/* Cup Catch: 1986 neon beach cabinet. Play-for-fun page, no network, no scripts inline. */
:root {
  --bg: #070114;
  --pink: #FF3CAC;
  --teal: #2AF5E4;
  --gold: #FFD166;
  --yellow: #FFE14D;
  --orange: #FF7A45;
  --foam: #FFF4FA;
  --ink: #160430;
  --board-w: min(100%, 520px, calc((100vh - 250px) * 0.6429));
}
@supports (height: 100dvh) {
  :root { --board-w: min(100%, 520px, calc((100dvh - 250px) * 0.6429)); }
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg); color: var(--foam);
  font-family: "Archivo", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body { min-height: 100vh; }
body.is-playing { overflow: hidden; overscroll-behavior: none; height: 100%; }
[hidden] { display: none !important; }

.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;
}

/* ---------- sunset backdrop ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,122,69,.28) 0%, rgba(255,60,172,.22) 28%, transparent 56%),
    linear-gradient(180deg, #09011D 0%, #24064E 46%, #3A0A5E 58%, #070116 100%);
}
.backdrop__sun {
  position: absolute; left: 50%; top: 8%; width: min(70vw, 460px); height: min(70vw, 460px);
  transform: translateX(-50%); border-radius: 50%;
  background: repeating-linear-gradient(180deg, #FFD166 0 14%, #FF7A45 14% 28%, #FF3CAC 28% 40%, transparent 40% 46%);
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 78%);
  mask-image: linear-gradient(180deg, #000 30%, transparent 78%);
  opacity: .5;
}
.backdrop__grid {
  position: absolute; left: -20%; right: -20%; bottom: 0; height: 36%;
  background:
    repeating-linear-gradient(90deg, rgba(42,245,228,.28) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(0deg, rgba(42,245,228,.22) 0 2px, transparent 2px 34px);
  transform: perspective(300px) rotateX(58deg); transform-origin: 50% 100%;
  opacity: .5;
}

.stage {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 10px 10px 18px;
}

/* ---------- the one honest line ---------- */
.fun-note {
  width: 100%; margin: 0; padding: 7px 12px; border-radius: 14px; text-align: center;
  border: 2px solid rgba(255,209,102,.7); background: rgba(14,3,34,.92);
  box-shadow: 0 0 18px rgba(255,209,102,.25);
  font-size: .9rem; line-height: 1.35; font-weight: 700; color: var(--foam);
}
.fun-note a { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, .board__canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- cabinet bezel (matches the Thirsty Maze box) ---------- */
.cabinet {
  position: relative; width: 100%; text-align: center;
  padding: 12px 12px 10px; border-radius: 24px;
  background: linear-gradient(180deg, #24064B 0%, #120229 55%, #090118 100%);
  border: 3px solid rgba(42,245,228,.75);
  box-shadow: 0 0 0 3px rgba(255,60,172,.45), 0 24px 64px rgba(0,0,0,.85), 0 0 46px rgba(42,245,228,.32), inset 0 2px 14px rgba(255,255,255,.14);
}
.cabinet::before {
  content: ""; position: absolute; left: 18px; right: 18px; top: -2px; height: 4px; border-radius: 999px;
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--teal), var(--yellow));
  box-shadow: 0 0 18px rgba(255,60,172,.8);
}
.cabinet__head { margin-bottom: 6px; }
.cabinet__kicker {
  display: block; font-family: "DM Mono", monospace; font-size: .62rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--teal);
}
.cabinet__title {
  margin: 2px 0 0; font-family: "Bungee", sans-serif; font-weight: 400; line-height: 1.1;
  font-size: clamp(1.5rem, 6vw, 2.1rem); letter-spacing: .04em; text-transform: uppercase;
  color: var(--yellow); text-shadow: 0 0 20px rgba(255,225,77,.6), 3px 3px 0 var(--pink);
}

/* ---------- HUD ---------- */
.hud {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  width: var(--board-w); margin: 0 auto 8px; padding: 6px 8px; border-radius: 10px;
  background: rgba(5,0,16,.88); border: 1px solid rgba(42,245,228,.4);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.8);
}
.hud__cell { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.hud__label {
  font-family: "DM Mono", monospace; font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(246,241,255,.7);
}
.hud__val {
  font-family: "Bungee", sans-serif; font-size: 1.05rem; color: var(--teal);
  text-shadow: 0 0 10px rgba(42,245,228,.7); line-height: 1.2;
}
.hearts { display: inline-flex; gap: 3px; align-items: center; min-height: 20px; }
.heart {
  display: inline-block; width: 18px; height: 16px; background: var(--pink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 18'%3E%3Cpath d='M10 17C-4 7 3-1 10 4c7-5 14 3 0 13z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 18'%3E%3Cpath d='M10 17C-4 7 3-1 10 4c7-5 14 3 0 13z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 4px rgba(255,60,172,.9));
}
.heart.is-lost { background: rgba(255,255,255,.18); filter: none; }

/* ---------- board ---------- */
.board {
  position: relative; width: var(--board-w); margin: 0 auto;
  aspect-ratio: 9 / 14; border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 3px rgba(148,163,184,.7), 0 0 0 5px #090118, 0 0 36px rgba(42,245,228,.28), 0 0 48px rgba(255,60,172,.26);
  background: #1B0538;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.board__canvas {
  display: block; width: 100%; height: 100%;
  touch-action: none; cursor: ew-resize;
}
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 14px; background: rgba(7,1,20,.78);
  touch-action: none;
}
.overlay__card {
  width: 100%; max-width: 340px; padding: 16px 14px 18px; border-radius: 18px;
  background: linear-gradient(180deg, #2B0954, #120229);
  border: 2px solid var(--teal);
  box-shadow: 0 0 0 2px rgba(255,60,172,.5), 0 0 30px rgba(42,245,228,.35);
}
.overlay__title {
  margin: 0 0 10px; font-family: "Bungee", sans-serif; font-weight: 400;
  font-size: 1.7rem; text-transform: uppercase; color: var(--yellow);
  text-shadow: 0 0 18px rgba(255,225,77,.6), 3px 3px 0 var(--pink);
  animation: titlePulse 2.4s ease-in-out infinite alternate;
}
@keyframes titlePulse { from { text-shadow: 0 0 10px rgba(255,225,77,.4), 3px 3px 0 var(--pink); } to { text-shadow: 0 0 26px rgba(255,225,77,.9), 3px 3px 0 var(--pink); } }
.overlay__tips { list-style: none; margin: 0 0 14px; padding: 0; text-align: left; font-size: .92rem; line-height: 1.35; }
.overlay__tips li { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 9px; }
.tip {
  flex: 0 0 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; color: #fff;
}
.tip--good { background: #1FBF6A; box-shadow: 0 0 10px rgba(124,255,178,.8); }
.tip--bad { background: #E02D4B; }
.tip--move { background: #6B32D6; }
.overlay__score { margin: 0 0 2px; font-family: "Bungee", sans-serif; font-size: 1.15rem; color: var(--foam); }
.overlay__score strong { color: var(--teal); font-size: 1.7rem; font-weight: 400; }
.overlay__best, .overlay__meta {
  margin: 0 0 6px; font-family: "DM Mono", monospace; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
}
.overlay__meta { color: rgba(246,241,255,.75); margin-bottom: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  min-height: 44px; min-width: 44px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font-family: "Bungee", sans-serif; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--foam); background: linear-gradient(180deg, #2B0954, #120229);
  border: 2px solid var(--teal); box-shadow: 0 0 16px rgba(42,245,228,.3);
}
.btn:hover { color: #fff; border-color: var(--yellow); box-shadow: 0 0 20px rgba(255,225,77,.5); }
.btn:active { transform: translateY(2px); }
.btn[aria-pressed="false"] { border-color: rgba(246,241,255,.45); color: rgba(246,241,255,.7); box-shadow: none; }
.btn--big {
  min-height: 56px; padding: 10px 34px; font-size: 1.1rem; color: var(--ink);
  background: linear-gradient(180deg, var(--yellow), var(--orange)); border-color: #fff;
  box-shadow: 0 0 24px rgba(255,122,69,.7), 0 4px 0 #8A2A10;
}
.btn--big:hover { color: var(--ink); border-color: var(--pink); }
.bar { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.btn--link { font-size: .72rem; padding: 8px 14px; }
.noscript { margin: 8px 0 0; color: var(--gold); font-weight: 700; }

@media (max-width: 420px) {
  .stage { padding: 8px 8px 14px; gap: 8px; }
  .cabinet { padding: 10px 8px 8px; }
  .overlay__tips { font-size: .86rem; }
  .btn--link { font-size: .68rem; padding: 8px 10px; }
}
@media (min-width: 1000px) and (min-height: 1200px) {
  :root { --board-w: min(100%, 800px, calc((100vh - 330px) * 0.6429)); }
  .stage { max-width: 900px; }
  .fun-note { font-size: 1.1rem; }
  .hud__val { font-size: 1.4rem; }
  .hud__label { font-size: .75rem; }
  .overlay__card { max-width: 480px; }
  .overlay__tips { font-size: 1.15rem; }
  .overlay__title { font-size: 2.3rem; }
  .btn { font-size: 1rem; min-height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .overlay__title { animation: none; }
  .btn:active { transform: none; }
  html { scroll-behavior: auto; }
}
