:root {
  --hud-h: 56px;
  --mascot-y: 128px;
  --line-y: calc(var(--mascot-y) + 30px); /* where the current distance sits: just below Pip */
  --text: #ffffff;
  --muted: #c4d4e8;
  --glass: rgba(6, 20, 46, 0.62);
  --glass-strong: rgba(4, 14, 34, 0.86);
  --glass-border: rgba(255, 255, 255, 0.16);
  --accent: #F2B84B;
  --accent-ink: #1a1203;
  --coral: #FF6F61;
  --focus: #FFE38A;
  --radius: 20px;
  --shallow: 1;
  --dark: 0;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #050816;
  color: var(--text);
  font-family: Nunito, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 10px;
}

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

/* ---------- Space ---------- */

#space { position: fixed; inset: 0; overflow: hidden; z-index: 0; background: #050816; }

#world {
  position: absolute;
  left: 0; right: 0;
  top: var(--line-y);
  will-change: transform;
  transition: transform 1.8s cubic-bezier(.3, .7, .2, 1);
}
#world.no-anim { transition: none; }

/* Earth's edge above Pip at the start, with a glowing atmosphere */
#world .earth {
  position: absolute; left: 50%; width: max(260vw, 2200px); aspect-ratio: 1; bottom: calc(100% - 70px);
  transform: translateX(-50%); border-radius: 50%;
  background:
    radial-gradient(ellipse 4% .7% at 40% 99.3%, rgba(70,160,105,.75) 55%, rgba(70,160,105,0)),
    radial-gradient(ellipse 3% .55% at 61% 99.4%, rgba(70,160,105,.7) 55%, rgba(70,160,105,0)),
    radial-gradient(circle at 50% 100%, #3B8CEB, #1D59BE 25%, #0F2A66 60%);
  box-shadow: 0 0 30px 10px rgba(150,215,255,.85), 0 0 140px 60px rgba(80,150,255,.45);
}
#world .earth-clouds {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(ellipse 4% .5% at 32% 99.5%, rgba(255,255,255,.7) 50%, rgba(255,255,255,0)),
    radial-gradient(ellipse 5% .6% at 52% 99.2%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0)),
    radial-gradient(ellipse 3% .45% at 70% 99.5%, rgba(255,255,255,.65) 50%, rgba(255,255,255,0));
  animation: clouds 60s linear infinite;
}
@keyframes clouds { to { transform: rotate(-3deg); } }
#world .atmosphere {
  position: absolute; left: 0; right: 0; top: 0; height: 260px; pointer-events: none;
  background: linear-gradient(180deg, rgba(150,215,255,.45), rgba(150,215,255,0));
}
/* Above Earth: black space, so no hard edge shows on tall or wide screens */
#world::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 2000px; background: #050816; }

.zone-label {
  position: absolute; left: 14px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.72);
  display: flex; flex-direction: column; gap: 2px;
}
.zone-label strong { font-weight: 900; font-size: 12px; }
.tick {
  position: absolute; left: 14px; font-size: 10px; color: rgba(255,255,255,.4);
  padding-left: 18px;
}
.tick::before {
  content: ''; position: absolute; left: 0; top: 50%; width: 12px; height: 1px; background: rgba(255,255,255,.35);
}

.creature {
  position: absolute;
  transform: translateX(-50%) scale(var(--s, 1));
  animation: drift 12s ease-in-out infinite alternate;
  opacity: .92;
}
.creature .glow { filter: drop-shadow(0 0 10px var(--hue)); }
@keyframes drift {
  from { translate: -10px 0; rotate: -2deg; }
  to { translate: 10px -14px; rotate: 2deg; }
}

.floor { position: absolute; left: 0; right: 0; height: 220px; }
.floor .black-hole { width: 100%; max-width: 640px; height: 170px; display: block; margin: 0 auto; }
.floor-label {
  text-align: center; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.7); margin-top: 6px;
}

/* Sunlight glare near home */
#rays { position: absolute; inset: 0; opacity: calc(var(--shallow) * .35); transition: opacity 1.8s; pointer-events: none; }
#rays span {
  position: absolute; top: -10%; width: 70px; height: 70%;
  background: linear-gradient(180deg, rgba(255,236,190,.5), rgba(255,236,190,0));
  transform: rotate(-24deg); transform-origin: top;
  filter: blur(8px);
  animation: ray 10s ease-in-out infinite alternate;
}
#rays span:nth-child(1) { left: 70%; }
#rays span:nth-child(2) { left: 80%; width: 40px; animation-delay: -3s; }
#rays span:nth-child(3) { left: 88%; width: 90px; animation-delay: -5s; }
#rays span:nth-child(4) { left: 96%; width: 50px; animation-delay: -7s; }
@keyframes ray { to { opacity: .4; transform: rotate(-20deg); } }

/* Shooting stars stream upward: you're flying onward */
#bubbles { position: absolute; inset: 0; opacity: .7; pointer-events: none; }
#bubbles span {
  position: absolute; bottom: -60px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(160,210,255,0));
  animation: streak linear infinite;
}
@keyframes streak {
  to { transform: translate3d(0, -115vh, 0); }
}

/* Twinkling stars, brighter the further you go */
#snow { position: absolute; inset: 0; opacity: calc(.45 + var(--dark) * .55); transition: opacity 1.8s; pointer-events: none; }
#snow span {
  position: absolute; border-radius: 50%;
  background: #fff; box-shadow: 0 0 4px rgba(200,230,255,.9);
  animation: twinkle ease-in-out infinite alternate;
}
@keyframes twinkle {
  from { opacity: .2; }
  to { opacity: 1; }
}

/* ---------- Mascot ---------- */

#mascot {
  position: fixed; z-index: 2;
  left: 50%; top: var(--mascot-y);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.mascot-bob { position: relative; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(-4px) rotate(-3deg); }
  50% { transform: translateY(5px) rotate(3deg); }
}
#mascot svg { display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
#mascot .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker .18s ease-in-out infinite alternate; }
#mascot .flame-r { animation-delay: -.09s; }
@keyframes flicker { from { transform: scaleY(.75); opacity: .8; } to { transform: scaleY(1.1); opacity: 1; } }
#mascot .beacon { animation: beacon 1.6s steps(1) infinite; }
@keyframes beacon { 50% { opacity: .25; } }
.lamp-beam {
  position: absolute; left: 50%; top: 76px; width: 120px; height: 150px; transform: translateX(-50%);
  background: radial-gradient(ellipse at top, rgba(255, 246, 194, .5), rgba(255,246,194,0) 70%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  opacity: 0; transition: opacity 1.2s;
}
body.deep .lamp-beam { opacity: 1; }
body.deep #mascot svg { filter: drop-shadow(0 0 14px rgba(160, 210, 255, .55)); }
body.flying .mascot-bob { animation-duration: .9s; }

/* ---------- HUD ---------- */

.hud {
  position: fixed; z-index: 5; top: 0; left: 0; right: 0;
  height: var(--hud-h);
  padding: 0 10px 0 14px;
  padding-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: 10px;
  background: rgba(4, 14, 34, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 900; font-size: 19px; color: var(--text); text-decoration: none;
}
.hud-mode {
  font-size: 13px; font-weight: 800; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.08);
  white-space: nowrap;
}
.hud-stats { margin-left: auto; display: flex; gap: 12px; font-size: 14px; white-space: nowrap; }
.hud-label { color: var(--muted); font-weight: 700; }
.hud-stat b { font-weight: 900; font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.1); border: 1px solid var(--glass-border);
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.18); }

.gauge {
  position: fixed; z-index: 3;
  right: 8px; top: calc(var(--hud-h) + 18px); bottom: 34px;
  width: 6px;
}
.gauge-track {
  position: absolute; inset: 0; border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px rgba(255,255,255,.25);
}
.gauge-marker {
  position: absolute; left: 50%; width: 14px; height: 14px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent); box-shadow: 0 0 0 2px #fff, 0 0 10px rgba(242,184,75,.9);
  transition: top 1.8s cubic-bezier(.3, .7, .2, 1);
}
.gauge-zone {
  position: absolute; bottom: -24px; right: -4px;
  font-size: 10px; font-weight: 800; white-space: nowrap; color: rgba(255,255,255,.75);
  text-transform: uppercase; letter-spacing: .06em;
}

@media (max-width: 520px) {
  .hud-mode { display: none; }
  .hud-stats { gap: 10px; font-size: 13px; }
  .brand span { font-size: 17px; }
}
@media (max-width: 370px) {
  .hud-label { display: none; }
}

/* ---------- App screens ---------- */

#app {
  position: fixed; z-index: 4;
  top: var(--hud-h); left: 0; right: 0; bottom: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: calc(var(--mascot-y) - var(--hud-h) + 56px) 16px 32px;
  outline: none;
}
.screen { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 10, 30, .35);
  padding: 20px;
}
.card h1, .card h2, .card h3 { margin: 0; line-height: 1.15; }
.card p { margin: 0; line-height: 1.5; color: var(--muted); }
.card p strong { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px;
  border-radius: 14px; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.1);
  font-weight: 800; font-size: 16px; cursor: pointer;
  text-decoration: none;
  transition: transform .12s, background .2s;
}
.btn:hover { background: rgba(255,255,255,.18); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 18px rgba(242,184,75,.35); }
.btn-primary:hover { background: #ffc85f; }
.btn-big { min-height: 58px; font-size: 19px; width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 800; cursor: pointer; text-decoration: underline; }

/* Home */
.home-hero { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.home-hero h1 { font-size: 40px; font-weight: 900; letter-spacing: -.01em; }
.home-hero .tagline { font-size: 17px; }
.streak { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--text); background: rgba(255,255,255,.08); padding: 6px 12px; border-radius: 999px; }
.lock { display: inline-flex; }
.countdown { font-variant-numeric: tabular-nums; }

/* Prompt */
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prompt-meta { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card .prompt-text { font-size: clamp(26px, 6.4vw, 34px); font-weight: 900; margin: 10px 0 16px; line-height: 1.15; }
.timer { position: relative; width: 64px; height: 64px; flex: none; }
.timer svg { transform: rotate(-90deg); }
.timer .track { stroke: rgba(255,255,255,.18); }
.timer .ring { stroke: #7FE6FF; transition: stroke .3s; }
.timer.low .ring { stroke: var(--coral); }
.timer .num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; }
.timer.low .num { color: var(--coral); }

.answer-form { display: flex; gap: 10px; }
.answer-input {
  flex: 1; min-width: 0; min-height: 56px;
  padding: 12px 16px; border-radius: 14px;
  border: 2px solid rgba(255,255,255,.3);
  background: rgba(0, 8, 24, .55);
  font-size: 20px; font-weight: 700;
}
.answer-input::placeholder { color: rgba(255,255,255,.5); }
.answer-input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(255,227,138,.3); }
.answer-form .btn { min-height: 56px; }

/* Reveal */
.badge {
  display: flex; align-items: center; gap: 14px;
  animation: pop .55s cubic-bezier(.2, 1.6, .4, 1) both;
}
.badge-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: rgba(255,255,255,.08); flex: none; }
.badge-icon .tier-icon { width: 44px; height: 44px; }
.badge-title { font-size: 26px; font-weight: 900; }
.badge-sub { color: var(--muted); font-weight: 700; }
.points { margin-left: auto; font-size: 28px; font-weight: 900; color: var(--accent); white-space: nowrap; }
@keyframes pop {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.your-answer { margin-top: 10px; color: var(--muted); }
.your-answer b { color: var(--text); }

.learn { display: flex; flex-direction: column; gap: 14px; animation: fadeUp .45s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.learn h3 { font-size: 18px; }
.tier-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tier-row {
  display: grid; grid-template-columns: 30px 108px 1fr; gap: 8px; align-items: start;
  padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.05);
}
.tier-row.mine { background: rgba(242,184,75,.18); box-shadow: inset 0 0 0 1px rgba(242,184,75,.6); }
.tier-row .tname { font-weight: 800; font-size: 14px; padding-top: 4px; }
.tier-row .tname small { display: block; font-weight: 700; color: var(--muted); font-size: 12px; }
.tier-row .samples { font-size: 14px; color: var(--muted); line-height: 1.45; padding-top: 4px; }
.rare-fact {
  border-radius: 14px; padding: 14px; display: flex; gap: 12px; align-items: flex-start;
  background: linear-gradient(135deg, rgba(185,140,255,.22), rgba(185,140,255,.06));
  box-shadow: inset 0 0 0 1px rgba(185,140,255,.5);
}
.rare-fact p { color: var(--text); }
.plus-hint { font-size: 14px; color: var(--muted); }

/* Results */
.results-top { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.results-depth { font-size: 46px; font-weight: 900; }
.results-zone { font-weight: 800; color: var(--muted); }
.curve { width: 100%; height: auto; display: block; }
.share-box {
  white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px;
  background: rgba(0,0,0,.25); border-radius: 12px; padding: 12px; margin: 0;
}
.squares { display: flex; gap: 6px; justify-content: center; }
.squares span { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; }

/* Stats */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { background: rgba(255,255,255,.06); border-radius: 14px; padding: 12px; }
.tile .v { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 28px 100px 1fr 34px; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.bars .bar { height: 12px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.bars .bar span { display: block; height: 100%; border-radius: 6px; }
.bars .n { text-align: right; font-variant-numeric: tabular-nums; }

/* Sheets */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0, 6, 18, .6);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--glass-strong);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
  animation: slideUp .28s cubic-bezier(.2, .8, .2, 1) both;
}
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--glass-border); }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { margin: 0; font-size: 24px; font-weight: 900; }
.sheet p { margin: 0; color: var(--muted); line-height: 1.5; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.benefits { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.benefits li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; }
.benefits li::before { content: '✓'; color: var(--accent); font-weight: 900; }
.price { font-size: 34px; font-weight: 900; }
.price small { font-size: 16px; color: var(--muted); font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 800; }
.field input {
  min-height: 50px; padding: 10px 14px; border-radius: 12px;
  border: 2px solid rgba(255,255,255,.3); background: rgba(0,8,24,.55); font-size: 18px;
}
.field input:focus { outline: none; border-color: var(--focus); }
.check { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.error { color: #FFB4AC; font-weight: 700; }
.note { font-size: 14px; }
.steps-dots { display: flex; gap: 6px; justify-content: center; }
.steps-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.3); }
.steps-dots span.on { background: var(--accent); }
.howto-art { display: grid; place-items: center; min-height: 60px; gap: 8px; }
.tier-strip { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tier-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; background: rgba(255,255,255,.07); padding: 4px 8px 4px 4px; border-radius: 999px; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }

#toast {
  position: fixed; z-index: 20; left: 50%; bottom: 24px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #fff; color: #0b1a33; font-weight: 800;
  padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.3);
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { position: fixed; inset: 40% 16px auto; text-align: center; z-index: 30; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  #bubbles, #snow span { display: none; }
}

/* Headings focused by script for screen readers don't need a ring. */
[tabindex="-1"]:focus:not(:focus-visible),
h2[tabindex="-1"]:focus { outline: none; }

/* Wrong guesses: the prompt stays open until a right answer or time runs out */
.guess-feedback { min-height: 1.5em; margin: 10px 2px 0; font-weight: 800; color: #FFB4AC; }
.guess-feedback:empty { margin-top: 4px; }
.guesses { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.guesses:empty { display: none; }
.guesses-label { color: var(--muted); font-weight: 700; margin-right: 2px; }
.guess-chip { padding: 3px 10px; border-radius: 999px; background: rgba(255,111,97,.18); border: 1px solid rgba(255,111,97,.5); text-decoration: line-through; text-decoration-color: rgba(255,180,172,.8); overflow-wrap: anywhere; }
.answer-form.shake { animation: shake .4s ease; }
.answer-form.shake .answer-input { border-color: var(--coral); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .answer-form.shake { animation: none; } }

/* "Did you mean …?" pop-up for near misses */
.did-you-mean { margin-top: 4px; padding: 14px 16px; border-radius: 16px; background: #fff; color: #0b1a33; box-shadow: 0 6px 24px rgba(0,0,0,.35); animation: dym-in .18s ease-out; }
.did-you-mean .dym-q { margin: 0; font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.did-you-mean .dym-typed { margin: 2px 0 12px; font-size: 14px; color: #4a5a75; overflow-wrap: anywhere; }
.did-you-mean .dym-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.did-you-mean .btn { min-height: 48px; }
.did-you-mean .btn:not(.btn-primary) { background: #e8edf5; color: #0b1a33; border-color: transparent; }
@keyframes dym-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .did-you-mean { animation: none; } }
.did-you-mean .btn:not(.btn-primary):hover { background: #d6dfec; }
.answer-form[hidden] { display: none; }
.card .did-you-mean .dym-q { color: #0b1a33; }
.card .did-you-mean .dym-typed { color: #4a5a75; }

/* Beat your friends */
.friends h2 { margin-bottom: 2px; }
.friends .rules { margin: 12px 0 16px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.07); color: var(--text); font-weight: 700; line-height: 1.9; }
.mult { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: 1px 7px; border-radius: 999px; font-size: 13px; font-weight: 900; white-space: nowrap; }
.mult.x2 { background: #F2B84B; color: #0b1a33; }
.mult.half { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.stack-form { display: grid; gap: 8px; margin-top: 16px; }
.stack-form label { font-weight: 800; }
.card .hint, .hint { font-size: 14px; color: var(--muted); }
.code-box { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(0,0,0,.22); border: 1px dashed rgba(255,255,255,.3); }
.code-label { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 800; }
.code-label .link-btn { font-size: 14px; }
#my-code { font: 700 17px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; color: #fff; }
.friends-h { margin: 22px 0 8px; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li { display: grid; grid-template-columns: 28px minmax(0,1fr) auto 36px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.06); }
.board li.me { background: rgba(242,184,75,.16); box-shadow: inset 0 0 0 1px rgba(242,184,75,.6); }
.board .rank { font-weight: 900; font-size: 18px; text-align: center; }
.board .who { font-weight: 800; overflow-wrap: anywhere; }
.board .who small, .vs-prompt small { color: var(--muted); font-weight: 700; margin-left: 4px; }
.board .deep { font-weight: 900; white-space: nowrap; }
.board .rm { width: 36px; height: 36px; font-size: 14px; }
.vs-prompt { margin-top: 14px; }
.vs-prompt ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.vs-prompt li { display: grid; grid-template-columns: minmax(60px, 7em) minmax(0,1fr) auto 3.2em; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; font-size: 15px; }
.vs-prompt li.me { background: rgba(242,184,75,.12); }
.vs-prompt .who { font-weight: 800; overflow-wrap: anywhere; }
.vs-prompt .ans { display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; min-width: 0; }
.vs-prompt .ans svg { flex: none; }
.vs-prompt .pts { text-align: right; font-weight: 800; white-space: nowrap; }
.vs-prompt .muted { color: var(--muted); font-style: italic; }
.friends-cta h3 { margin-bottom: 6px; }
.friends-cta .btn { margin-top: 12px; width: 100%; }
.stack-form .answer-form .answer-input { flex: 1 1 auto; min-width: 0; width: auto; }
.stack-form .answer-form .btn { flex: none; }
.card .friends-h { margin: 22px 0 8px; }
.vs-prompt .ans { overflow-wrap: break-word; word-break: normal; }
.vs-prompt .ans span, .vs-prompt .ans { hyphens: auto; }

/* Play online */
.btn-online { margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: rgba(79,209,232,.18); border-color: rgba(79,209,232,.6); }
.btn-online:hover { background: rgba(79,209,232,.28); }
.ol-rules { margin: 10px 0 4px; color: var(--text); }
.card .ol-rules { color: var(--text); }
.ol-rules .heart, .heart { fill: #FF6F61; vertical-align: -3px; }
.heart.lost { fill: rgba(255,255,255,.18); }
.card .ol-rules.small, .ol-rules.small { font-size: 13px; color: var(--muted); margin-top: 14px; }
.or { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; color: var(--muted); font-size: 14px; font-weight: 700; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.2); }
.code-input { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.game-code { margin: 6px 0 12px; font: 900 clamp(40px, 13vw, 60px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; color: #FFE38A; user-select: all; -webkit-user-select: all; }
.online .btn-primary:not(.btn-big) { width: 100%; }
.ol-lobby { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ol-lobby li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.06); font-weight: 800; }
.ol-lobby li.me { background: rgba(242,184,75,.16); }
.ol-lobby small { color: var(--muted); }
.tag { margin-left: auto; padding: 1px 8px; border-radius: 999px; background: rgba(79,209,232,.25); font-size: 12px; font-weight: 900; }
.lives-pick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 16px 0 12px; font-weight: 800; }
.lives-pick span { margin-right: 6px; }
.lives-pick .btn { min-width: 44px; min-height: 44px; padding: 0 12px; }
.lives-pick .btn.on { background: #F2B84B; color: #0b1a33; border-color: #F2B84B; }
.turn-banner { margin: 6px 0 12px; font-size: 18px; font-weight: 900; color: var(--text); }
.card .turn-banner { color: var(--text); }
.turn-banner.mine { color: #FFE38A; }
.card .ol-last, .ol-last { min-height: 1.5em; margin: 10px 0; color: var(--text); font-weight: 700; }
.ol-players { list-style: none; margin: 6px 0 12px; padding: 0; display: grid; gap: 6px; }
.ol-players li { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.06); border: 2px solid transparent; }
.ol-players li.turn { border-color: #FFE38A; background: rgba(255,227,138,.12); }
.ol-players li.out { opacity: .45; }
.ol-players .who { font-weight: 800; overflow-wrap: anywhere; }
.ol-players .who small { color: var(--muted); font-weight: 700; margin-left: 4px; }
.ol-players .hearts { display: inline-flex; gap: 1px; }
.ol-players .deep { font-weight: 800; white-space: nowrap; min-width: 4.5em; text-align: right; }
.ol-used { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.used-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.1); overflow-wrap: anywhere; }
.answer-input:disabled { opacity: .55; }
.lives-pick { display: grid; grid-template-columns: auto repeat(5, minmax(0, 1fr)); gap: 6px; }
.lives-pick .btn { min-width: 0; padding: 0; }

/* ---------- Play online: the ring of seats ---------- */
body.online-mode #mascot { display: none; }
body.online-mode #app { padding-top: 22px; }
.online .center, .card .center { text-align: center; }
.online.card { display: grid; gap: 18px; }
.ol-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ol-panel > .btn:not(.btn-big) { align-self: stretch; }

.seat-ring { position: relative; width: min(100%, 440px); aspect-ratio: 1; margin: 6px auto; }
.ring-art, .ring-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-centre { position: absolute; left: 50%; top: 50%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; }
.ring-seats { position: absolute; inset: 0; }
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92px; text-align: center; transition: opacity .3s; }
.seat .avatar {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 21px; color: #0b1a33;
  background: var(--c, #ccc); box-shadow: 0 4px 12px rgba(0,0,0,.35), inset 0 -4px 0 rgba(0,0,0,.15);
  transition: transform .35s cubic-bezier(.3,1.6,.5,1), box-shadow .35s;
}
.seat-name { max-width: 92px; font-size: 13px; font-weight: 800; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name small { color: var(--muted); font-weight: 700; }
.seat-hearts { display: inline-flex; gap: 0; line-height: 0; }
.seat-hearts .heart { width: 13px; height: 13px; }
.seat-depth { font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.seat-tag { padding: 0 7px; border-radius: 999px; background: rgba(79,209,232,.25); font-size: 11px; font-weight: 900; }
.seat.me .avatar { box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(0,0,0,.35); }
.seat.turn .avatar { transform: scale(1.22); box-shadow: 0 0 0 4px #FFE38A, 0 0 26px 6px color-mix(in srgb, var(--c) 70%, transparent); animation: seat-pulse 1.4s ease-in-out infinite; }
.seat.turn .seat-name { color: #FFE38A; }
.seat.out { opacity: .4; }
.seat.out .avatar { filter: grayscale(1); }
.seat.open .avatar { background: transparent; border: 2px dashed rgba(255,255,255,.35); color: rgba(255,255,255,.5); box-shadow: none; font-size: 24px; }
.seat.open .seat-name { color: rgba(255,255,255,.45); font-weight: 700; }
@keyframes seat-pulse { 50% { box-shadow: 0 0 0 6px rgba(255,227,138,.55), 0 0 34px 10px color-mix(in srgb, var(--c) 60%, transparent); } }

.ring-pointer { position: absolute; left: 50%; top: 50%; width: 41%; height: 0; transform-origin: 0 0; transition: transform .7s cubic-bezier(.3,.9,.3,1), opacity .3s; opacity: 0; }
.ring-pointer span { position: absolute; left: 56%; right: 22%; top: -3px; height: 6px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,227,138,0), #FFE38A); box-shadow: 0 0 12px rgba(255,227,138,.8); }

.centre-timer { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.centre-clock { position: absolute; inset: 0; width: 100%; height: 100%; }
.centre-clock .track { stroke: rgba(255,255,255,.16); }
.centre-clock .ring-arc { stroke: #7FE6FF; transition: stroke .3s; }
.centre-timer.low .ring-arc { stroke: var(--coral); }
.centre-pip { width: 70%; margin-top: -14%; }
.centre-pip svg { width: 100%; height: auto; display: block; }
.centre-timer .num { position: absolute; bottom: 13%; font-size: clamp(18px, 5vw, 26px); font-weight: 900; font-variant-numeric: tabular-nums; padding: 0 8px; border-radius: 999px; background: rgba(4,14,34,.7); }
.centre-timer.low .num { color: var(--coral); }

.centre-code { display: grid; justify-items: center; gap: 2px; text-align: center; padding: 10px; width: 100%; height: 100%; align-content: center; border-radius: 50%; background: radial-gradient(circle, rgba(242,184,75,.16), rgba(242,184,75,0) 70%); }
.centre-code span { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.centre-code b { font: 900 clamp(30px, 10vw, 46px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; color: #FFE38A; user-select: all; -webkit-user-select: all; outline: none; }
.centre-code small { font-size: 12px; color: var(--muted); font-weight: 700; }
.centre-trophy { display: grid; justify-items: center; gap: 0; text-align: center; }
.centre-trophy b { font-size: 18px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.centre-trophy span { font-size: 13px; color: var(--muted); font-weight: 800; }

.host-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper { display: grid; grid-template-columns: minmax(0,1fr) 40px 26px 40px; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 14px; background: rgba(255,255,255,.07); font-weight: 800; }
.stepper .btn { min-height: 40px; padding: 0; font-size: 20px; }
.stepper b { text-align: center; font-size: 19px; font-variant-numeric: tabular-nums; }

.online-start { align-items: center; }
.start-art { display: grid; place-items: center; }
.start-art .mini-ring { width: 130px; height: 130px; }
.start-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.name-row { font-size: 16px; color: var(--muted); }
.name-row b { color: var(--text); }
.code-input { text-align: center; font-size: 28px !important; letter-spacing: .35em; font-weight: 900; text-transform: uppercase; }
.connecting { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 10px 0; }
.connecting .mini-ring { animation: spin-slow 6s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.online-play .prompt-text { margin: 4px 0 2px; }
.online-play .turn-banner { margin: 0; }
.online-over .board { margin: 6px 0 8px; }
.over-ring .seat.turn .avatar { animation: none; }

@media (max-width: 400px) {
  .seat { width: 80px; }
  .seat-name { max-width: 80px; font-size: 12px; }
  .seat .avatar { width: 42px; height: 42px; font-size: 18px; }
  .stepper { grid-template-columns: minmax(0,1fr) 36px 22px 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .seat.turn .avatar { animation: none; }
  .ring-pointer { transition: none; }
  .connecting .mini-ring { animation: none; }
}

/* ---------- iPad and computer ---------- */
@media (min-width: 720px) {
  .screen { max-width: 640px; gap: 18px; }
  .card { padding: 26px 28px; }
  .card .prompt-text { font-size: 38px; }
  .home-hero h1 { font-size: 54px; }
  .home-hero .tagline { font-size: 19px; }
  .hud { padding: 0 18px 0 22px; }
  .hud-stats { font-size: 15px; gap: 18px; }
  .answer-input { font-size: 20px; }
  .seat-ring { width: min(100%, 460px); }
  .seat .avatar { width: 56px; height: 56px; font-size: 24px; }
  .seat { width: 110px; }
  .seat-name { max-width: 110px; font-size: 14px; }
  /* Online: the ring beside the panel */
  body.online-mode .screen { max-width: 1060px; }
  .online.card { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 28px; padding: 30px; }
  .online.card:not(.lobby):not(.online-play):not(.online-over) { grid-template-columns: 1fr; }
  .online-start.card { grid-template-columns: 200px minmax(0, 1fr); max-width: 760px; margin: 0 auto; width: 100%; }
  .start-art .mini-ring { width: 180px; height: 180px; }
}
@media (min-width: 720px) and (max-width: 899px) {
  /* iPad portrait: stack the ring above the panel, both centred */
  .online.card.lobby, .online.card.online-play, .online.card.online-over { grid-template-columns: 1fr; }
  .ol-panel { max-width: 520px; width: 100%; margin: 0 auto; }
}
/* Big screens (iPad landscape, laptops): Pip floats on the left, content sits to the right */
@media (min-width: 1000px) and (min-height: 560px) {
  #mascot { left: 19%; top: 52%; transform: translate(-50%, -50%) scale(1.7); }
  :root { --line-y: calc(52vh + 90px); }
  #app { padding-top: 36px; }
  .screen { margin-left: 36%; margin-right: auto; max-width: min(640px, 58%); }
  body.online-mode .screen { margin: 0 auto; max-width: 1060px; }
  body.online-mode #app { padding-top: 32px; }
  .seat-ring { width: min(100%, 500px); }
}
@media (hover: hover) {
  .seat .avatar:hover { transform: scale(1.06); }
  .seat.turn .avatar:hover { transform: scale(1.22); }
}
.online .answer-form .btn-primary { width: auto; flex: none; padding: 0 22px; }
.online .answer-form .answer-input { flex: 1 1 auto; min-width: 0; }
.seat.turn .seat-name { margin-top: 9px; }
body.online-mode .hud-stats { visibility: hidden; }
@media (min-width: 720px) {
  .online.card.online-start { grid-template-columns: 200px minmax(0, 1fr); max-width: 780px; margin: 0 auto; width: 100%; }
  body.online-mode .screen > .btn-row { max-width: 780px; margin: 0 auto; width: 100%; }
}

/* ---------- Radar scope for online play ---------- */
.seat-ring { width: min(100%, 460px); margin: 4px auto 22px; }
.ring-art svg { overflow: visible; }
.ring-art .dish-edge { fill: none; stroke: rgba(127,230,255,.45); stroke-width: .5; }
.ring-art .range { fill: none; stroke: rgba(127,230,255,.2); stroke-width: .3; }
.ring-art .range.faint { stroke: rgba(127,230,255,.12); }
.ring-art .cross { stroke: rgba(127,230,255,.12); stroke-width: .25; stroke-dasharray: 1 1.4; }
.ring-art .tick { stroke: rgba(127,230,255,.35); stroke-width: .35; }
.ring-art .tick.long { stroke: rgba(190,245,255,.8); stroke-width: .6; }
.ring-art .bezel-track { fill: none; stroke: rgba(255,255,255,.1); stroke-width: 1.6; }
.ring-art .ring-arc { fill: none; stroke: #7FE6FF; stroke-width: 1.6; stroke-linecap: round; transition: stroke .3s; }
.ring-art .ring-arc-glow { fill: none; stroke: #7FE6FF; stroke-width: 4.5; opacity: .22; stroke-linecap: round; transition: stroke .3s; }
.seat-ring.low .ring-arc, .seat-ring.low .ring-arc-glow { stroke: var(--coral); }

/* The beam: a conic wedge whose bright edge leads clockwise */
.ring-sweep { position: absolute; inset: 3%; border-radius: 50%; pointer-events: none; transition: transform 1s cubic-bezier(.25,.9,.3,1); }
.ring-sweep::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(79,209,232,0) 0deg 280deg, rgba(79,209,232,.07) 305deg, rgba(79,209,232,.3) 352deg, rgba(200,250,255,.85) 359.2deg, rgba(79,209,232,0) 360deg);
}
.ring-sweep.idle { animation: radar-sweep 6s linear infinite; }
.seat-ring.low .ring-sweep::before { background: conic-gradient(from 0deg, rgba(255,111,97,0) 0deg 280deg, rgba(255,111,97,.08) 305deg, rgba(255,111,97,.32) 352deg, rgba(255,200,190,.9) 359.2deg, rgba(255,111,97,0) 360deg); }
@keyframes radar-sweep { to { transform: rotate(360deg); } }

/* Centre: Pip and the seconds */
.ring-centre { width: 38%; }
.centre-timer { position: relative; width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, rgba(4,20,43,.85) 0 55%, rgba(4,20,43,0) 72%); }
.centre-pip { width: 74%; margin-top: -18%; }
.centre-timer .num { position: absolute; bottom: 6%; padding: 1px 12px; border-radius: 999px; background: #04142b; border: 1px solid rgba(127,230,255,.5); font-size: clamp(18px, 5vw, 26px); font-weight: 900; font-variant-numeric: tabular-nums; color: #bff6ff; box-shadow: 0 0 14px rgba(79,209,232,.35); }
.seat-ring.low .centre-timer .num { color: #ffd2cc; border-color: rgba(255,111,97,.7); box-shadow: 0 0 16px rgba(255,111,97,.5); }
.centre-code { background: radial-gradient(circle, rgba(4,20,43,.9) 0 58%, rgba(4,20,43,0) 72%); }
.centre-trophy { width: 100%; height: 100%; align-content: center; border-radius: 50%; background: radial-gradient(circle, rgba(4,20,43,.9) 0 58%, rgba(4,20,43,0) 72%); }

/* Players: gold-rimmed portholes */
.seat .avatar {
  position: relative;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.6) 0 9%, rgba(255,255,255,0) 10%),
    radial-gradient(circle at 50% 60%, var(--c, #ccc), color-mix(in srgb, var(--c, #ccc) 55%, #061a33));
  box-shadow: 0 0 0 3px #e3b04f, 0 0 0 5px #7d520f, 0 6px 14px rgba(0,0,0,.5), inset 0 -6px 10px rgba(0,0,0,.3);
  color: #071b33;
}
.seat .avatar i { font-style: normal; position: relative; z-index: 1; text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.seat.me .avatar { box-shadow: 0 0 0 3px #e3b04f, 0 0 0 5px #7d520f, 0 0 0 8px rgba(255,255,255,.85), 0 6px 14px rgba(0,0,0,.5), inset 0 -6px 10px rgba(0,0,0,.3); }
.seat.turn .avatar {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px #FFE38A, 0 0 0 5px #b8801f, 0 0 30px 8px color-mix(in srgb, var(--c) 65%, transparent), inset 0 -6px 10px rgba(0,0,0,.25);
  animation: none;
}
/* Radar pings from whoever's turn it is */
.seat.turn .avatar::before, .seat.turn .avatar::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--c); opacity: 0;
  animation: radar-ping 1.8s ease-out infinite;
}
.seat.turn .avatar::after { animation-delay: .9s; }
@keyframes radar-ping { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(2.3); opacity: 0; } }
.seat.open .avatar { background: rgba(127,230,255,.06); border: 2px dashed rgba(127,230,255,.45); box-shadow: none; color: rgba(191,246,255,.7); }
.seat.out .avatar { filter: grayscale(1) brightness(.7); }
.seat-name { text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.seat-depth { text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.over-ring .seat.turn .avatar::before, .over-ring .seat.turn .avatar::after { border-color: #FFE38A; }
@media (prefers-reduced-motion: reduce) {
  #mascot .flame, #mascot .beacon, #bubbles span, #snow span, #world .earth-clouds { animation: none; }
  .ring-sweep.idle { animation: none; }
  .ring-sweep { transition: none; }
  .seat.turn .avatar::before, .seat.turn .avatar::after { animation: none; }
}

/* ---------- Sunward world (the "up" game) ---------- */
#sunworld {
  position: absolute; left: 0; right: 0;
  top: calc(var(--line-y) - 7000px);
  will-change: transform; display: none;
  transition: transform 1.8s cubic-bezier(.3, .7, .2, 1);
}
#sunworld.no-anim { transition: none; }
body.sunward #sunworld { display: block; }
body.sunward #world { display: none; }
#sunworld .sun-disc {
  position: absolute; left: 50%; top: -900px; width: 1500px; height: 1500px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, #FFFBE6 0%, #FFE58A 45%, #FFB347 70%, #FF8A3C 100%);
  box-shadow: 0 0 120px 60px rgba(255,190,90,.65), 0 0 300px 140px rgba(255,140,60,.35);
}
#sunworld .sun-corona { position: absolute; inset: -60px; border-radius: 50%; border: 18px solid rgba(255,230,150,.25); animation: corona 4s ease-in-out infinite alternate; }
@keyframes corona { to { inset: -90px; border-color: rgba(255,230,150,.1); } }
/* Earth's curve below Pip at the start of a Sunward flight */
#sunworld .earth-below {
  position: absolute; left: 50%; width: max(260vw, 2200px); aspect-ratio: 1; top: calc(7000px + 60px); transform: translateX(-50%); border-radius: 50%;
  background:
    radial-gradient(ellipse 4% .7% at 42% .7%, rgba(70,160,105,.75) 55%, rgba(70,160,105,0)),
    radial-gradient(circle at 50% 0%, #3B8CEB, #1D59BE 25%, #0F2A66 60%);
  box-shadow: 0 0 30px 10px rgba(150,215,255,.85), 0 0 140px 60px rgba(80,150,255,.45);
}
body.sunward #rays { opacity: calc(.25 + var(--heat) * .6); }
body.sunward #rays span { background: linear-gradient(180deg, rgba(255,226,154,.65), rgba(255,226,154,0)); }
body.sunward #snow { opacity: calc(.6 - var(--heat) * .55); }
/* Flying up: thrusters underneath, streaks fall past */
#mascot .flame-down { display: none; }
body.sunward #mascot .flame-up { display: none; }
body.sunward #mascot .flame-down { display: inline; transform-origin: 50% 0; }
body.sunward #bubbles span { bottom: auto; top: -60px; background: linear-gradient(0deg, rgba(255,240,200,.9), rgba(255,200,120,0)); animation-name: streak-down; }
@keyframes streak-down { to { transform: translate3d(0, 115vh, 0); } }

/* ---------- The sky follows the real sun where you live ---------- */
#skytint { position: absolute; inset: 0; pointer-events: none; transition: background 3s; }
body[data-sky="dawn"] #skytint { background: linear-gradient(180deg, rgba(255,170,120,.28), rgba(255,200,140,.06) 45%, rgba(255,200,140,0)); }
body[data-sky="day"] #skytint { background: linear-gradient(180deg, rgba(150,210,255,.22), rgba(150,210,255,0) 55%); }
body[data-sky="dusk"] #skytint { background: linear-gradient(180deg, rgba(255,110,140,.3), rgba(190,90,200,.12) 50%, rgba(190,90,200,0)); }
body[data-sky="night"] #skytint { background: linear-gradient(180deg, rgba(10,10,40,.3), rgba(10,10,40,0) 60%); }
body[data-sky="dawn"] { --accent: #FFC857; }
body[data-sky="dusk"] { --accent: #FF9F7A; }

/* ---------- Home: up/down switch, launches, special days ---------- */
.dir-switch { display: grid; justify-items: center; gap: 8px; width: 100%; }
.dir-switch h1 { margin: 2px 0; }
.dir-arrow {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 360px; padding: 8px 14px; min-height: 52px;
  border-radius: 16px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.06); color: var(--text);
  cursor: pointer; text-align: left; transition: background .2s, border-color .2s, transform .15s;
}
.dir-arrow span { display: grid; line-height: 1.2; }
.dir-arrow b { font-size: 17px; font-weight: 900; }
.dir-arrow small { color: var(--muted); font-weight: 700; font-size: 13px; }
.dir-arrow svg { flex: none; padding: 7px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); }
.dir-arrow:hover { background: rgba(255,255,255,.12); }
.dir-arrow:active { transform: scale(.98); }
.dir-arrow.up.on { background: linear-gradient(90deg, rgba(255,200,90,.32), rgba(255,140,60,.18)); border-color: #FFC857; }
.dir-arrow.up.on svg { background: #FFC857; color: #3a1d00; }
.dir-arrow.down.on { background: linear-gradient(90deg, rgba(127,180,255,.28), rgba(166,139,255,.18)); border-color: #9DB8FF; }
.dir-arrow.down.on svg { background: #9DB8FF; color: #0b1240; }
.dir-arrow:not(.on) { opacity: .85; }
.rounds { display: grid; gap: 10px; width: 100%; }
.round-btn {
  display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 10px; width: 100%;
  padding: 10px 14px; min-height: 62px; border-radius: 16px; cursor: pointer; text-align: left; color: var(--text);
  border: 1px solid var(--glass-border); background: rgba(255,255,255,.07);
}
.round-btn.dawn { background: linear-gradient(90deg, rgba(255,200,87,.25), rgba(255,140,90,.1)); border-color: rgba(255,200,87,.6); }
.round-btn.dusk { background: linear-gradient(90deg, rgba(255,110,140,.22), rgba(160,110,255,.14)); border-color: rgba(255,140,170,.5); }
.round-btn.locked { opacity: .6; cursor: default; }
.round-btn.done { opacity: .9; }
.round-btn:not(.locked):hover { filter: brightness(1.12); }
.round-text { display: grid; line-height: 1.25; min-width: 0; }
.round-text b { font-size: 18px; font-weight: 900; }
.round-text small { color: var(--muted); font-weight: 700; font-size: 13px; }
.round-go { font-weight: 900; padding: 6px 14px; border-radius: 999px; background: var(--accent); color: #1a1203; white-space: nowrap; display: inline-flex; align-items: center; }
.round-btn.locked .round-go { background: rgba(255,255,255,.14); color: var(--text); padding: 8px; }
.round-btn.done .round-go { background: rgba(255,255,255,.16); color: var(--text); }
.special-day { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 14px; border-radius: 16px; text-align: left; background: rgba(255,214,107,.12); border: 1px solid rgba(255,214,107,.5); }
.special-day svg { flex: none; }
.special-day div { display: grid; line-height: 1.3; }
.special-day b { color: #FFE29A; }
.special-day small { color: var(--text); font-size: 13px; }
.special-day.eclipse { background: rgba(198,181,255,.12); border-color: rgba(198,181,255,.55); }
.special-day.eclipse b { color: #E2D9FF; }
.card .sun-line, .sun-line { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; font-size: 14px; color: var(--muted); }
.sun-line svg { flex: none; }
.bonus-tag { color: #E2D9FF; background: rgba(166,139,255,.3); padding: 1px 8px; border-radius: 999px; }
.tier-chip small { color: var(--muted); font-weight: 800; margin-left: 4px; }
@media (prefers-reduced-motion: reduce) { #sunworld .sun-corona { animation: none; } }

/* Near the Sun the sky turns pale: keep the glass dark enough to read */
body.sunward .card { background: var(--glass); }

/* ---------- Usernames, friends, reports ---------- */
.claim { text-align: center; }
.claim .stack-form { text-align: left; }
.claim-badge, .me-badge { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%; font: 900 30px/1 Nunito, sans-serif; color: #0b1240; background: radial-gradient(circle at 35% 30%, #fff6c9, #F2B84B 60%, #c9862a); box-shadow: 0 0 0 4px rgba(242,184,75,.25), 0 8px 20px rgba(0,0,0,.35); }
.me-badge { width: 52px; height: 52px; font-size: 24px; margin: 0; flex: none; }
.un-field { display: flex; align-items: center; gap: 6px; padding-left: 14px; border-radius: 14px; background: rgba(4,14,34,.6); border: 2px solid rgba(255,255,255,.2); }
.un-field:focus-within { border-color: var(--focus); }
.un-field span { font-weight: 900; color: var(--muted); }
.un-field .answer-input { border: 0; background: transparent; padding-left: 0; box-shadow: none !important; flex: 1 1 auto; min-width: 0; }
.un-field.grow { flex: 1 1 auto; min-width: 0; }
.card .un-status, .un-status { min-height: 1.4em; font-weight: 800; color: var(--muted); margin: 0; }
.un-status.ok { color: #7CF5A8; }
.un-status.bad { color: #FFB4AC; }
.friends-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.friends-head h2 { overflow-wrap: anywhere; }
@media (max-width: 480px) { .friends-head { grid-template-columns: auto minmax(0, 1fr); } .friends-head .btn { grid-column: 1 / -1; } }
.game-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 16px 0 4px; padding-bottom: 4px; }
.game-tab { flex: none; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.06); color: var(--text); font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.game-tab.on.deep { background: #9DB8FF; color: #0b1240; border-color: #9DB8FF; }
.game-tab.on.sun { background: #FFC857; color: #3a1d00; border-color: #FFC857; }
.board li.waiting { opacity: .6; }
.report-row { text-align: center; margin-top: 10px !important; }
.report-row .link-btn { font-size: 14px; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.08); color: var(--text); font-weight: 800; cursor: pointer; }
.chip:hover { background: rgba(255,255,255,.16); }

/* ---------- Online play: events and polish ---------- */
.ol-topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.answer-dots { display: inline-flex; gap: 5px; }
.answer-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); transition: background .3s, transform .3s; }
.answer-dots i.on { background: #FFE38A; box-shadow: 0 0 8px rgba(255,227,138,.8); transform: scale(1.1); }
.ol-prompt-text { font-size: clamp(26px, 5.5vw, 36px) !important; }
.turn-banner.mine { display: inline-block; padding: 6px 16px; border-radius: 999px; background: #FFE38A; color: #1a1203 !important; animation: turn-glow 1.2s ease-in-out infinite; }
@keyframes turn-glow { 50% { box-shadow: 0 0 0 6px rgba(255,227,138,.25), 0 0 24px rgba(255,227,138,.6); } }
.typing { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .3; animation: typing 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 30% { opacity: 1; transform: translateY(-3px); } }
.online-play .answer-form .answer-input { font-size: 20px; }
.ol-last { padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.ol-last:empty { display: none; }

/* A heart breaking: the seat shakes and flashes, the heart splits and falls */
.seat.hurt .avatar { animation: seat-hurt .6s ease; }
@keyframes seat-hurt {
  0%, 100% { translate: 0 0; }
  15% { translate: -7px 0; box-shadow: 0 0 0 4px #FF6F61, 0 0 30px 8px rgba(255,80,80,.8); }
  30% { translate: 6px 0; }
  45% { translate: -5px 0; }
  60% { translate: 4px 0; }
}
.heart.breaking { animation: heart-crack .9s ease forwards; }
@keyframes heart-crack { 0% { fill: #FF6F61; transform: scale(1.6); } 40% { fill: #FF6F61; transform: scale(1.3) rotate(-12deg); } 100% { fill: rgba(255,255,255,.18); transform: none; } }
.heart-burst { position: absolute; z-index: 5; transform: translate(-50%, -50%); pointer-events: none; width: 60px; height: 60px; }
.heart-burst .half { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; }
.heart-burst .half svg { width: 44px; height: 44px; fill: #FF4D5E; filter: drop-shadow(0 0 10px rgba(255,77,94,.8)); }
.heart-burst .half.l { clip-path: polygon(0 0, 52% 0, 44% 35%, 56% 55%, 46% 100%, 0 100%); animation: half-l 1.6s cubic-bezier(.2,.6,.4,1) forwards; }
.heart-burst .half.r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 46% 100%, 56% 55%, 44% 35%); animation: half-r 1.6s cubic-bezier(.2,.6,.4,1) forwards; }
.heart-burst b { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); font-size: 22px; font-weight: 900; color: #FF6F61; text-shadow: 0 2px 6px rgba(0,0,0,.6); animation: minus-one 1.6s ease forwards; }
@keyframes half-l { 0% { transform: scale(.4); opacity: 0; } 18% { transform: scale(1.3); opacity: 1; } 35% { transform: scale(1.2) translate(0, 0) rotate(0); } 100% { transform: scale(1) translate(-26px, 70px) rotate(-40deg); opacity: 0; } }
@keyframes half-r { 0% { transform: scale(.4); opacity: 0; } 18% { transform: scale(1.3); opacity: 1; } 35% { transform: scale(1.2) translate(0, 0) rotate(0); } 100% { transform: scale(1) translate(26px, 70px) rotate(40deg); opacity: 0; } }
@keyframes minus-one { 0% { opacity: 0; transform: translate(-50%, 10px); } 25% { opacity: 1; transform: translate(-50%, -12px); } 100% { opacity: 0; transform: translate(-50%, -40px); } }
/* When it's your heart: the screen edges flash red */
body.ouch::after { content: ""; position: fixed; inset: 0; z-index: 30; pointer-events: none; box-shadow: inset 0 0 120px 30px rgba(255,40,60,.75); animation: ouch .9s ease forwards; }
@keyframes ouch { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.points-pop { position: absolute; z-index: 5; transform: translate(-50%, -50%); pointer-events: none; font-size: 24px; font-weight: 900; text-shadow: 0 2px 8px rgba(0,0,0,.7); animation: pop-up 1.4s ease forwards; }
@keyframes pop-up { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -20px) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.new-prompt-banner { position: absolute; left: 50%; top: 50%; z-index: 6; transform: translate(-50%, -50%); padding: 10px 22px; border-radius: 999px; background: #FFE38A; color: #1a1203; font-weight: 900; font-size: 22px; white-space: nowrap; box-shadow: 0 0 40px rgba(255,227,138,.7); animation: banner-in 2.2s ease forwards; }
@keyframes banner-in { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .turn-banner.mine, .typing i, .heart.breaking, .seat.hurt .avatar, .new-prompt-banner { animation: none; }
}

/* =====================================================================
   Brand: logo and wordmark
   ===================================================================== */
.brand-mark-slot { display: inline-flex; }
.brand .wordmark { font-weight: 900; font-size: 20px; letter-spacing: .01em; background: linear-gradient(90deg, #FFE9A8, #FFC857 45%, #9DD7FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.menu-btn { margin-right: 2px; }
body.sunward .brand .wordmark { background: linear-gradient(90deg, #C2571A, #F07A2B 50%, #2E6BD6); -webkit-background-clip: text; background-clip: text; }
.emblem .rays { transform-origin: 50px 50px; animation: rays-turn 24s linear infinite; }
.emblem .twinkle { animation: twinkle 2.4s ease-in-out infinite alternate; }
.emblem .disc { transform-origin: 50px 52px; animation: disc-wobble 6s ease-in-out infinite alternate; }
@keyframes rays-turn { to { transform: rotate(360deg); } }
@keyframes disc-wobble { to { transform: rotate(4deg) scale(1.03); } }

/* =====================================================================
   Home: the up / down portals
   ===================================================================== */
.portals { width: 100%; display: grid; gap: 0; border-radius: 22px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.portal {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px;
  width: 100%; padding: 14px 18px; border: 0; cursor: pointer; text-align: left; color: inherit;
  transition: padding .35s ease, filter .2s;
}
.portal .emblem { transition: width .35s ease, height .35s ease; }
.portal-text { display: grid; line-height: 1.15; }
.portal-kicker { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.portal-kicker svg { width: 16px; height: 16px; }
.portal b { font-size: 22px; font-weight: 900; }
.portal small { font-size: 14px; font-weight: 700; opacity: .85; }
.portal.up { background: linear-gradient(160deg, #FFF6D6 0%, #FFD28A 55%, #FF9F5A 100%); color: #3a1d00; }
.portal.down { background: radial-gradient(120% 140% at 80% 120%, #3B1E78 0%, #120A36 45%, #04020C 100%); color: #EAF0FF; }
.portal.down::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(1.5px 1.5px at 20% 30%, #fff 60%, transparent), radial-gradient(1px 1px at 70% 20%, #fff 60%, transparent), radial-gradient(1px 1px at 85% 70%, #fff 60%, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #cfd8ff 60%, transparent), radial-gradient(1px 1px at 60% 55%, #fff 60%, transparent); opacity: .8; }
.portal.on { padding: 22px 18px; }
.portal:not(.on) { filter: saturate(.7) brightness(.92); }
.portal:not(.on):hover { filter: none; }
.portal.on b { font-size: 28px; }
.portal-seam { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; background: linear-gradient(90deg, #FF9F5A, #7B5CFF 50%, #2E6BD6); }
.portal-seam h1 { font-size: 30px !important; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.35); margin: 0; }
.seam-mark { display: inline-flex; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
@media (min-width: 720px) {
  .portal { padding: 18px 26px; }
  .portal.on { padding: 28px 26px; }
}

/* The warp when switching: a sunburst going up, a starfield going down */
.warp { position: fixed; inset: 0; z-index: 40; pointer-events: none; display: grid; place-items: center;
  clip-path: circle(0 at var(--x) var(--y)); animation: warp-open .55s cubic-bezier(.6,0,.4,1) forwards; }
.warp.to-sun { background: radial-gradient(circle at var(--x) var(--y), #FFFFFF 0%, #FFF1BF 20%, #FFC857 55%, #FF8A3C 100%); }
.warp.to-deep { background: radial-gradient(circle at var(--x) var(--y), #3B1E78 0%, #0B0626 45%, #000 100%); }
.warp.to-deep::before { content: ""; position: absolute; inset: -20%; background-image: repeating-conic-gradient(from 0deg at var(--x) var(--y), rgba(255,255,255,.35) 0deg .4deg, transparent .6deg 7deg); animation: warp-spin .9s linear; }
.warp .emblem { width: 160px; height: 160px; animation: warp-emblem .9s ease forwards; }
.warp.out { animation: warp-fade .6s ease forwards; clip-path: circle(150% at var(--x) var(--y)); }
@keyframes warp-open { to { clip-path: circle(150% at var(--x) var(--y)); } }
@keyframes warp-fade { to { opacity: 0; } }
@keyframes warp-spin { to { transform: rotate(25deg) scale(1.2); } }
@keyframes warp-emblem { 0% { transform: scale(.3); opacity: 0; } 50% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }

/* =====================================================================
   ▲ Sunward = light theme   ▼ Deep Space = dark theme (the default)
   ===================================================================== */
body.sunward {
  --text: #2B1A06;
  --muted: #6B5238;
  --glass: rgba(255, 250, 240, 0.80);
  --glass-strong: rgba(255, 248, 236, 0.96);
  --glass-border: rgba(140, 80, 10, 0.18);
  --accent: #F2A33A;
  --focus: #C2571A;
  color-scheme: light;
}
body.sunward #space { background: #CDEBFF; }
body.sunward .hud { background: rgba(255, 249, 238, .85); border-bottom-color: rgba(140,80,10,.15); color: var(--text); }
body.sunward .hud-mode { background: rgba(140,80,10,.08); color: var(--muted); }
body.sunward .icon-btn { background: rgba(140,80,10,.08); border-color: rgba(140,80,10,.15); color: var(--text); }
body.sunward .card { box-shadow: 0 12px 32px rgba(160, 90, 20, .18); }
body.sunward .btn { background: rgba(140,80,10,.07); border-color: rgba(140,80,10,.2); color: var(--text); }
body.sunward .btn:hover { background: rgba(140,80,10,.13); }
body.sunward .btn-primary { background: linear-gradient(180deg, #FFC857, #F2A33A); color: #2B1A06; border-color: transparent; }
body.sunward .answer-input, body.sunward .field input, body.sunward select { background: #fff; color: var(--text); border-color: rgba(140,80,10,.25); }
body.sunward .answer-input::placeholder { color: rgba(80,50,20,.45); }
body.sunward .link-btn { color: #B25410; }
body.sunward .tier-row, body.sunward .board li, body.sunward .ol-lobby li, body.sunward .tile, body.sunward .round-btn, body.sunward .rung, body.sunward .flight-log li, body.sunward .topic, body.sunward .menu-item { background: rgba(140,80,10,.06); }
body.sunward .tier-row.mine { background: rgba(242,163,58,.22); }
body.sunward .zone-label, body.sunward .tick, body.sunward .floor-label { color: rgba(60,35,10,.65); }
body.sunward .gauge-zone { color: rgba(60,35,10,.7); }
body.sunward .sheet { color: var(--text); }
body.sunward .share-box { background: rgba(140,80,10,.08); color: var(--text); }
body.sunward .rare-fact, body.sunward .special-day { background: rgba(255,255,255,.6); }
body.sunward .rare-fact p, body.sunward .special-day small { color: var(--text); }
body.sunward .guess-feedback, body.sunward .error { color: #B42318; }
body.sunward .timer .track { stroke: rgba(140,80,10,.15); }
body.sunward .timer .ring { stroke: #F07A2B; }
body.sunward .round-btn.dawn { background: linear-gradient(90deg, rgba(255,200,87,.45), rgba(255,140,90,.18)); }
body.sunward .round-btn.dusk { background: linear-gradient(90deg, rgba(255,110,140,.25), rgba(160,110,255,.15)); }
body.sunward .streak, body.sunward .mult.half { background: rgba(140,80,10,.08); color: var(--text); }
body.sunward .squares span { box-shadow: 0 0 0 1px rgba(140,80,10,.2); }
body.sunward #snow span { background: #fff8d6; box-shadow: none; }
body.sunward .tagline strong, body.sunward .card p strong { color: var(--text); }
/* switching themes fades the glass rather than snapping */
.card, .hud, .btn, .answer-input { transition: background-color .5s, color .5s, border-color .5s; }

/* =====================================================================
   Side menu (drawer)
   ===================================================================== */
.sheet-backdrop.drawer { align-items: stretch; justify-content: flex-start; }
.drawer .sheet { width: min(88vw, 360px); max-width: none; height: 100%; max-height: none; border-radius: 0 24px 24px 0; border: 1px solid var(--glass-border); border-left: 0; animation: drawer-in .28s cubic-bezier(.2,.8,.2,1) both; padding-top: calc(20px + env(safe-area-inset-top)); overflow-y: auto; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
.drawer-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; }
.drawer-brand b { font-weight: 900; }
.menu-list { display: grid; gap: 6px; }
.menu-h { margin: 12px 4px 2px !important; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted) !important; }
.menu-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid transparent; background: rgba(255,255,255,.05); color: var(--text); text-align: left; cursor: pointer; }
.menu-item:hover { background: rgba(255,255,255,.12); border-color: var(--glass-border); }
.menu-item b { display: block; font-size: 16px; }
.menu-item small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.menu-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.08); color: var(--c, var(--text)); }
.menu-icon .emblem { width: 34px; height: 34px; }
.menu-icon .at { font-size: 20px; font-weight: 900; }
.board-pick { display: grid; gap: 4px; padding: 0 4px 4px; font-weight: 800; font-size: 14px; color: var(--muted); }
.board-pick select, .field select { padding: 10px 12px; border-radius: 12px; font: 700 16px Nunito, sans-serif; background: rgba(4,14,34,.6); color: var(--text); border: 1px solid var(--glass-border); }

/* =====================================================================
   GCSE subject screen
   ===================================================================== */
.subject-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.subject-badge { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; color: #061a33; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 10px 24px rgba(0,0,0,.3); }
.subject-badge svg { width: 34px; height: 34px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.07); margin-bottom: 10px; }
.seg button { padding: 10px 8px; border-radius: 10px; border: 0; background: transparent; color: var(--text); font-weight: 800; font-size: 14px; cursor: pointer; }
.seg button.on { background: var(--c, #9DB8FF); color: #061a33; }
.dir-seg button.sun.on { background: #FFC857; color: #3a1d00; }
.dir-seg button.deep.on { background: #9DB8FF; color: #0b1240; }
.subject .btn-big { margin-top: 10px; }
.topic-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 8px; }
.topic { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.05); color: var(--text); cursor: pointer; }
.topic:hover { border-color: var(--c); }
.topic small { color: var(--muted); font-weight: 700; }
.small-print { font-size: 13px !important; margin-top: 14px !important; }

/* =====================================================================
   Reveal: the slow trip past each rank
   ===================================================================== */
.reveal-body { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 18px; align-items: center; margin-top: 12px; }
@media (max-width: 520px) { .reveal-body { grid-template-columns: minmax(0, 1fr); } }
.ladder { position: relative; display: grid; grid-auto-rows: 44px; padding-left: 40px; }
.rung { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; height: 38px; margin: 3px 0; padding: 0 10px; border-radius: 12px; background: rgba(255,255,255,.04); opacity: .35; transition: opacity .3s, background .3s, transform .3s; }
.rung-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rung-pts { font-weight: 900; font-variant-numeric: tabular-nums; }
.rung.passed { opacity: 1; background: color-mix(in srgb, var(--c) 18%, transparent); }
.rung.landed { background: color-mix(in srgb, var(--c) 38%, transparent); box-shadow: 0 0 0 2px var(--c), 0 0 22px color-mix(in srgb, var(--c) 60%, transparent); transform: scale(1.04); }
.ladder-pip { position: absolute; left: 0; top: 3px; width: 34px; height: 38px; display: grid; place-items: center; transition: transform .5s cubic-bezier(.4,.1,.3,1); }
.ladder-pip span { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, #D9E2EE 55%, #8E9CB3); box-shadow: 0 0 0 3px #F2B84B, 0 0 14px rgba(242,184,75,.8); }
.ladder.missed .ladder-pip span { box-shadow: 0 0 0 3px #55657E; }
.ladder.shake { animation: ladder-shake .5s ease; }
@keyframes ladder-shake { 25% { translate: -5px 0; } 50% { translate: 5px 0; } 75% { translate: -3px 0; } }
.trip-counter { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.trip-counter span { font-size: 44px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.trip-counter small { font-size: 16px; font-weight: 800; color: var(--muted); }
.reveal:not(.done) .badge-slot { opacity: 0; transform: translateY(10px) scale(.96); }
.reveal .badge-slot { transition: opacity .4s ease, transform .4s cubic-bezier(.3,1.5,.5,1); }
.reveal.done .trip-counter span { animation: count-pop .5s ease; }
@keyframes count-pop { 40% { transform: scale(1.15); } }
body.stepping #world, body.stepping #sunworld { transition-duration: .55s; }
.spark { position: fixed; z-index: 45; width: 8px; height: 8px; margin: -4px; border-radius: 50%; pointer-events: none; background: #FFE38A; box-shadow: 0 0 10px #FFE38A; animation: spark .9s ease-out forwards; }
.spark:nth-child(3n) { background: #B98CFF; box-shadow: 0 0 10px #B98CFF; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }

/* =====================================================================
   Mission report (results)
   ===================================================================== */
.mission-hero { position: relative; text-align: center; overflow: hidden; }
.mission-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; }
.mission-hero.deep::before { background: radial-gradient(120% 90% at 50% 0%, rgba(123,92,255,.35), transparent 60%); }
.mission-hero.sun::before { background: radial-gradient(120% 90% at 50% 0%, rgba(255,200,87,.55), transparent 60%); }
.mission-hero > * { position: relative; }
.mission-emblem { display: flex; justify-content: center; margin-bottom: 4px; }
.rank-title { font-size: 20px; font-weight: 900; margin: 2px 0; }
.pb { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: #FFE38A; color: #1a1203; font-size: 14px; vertical-align: middle; }
.card h3 { margin-bottom: 10px; }
.mission-tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)) !important; }
.mission-tiles .tile .v { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 22px; overflow-wrap: anywhere; }
.mission-tiles .tile.wide { grid-column: span 2; }
@media (max-width: 400px) { .mission-tiles .tile.wide { grid-column: auto; } }
.tier-bars { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.tier-bars li { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) 2em; gap: 10px; align-items: center; }
.tb-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; white-space: nowrap; }
.tb-bar { height: 12px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.tb-bar span { display: block; height: 100%; border-radius: 6px; transition: width 1s ease; }
.tb-n { font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }
.flight-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.flight-log li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.05); }
.flight-log li.miss { opacity: .7; }
.fl-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 13px; background: rgba(255,255,255,.1); }
.fl-main { display: grid; min-width: 0; line-height: 1.25; }
.fl-main small { color: var(--muted); font-weight: 700; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-main b { font-size: 16px; overflow-wrap: anywhere; }
.fl-main em { font-style: normal; font-size: 12px; color: var(--muted); }
.fl-tier { display: grid; justify-items: center; color: var(--c); }
.fl-tier small { font-size: 11px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.fl-pts { display: grid; justify-items: end; font-weight: 900; font-variant-numeric: tabular-nums; }
.fl-pts small { font-size: 12px; color: var(--muted); font-weight: 700; }
@media (max-width: 420px) { .fl-tier small { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .emblem .rays, .emblem .twinkle, .emblem .disc, .warp, .ladder-pip, .spark { animation: none !important; transition: none !important; }
}

/* ---------- Secret stats (hold the header logo 10 s) ---------- */
.brand { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.brand .brand-mark { transition: transform .3s ease, filter .3s ease; }
.brand.holding .brand-mark { transform: scale(1.12); filter: brightness(1.15); transition: transform 10s linear, filter 10s linear; }
.admin-big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 14px; }
.admin-big > div { display: grid; gap: 2px; padding: 16px 12px; border-radius: 16px; text-align: center; background: rgba(255,255,255,.07); border: 1px solid var(--glass-border); }
.admin-big span { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.admin-big b { font-size: clamp(30px, 10vw, 44px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
.admin-big small { color: var(--muted); font-weight: 700; }
.admin-modes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.admin-modes li { display: grid; grid-template-columns: minmax(0, 1fr) 5em 5em; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.04); }
.admin-modes li b, .admin-modes li.h span { text-align: right; font-variant-numeric: tabular-nums; }
.admin-modes li.h { background: none; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.admin-body .muted { color: var(--muted); }

/* Seats are placed by the centre of their avatar, not of the whole block,
   so the avatar never rides up onto the bezel. Labels face the centre. */
.seat { --av: 48px; transform: translate(-50%, calc(var(--av) / -2)); }
.seat.lower { flex-direction: column-reverse; transform: translate(-50%, calc(-100% + var(--av) / 2)); }
.seat.lower.turn .seat-name { margin-top: 0; margin-bottom: 9px; }
@media (max-width: 400px) { .seat { --av: 42px; } }
@media (min-width: 720px) { .seat { --av: 56px; } }

/* ---------- Profile pictures ---------- */
.pfp, .me-badge { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; font-weight: 900; color: #0b1240; background: radial-gradient(circle at 35% 30%, #fff6c9, #F2B84B 60%, #c9862a); }
.pfp img, .me-badge img, .seat .avatar img, .icon-btn.has-pic img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.pfp.sm { width: 24px; height: 24px; font-size: 12px; margin-right: 6px; vertical-align: middle; }
.pfp.xl { width: 96px; height: 96px; font-size: 40px; box-shadow: 0 0 0 4px rgba(242,184,75,.35), 0 10px 24px rgba(0,0,0,.35); }
.board .who { display: inline-flex; align-items: center; min-width: 0; }
.profile-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; padding: 4px 0 16px; margin-bottom: 14px; border-bottom: 1px solid var(--glass-border); }
.profile-who { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.profile-who > b { font-size: 20px; overflow-wrap: anywhere; }
.pfp-actions { margin: 4px 0 0 !important; justify-content: flex-start !important; flex-wrap: wrap; }
.pfp-actions .btn { min-height: 42px; padding: 8px 14px; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-btn.busy { opacity: .6; pointer-events: none; }
.icon-btn.has-pic { padding: 0; overflow: hidden; }
.seat .avatar.has-pic { padding: 0; }
.seat .avatar.has-pic img { position: relative; z-index: 1; }
@media (max-width: 380px) { .profile-head { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; } .profile-who { justify-items: center; } .pfp-actions { justify-content: center !important; } }

/* ---------- Pip: blinking visor eyes and a breathing core ---------- */
#mascot .eye, .centre-pip .eye { transform-box: fill-box; transform-origin: 50% 50%; animation: pip-blink 4.6s infinite; }
@keyframes pip-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.12); } }
#mascot .core { animation: pip-core 2.4s ease-in-out infinite alternate; }
@keyframes pip-core { from { opacity: .75; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #mascot .eye, .centre-pip .eye, #mascot .core { animation: none; } }
.admin-chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 140px; margin-bottom: 14px; }
.ac-col { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; height: 100%; gap: 3px; }
.ac-col b { font-size: 12px; font-variant-numeric: tabular-nums; }
.ac-col span { align-self: end; width: 70%; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #FFE38A, #F2A33A); }
.ac-col small { font-size: 11px; font-weight: 800; color: var(--muted); }

/* =====================================================================
   Geography: the world behind the section, and the fly-in
   ===================================================================== */
#globe-bg { position: absolute; inset: 0; display: none; pointer-events: none; }
#globe-bg canvas { position: absolute; left: 50%; top: 58%; width: min(150vw, 150vh); height: min(150vw, 150vh); transform: translate(-50%, -50%); }
body.geo-mode #globe-bg { display: block; }
body.geo-mode #world, body.geo-mode #sunworld, body.geo-mode #rays, body.geo-mode #skytint { opacity: 0; }
body.geo-mode #space { background: radial-gradient(120% 80% at 50% 20%, #0d1f4d 0%, #050816 60%); }
body.geo-mode .gauge { opacity: .35; }
body.geo-mode .card { background: rgba(6, 20, 46, .72); }
body.sunward.geo-mode .card { background: rgba(255, 250, 240, .86); }
@media (min-width: 1000px) { #globe-bg canvas { left: 30%; top: 55%; width: min(95vw, 120vh); height: min(95vw, 120vh); } }
body.geo-arriving #globe-bg canvas { animation: globe-arrive 2.2s cubic-bezier(.2,.75,.2,1) both; }
@keyframes globe-arrive {
  0% { transform: translate(-50%, -50%) scale(.02) rotate(-40deg); filter: brightness(3); }
  55% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); filter: brightness(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); filter: none; }
}
body.geo-arriving #app { animation: geo-app-in 2.2s ease both; }
@keyframes geo-app-in { 0%, 60% { opacity: 0; transform: translateY(30px); } 100% { opacity: 1; transform: none; } }
.geo-intro { position: fixed; inset: 0; z-index: 30; pointer-events: none; display: grid; place-items: center; }
.gi-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 55%, rgba(255,255,255,.95), rgba(140,200,255,.35) 25%, rgba(5,8,22,0) 60%); animation: gi-flash 1.2s ease-out both; }
@keyframes gi-flash { 0% { opacity: 0; transform: scale(.2); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }
.gi-ring { position: absolute; left: 50%; top: 55%; width: 40px; height: 40px; margin: -20px; border-radius: 50%; border: 3px solid rgba(160, 220, 255, .9); box-shadow: 0 0 30px rgba(120,200,255,.8); animation: gi-ring 1.4s cubic-bezier(.2,.7,.2,1) both; }
.gi-ring.r2 { animation-delay: .25s; border-color: rgba(127, 211, 138, .9); }
@keyframes gi-ring { from { transform: scale(.2); opacity: 1; } to { transform: scale(28); opacity: 0; } }
.gi-title { position: relative; text-align: center; color: #fff; text-shadow: 0 4px 24px rgba(0,0,0,.6); }
.gi-title small { display: block; font-weight: 900; letter-spacing: .4em; text-transform: uppercase; font-size: 14px; opacity: 0; animation: gi-fade .6s .5s ease both; }
.gi-title b { display: block; font-size: clamp(44px, 13vw, 96px); font-weight: 900; letter-spacing: .04em; }
.gi-title b span { display: inline-block; opacity: 0; animation: gi-letter .5s calc(.45s + var(--i) * .06s) cubic-bezier(.3,1.6,.5,1) both; background: linear-gradient(180deg, #ffffff, #9ee6a8); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes gi-letter { from { opacity: 0; transform: translateY(40px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes gi-fade { to { opacity: .85; } }
.geo-intro.out { animation: gi-out .6s ease forwards; }
@keyframes gi-out { to { opacity: 0; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { body.geo-arriving #globe-bg canvas, body.geo-arriving #app { animation: none; } }

/* =====================================================================
   Online: players orbit the Earth
   ===================================================================== */
.ring-art .star { fill: #fff; animation: star-twinkle 3.6s ease-in-out infinite alternate; }
@keyframes star-twinkle { from { opacity: .25; } to { opacity: .95; } }
.ring-art .orbit-path { fill: none; stroke: url(#orbit-glow); stroke-width: .45; stroke-dasharray: 1.2 1.6; opacity: .85; }
.ring-art .orbit-path.glow { stroke-dasharray: none; stroke-width: 2.2; opacity: .12; filter: blur(.6px); }
.ring-earth { position: absolute; left: 50%; top: 50%; width: 50%; aspect-ratio: 1; height: auto; transform: translate(-50%, -50%); pointer-events: none; }
.ring-centre { z-index: 1; }
.centre-code, .centre-timer { background: none !important; }
.centre-code span, .centre-code small { color: #e8f3ff; text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.centre-code b { text-shadow: 0 2px 10px rgba(0,0,0,.85), 0 0 18px rgba(255,200,87,.5); }
.centre-code { gap: 0; }
.centre-pip { filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
/* The orbit turns; each player stays upright as they go round. */
.orbit-layer, .ring-seats { position: absolute; inset: 0; animation: orbit-turn 120s linear infinite; }
.orbit-layer { pointer-events: none; }
.ring-seats { z-index: 2; }
.seat { transform-origin: 0 0; animation: orbit-upright 120s linear infinite; }
@keyframes orbit-turn { to { transform: rotate(360deg); } }
@keyframes orbit-upright { from { rotate: 0deg; } to { rotate: -360deg; } }
.seat.turn .avatar { box-shadow: 0 0 0 3px #FFE38A, 0 0 0 6px rgba(255,227,138,.35), 0 0 30px 8px color-mix(in srgb, var(--c) 70%, transparent); }
/* Whose turn it is: a beam of light from Earth out to their orbit. */
.ring-sweep { inset: 0; }
.ring-sweep::before { background: conic-gradient(from 0deg, rgba(127,230,255,0) 0deg 340deg, rgba(127,230,255,.10) 348deg, rgba(190,246,255,.55) 359deg, rgba(127,230,255,0) 360deg) !important; -webkit-mask: radial-gradient(circle, transparent 0 24%, #000 25% 100%); mask: radial-gradient(circle, transparent 0 24%, #000 25% 100%); }
.ring-sweep.idle { animation-duration: 9s; }
@media (prefers-reduced-motion: reduce) { .orbit-layer, .ring-seats, .seat, .ring-art .star { animation: none; } }

/* Theme picker in the lobby */
.theme-pick { width: 100%; }
.theme-h { margin: 0 0 8px; text-align: center; font-weight: 800; color: var(--muted); }
.theme-h b { color: var(--text); margin-left: 6px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.theme-chip { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--glass-border); background: rgba(255,255,255,.06); color: var(--text); font: 800 14px Nunito, sans-serif; cursor: pointer; }
.theme-chip span { grid-row: span 2; font-size: 22px; }
.theme-chip small { color: var(--muted); font-weight: 700; font-size: 11px; }
.theme-chip.on { background: rgba(255,200,87,.22); border-color: #FFC857; box-shadow: 0 0 0 2px rgba(255,200,87,.35); }

/* Losing a heart: it cracks in two and shatters across the screen */
.heart-loss { position: fixed; inset: 0; z-index: 35; pointer-events: none; display: grid; place-items: center; align-content: center; gap: 14px; }
.hl-flash { position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,60,80,.45), rgba(255,60,80,0) 65%); animation: hl-flash 1.4s ease-out both; }
.heart-loss.me .hl-flash { background: radial-gradient(circle, rgba(255,40,60,.65), rgba(120,0,20,.35) 60%, rgba(0,0,0,0)); }
@keyframes hl-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.hl-heart { position: relative; width: 140px; height: 130px; animation: hl-pop .45s cubic-bezier(.3,1.7,.5,1) both; }
@keyframes hl-pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hl-heart svg { width: 140px; height: 130px; fill: #ff4d63; filter: drop-shadow(0 0 22px rgba(255,77,99,.9)); }
.hl-l, .hl-r { position: absolute; inset: 0; }
.hl-l { clip-path: polygon(0 0, 52% 0, 44% 28%, 56% 50%, 46% 72%, 50% 100%, 0 100%); animation: hl-split-l 1.6s .55s cubic-bezier(.5,0,.7,1) both; }
.hl-r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 50% 100%, 46% 72%, 56% 50%, 44% 28%); animation: hl-split-r 1.6s .55s cubic-bezier(.5,0,.7,1) both; }
@keyframes hl-split-l { 0% { transform: none; } 15% { transform: translateX(-6px) rotate(-6deg); } 100% { transform: translate(-90px, 220px) rotate(-50deg); opacity: 0; } }
@keyframes hl-split-r { 0% { transform: none; } 15% { transform: translateX(6px) rotate(6deg); } 100% { transform: translate(90px, 220px) rotate(50deg); opacity: 0; } }
.hl-heart i { position: absolute; left: 50%; top: 45%; width: 12px; height: 12px; background: #ff7a8a; clip-path: polygon(50% 0, 100% 60%, 30% 100%); opacity: 0; animation: hl-shard 1.1s .6s cubic-bezier(.2,.8,.3,1) both; }
@keyframes hl-shard { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)); } }
.hl-text { position: relative; margin: 0; padding: 10px 18px; border-radius: 999px; background: rgba(20, 4, 12, .85); border: 1px solid rgba(255,77,99,.6); color: #fff; font-size: 20px; font-weight: 800; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: hl-text 2.2s ease both; }
.hl-text b { color: #ff8a98; }
@keyframes hl-text { 0% { opacity: 0; transform: translateY(16px); } 15%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.seat.hurt .seat-hearts { animation: hearts-shake .6s ease; }
@keyframes hearts-shake { 20% { transform: translateX(-4px) scale(1.25); } 40% { transform: translateX(4px) scale(1.25); } 60% { transform: translateX(-3px) scale(1.15); } }
.seat-hearts .heart { width: 15px; height: 15px; }

/* =====================================================================
   Home: every button clearly tappable
   ===================================================================== */
.portal { box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.portal.on { box-shadow: inset 0 0 0 3px rgba(255,255,255,.55), 0 0 24px rgba(255,255,255,.15); }
.portal-cue { position: absolute; right: 12px; top: 10px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: .02em; background: rgba(255,255,255,.85); color: #1a1240; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.portal.on .portal-cue { background: #1a1240; color: #fff; }
.portal.down .portal-cue { background: rgba(255,255,255,.9); }
.portal.down.on .portal-cue { background: #FFC857; color: #1a1203; }
.portal:not(.on) .portal-cue { animation: cue-nudge 2.4s ease-in-out infinite; }
@keyframes cue-nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-3px); } 90% { transform: translateY(1px); } }

.round-btn { border-width: 2px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.round-btn:not(.locked):not(.done) .round-go { animation: go-pulse 1.8s ease-in-out infinite; }
@keyframes go-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,200,87,.7); } 50% { box-shadow: 0 0 0 8px rgba(255,200,87,0); } }

.btn-online { width: 100%; display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto; text-align: left; gap: 12px; padding: 14px 16px; border-width: 2px; background: linear-gradient(90deg, rgba(79,209,232,.35), rgba(123,92,255,.3)) !important; border-color: rgba(127,230,255,.8) !important; box-shadow: 0 8px 22px rgba(0,0,0,.25), 0 0 20px rgba(79,209,232,.2); }
.btn-online svg { width: 30px; height: 30px; }
.bo-text { display: grid; line-height: 1.2; }
.bo-text b { font-size: 18px; }
.bo-text small { font-size: 13px; font-weight: 700; opacity: .85; }
.tile-go { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.16); font-size: 22px; font-weight: 900; line-height: 1; }

.home-tiles { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.home-tile { --t: #7FD38A; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; min-height: 64px; border-radius: 16px; text-align: left; cursor: pointer; color: var(--text); border: 2px solid color-mix(in srgb, var(--t) 70%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--t) 24%, transparent), color-mix(in srgb, var(--t) 8%, transparent)); box-shadow: 0 6px 16px rgba(0,0,0,.2); transition: transform .15s, filter .15s; font: inherit; }
.home-tile:hover { filter: brightness(1.12); transform: translateY(-1px); }
.home-tile:active { transform: scale(.98); }
.home-tile.geo { grid-column: 1 / -1; --t: #7FD38A; }
.ht-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: color-mix(in srgb, var(--t) 30%, rgba(0,0,0,.2)); color: var(--t); font-size: 20px; font-weight: 900; }
.ht-icon svg { width: 26px; height: 26px; }
.home-tile.geo .ht-icon { background: rgba(0,0,0,.2); }
.ht-text { display: grid; min-width: 0; line-height: 1.2; }
.ht-text b { font-size: 16px; }
.ht-text small { font-size: 12px; font-weight: 700; color: var(--muted); overflow-wrap: anywhere; }
.home-tile .tile-go { width: 26px; height: 26px; font-size: 20px; background: color-mix(in srgb, var(--t) 35%, transparent); }
body.sunward .home-tile { color: #2B1A06; background: linear-gradient(135deg, color-mix(in srgb, var(--t) 40%, #fff), color-mix(in srgb, var(--t) 18%, #fff)); border-color: color-mix(in srgb, var(--t) 80%, #8a5a20); }
body.sunward .ht-icon { color: #2B1A06; }
body.sunward .btn-online { color: #10204a; }
@media (max-width: 380px) { .home-tiles { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .portal-cue, .round-go { animation: none !important; } }
.home-tile:not(.geo) { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; row-gap: 8px; align-items: start; }
.home-tile:not(.geo) .ht-icon { grid-column: 1; grid-row: 1; }
.home-tile:not(.geo) .tile-go { grid-column: 2; grid-row: 1; }
.home-tile:not(.geo) .ht-text { grid-column: 1 / -1; grid-row: 2; }
.ht-text small { overflow-wrap: normal; }

/* =====================================================================
   Answering: the answer flies into Pip, then the big reveal
   ===================================================================== */
.answer-form.launched { opacity: .35; pointer-events: none; transition: opacity .3s; }
.answer-launch { position: fixed; z-index: 32; transform: translate(-50%, -50%); padding: 10px 18px; border-radius: 999px; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 900 20px Nunito, sans-serif; color: #071b33; background: linear-gradient(90deg, #FFE38A, #7FE6FF); box-shadow: 0 0 0 3px rgba(255,255,255,.7), 0 0 30px rgba(127,230,255,.9); pointer-events: none; animation: answer-launch 1.1s cubic-bezier(.55,0,.35,1) forwards; }
@keyframes answer-launch {
  0% { transform: translate(-50%, -50%) scale(1); }
  25% { transform: translate(-50%, calc(-50% - 30px)) scale(1.15); }
  45% { transform: translate(-50%, calc(-50% - 30px)) scale(.9); color: #071b33; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(.08); color: transparent; border-radius: 50%; }
}
body.pip-charging #mascot svg { animation: pip-charge .6s ease-in-out; filter: drop-shadow(0 0 18px #7FE6FF) drop-shadow(0 0 40px #FFE38A) brightness(1.3); }
@keyframes pip-charge { 0%, 100% { transform: none; } 20% { transform: translateX(-3px) scale(1.06); } 40% { transform: translateX(3px) scale(1.1); } 60% { transform: translateX(-2px) scale(1.08); } }
.pip-charge-ring { position: fixed; z-index: 31; width: 30px; height: 30px; margin: -15px; border-radius: 50%; border: 3px solid #7FE6FF; box-shadow: 0 0 20px #7FE6FF; pointer-events: none; animation: charge-ring .8s ease-out forwards; }
@keyframes charge-ring { to { transform: scale(9); opacity: 0; } }

.tier-reveal { --c: #fff; position: fixed; inset: 0; z-index: 33; display: grid; place-items: center; overflow: hidden; cursor: pointer; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 30%, rgba(3,5,20,.6)), rgba(3,5,20,.92) 70%); animation: tr-in .35s ease both; }
@keyframes tr-in { from { opacity: 0; } }
.tier-reveal.out { animation: tr-out .45s ease forwards; }
@keyframes tr-out { to { opacity: 0; transform: scale(1.08); } }
.tr-rays { position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--c) 45%, transparent) 0deg 6deg, transparent 6deg 18deg); -webkit-mask: radial-gradient(circle, #000 0 8%, rgba(0,0,0,.6) 20%, transparent 45%); mask: radial-gradient(circle, #000 0 8%, rgba(0,0,0,.6) 20%, transparent 45%); animation: tr-rays 9s linear infinite, tr-fade-in .8s ease both; }
@keyframes tr-rays { to { transform: rotate(360deg); } }
@keyframes tr-fade-in { from { opacity: 0; } }
.tr-wave { position: absolute; left: 50%; top: 45%; width: 80px; height: 80px; margin: -40px; border-radius: 50%; border: 4px solid var(--c); box-shadow: 0 0 30px var(--c), inset 0 0 20px var(--c); animation: tr-wave 1.2s .35s cubic-bezier(.15,.7,.3,1) both; }
.tr-wave.w2 { animation-delay: .55s; border-width: 2px; }
.tr-wave.w3 { animation-delay: .8s; border-width: 6px; }
@keyframes tr-wave { from { transform: scale(.3); opacity: 1; } to { transform: scale(12); opacity: 0; } }
.tr-core { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; transform: translateY(-4vh); }
.tr-icon { display: grid; place-items: center; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 40%, transparent), transparent 70%); animation: tr-slam .7s .2s cubic-bezier(.2,1.8,.4,1) both; }
.tr-icon svg { width: 120px; height: 120px; filter: drop-shadow(0 0 18px var(--c)); }
@keyframes tr-slam { 0% { transform: scale(3.2) rotate(-25deg); opacity: 0; filter: blur(6px); } 60% { opacity: 1; filter: none; } 100% { transform: none; } }
.tr-rating { font-size: 14px; font-weight: 900; letter-spacing: .3em; text-transform: uppercase; color: var(--c); text-shadow: 0 0 12px var(--c); animation: tr-up .5s .15s ease both; }
.tr-name { font-size: clamp(40px, 12vw, 76px); font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 0 24px var(--c), 0 4px 0 rgba(0,0,0,.35); }
.tr-name span { display: inline-block; animation: tr-letter .45s calc(.55s + var(--i) * .05s) cubic-bezier(.3,1.7,.5,1) both; }
@keyframes tr-letter { from { opacity: 0; transform: translateY(30px) scale(.4) rotate(-12deg); } }
.tr-points { font-size: clamp(30px, 9vw, 48px); font-weight: 900; color: #FFE38A; font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(255,227,138,.8); animation: tr-up .4s .6s ease both; }
@keyframes tr-up { from { opacity: 0; transform: translateY(14px); } }
.tier-reveal.lv5 .tr-icon { animation: tr-slam .7s .2s cubic-bezier(.2,1.8,.4,1) both, tr-legend 1.2s 1s ease-in-out infinite alternate; }
@keyframes tr-legend { to { transform: scale(1.08); filter: brightness(1.3); } }
.tier-reveal.lv0 .tr-rays, .tier-reveal.lv1 .tr-rays { opacity: .5; }
/* A miss: static and a glitching "Lost signal" */
.tier-reveal.miss { background: rgba(5,6,14,.94); }
.tr-static { position: absolute; inset: 0; opacity: .22; background: repeating-linear-gradient(0deg, rgba(255,255,255,.18) 0 1px, transparent 1px 3px); animation: tr-static .25s steps(3) infinite; }
@keyframes tr-static { to { transform: translateY(3px); } }
.tier-reveal.miss .tr-icon { color: #ff6f61; animation: tr-shake .5s ease both; }
.tier-reveal.miss .tr-icon svg { filter: drop-shadow(0 0 14px #ff6f61); }
@keyframes tr-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-12px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.tr-name.glitch { position: relative; color: #ff6f61; text-shadow: 0 0 18px rgba(255,111,97,.7); animation: tr-glitch 1.2s steps(2) infinite; }
.tr-name.glitch::before, .tr-name.glitch::after { content: attr(data-t); position: absolute; inset: 0; }
.tr-name.glitch::before { color: #7FE6FF; transform: translate(-3px, 1px); clip-path: inset(0 0 55% 0); opacity: .8; }
.tr-name.glitch::after { color: #B98CFF; transform: translate(3px, -1px); clip-path: inset(55% 0 0 0); opacity: .8; }
@keyframes tr-glitch { 0%, 100% { transform: none; } 10% { transform: skewX(-12deg) translateX(-4px); } 12% { transform: none; } 50% { transform: translateX(3px); } 52% { transform: none; } }
.tier-reveal.miss .tr-rating { color: #c9d3e6; text-shadow: none; letter-spacing: .1em; text-transform: none; font-size: 16px; }
/* Slower steps past each rank */
.ladder-pip { transition-duration: .8s !important; }
.rung { transition-duration: .5s !important; }
body.stepping #world, body.stepping #sunworld { transition-duration: .85s !important; }
@media (prefers-reduced-motion: reduce) { .answer-launch, .tier-reveal, .tr-rays, .tr-wave, .tr-icon, .tr-name span, .tr-static, .tr-name.glitch { animation: none !important; } }
.tier-reveal { background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 28%, rgba(3,5,20,.9)), rgba(3,5,20,.97) 65%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* ---------- Sign in / create account ---------- */
.auth-tabs { margin-bottom: 8px; }
.google-btn { width: 100%; gap: 10px; background: #fff !important; color: #1f1f1f !important; border-color: #dadce0 !important; font-weight: 800; }
.google-btn:hover { background: #f5f7fa !important; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px !important; color: var(--muted); font-size: 13px; font-weight: 800; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--glass-border); }
#acc-form .field input { width: 100%; padding: 12px 14px; border-radius: 12px; font: 700 16px Nunito, sans-serif; border: 1px solid var(--glass-border); background: rgba(4,14,34,.6); color: var(--text); }
body.sunward #acc-form .field input { background: #fff; color: #2B1A06; }
#acc-forgot { margin-top: 10px; }
[hidden] { display: none !important; }

/* ---------- Mission control (owner only) ---------- */
.mission h3 { margin: 18px 0 8px; font-size: 16px; }
.mission h3 small { color: var(--muted); font-weight: 700; }
.mc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.mc-tiles.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.mc-tile { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid var(--glass-border); }
.mc-tile span { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mc-tile b { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mc-tiles.small .mc-tile b { font-size: 22px; }
.mc-tile small { font-size: 12px; font-weight: 700; color: var(--muted); }
.mc-tile small.up { color: #7CF5A8; }
.mc-tile small.down { color: #ff8a98; }
.mc-chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; align-items: end; height: 130px; padding: 6px 4px 0; border-radius: 12px; background: rgba(255,255,255,.04); }
.mc-col { display: grid; grid-template-rows: 1fr auto; height: 100%; min-width: 0; }
.mc-col span { align-self: end; border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, #FFE38A, #F2A33A); }
.mc-col small { font-size: 9px; font-weight: 800; color: var(--muted); white-space: nowrap; overflow: visible; height: 14px; }
.mc-split { display: flex; gap: 2px; margin-top: 8px; border-radius: 12px; overflow: hidden; font-size: 12px; font-weight: 900; }
.mc-split span { padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-split .sun { background: #FFC857; color: #3a1d00; }
.mc-split .deep { background: #3B1E78; color: #fff; }
.mc-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: mc; }
.mc-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.04); }
.mc-list li small { color: var(--muted); font-weight: 700; min-width: 70px; text-align: right; }
.mc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-chips .chip b { color: #FFE38A; margin-left: 4px; }
.mc-reports { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.mc-reports li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.04); }
.mc-reports em { font-style: normal; color: var(--muted); }
.mc-reports small { color: var(--muted); font-size: 12px; }
.owner-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 12px 0; padding: 14px; border-radius: 16px; border: 2px solid rgba(255,200,87,.6); background: linear-gradient(135deg, rgba(255,200,87,.18), rgba(123,92,255,.18)); }
.owner-panel b { display: block; font-size: 17px; }
.owner-panel small { color: var(--muted); font-weight: 700; }
