body { background: #7fd9cc; }
#choose { background: #7fd9cc url("/games/_shared/lagoon.svg") center bottom / cover no-repeat; }
.sign { display: grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 50%; font-size: clamp(44px, 8vw, 92px); font-weight: 700; line-height: 1; background: var(--cream); }

.play { display: grid; grid-template-columns: minmax(0, 1.76fr) minmax(300px, 1fr); background: #7fd9cc url("/games/_shared/lagoon.svg") center bottom / cover no-repeat; }
#play ~ * { z-index: 1; }

/* ---------- The stall ---------- */
.stall { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; grid-template-rows: clamp(44px, 13vh, 112px) minmax(0, 1fr) minmax(0, 1.02fr); min-height: 0; padding: max(14px, env(safe-area-inset-top)) 12px 0 max(16px, env(safe-area-inset-left)); }
.awning { position: relative; z-index: 3; border-top: 22px solid #c9405b; border-radius: 12px 12px 0 0; --u: calc(100% / 5);
  background: linear-gradient(90deg, var(--coral) 50%, var(--cream) 50%) 0 0 / var(--u) 100%;
  -webkit-mask: radial-gradient(ellipse 50% 46% at 50% 54%, #000 99%, transparent) 0 0 / 10% 100%, linear-gradient(#000 0 0) 0 0 / 100% 56% no-repeat;
  mask: radial-gradient(ellipse 50% 46% at 50% 54%, #000 99%, transparent) 0 0 / 10% 100%, linear-gradient(#000 0 0) 0 0 / 100% 56% no-repeat;
  -webkit-mask-origin: border-box; mask-origin: border-box; -webkit-mask-clip: border-box; mask-clip: border-box; }
.inside { position: relative; z-index: 1; margin: -70px 24px 0; padding-top: 70px; background: #0f6e66; border: solid #8a4637; border-width: 0 20px; min-height: 0; overflow: hidden; container-type: size; }
.inside::after { content: ""; position: absolute; left: 0; right: 0; bottom: 26%; height: 10px; background: #0b5751; }
.bulbs { position: absolute; z-index: 1; left: 3%; right: 3%; top: 88px; display: flex; justify-content: space-between; border-top: 4px solid var(--ink); }
.bulb { position: relative; width: 24px; width: clamp(18px, 4.5cqw, 28px); aspect-ratio: 1; border-radius: 50%; background: #0b5751; border: 3px solid #3b9b90; margin-top: 5px; transition: background .3s, box-shadow .3s; }
.bulb::before { content: ""; position: absolute; left: 50%; top: -10px; width: 11px; height: 10px; translate: -50% 0; background: var(--ink); }
.bulb.lit { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 9px rgb(255 226 138 / .4); }
.customer, .shop-pip { position: absolute; z-index: 2; bottom: -8%; }
.customer { left: 9%; width: min(38%, 38vh); width: min(40cqw, 70cqh); }
.customer img { width: 100%; }
.shop-pip { right: 8%; width: min(36%, 36vh); width: min(38cqw, 66cqh); }

.counter { position: relative; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; justify-items: center; gap: 8px; min-height: 0; padding: 40px 12px max(18px, env(safe-area-inset-bottom)); margin: 0 10px; background: linear-gradient(#d9825b 72%, #bf6847 72%); }
.counter::before { content: ""; position: absolute; left: -10px; right: -10px; top: 0; height: 30px; border-radius: 15px; background: var(--apricot); }
.tray { width: 100%; min-width: 0; min-height: 0; padding: 22px 8px 4px; display: grid; grid-template-columns: repeat(var(--across, 1), auto); align-content: center; justify-content: center; justify-items: center; align-items: center; gap: 14px; cursor: pointer; }
.tray-add { gap: 30px; align-items: start; }
.group { display: grid; grid-template-columns: repeat(var(--cols, 5), var(--size)); gap: var(--unit-gap, 0); justify-content: center; }
.unit { position: relative; width: var(--size); height: var(--size); display: grid; place-items: center; place-content: center; border-radius: 26%; }
.unit img { width: 92%; pointer-events: none; transition: opacity .25s; }
.unit.snack img { width: calc(var(--size) * .92); }
.unit.plate { grid-template-columns: repeat(var(--on), calc(62% / var(--on))); border-radius: 50%; background: var(--cream); box-shadow: 0 5px 0 #a8583c, inset 0 0 0 calc(var(--size) * .06) #ffe3c2; }
.unit.plate img { width: 100%; }
.unit.pack::before { content: ""; position: absolute; inset: 3%; border-radius: 20%; background: linear-gradient(#fff1d0 0 24%, #f0b978 24%); box-shadow: 0 3px 0 #8a4637; }
.unit.pack img { position: absolute; left: 50%; top: 4%; width: 42%; translate: -50% 0; }
.unit.pack b { position: relative; margin-top: 42%; font-size: calc(var(--size) * .4); line-height: 1; pointer-events: none; }
.unit.new-row { grid-column-start: 1; }
.unit.counted { background-color: var(--gold); }
.unit.pack.counted::before { background: linear-gradient(#fff1d0 0 24%, var(--gold) 24%); }
.unit.eaten { opacity: .3; filter: grayscale(1); }
.unit.served { opacity: 0; transition: opacity .25s .1s; }
.unit[data-n]::after { content: attr(data-n); position: absolute; z-index: 3; left: 50%; top: 0; translate: -50% -42%; min-width: 1.6em; height: 1.6em; padding: 0 .25em; display: grid; place-items: center; border-radius: 1em; background: var(--accent); color: #fff; border: 2px solid #fff; font-size: clamp(16px, calc(var(--size) * .3), 28px); font-weight: 700; line-height: 1; pointer-events: none; animation: pop-in .25s; }
/* On a box, the count sits on the corner so the picture still shows. */
.unit.pack[data-n]::after { left: 92%; translate: -50% -38%; }
.none { font-size: clamp(40px, 10vmin, 110px); font-weight: 700; line-height: 1; opacity: .5; }
.order { min-height: 52px; padding: 6px 28px; border-radius: 26px; background: var(--cream); font-size: clamp(20px, 2.5vw, 28px); font-weight: 700; box-shadow: 0 6px 0 #8a4637; }
.order:active { transform: translateY(4px); box-shadow: 0 2px 0 #8a4637; }

/* ---------- Sum and number keys ---------- */
.till { container-type: inline-size; position: relative; display: grid; grid-template-rows: auto auto; align-content: center; gap: clamp(14px, 3vh, 28px); padding: 96px max(24px, env(safe-area-inset-right)) 24px 12px; }
.sum { display: flex; align-items: center; justify-content: center; gap: clamp(6px, 1vw, 12px); min-height: clamp(74px, 13vh, 116px); padding: 8px 14px; border-radius: 30px; background: var(--cream); box-shadow: 0 8px 0 #b5563a; font-size: min(54px, 8vh); font-size: min(72px, 8.5vh, calc((100cqw - 70px) / var(--wide, 8))); font-weight: 700; line-height: 1; white-space: nowrap; transition: background .2s; }
.sum.right { background: #c5f5d8; }
.boxes { display: flex; gap: 6px; }
.box { display: grid; place-items: center; width: 1.12em; height: 1.4em; border-radius: 16px; background: #fff; border: 5px solid #84729a; }
.box.now { border-color: var(--accent); }
.sum.right .box { border-color: #15803d; }
.ghost { color: #857799; }
.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 132px)); justify-content: center; gap: clamp(12px, 2.4vh, 20px) 14px; }
.pad .key { height: clamp(48px, 10.4vh, 108px); border-radius: 24px; font-size: clamp(30px, 4vw, 46px); box-shadow: 0 8px 0 #b5563a; }
.pad .key.glow { box-shadow: 0 8px 0 var(--gold-edge), 0 0 0 8px rgb(255 226 138 / .75); }
.pad .key-back { background: var(--apricot); }
.home-btn { left: auto; right: max(100px, calc(env(safe-area-inset-right) + 84px)); }
body:has(#play[hidden]) .home-btn { left: max(20px, env(safe-area-inset-left)); right: auto; }

/* ---------- Tall screens: stall on top, keys below ---------- */
@media (max-aspect-ratio: 1/1) {
  .play { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .stall { padding-top: 100px; padding-right: 16px; grid-template-rows: clamp(54px, 9vh, 112px) minmax(0, .9fr) minmax(0, 1.1fr); }
  .till { padding: 18px 16px max(20px, env(safe-area-inset-bottom)); gap: 18px; }
  .sum { justify-self: center; min-width: min(100%, 420px); min-height: 78px; }
  .pad { grid-template-columns: repeat(6, minmax(0, 112px)); gap: 16px clamp(6px, 1.6vw, 14px); }
  .pad .key { height: clamp(54px, 7.4vh, 88px); }
  .key-0 { order: 1; }
  .key-back { order: 2; }
  .home-btn { left: max(20px, env(safe-area-inset-left)); right: auto; }
}
@media (max-width: 480px) {
  .stall { padding: 90px 6px 0; }
  .inside { margin-inline: 12px; border-width: 0 12px; }
  .counter { margin: 0 4px; padding: 34px 4px 12px; }
  .pad .key { border-radius: 16px; }
  .till { padding-top: 14px; gap: 14px; }
  .sum { min-height: 66px; }
  .box { border-width: 4px; border-radius: 12px; }
}
@media (max-height: 500px) {
  .till { padding: 70px 16px 8px 8px; gap: 10px; }
  .sum { min-height: 48px; border-radius: 20px; }
  .pad { grid-template-columns: repeat(6, minmax(0, 60px)); gap: 12px 6px; }
  .key-0 { order: 1; }
  .key-back { order: 2; }
  .round-btn { width: 48px; height: 48px; }
  .counter { padding: 22px 6px 8px; }
  .counter::before { height: 18px; }
  .order { min-height: 44px; font-size: 18px; }
  .tray { padding-top: 10px; }
  .bulbs { top: 72px; }
}
