:root {
  --bg: #04050a;
  --ink: #e9f1ff;
  --dim: #8a97ad;
  --faint: #5a6579;
  --cyan: #5ef1ff;
  --red: #ff4d5e;
  --gold: #ffb02e;
  --green: #5fe3a1;
  --glass: rgba(9, 13, 24, 0.58);
  --glass-strong: rgba(8, 11, 20, 0.86);
  --line: rgba(160, 200, 255, 0.12);
  --line-strong: rgba(160, 220, 255, 0.28);
  --mono: 'Share Tech Mono', ui-monospace, Consolas, monospace;
  --ui: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --display: 'Orbitron', 'Rajdhani', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--ui); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; }
input { font-family: inherit; user-select: text; -webkit-user-select: text; }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---------- boot ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 20; }
#boot { background: radial-gradient(ellipse at 50% 60%, #0d1430 0%, #04050a 65%); gap: 22px; transition: opacity 0.8s; }
#boot.fade { opacity: 0; pointer-events: none; }
.boot-logo { font-family: var(--display); font-weight: 900; font-size: clamp(32px, 7vw, 64px); letter-spacing: 0.35em; padding-left: 0.35em; background: linear-gradient(90deg, #ff4d5e, #ffb02e 45%, #fff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boot-bar { width: min(320px, 70vw); height: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; border-radius: 2px; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); transition: width 0.3s; }
.boot-msg { font-family: var(--mono); color: var(--dim); font-size: 13px; letter-spacing: 0.15em; text-transform: uppercase; }

/* ---------- title ---------- */
#title { justify-content: center; align-items: flex-start; padding: 0 0 0 clamp(16px, 7vw, 120px); pointer-events: none; }
#title .title-wrap { pointer-events: auto; width: min(440px, calc(100vw - 32px)); }
.logo { font-family: var(--display); font-weight: 900; font-size: clamp(46px, 9vw, 96px); letter-spacing: 0.08em; margin: 0; line-height: 0.95; color: #fff; text-shadow: 0 0 40px rgba(255, 77, 94, 0.35), 0 0 80px rgba(255, 120, 60, 0.15); }
.logo span { background: linear-gradient(180deg, #ff6a5e, #ff2a3d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { font-size: clamp(16px, 2.2vw, 20px); color: #c9d4e6; line-height: 1.35; margin: 14px 0 26px; font-weight: 500; letter-spacing: 0.02em; }
.card { background: var(--glass-strong); border: 1px solid var(--line); border-radius: 16px; padding: 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.card label { display: block; font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; font-weight: 600; }
.card input { width: 100%; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-strong); border-radius: 10px; padding: 14px 16px; font-size: 24px; font-family: var(--display); letter-spacing: 0.08em; color: #fff; outline: none; text-transform: uppercase; transition: border-color 0.2s, box-shadow 0.2s; }
.card input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(94, 241, 255, 0.12); }
.card input::placeholder { color: #3c475a; }
.paints { display: flex; gap: 10px; margin: 16px 0 6px; }
.paint-dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; outline: 1px solid rgba(255, 255, 255, 0.15); cursor: pointer; transition: transform 0.15s, border-color 0.15s; position: relative; }
.paint-dot::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--acc); opacity: 0.9; box-shadow: 0 0 10px var(--acc); }
.paint-dot.sel { border-color: #fff; transform: scale(1.1); }
.err { color: var(--red); min-height: 20px; font-size: 15px; margin: 6px 0; font-weight: 600; }
.fine { color: var(--faint); font-size: 13px; margin: 10px 0 0; }
.btn { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 16px; font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; transition: background 0.15s, transform 0.1s, border-color 0.15s; }
.btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #ff5a4e, #e0263a); border-color: rgba(255, 140, 120, 0.6); color: #fff; box-shadow: 0 6px 30px rgba(255, 60, 70, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn.primary:hover { background: linear-gradient(180deg, #ff6d5e, #f0303f); }
.btn.big { width: 100%; padding: 16px; font-size: 20px; font-family: var(--display); letter-spacing: 0.3em; margin-top: 8px; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.cyan { background: rgba(94, 241, 255, 0.12); border-color: rgba(94, 241, 255, 0.45); color: var(--cyan); }
.btn.gold { background: rgba(255, 176, 46, 0.12); border-color: rgba(255, 176, 46, 0.5); color: var(--gold); }
.link { background: none; border: none; color: var(--dim); font-size: 14px; margin-top: 12px; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }
.recover { display: flex; gap: 8px; margin-top: 10px; }
.recover input { font-size: 15px; padding: 10px; letter-spacing: 0.1em; font-family: var(--mono); }
.wb-hello { color: var(--dim); text-transform: uppercase; letter-spacing: 0.2em; font-size: 13px; font-weight: 600; }
.wb-name { font-family: var(--display); font-size: 30px; font-weight: 700; margin: 4px 0 10px; letter-spacing: 0.05em; }
.wb-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 15px; color: #c9d4e6; margin-bottom: 10px; }
.wb-stats b { display: block; font-family: var(--mono); font-size: 18px; color: #fff; font-weight: 400; }
.wb-offline { background: rgba(94, 241, 255, 0.08); border: 1px solid rgba(94, 241, 255, 0.25); color: #bff6ff; border-radius: 10px; padding: 10px 12px; font-size: 15px; margin: 8px 0; }
.wait { color: var(--dim); font-family: var(--mono); letter-spacing: 0.08em; }
.title-foot { margin-top: 14px; color: var(--faint); font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; display: flex; gap: 14px; }
.controls-hint { position: fixed; bottom: calc(18px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; gap: 22px; color: var(--faint); font-size: 13px; letter-spacing: 0.06em; pointer-events: none; white-space: nowrap; }
.controls-hint b { color: var(--dim); }

#countdown { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 900; font-size: clamp(80px, 18vw, 200px); color: #fff; z-index: 25; pointer-events: none; text-shadow: 0 0 60px rgba(255, 90, 60, 0.7); }
#countdown.pop { animation: pop 0.9s ease-out; }
@keyframes pop { 0% { transform: scale(1.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: scale(0.9); opacity: 0; } }

/* ---------- world labels ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.wlabel { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; white-space: nowrap; transition: opacity 0.2s; will-change: transform; }
.wlabel .wl-name { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.2em; color: var(--lc, #dfe9ff); text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 2px #000; }
.wlabel .wl-sub { font-size: 12px; color: #aeb9cc; letter-spacing: 0.06em; text-shadow: 0 0 6px #000; }
.wlabel.world .wl-name { font-size: 15px; }
.wlabel.world::after { content: ''; width: 1px; height: 18px; background: linear-gradient(var(--lc, #9fb5d6), transparent); margin-top: 3px; opacity: 0.6; }
.wlabel.ghost .wl-name { font-family: var(--ui); font-size: 14px; letter-spacing: 0.08em; color: #bff6ff; }
.wlabel.ghost .wl-sub { font-size: 10px; color: var(--gold); letter-spacing: 0.2em; }
.wlabel.danger .wl-name { animation: blink 1s infinite; }
.wlabel.beacon .wl-name { font-size: 12px; }
@keyframes blink { 50% { opacity: 0.45; } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#hud .hud-tc, #hud .hud-bc, #hud #banner, #hud #toasts { pointer-events: none; }
.hud-tl { position: absolute; top: calc(16px + var(--safe-t)); left: 16px; padding: 12px 16px; min-width: 210px; }
.pilot-name { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.08em; }
.pilot-rank { display: flex; justify-content: space-between; color: var(--dim); font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.pilot-rank .lvl { color: var(--cyan); font-family: var(--mono); }
.xpbar { height: 3px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; margin: 7px 0 8px; overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), #a6fff3); box-shadow: 0 0 8px var(--cyan); transition: width 0.4s; }
.pilot-meta { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 15px; }
.pilot-meta .dim { color: var(--dim); font-family: var(--ui); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.sd-ico { width: 10px; height: 10px; background: #9fe8ff; transform: rotate(45deg); box-shadow: 0 0 8px #9fe8ff; border-radius: 2px; }

.hud-tc { position: absolute; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); text-align: center; width: min(560px, 60vw); }
.dist-label { font-size: 12px; letter-spacing: 0.32em; color: var(--dim); font-weight: 700; text-transform: uppercase; }
.dist { font-family: var(--mono); font-size: clamp(30px, 4.6vw, 54px); line-height: 1.05; text-shadow: 0 0 24px rgba(94, 241, 255, 0.25); white-space: nowrap; }
.dist .unit { font-family: var(--ui); font-size: 0.42em; color: #c6d3ea; margin-left: 10px; font-weight: 600; letter-spacing: 0.08em; }
.dist-sub { color: var(--dim); font-size: 14px; letter-spacing: 0.05em; margin-top: 2px; }
.next { margin: 8px auto 0; width: min(360px, 50vw); }
.next-txt { font-size: 13px; color: #b7c4da; letter-spacing: 0.08em; margin-bottom: 4px; }
.nextbar { height: 2px; background: rgba(255, 255, 255, 0.08); border-radius: 2px; overflow: hidden; }
.nextbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); }

.hud-tr { position: absolute; top: calc(16px + var(--safe-t)); right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.rank-card { padding: 10px 16px; text-align: right; min-width: 150px; }
.rk-label { font-size: 12px; letter-spacing: 0.25em; color: var(--dim); text-transform: uppercase; font-weight: 700; }
.rk { font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--gold); text-shadow: 0 0 18px rgba(255, 176, 46, 0.35); }
.rk-sub { font-size: 13px; color: var(--dim); }
.hud-nav { display: flex; gap: 6px; }
.hud-nav button { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; width: 52px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color 0.15s, background 0.15s; position: relative; }
.hud-nav button:hover { border-color: var(--line-strong); background: rgba(20, 30, 50, 0.7); }
.hud-nav svg { width: 20px; height: 20px; fill: #cfe0f7; }
.hud-nav span { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.hud-nav button.badge::after { content: ''; position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }

.hud-bl { position: absolute; left: 16px; bottom: calc(16px + var(--safe-b)); padding: 10px 16px 14px; width: 230px; }
.gauge { width: 100%; height: 70px; display: block; }
.gauge path { fill: none; stroke-width: 7; stroke-linecap: round; }
.g-bg { stroke: rgba(255, 255, 255, 0.07); }
.g-fg { stroke: url(#none); stroke: var(--cyan); filter: drop-shadow(0 0 6px rgba(94, 241, 255, 0.7)); stroke-dasharray: 157; stroke-dashoffset: 157; transition: stroke 0.3s; }
.g-fg.hot { stroke: var(--gold); filter: drop-shadow(0 0 8px rgba(255, 176, 46, 0.8)); }
.g-fg.boost { stroke: var(--red); filter: drop-shadow(0 0 10px rgba(255, 77, 94, 0.9)); }
.spd { font-family: var(--mono); font-size: 22px; text-align: center; margin-top: -30px; white-space: nowrap; }
.spd-c { font-family: var(--mono); font-size: 13px; color: var(--dim); text-align: center; }
.mom { text-align: center; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); font-weight: 700; margin: 6px 0 8px; }
.mom b { color: var(--cyan); font-family: var(--mono); font-size: 15px; letter-spacing: 0; }
.pips { display: flex; flex-direction: column; gap: 4px; }
.pip-row { display: flex; align-items: center; gap: 6px; }
.pip-label { width: 52px; font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.pip { display: inline-block; width: 18px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin-right: 3px; }
.pip.on.cell { background: #ff9a3d; box-shadow: 0 0 6px #ff9a3d; }
.pip.on.sh { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.status-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; min-height: 0; }
.tag { font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; font-weight: 700; padding: 2px 7px; border-radius: 6px; border: 1px solid; }
.tag.boost { color: #ffb27a; border-color: rgba(255, 140, 80, 0.5); background: rgba(255, 120, 60, 0.12); }
.tag.assist { color: #d6a8ff; border-color: rgba(180, 120, 255, 0.5); background: rgba(160, 90, 255, 0.12); }
.tag.stun { color: #ff8a95; border-color: rgba(255, 77, 94, 0.5); background: rgba(255, 77, 94, 0.12); }
.tag.auto { color: #bff6ff; border-color: rgba(94, 241, 255, 0.4); background: rgba(94, 241, 255, 0.1); }

.hud-br { position: absolute; right: 16px; bottom: calc(16px + var(--safe-b)); width: 290px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.rivals { padding: 10px 14px; }
.rivals h4 { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.25em; color: var(--dim); text-transform: uppercase; }
.rival { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 3px 0; gap: 8px; }
.rival .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rival .gap { font-family: var(--mono); font-size: 13px; color: var(--dim); white-space: nowrap; }
.rival.ahead .gap { color: #ffb27a; }
.rival.behind .gap { color: #8fe3b8; }
.rival.me { color: var(--cyan); }
.bot-tag { font-size: 9px; letter-spacing: 0.15em; color: var(--gold); border: 1px solid rgba(255, 176, 46, 0.5); border-radius: 4px; padding: 0 3px; margin-left: 4px; vertical-align: 1px; font-weight: 700; }
.feed { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow: hidden; mask-image: linear-gradient(transparent, #000 30%); -webkit-mask-image: linear-gradient(transparent, #000 30%); }
.feed-item { font-size: 13px; color: #c3cfe2; text-shadow: 0 1px 4px #000; animation: feedIn 0.4s ease-out; }
.feed-item b { color: #fff; font-weight: 700; }
.feed-item.discovery b, .feed-item.loot b { color: var(--gold); }
@keyframes feedIn { from { opacity: 0; transform: translateX(10px); } }

.hud-bc { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); width: min(400px, calc(100vw - 560px)); min-width: 280px; }
.quest-card { padding: 12px 16px; border-left: 3px solid var(--qc, var(--cyan)); }
.quest-card .q-giver { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--qc, var(--cyan)); font-weight: 700; }
.quest-card .q-title { font-family: var(--display); font-size: 15px; font-weight: 700; margin: 3px 0; letter-spacing: 0.06em; }
.quest-card .q-desc { font-size: 14px; color: #c3cfe2; }
.quest-card .q-line { font-size: 13px; color: var(--dim); font-style: italic; margin-top: 4px; }
.q-bar { height: 3px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.q-bar i { display: block; height: 100%; width: 0; background: var(--qc, var(--cyan)); box-shadow: 0 0 8px var(--qc, var(--cyan)); transition: width 0.2s; }

.bh-status { margin-top: 8px; font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase; font-weight: 700; color: #ffab7a; text-shadow: 0 0 10px rgba(255, 100, 40, 0.6); white-space: nowrap; }
.bh-status.quiet { color: var(--faint); text-shadow: none; }

#banner { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.banner { animation: bannerIn 4.2s ease-out forwards; }
.banner .b-kind { font-size: 13px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.banner .b-title { font-family: var(--display); font-weight: 900; font-size: clamp(26px, 5vw, 52px); letter-spacing: 0.12em; text-shadow: 0 0 30px rgba(255, 180, 80, 0.4), 0 2px 10px #000; white-space: nowrap; }
.banner .b-sub { font-size: 17px; color: #d2dcee; margin-top: 4px; text-shadow: 0 1px 6px #000; }
.banner.good .b-kind { color: var(--cyan); }
.banner.good .b-title { text-shadow: 0 0 30px rgba(94, 241, 255, 0.5), 0 2px 10px #000; }
.banner.danger .b-kind { color: var(--red); }
@keyframes bannerIn { 0% { opacity: 0; transform: scale(1.12); letter-spacing: 0.3em; } 10% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

#toasts { position: absolute; top: calc(176px + var(--safe-t)); right: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; width: 320px; }
.toast { background: var(--glass-strong); border: 1px solid var(--line); border-left: 3px solid var(--tc, var(--cyan)); border-radius: 10px; padding: 9px 14px; font-size: 14px; max-width: 320px; animation: toastIn 0.3s ease-out; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); }
.toast .t-title { font-weight: 700; letter-spacing: 0.04em; }
.toast .t-sub { color: var(--dim); font-size: 13px; }
.toast.out { opacity: 0; transform: translateX(20px); transition: all 0.4s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

.touch-btn { position: absolute; right: 22px; bottom: calc(190px + var(--safe-b)); width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(255, 120, 60, 0.45), rgba(120, 30, 20, 0.5)); border: 2px solid rgba(255, 150, 100, 0.6); font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.1em; display: none; box-shadow: 0 0 30px rgba(255, 90, 50, 0.35); }
.touch-btn:active { transform: scale(0.95); }

/* ---------- steering ---------- */
#reticle { position: fixed; left: 0; top: 0; z-index: 9; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
#reticle.on { opacity: 1; }
#reticle i { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border: 1.5px solid rgba(190, 240, 255, 0.85); border-radius: 50%; box-shadow: 0 0 8px rgba(94, 241, 255, 0.5); }
#reticle i::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: #bff6ff; border-radius: 50%; }
#joystick { position: fixed; left: 0; top: 0; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 1.5px solid rgba(160, 220, 255, 0.35); background: radial-gradient(circle, rgba(94, 241, 255, 0.08), transparent 70%); z-index: 9; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
#joystick.on { opacity: 1; }
#joystick i { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; border-radius: 50%; background: rgba(190, 240, 255, 0.35); border: 1.5px solid rgba(190, 240, 255, 0.7); transform: translate(-50%, -50%); }
#h-heading { position: absolute; left: 0; top: 0; pointer-events: none; transition: opacity 0.3s; }
#h-heading .hd-mark { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border: 2px solid #ffb02e; transform: rotate(45deg); box-shadow: 0 0 12px rgba(255, 176, 46, 0.7); }
#h-heading .hd-label { position: absolute; left: 0; top: 14px; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: #ffcf7a; text-shadow: 0 0 6px #000; }
#h-heading.centred { opacity: 0.35; }
#h-heading.edge .hd-mark { border: none; width: 0; height: 0; left: -10px; top: -8px; box-shadow: none; transform: rotate(var(--rot, 0deg)); border-left: 18px solid #ffb02e; border-top: 8px solid transparent; border-bottom: 8px solid transparent; filter: drop-shadow(0 0 6px rgba(255, 176, 46, 0.8)); }
#h-heading.edge .hd-label { top: 12px; }
.course { margin-top: 8px; font-size: 12px; color: #8fe3b8; letter-spacing: 0.04em; text-align: center; }
.course.warn { color: #ffcf7a; }
.realign { position: absolute; left: 50%; bottom: calc(140px + var(--safe-b)); transform: translateX(-50%); background: rgba(255, 176, 46, 0.14); border: 1px solid rgba(255, 176, 46, 0.6); color: #ffcf7a; border-radius: 22px; padding: 9px 18px; font-size: 14px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; display: none; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.realign.show { display: block; }
.realign kbd { font-family: var(--mono); font-size: 12px; border: 1px solid rgba(255, 176, 46, 0.5); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
#zone-note { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); font-family: var(--display); font-size: 15px; letter-spacing: 0.3em; text-transform: uppercase; color: rgba(225, 235, 255, 0.85); text-shadow: 0 0 12px rgba(0, 0, 0, 0.9); pointer-events: none; opacity: 0; white-space: nowrap; }
#zone-note.show { animation: zoneIn 3.2s ease-out forwards; }
@keyframes zoneIn { 0% { opacity: 0; letter-spacing: 0.6em; } 15% { opacity: 1; letter-spacing: 0.3em; } 75% { opacity: 1; } 100% { opacity: 0; } }
.wlabel.zone .wl-name { font-family: var(--ui); font-size: 12px; letter-spacing: 0.22em; color: rgba(200, 215, 240, 0.75); }
.wlabel.zone.near .wl-name { opacity: 0; }
.fs-hud { position: absolute; display: none; }
.phone-card { position: fixed; right: 24px; bottom: 24px; display: flex; gap: 14px; align-items: center; padding: 14px 16px; max-width: 360px; z-index: 21; }
.phone-card .qr { width: 104px; height: 104px; flex: none; }
.phone-card .qr svg { width: 100%; height: 100%; }
.phone-txt { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--dim); }
.phone-txt b { color: #fff; font-size: 15px; }
.phone-txt code { font-family: var(--mono); color: var(--cyan); font-size: 13px; user-select: all; }
.phone-txt small { color: var(--faint); }
.fs-btn { margin: 0 0 0 auto; font-size: 12px; }

/* ---------- panels ---------- */
#panel { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(2, 3, 8, 0.45); padding: 16px; }
.panel-inner { width: min(980px, 100%); height: min(720px, 100%); display: flex; flex-direction: column; overflow: hidden; background: rgba(8, 11, 20, 0.88); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 0 16px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: none; padding: 12px 14px; font-size: 14px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: #fff; border-bottom-color: var(--red); }
.close { background: none; border: none; font-size: 30px; color: var(--dim); width: 44px; height: 44px; line-height: 1; }
.close:hover { color: #fff; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; user-select: text; }
.panel-foot { padding: 8px 16px; font-size: 12px; color: var(--faint); border-top: 1px solid var(--line); letter-spacing: 0.05em; }
.panel-body h3 { font-family: var(--display); font-size: 14px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin: 0 0 12px; font-weight: 700; }
.sub-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.sub-tabs button { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.sub-tabs button.on { background: rgba(255, 77, 94, 0.15); border-color: rgba(255, 77, 94, 0.5); color: #fff; }

/* hangar */
.hangar { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.ship-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stat { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat .k { font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.stat .v { font-family: var(--mono); font-size: 16px; }
.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, 0.025); cursor: pointer; border-left: 3px solid var(--rc, #555); transition: background 0.15s; }
.slot:hover, .slot.sel { background: rgba(255, 255, 255, 0.06); }
.slot .s-slot { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.slot .s-name { font-weight: 700; font-size: 15px; color: var(--rc, #fff); }
.slot .s-stat { font-family: var(--mono); font-size: 13px; color: #c3cfe2; }
.inv-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.inv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: rgba(255, 255, 255, 0.025); cursor: pointer; border-top: 2px solid var(--rc, #555); position: relative; transition: background 0.15s, transform 0.1s; }
.item:hover { background: rgba(255, 255, 255, 0.06); }
.item.sel { outline: 1px solid var(--rc); background: rgba(255, 255, 255, 0.07); }
.item.eq::after { content: 'EQUIPPED'; position: absolute; top: 6px; right: 8px; font-size: 9px; letter-spacing: 0.15em; color: var(--cyan); font-weight: 700; }
.item .i-slot { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.item .i-name { font-weight: 700; font-size: 14px; color: var(--rc); line-height: 1.15; margin: 2px 0; }
.item .i-stat { font-family: var(--mono); font-size: 12px; color: #c3cfe2; }
.item .i-up { color: var(--green); }
.item .i-down { color: var(--red); }
.detail { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: rgba(255, 255, 255, 0.03); }
.detail .d-name { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--rc); letter-spacing: 0.04em; }
.detail .d-meta { font-size: 13px; color: var(--dim); margin: 2px 0 8px; }
.detail table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 10px; }
.detail td { padding: 3px 0; }
.detail td:last-child { text-align: right; font-family: var(--mono); }
.detail .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* cosmetics */
.cos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.cos { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: rgba(255, 255, 255, 0.025); cursor: pointer; text-align: center; transition: background 0.15s; }
.cos:hover { background: rgba(255, 255, 255, 0.06); }
.cos.sel { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.cos.locked { opacity: 0.45; cursor: default; }
.cos .swatch { width: 54px; height: 54px; border-radius: 50%; margin: 2px auto 8px; position: relative; box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.35), inset 0 6px 10px rgba(255, 255, 255, 0.25); }
.cos .swatch::after { content: ''; position: absolute; inset: 20px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc); }
.cos .trail { height: 10px; border-radius: 6px; margin: 22px 4px 16px; }
.cos .c-name { font-weight: 700; font-size: 14px; }
.cos .c-lock { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* leaderboard */
.lb { width: 100%; border-collapse: collapse; }
.lb th { text-align: left; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.lb td { padding: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 15px; }
.lb td.num { font-family: var(--mono); text-align: right; }
.lb th.num { text-align: right; }
.lb tr.me td { background: rgba(94, 241, 255, 0.08); color: #fff; }
.lb .pos { font-family: var(--display); font-weight: 700; width: 56px; color: var(--dim); }
.lb tr:nth-child(1) .pos { color: #ffd166; }
.lb tr:nth-child(2) .pos { color: #d8e1ee; }
.lb tr:nth-child(3) .pos { color: #e3a46b; }
.lb .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; box-shadow: 0 0 6px currentColor; }
.lb .ttl { color: var(--gold); font-size: 12px; margin-left: 6px; letter-spacing: 0.06em; }
.lb .online { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-left: 6px; box-shadow: 0 0 6px var(--green); vertical-align: 2px; }
.lb-me { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(94, 241, 255, 0.3); border-radius: 10px; background: rgba(94, 241, 255, 0.06); font-size: 15px; }
.lb-note { color: var(--dim); font-size: 13px; margin-bottom: 10px; }

/* map */
.map-wrap { position: relative; }
#map-canvas { width: 100%; height: 420px; display: block; border-radius: 12px; background: #03050c; border: 1px solid var(--line); touch-action: pan-y; }
.map-tip { position: absolute; pointer-events: none; background: var(--glass-strong); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-size: 13px; white-space: nowrap; transform: translate(-50%, -120%); }
.map-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--dim); margin-top: 10px; }
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* achievements */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ach { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(255, 255, 255, 0.025); display: flex; gap: 10px; align-items: flex-start; }
.ach.done { border-color: rgba(94, 241, 255, 0.35); background: rgba(94, 241, 255, 0.05); }
.ach .medal { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 2px solid var(--faint); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 13px; color: var(--faint); }
.ach.done .medal { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 12px rgba(94, 241, 255, 0.4); }
.ach .a-name { font-weight: 700; font-size: 15px; }
.ach .a-desc { font-size: 13px; color: var(--dim); }
.ach .a-rew { font-size: 12px; color: var(--gold); margin-top: 3px; }
.awards { margin-top: 18px; }
.award { font-size: 14px; color: #c3cfe2; padding: 4px 0; }

/* settings */
.set-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); gap: 16px; }
.set-row .s-k { font-weight: 700; font-size: 15px; }
.set-row .s-h { font-size: 13px; color: var(--dim); }
.set-row select, .set-row input[type=range] { accent-color: var(--red); }
.set-row select { background: rgba(255, 255, 255, 0.06); color: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-family: var(--ui); font-size: 14px; }
.set-row select option { background: #0b0f1a; }
.code-box { font-family: var(--mono); font-size: 20px; letter-spacing: 0.12em; padding: 12px 14px; background: rgba(255, 255, 255, 0.05); border: 1px dashed var(--line-strong); border-radius: 10px; text-align: center; user-select: all; margin: 10px 0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; color: #c3cfe2; }
.keys kbd { font-family: var(--mono); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 7px; font-size: 13px; color: #fff; }

/* modal */
#modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(2, 3, 8, 0.6); padding: 16px; }
.modal-inner { width: min(520px, 100%); padding: 24px; text-align: center; background: rgba(8, 11, 20, 0.92); }
.modal-inner h2 { font-family: var(--display); letter-spacing: 0.12em; margin: 0 0 8px; }
.modal-inner p { color: #c3cfe2; font-size: 16px; line-height: 1.45; }
.modal-inner .row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ---------- mobile ---------- */
@media (max-width: 860px), (pointer: coarse) {
  .touch-btn { display: block; }
  .hud-tl { padding: 8px 12px; min-width: 0; max-width: 46vw; top: calc(10px + var(--safe-t)); left: 10px; }
  .pilot-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pilot-rank { font-size: 11px; }
  .pilot-meta { font-size: 12px; }
  .pilot-meta .dim { display: none; }
  .hud-tc { top: calc(92px + var(--safe-t)); width: calc(100vw - 20px); }
  .dist { font-size: 30px; }
  .next { width: 70vw; }
  .hud-tr { top: calc(10px + var(--safe-t)); right: 10px; gap: 6px; }
  .rank-card { padding: 6px 10px; min-width: 0; }
  .rk { font-size: 20px; }
  .rk-label, .rk-sub { font-size: 10px; }
  .hud-nav { position: fixed; right: 10px; top: calc(196px + var(--safe-t)); flex-direction: column; }
  .hud-nav button { width: 44px; height: 44px; }
  .hud-nav span { display: none; }
  .hud-bl { left: 10px; bottom: calc(10px + var(--safe-b)); width: calc(50vw - 15px); max-width: 200px; padding: 6px 10px 10px; }
  .gauge { height: 50px; }
  .spd { font-size: 16px; margin-top: -22px; }
  .pip-label { width: 44px; font-size: 10px; }
  .pip { width: 12px; }
  .hud-br { bottom: calc(10px + var(--safe-b)); right: 10px; width: calc(50vw - 15px); max-width: 260px; }
  .rivals { padding: 6px 10px; }
  .rival { font-size: 12px; }
  .feed { display: none; }
  .hud-bc { bottom: auto; top: calc(196px + var(--safe-t)); left: 10px; transform: none; width: calc(100vw - 74px); min-width: 0; }
  .quest-card { padding: 8px 12px; }
  .quest-card .q-line { display: none; }
  #toasts { top: auto; bottom: calc(190px + var(--safe-b)); right: 100px; left: 10px; width: auto; align-items: flex-start; }
  .toast { max-width: 100%; }
  #banner { top: 50%; width: calc(100vw - 20px); }
  .banner .b-title { white-space: normal; font-size: 26px; }
  .banner .b-sub { font-size: 14px; }
  .bh-status { font-size: 10px; }
  .hangar { grid-template-columns: 1fr; }
  #title { padding: 0 16px; align-items: center; justify-content: flex-end; padding-bottom: calc(40px + var(--safe-b)); }
  .controls-hint { display: none; }
  .tabs button { padding: 10px; font-size: 12px; }
  #map-canvas { height: 320px; }
  .touch-btn { bottom: calc(190px + var(--safe-b)); right: 14px; width: 72px; height: 72px; }
  .realign { bottom: calc(236px + var(--safe-b)); left: 10px; transform: none; font-size: 12px; padding: 8px 12px; }
  .realign kbd { display: none; }
  .phone-card { display: none !important; }
  .fs-hud { display: block; left: 10px; top: calc(96px + var(--safe-t)); width: 36px; height: 36px; border-radius: 10px; background: var(--glass); border: 1px solid var(--line); color: #cfe0f7; font-size: 18px; }
  #zone-note { top: 30%; font-size: 12px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .hud-tc { top: calc(8px + var(--safe-t)); }
  .hud-br { display: none; }
  .hud-bc { top: auto; bottom: 10px; width: 40vw; }
  .touch-btn { bottom: 70px; }
}
