:root {
  color-scheme: dark;
  --bg: #05060d;
  --panel: rgba(12, 16, 32, 0.72);
  --panel-border: rgba(140, 170, 255, 0.16);
  --text: #dfe6ff;
  --muted: #8592b8;
  --accent: #7cf7d4;
  --accent-2: #f78cff;
  --warn: #ffb35a;
  --bad: #ff6b6b;
  --gold: #ffd166;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Exo 2", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--sans);
  -webkit-user-select: none; user-select: none;
}
canvas { display: block; position: fixed; top: 0; left: 0; width: 100%; height: 100%; touch-action: none; }
/* The canvas paints edge to edge (under the notch and home bar); the HUD lives
   inside the safe area so nothing interactive sits under them. */
#hud {
  position: fixed; pointer-events: none;
  top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px); left: env(safe-area-inset-left, 0px);
}
.hidden { display: none !important; }
button { font-family: var(--sans); }

.k { color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; }
.ok { color: var(--accent) !important; }
.warn { color: var(--warn) !important; }
.bad { color: var(--bad) !important; }
.eyebrow { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------------------------------------------------------------- HUD */
.panel {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
#mission { top: 12px; left: 12px; max-width: 320px; }
#mission .title { font-size: 20px; font-weight: 800; margin: 2px 0 6px; }
#hud-goals { list-style: none; margin: 0; padding: 0; font-size: 13px; }
#hud-goals li { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; color: var(--muted); }
#hud-goals li.active { color: var(--text); }
#hud-goals li.done { color: var(--accent); text-decoration: line-through; opacity: 0.7; }
#hud-goals .chk { width: 12px; font-family: var(--mono); }
#hud-goals .sub { width: 100%; padding-left: 18px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.minibar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; margin: 3px 0; overflow: hidden; }
.minibar div { height: 100%; background: var(--accent); }

#clock { top: 12px; right: 12px; font-family: var(--mono); font-size: 13px; text-align: right; line-height: 1.6; }
#topbtns {
  position: absolute; top: 108px; right: 12px; display: flex; gap: 6px; pointer-events: auto;
}
#btn-gyro { display: none; }
#btn-gyro.on { background: rgba(124, 247, 212, 0.3); border-color: rgba(124, 247, 212, 0.6); }
.icon-btn {
  background: var(--panel); border: 1px solid var(--panel-border); color: var(--text);
  border-radius: 8px; width: 36px; height: 32px; cursor: pointer; font-size: 12px;
}

#gauges { bottom: 12px; left: 12px; width: 220px; }
.gauge { margin-bottom: 8px; }
.glabel { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; margin-bottom: 3px; }
.glabel span:first-child { color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar div { height: 100%; background: linear-gradient(90deg, #ff9f43, var(--gold)); transition: width 0.1s linear; }
.bar.payload div { background: linear-gradient(90deg, #c9a227, #ffe08a); }
.gauge.spent { opacity: 0.35; }
.gauge.active-stage .glabel span:first-child { color: var(--text); }
.bar.rcs div { background: linear-gradient(90deg, #6aa8ff, #a8d4ff); }
#gauge-rcs.low .bar.rcs div { background: linear-gradient(90deg, #ff6b6b, #ffb35a); }
#gauge-rcs.low .glabel { color: #ff9a7a; animation: rcs-low 1s ease-in-out infinite alternate; }
@keyframes rcs-low { from { opacity: 1; } to { opacity: 0.55; } }
.bar.thr div { background: linear-gradient(90deg, #555f80, #9aa6cc); }
.row { font-family: var(--mono); font-size: 12px; }

#orbit { bottom: 12px; right: 12px; min-width: 200px; font-family: var(--mono); font-size: 12px; }
#orbit .grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
#orbit .grid span:nth-child(even) { text-align: right; }
#hud-target { color: var(--accent-2); font-size: 12px; }
#hud-target b { color: #fff; }

#toast {
  position: absolute; top: 18%; left: 50%; transform: translate(-50%, -8px);
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.04em;
  background: rgba(10, 14, 30, 0.8); border: 1px solid var(--panel-border);
  padding: 8px 16px; border-radius: 999px; opacity: 0; transition: opacity 0.3s, transform 0.3s;
  pointer-events: none; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Coach: big contextual control prompts */
#coach {
  position: absolute; left: 50%; bottom: 120px; transform: translate(-50%, 12px);
  max-width: calc(100vw - 32px); width: max-content;
  padding: 14px 22px; border-radius: 14px;
  background: rgba(10, 14, 30, 0.88); border: 1.5px solid rgba(124, 247, 212, 0.55);
  box-shadow: 0 0 0 0 rgba(124, 247, 212, 0.4), 0 12px 40px rgba(0,0,0,0.45);
  font-size: clamp(16px, 2.4vw, 22px); font-weight: 600; text-align: center; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
#coach.show { opacity: 1; transform: translate(-50%, 0); animation: coach-pulse 2s ease-in-out infinite; }
@keyframes coach-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 247, 212, 0.35), 0 12px 40px rgba(0,0,0,0.45); }
  50% { box-shadow: 0 0 0 8px rgba(124, 247, 212, 0), 0 12px 40px rgba(0,0,0,0.45); }
}
@media (prefers-reduced-motion: reduce) { #coach.show { animation: none; } }
kbd.big {
  display: inline-block; min-width: 1.8em; padding: 2px 10px; margin: 0 2px;
  font-size: 0.9em; font-weight: 600; border-radius: 7px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.3);
  border-bottom-width: 3px; color: #fff;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.chip kbd { color: var(--text); }

/* Touch controls: rotate on the left thumb, burn on the right thumb */
#touch { display: none; }
body.touch #touch {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 12px 12px;
  pointer-events: none;
}
#touch .tgroup { display: flex; gap: 8px; pointer-events: auto; }
#touch .tgroup.small { flex-wrap: wrap; justify-content: center; max-width: 120px; }
#touch button {
  width: 64px; height: 64px; border-radius: 16px; border: 1px solid var(--panel-border);
  background: var(--panel); color: var(--text); font-size: 26px; touch-action: none;
  -webkit-tap-highlight-color: transparent; pointer-events: auto;
}
#touch .tgroup.small button { width: 52px; height: 40px; font-size: 16px; border-radius: 10px; }
#touch button.burn {
  width: 96px; height: 96px; border-radius: 50%;
  background: rgba(255, 140, 50, 0.28); border-color: rgba(255, 170, 90, 0.6);
  font-weight: 800; font-size: 16px; letter-spacing: 0.1em;
}
#touch button.on { background: rgba(124, 247, 212, 0.35); }

/* ------------------------------------------------------------ screens */
.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  align-items: center; justify-content: center; padding-block: 24px; overflow-y: auto;
}
#pause, #result, #briefing, #help { background: rgba(3, 4, 10, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.card {
  background: rgba(12, 16, 32, 0.92); border: 1px solid var(--panel-border);
  border-radius: 16px; padding: 26px 28px; width: min(520px, 100%);
  box-shadow: 0 20px 80px rgba(0,0,0,0.5);
}
.card h1 { margin: 4px 0 6px; font-size: 32px; font-weight: 800; letter-spacing: 0.01em; }
.card p { color: #c4cdee; line-height: 1.55; font-size: 15px; }
.card .small { font-size: 13px; color: var(--muted); }
.teaches { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.objective { margin: 14px 0; padding: 10px 12px; border-radius: 8px; background: rgba(247, 140, 255, 0.08); border: 1px solid rgba(247,140,255,0.25); }
.stats { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; margin: 8px 0 4px; }
.buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.buttons.vertical { flex-direction: column; align-items: stretch; }
.buttons button, .menu-foot button {
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.05); color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer;
}
.buttons button:hover, .menu-foot button:hover { background: rgba(255,255,255,0.1); }
button.primary { background: var(--accent) !important; color: #04211a !important; border-color: transparent !important; }
button.primary:hover { filter: brightness(1.1); }
button.ghost { background: transparent !important; }

#res-title.ok { color: var(--accent); }
#res-title.bad { color: var(--bad); }
#res-stars { font-size: 38px; color: var(--gold); letter-spacing: 0.1em; }
.dim { color: rgba(255,255,255,0.12); }

.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys td { padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.keys td:first-child { white-space: nowrap; padding-right: 14px; }
kbd {
  font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 5px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
}
body.touch .desktop-only { display: none; }
body:not(.touch) .touch-only { display: none; }
kbd.tbtn { display: inline-block; min-width: 30px; text-align: center; padding: 3px 8px; border-radius: 8px; font-size: 13px; }
kbd.tbtn.burn { border-radius: 999px; background: rgba(255, 140, 50, 0.28); border-color: rgba(255, 170, 90, 0.6); font-weight: 700; letter-spacing: 0.08em; }
.pro { color: #8df57a; } .retro { color: #f5d47a; } .tgt { color: var(--accent-2); }

/* -------------------------------------------------------------- menu */
#menu { justify-content: flex-start; padding-top: 7vh; }
.logo {
  font-weight: 800; font-size: clamp(44px, 10vw, 96px); letter-spacing: 0.12em;
  background: linear-gradient(180deg, #ffffff 0%, #9fc0ff 60%, #6a7dff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px rgba(120, 150, 255, 0.25);
}
.tagline { font-family: var(--mono); color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; margin-bottom: 5vh; text-align: center; }
.level-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; width: min(1000px, 100%);
}
.level-card {
  text-align: left; padding: 14px 16px; border-radius: 12px; cursor: pointer;
  background: rgba(12, 16, 32, 0.78); border: 1px solid var(--panel-border); color: var(--text);
  transition: transform 0.15s, border-color 0.15s;
}
.level-card:hover { transform: translateY(-2px); border-color: rgba(124, 247, 212, 0.5); }
.level-card.next { border-color: rgba(124, 247, 212, 0.55); }
.nexttag { margin-left: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); vertical-align: middle; }
.level-card .num { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.level-card .lname { font-size: 18px; font-weight: 800; margin: 2px 0; }
.level-card .lteach { font-size: 12px; color: var(--muted); min-height: 30px; }
.level-card .lstars { color: var(--gold); margin-top: 6px; font-size: 16px; }
.menu-foot { margin-top: 24px; }

@media (max-width: 640px) {
  #mission { max-width: calc(100vw - 172px); padding: 8px 10px; }
  #mission .title { overflow-wrap: anywhere; font-size: 16px; }
  #mission .eyebrow { display: none; }
  #clock { font-size: 11px; padding: 6px 8px; }
  .gauge { margin-bottom: 4px; }
  #gauges { width: 160px; }
  #orbit { min-width: 150px; }
  .card { padding: 20px 18px; }
  .card h1 { font-size: 26px; }
}

/* -------------------------------------------------------- phone gate */
#gate { background: var(--bg); z-index: 50; }
.gate-card { text-align: center; width: min(420px, 100%); }
.gate-card .buttons { justify-content: center; }
.gate-icon { font-size: 54px; color: var(--accent); line-height: 1; }
#gate[data-reason="rotate"] .gate-icon { animation: gate-turn 2.4s ease-in-out infinite; }
@keyframes gate-turn { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
@media (prefers-reduced-motion: reduce) { .gate-icon { animation: none !important; } }

/* ------------------------------------------- landscape phones (short) */
@media (max-height: 500px) {
  .panel { padding: 6px 9px; border-radius: 8px; }
  #mission { top: 8px; left: 8px; max-width: 34vw; }
  #mission .eyebrow { display: none; }
  #mission .title { font-size: 15px; margin: 0 0 2px; }
  #hud-goals { font-size: 12px; }
  #clock { top: 8px; right: 8px; font-size: 11px; line-height: 1.4; }
  #coach { font-size: 15px; padding: 8px 14px; }
  .screen { padding-block: 10px; }
  .card { padding: 14px 18px; }
  .card h1 { font-size: 22px; }
  .card p { font-size: 13px; margin: 6px 0; }
  .keys { font-size: 12px; }
  .keys td { padding: 2px 0; }
  kbd.tbtn { min-width: 24px; padding: 1px 6px; font-size: 11px; }
  #help .card h1 { font-size: 18px; margin: 0 0 4px; }
  #help .card .small { font-size: 11px; }
  .buttons { margin-top: 10px; }
  #menu { padding-top: 10px; }
  .logo { font-size: 40px; }
  .tagline { margin-bottom: 12px; }
  .level-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .level-card { padding: 8px 10px; }
  .level-card .lname { font-size: 15px; }
  .level-card .lteach { min-height: 0; }
}

/* ------------------------------------------------------- touch HUD
   Phones and tablets: no boxes, just legible text over the scene.
   Top: mission (left) · resources (center) · clock + G + pause (right).
   Bottom: rotate (left thumb) · warp/frame/camera (middle) · BURN (right). */
body.touch .panel {
  background: transparent; border: none; border-radius: 0;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  padding: 0; text-shadow: 0 1px 3px rgba(0,0,0,0.95), 0 0 8px rgba(0,0,0,0.6);
}
/* Objective: same height as the resource strip; only the active goal shows. */
body.touch #mission { top: 10px; left: 12px; width: calc(32vw - 28px); max-width: none; }
body.touch #mission .eyebrow { display: none; }
body.touch #mission .title { font-size: 13px; margin: 0; line-height: 1.25; }
body.touch #hud-goals { font-size: 11px; line-height: 1.3; }
body.touch #hud-goals li { display: block; padding: 0; }
body.touch #hud-goals li:not(.active) { display: none; }
body.touch #hud-goals .chk { display: none; }
body.touch #hud-goals li > span:not(.chk) { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.touch #hud-goals .sub { display: flex; align-items: center; gap: 6px; padding: 1px 0 0; font-size: 10px; white-space: nowrap; overflow: hidden; }
body.touch #hud-goals .sub .minibar { width: 54px; flex: none; margin: 0; }

body.touch #gauges {
  top: 10px; bottom: auto; left: 50%; transform: translateX(-50%); width: min(300px, 36vw);
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px;
}
body.touch #gauges .gauge { margin: 0; }
body.touch #gauges .glabel { font-size: 11px; margin-bottom: 2px; }
body.touch #gauges .bar { height: 5px; background: rgba(255,255,255,0.15); }
body.touch #gauges .gauge.throttle { display: none; }
body.touch #gauges .row { grid-column: 1 / -1; text-align: center; font-size: 11px; }
body.touch #gauges:has(#gauge-rcs[style*="none"]) { grid-template-columns: 1fr; }

body.touch #clock { top: 10px; right: 112px; font-size: 11px; line-height: 1.4; }
body.touch #topbtns { top: 8px; right: 8px; }
body.touch #btn-gyro { display: block; }
body.touch #topbtns .icon-btn { width: 44px; height: 38px; font-size: 14px; font-weight: 700; background: rgba(12,16,32,0.55); }

/* Orbit readout: two short rows (ALT SPD / AP PE) and one line of target info. */
body.touch #orbit { top: 64px; bottom: auto; right: 12px; min-width: 0; width: 148px; font-size: 10px; }
body.touch #orbit .eyebrow { font-size: 9px; }
body.touch #orbit .grid { grid-template-columns: auto 1fr auto 1fr; margin: 1px 0; gap: 0 5px; }
body.touch #orbit .grid span:nth-child(4n+3) { padding-left: 12px; }
body.touch #hud-target { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

body.touch #coach { top: auto; bottom: 64px; font-size: 14px; padding: 6px 14px; max-width: 52vw; background: rgba(10, 14, 30, 0.6); }
body.touch.no-rotate #touch [data-key="rotL"], body.touch.no-rotate #touch [data-key="rotR"] { visibility: hidden; }
body.touch kbd.big { padding: 0 7px; }

body.touch #touch { padding: 0 12px 10px; }
body.touch #touch button { width: 62px; height: 62px; background: rgba(12,16,32,0.45); }
body.touch #touch .tgroup.small { flex-wrap: nowrap; max-width: none; }
body.touch #touch .tgroup.small button { width: 44px; height: 38px; }
body.touch #touch button.burn { width: 84px; height: 84px; background: rgba(255, 140, 50, 0.28); }

/* Tall cards on short screens scroll instead of being clipped at the top. */
.screen > .card { margin-block: auto; }
.screen { justify-content: flex-start; }
#menu { justify-content: flex-start; }

.level-card.test .num { color: var(--warn); }

/* Deploy button: only while a payload can be released */
#touch button.deploy { display: none; }
body.touch.can-deploy #touch button.deploy {
  display: block; position: absolute; right: 12px; bottom: 108px; width: 84px; height: 40px;
  border-radius: 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  background: rgba(124, 247, 212, 0.25); border-color: rgba(124, 247, 212, 0.6); pointer-events: auto;
}
kbd.tbtn.deploy { background: rgba(124, 247, 212, 0.25); border-color: rgba(124, 247, 212, 0.6); font-weight: 700; letter-spacing: 0.06em; }
#res-score { font-family: var(--mono); font-size: 28px; font-weight: 600; color: var(--text); margin: 4px 0; }
#res-score .k { font-size: 11px; margin-right: 8px; }
#res-score .pb { font-size: 12px; color: var(--accent); margin-left: 10px; }

/* Menu brand: app icon beside the wordmark */
.brand { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2vw, 22px); }
.logo-mark { width: clamp(52px, 9vw, 96px); height: auto; border-radius: 22%; box-shadow: 0 12px 40px rgba(0,0,0,0.5); }
@media (max-height: 500px) { .logo-mark { width: 44px; } }

.level-grid.w2 .level-card { background: rgba(10, 24, 22, 0.8); border-color: rgba(150, 230, 140, 0.18); }
.level-grid.w2 .level-card:hover, .level-grid.w2 .level-card.next { border-color: rgba(180, 240, 106, 0.6); }
.level-grid.w2 .nexttag { color: #b4f06a; }
.level-grid.w3 .level-card { background: rgba(26, 14, 12, 0.8); border-color: rgba(255, 150, 90, 0.18); }
.level-grid.w3 .level-card:hover, .level-grid.w3 .level-card.next { border-color: rgba(255, 170, 90, 0.6); }
.level-grid.w3 .nexttag { color: #ffaa5a; }

/* World tabs */
#world-tabs { display: flex; flex-shrink: 0; gap: 8px; width: min(1000px, 100%); margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
#world-tabs::-webkit-scrollbar { display: none; }
.wtab {
  flex: 1 1 0; min-width: 150px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px;
  text-align: left; padding: 10px 14px; border-radius: 12px; cursor: pointer;
  background: rgba(12, 16, 32, 0.6); border: 1px solid var(--panel-border); color: var(--muted);
  font-family: var(--sans); transition: border-color 0.15s, background 0.15s;
}
.wtab .wnum { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.wtab .wname { grid-column: 1; font-size: 17px; font-weight: 800; color: var(--text); }
.wtab .wstars { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-family: var(--mono); font-size: 12px; color: var(--gold); white-space: nowrap; }
.wtab:hover { border-color: rgba(124, 247, 212, 0.4); }
.wtab.active { background: rgba(20, 30, 52, 0.9); border-color: rgba(124, 247, 212, 0.7); box-shadow: 0 0 0 1px rgba(124, 247, 212, 0.25) inset; }
.wtab.w2 .wnum { color: #b4f06a; }
.wtab.w3 .wnum { color: #ffaa5a; }
.wtab.w3.active { background: rgba(34, 18, 12, 0.92); border-color: rgba(255, 170, 90, 0.7); box-shadow: 0 0 0 1px rgba(255, 170, 90, 0.25) inset; }
.wtab.w2.active { background: rgba(14, 34, 28, 0.92); border-color: rgba(180, 240, 106, 0.7); box-shadow: 0 0 0 1px rgba(180, 240, 106, 0.25) inset; }
.wtab.locked .wname { color: var(--muted); }
.wtab.locked .wstars { color: var(--muted); }
.wtab.tests { flex: 0 0 auto; min-width: 0; }
.wtab.tests .wnum { color: var(--warn); }
.wtab.tests .wname { font-size: 13px; font-weight: 600; color: var(--muted); }
#world-info { flex-shrink: 0; width: min(1000px, 100%); margin: 0 0 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
#world-info .wi-board { float: right; margin: -4px 0 0 12px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--panel-border); background: rgba(255,255,255,0.04); color: var(--text); font: 600 12px var(--sans); cursor: pointer; }
#world-info .wi-board:hover { background: rgba(255,255,255,0.1); }
#world-info .lock { display: block; font-family: var(--sans); font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.unlockbar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-bottom: 6px; max-width: 420px; }
.unlockbar > div { height: 100%; background: linear-gradient(90deg, var(--gold), #b4f06a); }
.level-grid.locked .level-card { opacity: 0.4; cursor: not-allowed; transform: none; }
.level-grid.locked .level-card:hover { border-color: var(--panel-border); }
.level-grid.tests .level-card .num { color: var(--warn); }
#res-msg .unlocked { display: block; margin-top: 10px; font-weight: 700; color: #b4f06a; }
@media (max-height: 500px) {
  .wtab { padding: 6px 10px; min-width: 120px; }
  .wtab .wname { font-size: 14px; }
  #world-tabs { margin-bottom: 8px; }
}

/* Online: leaderboard, pilot profile, result rank */
.online-only { display: none; }
body.online .online-only { display: inline-block; }
.menu-foot { display: flex; gap: 10px; justify-content: center; }
.board-card, .profile-card { width: min(560px, 100%); }
#board-pick { width: 100%; margin-top: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(255,255,255,0.06); color: var(--text); font: 600 14px var(--sans); }
#board-pick option, #board-pick optgroup { background: #0b1020; color: #e8eefc; }
.board-tabs { display: flex; gap: 8px; margin: 10px 0 12px; }
.board-tabs button { flex: 1; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(255,255,255,0.04); color: var(--muted); font: 600 14px var(--sans); cursor: pointer; }
.board-tabs button.active { color: var(--text); border-color: rgba(124, 247, 212, 0.6); background: rgba(124, 247, 212, 0.08); }
#board-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow-y: auto; font-family: var(--mono); font-size: 14px; }
#board-list li { display: grid; grid-template-columns: 3em 1fr auto; gap: 10px; padding: 7px 10px; border-radius: 8px; }
#board-list li:nth-child(odd) { background: rgba(255,255,255,0.03); }
#board-list li.me { background: rgba(124, 247, 212, 0.12); color: var(--accent); }
#board-list li .rk { color: var(--muted); }
#board-list li:nth-child(1) .rk { color: var(--gold); }
#board-list li.empty { display: block; color: var(--muted); text-align: center; padding: 18px; }
#board-me { margin-top: 10px; font-family: var(--mono); color: var(--muted); }
#res-online { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 10px; min-height: 1.2em; }
#res-online b { color: var(--accent); font-weight: 600; }
.pf-row { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.pf-row .k { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.pf-inline { display: flex; gap: 8px; align-items: center; }
.pf-inline input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(0,0,0,0.35); color: var(--text); font: 16px var(--sans); -webkit-user-select: text; user-select: text; }
.pf-inline button, .pf-row > button { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--panel-border); background: rgba(255,255,255,0.06); color: var(--text); font: 600 14px var(--sans); cursor: pointer; }
#pf-code { flex: 1; font-family: var(--mono); font-size: 20px; letter-spacing: 0.12em; color: var(--accent); -webkit-user-select: text; user-select: text; }
button.apple { background: #fff !important; color: #000 !important; border-color: #fff !important; font-size: 16px !important; padding: 11px 14px !important; }
#pf-status { min-height: 1.4em; }
#pf-status.warn { color: var(--warn); }
@media (max-height: 500px) {
  .pf-row { margin-top: 10px; }
  #board-list { max-height: 38vh; }
}
button.danger { color: var(--bad) !important; border-color: rgba(255, 107, 107, 0.35) !important; }
a.plain { color: var(--muted); }
