/* ============================================================================
   OVERDRIVE — UI layer. Sits on top of the Sketchbook canvas.
   ========================================================================== */
:root {
  --bg: #0a0e17;
  --panel: rgba(14, 20, 33, 0.86);
  --panel-solid: #0e1421;
  --cyan: #19e3ff;
  --magenta: #ff2e88;
  --gold: #ffce4d;
  --green: #38e08a;
  --text: #eaf2ff;
  --muted: #8ea3c0;
  --stroke: rgba(255, 255, 255, 0.08);
  --glow-cyan: 0 0 18px rgba(25, 227, 255, 0.55);
  --glow-mag: 0 0 18px rgba(255, 46, 136, 0.55);
  --font: 'Solway', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Alfa Slab One', var(--font);
}

* { box-sizing: border-box; }

#ovr-root, #ovr-root * {
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font);
}

/* Hide the engine's stock chrome (welcome popup, dat.gui, github corner) */
.swal2-container, .swal2-backdrop-show { display: none !important; }
.dg.ac, .dg.main, #dat-gui-container { display: none !important; }
.github-corner { display: none !important; }
#loading-screen { display: none !important; }

/* ---- Generic overlay helpers --------------------------------------------- */
.ovr-fill {
  position: fixed; inset: 0; z-index: 50;
}
.ovr-hidden { display: none !important; }

/* ============================================================================
   LANDING
   ========================================================================== */
/* Sketchbook page: cream paper + faint grid + red margin line + ink wireframe */
#landing {
  z-index: 200;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background-color: #f1e9d6;
  background-image:
    radial-gradient(1100px 760px at 50% 120%, rgba(192,57,43,0.05), transparent 62%),
    linear-gradient(rgba(120,130,150,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,130,150,0.10) 1px, transparent 1px);
  background-size: auto, 27px 27px, 27px 27px;
  color: #20202a;
  text-align: center; padding: 24px; overflow: hidden;
}
#landing::before {            /* notebook margin line */
  content: ''; position: absolute; top: 0; bottom: 0; left: 52px; width: 2px;
  background: rgba(192,57,43,0.30); z-index: 2;
}
#ink-bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.paper-glow {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(460px 230px at 50% 30%, rgba(241,233,214,0.78), rgba(241,233,214,0) 72%);
}
.landing-content { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; }

.sketch-note {
  font-family: 'Patrick Hand', cursive; color: rgba(192,57,43,0.85);
  transform: rotate(-3deg); font-size: 15px; margin-bottom: 2px; letter-spacing: 1px; text-shadow: none;
}
#landing .logo {
  font-family: 'Permanent Marker', cursive;
  font-size: clamp(46px, 10vw, 112px);
  line-height: 0.95; letter-spacing: 1px; margin: 0;
  color: #1b1b26; -webkit-text-fill-color: #1b1b26; background: none;
  text-shadow: 2px 2px 0 rgba(192,57,43,0.20); transform: rotate(-1.2deg);
}
#landing .tagline {
  font-family: 'Patrick Hand', cursive;
  color: #494956; font-size: clamp(16px, 2.6vw, 22px);
  margin: 6px 0 2px; text-shadow: none;
}
#landing .ticker-chip {
  font-family: 'Permanent Marker', cursive;
  display: inline-block; margin-top: 14px; padding: 3px 16px;
  border: 2px solid rgba(192,57,43,0.65); border-radius: 4px;
  background: transparent; color: #c0392b; letter-spacing: 1px;
  text-shadow: none; transform: rotate(-2deg); filter: url(#sketch-edges);
}

.cta-row { display: flex; gap: 16px; margin-top: 32px; flex-wrap: wrap; justify-content: center; }
.btn {
  border: none; cursor: pointer; font-weight: 700;
  padding: 15px 26px; border-radius: 14px; font-size: 16px;
  letter-spacing: 0.4px; transition: transform .12s ease, box-shadow .2s ease, filter .2s;
  text-shadow: none; color: #04121a;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: linear-gradient(95deg, var(--cyan), #7af0ff); box-shadow: var(--glow-cyan); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 0 26px rgba(25,227,255,0.7); }
.btn-ghost {
  background: rgba(255,255,255,0.05); color: var(--text);
  border: 1px solid var(--stroke); box-shadow: none;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 10px; }

/* hand-drawn ink buttons (landing only) */
.btn.sketch {
  font-family: 'Permanent Marker', cursive; font-weight: 400; font-size: 18px;
  letter-spacing: 0.5px; border-radius: 8px; filter: url(#sketch-edges);
}
.btn-primary.sketch {
  background: #1b1b26; color: #f3ecda; box-shadow: 4px 4px 0 rgba(27,27,38,0.22);
}
.btn-primary.sketch:hover { background: #2b2b3a; box-shadow: 5px 5px 0 rgba(27,27,38,0.28); }
.btn-ghost.sketch {
  background: transparent; color: #1b1b26; border: 2px solid #1b1b26; box-shadow: 4px 4px 0 rgba(27,27,38,0.14);
}
.btn-ghost.sketch:hover { background: rgba(27,27,38,0.06); }

/* name input (login) */
.name-input {
  font-family: 'Patrick Hand', cursive; font-size: 19px; text-align: center;
  width: min(300px, 82vw); padding: 11px 16px; margin: 4px 0 2px;
  background: rgba(255,253,245,0.75); color: #1b1b26; border: 2px solid #1b1b26;
  border-radius: 8px; outline: none; filter: url(#sketch-edges); text-shadow: none;
}
.name-input::placeholder { color: #9c958a; }
.name-input:focus { background: #fffdf6; box-shadow: 3px 3px 0 rgba(27,27,38,0.16); }

.landing-hint {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  width: min(560px, 90%); margin: 0; z-index: 4;
  font-family: 'Patrick Hand', cursive; color: #5a5a66; font-size: 15px; text-shadow: none;
}
.landing-hint b { color: #1b1b26; }

/* How-to: pinned sketch cards */
.howto { display: flex; gap: 16px; margin-top: 30px; flex-wrap: wrap; justify-content: center; max-width: 680px; }
.howto .card {
  position: relative; background: rgba(255,253,245,0.62); border-radius: 6px;
  padding: 14px 16px; width: 200px; text-align: left;
}
.howto .card::before {            /* wavy ink border, keeps text crisp */
  content: ''; position: absolute; inset: 0; border: 2px solid #2b2b36; border-radius: 6px;
  filter: url(#sketch-edges); pointer-events: none;
}
.howto .card:nth-child(1) { transform: rotate(-1.2deg); }
.howto .card:nth-child(2) { transform: rotate(0.7deg); }
.howto .card:nth-child(3) { transform: rotate(-0.5deg); }
.howto .card .k { font-family: 'Permanent Marker', cursive; color: #1b1b26; font-weight: 400; font-size: 15px; text-shadow: none; }
.howto .card .d { font-family: 'Patrick Hand', cursive; color: #4a4a58; font-size: 15px; margin-top: 4px; text-shadow: none; }

/* Guidance icon (top-right of the landing) + popover */
.guide-icon {
  position: absolute; right: 22px; top: 62px; z-index: 5;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: #1b1b26; color: #f3ecda; border: none;
  font-family: 'Permanent Marker', cursive; font-size: 22px; line-height: 1;
  box-shadow: 3px 3px 0 rgba(27,27,38,0.22); filter: url(#sketch-edges);
  transition: transform .12s ease;
}
.guide-icon:hover { transform: translateY(-2px) rotate(-4deg); }
.guide-icon:active { transform: scale(0.95); }

.guide-pop {
  position: absolute; right: 22px; top: 118px; z-index: 5; width: min(320px, 80vw);
  background: #fbf6e9; color: #2b2b36; border-radius: 8px; padding: 16px 16px 14px;
  box-shadow: 0 14px 40px rgba(27,27,38,0.28);
  text-align: left; display: none;
}
.guide-pop.open { display: block; animation: gp-in .16s ease-out; }
@keyframes gp-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.guide-pop::before {            /* wavy ink border */
  content: ''; position: absolute; inset: 0; border: 2px solid #2b2b36; border-radius: 8px;
  filter: url(#sketch-edges); pointer-events: none;
}
.guide-pop .gp-title { font-family: 'Permanent Marker', cursive; font-size: 18px; margin-bottom: 8px; color: #1b1b26; }
.guide-pop .gp-row { display: flex; gap: 9px; align-items: flex-start; font-family: 'Patrick Hand', cursive; font-size: 15px; color: #4a4a58; line-height: 1.25; margin-top: 7px; }
.guide-pop .gp-row b { color: #1b1b26; }
.guide-pop .gp-ic { font-size: 18px; line-height: 1.1; }

/* ---- Coin bar ------------------------------------------------------------ */
#coin-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 210;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(8,12,20,0.92), rgba(8,12,20,0));
}
#coin-bar .spacer { flex: 1; }
#coin-bar .coin-logo {
  width: 34px; height: 34px; border-radius: 50%; display: block; object-fit: cover;
  box-shadow: 0 1px 5px rgba(0,0,0,0.45); border: 1.5px solid rgba(255,255,255,0.15);
}
body.pregame #coin-bar .coin-logo { border-color: rgba(27,27,38,0.25); }
#coin-bar .ca {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--stroke);
  border-radius: 10px; padding: 7px 10px; max-width: 320px;
}
#coin-bar .ca code {
  font-family: 'Cutive Mono', monospace; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: none;
}
#coin-bar .ca .copy { cursor: pointer; color: var(--cyan); font-size: 12px; font-weight: 700; }
.coin-link {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  color: var(--text); font-weight: 700; font-size: 13px; text-shadow: none;
  padding: 8px 13px; border-radius: 10px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
}
.coin-link.buy { background: linear-gradient(95deg, var(--green), #8ef0bd); color: #06251a; border: none; }
.coin-link:hover { filter: brightness(1.08); }
#coin-bar .logo-mini { font-family: var(--display); color: var(--cyan); }
#coin-bar #coin-ticker { color: var(--gold); font-weight: 700; text-shadow: none; letter-spacing: 1px; }

/* paper-themed coin bar while on the landing (reverts to neon in-game) */
body.pregame #coin-bar { background: linear-gradient(180deg, rgba(241,233,214,0.96), rgba(241,233,214,0)); }
body.pregame #coin-bar .logo-mini { font-family: 'Permanent Marker', cursive; color: #1b1b26; }
body.pregame #coin-bar #coin-ticker { font-family: 'Permanent Marker', cursive; color: #c0392b; }
body.pregame #coin-bar .ca { background: rgba(255,253,245,0.7); border-color: #2b2b36; }
body.pregame #coin-bar .ca code { color: #4a4a58; }
body.pregame .coin-link { font-family: 'Patrick Hand', cursive; color: #1b1b26; border-color: #1b1b26; background: rgba(255,253,245,0.55); }
body.pregame .coin-link.buy { background: #1b1b26; color: #f3ecda; border: none; }

/* ============================================================================
   LOADING (between landing and game)
   ========================================================================== */
#ovr-loading {
  z-index: 190; display: none; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(180deg, #070b13, #0a0e17); color: var(--text);
}
#ovr-loading .spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.12); border-top-color: var(--cyan);
  animation: ovr-spin 0.9s linear infinite;
}
@keyframes ovr-spin { to { transform: rotate(360deg); } }
#ovr-loading .lbl { margin-top: 18px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-size: 13px; }

/* ============================================================================
   IN-GAME HUD
   ========================================================================== */
#hud { z-index: 80; pointer-events: none; display: none; }
#hud .pill {
  position: absolute; background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 8px 12px; backdrop-filter: blur(8px);
}

/* top-left: identity + tokens */
#hud-identity { top: 60px; left: 14px; display: flex; align-items: center; gap: 10px; }
#hud-identity .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
#hud-identity .name { font-weight: 700; font-size: 13px; }
#hud-identity .sub { color: var(--muted); font-size: 11px; text-shadow: none; }
#hud-tokens { color: var(--gold); font-weight: 700; font-size: 13px; }

/* top-center: run status */
#hud-run {
  top: 60px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 18px; align-items: center; text-align: center;
}
#hud-run .stat .v { font-family: var(--display); font-size: 24px; line-height: 1; }
#hud-run .stat .l { color: var(--muted); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; text-shadow: none; }
#hud-run .timer .v { color: var(--cyan); }
#hud-run .timer.low .v { color: var(--magenta); }
#hud-run .combo .v { color: var(--gold); }

/* bottom-center: speedometer */
#hud-speed { bottom: 18px; left: 50%; transform: translateX(-50%); text-align: center; min-width: 120px; }
#hud-speed .v { font-family: var(--display); font-size: 30px; line-height: 1; }
#hud-speed .u { color: var(--muted); font-size: 11px; letter-spacing: 2px; text-shadow: none; }
#hud-speed .mode { color: var(--cyan); font-size: 11px; margin-top: 2px; text-shadow: none; }

/* top-right buttons */
#hud-actions { position: absolute; top: 56px; right: 14px; display: flex; gap: 8px; pointer-events: auto; }

/* players online */
#hud-players { top: 108px; left: 14px; display: flex; align-items: center; gap: 7px; font-size: 13px; }
#hud-players .n { font-weight: 700; color: var(--cyan); }
#hud-players .via { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; text-shadow: none; border: 1px solid var(--stroke); border-radius: 6px; padding: 1px 5px; }

/* UTC clock (drives the sun) */
#hud-utc { bottom: 18px; left: 14px; display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 7px 11px; }
#hud-utc .t { font-family: 'Cutive Mono', monospace; font-weight: 700; color: var(--cyan); letter-spacing: 0.5px; text-shadow: none; }
#hud-utc .z { color: var(--muted); font-size: 10px; letter-spacing: 1px; text-shadow: none; }

/* Settings panel */
.set-group { margin-bottom: 14px; }
.set-title { font-weight: 700; font-size: 13px; color: var(--cyan); margin-bottom: 4px; letter-spacing: 0.5px; text-shadow: none; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid rgba(255,255,255,0.06); font-size: 14px; cursor: pointer; }
.set-row span { color: var(--text); text-shadow: none; }
.set-row input[type=range] { width: 130px; accent-color: var(--cyan); }
.set-row select { background: var(--panel-solid); color: var(--text); border: 1px solid var(--stroke); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.set-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--cyan); cursor: pointer; }

/* Missions list */
.mission-list { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.mission-btn {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.03); color: var(--text); cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.mission-btn:hover { background: rgba(25,227,255,0.09); border-color: rgba(25,227,255,0.32); }
.mission-btn .mi { font-size: 22px; }
.mission-btn .mt { font-weight: 700; font-size: 14px; }
.mission-btn .ms { color: var(--muted); font-size: 12px; text-shadow: none; }

/* Controls reference (Settings) */
.ctrl-list { margin-top: 4px; }
.ctrl-row { display: flex; align-items: center; gap: 6px; padding: 6px 2px; }
.ctrl-row .cd { margin-left: 8px; color: var(--text); font-size: 13.5px; text-shadow: none; }
.ctrl-row .sep { color: var(--muted); font-size: 12px; text-shadow: none; }
#ovr-root .kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 25px; height: 25px; padding: 0 7px;
  background: #e9edf3; color: #1a2030; border: 1px solid #aeb7c4; border-bottom-width: 2px;
  border-radius: 6px; font-family: 'Cutive Mono', monospace; font-size: 12px; font-weight: 700;
  text-shadow: none; line-height: 1;
}
.ctrl-row.touch-only { display: none; }
body.is-mobile .ctrl-row.touch-only { display: flex; }

/* let tall modals (settings with controls) scroll */
.modal { max-height: 88vh; overflow-y: auto; }

/* coin CA "coming soon" */
#coin-bar .ca.soon code { color: var(--gold); }

/* ---- Remote players (billboarded avatars) ---- */
#rp-layer { z-index: 65; pointer-events: none; overflow: hidden; }
.rp { position: absolute; transform: translate(-50%,-100%); will-change: left, top, transform; text-align: center; }
.rp .rp-icon { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.7)); }
.rp .rp-tag {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
  background: rgba(10,14,22,0.82); border: 1px solid var(--stroke); border-radius: 999px;
  padding: 3px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; backdrop-filter: blur(4px);
  text-shadow: 0 1px 2px #000;
}
.rp .rp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rp .rp-text { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.rp .rp-name { font-weight: 700; }
.rp .rp-wallet { font-family: 'Cutive Mono', monospace; font-size: 9.5px; color: var(--cyan); text-shadow: 0 1px 2px #000; letter-spacing: 0.3px; }
.rp.rp-self .rp-tag { border-color: rgba(25,227,255,0.55); }
.rp .rp-score { color: var(--gold); font-size: 11px; }
.rp .rp-arrow {
  position: absolute; top: 0; left: 50%; width: 0; height: 0; display: none;
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid var(--cyan);
}
.rp.edge .rp-icon, .rp.edge .rp-tag { opacity: 0.55; }
.rp.edge .rp-arrow { display: block; }

/* Objective marker (projected checkpoint) */
#marker { position: absolute; z-index: 70; display: none; transform: translate(-50%, -50%); pointer-events: none; }
#marker .ring {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid var(--cyan); box-shadow: var(--glow-cyan), inset 0 0 14px rgba(25,227,255,0.4);
  animation: ovr-pulse 1.1s ease-in-out infinite;
}
@keyframes ovr-pulse { 0%,100% { transform: scale(0.82); opacity: 0.85; } 50% { transform: scale(1.05); opacity: 1; } }
#marker .dist {
  margin-top: 6px; text-align: center; font-weight: 700; font-size: 12px; color: var(--cyan);
  text-shadow: 0 1px 3px #000;
}
#marker .arrow {
  position: absolute; top: 50%; left: 50%; width: 0; height: 0;
  border-left: 11px solid transparent; border-right: 11px solid transparent;
  border-bottom: 20px solid var(--cyan); transform-origin: 50% 50%;
  display: none; filter: drop-shadow(0 0 6px rgba(25,227,255,0.7));
}
#marker.edge .ring, #marker.edge .dist { display: none; }
#marker.edge .arrow { display: block; }

/* Floating "+score" popups */
#popups { position: fixed; left: 50%; top: 40%; z-index: 75; pointer-events: none; transform: translateX(-50%); }
.score-pop {
  font-family: var(--display); font-size: 30px; color: var(--gold);
  text-shadow: 0 2px 10px rgba(0,0,0,0.8); animation: ovr-pop 0.9s ease-out forwards; text-align: center;
}
.score-pop .x { color: var(--magenta); font-size: 18px; }
@keyframes ovr-pop { 0% { transform: translateY(10px) scale(0.7); opacity: 0; } 25% { opacity: 1; transform: scale(1.1);} 100% { transform: translateY(-40px) scale(1); opacity: 0; } }

/* ============================================================================
   MODALS (leaderboard + results)
   ========================================================================== */
.modal-scrim {
  position: fixed; inset: 0; z-index: 300; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 7, 13, 0.66); backdrop-filter: blur(4px);
}
.modal {
  width: 100%; max-width: 440px; background: var(--panel-solid);
  border: 1px solid var(--stroke); border-radius: 18px; padding: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6); color: var(--text);
}
.modal h2 { font-family: var(--display); font-size: 26px; margin: 0 0 4px; text-shadow: none; }
.modal .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; text-shadow: none; }
.modal .row-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .row-actions .btn { flex: 1; }
.modal .close { position: absolute; }

/* results stats */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 4px; }
.result-grid .cell { background: rgba(255,255,255,0.03); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px; text-align: center; }
.result-grid .cell .v { font-family: var(--display); font-size: 26px; }
.result-grid .cell .l { color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; text-shadow: none; }
.result-grid .cell.best .v { color: var(--gold); }
.result-grid .cell.earn .v { color: var(--green); }
.badge-best { display:inline-block; margin: 10px auto 0; color: var(--gold); font-weight: 700; }

/* leaderboard list */
.lb-backend { font-size: 11px; color: var(--muted); margin-bottom: 10px; text-shadow: none; }
.lb-list { max-height: 46vh; overflow-y: auto; margin: 0 -4px; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px;
}
.lb-row + .lb-row { border-top: 1px solid rgba(255,255,255,0.05); }
.lb-row.me { background: rgba(25,227,255,0.08); border: 1px solid rgba(25,227,255,0.25); }
.lb-row .rank { width: 26px; font-weight: 700; color: var(--muted); text-align: center; }
.lb-row .rank.top { color: var(--gold); }
.lb-row .nm { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-family: var(--display); font-size: 16px; color: var(--cyan); }
.lb-row .tk { width: 70px; text-align: right; color: var(--gold); font-size: 12px; text-shadow: none; }

/* ============================================================================
   TOUCH CONTROLS
   ========================================================================== */
#touch-controls { z-index: 90; display: none; pointer-events: none; }
#cam-zone { position: fixed; top: 0; right: 0; width: 55%; height: 100%; z-index: 60; pointer-events: auto; }

#joy-zone { position: fixed; left: 4%; bottom: 5%; z-index: 95; pointer-events: none; }
#joy-base {
  width: 128px; height: 128px; border-radius: 50%;
  background: radial-gradient(circle, rgba(25,227,255,0.10), rgba(255,255,255,0.03));
  border: 2px solid rgba(25,227,255,0.35); pointer-events: auto; position: relative;
  touch-action: none;
}
#joy-knob {
  width: 56px; height: 56px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #7af0ff, var(--cyan));
  box-shadow: var(--glow-cyan); position: absolute; left: 50%; top: 50%;
  margin: -28px 0 0 -28px; transition: transform 0.04s linear; pointer-events: none;
}

#btn-stack { position: fixed; right: 5%; bottom: 6%; z-index: 95; display: flex; align-items: flex-end; gap: 14px; pointer-events: none; }
.tbtn {
  pointer-events: auto; touch-action: none; user-select: none;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #04121a; border: none; text-align: center; line-height: 1.05;
}
.tbtn .ic { font-size: 20px; }
.tbtn .tx { font-size: 9.5px; letter-spacing: 0.5px; }
.tbtn.held { filter: brightness(1.25); transform: scale(0.94); }
#btn-enter { width: 64px; height: 64px; background: linear-gradient(150deg, #fff0a8, var(--gold)); flex-direction: column; }
#btn-action { width: 78px; height: 78px; background: linear-gradient(150deg, #ff7ab0, var(--magenta)); color: #fff; flex-direction: column; box-shadow: var(--glow-mag); }
#btn-boost { width: 70px; height: 70px; background: linear-gradient(150deg, #7af0ff, var(--cyan)); flex-direction: column; box-shadow: var(--glow-cyan); }

/* ============================================================================
   ROTATE GUARD (portrait on mobile)
   ========================================================================== */
#rotate-guard {
  position: fixed; inset: 0; z-index: 500; display: none;
  background: #070b13; color: var(--text);
  flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px;
}
#rotate-guard .ph { font-size: 60px; animation: ovr-rotate 1.8s ease-in-out infinite; }
@keyframes ovr-rotate { 0%,40% { transform: rotate(0); } 60%,100% { transform: rotate(-90deg); } }
#rotate-guard .t { font-family: var(--display); font-size: 22px; margin-top: 18px; text-shadow: none; }
#rotate-guard .d { color: var(--muted); margin-top: 8px; text-shadow: none; }

@media (orientation: portrait) {
  body.is-mobile #rotate-guard { display: flex; }
}

/* ============================================================================
   MOBILE: declutter the HUD so nothing overlaps the touch controls
   ========================================================================== */
body.is-mobile #hud-utc { display: none; }                 /* sat under the joystick */
body.is-mobile #coin-bar { padding: 6px 10px; gap: 7px; }
body.is-mobile #coin-bar .ca { display: none; }
body.is-mobile #coin-bar .coin-logo { width: 26px; height: 26px; }
body.is-mobile #coin-bar .logo-mini { font-size: 13px; }
body.is-mobile .coin-link { padding: 6px 10px; font-size: 12px; }

body.is-mobile #hud-identity { top: 46px; left: 8px; padding: 5px 9px; gap: 7px; }
body.is-mobile #hud-identity .sub { display: none; }       /* name floats above the head now */
body.is-mobile #hud-identity .name { font-size: 11px; }
body.is-mobile #hud-tokens { font-size: 11px; }
body.is-mobile #hud-players { top: 80px; left: 8px; padding: 4px 8px; font-size: 11px; }

body.is-mobile #hud-actions { top: 44px; right: 8px; gap: 5px; }
body.is-mobile #hud-actions .btn-sm { padding: 7px 9px; font-size: 12px; }
body.is-mobile #hud-actions #btn-run { padding: 7px 11px; font-size: 12px; }

body.is-mobile #hud-run { top: 44px; gap: 10px; padding: 6px 11px; }
body.is-mobile #hud-run .stat .l { display: none; }        /* keep numbers, drop labels */
body.is-mobile #hud-run .stat .v { font-size: 17px; }

body.is-mobile #hud-speed { bottom: 8px; min-width: 96px; padding: 5px 10px; }
body.is-mobile #hud-speed .v { font-size: 22px; }
body.is-mobile #hud-speed .u { font-size: 9px; }
body.is-mobile #hud-speed .mode { font-size: 9px; }

/* nameplates a touch smaller on phones */
body.is-mobile .rp .rp-icon { font-size: 19px; }
body.is-mobile .rp .rp-tag { font-size: 11px; padding: 2px 7px; }

/* very narrow: also tighten the landing */
@media (max-width: 560px) {
  #landing .howto { display: none; }
}
