/* Thirsty Beaches: Soft Serve Stacker. 1986 neon beach cabinet, same palette and fonts as the Thirsty Maze and Drink Slots pages. */
:root {
  --bg: #070114;
  --pink: #FF3CAC;
  --teal: #2AF5E4;
  --gold: #FFD166;
  --orange: #FF7A45;
  --foam: #FFF4FA;
  --ink: #160430;
  --chrome: 318px;   /* page height used by everything except the board (title, note, HUD, buttons, links) */
  --bw: max(220px, min(calc(100vw - 56px), 440px, calc((100vh - var(--chrome)) * 0.6)));
}
@supports (height: 100dvh) {
  :root { --bw: max(220px, min(calc(100vw - 56px), 440px, calc((100dvh - var(--chrome)) * 0.6))); }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--foam);
  font-family: "Archivo", system-ui, sans-serif;
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body { position: relative; min-height: 100vh; }
/* while a round is running nothing on the page may scroll or zoom */
body.is-playing { touch-action: none; user-select: none; -webkit-user-select: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 1986 sunset backdrop ---------- */
.backdrop {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, rgba(255,122,69,0.28) 0%, rgba(255,60,172,0.2) 28%, transparent 58%),
    linear-gradient(180deg, #09011D 0%, #24064E 50%, #3A0A5E 64%, #070116 100%);
}
.backdrop__sun {
  position: absolute; left: 50%; top: 8%; width: min(70vw, 460px); height: min(70vw, 460px);
  transform: translateX(-50%); border-radius: 50%; opacity: 0.38;
  background: repeating-linear-gradient(to bottom,
    #FFD166 0%, #FFD166 54%, transparent 54%, transparent 57%,
    #FF7A45 57%, #FF7A45 66%, transparent 66%, transparent 70%,
    #FF3CAC 70%, #FF3CAC 80%, transparent 80%, transparent 85%,
    #D61A86 85%, #D61A86 100%);
  box-shadow: 0 0 90px rgba(255,60,172,0.5), 0 0 150px rgba(255,209,102,0.25);
}
.backdrop__grid {
  position: absolute; left: -24%; right: -24%; bottom: -14%; height: 40%;
  background-image:
    linear-gradient(to right, rgba(42,245,228,0.3) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,60,172,0.36) 1px, transparent 1px);
  background-size: 48px 34px;
  transform: perspective(360px) rotateX(64deg); transform-origin: bottom center; opacity: 0.55;
}

/* ---------- Page frame ---------- */
.stage {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 10px 12px 18px; max-width: 100vw;
}
.marquee { text-align: center; margin: 0; }
.marquee__kicker {
  margin: 0; font-family: "DM Mono", monospace; font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--teal); text-shadow: 0 0 10px rgba(42,245,228,0.7);
}
.marquee__title {
  margin: 2px 0 0; font-family: "Bungee", Impact, sans-serif; font-weight: 400; line-height: 1.05;
  font-size: clamp(1.45rem, 7.2vw, 2.4rem); letter-spacing: 0.02em;
  background: linear-gradient(180deg, #FFFFFF 0%, #CFEFFF 34%, #7FD8FF 46%, #243B8F 52%, #7FD8FF 60%, #FF9ADF 78%, #FF3CAC 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(90,10,80,0.65)) drop-shadow(0 0 16px rgba(42,245,228,0.35));
}
.fun-note {
  margin: 0; width: min(100%, 560px); padding: 7px 12px; border-radius: 14px; text-align: center;
  border: 2px solid rgba(255,209,102,0.7); background: rgba(14,3,34,0.92); box-shadow: 0 0 16px rgba(255,209,102,0.22);
  font-size: 0.82rem; line-height: 1.3; font-weight: 700; color: var(--foam);
}
.fun-note a { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; display: inline-block; padding: 8px 2px; margin: -8px 0; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.board:focus { outline: none; }
body:not(.is-playing) .board:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* narrow screens: one column, cabinet first, then the links, then the help panels */
.layout { display: contents; }
.cabinet { order: 1; }
.links { order: 2; }
.side { order: 3; }

/* ---------- Cabinet ---------- */
.cabinet {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 12px 12px; border-radius: 22px;
  background: linear-gradient(180deg, #3B0D72 0%, #26084F 45%, #160436 100%);
  border: 3px solid rgba(42,245,228,0.75);
  box-shadow: 0 0 0 3px rgba(255,60,172,0.45), 0 18px 48px rgba(0,0,0,0.8), 0 0 40px rgba(42,245,228,0.3), inset 0 2px 12px rgba(255,255,255,0.14);
}
.cabinet__bulbs {
  position: absolute; left: 22px; right: 22px; top: 3px; height: 8px;
  background: radial-gradient(circle, #FFD166 2.2px, rgba(255,209,102,0) 3.4px) 0 50% / 16px 8px repeat-x;
  filter: drop-shadow(0 0 4px rgba(255,209,102,0.9)); animation: bulbs 1.6s steps(2, end) infinite;
}
@keyframes bulbs { 50% { opacity: 0.45; } }

.hud {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: var(--bw); margin: 0;
  padding: 6px 8px; border-radius: 10px; background: rgba(5,0,16,0.88);
  border: 1px solid rgba(42,245,228,0.4); box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}
.hud__cell { text-align: center; min-width: 0; }
.hud dt {
  font-family: "DM Mono", monospace; font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--teal);
  text-shadow: 0 0 8px rgba(42,245,228,0.6);
}
.hud dd {
  margin: 0; font-family: "Bungee", Impact, sans-serif; font-size: 1.25rem; line-height: 1.15; color: var(--gold);
  text-shadow: 0 0 12px rgba(255,209,102,0.6); font-variant-numeric: tabular-nums;
}

.board {
  position: relative; width: var(--bw); aspect-ratio: 3 / 5; border-radius: 12px; overflow: hidden;
  border: 3px solid rgba(148,163,184,0.7);
  box-shadow: 0 0 0 2px #090118, 0 0 30px rgba(42,245,228,0.25), 0 0 40px rgba(255,60,172,0.22);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer;
}
.board__canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---------- Overlay cards ---------- */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px;
  background: radial-gradient(circle at 50% 60%, rgba(7,1,20,0.15), rgba(7,1,20,0.62)); touch-action: none;
}
.card {
  width: 100%; max-width: 280px; padding: 14px 14px 12px; text-align: center; border-radius: 18px;
  background: linear-gradient(180deg, rgba(36,6,75,0.94), rgba(14,2,36,0.95));
  border: 2px solid rgba(42,245,228,0.7); box-shadow: 0 0 0 2px rgba(255,60,172,0.4), 0 14px 36px rgba(0,0,0,0.7), 0 0 28px rgba(42,245,228,0.3);
}
.card__kicker {
  margin: 0 0 6px; font-family: "Bungee", Impact, sans-serif; font-size: 1.05rem; color: var(--gold); text-shadow: 0 0 14px rgba(255,209,102,0.6);
}
.card__text { margin: 0 0 10px; font-size: 0.86rem; line-height: 1.35; color: rgba(255,244,250,0.88); }
.card__hint { margin: 8px 0 0; font-family: "DM Mono", monospace; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,244,250,0.65); }
.card__rank {
  margin: 0 0 4px; font-family: "Bungee", Impact, sans-serif; font-size: 1.5rem; line-height: 1.1; color: var(--foam);
  text-shadow: 0 0 16px rgba(255,60,172,0.85);
}
.card__new { margin: 0 0 6px; font-family: "Bungee", Impact, sans-serif; font-size: 0.9rem; color: var(--teal); text-shadow: 0 0 12px rgba(42,245,228,0.8); }
.card__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0 12px; }
.card__stats dt { font-family: "DM Mono", monospace; font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--teal); }
.card__stats dd { margin: 0; font-family: "Bungee", Impact, sans-serif; font-size: 1.3rem; color: var(--gold); }

/* the result card sits high so the pile in the sand stays visible below it */
.overlay--over { align-items: flex-start; padding-top: 12%; }

/* ---------- Buttons (44px minimum targets) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0.55rem 1.1rem;
  font-family: "Bungee", Impact, sans-serif; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  color: var(--foam); border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, #2B0954, #120229); border: 2px solid var(--teal); box-shadow: 0 0 16px rgba(42,245,228,0.35);
  transition: transform 0.08s ease-out, box-shadow 0.12s;
}
.btn:hover { border-color: var(--gold); box-shadow: 0 0 20px rgba(255,209,102,0.5); }
.btn:active { transform: scale(0.96); }
.btn--go {
  min-width: 150px; min-height: 52px; font-size: 1.05rem; color: var(--ink);
  background: linear-gradient(180deg, #FFE98A, #FFD166 55%, #FF9A4D); border-color: var(--foam); box-shadow: 0 0 22px rgba(255,209,102,0.7), 0 4px 0 #8a3a14;
}
.btn--go:hover { color: var(--ink); border-color: #fff; box-shadow: 0 0 28px rgba(255,60,172,0.75), 0 4px 0 #8a3a14; }
.btn--small { min-width: 112px; }
.controls { display: flex; justify-content: center; gap: 10px; width: var(--bw); }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.btn--link { font-size: 0.72rem; padding: 0.5rem 0.9rem; }

/* ---------- Side panels (shown beside the cabinet on wide screens, below it otherwise) ---------- */
.side {
  width: min(100%, 560px); padding: 12px 14px; border-radius: 16px; background: rgba(14,3,34,0.82);
  border: 1px solid rgba(42,245,228,0.4); font-size: 0.88rem; line-height: 1.4; color: rgba(255,244,250,0.9);
}
.side__h { margin: 0 0 6px; font-family: "Bungee", Impact, sans-serif; font-weight: 400; font-size: 1rem; color: var(--gold); text-shadow: 0 0 12px rgba(255,209,102,0.55); }
.side__list { margin: 0; padding-left: 1.15rem; }
.side__list li { margin: 0 0 5px; }
.side strong { color: var(--teal); }

@media (min-width: 1100px) {
  :root { --chrome: 316px; }
  .stage { padding-top: 12px; }
  .marquee { display: flex; align-items: baseline; gap: 14px; }
  .marquee__title { font-size: 2rem; margin: 0; }
  .layout { display: flex; order: 0; flex-direction: row; justify-content: center; align-items: flex-start; gap: 28px; width: 100%; }
  .links { order: 1; }
  .side { align-self: center; width: 280px; flex: none; }
  .side--left { order: 0; }
  .cabinet { order: 1; }
  .side--right { order: 2; }
}

/* kiosk-style tall portrait screens (1080x1920): scale the cabinet up */
@media (min-width: 900px) and (min-height: 1300px) and (max-width: 1099px) {
  :root { --chrome: 520px; --bw: min(calc(100vw - 80px), 760px, calc((100dvh - var(--chrome)) * 0.6)); }
  .marquee__title { font-size: 3.4rem; }
  .marquee__kicker { font-size: 1rem; }
  .fun-note { font-size: 1.15rem; width: min(100%, 760px); padding: 12px 18px; }
  .hud dt { font-size: 0.9rem; }
  .hud dd { font-size: 2rem; }
  .btn { font-size: 1.1rem; min-height: 64px; }
  .btn--link { font-size: 1rem; }
  .card { max-width: 420px; padding: 22px; }
  .card__kicker { font-size: 1.5rem; }
  .card__text { font-size: 1.15rem; }
  .card__rank { font-size: 2.2rem; }
  .side { width: min(100%, 760px); font-size: 1.1rem; }
}

/* short landscape phones: shrink the board to what is left */
@media (max-height: 520px) { :root { --chrome: 170px; } .marquee__kicker { display: none; } }

/* Reduced motion: no flashing bulbs, no press animation. The canvas honours the same setting (no shake, flash, or sway). */
@media (prefers-reduced-motion: reduce) {
  .cabinet__bulbs { animation: none; }
  .btn, .btn:active { transition: none; transform: none; }
}
