:root {
  --bg: #030712;
  --panel: rgba(8, 18, 38, 0.72);
  --panel-solid: #0a1630;
  --line: rgba(120, 190, 255, 0.18);
  --line-strong: rgba(120, 220, 255, 0.4);
  --text: #e8f2ff;
  --muted: #8ea4c4;
  --cyan: #5ee6ff;
  --blue: #3a7bff;
  --good: #3ddc97;
  --bad: #ff4d6d;
  --warn: #ffc857;
  --pink: #ff7ad9;
  --ui: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background:
    radial-gradient(1200px 700px at 15% 10%, rgba(58, 123, 255, 0.14), transparent 60%),
    radial-gradient(900px 600px at 90% 90%, rgba(255, 122, 217, 0.08), transparent 60%),
    radial-gradient(800px 800px at 50% 55%, rgba(94, 230, 255, 0.05), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
kbd {
  font-family: var(--mono); font-size: 0.72em; padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--line-strong); background: rgba(94, 230, 255, 0.08); color: var(--cyan);
}

#stars, #globe { position: fixed; inset: 0; display: block; }
#globe { cursor: grab; }
#globe.dragging { cursor: grabbing; }
body.playing #globe { cursor: crosshair; }

/* ---------- loading ---------- */
#loading {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: var(--bg); z-index: 50; transition: opacity 0.6s; color: var(--muted); letter-spacing: 0.08em;
}
#loading.done { opacity: 0; pointer-events: none; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr minmax(0, 560px) 1fr; align-items: start; gap: 16px;
  padding: 18px 22px; pointer-events: none;
}
.hud-left { padding-top: 6px; }
.hud-mode { font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--cyan); font-weight: 600; }
.hud-round { font-family: var(--mono); font-size: 22px; font-weight: 700; margin-top: 4px; }

.prompt {
  position: relative; text-align: center; padding: 14px 22px 18px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.prompt.pop { animation: pop 0.45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(0.94); opacity: 0.3; } to { transform: none; opacity: 1; } }
.p-label { font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.p-main {
  font-size: clamp(22px, 3.4vw, 36px); font-weight: 700; line-height: 1.15; margin: 4px 0 4px;
  text-wrap: balance; letter-spacing: -0.01em;
}
.p-sub { font-size: 13px; color: var(--muted); }
.p-sub b { color: var(--text); font-family: var(--mono); }
.c-start { color: var(--cyan); }
.c-end { color: var(--pink); }
.c-arrow { color: var(--muted); margin: 0 0.4em; font-weight: 400; }
.tag {
  display: inline-block; font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; font-weight: 700;
  padding: 2px 7px; border-radius: 99px; background: rgba(255, 200, 87, 0.15); color: var(--warn);
  border: 1px solid rgba(255, 200, 87, 0.4); vertical-align: 1px;
}
.timer { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.06); }
#timer-fill {
  height: 100%; transform-origin: left; transform: scaleX(0);
  background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 12px var(--cyan);
}
#timer-fill.warn { background: linear-gradient(90deg, #ff2f5b, var(--warn)); box-shadow: 0 0 14px var(--bad); }
.timer-text { position: absolute; right: 12px; top: 10px; font-family: var(--mono); font-size: 11px; color: var(--muted); }

.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 2px; }
.score-wrap { display: flex; align-items: baseline; gap: 8px; }
.hud-score { font-family: var(--mono); font-size: 30px; font-weight: 700; text-shadow: 0 0 20px rgba(94, 230, 255, 0.4); }
.hud-mult {
  font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--warn);
  opacity: 0; transform: scale(0.6); transition: 0.25s;
}
.hud-mult.on { opacity: 1; transform: none; text-shadow: 0 0 12px rgba(255, 200, 87, 0.7); }
.hud-lives { display: flex; gap: 4px; }
.hud-lives.hurt { animation: hurt 0.5s; }
@keyframes hurt { 30% { transform: scale(1.25); } }
.heart svg { width: 22px; height: 22px; fill: var(--bad); filter: drop-shadow(0 0 6px rgba(255, 77, 109, 0.7)); transition: 0.3s; }
.heart.lost svg { fill: transparent; stroke: rgba(255, 255, 255, 0.25); stroke-width: 1.5; filter: none; }
.hud-streak { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--warn); min-height: 14px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; top: 170px; z-index: 30; transform: translate(-50%, -8px);
  padding: 9px 16px; border-radius: 99px; background: var(--panel-solid); border: 1px solid var(--line-strong);
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: 0.2s; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { border-color: rgba(255, 77, 109, 0.6); color: #ffd0d9; }
#toast.good { border-color: rgba(61, 220, 151, 0.6); color: #c9ffe6; }

/* ---------- border chain ---------- */
#chain {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 10;
  max-width: min(860px, calc(100vw - 130px)); padding: 10px 14px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.chain-row { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chain-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 5px 11px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; animation: chipIn 0.3s;
}
@keyframes chipIn { from { transform: scale(0.7); opacity: 0; } }
.chip-start { background: rgba(94, 200, 255, 0.18); color: #bfefff; border-color: rgba(94, 200, 255, 0.5); }
.chip-path { background: rgba(255, 200, 87, 0.16); color: #ffe7b0; border-color: rgba(255, 200, 87, 0.45); }
.chip-end { background: rgba(255, 122, 217, 0.18); color: #ffd3f3; border-color: rgba(255, 122, 217, 0.5); }
.chip.ghost { background: transparent; border-style: dashed; opacity: 0.75; }
.chain-sep { color: var(--muted); flex: none; }
.chain-meta { font-size: 11px; color: var(--muted); margin-top: 7px; text-align: center; letter-spacing: 0.04em; }
.chain-meta b { color: var(--text); font-family: var(--mono); }

/* ---------- shape panel ---------- */
#shape-panel {
  position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; pointer-events: none;
  padding-top: 120px;
}
.shape-card {
  pointer-events: auto; width: min(420px, calc(100vw - 32px)); padding: 16px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: pop 0.4s;
}
#shape-canvas {
  width: 100%; height: min(300px, 34vh); display: block; border-radius: 14px;
  background: radial-gradient(circle at 50% 40%, rgba(58, 123, 255, 0.12), transparent 70%), rgba(0, 0, 0, 0.25);
}
.shape-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.shape-badges:empty { display: none; }
.badge {
  font-size: 12px; padding: 4px 10px; border-radius: 99px; background: rgba(94, 230, 255, 0.1);
  border: 1px solid rgba(94, 230, 255, 0.35); color: #c8f6ff; animation: chipIn 0.3s;
}
.guess-list { display: grid; gap: 6px; margin-top: 10px; }
.guess-list:empty { display: none; }
.guess-row {
  display: grid; grid-template-columns: 1fr auto 28px; gap: 10px; align-items: center; padding: 7px 12px;
  border-radius: 10px; background: rgba(255, 77, 109, 0.1); border: 1px solid rgba(255, 77, 109, 0.3);
  font-size: 14px; animation: chipIn 0.3s;
}
.g-name { font-weight: 600; }
.g-dist { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.g-dir { font-size: 18px; text-align: center; color: var(--warn); }
.guess-box { position: relative; margin-top: 10px; }
.guess-box.shake-x { animation: shakeX 0.35s; }
@keyframes shakeX { 25% { transform: translateX(-8px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }
#guess-input, #route-input {
  width: 100%; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.35); color: var(--text); font: 600 16px var(--ui); outline: none;
  user-select: text; -webkit-user-select: text;
}
#guess-input:focus, #route-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(94, 230, 255, 0.18); }
#suggest, #route-suggest {
  list-style: none; margin: 0; padding: 4px; position: absolute; left: 0; right: 0; bottom: calc(100% + 6px);
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}
#suggest:empty, #route-suggest:empty { display: none; }
#suggest li, #route-suggest li { padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
#suggest li.on, #suggest li:hover, #route-suggest li.on, #route-suggest li:hover { background: rgba(94, 230, 255, 0.14); color: #fff; }

/* ---------- feedback ---------- */
#feedback {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 20;
  width: min(440px, calc(100vw - 32px)); padding: 16px 20px 16px; border-radius: 20px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); animation: rise 0.4s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }
#feedback.good { border-color: rgba(61, 220, 151, 0.5); box-shadow: 0 0 40px rgba(61, 220, 151, 0.15), 0 20px 60px rgba(0, 0, 0, 0.55); }
#feedback.bad { border-color: rgba(255, 77, 109, 0.5); box-shadow: 0 0 40px rgba(255, 77, 109, 0.15), 0 20px 60px rgba(0, 0, 0, 0.55); }
.fb-points { font-family: var(--mono); font-weight: 700; font-size: 30px; letter-spacing: 0.02em; }
#feedback.good .fb-points { color: var(--good); text-shadow: 0 0 18px rgba(61, 220, 151, 0.6); }
#feedback.bad .fb-points { color: var(--bad); text-shadow: 0 0 18px rgba(255, 77, 109, 0.6); font-size: 22px; letter-spacing: 0.14em; }
.fb-title { font-size: 19px; font-weight: 700; margin-top: 2px; }
.fb-detail { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.fb-extra { font-size: 12px; color: var(--warn); margin-top: 4px; letter-spacing: 0.06em; }
.fb-extra:empty { display: none; }
#feedback .btn { margin-top: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); font-weight: 600; font-size: 14px;
  transition: 0.15s;
}
.btn:hover { background: rgba(94, 230, 255, 0.1); border-color: var(--cyan); }
.btn-primary {
  background: linear-gradient(135deg, #5ee6ff, #3a7bff); color: #021024; border: none;
  box-shadow: 0 6px 24px rgba(58, 123, 255, 0.4);
}
.btn-primary:hover { filter: brightness(1.1); background: linear-gradient(135deg, #5ee6ff, #3a7bff); }
.btn-primary kbd { background: rgba(2, 16, 36, 0.2); border-color: rgba(2, 16, 36, 0.3); color: #021024; }

#controls {
  position: fixed; right: 18px; bottom: 22px; z-index: 12; display: flex; flex-direction: column; gap: 8px;
}
#controls button {
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: 0.15s;
}
#controls button:hover { border-color: var(--cyan); background: rgba(94, 230, 255, 0.1); }
#controls svg { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#mute .off { display: none; }
#mute.muted .on { display: none; }
#mute.muted .off { display: block; }
#controls .game-only { display: none; }
#controls.in-game .game-only { display: grid; }

/* ---------- countdown ---------- */
#countdown {
  position: fixed; left: 50%; top: 55%; z-index: 25; transform: translate(-50%, -50%); pointer-events: none;
  font-family: var(--mono); font-weight: 700; font-size: 120px; color: #fff; opacity: 0;
  text-shadow: 0 0 40px var(--cyan), 0 0 80px rgba(58, 123, 255, 0.6);
}
#countdown.show { animation: count 0.6s ease-out forwards; }
@keyframes count {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 15; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(ellipse at center, rgba(3, 7, 18, 0.35), rgba(3, 7, 18, 0.82) 75%);
  animation: fade 0.5s;
}
@keyframes fade { from { opacity: 0; } }
.menu-inner { width: min(1080px, 100%); display: grid; gap: 28px; justify-items: center; }
.brand { text-align: center; }
.brand-kicker { font-size: 12px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--cyan); font-weight: 600; }
.brand h1 {
  margin: 6px 0 4px; font-size: clamp(48px, 10vw, 104px); font-weight: 700; letter-spacing: 0.12em; line-height: 1;
  padding-left: 0.12em;
  background: linear-gradient(180deg, #ffffff 20%, #8fdcff 65%, #3a7bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(94, 230, 255, 0.35));
}
.brand-sub { margin: 0; color: var(--muted); font-size: 16px; }

.mode-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; width: 100%; }
.mode-card {
  text-align: left; cursor: pointer; padding: 18px 16px 16px; border-radius: 18px; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; min-height: 220px;
}
.mode-card:hover { transform: translateY(-4px); border-color: var(--cyan); box-shadow: 0 14px 40px rgba(58, 123, 255, 0.25); }
.mode-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.mode-card.daily { border-color: rgba(255, 122, 217, 0.4); background: linear-gradient(160deg, rgba(255, 122, 217, 0.12), var(--panel) 55%); }
.mode-card.daily:hover { border-color: var(--pink); box-shadow: 0 14px 40px rgba(255, 122, 217, 0.22); }
.mc-top { display: flex; justify-content: space-between; align-items: center; }
.mc-icon svg { width: 30px; height: 30px; fill: none; stroke: var(--cyan); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.daily .mc-icon svg { stroke: var(--pink); }
.pips { display: flex; gap: 3px; }
.pips i { width: 6px; height: 14px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.pips i.on { background: var(--warn); box-shadow: 0 0 6px rgba(255, 200, 87, 0.5); }
.mc-name { font-size: 19px; font-weight: 700; }
.mc-desc { font-size: 13px; color: var(--muted); line-height: 1.45; flex: 1; }
.mc-foot { font-size: 12px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); }
.mc-foot b { color: var(--text); font-family: var(--mono); }
.menu-help { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: 12px; color: var(--muted); }

.over-card {
  width: min(460px, 100%); text-align: center; padding: 28px 26px 24px; border-radius: 24px;
  background: var(--panel); border: 1px solid var(--line-strong); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: pop 0.5s cubic-bezier(.2, 1.3, .4, 1);
}
.over-mode { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--cyan); font-weight: 600; }
.over-card h2 { margin: 6px 0 0; font-size: 26px; }
.over-score {
  font-family: var(--mono); font-size: 64px; font-weight: 700; margin: 6px 0 0; line-height: 1.1;
  background: linear-gradient(180deg, #fff, #8fdcff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.over-best {
  display: inline-block; margin-top: 6px; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 700;
  padding: 4px 10px; border-radius: 99px; color: var(--warn); border: 1px solid rgba(255, 200, 87, 0.5);
  background: rgba(255, 200, 87, 0.1); animation: glow 1.4s ease-in-out infinite alternate;
}
@keyframes glow { to { box-shadow: 0 0 18px rgba(255, 200, 87, 0.45); } }
.over-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 16px auto 0; max-width: 300px; }
.over-grid:empty { display: none; }
.cell { width: 16px; height: 16px; border-radius: 4px; }
.cell-g { background: var(--good); box-shadow: 0 0 8px rgba(61, 220, 151, 0.5); }
.cell-y { background: var(--warn); }
.cell-r { background: var(--bad); }
.over-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.stat { padding: 10px 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.stat-v { font-family: var(--mono); font-weight: 700; font-size: 16px; }
.stat-k { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 3px; }
.over-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }

body.shake #globe, body.shake #hud { animation: shake 0.4s; }
@keyframes shake {
  20% { transform: translate(-7px, 2px); } 40% { transform: translate(6px, -3px); }
  60% { transform: translate(-4px, 1px); } 80% { transform: translate(3px, 0); }
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .mode-card.daily { grid-column: 1 / -1; min-height: 0; }
  .mode-card { min-height: 0; }
}
@media (max-width: 700px) {
  #hud { grid-template-columns: 1fr auto; grid-template-areas: "left right" "prompt prompt"; padding: 12px 14px; gap: 10px; }
  .hud-left { grid-area: left; padding-top: 0; }
  .prompt { grid-area: prompt; padding: 10px 14px 14px; }
  .hud-right { grid-area: right; flex-direction: row; align-items: center; gap: 10px; padding-top: 0; }
  .hud-streak { display: none; }
  .hud-score { font-size: 22px; }
  .hud-round { font-size: 17px; }
  .heart svg { width: 18px; height: 18px; }
  #toast { top: 190px; }
  #controls { right: 12px; bottom: auto; top: 50%; transform: translateY(-50%); }
  #controls button { width: 38px; height: 38px; }
  #chain { max-width: calc(100vw - 24px); bottom: 12px; }
  #feedback { bottom: 12px; }
  #shape-panel { padding-top: 170px; align-items: start; }
  #shape-canvas { height: min(220px, 28vh); }
  .mode-grid { grid-template-columns: 1fr; }
  .over-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- stats ---------- */
.btn-stats svg { width: 16px; height: 16px; fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; }
.btn-ghost { background: transparent; border-color: rgba(255, 77, 109, 0.35); color: #ffb3c1; font-size: 12px; padding: 7px 12px; }
.btn-ghost:hover { background: rgba(255, 77, 109, 0.1); border-color: var(--bad); }
.over-note { margin-top: 10px; font-size: 13px; color: var(--muted); }
.over-note:empty { display: none; }
.over-note b { color: var(--text); font-family: var(--mono); }
#stats { z-index: 18; align-items: start; }
.stats-card {
  width: min(640px, 100%); margin: 24px 0; padding: 22px 24px 18px; border-radius: 24px; text-align: left;
  background: var(--panel); border: 1px solid var(--line-strong); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: pop 0.4s cubic-bezier(.2, 1.3, .4, 1);
}
.stats-head { display: flex; justify-content: space-between; align-items: start; }
.stats-head h2 { margin: 4px 0 0; font-size: 28px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.icon-btn:hover { border-color: var(--cyan); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
#stats-body h3 {
  margin: 22px 0 10px; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.stats-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 16px; }
.stats-tiles.four { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
.stats-tiles.three { grid-template-columns: repeat(3, 1fr); margin-top: 0; }
.stats-tiles .stat { text-align: center; }
.stat.hot .stat-v { color: var(--warn); text-shadow: 0 0 12px rgba(255, 200, 87, 0.5); }
.stats-empty { color: var(--muted); text-align: center; padding: 30px 0 10px; }
.stats-muted { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.atlas-top { display: flex; justify-content: space-between; font-size: 14px; }
.atlas-top b { font-family: var(--mono); font-size: 18px; }
.atlas-pct { font-family: var(--mono); color: var(--cyan); font-weight: 700; }
.atlas-bar, .mrow-bar, .nbar { display: block; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.atlas-bar { height: 10px; margin-top: 8px; }
.atlas-bar i, .mrow-bar i, .nbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.nbar i { background: var(--bad); }
.mtable { display: grid; gap: 8px; }
.mrow { display: grid; grid-template-columns: 1.3fr 0.8fr 2fr 44px; gap: 12px; align-items: center; font-size: 14px; }
.mhead { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.mrow-name { font-weight: 600; }
.mrow-best, .mrow-pct { font-family: var(--mono); }
.mrow-pct { text-align: right; color: var(--muted); font-size: 12px; }
.dchart { margin-top: 14px; }
.dbars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; height: 110px; align-items: end; border-bottom: 1px solid var(--line); }
.dcol { height: 100%; display: flex; align-items: end; justify-content: center; cursor: default; border-radius: 6px 6px 0 0; }
.dcol:hover { background: rgba(94, 230, 255, 0.06); }
.dbar { display: block; width: 62%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--cyan); opacity: 0.85; }
.dcol.today .dbar { opacity: 1; box-shadow: 0 0 12px rgba(94, 230, 255, 0.6); }
.dcol:hover .dbar { opacity: 1; }
.dnone { display: block; width: 62%; max-width: 22px; height: 2px; background: rgba(255, 255, 255, 0.15); }
.dlabels { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; margin-top: 6px; }
.dlabels span { font-size: 10px; color: var(--muted); text-align: center; font-family: var(--mono); white-space: nowrap; }
.nemesis { display: grid; gap: 8px; }
.nrow { display: grid; grid-template-columns: 1.4fr 2fr 36px; gap: 12px; align-items: center; font-size: 14px; }
.ncount { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.stats-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
#chart-tip {
  position: fixed; z-index: 40; transform: translate(-50%, -100%); pointer-events: none; opacity: 0; transition: opacity 0.12s;
  padding: 6px 10px; border-radius: 8px; background: var(--panel-solid); border: 1px solid var(--line-strong);
  font-size: 12px; font-family: var(--mono); white-space: nowrap; color: var(--text);
}
#chart-tip.show { opacity: 1; }
@media (max-width: 700px) {
  .stats-tiles { grid-template-columns: repeat(2, 1fr); }
  .stats-tiles.four, .stats-tiles.three { grid-template-columns: repeat(2, 1fr); }
  .stats-card { padding: 18px 16px; }
  .mrow { grid-template-columns: 1.3fr 0.9fr 1.4fr 38px; gap: 8px; font-size: 13px; }
}
.dcol.pre { pointer-events: none; }
#stats { background: rgba(3, 7, 18, 0.88); }
.stats-card { background: rgba(10, 22, 48, 0.96); }

/* Border Run typing */
#chain { width: min(560px, calc(100vw - 130px)); z-index: 13; }
#chain .chip { cursor: pointer; font-family: inherit; }
#chain .chip.ghost { cursor: default; }
#chain .chip:hover:not(.ghost) { filter: brightness(1.2); }
#route-box { margin-top: 10px; }
#route-input:disabled { opacity: 0.5; }
@media (max-width: 700px) { #chain { width: calc(100vw - 24px); } }
