: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: rgba(14, 10, 40, calc(.62 + var(--heat) * .25)); }
