.coffee-stage {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 10px;
  padding: 18px;
  min-height: 290px;
  aspect-ratio: auto;
  background: radial-gradient(ellipse at 50% 35%, #3c6652, #152d27 74%);
}
.ticket { text-align: center; }
.ticket p, #summary { margin: 0; color: var(--soft); }
.ticket h2 { font-size: clamp(1.55rem, 5vw, 2.7rem); margin: .2rem 0 .65rem; }
#layers { position: absolute; inset: 0; display: flex; flex-direction: column-reverse; justify-content: start; }
#layers span { background: var(--fill); min-height: var(--height); }
#ice { position: absolute; inset: 33% 9px auto; display: flex; gap: 4px; }
#ice i { width: 25px; height: 25px; border-radius: 5px; transform: rotate(19deg); border: 2px solid #e8faffaa; background: #b7eafa88; }
#ice i:nth-child(2) { transform: translateY(-13px) rotate(-14deg); }
#summary { font-size: .88rem; text-align: center; }
#coffee fieldset { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
#coffee legend { font-weight: 700; padding: 0 0 6px; }
.choices, .coffee-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.choices label, .syrup select { padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 9px; background: #682940; }
.choices label { cursor: pointer; }
.choices input { margin: 0 4px 0 0; accent-color: var(--gold); }
.syrup select { color: inherit; font: inherit; margin-left: 6px; }
.coffee-actions { margin-top: 14px; }
#serve, #next { background: var(--gold); color: #481b2d; }
#serve:disabled { opacity: .55; cursor: default; }
#feedback { margin: .65rem 0 0; }
#feedback:empty { display: none; }

#cup-preview { display: grid; justify-items: center; width: 100%; }
#cup-preview #summary { margin-top: 8px; }
#start-game { background: var(--gold); color: #481b2d; margin-bottom: .4rem; }
.barista-line { font-weight: 700; }
.barista {
  position: relative;
  width: 116px;
  height: 126px;
  margin-top: 6px;
  perspective: 450px;
}
.barista-head, .barista-body {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.barista-head {
  top: 0;
  z-index: 1;
  width: 55px;
  height: 61px;
  border-radius: 48% 48% 40% 40%;
  background: radial-gradient(ellipse at 55% 24%, #533126, #241711 75%);
}
.barista-body {
  bottom: 0;
  width: 106px;
  height: 72px;
  border-radius: 46px 46px 12px 12px;
  background: linear-gradient(100deg, #cad4bb, #f6edce 45%, #b3bda5);
  overflow: hidden;
}
.barista-apron {
  position: absolute;
  inset: 8px 27px 0;
  background: repeating-linear-gradient(45deg, transparent 0 22px, #493025 22px 28px, transparent 28px 44px), repeating-linear-gradient(-45deg, transparent 0 24px, #493025 24px 30px, transparent 30px 44px);
}
.barista.facing { animation: barista-turn .58s ease both; }
.facing .barista-head {
  background: radial-gradient(circle at 34% 51%, #38241e 0 2px, transparent 3px), radial-gradient(circle at 66% 51%, #38241e 0 2px, transparent 3px), linear-gradient(#38241e 0 24%, #d69b72 25% 100%);
}
.facing .barista-face {
  position: absolute;
  left: 37%;
  top: 58%;
  width: 26%;
  height: 24%;
  border-bottom: 2px solid #743f31;
  border-radius: 50%;
}
.facing .barista-apron {
  inset: 0 25px;
  background: linear-gradient(90deg, #503126 12%, transparent 12% 88%, #503126 88%) top / 100% 34% no-repeat, linear-gradient(#785041, #422820) bottom / 100% 68% no-repeat;
}
@keyframes barista-turn {
  from { transform: rotateY(180deg); }
  to { transform: rotateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .barista.facing { animation: none; }
}


.coffee-stage {
  background: radial-gradient(ellipse at 49% 0%, #a96e83, transparent 58%),
    repeating-linear-gradient(90deg, #ffffff05 0 1px, transparent 1px 33px), #4c192f;
}
.barista-head { box-shadow: inset 7px 2px 10px #ffdbc642, inset -7px -4px 9px #17090375, 0 5px 12px #06130c6b; }
.barista-body { box-shadow: inset 12px 0 15px #fff8, inset -13px -2px 16px #202b2373, 0 8px 14px #06130c6b; }

.countertop {
  --cup-center: calc(50% - 48px);
  --bin-center: calc(50% + 66px);
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 169px;
}
.countertop::before {
  content: '';
  position: absolute;
  inset: 58% 0 0;
  border-radius: 50% 50% 13px 13px / 23% 23% 13px 13px;
  background: repeating-linear-gradient(174deg, #ad79572b 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #ba855e, #62412e 73%, #3e261d);
  box-shadow: 0 9px 15px #08150f80, inset 0 2px #fcd7a85c;
}
.saucer {
  position: absolute;
  bottom: 14px;
  left: var(--cup-center);
  transform: translateX(-50%);
  width: 132px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #8b7057 20%, #d6c4a5 46%, #fff2ce 64%, #ac8864 84%);
  box-shadow: 4px 6px 10px #24120b99;
}
.cup-motion {
  position: absolute;
  z-index: 2;
  left: calc(var(--cup-center) - 44px);
  bottom: 27px;
  width: 88px;
  height: 103px;
}
.coffee-cup {
  position: absolute;
  inset: 0;
  border-radius: 12px 12px 31px 31px;
  border: 2px solid #e7eee29c;
  background: linear-gradient(90deg, #d5f5e633, #ebf9ed45 14%, #e3f5ec12 62%, #091d1780);
  box-shadow: inset -4px -5px 8px #102b2178, 4px 6px 9px #1b160e75;
  overflow: hidden;
}
.coffee-cup::before {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  height: 13px;
  border: 2px solid #efffebe0;
  border-radius: 50%;
  background: radial-gradient(ellipse, #142e284d, #eaffeb35);
  box-shadow: 0 3px 5px #2b211555;
}
.coffee-cup::after {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 16px 69% 12px 9%;
  border-radius: 50%;
  background: linear-gradient(90deg, #fff6, transparent);
  pointer-events: none;
}
.cup-handle {
  position: absolute;
  left: 79px;
  top: 26px;
  width: 34px;
  height: 45px;
  border: 6px solid #d8e9daa8;
  border-radius: 0 50% 55% 0;
  box-shadow: inset 2px 2px 5px #1c291f9c, 3px 3px 5px #1a251b70;
}
#layers span { background: linear-gradient(90deg, #fff3, transparent 55%, #31150957), var(--fill); }
#ice i { box-shadow: inset 2px 2px 5px #efffffaa, inset -3px -4px 6px #39748e77; }

.coffee-bin {
  position: absolute;
  left: calc(var(--bin-center) - 34px);
  bottom: 13px;
  width: 68px;
  height: 76px;
  border-radius: 6px 6px 19px 19px;
  background: repeating-linear-gradient(90deg, transparent 0 10px, #1f262651 10px 12px),
    linear-gradient(90deg, #495955, #b0c1ba 27%, #92a39b 54%, #394644);
  box-shadow: inset -3px -5px 8px #19292a88, 5px 7px 11px #140e0ab8;
}
.coffee-bin::before, .bin-lid {
  position: absolute;
  content: '';
  left: -2px;
  right: -2px;
  top: -11px;
  height: 24px;
  border-radius: 50%;
}
.coffee-bin::before { background: radial-gradient(ellipse, #080d0d 47%, #273836 57%, #b3c5b9 69%); }
.bin-lid {
  background: radial-gradient(ellipse at 45% 25%, #d3e0d9, #677b74 56%, #253936 94%);
  box-shadow: 0 3px 4px #142722b8;
  transform-origin: right center;
}
.bin-label {
  position: absolute;
  inset: 29px 13px auto;
  border-radius: 4px;
  background: #1a302c;
  color: #f7efe0;
  text-align: center;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .07em;
}
.pour-stream {
  position: absolute;
  z-index: 3;
  left: calc(var(--bin-center) - 9px);
  bottom: 76px;
  width: 15px;
  height: 52px;
  border-radius: 45%;
  background: linear-gradient(90deg, #3b160b, #c3804b 45%, #653018);
  box-shadow: 0 0 9px #d8944b85;
  transform-origin: 50% 100%;
  opacity: 0;
}
.discard .cup-motion { animation: tip-cup 1.65s ease-in-out both; }
.discard .bin-lid { animation: bin-open 1.65s ease both; }
.discard .pour-stream { animation: pour 1.65s ease both; }
@keyframes tip-cup {
  35%, 68% { transform: translate(67px, -47px) rotate(111deg); }
}
@keyframes bin-open {
  24%, 79% { transform: translate(11px, -24px) rotate(67deg); }
}
@keyframes pour {
  30% { opacity: 0; transform: scaleY(.15); }
  38%, 68% { opacity: 1; transform: scaleY(1); }
  77% { opacity: 0; transform: scaleY(.2); }
}
.success .cup-motion { animation: toast-cup .8s ease both; }
@keyframes toast-cup { 44% { transform: translateY(-14px) rotate(-7deg); } }
#confetti { position: absolute; z-index: 4; left: 50%; top: 55%; pointer-events: none; }
#confetti i {
  position: absolute;
  width: 9px;
  height: 13px;
  border-radius: 2px;
  background: linear-gradient(140deg, #fff9, transparent 58%), var(--color);
  box-shadow: 0 2px 4px #121c1766;
  animation: confetti-burst 1.48s var(--delay) ease-out both;
}
#confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
@keyframes confetti-burst {
  0% { opacity: 0; transform: scale(.2); }
  12%, 66% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 47px)) rotate(var(--spin)); }
}
#feedback { font-weight: 750; text-align: center; }
.success #feedback { color: #b7fad4; }
.discard #feedback, #shot-error { color: #ffd1ad; }
#shot-error:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .discard .cup-motion, .discard .bin-lid, .discard .pour-stream, .success .cup-motion, #confetti i { animation: none; }
  .discard .bin-lid { transform: translate(11px, -24px) rotate(67deg); }
  .discard .pour-stream { opacity: 1; }
  #confetti i { transform: translate(calc(var(--x) * .73), calc(var(--y) * .6)); }
}
