/* Let every viewer see the shared winner before the existing podium countdown.
   Visibility preserves the layout; the panels are also inert during this beat. */
body.arena-celebrating :is(#results,#paused,#hud,#controls,#pause,#danger-warning,#capture-banner,#control-tip){visibility:hidden;pointer-events:none}
/* App shell: one obvious action per screen. Home is your planet and Play; the arena
   keeps only what you steer by; menus are sheets. Loaded last, over style.css. */
:root{--sheet:#211d3a;--line:#faf1d71c;--safe-b:env(safe-area-inset-bottom,0px);--safe-t:env(safe-area-inset-top,0px)}
::selection{background:#f4dc7855;color:var(--ink)}
.game{scrollbar-color:#bac8dc40 transparent}

/* Top bar: brand, stardust and settings at home; only pause and the room chip in flight. */
.topbar{padding:max(14px,var(--safe-t)) 20px 10px;align-items:center}
.wordmark{font-size:26px;gap:8px}.wordmark img{width:34px;height:34px;border-radius:9px}
.wordmark .byline{display:none}
.settings{gap:8px;align-items:center}
.wallet-pill{display:inline-flex;align-items:center;gap:6px;height:38px;padding:0 14px 0 11px;border-radius:999px;border:1px solid var(--line);background:#faf1d70d;color:var(--ink);font:600 16px/1 Fredoka,sans-serif;font-variant-numeric:tabular-nums}
.wallet-pill svg{width:17px;height:17px;fill:var(--yellow)}
.wallet-pill:hover{background:#faf1d71a}
.topbar .icon-button{width:40px;height:40px;background:#faf1d70d;border:1px solid var(--line)}
.topbar .icon-button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round}
body[data-playing=true] .wordmark,body[data-playing=true] .wallet-pill,body[data-playing=true] #settings-open{display:none}
body[data-playing=true] .topbar{justify-content:flex-end;padding-top:max(12px,var(--safe-t))}
body[data-playing=true] .topbar .icon-button{background:transparent;border-color:transparent}

/* Home: the live planet, who you are, Play. */
.entry{display:flex;flex-direction:column;align-items:stretch;gap:12px;text-align:left}
.entry h1{margin:0 0 4px}
.entry .identity-card{margin:6px 0 0}
.entry .primary{margin-top:2px}
.friends-open{display:flex;align-items:center;justify-content:center;gap:10px;margin:0;min-height:52px;font:600 16px Fredoka,sans-serif;color:var(--mint);border-color:#9edfd055}
.friends-open svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.friends-open:hover{background:#9edfd012}
.entry .online-count{margin:0;text-align:left}
.entry .session-note{margin:0;text-align:left}
.session-note:empty{display:none}
@media(max-width:760px){
  .entry{top:calc(60px + var(--safe-t));bottom:calc(84px + var(--safe-b));left:20px;right:20px;width:auto;transform:none;align-items:center;text-align:center;gap:10px}
  .entry h1{font-size:clamp(30px,8.6vw,38px);line-height:1.02}
  .entry h1 br:nth-child(2){display:inline}
  .home-planet{display:block;flex:1 1 auto;min-height:150px;height:auto;width:100%}
  .entry .identity-card,.entry .primary,.friends-open{width:min(100%,380px)}
  .entry .online-count,.entry .session-note{text-align:center}
}
@media(min-width:761px){.home-planet{display:none}.entry{width:360px}}
.app-nav{background:color-mix(in srgb,var(--sky-deep,#04071f) 94%,transparent);border-top-color:var(--line)}
@media(min-width:761px){.app-nav{background:transparent}}

/* Flight HUD: size and orbit at left, progress to the next singularity in the middle, rank at right. */
.hud{top:calc(max(12px,var(--safe-t)) + 2px);left:20px;right:76px;align-items:flex-start;gap:12px}
.hud-mass{display:flex;flex-direction:column;gap:3px;min-width:96px}
.hud-mass strong{font:600 34px/1 Fredoka,sans-serif;color:var(--yellow);font-variant-numeric:tabular-nums;text-shadow:0 2px 6px #04071f}
.hud-mass span{font-size:12px;color:var(--muted);text-shadow:0 1px 3px #04071f}
.hud-mass .growth{width:96px;height:3px;border-radius:2px;background:#faf1d724;overflow:hidden;margin:3px 0 1px}
.hud-mass .growth span{display:block;height:100%;background:var(--mint)}
#orbit-copy{color:#9edfd0cc}
.hud-arena{position:absolute;left:50%;transform:translateX(-50%);top:4px;display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;text-shadow:0 1px 3px #04071f}
.arena-meter{position:relative;width:132px;height:6px;border-radius:3px;background:#faf1d724;overflow:hidden}
.arena-meter span{position:absolute;inset:0 auto 0 0;width:0;border-radius:3px;background:linear-gradient(90deg,var(--mint),var(--yellow));transition:width .4s var(--ease)}
.arena-meter i{display:none}
.hud-arena strong{font:600 17px/1 Fredoka,sans-serif;color:var(--ink);font-variant-numeric:tabular-nums}
.hud-arena small{font-size:11px;color:var(--muted)}
.hud-rank{position:relative;margin-left:auto;display:flex;flex-direction:column;align-items:flex-end;pointer-events:auto}
#rank-toggle{display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding:4px 2px;border:0;background:none;color:var(--ink);text-shadow:0 1px 3px #04071f}
#rank-toggle strong{font:600 22px/1 Fredoka,sans-serif;color:var(--yellow)}
#rank-toggle small{font-size:11px;color:var(--muted);white-space:nowrap}
.hud .leaders{width:170px;margin-top:8px;font-size:12px}
.hud .leaders li{margin-bottom:6px}
@media(max-width:760px){
  .hud{left:16px;right:64px}
  .hud-mass{min-width:78px}.hud-mass strong{font-size:28px}.hud-mass .growth{width:78px}
  #orbit-copy{font-size:11px}
  .arena-meter{width:96px}
  .hud .leaders{display:none;position:absolute;top:44px;right:0;width:180px;padding:10px 12px;border-radius:14px;background:#04071fd9}
  .hud.ranks-open .leaders{display:block}
}
@media(max-height:520px) and (min-width:761px){.hud{top:10px}.hud-mass strong{font-size:24px}}

/* Controls: round buttons, Boost biggest; the hint fades once you're moving. */
.controls{left:20px;right:max(20px,env(safe-area-inset-right));bottom:calc(18px + var(--safe-b));align-items:flex-end}
#control-tip{position:absolute;left:50%;bottom:calc(100% + 10px);transform:translateX(-50%);margin:0;white-space:nowrap;font-size:12px;color:var(--muted);text-shadow:0 1px 3px #04071f;transition:opacity .8s var(--ease)}
#control-tip.faded{opacity:0}
.burn-controls{margin-left:auto;align-items:flex-end;gap:12px}
body .burn-controls .round,body[data-playing=true] .burn-controls .round{flex:none;display:grid;place-items:center;align-content:center;gap:2px;min-width:0;min-height:0;padding:0;border-radius:50%;background:#04071f40;text-shadow:0 1px 3px #04071f}
body .burn-controls .round svg,body[data-playing=true] .burn-controls .round svg{width:22px;height:22px}
body .burn-controls .round span,body[data-playing=true] .burn-controls .round span{font-size:11px;line-height:1;font-weight:600}
body .burn-controls .emote-button,body[data-playing=true] .burn-controls .emote-button{width:46px;height:46px;border:1px solid #faf1d740}
body .burn-controls .brake-button,body[data-playing=true] .burn-controls .brake-button{width:60px;height:60px;border:1.5px solid #9edfd099}
body .burn-controls .boost-button,body[data-playing=true] .burn-controls .boost-button{width:78px;height:78px;border:2px solid #f4dc78cc}
body .burn-controls .boost-button svg,body[data-playing=true] .burn-controls .boost-button svg{width:28px;height:28px}
body .burn-controls .boost-button:disabled{border-color:#f4dc7855;color:#f4dc7899}
#boost-key{display:none}
/* P2-M: Fling (moon count badge), the round clock and the combo chip. */
body .burn-controls .fling-button,body[data-playing=true] .burn-controls .fling-button{position:relative;width:64px;height:64px;border:1.5px solid #ff9e8ccc;color:var(--coral)}
body .burn-controls .fling-button:disabled{border-color:#ff9e8c55;color:#ff9e8c99}
.fling-count{position:absolute;top:-4px;right:-4px;min-width:21px;height:21px;padding:0 5px;border-radius:11px;background:var(--coral);color:#182338;font:600 13px/21px Fredoka,sans-serif;text-align:center;text-shadow:none}
.round-clock{font:600 18px/1 Fredoka,sans-serif;color:var(--ink);font-variant-numeric:tabular-nums;letter-spacing:.02em}
.round-clock.urgent{color:var(--coral);animation:clock-pulse 1s ease-in-out infinite}
@keyframes clock-pulse{50%{transform:scale(1.12)}}
@media(prefers-reduced-motion:reduce){.round-clock.urgent{animation:none}}
.combo-chip{font:600 13px/1 Fredoka,sans-serif;color:#182338;background:var(--mint);border-radius:999px;padding:4px 9px}
@media(hover:hover) and (pointer:fine){#boost-key{display:block;font-size:9px;opacity:.6}}

/* Sheets: pause, results, friends and settings share one calm surface. */
.sheet{text-align:center}
.sheet h2{font-size:34px;margin:0 0 8px}
.sheet-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px;text-align:left}
.sheet-header h2{margin:0}
.sheet-copy{color:var(--muted);font-size:14px;line-height:1.5;margin:0 0 16px}
.sheet .primary{width:100%}
.sheet-actions{display:flex;justify-content:space-between;margin-top:8px}
.sheet-actions .text-button{color:var(--muted)}
.sheet-actions .text-button:hover{color:var(--yellow)}
#settings,#friends{text-align:left}
.sheet-list{display:flex;flex-direction:column;margin:8px 0 12px;border-radius:16px;background:#04071f55;overflow:hidden}
.sheet-row{display:flex;align-items:center;gap:14px;min-height:56px;padding:0 16px;border:0;border-bottom:1px solid var(--line);background:none;color:var(--ink);font:500 15px system-ui,sans-serif;text-align:left}
.sheet-row:last-child{border-bottom:0}
.sheet-row svg{flex:none;width:22px;height:22px;fill:none;stroke:var(--mint);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.sheet-row small{margin-left:auto;color:var(--muted);font-size:13px}
.sheet-row:hover{background:#faf1d70a}
.how-to{margin:4px 0 8px;font-size:14px;color:var(--muted)}
.how-to summary{cursor:pointer;min-height:44px;display:flex;align-items:center;color:var(--ink);font-weight:600}
.how-to p{margin:0 0 8px;line-height:1.55}
#settings .distribution-links{margin:6px 0 0}
#friends .multiplayer{display:flex;flex-direction:column;gap:12px;margin:0}
#friends .room-status{display:flex;flex-direction:column;align-items:center;gap:6px;padding:16px;border-radius:16px;background:#04071f55;text-align:center}
#friends .room-status>span:first-child{font-size:12px;color:var(--muted)}
#friends .room-status strong{font:600 34px/1 Fredoka,sans-serif;letter-spacing:.16em;color:var(--mint)}
#friends .room-actions{display:flex;gap:10px;align-items:center}
#friends .room-actions .secondary{margin:0;width:auto;min-height:40px;padding:0 18px;font-weight:600}
#friends .join-room{flex-direction:column;align-items:stretch;gap:6px}
#friends .join-room label{font-size:12px;color:var(--muted)}
#friends .join-controls{display:flex;gap:8px}
#friends .join-controls input{flex:1}

/* Results: what you earned first, the video offer right under it, then go again. */
.result-reward{display:flex;align-items:baseline;justify-content:center;gap:8px;margin:6px 0 10px}
.reward-icon svg{width:26px;height:26px;fill:var(--yellow);transform:translateY(3px)}
.result-reward strong{font:600 46px/1 Fredoka,sans-serif;color:var(--yellow);font-variant-numeric:tabular-nums}
.result-reward small{font-size:14px;color:var(--muted)}
.center-panel .earned{margin:0}
.reward-button{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:52px;margin:0 0 14px;border:1.5px solid var(--mint);border-radius:var(--radius);background:#9edfd014;color:var(--mint);font:600 16px Fredoka,sans-serif}
.reward-button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}
.reward-button:hover:not(:disabled){background:#9edfd024}
.reward-button:disabled{opacity:.7}
#results .result-stats{gap:28px;margin:10px 0 12px}
#results .result-stats strong{font-size:24px}
#results .result-stats span{font-size:11px;letter-spacing:.02em}
.result-note{margin:0 0 6px;font-size:13px;color:var(--mint)}
#results>p#result-reason{margin:0 0 4px;font-size:14px}
#results .primary{margin-top:6px}

/* Phones: sheets rise from the bottom like a native app. */
@media(max-width:760px){
  .sheet,.account-panel{top:auto;bottom:0;left:0;right:0;width:auto;max-height:calc(100% - 60px);transform:none;border-radius:24px 24px 0 0;padding:14px 20px calc(20px + var(--safe-b));overflow:auto;background:var(--sheet);box-shadow:0 -12px 40px #04071f99}
  .sheet::before,.account-panel::before{content:"";display:block;width:40px;height:4px;border-radius:2px;background:#faf1d733;margin:0 auto 12px}
  body:not([data-playing=true]) .sheet:not(#paused):not(#results),body:not([data-playing=true]) .account-panel{bottom:calc(72px + var(--safe-b));border-radius:24px}
  #results{max-height:calc(100% - 80px);top:auto}
  .sheet h2{font-size:28px}
  .result-reward strong{font-size:40px}
}
@media(prefers-reduced-motion:reduce){#control-tip{transition:none}.arena-meter span{transition:none}}
/* P2-F flow: kill feed, centre callouts, spectate banner, coach marks, ping chip and the compact death card. */
.kill-feed{position:absolute;left:12px;top:150px;margin:0;padding:0;list-style:none;display:flex;flex-direction:column;align-items:flex-start;gap:4px;max-width:min(64vw,360px);pointer-events:none;z-index:2}
.feed-line{font:600 12px/1.3 Fredoka,system-ui,sans-serif;color:#faf1d7d9;background:#17152ebf;border-radius:9px;padding:3px 8px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 1px 2px #04071f;animation:feed-in .22s var(--ease),feed-out .5s ease-in calc(var(--life,6s) - .5s) forwards}
.feed-line.feed-mine{box-shadow:inset 0 0 0 1px #f4dc7866;color:var(--ink)}
.feed-line .feed-you{font-weight:700}
@keyframes feed-in{from{opacity:0;transform:translateX(-14px)}}
@keyframes feed-out{to{opacity:0;transform:translateX(-8px)}}
.callout{position:absolute;left:50%;top:38%;transform:translate(-50%,-50%);width:max-content;max-width:calc(100% - 32px);text-align:center;pointer-events:none;opacity:0;z-index:3}
.callout strong{display:block;font:700 clamp(30px,9vw,48px)/1.02 Fredoka,system-ui,sans-serif;letter-spacing:.01em;paint-order:stroke fill;-webkit-text-stroke:5px #17152e;text-shadow:0 4px 0 #17152e,0 0 22px #17152e}
.callout span{display:block;margin-top:6px;font:600 15px/1.2 Fredoka,system-ui,sans-serif;color:var(--ink);text-shadow:0 2px 3px #04071f,0 0 8px #04071f}
.callout.show{animation:callout-pop 1.5s var(--ease) forwards}
@keyframes callout-pop{0%{opacity:0;transform:translate(-50%,-50%) scale(.45)}12%{opacity:1;transform:translate(-50%,-50%) scale(1.14)}22%{transform:translate(-50%,-50%) scale(1)}78%{opacity:1;transform:translate(-50%,-50%)}100%{opacity:0;transform:translate(-50%,-62%)}}
.spectate{position:absolute;left:50%;top:max(86px,calc(env(safe-area-inset-top) + 76px));transform:translateX(-50%);width:max-content;max-width:calc(100% - 32px);text-align:center;pointer-events:none;z-index:3;animation:spectate-in .4s var(--ease)}
.spectate strong{display:block;font:700 clamp(26px,7.4vw,36px)/1.05 Fredoka,system-ui,sans-serif;color:var(--ink);paint-order:stroke fill;-webkit-text-stroke:4px #17152e;text-shadow:0 3px 0 #17152e}
.spectate .spectate-detail{display:inline-block;margin-top:8px;padding:4px 10px;border-radius:999px;background:#17152ecc;font:600 13px/1.3 Fredoka,system-ui,sans-serif;color:var(--yellow)}
@keyframes spectate-in{from{opacity:0;transform:translate(-50%,-10px) scale(.92)}}
.coach{position:absolute;left:50%;bottom:calc(150px + env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;align-items:center;gap:10px;width:max-content;max-width:calc(100% - 32px);padding:10px 16px;border-radius:999px;background:#17152ee0;border:1.5px solid var(--yellow);color:var(--ink);font:600 16px/1.2 Fredoka,system-ui,sans-serif;pointer-events:none;z-index:3;animation:coach-in .4s var(--ease),coach-bob 2.4s ease-in-out .4s infinite}
.coach-icon{font-size:20px;line-height:1}
.coach[data-step=fling]{border-color:var(--coral)}
@keyframes coach-in{from{opacity:0;transform:translate(-50%,12px)}}
@keyframes coach-bob{50%{transform:translate(-50%,-5px)}}
#control-tip.coached,.coach.yield,body.calling .challenge-chip{visibility:hidden}
@media(max-height:520px){.coach{left:110px;bottom:max(14px,env(safe-area-inset-bottom));transform:none;animation:coach-in-short .4s var(--ease)}.coach{font-size:14px;padding:7px 12px}@keyframes coach-in-short{from{opacity:0;transform:translateY(10px)}}.callout{top:40%}.callout strong{font-size:32px}.spectate{top:max(18px,env(safe-area-inset-top))}}
.ping-chip{display:inline-flex;align-items:center;gap:5px;margin-top:2px;font:600 11px/1 system-ui,sans-serif;color:var(--muted);text-shadow:0 1px 3px #04071f;font-variant-numeric:tabular-nums}
.ping-chip:before{content:'';width:7px;height:7px;border-radius:50%;background:#7fe0a0;box-shadow:0 0 6px #7fe0a0}
.ping-chip[data-level=fair]:before{background:#f4c95c;box-shadow:0 0 6px #f4c95c}
.ping-chip[data-level=poor]:before{background:var(--coral);box-shadow:0 0 6px var(--coral)}
.leader-crown{margin-left:4px;color:var(--yellow);font-size:10px;font-weight:600;white-space:nowrap}
#results.death-card :is(#result-reason,#double-reward,#round-panel,.result-stats,#round-bonus,#result-bonus,#best){display:none!important}
#results.death-card h2{font-size:32px;margin:0 0 6px}
#results.death-card .card-killer{text-shadow:0 2px 0 #04071f}
#results.death-card #again{min-height:64px;font-size:26px}
#results.death-card :is(#full-results,#result-home){display:inline-flex;width:auto;margin:6px 16px 0;color:var(--muted)}
body.arena-celebrating :is(.kill-feed,.callout,.coach,.spectate){visibility:hidden}
@media(prefers-reduced-motion:reduce){.callout.show{animation:callout-fade 1.5s linear forwards}@keyframes callout-fade{0%,80%{opacity:1}100%{opacity:0}}.coach{animation:none}.feed-line{animation:feed-out .3s linear calc(var(--life,6s) - .3s) forwards}}
