* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #05060f; color: #eef2ff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

.screen {
  position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto; touch-action: pan-y;
  background: radial-gradient(ellipse at 50% 0%, rgba(40, 50, 110, 0.75), rgba(3, 4, 12, 0.92) 70%);
}
#pause, #results, #lobby, #invite { align-items: center; background: rgba(3, 4, 12, 0.72); }

.panel {
  width: 100%; max-width: 860px; margin: auto; padding: 28px;
  background: rgba(14, 18, 40, 0.88); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); text-align: center;
}
.panel.small { max-width: 420px; }

h1 { margin: 0; font-size: clamp(34px, 7vw, 64px); letter-spacing: 2px; font-weight: 900; font-style: italic; }
h1 span { color: #ffb21e; }
.tag { margin: 4px 0 18px; color: #9fb0e0; }
h2 { margin: 20px 0 10px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #8fa0d8; text-align: left; }
h2.title { text-align: center; font-size: 30px; color: #fff; letter-spacing: 1px; text-transform: none; margin-top: 0; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }

button {
  font: inherit; color: #eef2ff; background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 10px 18px;
  cursor: pointer; transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
button:hover { background: rgba(255, 255, 255, 0.13); }
button:active { transform: scale(0.97); }
button.sel { border-color: #ffb21e; background: rgba(255, 178, 30, 0.16); }
button.big {
  display: block; width: 100%; margin: 22px 0 10px; padding: 16px; font-size: 20px; font-weight: 800;
  letter-spacing: 2px; color: #1b1200; background: linear-gradient(#ffc94d, #ff9d0a); border-color: #ffd97a;
}
.panel.small button:not(.big) { width: 100%; margin-top: 8px; }

#diffs button { flex: 1; min-width: 100px; font-weight: 700; }
#diffs small { display: block; font-weight: 400; color: #9fb0e0; font-size: 12px; }

.planets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.planet { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; }
.planet .ball {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  box-shadow: inset -8px -8px 14px rgba(0, 0, 0, 0.45), 0 0 12px rgba(255, 255, 255, 0.12);
}
.planet b { display: block; font-size: 17px; }
.planet .g { color: #ffcf66; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.planet .t { color: #9fb0e0; font-size: 12px; }

#colors button { width: 48px; height: 48px; padding: 0; border-radius: 50%; }

.help { color: #9fb0e0; font-size: 13px; line-height: 1.7; margin: 8px 0 0; }
.help b { color: #eef2ff; }

#resSub, #lobSub { color: #9fb0e0; margin: 0 0 12px; }
#resList, #lobList { list-style: none; padding: 0; margin: 0 0 12px; text-align: left; }
#resList li, #lobList li {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 6px;
  border-radius: 10px; background: rgba(255, 255, 255, 0.06); font-variant-numeric: tabular-nums;
}
#resList li.me, #lobList li.me { background: rgba(255, 178, 30, 0.2); font-weight: 700; }
#resList .dot, #lobList .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
#resList .nm, #lobList .nm { flex: 1; }
#resBest { color: #ffcf66; min-height: 1.2em; }

#touch { position: fixed; inset: auto 0 0 0; padding: 14px; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
#touch .tgroup { display: flex; gap: 10px; align-items: flex-end; pointer-events: auto; }
#touch button {
  width: 74px; height: 74px; border-radius: 50%; padding: 0; font-size: 13px; font-weight: 800;
  background: rgba(10, 14, 30, 0.55); border-color: rgba(255, 255, 255, 0.35); line-height: 1.1;
}
#touch .left button { font-size: 30px; }
#touch button.gas { width: 92px; height: 92px; background: rgba(255, 157, 10, 0.6); }
#touch button.on { background: rgba(255, 255, 255, 0.35); }
#touch small { font-weight: 400; font-size: 10px; }

/* ---------- 3D additions ---------- */
#coinsBar { display: flex; justify-content: space-between; align-items: center; }
.coins { color: #ffcf66; font-weight: 800; font-variant-numeric: tabular-nums; }
.coins::before { content: "● "; color: #ffb21e; }
#garage { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.upg { text-align: left; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); }
.upg b { font-size: 16px; }
.upg p { margin: 2px 0 8px; color: #9fb0e0; font-size: 12px; min-height: 2.4em; }
.upg .pips { display: flex; gap: 5px; margin-bottom: 10px; }
.upg .pips i { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
.upg .pips i.on { background: #ffb21e; }
.upg button { width: 100%; padding: 8px; font-weight: 700; }
.upg button:disabled { opacity: 0.45; cursor: not-allowed; }
.upg button.can { border-color: #ffb21e; color: #ffcf66; }

#hud { position: fixed; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7); }
#hud > div { position: absolute; }
#hPos { left: 70px; top: 10px; font-size: 46px; font-weight: 900; color: #ffcf4d; font-style: italic; }
#hPos small { font-size: 18px; color: #fff; font-style: normal; margin-left: 6px; }
#hTime { left: 72px; top: 66px; font: 700 20px ui-monospace, Menlo, monospace; }
/* race menu button (gear): Resume, Restart, Quit and the vibration switch */
#hMenu { position: absolute; left: 14px; top: 12px; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(10, 13, 30, 0.55); pointer-events: auto; cursor: pointer; display: grid; place-items: center; touch-action: manipulation; }
#hMenu svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#hMenu:active { background: rgba(255, 178, 30, 0.5); }
#hPlanet { right: 16px; top: 12px; text-align: right; font-size: 24px; font-weight: 800; }
#hPlanet small { display: block; font-size: 13px; font-weight: 600; color: #dfe6ff; }
#hProg { left: 50%; top: 18px; width: min(46vw, 520px); height: 6px; transform: translateX(-50%); background: rgba(255, 255, 255, 0.28); border-radius: 3px; box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.35); }
#hProg i { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.6); }
#hProg i.me { width: 16px; height: 16px; margin: -8px 0 0 -8px; border-color: #fff; z-index: 2; }
#hSpeed { left: 16px; bottom: 62px; font-size: 48px; font-weight: 900; font-style: italic; }
#hSpeed small { font-size: 14px; font-weight: 600; margin-left: 6px; font-style: normal; }
#hNitro { left: 16px; bottom: 18px; width: 200px; height: 16px; border-radius: 8px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
#hNitro i { display: block; height: 100%; background: #ff9d0a; border-radius: 8px; }
#hNitro i.on { background: #ffe27a; }
#hAnchor { left: 16px; bottom: 40px; width: 200px; height: 16px; border-radius: 8px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
#hAnchor i { display: block; height: 100%; background: #5b6b9a; border-radius: 8px; }
#hAnchor i.ready { background: #4fc3ff; }
#hAnchor i.on { background: #d6f1ff; }
#hAnchor span { position: absolute; left: 8px; top: 2px; font-size: 10px; font-weight: 800; text-shadow: none; }
#hNitro span { position: absolute; left: 8px; top: 2px; font-size: 10px; font-weight: 800; text-shadow: none; }
#hMsg { left: 0; right: 0; top: 30%; text-align: center; font-size: 46px; font-weight: 900; color: #ffcf4d; font-style: italic; }
#hMsg.count { font-size: 130px; color: #fff; top: 24%; }
#hSub { left: 0; right: 0; top: calc(30% + 64px); text-align: center; font-size: 16px; font-weight: 600; color: #eef2ff; }
#hMap { right: 16px; bottom: 16px; width: 150px; height: 200px; background: rgba(5, 8, 20, 0.5); border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.18); }
#hMap canvas { width: 100%; height: 100%; display: block; }
body.touch #hSpeed { bottom: 172px; } body.touch #hAnchor { bottom: 150px; } body.touch #hNitro { bottom: 128px; } body.touch #hMap { bottom: 130px; width: 110px; height: 150px; }
#resCoins { color: #ffcf66; font-weight: 800; font-size: 18px; margin: 4px 0; }

/* ---------- online ---------- */
.mp input { font: inherit; color: #eef2ff; background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 10px 14px; min-width: 0; flex: 1 1 130px; -webkit-user-select: text; user-select: text; }
.mp input#mpCode { flex: 0 1 96px; text-transform: uppercase; letter-spacing: 3px; text-align: center; font-weight: 800; }
.mp button { flex: 1 1 120px; font-weight: 700; }
#mpErr { color: #ff8a65; min-height: 1.2em; }
#lobPingMsg { color: #ffcf66; font-weight: 800; min-height: 1.3em; margin: 6px 0 0; }
#lobList li.pinged { outline: 2px solid #ffb21e; background: rgba(255, 178, 30, 0.3); }
#lobPing:disabled { opacity: 0.5; cursor: default; }
.lobLabel { margin: 0; color: #9fb0e0; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
#invite h1 { font-size: 34px; margin-bottom: 14px; }
#invErr { color: #ff8a65; min-height: 1.2em; }
#lobCode, #invCode { color: #ffb21e; font: 900 64px ui-monospace, Menlo, monospace; letter-spacing: 12px; margin: 4px 0 10px 12px; -webkit-user-select: text; user-select: text; }
.lobCopy { margin-bottom: 14px; }
.lobCopy button { flex: 1; width: auto !important; margin-top: 0 !important; font-weight: 700; }

/* ---------- artwork ---------- */
#menu, #invite, #lobby {
  background:
    linear-gradient(rgba(3, 4, 12, 0.35), rgba(3, 4, 12, 0.7)),
    url(assets/menu_bg.webp) center / cover no-repeat fixed #05060f;
}
#menu .panel, #invite .panel, #lobby .panel { background: rgba(10, 13, 30, 0.9); }
h1.logo { margin: -14px 0 -18px; line-height: 0; }
h1.logo img { width: min(100%, 520px); height: auto; mix-blend-mode: screen; filter: brightness(0.9) contrast(1.25); }   /* black background drops out */
#invite h1.logo { margin: -10px 0 -4px; }
#invite h1.logo img { width: min(100%, 320px); }

/* ---------- touch controls: work in portrait and landscape ---------- */
#touch {
  --b: min(74px, 17.5vw);
  padding: 12px max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
#touch button { width: var(--b); height: var(--b); font-size: min(13px, 3.2vw); }
#touch .left { gap: 8px; }
#touch .left button { font-size: min(30px, 7vw); }
/* right hand: big GAS in the corner, BRAKE / JUMP / DOWN fanned around it */
#touch .tgroup.right { position: relative; display: block; width: calc(var(--b) * 2.07 + 8px); height: calc(var(--b) * 2.07 + 8px); }
#touch .right button { position: absolute; width: calc(var(--b) * 0.82); height: calc(var(--b) * 0.82); font-size: min(11px, 2.8vw); }
#touch .right button.gas { right: 0; bottom: 0; width: calc(var(--b) * 1.25); height: calc(var(--b) * 1.25); font-size: min(17px, 4.2vw); }
#touch .right button[data-key="brake"] { right: calc(var(--b) * 1.25 + 8px); bottom: calc(var(--b) * 0.1); }
#touch .right button[data-key="space"] { right: calc(var(--b) * 1.1); bottom: calc(var(--b) * 0.95); }
#touch .right button[data-key="anchor"] { right: calc(var(--b) * 0.15); bottom: calc(var(--b) * 1.25 + 8px); }
#touch .right small { font-size: min(9px, 2.3vw); }

body.touch #hSpeed { bottom: calc(min(74px, 17.5vw) + 80px); font-size: 36px; }
body.touch #hAnchor { bottom: calc(min(74px, 17.5vw) + 58px); width: 150px; }
body.touch #hNitro { bottom: calc(min(74px, 17.5vw) + 36px); width: 150px; }
body.touch #hMap { top: 64px; bottom: auto; width: 92px; height: 122px; }

/* narrow (portrait phone) HUD */
@media (max-width: 600px) {
  #hPos { font-size: 34px; top: 8px; left: 58px; }
  #hPos small { font-size: 14px; }
  #hTime { top: 48px; left: 59px; font-size: 16px; }
  #hMenu { left: 10px; top: 8px; width: 38px; height: 38px; }
  #hPlanet { font-size: 18px; right: 12px; top: 8px; }
  #hPlanet small { font-size: 10px; }
  #hProg { top: 84px; width: 72vw; }
  #hMap, body.touch #hMap { top: 104px; bottom: auto; right: 12px; width: 78px; height: 104px; }
  #hMsg { font-size: 30px; }
  #hMsg.count { font-size: 96px; }
  #hSub { font-size: 13px; top: calc(30% + 48px); padding: 0 16px; }
}

/* ---------- rotate hint: phones held upright, first seconds of a race ---------- */
#rotateHint {
  display: none; position: fixed; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 5;
  padding: 16px 20px 14px; border-radius: 16px; background: rgba(5, 8, 20, 0.72); border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center; font-size: 14px; font-weight: 700; pointer-events: none; white-space: nowrap;
}
#rotateHint .phone {
  width: 34px; height: 60px; margin: 6px auto 16px; border: 4px solid #fff; border-radius: 9px; position: relative;
  animation: phoneTurn 1.8s ease-in-out infinite;
}
#rotateHint .phone::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 10px; height: 3px; margin-left: -5px; border-radius: 2px; background: #fff; }
@media (orientation: portrait) {
  /* shown only while waiting: in the online lobby and during the 3-2-1 countdown */
  body.touch.hint-count #rotateHint, body.touch.hint-lobby #rotateHint { display: block; animation: hintIn 0.4s; }
  body.touch.hint-lobby #rotateHint { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 16px 9px; }
  body.touch.hint-lobby #rotateHint .phone { width: 22px; height: 38px; border-width: 3px; margin: 4px auto 10px; }
}
@keyframes hintIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes phoneTurn { 0%, 18% { transform: rotate(0); } 62%, 100% { transform: rotate(-90deg); } }

/* phones: no double-tap zoom, text selection or long-press menus on the game surface */
canvas#game, #hud, #touch, #touch button, #rotateHint { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
button { touch-action: manipulation; }
#touch button { touch-action: none; }

/* ---------- weapons ---------- */
#armory { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
#armory .upg p { min-height: 3.6em; }
#modes button { flex: 1; min-width: 140px; font-weight: 700; }
#modes small { display: block; font-weight: 400; color: #9fb0e0; font-size: 12px; }
#hWeapon { left: 50%; bottom: 18px; transform: translateX(-50%); min-width: 170px; padding: 8px 12px 9px; border-radius: 12px; background: rgba(5, 8, 20, 0.6); border: 1px solid rgba(255, 255, 255, 0.18); text-shadow: none; }
#hWeapon b { font-size: 15px; } #hWeapon span { float: right; font-size: 11px; font-weight: 700; color: #cfd8f5; margin-top: 3px; }
#hWeapon em { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
#hWeapon i { display: block; height: 100%; background: #ffb21e; }
#hWeapon i.hot { background: #ff4a3a; } #hWeapon i.ammo { background: #4fc3ff; }
#hCross { left: 0; top: 0; width: 0; height: 0; }
#hCross::before, #hCross::after { content: ""; position: absolute; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 3px rgba(0, 0, 0, 0.9); }
#hCross::before { left: -17px; top: -1px; width: 34px; height: 2px; -webkit-mask: linear-gradient(90deg, #000 35%, transparent 35%, transparent 65%, #000 65%); mask: linear-gradient(90deg, #000 35%, transparent 35%, transparent 65%, #000 65%); }
#hCross::after { left: -1px; top: -17px; width: 2px; height: 34px; -webkit-mask: linear-gradient(#000 35%, transparent 35%, transparent 65%, #000 65%); mask: linear-gradient(#000 35%, transparent 35%, transparent 65%, #000 65%); }
#hCross.lock::before, #hCross.lock::after { background: #ff3b30; }
#hCross.lock { outline: 2px solid #ff3b30; outline-offset: 14px; border-radius: 50%; }
body.touch #hWeapon { left: 12px; transform: none; bottom: calc(min(74px, 17.5vw) + 126px); min-width: 150px; padding: 6px 10px 7px; }
/* touch: FIRE and SWAP join the fan, one column further left; hidden in pure racing */
#touch .gun { display: none; }
body.armed #touch .gun { display: block; }
body.armed #touch .tgroup.right { width: calc(var(--b) * 2.95 + 16px); }
#touch .right button[data-key="fire"] { right: calc(var(--b) * 2.07 + 16px); bottom: calc(var(--b) * 0.1); background: rgba(229, 57, 53, 0.6); }
#touch .right button[data-key="wpn"] { right: calc(var(--b) * 1.98 + 16px); bottom: calc(var(--b) * 1.02); }

/* ---------- health ---------- */
#hHealth { left: 16px; bottom: 62px; width: 200px; height: 16px; border-radius: 8px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
#hHealth i { display: block; height: 100%; background: #4cd964; border-radius: 8px; transition: width 0.15s; }
#hHealth i.mid { background: #ffb21e; } #hHealth i.low { background: #ff3b30; }
#hHealth span { position: absolute; left: 8px; top: 2px; font-size: 10px; font-weight: 800; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); white-space: nowrap; }
body.armed #hSpeed { bottom: 84px; }
#hHurt { inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 30, 20, 0.75) 100%); }
#hCross.hit::before, #hCross.hit::after { background: #fff; transform: rotate(45deg) scale(1.25); }
body.touch #hHealth { bottom: calc(min(74px, 17.5vw) + 80px); width: 150px; }
body.touch.armed #hSpeed { bottom: calc(min(74px, 17.5vw) + 102px); }
body.touch #hWeapon { bottom: calc(min(74px, 17.5vw) + 150px); }

/* ---------- key map: desktop only ---------- */
#hKeys { left: 16px; top: 100px; padding: 8px 10px; border-radius: 10px; background: rgba(5, 8, 20, 0.5); border: 1px solid rgba(255, 255, 255, 0.14); font-size: 11px; line-height: 1.9; color: #dfe6ff; text-shadow: none; }
#hKeys kbd { display: inline-block; min-width: 18px; padding: 0 5px; margin-right: 3px; border-radius: 4px; background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.25); font: 700 10px ui-monospace, Menlo, monospace; text-align: center; color: #fff; }
#hKeys .gunkey { display: none; }
body.armed #hKeys .gunkey { display: block; }
body.touch #hKeys { display: none; }
@media (max-width: 700px), (max-height: 420px) { #hKeys { display: none; } }

/* ---------- menu: play first, settings as collapsed pickers ---------- */
#menu .panel { max-width: 640px; }
#menu #startBtn { margin: 6px 0 16px; padding: 20px; font-size: 24px; }
details.pick { margin-top: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.11); text-align: left; }
details.pick[open] { border-color: rgba(255, 178, 30, 0.6); background: rgba(255, 255, 255, 0.07); }
details.pick > summary { display: flex; align-items: center; gap: 10px; padding: 13px 14px; cursor: pointer; list-style: none; font-size: 15px; -webkit-tap-highlight-color: transparent; }
details.pick > summary::-webkit-details-marker { display: none; }
details.pick > summary span { color: #9fb0e0; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; flex: none; }
details.pick > summary b { margin-left: auto; text-align: right; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.pick > summary::after { content: "▾"; color: #9fb0e0; flex: none; transition: transform 0.15s; }
details.pick[open] > summary::after { transform: rotate(180deg); }
details.pick > :not(summary) { margin: 0 12px 12px; }
details.pick .help { margin: 6px 12px 12px; }
details.pick .swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: -3px; border: 2px solid rgba(255, 255, 255, 0.6); }
details.pick .coins { color: #ffcf66; }
#menu .planets { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
details.pick > summary b small { display: block; font-size: 11px; font-weight: 600; color: #ffcf66; letter-spacing: 0.3px; }

/* picker icons */
details.pick .ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 178, 30, 0.14); color: #ffb21e; }
details.pick .ico svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
details.pick[open] .ico { background: #ffb21e; color: #1b1200; }
details.pick > summary { padding: 9px 14px 9px 10px; }
@media (max-width: 380px) {
  details.pick > summary { font-size: 13px; gap: 8px; }
  details.pick > summary span { font-size: 11px; letter-spacing: 1px; }
  details.pick .ico { width: 30px; height: 30px; }
}

/* ---------- corner buttons + how-to-play sheet ---------- */
.corner { position: fixed; top: max(14px, env(safe-area-inset-top)); z-index: 3; height: 44px; min-width: 44px; padding: 0 14px; border-radius: 22px; font-weight: 800; font-size: 18px; background: rgba(10, 13, 30, 0.82); border-color: rgba(255, 255, 255, 0.28); }
.corner.left { left: max(14px, env(safe-area-inset-left)); padding: 0; }
.corner.right { right: max(14px, env(safe-area-inset-right)); font-size: 14px; }
#help { align-items: center; z-index: 10; background: rgba(3, 4, 12, 0.8); }
table.keys { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; margin-bottom: 12px; }
table.keys th { color: #8fa0d8; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; padding: 4px 6px; }
table.keys td { padding: 6px; border-top: 1px solid rgba(255, 255, 255, 0.09); }
table.keys td:first-child { color: #dfe6ff; font-weight: 600; }
table.keys kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.25); font: 700 11px ui-monospace, Menlo, monospace; text-align: center; }
#help .panel.small { max-width: 520px; }
@media (max-width: 480px) { #menu .panel, #lobby .panel { margin-top: 52px; } }

/* ---------- account ---------- */
#acctBtn { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#acctBtn.in { border-color: #4cd964; color: #b9f5c5; }
#acctBtn.in::before { content: "● "; color: #4cd964; }
#acct { align-items: center; z-index: 10; background: rgba(3, 4, 12, 0.8); }
#acct .panel.small button { width: 100%; margin-top: 8px; }
#acct .big.google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #fff; font-size: 16px; letter-spacing: 0; margin: 14px 0 6px; }
#acct .big.google svg { width: 20px; height: 20px; }
#acct .or { color: #8fa0d8; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; margin: 14px 0 8px; }
.acctForm input { display: block; width: 100%; margin-bottom: 8px; font: inherit; color: #eef2ff; background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 11px 14px; -webkit-user-select: text; user-select: text; }
.acctForm .row button { flex: 1; width: auto !important; margin-top: 0 !important; font-weight: 700; }
button.link { background: none; border: none; color: #9fb0e0; text-decoration: underline; font-size: 13px; padding: 8px; }
#acctErr { color: #ff8a65; min-height: 1.3em; }
#acctWho { font-weight: 700; margin: 0 0 6px; word-break: break-word; }

/* ---------- switch between the 3D and 2D games ---------- */
.gameSwitch { display: inline-flex; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.14); }
.gameSwitch a { padding: 7px 18px; border-radius: 999px; font-size: 14px; font-weight: 800; letter-spacing: 0.5px; color: #c9d3f5; text-decoration: none; cursor: pointer; }
.gameSwitch a small { font-weight: 600; opacity: 0.75; margin-left: 5px; }
.gameSwitch a:hover { background: rgba(255, 255, 255, 0.1); }
.gameSwitch a.on { color: #1b1200; background: linear-gradient(#ffc94d, #ff9d0a); cursor: default; }
.tag { margin-bottom: 10px; }

/* ---------- help: feedback form + version ---------- */
details.fb { margin: 4px 0 4px; text-align: left; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 0 12px; background: rgba(255, 255, 255, 0.04); }
details.fb summary { padding: 11px 0; cursor: pointer; font-weight: 700; color: #ffcf66; }
details.fb[open] { padding-bottom: 12px; }
.fbKinds { gap: 6px; margin-bottom: 8px; }
.fbKinds button { flex: 1; padding: 7px 4px; font-size: 13px; font-weight: 700; }
details.fb textarea, details.fb input {
  display: block; width: 100%; margin-bottom: 8px; font: inherit; color: #eef2ff; background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 10px 12px; resize: vertical;
  -webkit-user-select: text; user-select: text; touch-action: auto;
}
details.fb textarea:focus, details.fb input:focus { outline: none; border-color: #ffb21e; }
#fbSend { width: 100%; font-weight: 800; border-color: #ffb21e; color: #ffcf66; }
#fbSend:disabled { opacity: 0.5; cursor: default; }
#fbMsg { min-height: 1.2em; margin: 6px 0 0; }
.ver { margin: 10px 0 0; font-size: 12px; color: #7f8fc4; letter-spacing: 0.5px; }

/* ---------- skins shop ---------- */
#skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.upg.skin { text-align: center; }
.upg.skin img { display: block; width: 72px; height: 72px; margin: 0 auto 2px; image-rendering: auto; }
.upg.skin b { display: block; margin-bottom: 8px; }
.upg.skin.using { border-color: #ffb21e; background: rgba(255, 178, 30, 0.12); }

/* ---------- menu: start + play online side by side; online sheet ---------- */
.playRow { display: flex; align-items: stretch; gap: 10px; margin: 22px 0 10px; }
.playRow button.big { margin: 0; flex: 1.3 1 0; width: auto; height: auto; padding: 16px 8px; white-space: nowrap; }
.playRow button#onlineBtn { flex: 1 1 0; color: #eef2ff; background: linear-gradient(#3d6fe0, #2749b0); border-color: #7fa2ff; letter-spacing: 1px; }
@media (max-width: 480px) { .playRow button.big, .playRow button#onlineBtn { font-size: 14px; letter-spacing: 0.5px; padding: 15px 4px; } }
#online { align-items: center; background: rgba(3, 4, 12, 0.72); }
#online .mp input#mpName { flex: 1 1 100%; }
#online #mpCreate { margin: 10px 0 6px; }
#online #mpErr { color: #ff8a65; min-height: 1.2em; }
#menu .playRow { margin: 6px 0 16px; }
#menu .playRow #startBtn, #menu .playRow #onlineBtn { margin: 0; padding: 18px 8px; font-size: 20px; }
@media (max-width: 480px) { #menu .playRow #startBtn, #menu .playRow #onlineBtn { padding: 16px 4px; font-size: 15px; letter-spacing: 0.5px; } }
#online .row.mp { align-items: stretch; }
#online .mp button#mpJoin { width: auto; flex: 1 1 0; margin-top: 0; font-weight: 700; }

/* ---------- help: terms of use ---------- */
details.terms { margin-top: 8px; }
details.terms summary { color: #c9d3f5; }
details.terms h4 { margin: 12px 0 2px; font-size: 13px; color: #ffcf66; letter-spacing: 0.3px; }
details.terms p { margin: 0; font-size: 12.5px; line-height: 1.55; color: #c3cdee; -webkit-user-select: text; user-select: text; }
details.terms p.when { color: #7f8fc4; font-size: 11.5px; }

/* ---------- inside the phone app ---------- */
/* Google's sign-in window cannot open inside an app shell; email sign-in and guest play work there. */
body.app #acctGoogle, body.app #acctOut .or { display: none; }
body.app #acctOut .or + .acctForm { margin-top: 14px; }

/* ---------- friends ---------- */
#inviteBar { margin: 0 0 12px; }
#inviteBar .inv { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 6px; border-radius: 12px; text-align: left; background: rgba(61, 111, 224, 0.22); border: 1px solid #7fa2ff; }
#inviteBar .inv span { flex: 1; } #inviteBar .inv b { color: #ffcf66; }
#inviteBar button, .frList button, .frCode button { padding: 6px 12px; font-size: 13px; font-weight: 700; }
#friendsBox { text-align: left; } #friendsBox h4 { margin: 14px 0 6px; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: #8fa0d8; }
.frCode { margin: 0 0 10px; color: #c9d3f5; } .frCode b { font: 800 20px ui-monospace, Menlo, monospace; letter-spacing: 3px; color: #ffb21e; margin: 0 8px; -webkit-user-select: text; user-select: text; }
#friendsBox .mp input { text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.frNote { min-height: 1.2em; margin: 6px 0 0; }
.frList { list-style: none; margin: 0; padding: 0; }
.frList li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin-bottom: 5px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.frList .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frList button.can, #inviteBar button.can { border-color: #ffb21e; color: #ffcf66; }
.panel.small .frList button { width: auto; margin-top: 0; }
#lobFriends { margin: 4px 0 10px; }
.dotNew { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #ff5a4a; }
#friendsBox .frMe { margin-bottom: 10px; } #friendsBox .frMe input { text-transform: none; letter-spacing: 0; font-weight: 600; }

/* ---------- sign-in inside the phone app: Google and Apple both use the phone's own sign-in ---------- */
#acctApple { display: none; align-items: center; justify-content: center; gap: 10px; margin-top: 0; color: #fff; background: #000; border-color: #5a5a5a; letter-spacing: 0.5px; }
#acctApple svg { width: 20px; height: 20px; }
body.app.ios #acctApple { display: flex; }
body.app #acctGoogle { display: flex; } body.app #acctOut .or { display: block; }

/* ---------- notch / Dynamic Island / home bar: keep the race gauges clear of them ---------- */
#hud { inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#hud > #hHurt { position: fixed; inset: 0; }        /* the red "hit" edge glow still covers the whole screen */
#hud > #hCross { position: fixed; }                  /* the crosshair is placed in whole-screen coordinates */

/* ---------- finish popup on a phone held sideways: wide, two columns, no scrolling ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  #results { padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  #results .panel.small {
    max-width: 780px; padding: 12px 18px; display: grid; column-gap: 20px; row-gap: 4px; align-items: center; text-align: left;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    grid-template-areas: "title list" "sub list" "coins list" "best list" "again list" "menu list";
  }
  #resTitle { grid-area: title; font-size: 24px; margin: 0; text-align: left; }
  #resSub { grid-area: sub; margin: 0; font-size: 13px; }
  #resCoins { grid-area: coins; margin: 0; }
  #resBest { grid-area: best; margin: 0; min-height: 0; font-size: 14px; }
  #results [data-act="restart"] { grid-area: again; margin: 6px 0 0; padding: 10px; font-size: 16px; }
  #results [data-act="menu"] { grid-area: menu; margin: 0 !important; padding: 8px; }
  #resList { grid-area: list; margin: 0; align-self: center; }
  #resList li { padding: 6px 10px; margin-bottom: 4px; font-size: 14px; }
  #resList li:last-child { margin-bottom: 0; }
}

/* ---------- phone held sideways (the app is always like this): menu and popups laid out wide ---------- */
.menuLeft, .menuRight { display: contents; }          /* invisible wrappers everywhere else */
@media (orientation: landscape) and (max-height: 520px) {
  .screen { padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  /* menu: logo and the two big buttons on the left, the settings list on the right */
  #menu .panel { display: flex; gap: 18px; align-items: stretch; max-width: 1000px; margin: auto; padding: 10px 16px; }
  .menuLeft { display: flex; flex-direction: column; justify-content: center; flex: 0 0 37%; min-width: 0; padding-top: 34px; }
  .menuRight { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-content: start; flex: 1 1 0; min-width: 0; margin-top: 44px; }
  .menuRight > details.pick[open], .menuRight > p { grid-column: 1 / -1; }      /* an opened setting takes the full width */
  #menu h1.logo { margin: -8px 0 -10px; } #menu h1.logo img { width: min(100%, 240px); }
  #menu .tag { font-size: 12px; margin: 0 0 8px; }
  #menu .gameSwitch { align-self: center; margin-bottom: 10px; } .gameSwitch a { padding: 5px 14px; font-size: 13px; }
  #menu .playRow { margin: 0 0 6px; }
  #menu .playRow #startBtn, #menu .playRow #onlineBtn { padding: 13px 4px; font-size: 15px; letter-spacing: 0.5px; }
  #menu details.pick { margin: 0; } #menu details.pick > summary { padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
  #menu details.pick > summary > span { letter-spacing: 0.5px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; } #menu details.pick > summary > b.coins { flex: none; } #menu details.pick > summary > b { font-size: 13px; flex: 0 6 auto; }
  /* popups: two columns instead of one tall one */
  #help .panel.small, #acct .panel.small, #online .panel.small, #lobby .panel.small { max-width: 720px; padding: 14px 20px; column-count: 2; column-gap: 24px; }
  #help .panel.small > *, #acct .panel.small > * > *, #acct .panel.small > button, #acct .panel.small > p, #online .panel.small > *, #lobby .panel.small > * { break-inside: avoid; }
  .panel.small h2.title { column-span: all; font-size: 22px; margin-bottom: 8px; }
  #help table.keys { font-size: 12px; margin-bottom: 8px; } #help table.keys td { padding: 4px 6px; }
  #help .panel.small > .help { margin-top: 0; font-size: 12px; line-height: 1.5; }
  .panel.small button.big { margin: 8px 0 6px; padding: 11px; font-size: 16px; }
  #lobCode, #invCode { font-size: 44px; letter-spacing: 8px; margin: 0 0 6px 8px; }
  #lobby .lobLabel { margin-top: 0; }
  #invite .panel.small { max-width: 560px; padding: 12px 20px; } #invite h1.logo img { width: min(100%, 190px); }
  #pause .panel.small { padding: 16px 24px; }
}
.acctNameRow { margin: 4px 0 10px; } .panel.small .acctNameRow button { width: auto; margin-top: 0; font-weight: 700; }

/* ---------- a setting opens on its own screen (no unfolding inside the menu, so the menu never scrolls) ---------- */
details.pick > summary::after { content: "›"; font-size: 18px; transform: none !important; }
#sheet { align-items: center; background: rgba(3, 4, 12, 0.8); }
.sheetPanel { max-width: 760px; max-height: 100%; display: flex; flex-direction: column; padding: 14px 18px 16px; text-align: left; }
.sheetHead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex: none; }
.sheetHead h2 { flex: 1; margin: 0; font-size: 20px; letter-spacing: 0.5px; text-transform: none; color: #fff; text-align: left; }
#sheetBack { padding: 7px 14px; font-weight: 700; flex: none; }
#sheetInfo { color: #ffcf66; font-weight: 800; flex: none; }
#sheetInfo small { display: none; } #sheetInfo .swatch { display: none; }
#sheetBody { overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#sheetBody > * { margin: 0; }
@media (orientation: landscape) and (max-height: 520px) {
  .sheetPanel { max-width: 920px; padding: 10px 16px 12px; }
  .sheetHead { margin-bottom: 8px; } .sheetHead h2 { font-size: 17px; }
  #sheetBody .planets { grid-template-columns: repeat(3, 1fr); }
  #sheetBody .planet { padding: 8px; gap: 8px; } #sheetBody .planet .ball { width: 38px; height: 38px; }
  #sheetBody #skins { grid-template-columns: repeat(4, 1fr); gap: 8px; } #sheetBody .upg.skin canvas, #sheetBody .upg.skin img { max-width: 78px; width: 78px; height: auto; margin-bottom: 0; }
  #sheetBody .upg.skin { padding: 6px 8px; } #sheetBody .upg.skin b { margin-bottom: 4px; font-size: 13px; } #sheetBody .upg.skin button { padding: 5px; font-size: 12px; }
  #sheetBody #garage { grid-template-columns: repeat(3, 1fr); gap: 8px; } #sheetBody #armory { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  #sheetBody .upg button { padding: 6px; font-size: 12px; } #sheetBody .upg .pips { margin-bottom: 6px; }
  #sheetBody .upg { padding: 8px 10px; } #sheetBody .upg p { margin: 2px 0 6px; font-size: 12px; min-height: 0; }
}

/* ---------- help: Contact us, Terms and Privacy open on their own screen ---------- */
#help details.fb > summary { display: flex; align-items: center; list-style: none; }
#help details.fb > summary::-webkit-details-marker { display: none; }
#help details.fb > summary::after { content: "›"; margin-left: auto; font-size: 18px; color: #9fb0e0; }
#sheetBody.doc h4 { margin: 12px 0 2px; font-size: 13px; color: #ffcf66; letter-spacing: 0.3px; }
#sheetBody.doc p { margin: 0; font-size: 13px; line-height: 1.55; color: #c3cdee; -webkit-user-select: text; user-select: text; }
#sheetBody.doc p.when { color: #7f8fc4; font-size: 11.5px; }
#sheetBody.doc p.help { margin: 6px 0 0; min-height: 1.2em; }
#sheetBody.doc .fbKinds { margin-bottom: 8px; }
#sheetBody.doc textarea, #sheetBody.doc input {
  display: block; width: 100%; margin: 0 0 8px; font: inherit; color: #eef2ff; background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 10px 12px; resize: vertical;
  -webkit-user-select: text; user-select: text; touch-action: auto;
}
#sheetBody.doc textarea:focus, #sheetBody.doc input:focus { outline: none; border-color: #ffb21e; }
.sheetPanel.narrow { max-width: 620px; }
@media (orientation: landscape) and (max-height: 520px) { .sheetPanel.narrow { max-width: 760px; } #sheetBody.doc textarea { height: 64px; } }
@media (orientation: landscape) and (max-height: 520px) { #help details.fb { margin: 3px 0; } #help details.fb > summary { padding: 7px 0; font-size: 14px; } #help .ver { margin-top: 6px; } #help #helpClose { margin: 6px 0 0; padding: 9px; } #help h2.title { margin-bottom: 4px; } }
.frPush { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; padding: 8px 10px; border-radius: 10px; background: rgba(61, 111, 224, 0.16); border: 1px solid rgba(127, 162, 255, 0.5); font-size: 13px; }
.frPush span { flex: 1; } .frPush button { flex: none; padding: 6px 12px; font-size: 13px; font-weight: 700; }

/* ---------- menu backdrop drifts very slowly (a still picture, gently zooming and sliding) ---------- */
#menu, #invite, #lobby { background: #05060f; }
#menu::before, #invite::before, #lobby::before {
  content: ""; position: fixed; inset: -7%; z-index: 0; pointer-events: none;
  background: linear-gradient(rgba(3, 4, 12, 0.35), rgba(3, 4, 12, 0.7)), url(assets/menu_bg.webp) center / cover no-repeat;
  animation: bgDrift 80s ease-in-out infinite alternate; will-change: transform;
}
#menu .panel, #invite .panel, #lobby .panel { position: relative; z-index: 1; }
@keyframes bgDrift {
  from { transform: scale(1) translate3d(-2%, -1.2%, 0); }
  to { transform: scale(1.14) translate3d(2%, 1.4%, 0); }
}
@media (prefers-reduced-motion: reduce) { #menu::before, #invite::before, #lobby::before { animation: none; } }

/* ---------- menu backdrop: a slow looping video of the scene (the still picture is the fallback) ---------- */
#bgVideo { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #05060f; pointer-events: none; }
body.vbg #menu, body.vbg #invite, body.vbg #lobby { background: linear-gradient(rgba(3, 4, 12, 0.3), rgba(3, 4, 12, 0.66)); }
body.vbg #menu::before, body.vbg #invite::before, body.vbg #lobby::before { display: none; }
/* with the video behind it, the menu panel is see-through enough to watch the scene */
body.vbg #menu .panel { background: rgba(8, 11, 26, 0.58); border-color: rgba(255, 255, 255, 0.16); }
body.vbg #menu details.pick { background: rgba(10, 14, 32, 0.62); }
/* the logo picture now has real transparency: no blending tricks needed */
h1.logo img { mix-blend-mode: normal; filter: none; }

/* coin packs */
.shopList li { padding: 9px 12px; } .shopList .nm { font-size: 15px; } .shopList .coins { margin-right: 4px; }
.shopList button { min-width: 92px; padding: 8px 14px; font-size: 14px; font-weight: 800; }
/* the shop is reached from the screens where coins are spent, not from its own menu row */
#pickShop { display: none !important; }
#sheetCoins { flex: none; padding: 6px 12px; font-size: 13px; font-weight: 800; }
body:not(.shop) #sheetCoins { display: none; }

/* Help: usage statistics on/off */
.statsRow { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 6px; text-align: left; cursor: pointer; }
.statsRow input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: #ffb21e; }
.statsRow span { font-weight: 700; }
.statsRow small { display: block; font-weight: 400; opacity: 0.75; font-size: 0.85em; line-height: 1.35; margin-top: 2px; }

/* the pause sheet covers the touch controls (they come later in the page) */
#pause { z-index: 6; }

/* Android draws a rectangle over a tapped button (tap highlight) and a focus ring after it: neither on the race controls */
html { -webkit-tap-highlight-color: transparent; }
#touch button, #hMenu { -webkit-tap-highlight-color: transparent; outline: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#touch button:focus, #touch button:focus-visible, #hMenu:focus, #hMenu:focus-visible { outline: none; }

#pause .statsRow { margin: 16px 4px 2px; }

/* the gear is small on a phone: the touch area reaches 14px beyond it */
#hMenu::before { content: ''; position: absolute; inset: -14px; border-radius: 50%; }
#hMenu { touch-action: none; }

#pause button { touch-action: none; -webkit-tap-highlight-color: transparent; }

/* ---------- new version bar (menu) + required update screen: js/updates.js ---------- */
#updateBar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 0 12px; border-radius: 12px; text-align: left; background: rgba(255, 178, 30, 0.14); border: 1px solid #ffb21e; }
#updateBar span { flex: 1; } #updateBar b { color: #ffcf66; }
#updateBar button { padding: 6px 12px; font-size: 13px; font-weight: 700; flex: none; }
#updateBar button.can { border-color: #ffb21e; color: #ffcf66; }
#updateGate { align-items: center; z-index: 30; background: rgba(3, 4, 12, 0.94); }
#updateGate p { margin: 0 0 6px; line-height: 1.5; }
#updateGate h1.logo { margin: -10px 0 -4px; } #updateGate h1.logo img { width: min(100%, 300px); }
#updateGate button.big { margin: 14px 0 0; }
@media (orientation: landscape) and (max-height: 520px) { #updateGate .panel.small { max-width: 520px; padding: 12px 20px 16px; } #updateGate h1.logo img { width: min(100%, 170px); } #updateGate h2.title { font-size: 22px; margin-bottom: 6px; } }

/* ---------- opening screen (phone app only; see the top of index.html) ---------- */
/* backdrop and logo size repeat the app's launch picture (app/tools/make-art.mjs): the logo is 34% of the long side, centred */
#splash { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #05060f radial-gradient(circle at 50% 50%, #1d2a66 5vmax, #0b1030 43vmax, #05060f 75vmax); transition: opacity 0.5s ease; }
#splash.out { opacity: 0; pointer-events: none; }
.splashIn { position: relative; width: 34vmax; }
.splashIn img { display: block; width: 100%; height: auto; animation: splashLogo 1.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
#splash.out .splashIn { transform: scale(1.12); transition: transform 0.5s ease-in; }
.splashIn p { position: absolute; left: -30vmax; right: -30vmax; top: 100%; margin: 6px 0 0; text-align: center; color: #9fb0e0; font-size: clamp(12px, 1.7vmax, 18px); letter-spacing: 0.4px; animation: splashUp 0.6s ease-out 0.35s both; }
.splashIn i { position: absolute; left: 22%; right: 22%; top: calc(100% + clamp(34px, 5vmax, 52px)); height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; animation: splashUp 0.4s ease-out 0.35s both; }
.splashIn i b { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #ff9d0a, #ffc94d); transform-origin: left; animation: splashBar 1.3s ease-in-out 0.4s both; }
@keyframes splashLogo { 0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 178, 30, 0)); } 45% { transform: scale(1.09); filter: drop-shadow(0 0 22px rgba(255, 178, 30, 0.55)); } 100% { transform: scale(1.05); filter: drop-shadow(0 0 12px rgba(255, 178, 30, 0.3)); } }
@keyframes splashUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes splashBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .splashIn img, .splashIn p, .splashIn i, .splashIn i b { animation: none; } #splash.out .splashIn { transform: none; } }
