/* Layout: full-bleed 3D sky with glassy dusk-blue panels docked over it; one world, one dark look. */
:root {
  --ink: #0d1328;
  --panel: rgba(14, 22, 48, 0.78);
  --panel-2: rgba(28, 40, 78, 0.72);
  --line: rgba(190, 215, 255, 0.16);
  --text: #f6efe2;
  --dim: #a9b6d3;
  --apricot: #ff9d5c;
  --on-apricot: #2a1406; /* text on accent buttons; both follow the equipped paint (UI.applyAccent) */
  --sky: #7fd6ff;
  --mint: #7affc8;
  --gold: #ffd36b;
  --bad: #ff6b6b;
  --display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; }
body { margin: 0; background: var(--ink); color: var(--text); font-family: var(--body); overflow: hidden; -webkit-user-select: none; user-select: none; touch-action: none; }
html { box-sizing: border-box; } *, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: max(18px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.screen.dim { background: linear-gradient(180deg, rgba(8, 12, 30, 0.55), rgba(8, 12, 30, 0.82)); }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head h2 { font-family: var(--display); font-weight: 900; font-size: clamp(34px, 6vw, 54px); letter-spacing: 0.02em; text-transform: uppercase; margin: 0; line-height: 0.9; flex: 1; text-wrap: balance; }
.back { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; font-weight: 700; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-width: 0; }
.label { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.muted { color: var(--dim); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 12px; }
.btn { background: var(--apricot); color: var(--on-apricot); border: 0; border-radius: 14px; padding: 14px 22px; font-weight: 800; font-size: 16px; letter-spacing: 0.02em; transition: transform .12s, filter .12s; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.sky { background: var(--sky); color: #06213a; }
.btn.small { padding: 9px 14px; font-size: 14px; border-radius: 11px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.dot.off { background: #6b7690; box-shadow: none; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar, drawer, music player ---------- */
:root { --tbh: 58px; }
#topbar { position: absolute; left: 0; right: 0; top: 0; z-index: 8; height: calc(var(--tbh) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 18px; background: linear-gradient(180deg, rgba(8, 12, 30, 0.7), rgba(8, 12, 30, 0)); }
body.has-topbar .screen { padding-top: calc(var(--tbh) + max(14px, env(safe-area-inset-top, 0px))); }
.brand { font-family: var(--display); font-weight: 900; font-size: 26px; letter-spacing: 0.02em; text-transform: uppercase; color: #ffd9b8; flex: none; }
.tb-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tb-tabs::-webkit-scrollbar { display: none; }
.tb-tab { background: none; border: 0; padding: 8px 14px; border-radius: 999px; font-family: var(--body); font-weight: 700; font-size: 15px; color: var(--dim); flex: none; transition: background-color .12s ease-out, color .12s ease-out; }
.tb-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.tb-tab.on { color: var(--on-apricot); background: var(--apricot); }
.tb-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
.tb-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.tb-btn:hover { border-color: rgba(255, 255, 255, 0.4); }
.tb-btn svg { width: 18px; height: 18px; }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #ffcc3d 45%, #d68a12 100%); box-shadow: inset 0 0 0 2px rgba(120, 70, 0, 0.35); display: inline-block; flex: none; }
#music-pop { position: absolute; z-index: 9; top: calc(var(--tbh) + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: 250px; padding: 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 6px; }
#music-pop b { font-family: var(--display); font-weight: 900; font-size: 34px; text-transform: uppercase; line-height: 0.9; }
#music-pop small { color: var(--dim); font-size: 13px; min-height: 18px; }
.mp-ctl { display: flex; justify-content: center; gap: 12px; margin: 8px 0; }
.mp-ctl button { width: 42px; height: 42px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; }
.mp-ctl button svg { width: 16px; height: 16px; }
.mp-ctl .mp-main { width: 52px; height: 52px; background: var(--text); color: var(--ink); }
.mp-vol { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--dim); }
.mp-vol input { flex: 1; accent-color: var(--apricot); }
#drawer { position: absolute; z-index: 12; top: 0; right: 0; bottom: 0; width: min(360px, 100%); padding: max(18px, env(safe-area-inset-top, 0px)) 18px max(18px, env(safe-area-inset-bottom, 0px)); background: rgba(10, 14, 32, 0.96); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4); }
.dr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dr-head h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 44px; text-transform: uppercase; }
.dr-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.dr-item:hover { border-color: rgba(255, 255, 255, 0.4); }
.dr-item b { font-size: 16px; } .dr-item small { color: var(--dim); font-size: 13px; }
.dr-foot { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- basecamp (title): info chips on top, glider in the middle, one launch bar at the bottom ---------- */
#scr-title { justify-content: space-between; background: linear-gradient(180deg, rgba(8, 12, 30, 0.35) 0%, rgba(8, 12, 30, 0) 24%, rgba(8, 12, 30, 0) 68%, rgba(8, 12, 30, 0.55) 100%); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; position: relative; z-index: 2; }
.chip { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-align: left; min-width: 0; position: relative; }
button.chip:hover { border-color: rgba(255, 255, 255, 0.35); }
.chip .k { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.chip b { font-family: var(--display); font-weight: 800; font-size: 19px; text-transform: uppercase; line-height: 1; }
.chip small { font-size: 12px; font-weight: 700; color: var(--dim); }
.chip.prog .lv { font-family: var(--display); font-weight: 800; font-size: 16px; text-transform: uppercase; letter-spacing: 0.06em; }
.chip.prog .lv b { font-size: 24px; margin-left: 2px; }
.chip.prog .bar { width: 110px; height: 7px; }
.chip .swatch { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.chip-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chips .foot { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.title-world { font-size: 13px; font-weight: 700; color: #dfe7f7; padding: 6px 12px; border-radius: 999px; background: rgba(10, 16, 36, 0.62); }
.launch { align-self: center; width: min(900px, 100%); display: flex; border-radius: 20px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35); position: relative; z-index: 2; }
.modes-seg { display: flex; flex: 1; min-width: 0; }
.mcard { flex: 1; min-width: 0; padding: 16px 18px 18px; text-align: left; background: none; border: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; color: var(--dim); position: relative; transition: background-color .15s ease-out; }
.mcard:hover { background: rgba(255, 255, 255, 0.04); }
.mcard b { font-family: var(--display); font-weight: 900; font-size: 28px; text-transform: uppercase; line-height: 0.95; color: var(--text); display: flex; align-items: center; gap: 8px; }
.mcard b::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--mc); flex: none; }
.mcard small { font-size: 12px; font-weight: 700; }
.mcard.on { background: rgba(255, 255, 255, 0.08); color: #dfe7f7; }
.mcard.on::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--mc); }
.mcard[data-mode="courses"] { --mc: #7fd6ff; }
.mcard[data-mode="sky"] { --mc: #b58bff; }
.mcard[data-mode="race"] { --mc: #ff7a8a; }
.mcard[data-mode="daily"] { --mc: #ffd36b; }
.flybtn { flex: none; min-width: 220px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; padding: 0 30px; background: var(--apricot); color: var(--on-apricot); transition: filter .12s ease-out; }
.flybtn:hover { filter: brightness(1.08); }
.flybtn span { font-family: var(--display); font-weight: 900; font-size: 44px; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1; }
.flybtn svg { width: 34px; height: 34px; }
.nameplate { position: absolute; left: var(--gx, 50%); top: var(--gy, 62%); transform: translate(-50%, 0); text-align: center; pointer-events: none; display: flex; flex-direction: column; gap: 2px; padding: 6px 16px; border-radius: 12px; background: rgba(10, 16, 36, 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.nameplate b { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 0.1em; text-transform: uppercase; }
.nameplate small { font-size: 12px; font-weight: 700; color: #dfe7f7; letter-spacing: 0.08em; text-transform: uppercase; }
.callsign { display: flex; gap: 8px; align-items: center; }
.callsign input, .field { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 10px; font: inherit; font-weight: 700; width: 100%; min-width: 0; }

/* ---------- boards: picture cards, one opens at a time ---------- */
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.bcard { border-radius: 16px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.bhead { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; position: relative; }
.bhead img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.bhead b { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px; font-family: var(--display); font-weight: 800; font-size: 21px; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1; background: linear-gradient(0deg, rgba(8, 12, 30, 0.85), rgba(8, 12, 30, 0)); }
.bcard:hover { border-color: rgba(255, 255, 255, 0.4); }
.bcard.open { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); border-color: var(--apricot); }
.bcard.open .bhead b { font-size: 30px; }
.dtag { flex: none; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.dtag.easy { background: #1f4d3a; color: #9ff0c4; }
.dtag.medium { background: #4d3d14; color: #ffd98a; }
.dtag.hard { background: #5a1f26; color: #ffb3bb; }
.bdetail { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
@media (max-width: 760px) { .bgrid { grid-template-columns: 1fr 1fr; } .bcard.open { grid-template-columns: 1fr; } .bhead b { font-size: 17px; } }

/* ---------- world map ---------- */
#scr-fly { background: none; }
#scr-fly .map-head, .map-list, .map-panel { position: relative; z-index: 1; }
.map-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.map-head h2 { font-family: var(--display); font-weight: 900; font-size: clamp(32px, 5vw, 50px); text-transform: uppercase; margin: 0; flex: 1; line-height: 0.9; }
.map-body { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; min-height: 0; padding-top: 10px; }
.map-list { display: flex; flex-direction: column; gap: 6px; overflow: auto; min-height: 0; }
.pin { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px 9px 9px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); text-align: left; transition: border-color .12s ease-out; }
.pin:hover { border-color: rgba(255, 255, 255, 0.45); }
.pin.sel { border-color: var(--apricot); background: var(--panel-2); }
.pin.locked { opacity: 0.6; }
.pin i { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font-style: normal; font-family: var(--display); font-weight: 900; font-size: 16px; background: var(--text); color: var(--ink); }
.pin.sel i { background: var(--apricot); color: var(--on-apricot); }
.pin b { font-family: var(--display); font-weight: 800; font-size: 19px; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1; display: block; }
.pin small { font-size: 12px; font-weight: 700; color: var(--dim); display: block; margin-top: 2px; }
.map-stage { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.map-pic { position: relative; z-index: 0; flex: 1; min-height: 240px; border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 0 0 200vmax #0d1328; } /* a window onto the live 3D scene: the huge shadow paints the rest of the screen dark */
.map-pic.locked { backdrop-filter: grayscale(0.85) brightness(0.55); -webkit-backdrop-filter: grayscale(0.85) brightness(0.55); }
.map-pic .cap { position: absolute; left: 16px; bottom: 16px; max-width: min(520px, calc(100% - 32px)); padding: 14px 18px; border-radius: 16px; background: rgba(10, 16, 36, 0.78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.map-pic h3 { margin: 4px 0 6px; font-family: var(--display); font-weight: 900; font-size: clamp(34px, 4.4vw, 52px); text-transform: uppercase; line-height: 0.9; }
.map-pic p { margin: 0; color: #dfe7f7; font-size: 14px; }
.map-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.map-panel .opt { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.map-panel .opt b { display: block; font-size: 15px; }
.map-panel .opt small { color: var(--dim); font-size: 12px; }

/* ---------- shop ---------- */
.shop-wrap { max-width: 600px; margin-left: 0; align-self: flex-start; padding: 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
.sitem { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px; border-radius: 14px; background: var(--panel); border: 2px solid transparent; color: var(--text); text-align: left; transition: border-color .12s ease-out; }
.sitem:hover { border-color: var(--line); }
.sitem.sel { border-color: var(--apricot); }
.sitem .swatch { height: 28px; }
.sitem .sname { font-weight: 800; font-size: 14px; }
.sitem .price { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 13px; }
.sitem .price s { color: var(--dim); font-weight: 600; }
.sitem .have { font-size: 12px; font-weight: 800; color: var(--dim); }
.shop-sel { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.shop-sel .swatch { width: 44px; height: 44px; flex: none; }
.shop-sel .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-sel .info b { font-size: 16px; }
.shop-sel .info small { color: var(--dim); font-size: 12px; }

/* ---------- phones: everything stays, the page scrolls ---------- */
@media (max-width: 760px) {
  #topbar { gap: 8px; }
  .brand { display: none; }
  .tb-tab { font-size: 14px; padding: 7px 10px; }
  .tb-btn { padding: 0 9px; }
  #music-name, #menu-btn span { display: none; }
  .chips { gap: 6px; }
  .chip { padding: 6px 10px; }
  .chip b { font-size: 16px; }
  .chip.prog .bar { width: 70px; }
  .chips .foot { margin-left: 0; }
  .launch { flex-direction: column; }
  .mcard { padding: 10px 10px 12px; }
  .mcard b { font-size: 19px; }
  .mcard small { font-size: 11px; }
  .flybtn { min-height: 62px; }
  .map-body { grid-template-columns: 1fr; }
  .map-list { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .pin { padding: 7px 8px 7px 7px; gap: 8px; }
  .pin i { width: 28px; height: 28px; font-size: 14px; }
  .pin b { font-size: 15px; }
  .pin small { font-size: 11px; }
  .map-pic { flex: none; aspect-ratio: 16 / 10; min-height: 0; }
  .map-pic .cap { left: 10px; bottom: 10px; padding: 8px 12px; }
  .map-pic h3 { font-size: 28px; margin: 2px 0 0; }
  .map-pic p { display: none; }
}

/* ---------- fly / world select ---------- */
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; }
.wcard { position: relative; border-radius: 14px; padding: 12px; min-height: 104px; text-align: left; border: 2px solid transparent; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.wcard.sel { border-color: var(--text); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15); }
.wcard b { font-family: var(--display); font-weight: 800; font-size: 22px; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1; }
.wcard small { font-size: 12px; opacity: 0.9; font-weight: 700; }
.wcard.locked { filter: grayscale(0.8) brightness(0.6); }
.wcard .lk { position: absolute; top: 8px; right: 10px; font-size: 12px; font-weight: 800; background: rgba(0, 0, 0, 0.45); padding: 3px 8px; border-radius: 999px; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.mode { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mode:hover { border-color: rgba(255, 255, 255, 0.4); }
.mode h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1; }
.mode p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.4; }
.tag { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); }
.tag.easy { background: rgba(122, 255, 200, 0.18); color: var(--mint); }
.tag.hard { background: rgba(255, 107, 107, 0.18); color: #ffa3a3; }
.medals { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; font-weight: 700; }
.medal { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); opacity: 0.55; }
.medal.got { opacity: 1; background: rgba(255, 255, 255, 0.14); }
.medal i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.m-plat i { background: linear-gradient(135deg, #f4f8ff, #9fb3cc); } .m-gold i { background: #ffd36b; } .m-silver i { background: #cfd8e6; } .m-bronze i { background: #d08a52; }
.best { font-size: 14px; font-weight: 700; }

/* ---------- lists, tables ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; color: var(--dim); }
.tab.on { background: var(--text); color: var(--ink); border-color: var(--text); }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item { background: var(--panel-2); border: 2px solid var(--line); border-radius: 14px; padding: 12px; text-align: left; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.item.on { border-color: var(--apricot); }
.item.locked { opacity: 0.5; }
.item b { font-size: 15px; }
.item small { color: var(--dim); font-size: 12px; line-height: 1.3; }
.swatch { height: 34px; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); font-weight: 800; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 9px 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
tr.me td { background: rgba(255, 157, 92, 0.12); }
.tablewrap { overflow-x: auto; }
.bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--apricot); border-radius: 999px; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ach { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); opacity: 0.5; min-width: 0; }
.ach.got { opacity: 1; border-color: rgba(255, 211, 107, 0.5); }
.ach b { display: block; font-size: 14px; } .ach small { color: var(--dim); font-size: 12px; }
.track { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.tier { flex: 0 0 120px; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; min-height: 86px; display: flex; flex-direction: column; gap: 4px; }
.tier.got { border-color: rgba(255, 157, 92, 0.6); }
.tier.cur { box-shadow: 0 0 0 2px var(--apricot); }
.tier b { font-family: var(--display); font-size: 22px; font-weight: 800; }
.chal { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.chal.done { border-color: rgba(122, 255, 200, 0.5); }
.set { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; }
.set label { font-weight: 700; }
.set input[type=range] { width: min(220px, 42vw); accent-color: var(--apricot); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 8px 12px; font-weight: 700; font-size: 13px; color: var(--dim); }
.seg button.on { background: var(--text); color: var(--ink); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
kbd { display: inline-block; min-width: 26px; text-align: center; padding: 3px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); border-bottom: 2px solid rgba(0, 0, 0, 0.4); font-family: var(--body); font-weight: 800; font-size: 12px; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
#hud::before, #hud::after { content: ""; position: absolute; left: 0; right: 0; height: 150px; pointer-events: none; }
#hud::before { top: 0; background: linear-gradient(180deg, rgba(8, 14, 34, 0.5), rgba(8, 14, 34, 0)); }
#hud::after { bottom: 0; background: linear-gradient(0deg, rgba(8, 14, 34, 0.5), rgba(8, 14, 34, 0)); }
#hud > * { z-index: 1; }
.hud-tl { position: absolute; top: max(14px, env(safe-area-inset-top, 0px)); left: max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 2px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); }
.hud-mode { font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #e7eefb; }
.hud-time { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 6vw, 50px); line-height: 0.95; }
.hud-delta { font-weight: 800; font-size: 16px; height: 20px; }
.hud-delta.ahead { color: var(--mint); } .hud-delta.behind { color: #ffa3a3; }
.hud-target { font-size: 13px; font-weight: 700; color: #dbe5f7; }
.hud-tc { position: absolute; top: max(14px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); }
.hud-rings { font-family: var(--display); font-weight: 800; font-size: 30px; }
.hud-combo { font-weight: 800; font-size: 15px; color: var(--gold); min-height: 20px; }
.hud-tr { position: absolute; top: max(14px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); text-align: right; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.hud-score { font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; }
.hud-bl { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; gap: 18px; align-items: flex-end; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.gauge b { display: block; font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 0.9; }
.gauge span { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #dfe7f7; }
.boost { width: 150px; }
.boost .bar { height: 8px; background: rgba(0, 0, 0, 0.35); }
.boost .bar > i { background: var(--sky); }
#minimap { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); width: 150px; height: 150px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(10, 16, 36, 0.4); }
#feed { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.feed-item { font-weight: 800; font-size: 18px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); animation: feed 1.6s ease-out forwards; white-space: nowrap; }
.feed-item em { font-style: normal; color: var(--gold); margin-left: 8px; }
.feed-item i { font-style: normal; color: var(--mint); margin-left: 6px; font-size: 14px; }
@keyframes feed { 0% { opacity: 0; transform: translateY(10px) scale(0.9); } 12% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-24px); } }
#warn { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font-family: var(--display); font-weight: 900; font-size: 34px; letter-spacing: 0.08em; text-transform: uppercase; color: #ff8a80; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
#count { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 900; font-size: clamp(90px, 18vw, 170px); text-shadow: 0 6px 30px rgba(0, 0, 0, 0.4); }
#count.pop { animation: pop .8s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } }
#flash { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font-weight: 800; font-size: 20px; padding: 8px 16px; border-radius: 999px; background: rgba(10, 16, 36, 0.7); }
#marker { position: absolute; left: 0; top: 0; width: 0; height: 0; }
#marker .arr { position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; }
#marker .dist { position: absolute; left: -40px; width: 80px; top: 18px; text-align: center; font-weight: 800; font-size: 13px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
#split { position: absolute; left: 50%; top: 15%; transform: translateX(-50%); font-family: var(--display); font-weight: 800; font-size: 30px; padding: 2px 14px; border-radius: 10px; background: rgba(10, 16, 36, 0.55); }
#split.ahead { color: var(--mint); } #split.behind { color: #ffa3a3; }
#standings { min-width: 180px; background: rgba(10, 16, 36, 0.6); border-radius: 12px; padding: 8px 10px; font-size: 13px; text-align: left; }
#standings div { display: flex; gap: 8px; justify-content: space-between; padding: 2px 0; }
#standings .me { color: var(--apricot); font-weight: 800; }
.hud-pilots { font-size: 13px; font-weight: 700; background: rgba(10, 16, 36, 0.55); padding: 6px 10px; border-radius: 10px; max-width: 220px; }
#lobby { position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(520px, calc(100% - 32px)); pointer-events: auto; }
#photo-hint { position: absolute; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); font-size: 14px; font-weight: 700; background: rgba(10, 16, 36, 0.6); padding: 8px 14px; border-radius: 999px; pointer-events: auto; }

/* touch controls */
#touch { position: absolute; inset: 0; pointer-events: none; }
body:not([data-input="touch"]) #touch { display: none; }
#touch .tb { pointer-events: auto; position: absolute; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(10, 16, 36, 0.35); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: 0.06em; display: flex; align-items: center; justify-content: center; touch-action: none; }
#touch .tb.on { background: rgba(255, 157, 92, 0.6); }
#t-boost { width: 92px; height: 92px; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
#t-brake { width: 64px; height: 64px; right: calc(max(20px, env(safe-area-inset-right, 0px)) + 14px); bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 104px); }
#t-cam { width: 52px; height: 52px; right: calc(max(20px, env(safe-area-inset-right, 0px)) + 20px); bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 244px); }
#t-reset { width: 52px; height: 52px; right: calc(max(20px, env(safe-area-inset-right, 0px)) + 20px); bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 180px); }
#t-drop { width: 52px; height: 52px; right: calc(max(20px, env(safe-area-inset-right, 0px)) + 20px); bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 180px); }
#touch .tb[hidden] { display: none; }
#t-pause { width: 46px; height: 46px; left: 50%; transform: translateX(-50%); top: max(64px, env(safe-area-inset-top, 0px)); border-radius: 12px; }
/* arrow pad, bottom-left: works like the arrow keys */
#touch .tpad { width: 64px; height: 64px; border-radius: 18px; }
#touch .tpad svg { width: 24px; height: 24px; }
.tstick { position: absolute; pointer-events: auto; touch-action: none; left: max(20px, env(safe-area-inset-left, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px)); width: 130px; height: 130px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); background: rgba(10, 16, 36, 0.35); }
.tstick i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); pointer-events: none; }
.touch-hint { position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 150px); font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, 0.6); }
body[data-input="touch"] #minimap { width: 110px; height: 110px; bottom: auto; top: calc(max(14px, env(safe-area-inset-top, 0px)) + 62px); }
body[data-input="touch"] .hud-tc { left: auto; right: max(16px, env(safe-area-inset-right, 0px)); transform: none; text-align: right; }
body[data-input="touch"] .hud-tc .hud-rings { font-size: 24px; }
body[data-input="touch"] .hud-tr { top: calc(max(14px, env(safe-area-inset-top, 0px)) + 182px); }
body[data-input="touch"] .hud-bl { bottom: auto; top: max(120px, env(safe-area-inset-top, 0px)); flex-direction: column; align-items: flex-start; gap: 6px; }
body[data-input="touch"] .gauge b { font-size: 30px; }

/* overlays */
.overlay { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 10, 26, 0.55); }
.card { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); touch-action: pan-y; }
.card h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 46px; text-transform: uppercase; line-height: 0.9; }
.res-big { font-family: var(--display); font-weight: 900; font-size: 72px; line-height: 0.9; }
.res-medal { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.res-medal i { width: 28px; height: 28px; border-radius: 50%; display: inline-block; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stat { background: var(--panel-2); border-radius: 12px; padding: 10px; }
.stat b { display: block; font-size: 20px; font-weight: 800; }
.stat span { font-size: 11px; color: var(--dim); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
#toasts { position: absolute; top: max(16px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; z-index: 20; max-width: calc(100% - 32px); }
.toast { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; max-width: 320px; animation: toast 4.2s ease forwards; backdrop-filter: blur(10px); }
.toast b { display: block; font-size: 14px; color: var(--c, var(--text)); } .toast span { font-size: 13px; color: var(--dim); }
@keyframes toast { 0% { opacity: 0; transform: translateX(30px); } 8% { opacity: 1; transform: none; } 88% { opacity: 1; } 100% { opacity: 0; transform: translateX(30px); } }
/* phones held upright: the game only plays sideways (main.js pauses a flight when this shows) */
#rotate { display: none; position: fixed; inset: 0; z-index: 40; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; background: var(--ink); color: var(--text); }
#rotate svg { width: 120px; height: 90px; color: var(--apricot); }
#rotate b { font-family: var(--display); font-weight: 900; font-size: 32px; text-transform: uppercase; line-height: 1; }
#rotate small { color: var(--dim); font-size: 14px; font-weight: 700; }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 600px) { #rotate { display: flex; } }
#loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--ink); z-index: 30; }
.logo { font-family: var(--display); font-weight: 900; font-size: clamp(84px, 17vw, 190px); line-height: 0.78; letter-spacing: -0.01em; margin: 0; text-transform: uppercase; color: #ffd9b8; }
#loading .logo { font-size: 110px; }
#loading p { color: var(--dim); font-weight: 700; }
#loading .about { max-width: 440px; margin: 0; padding: 0 20px; text-align: center; font-weight: 600; font-size: 14px; line-height: 1.5; }
#loading .about a { color: var(--text); white-space: nowrap; }
@media (max-width: 640px) {

  #scr-title { background: linear-gradient(180deg, rgba(8, 12, 30, 0.65) 0%, rgba(8, 12, 30, 0.1) 40%, rgba(8, 12, 30, 0.75) 100%); }
  .hud-score { font-size: 30px; }
  .gauge b { font-size: 32px; }
  .boost { width: 110px; }
  #minimap { width: 110px; height: 110px; }
}
@media (prefers-reduced-motion: reduce) { .feed-item, .toast, #count.pop { animation-duration: 0.01s; animation-iteration-count: 1; } }

/* phones held sideways are short: shrink the menu so the glider and FLY button fit */
@media (max-height: 520px) {
  :root { --tbh: 44px; }
  .tb-tab { font-size: 13px; padding: 6px 10px; }
  .brand { font-size: 22px; }
  .chips { gap: 6px; }
  .chip { padding: 5px 10px; gap: 8px; border-radius: 10px; }
  .chip .k { font-size: 9px; }
  .chip b { font-size: 14px; }
  .chip small { font-size: 10px; }
  .chip.prog .lv b { font-size: 18px; }
  .chip.prog .bar { width: 70px; }
  .chip .swatch { width: 20px; height: 20px; }
  .callsign input, .callsign .btn { padding: 6px 10px; font-size: 13px; }
  .title-world, .pill { font-size: 11px; padding: 4px 10px; }
  .launch { width: min(720px, 100%); border-radius: 14px; flex-direction: row; }
  .mcard { padding: 8px 10px 10px; gap: 2px; }
  .mcard b { font-size: 17px; }
  .mcard small { font-size: 10px; }
  .flybtn { min-width: 130px; padding: 0 16px; }
  .flybtn span { font-size: 28px; }
  .flybtn svg { width: 22px; height: 22px; }
  .nameplate { display: none; } /* no room under the glider on a sideways phone */
  .nameplate b { font-size: 15px; }
  .nameplate small { font-size: 10px; }
}

/* sideways phone in flight: smaller controls in two corners, speed readout moved to the bottom middle, no minimap */
@media (max-height: 520px) {
  body[data-input="touch"] .hud-bl { left: 50%; transform: translateX(-50%); gap: 12px; flex-direction: row; align-items: flex-end; bottom: max(10px, env(safe-area-inset-bottom, 0px)); top: auto; }
  body[data-input="touch"] #minimap, body[data-input="touch"] .touch-hint { display: none; }
  .tstick { width: 104px; height: 104px; bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
  .tstick i { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  #t-boost { width: 70px; height: 70px; bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
  #t-brake { width: 50px; height: 50px; right: calc(max(20px, env(safe-area-inset-right, 0px)) + 80px); bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
  #t-reset, #t-drop { width: 46px; height: 46px; bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 84px); right: calc(max(20px, env(safe-area-inset-right, 0px)) + 12px); }
  #t-cam { width: 46px; height: 46px; bottom: calc(max(14px, env(safe-area-inset-bottom, 0px)) + 140px); right: calc(max(20px, env(safe-area-inset-right, 0px)) + 12px); }
  #touch .tb { font-size: 11px; }
}
