/* Mission Control — landscape tablet, big touch targets, no external assets. */

:root {
  --bg1: #0b1030;
  --bg2: #1c2160;
  --ink: #ffffff;
  --ink-soft: #c9d0ff;
  --accent: #ff8a3d;
  --accent2: #ffb347;
  --go: #33c27a;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-line: rgba(255, 255, 255, 0.18);
  --dim: 0.32;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg1);
  color: var(--ink);
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 32% 72%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 54% 28%, #fff8c8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 72% 64%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 14%, #cfe2ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 86%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 46% 92%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 94% 82%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 46%, #fff 50%, transparent 51%),
    radial-gradient(ellipse at 30% 20%, #26307a 0%, transparent 60%),
    linear-gradient(160deg, var(--bg2), var(--bg1));
}

img, svg { -webkit-user-drag: none; }
svg.art { display: block; width: 100%; height: 100%; overflow: visible; }

.screen {
  position: fixed;
  inset: 0;
  display: none;
  touch-action: none;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.screen.active { display: flex; animation: fade-in .35s ease both; }

.btn {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: none;
  min-width: 96px;
  min-height: 96px;
  transition: transform .12s ease;
}
.btn.pressed { transform: scale(.95); }
.btn:focus { outline: none; }
.btn:focus-visible { outline: 4px solid #fff6b0; outline-offset: 4px; }

/* ---------- START ---------- */
#screen-start { align-items: center; justify-content: center; }
.start-wrap { display: flex; align-items: center; justify-content: center; }
.btn-start {
  position: relative;
  width: min(560px, 70vh);
  height: min(560px, 70vh);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 35%, #3a4aa8, #1b2470);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, .12), 0 20px 60px rgba(0, 0, 0, .45);
  animation: breathe 2.6s ease-in-out infinite;
}
.start-rocket { position: absolute; width: 22%; height: 34%; top: 8%; left: 50%; transform: translateX(-50%); }
.start-play { width: 44%; height: 44%; margin-top: 18%; }
.start-label { font-size: 52px; font-weight: 800; margin-top: 4%; letter-spacing: .5px; }

/* ---------- HOME ---------- */
#screen-home { flex-direction: column; align-items: center; }
.strip {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: 78px 120px;
  align-items: center;
  justify-items: center;
  padding: 0 8px;
}
.strip-line {
  position: absolute; left: 4%; right: 4%; top: calc(78px + 60px);
  height: 6px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 14px, transparent 14px 26px);
}
.strip-rocket {
  grid-row: 1;
  width: 46px; height: 76px;
  transform: rotate(90deg);
  filter: drop-shadow(0 0 10px rgba(255, 200, 120, .7));
  animation: bob 2s ease-in-out infinite;
}
.slot { grid-row: 2; position: relative; width: 112px; height: 112px; transition: opacity .3s; }
.slot.dim { opacity: var(--dim); filter: saturate(.3); }
.slot.here { filter: drop-shadow(0 0 16px rgba(255, 246, 176, .8)); }
.pad-slot { width: 96px; height: 96px; }
.lap-stars { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); display: flex; gap: 2px; }
.lap-stars .art { width: 22px; height: 22px; }

.btn-launch {
  margin-top: auto;
  margin-bottom: auto;
  width: 600px; max-width: 62vw;
  height: 440px; max-height: 56vh;
  border-radius: 64px;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  box-shadow: 0 14px 0 #c85a1c, 0 24px 60px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  animation: breathe 3s ease-in-out infinite;
}
.btn-launch.pressed { transform: translateY(8px) scale(.98); box-shadow: 0 6px 0 #c85a1c, 0 14px 40px rgba(0,0,0,.45); }
.launch-rocket { height: 56%; aspect-ratio: 100 / 170; }
.launch-label { font-size: 96px; line-height: 1; font-weight: 900; text-shadow: 0 4px 0 rgba(0, 0, 0, .2); }

.btn-collection {
  position: absolute; left: 24px; bottom: 24px;
  width: 170px; height: 170px;
  border-radius: 36px;
  background: var(--panel);
  border: 3px solid var(--panel-line);
  padding: 14px;
}

/* ---------- COUNTDOWN ---------- */
#screen-countdown { align-items: center; justify-content: center; }
.countdown-wrap { display: flex; align-items: center; justify-content: center; gap: 60px; }
.count-num { font-size: 380px; font-weight: 900; line-height: 1; color: #fff6b0; text-shadow: 0 0 40px rgba(255, 220, 120, .6); min-width: 260px; text-align: center; }
.count-num.pop { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.countdown-rocket { width: 170px; height: 290px; animation: shake .15s linear infinite; }

/* ---------- CALLING ---------- */
#screen-calling { align-items: center; justify-content: center; overflow: hidden; }
.calling-sky {
  position: absolute; inset: -50% 0 0 0;
  background:
    radial-gradient(2px 14px at 20% 10%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(2px 18px at 40% 40%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(2px 12px at 65% 20%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(2px 16px at 82% 60%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(2px 12px at 10% 70%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(2px 14px at 55% 80%, rgba(255,255,255,.6) 50%, transparent 51%);
  background-size: 100% 50%;
  animation: streak 1.2s linear infinite;
}
.calling-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.calling-rocket { width: 200px; height: 340px; animation: fly 2.4s ease-in-out infinite; }
.calling-text { font-size: 96px; font-weight: 900; margin-top: 10px; color: #fff6b0; text-shadow: 0 4px 0 rgba(0,0,0,.25); }
.flame { transform-origin: 50px 128px; animation: flicker .18s ease-in-out infinite alternate; }

.hold-target {
  position: absolute; right: 28px; bottom: 28px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  border: 3px dashed rgba(255, 255, 255, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  touch-action: none;
}
.hold-icon { width: 96px; height: 96px; }
.hold-label { font-size: 20px; font-weight: 700; color: var(--ink-soft); margin-top: 4px; text-align: center; line-height: 1.1; max-width: 140px; }
.hold-ring { position: absolute; inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); transform: rotate(-90deg); pointer-events: none; }
.hold-ring-track { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 6; }
.hold-ring-bar { fill: none; stroke: #ffd23f; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.hold-target.holding { background: rgba(255, 210, 63, .18); }

/* ---------- CONFIRM (grown-up) ---------- */
#screen-confirm { flex-direction: column; gap: 14px; background: rgba(8, 10, 30, .92); }
.confirm-top { display: flex; align-items: center; gap: 24px; }
.btn-back {
  height: 96px; padding: 0 30px; border-radius: 24px;
  background: var(--panel); border: 2px solid var(--panel-line);
  font-size: 32px; font-weight: 700;
}
.confirm-title { font-size: 44px; font-weight: 800; }
.banner-fade { background: #ffd23f; color: #2b2340; font-size: 30px; font-weight: 800; padding: 14px 22px; border-radius: 18px; }
.note-cool { align-self: flex-start; background: rgba(95, 200, 255, .18); border: 2px solid rgba(95, 200, 255, .5); color: #dff4ff; font-size: 24px; font-weight: 700; padding: 8px 16px; border-radius: 14px; }
.choices { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 20px; min-height: 0; }
.choice {
  border-radius: 32px;
  display: flex; align-items: center; justify-content: flex-start; gap: 28px;
  padding: 0 34px;
  font-size: 44px; font-weight: 800; text-align: left;
  background: var(--panel); border: 3px solid var(--panel-line);
}
.choice .choice-icon { width: 120px; height: 120px; flex: none; }
.choice-wee { background: rgba(255, 217, 61, .16); border-color: rgba(255, 217, 61, .55); }
.choice-poo { background: rgba(196, 132, 90, .2); border-color: rgba(220, 160, 110, .55); }
.choice-prompted { background: rgba(95, 200, 255, .14); border-color: rgba(95, 200, 255, .5); }
.choice-false { background: rgba(143, 160, 232, .14); border-color: rgba(143, 160, 232, .5); }

/* ---------- REWARD ---------- */
#screen-reward { align-items: center; justify-content: center; overflow: hidden; }
.reward-stage { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.arrive-body { position: relative; width: 420px; height: 420px; max-height: 58vh; max-width: 58vh; animation: arrive 1.2s cubic-bezier(.2, 1.3, .4, 1) both; }
.arrive-rocket { position: absolute; width: 90px; height: 150px; left: 50%; top: 50%; animation: swoop 1.4s ease-out both; }
.arrive-name { font-size: 84px; font-weight: 900; color: #fff6b0; text-shadow: 0 4px 0 rgba(0,0,0,.25); margin-top: 40px; animation: fade-up .6s .7s ease both; }
.lap-badge { position: absolute; top: 40px; left: 40px; width: 150px; height: 150px; animation: pop .8s 1s cubic-bezier(.2, 1.6, .4, 1) both; }
.bonus-card {
  position: absolute; left: 40px; top: 50%; margin-top: -170px;
  width: 280px; padding: 20px; border-radius: 32px;
  background: rgba(255, 255, 255, .1); border: 3px solid rgba(255, 246, 176, .6);
  display: flex; flex-direction: column; align-items: center;
  animation: pop .7s cubic-bezier(.2, 1.6, .4, 1) both;
}
.bonus-card[hidden] { display: none; }
.bonus-card .art { width: 200px; height: 200px; }
.bonus-name { font-size: 32px; font-weight: 800; text-align: center; margin-top: 6px; line-height: 1.15; overflow-wrap: anywhere; }
.sparkles { position: absolute; inset: 0; pointer-events: none; }
.spark { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; transform: rotate(var(--a)) translateY(-240px); animation: twinkle 1.6s var(--d) ease-in-out infinite; }
.cheer-art { position: relative; width: 420px; height: 420px; max-height: 60vh; max-width: 60vh; }
.cheer-star { width: 100%; height: 100%; animation: arrive 1s cubic-bezier(.2, 1.4, .4, 1) both; }
.rest-art { position: relative; width: 360px; height: 360px; max-height: 60vh; max-width: 60vh; }
.rest-rocket { position: absolute; width: 26%; height: 44%; left: 37%; top: 26%; }
.btn-go { position: absolute; right: 30px; bottom: 30px; width: 160px; height: 160px; border-radius: 50%; animation: fade-in .4s ease both; }
.btn-go[hidden] { display: none; }

/* ---------- COLLECTION ---------- */
#screen-collection { padding: 0; touch-action: pan-y; }
.coll-scroll {
  position: absolute; top: 0; right: 0; bottom: 0; left: 210px;
  scrollbar-width: none;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 24px 24px 40px 0;
  display: flex; flex-direction: column; gap: 18px;
}
.coll-scroll * { touch-action: pan-y; }
.coll-scroll::-webkit-scrollbar { display: none; }
.coll-group { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 2px dashed rgba(255, 255, 255, .12); }
.coll-mark { width: 26px; height: 44px; flex: none; transform: rotate(90deg); opacity: .6; }
.coll-row { display: flex; flex-wrap: wrap; gap: 12px; }
.tile {
  position: relative;
  width: 112px; height: 112px;
  border-radius: 26px;
  background: var(--panel);
  border: 2px solid var(--panel-line);
  padding: 10px;
  font: inherit; color: inherit; cursor: pointer;
}
.tile.locked { opacity: .55; background: rgba(255, 255, 255, .03); }
.tile .lap-stars { bottom: 2px; }
.tile.bounce { animation: bounce .5s ease both; }
.shelf { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; padding: 18px; border-radius: 32px; background: rgba(255, 210, 63, .08); border: 3px solid rgba(255, 210, 63, .3); }
.sticker { border-radius: 50%; }
.count { position: absolute; right: -6px; top: -6px; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 22px; background: #ffd23f; color: #2b2340; font-size: 28px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.btn-home {
  position: absolute; left: 24px; bottom: 24px;
  width: 170px; height: 170px; border-radius: 36px; padding: 22px;
  background: #2f7fd6; box-shadow: 0 10px 0 #1d5aa6;
}

/* ---------- Debug ---------- */
.debug-panel {
  position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; gap: 6px; align-items: center;
  background: rgba(0, 0, 0, .7); padding: 6px; border-radius: 8px;
  font: 13px/1.2 system-ui, sans-serif;
}
.debug-panel button { font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid #888; background: #333; color: #fff; }
.debug-info { color: #9f9; padding: 0 6px; }
.noscript { font-size: 32px; padding: 40px; }

/* ---------- Animations ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.3); } 100% { opacity: 1; transform: scale(1); } }
@keyframes shake { 0% { translate: 0 0; } 25% { translate: -2px 1px; } 50% { translate: 2px 0; } 75% { translate: -1px -1px; } 100% { translate: 0 0; } }
@keyframes fly { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-24px) rotate(3deg); } }
@keyframes streak { from { transform: translateY(0); } to { transform: translateY(50%); } }
@keyframes flicker { from { transform: scaleY(.85); } to { transform: scaleY(1.15); } }
@keyframes arrive { 0% { opacity: 0; transform: scale(.2) rotate(-20deg); } 100% { opacity: 1; transform: none; } }
@keyframes swoop {
  0% { opacity: 1; transform: translate(-700px, 300px) rotate(60deg) scale(1.2); }
  70% { opacity: 1; transform: translate(-45px, -75px) rotate(45deg) scale(.7); }
  100% { opacity: 0; transform: translate(-45px, -75px) rotate(45deg) scale(.4); }
}
@keyframes twinkle { 0%, 100% { opacity: .2; scale: .6; } 50% { opacity: 1; scale: 1.1; } }
@keyframes bounce { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.12); } 70% { transform: scale(.96); } }

/* Reduced motion: no movement; entrances become simple fades, loops stop. */
@media (prefers-reduced-motion: reduce) {
  .btn-start, .btn-launch, .strip-rocket, .countdown-rocket, .calling-sky,
  .calling-rocket, .flame, .tile.bounce { animation: none !important; }
  .count-num.pop, .arrive-body, .arrive-name, .lap-badge, .bonus-card,
  .cheer-star, .screen.active, .btn-go { animation: fade-in .4s ease both !important; }
  .arrive-rocket { display: none; }
  .spark { animation: none !important; opacity: .8; }
  .btn, .slot { transition: none; }
  .btn.pressed { transform: none; filter: brightness(1.15); }
}
