/* Rocket Roadster: a night launch broadcast. Thin white type, red LED accents, cyan rings. */
:root {
  --bg: #05070d; --ink: #f4f6fa; --dim: rgba(244, 246, 250, .62); --red: #ff2a3a; --cyan: #46e8ff; --gold: #ffc23a; --green: #5cff9a;
  --glass: rgba(8, 11, 20, .62); --line: rgba(255, 255, 255, .16);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --hud: 'Titillium Web', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--hud); -webkit-user-select: none; user-select: none; touch-action: manipulation; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; cursor: pointer; color: inherit; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid rgba(255,255,255,.35); border-bottom-width: 2px; border-radius: 4px; background: rgba(255,255,255,.08); font: 600 12px/1.5 var(--hud); }
.hidden { display: none !important; }
body.touch .key-only, body:not(.touch) .touch-only { display: none !important; }
#loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; background: var(--bg); z-index: 50; transition: opacity .5s; letter-spacing: .3em; }
#loading b { font-weight: 300; font-size: 30px; }
#loading span { font-size: 13px; color: var(--dim); letter-spacing: .1em; }
#loading.gone { opacity: 0; pointer-events: none; }
#visor { position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0; transition: opacity .4s;
  background: linear-gradient(180deg, rgba(255, 190, 80, .12), rgba(255, 190, 80, .03) 40%, rgba(0, 0, 0, 0) 60%), radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(0, 0, 0, .55)); }
body.cockpit #visor { opacity: 1; }

/* ---------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-family: var(--hud); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
#hud button { pointer-events: auto; }
.top { position: absolute; top: calc(10px + var(--st)); left: calc(14px + var(--sl)); right: calc(14px + var(--sr)); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tl, .tr { display: flex; gap: 10px; align-items: center; min-width: 0; }
.tl { flex-direction: column; align-items: flex-start; gap: 6px; }
.tank { display: flex; align-items: center; gap: 8px; }
.tank .lbl { font-size: 11px; letter-spacing: .18em; color: var(--dim); }
.tank .bar { width: 150px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.14); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.tank .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #3aa0ff, #8fd8ff); transition: width .15s; }
.tank.low .bar i { background: linear-gradient(90deg, #ff3a2a, #ff9a4a); animation: blink .5s infinite; }
.tank b { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 52px; }
.hull { display: flex; gap: 4px; }
.hull i { width: 26px; height: 6px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 6px rgba(255,255,255,.5); }
.hull i.off { background: rgba(255,255,255,.15); box-shadow: none; }
.hull.hit i { background: var(--red); }
.tc { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; }
.timer { font-size: 44px; font-weight: 300; line-height: 1; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.timer.low { color: #ff6a5a; }
.timer.frozen { color: var(--cyan); font-size: 30px; }
.sect { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--dim); margin-top: 2px; }
.score { text-align: right; display: flex; flex-direction: column; line-height: 1; }
.score b { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.score span { font-size: 13px; color: var(--cyan); font-weight: 600; letter-spacing: .06em; min-height: 16px; }
.hbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); color: #fff; font-size: 15px; flex: none; }
/* broadcast gauges */
.gauge { position: absolute; bottom: calc(14px + var(--sb)); width: 112px; height: 112px; }
.gauge.gl { left: calc(18px + var(--sl)); }
.gauge.gr { right: calc(18px + var(--sr)); }
.gauge svg { width: 100%; height: 100%; transform: rotate(135deg); }
.gauge circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.gauge .trk { stroke: rgba(255,255,255,.22); stroke-dasharray: 207 300; }
.gauge .arc { stroke: #fff; stroke-dasharray: 0 300; transition: stroke-dasharray .1s; filter: drop-shadow(0 0 3px rgba(255,255,255,.6)); }
.gv { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.gv span { font-size: 9px; letter-spacing: .16em; color: var(--dim); }
.gv b { font-size: 28px; font-weight: 400; font-variant-numeric: tabular-nums; margin: 3px 0 1px; }
.gv em { font-style: normal; font-size: 10px; color: var(--dim); letter-spacing: .14em; }
#c-side { position: absolute; left: 118px; bottom: 6px; width: 120px; height: 44px; opacity: .9; }
#c-top { position: absolute; right: 120px; bottom: 2px; width: 64px; height: 110px; opacity: .95; }
.speed { position: absolute; left: 50%; bottom: calc(18px + var(--sb)); transform: translateX(-50%); text-align: center; line-height: 1; }
.speed b { font-size: 34px; font-weight: 300; font-variant-numeric: tabular-nums; display: block; }
.speed span { font-size: 10px; letter-spacing: .2em; color: var(--dim); }
.mini { display: none; }
#msg { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); font-size: 54px; font-weight: 300; letter-spacing: .16em; text-align: center; white-space: nowrap; opacity: 0; transition: opacity .2s; }
#msg.on { opacity: 1; }
#msg.big { font-size: 110px; font-weight: 600; }
#sub { position: absolute; left: 50%; top: calc(30% + 46px); transform: translateX(-50%); font-size: 17px; letter-spacing: .06em; text-align: center; color: var(--ink); max-width: 90vw; opacity: 0; transition: opacity .2s; background: var(--glass); padding: 6px 14px; border-radius: 999px; }
#sub.on { opacity: 1; }
#warn { position: absolute; left: 50%; top: calc(76px + var(--st)); transform: translateX(-50%); font-size: 15px; font-weight: 700; letter-spacing: .18em; color: #ff6a4a; opacity: 0; transition: opacity .15s; }
#warn.on { opacity: 1; animation: blink .4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
#pops { position: absolute; left: 50%; top: calc(30% + 104px); transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; }
.pop { font-size: 18px; font-weight: 600; letter-spacing: .05em; animation: pop 1.3s ease-out forwards; white-space: nowrap; }
.pop.gold { color: var(--gold); } .pop.cyan { color: var(--cyan); } .pop.bad { color: #ff6a5a; } .pop.green { color: var(--green); }
@keyframes pop { 0% { opacity: 0; transform: translateY(10px) scale(.9); } 12% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }
#arrow { position: absolute; left: 50%; top: 50%; font-size: 30px; color: var(--cyan); text-shadow: 0 0 10px var(--cyan); transform-origin: center; }
#speedbar { position: absolute; left: 50%; bottom: calc(84px + var(--sb)); transform: translateX(-50%); width: min(460px, 70vw); text-align: center; }
.sb-track { position: relative; height: 10px; border-radius: 5px; background: rgba(255,255,255,.15); }
.sb-zone { position: absolute; top: 0; bottom: 0; left: 64.8%; width: 13.3%; background: rgba(92,255,154,.45); border-radius: 3px; }
.sb-perf { position: absolute; top: -3px; bottom: -3px; left: 68.9%; width: 4.4%; background: var(--green); border-radius: 3px; box-shadow: 0 0 10px var(--green); }
.sb-needle { position: absolute; top: -6px; width: 3px; height: 22px; background: #fff; left: 0; box-shadow: 0 0 6px #fff; }
#speedbar span { display: block; margin-top: 8px; font-size: 13px; letter-spacing: .08em; color: var(--dim); }
#launchbar { position: absolute; right: calc(160px + var(--sr)); top: 50%; transform: translateY(-50%); height: 46vh; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lb-track { position: relative; width: 12px; flex: 1; border-radius: 6px; background: rgba(255,255,255,.15); }
.lb-zone { position: absolute; left: 0; right: 0; top: 0; height: 13.3%; background: rgba(92,255,154,.45); border-radius: 6px 6px 0 0; }
.lb-perf { position: absolute; left: -3px; right: -3px; top: 0; height: 4.8%; background: var(--green); box-shadow: 0 0 10px var(--green); border-radius: 4px; }
.lb-car { position: absolute; left: -6px; right: -6px; height: 4px; background: #fff; bottom: 0; box-shadow: 0 0 8px #fff; }
#launchbar span { font-size: 11px; letter-spacing: .2em; color: var(--green); }
#landinfo { position: absolute; left: 50%; top: calc(110px + var(--st)); transform: translateX(-50%); display: grid; grid-template-columns: auto auto auto auto auto; gap: 4px 10px; align-items: baseline; background: var(--glass); padding: 8px 16px; border-radius: 12px; border: 1px solid rgba(92,255,154,.4); }
#landinfo b { font-size: 22px; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
#landinfo span { font-size: 11px; color: var(--dim); letter-spacing: .1em; }
#landinfo b.bad { color: #ff6a5a; }
#landinfo em { font-style: normal; font-size: 22px; font-weight: 300; margin-left: 8px; }
#keys { position: absolute; left: 50%; bottom: calc(76px + var(--sb)); transform: translateX(-50%); font-size: 12px; color: var(--dim); letter-spacing: .04em; white-space: nowrap; }

/* ---------------------------------------------------------------- touch */
#touch { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.stick { position: absolute; bottom: calc(14px + var(--sb)); width: 140px; height: 140px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); background: rgba(8,11,20,.35); pointer-events: auto; touch-action: none; }
#stickL { left: calc(16px + var(--sl)); }
#stickR { right: calc(16px + var(--sr)); }
.stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 0 14px rgba(255,255,255,.4); }
.stick .cap { position: absolute; left: 0; right: 0; top: -16px; text-align: center; font-size: 9px; letter-spacing: .14em; color: var(--dim); }
.tb { position: absolute; pointer-events: auto; width: 62px; height: 62px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); background: rgba(8,11,20,.5); color: #fff; font-size: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; touch-action: none; }
.tb span { font-size: 8px; letter-spacing: .12em; margin-top: 2px; }
.tb.on { background: rgba(255,255,255,.3); }
#t-rollL { right: calc(232px + var(--sr)); bottom: calc(96px + var(--sb)); }
#t-rollR { right: calc(164px + var(--sr)); bottom: calc(150px + var(--sb)); }
#t-boost { right: calc(166px + var(--sr)); bottom: calc(16px + var(--sb)); border-color: rgba(255,140,60,.6); }
#t-launch { left: 50%; bottom: calc(30px + var(--sb)); transform: translateX(-50%); width: 150px; height: 70px; border-radius: 35px; font-size: 20px; font-weight: 700; letter-spacing: .14em; background: rgba(92,255,154,.3); border-color: var(--green); animation: blink .5s infinite; }
#t-go { left: calc(16px + var(--sl)); bottom: calc(14px + var(--sb)); width: 140px; height: 140px; font-size: 40px; }
body.touch .gauge { display: none; }
body.touch .mini { display: flex; gap: 12px; position: absolute; top: calc(62px + var(--st)); left: calc(14px + var(--sl)); font-size: 12px; color: var(--dim); letter-spacing: .1em; }
body.touch .mini b { color: var(--ink); font-size: 15px; font-weight: 600; }
body.touch .speed { bottom: calc(26px + var(--sb)); }
body.touch #launchbar { right: calc(24px + var(--sr)); height: 34vh; top: 34%; }
body.touch #speedbar { bottom: calc(170px + var(--sb)); }

#rotate { display: none; }
@media (orientation: portrait) {
  body.touch.playing #rotate { display: flex; position: fixed; inset: 0; z-index: 60; background: var(--bg); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 30px; }
  #rotate b { font-size: 60px; animation: spin 2s infinite; }
  @keyframes spin { 50% { transform: rotate(90deg); } }
}

/* ---------------------------------------------------------------- screens */
#ui { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.screen { display: none; position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; padding: calc(16px + var(--st)) calc(18px + var(--sr)) calc(16px + var(--sb)) calc(18px + var(--sl)); }
.screen.on { display: flex; }
#title { background: linear-gradient(90deg, rgba(3,5,10,.92) 0%, rgba(3,5,10,.7) 42%, rgba(3,5,10,0) 70%); gap: 24px; align-items: center; justify-content: space-between; }
.t-main { max-width: 560px; display: flex; flex-direction: column; gap: 12px; }
.kicker { margin: 0; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--red); font-weight: 600; }
.logo { margin: 0; display: flex; flex-direction: column; line-height: .92; font-weight: 300; letter-spacing: .32em; }
.logo span:first-child { font-size: clamp(36px, 6.4vw, 74px); }
.logo span:last-child { font-size: clamp(30px, 5.2vw, 60px); font-weight: 600; letter-spacing: .26em; color: #fff; text-shadow: 0 0 30px rgba(255,42,58,.45); }
.lead { margin: 0; font-size: 16px; line-height: 1.5; color: rgba(244,246,250,.85); }
.challenge:empty { display: none; }
.challenge { background: rgba(255,194,58,.15); border: 1px solid var(--gold); border-radius: 10px; padding: 8px 12px; font-size: 15px; }
.opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-size: 14px; letter-spacing: .06em; color: var(--dim); }
.seg button.on { background: #fff; color: #05070d; font-weight: 600; }
.paints { display: flex; gap: 7px; align-items: center; }
.paints button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); padding: 0; }
.paints button.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.paints em { font-style: normal; font-size: 12px; color: var(--dim); margin-left: 4px; letter-spacing: .05em; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu .row { display: flex; gap: 8px; flex-wrap: wrap; }
.menu button, .buttons button, .ghost { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 999px; padding: 10px 18px; font-size: 15px; letter-spacing: .06em; }
.menu button:hover, .buttons button:hover { background: rgba(255,255,255,.14); }
.menu .row button { flex: 1; }
button.primary { background: #fff !important; color: #05070d !important; font-weight: 700; font-size: 18px !important; letter-spacing: .2em !important; border: 0 !important; padding: 13px 22px !important; }
.disclaimer { margin: 0; font-size: 11.5px; line-height: 1.45; color: rgba(244,246,250,.5); }
.disclaimer a { color: inherit; }
.t-side { width: 300px; flex: none; display: flex; flex-direction: column; gap: 10px; align-self: center; }
.sheet { margin: auto; background: rgba(8, 11, 20, .9); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; width: 100%; backdrop-filter: blur(6px); }
.sheet.narrow { max-width: 420px; } .sheet.wide { max-width: 900px; }
.sheet header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sheet header h2 { margin: 0 auto 0 0; font-weight: 300; letter-spacing: .2em; text-transform: uppercase; font-size: 22px; }
.ghost { padding: 7px 14px !important; font-size: 13px !important; }
#pause, #settings, #help, #end { background: rgba(3, 5, 10, .55); }
.help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.help h4 { margin: 0 0 6px; font-weight: 600; letter-spacing: .1em; color: var(--cyan); }
.help p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: rgba(244,246,250,.85); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.setrow input[type=range] { width: 150px; accent-color: #fff; }
.setrow .seg button { padding: 5px 11px; font-size: 13px; }
/* end */
.end-top { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.end-why { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--red); font-weight: 600; margin: 0; }
.end-big { font-size: 64px; font-weight: 300; line-height: 1; margin: 6px 0; font-variant-numeric: tabular-nums; }
.end-rank { font-size: 18px; letter-spacing: .14em; text-transform: uppercase; }
.end-best { color: var(--green); font-weight: 600; letter-spacing: .1em; margin-top: 4px; }
.end-list { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.end-list div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); padding: 3px 0; }
.end-list span { color: var(--dim); }
.end-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--dim); }
.end-stats b { color: var(--ink); }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.e-board:empty { display: none; }
.e-board { margin: 12px 0 0; }

@media (max-width: 900px) { .t-side { display: none; } .t-main { max-width: 600px; } #title { background: linear-gradient(90deg, rgba(3,5,10,.92), rgba(3,5,10,.55)); } }
@media (max-width: 760px) { .help { grid-template-columns: 1fr; } .end-top { grid-template-columns: 1fr; } }
@media (max-height: 500px) {
  .t-main { gap: 7px; }
  .lead { font-size: 13px; line-height: 1.38; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .logo span:first-child { font-size: 32px; } .logo span:last-child { font-size: 26px; }
  .kicker { font-size: 10px; }
  .menu button { padding: 7px 14px; font-size: 13px; } button.primary { padding: 9px 18px !important; font-size: 15px !important; }
  .disclaimer { font-size: 10px; }
  .timer { font-size: 32px; } .score b { font-size: 22px; } .hbtn { width: 34px; height: 34px; font-size: 13px; }
  .tank .bar { width: 100px; }
  #msg { font-size: 36px; } #msg.big { font-size: 70px; } #sub { font-size: 13px; top: calc(30% + 30px); } #pops { top: calc(30% + 66px); } .pop { font-size: 15px; }
  .stick { width: 112px; height: 112px; } .stick i { width: 46px; height: 46px; margin: -23px; }
  .tb { width: 50px; height: 50px; font-size: 18px; }
  #t-rollL { right: calc(190px + var(--sr)); bottom: calc(78px + var(--sb)); }
  #t-rollR { right: calc(134px + var(--sr)); bottom: calc(122px + var(--sb)); }
  #t-boost { right: calc(136px + var(--sr)); bottom: calc(14px + var(--sb)); }
  #t-go { width: 112px; height: 112px; }
  body.touch #speedbar { bottom: calc(136px + var(--sb)); }
  #landinfo { top: calc(80px + var(--st)); padding: 4px 12px; } #landinfo b { font-size: 17px; }
  .sheet { padding: 12px 14px; } .sheet header { margin-bottom: 6px; } .sheet header h2 { font-size: 17px; }
  .help p { font-size: 12.5px; } .setrow { padding: 4px 0; font-size: 13px; }
  .end-big { font-size: 44px; } .end-list { font-size: 12.5px; }
  #pause .menu { display: grid; grid-template-columns: 1fr 1fr; }
  body.touch .mini { top: calc(50px + var(--st)); }
}
@media (max-height: 340px) { .opts { gap: 8px; } .paints em { display: none; } .speed b { font-size: 24px; } }
@media (max-height: 300px) { body.touch #launchbar { top: calc(50% - 40px); height: 28vh; } }
