:root {
  --bg: #f5f4ef;
  --ink: #111827;
  --muted: #64748b;
  --line: #e2dfd5;
  --card: #ffffff;
  --accent: #0284c7;
  --accent-ink: #ffffff;
  --fids-bg: #090d16;
  --fids-card: #111827;
  --fids-border: #1f293d;
  --fids-amber: #f59e0b;
  --fids-green: #10b981;
  --water: #d8e5f0;
  --land: #ede9df;
  --border: #c4beaf;
  --state: #dad4c5;
  --pending: #f59e0b;
  --great: #059669;
  --good: #d97706;
  --ok: #ea580c;
  --bad: #dc2626;
  --radius: 10px;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] {
  --bg: #070a12;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #1e293b;
  --card: #0f172a;
  --accent: #38bdf8;
  --accent-ink: #04111d;
  --fids-bg: #030712;
  --fids-card: #0b1120;
  --fids-border: #1e293b;
  --fids-amber: #fbbf24;
  --fids-green: #34d399;
  --water: #071324;
  --land: #141f33;
  --border: #23344d;
  --state: #1c2b42;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: hidden; }
body.in-game { position: fixed; inset: 0; width: 100%; overflow: hidden; overscroll-behavior: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.loading { display: grid; place-items: center; height: 100vh; color: var(--muted); font-size: 18px; padding: 24px; text-align: center; }

/* ---------- Hub Header & Aviation Identity ---------- */
.hub { max-width: 600px; margin: 0 auto; padding: 24px 16px 40px; }
.hub-head { text-align: center; margin-bottom: 20px; }
.hub-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 8px; }
.brand-banner {
  background: radial-gradient(circle at top, rgba(2, 132, 199, 0.08) 0%, transparent 70%);
  padding: 12px 0 6px;
}
.brand-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.2);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
  color: var(--ink);
}
.logo-dot { color: var(--accent); margin: 0 4px; }
.logo-sub { font-weight: 600; font-size: 0.55em; letter-spacing: 0.12em; color: var(--muted); vertical-align: middle; }
.tagline { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; font-weight: 500; }

/* ---------- Interactive 3D Globe Radar Hero ---------- */
.globe-stage {
  position: relative;
  width: 100%;
  max-width: 340px;
  height: 300px;
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.globe-sphere {
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #1e3a8a 0%, #0f172a 60%, #020617 100%);
  box-shadow: 
    inset 0 0 35px rgba(56, 189, 248, 0.4),
    0 0 45px rgba(56, 189, 248, 0.12),
    0 12px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.globe-grid {
  position: absolute; inset: 0;
  border-radius: 50%;
  background-image: 
    repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 18px, rgba(56, 189, 248, 0.12) 19px, transparent 20px),
    linear-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 100% 22px;
}
.radar-sweep {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 72%, rgba(56, 189, 248, 0.28) 100%);
  animation: sweep 4.2s linear infinite;
}
@keyframes sweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.arc-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.hud-hub {
  margin-top: 10px;
  background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 5px 12px; border-radius: 99px; font-size: 11px;
  display: flex; align-items: center; gap: 8px;
  color: #94a3b8; font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
.hud-ping {
  width: 6.5px; height: 6.5px; background: #10b981; border-radius: 50%;
  box-shadow: 0 0 7px #10b981;
}

/* ---------- 5 Mission Orbs Orbit Grid ---------- */
.missions-orbit {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}
.orb-node {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 6px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.orb-node:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.15);
}
.orb-node.is-done {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}
.orb-icon { font-size: 22px; }
.orb-title {
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.orb-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 800; padding: 3px 6px; border-radius: 4px;
}
.tag-done { color: var(--great); background: rgba(16, 185, 129, 0.12); }
.tag-play { color: var(--accent); background: rgba(2, 132, 199, 0.1); }

/* ---------- Radar Dock (Daily Total + Boarding Pass) ---------- */
.dock {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}
.dock-score-box { min-width: 0; }
.dock-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700; color: var(--muted);
  display: flex; align-items: center; gap: 4px;
}
.dock-streak { color: var(--pending); font-weight: 800; }
.dock-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--ink); margin-top: 2px;
}
.dock-max { font-size: 12px; color: var(--muted); font-weight: 600; }
.dock-btn {
  background: var(--accent); color: var(--accent-ink);
  padding: 9px 18px; border-radius: 99px;
  font-weight: 700; font-size: 13px; text-decoration: none; border: none;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s;
}
.dock-btn:hover { transform: translateY(-1px); }

@media (max-width: 480px) {
  .missions-orbit {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .missions-orbit .orb-node:nth-child(4) {
    grid-column: 1 / 2;
  }
  .missions-orbit .orb-node:nth-child(5) {
    grid-column: 2 / 3;
  }
  .orb-node { padding: 12px 6px; }
  .orb-icon { font-size: 20px; }
  .orb-title { font-size: 11px; }
  .orb-tag { font-size: 9px; }
  .dock { padding: 12px 14px; }
  .dock-score { font-size: 19px; }
  .dock-btn { padding: 8px 14px; font-size: 12px; }
}

@media (max-width: 480px) {
  .fids-columns-row, .fids-row {
    grid-template-columns: 60px minmax(0, 1fr) 76px 65px;
    gap: 6px;
    padding: 11px 10px;
  }
  .fids-flight-icon { display: none; }
  .fids-flight-code { font-size: 11.5px; }
  .fids-game-name { font-size: 13.5px; }
  .fids-game-blurb { display: none; }
  .fids-pill { font-size: 9.5px; padding: 2px 5px; }
  .fids-score-val { font-size: 11px; }
}

.practice { margin-top: 24px; text-align: center; }
.practice-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 10px; }
.practice-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hub-foot { margin-top: 40px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.foot-links { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.foot-link { color: var(--accent); text-decoration: none; font-size: 12.5px; font-weight: 700; }
.foot-link:hover { text-decoration: underline; }
.foot-link-btn { background: none; border: none; padding: 0; color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.foot-link-btn:hover { color: var(--ink); text-decoration: underline; }
.foot-dot { color: var(--border); }
.foot-sub { font-size: 11px; font-weight: 500; opacity: 0.7; }

.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 34px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600;
}
.chip:hover { border-color: #cfd6e4; }

/* ---------- Game ---------- */
.game { display: flex; flex-direction: column; width: 100%; height: 100vh; height: 100dvh; max-width: 1100px; margin: 0 auto; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
.back { font-size: 22px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.back:hover { background: var(--card); }
.titles { flex: 1; min-width: 0; }
.title { font-weight: 800; font-size: 17px; }
.subtitle { font-size: 13px; color: var(--muted); }

.prompt { padding: 4px 16px 10px; text-align: center; }
.pips { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.pip { width: 26px; height: 6px; border-radius: 3px; background: var(--line); transition: background .2s; }
.pip.current { background: var(--ink); }
.pip.g-great { background: var(--great); }
.pip.g-good { background: var(--good); }
.pip.g-ok { background: var(--ok); }
.pip.g-bad { background: var(--bad); }
.find-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.iata { font-size: 40px; font-weight: 800; letter-spacing: .04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.iata .of, .big-score .of { font-size: .45em; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.airport-name { font-size: 14px; color: var(--ink); min-height: 1.3em; }
.airport-name .city { color: var(--muted); }

.map-wrap {
  position: relative; flex: 1; min-height: 200px; margin: 0 12px;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--water);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.map-svg { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; pointer-events: none; touch-action: none; user-select: none; }
.map-svg.panning { cursor: grabbing; }
.map-water { fill: var(--water); }
.map-graticule { fill: none; stroke: var(--border); stroke-width: 0.5; opacity: 0.28; vector-effect: non-scaling-stroke; stroke-dasharray: 3 3; }
.map-land { fill: var(--land); stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.map-states { fill: none; stroke: var(--state); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.map-lakes { fill: var(--water); stroke: var(--border); stroke-width: 0.85; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

.marker circle { stroke: #fff; }
.marker text { font-weight: 800; paint-order: stroke; stroke: #fff; fill: var(--ink); pointer-events: none; }
.marker.pending circle { fill: var(--pending); animation: pulse 1.2s ease-in-out infinite; }
.marker.guess circle { fill: var(--pending); }
.marker.truth circle { fill: var(--ink); }
.marker.truth.g-great circle { fill: var(--great); }
.marker.truth.g-good circle { fill: var(--good); }
.marker.truth.g-ok circle { fill: var(--ok); }
.marker.truth.g-bad circle { fill: var(--bad); }
.marker.past circle { fill: #9aa3b2; }
.marker.past text { fill: #7b8494; font-weight: 700; }
.map-line { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 4; opacity: .7; }
@keyframes pulse { 50% { transform: scale(1.25); } }

.zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.zoom button {
  width: 36px; height: 36px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--line); font-size: 18px; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.actionbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.action-msg { flex: 1; font-size: 14px; color: var(--muted); }
.action-msg .score { font-weight: 800; font-size: 18px; }
.score.g-great, .row-score.g-great { color: var(--great); }
.score.g-good, .row-score.g-good { color: var(--good); }
.score.g-ok, .row-score.g-ok { color: var(--ok); }
.score.g-bad, .row-score.g-bad { color: var(--bad); }

.btn {
  height: 44px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-weight: 700; font-size: 15px; transition: transform .08s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn.wide { width: 100%; margin-top: 8px; }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 24, 34, .45); display: grid; place-items: center;
  padding: 16px; z-index: 50; animation: fade .15s ease;
}
.modal {
  position: relative; background: var(--card); border-radius: 18px; padding: 24px; width: 100%; max-width: 420px;
  max-height: calc(100dvh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .18s ease;
}
.modal h2 { margin: 0 0 8px; }
.modal p, .modal li { line-height: 1.5; font-size: 15px; }
.modal ul { padding-left: 20px; }
.modal-x { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 26px; color: var(--muted); width: 36px; height: 36px; }
.legend { font-size: 14px; color: var(--muted); margin: 8px 0; }
.results { text-align: center; }
.big-score { font-size: 48px; font-weight: 800; line-height: 1.1; margin-top: 4px; }
.squares { font-size: 26px; letter-spacing: 4px; margin: 6px 0 14px; }
.rows { text-align: left; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 24px 44px 1fr auto 46px; gap: 8px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.row-iata { font-weight: 800; }
.row-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dist { color: var(--muted); font-variant-numeric: tabular-nums; }
.row-score { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 4px; }
.stat-v { font-size: 22px; font-weight: 800; }
.stat-l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.next { margin-top: 14px; font-size: 13px; color: var(--muted); }
.countdown { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; top: 20px; transform: translate(-50%, -20px); opacity: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  z-index: 100; transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* ---------- Codebreaker ---------- */
.cb-game { max-width: 600px; height: auto; min-height: 100dvh; }
.cb-stage { flex: 1; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.cb-prompt-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 16px; text-align: center;
}
.cb-big-code { font-size: 52px; font-weight: 800; letter-spacing: .08em; line-height: 1.05; margin: 6px 0 4px; color: var(--accent); }
.cb-big-city { font-size: 32px; font-weight: 800; line-height: 1.15; margin: 6px 0 4px; }
.cb-question { font-size: 14px; color: var(--muted); }
.cb-hints { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.cb-hint-pill {
  font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px; color: var(--ink);
}

.cb-input-wrap { position: relative; }
.cb-input-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cb-input {
  flex: 1 1 160px; min-width: 0; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font: inherit; font-size: 16px; color: var(--ink); outline: none;
}
.cb-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 95, 214, .12); }
.cb-code-input { text-transform: uppercase; font-weight: 800; letter-spacing: .18em; font-size: 20px; text-align: center; }

.cb-suggestions {
  margin-top: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.cb-suggestions:empty { display: none; }
.cb-sugg-item {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--card);
  text-align: left; font-size: 14px;
}
.cb-sugg-item:last-child { border-bottom: 0; }
.cb-sugg-item.active, .cb-sugg-item:hover { background: #eef3fc; }
.cb-sugg-city { font-weight: 700; }
.cb-sugg-country { font-size: 12px; color: var(--muted); }

.cb-guesses { display: flex; flex-direction: column; gap: 8px; }
.cb-guess-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  font-size: 14px;
}
.cb-guess-row.empty { background: transparent; border-style: dashed; color: var(--muted); justify-content: center; }
.cb-guess-row.correct { border-color: var(--great); background: #f0fdf4; }
.cb-g-city { font-weight: 700; }
.cb-g-country { font-weight: 400; color: var(--muted); }
.cb-g-dist { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.cb-tiles { display: flex; gap: 6px; }
.cb-tile {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px;
  font-weight: 800; font-size: 16px; color: #fff; background: #9ca3af;
}
.cb-tile.correct { background: var(--great); }
.cb-tile.present { background: var(--good); }
.cb-tile.absent { background: #6b7280; }
.cb-g-known { font-size: 13px; color: var(--muted); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cb-reveal {
  padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card);
}
.cb-reveal.won { border-color: var(--great); background: #f0fdf4; }
.cb-reveal.lost { border-color: var(--bad); background: #fef2f2; }
.cb-reveal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.cb-reveal-badge {
  font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: var(--great); color: #fff;
}
.cb-reveal.lost .cb-reveal-badge { background: var(--bad); }
.cb-also { font-size: 12px; color: var(--muted); }
.cb-reveal-name { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cb-story { margin: 8px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.cb-hint-pill.pill-ok { background: #e7f6ec; border-color: var(--great); color: var(--great); }
:root[data-theme="dark"] .cb-reveal.won,
:root[data-theme="dark"] .cb-guess-row.correct { background: rgba(22, 163, 74, 0.14); }
:root[data-theme="dark"] .cb-reveal.lost { background: rgba(220, 38, 38, 0.14); }
:root[data-theme="dark"] .cb-sugg-item.active,
:root[data-theme="dark"] .cb-sugg-item:hover { background: #243452; }

/* Hub Toolbar & Boarding Pass Card */
.hub-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 8px; }
.archive-select { appearance: auto; cursor: pointer; padding-right: 10px; }

.boarding-pass {
  background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px; position: relative;
}
.bp-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.bp-rank { display: flex; align-items: center; gap: 10px; }
.bp-icon { font-size: 28px; }
.bp-label { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.bp-title { font-size: 17px; font-weight: 800; }
.bp-daily { text-align: right; }
.bp-score { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bp-score .of { font-size: 12px; color: var(--muted); font-weight: 600; }
.bp-bar-wrap { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 12px 0 10px; }
.bp-bar { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.bp-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); gap: 8px; flex-wrap: wrap; }
.bp-share-btn { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); height: 30px; font-size: 12px; }

/* Codebreaker On-Screen Keyboard & Mini-Map */
.cb-kb { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; user-select: none; }
.cb-kb-row { display: flex; justify-content: center; gap: 5px; }
.cb-key {
  min-width: 30px; height: 40px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); font-weight: 700; font-size: 13px; flex: 1; max-width: 42px;
}
.cb-key.wide { max-width: 64px; font-size: 12px; }
.cb-key.correct { background: var(--great); color: #fff; border-color: var(--great); }
.cb-key.present { background: var(--good); color: #fff; border-color: var(--good); }
.cb-key.absent { background: #4b5563; color: #d1d5db; border-color: #4b5563; opacity: 0.7; }
.cb-minimap {
  height: 155px; margin-top: 10px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  position: relative;
}

/* Plane glyph on flight arc */
.plane-glyph { fill: var(--pending); stroke: #fff; stroke-width: 1.2; }

/* ---------- Route Map, Guess the Route, Connect the Trip ---------- */
.map-arc.spoke-faint { stroke: var(--accent); stroke-width: 1.1; opacity: 0.28; }
.map-arc.spoke-highlight { stroke: var(--pending); stroke-width: 2.6; opacity: 0.95; }
.map-arc.spoke-active { stroke: var(--ink); stroke-width: 2.2; opacity: 0.85; }
.map-arc.spoke-active.g-great { stroke: var(--great); }
.map-arc.spoke-active.g-good { stroke: var(--good); }
.map-arc.spoke-active.g-ok { stroke: var(--ok); }
.map-arc.spoke-active.g-bad { stroke: var(--bad); }

.rm-headline { font-size: 19px; font-weight: 800; margin-top: 2px; line-height: 1.25; }
.rm-panel, .gr-panel, .ct-panel {
  padding: 10px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; position: relative;
}
.rm-controls { position: relative; display: flex; flex-direction: column; gap: 6px; }
.rm-suggestions {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); margin-top: 0; z-index: 20;
}
.rm-FinishedBar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rm-choice-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
.rm-choice-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 700; font-size: 14px;
  text-align: left; cursor: pointer; transition: border-color .15s, background .15s, transform .08s;
}
.rm-choice-btn:hover:not(:disabled) { border-color: var(--accent); }
.rm-choice-btn:active:not(:disabled) { transform: scale(0.99); }
.rm-choice-btn .rm-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px;
  background: var(--bg); font-size: 12px; font-weight: 800; color: var(--accent);
}
.rm-choice-btn .rm-choice-sub { font-size: 12px; font-weight: 600; color: var(--muted); }
.rm-choice-btn.is-correct {
  background: var(--great); color: #fff; border-color: var(--great);
}
.rm-choice-btn.is-correct .rm-badge,
.rm-choice-btn.is-correct .rm-choice-sub { color: #fff; background: rgba(255,255,255,0.2); }
.rm-choice-btn.is-wrong {
  background: rgba(239, 68, 68, 0.12); border-color: var(--bad); color: var(--muted); opacity: 0.78;
}
.rm-time-box {
  display: flex; flex-direction: column; gap: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.rm-time-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.rm-time-readout {
  font-size: 24px; font-weight: 800; color: var(--accent); letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.rm-time-route {
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.rm-time-slider-row {
  display: flex; align-items: center; gap: 8px;
}
.rm-time-slider {
  flex: 1; min-width: 0; accent-color: var(--accent); height: 6px; cursor: pointer;
}
.rm-step-btn {
  padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-weight: 700; font-size: 12px; cursor: pointer;
}
.rm-step-btn:hover { border-color: var(--accent); }

/* Guess the Route */
.gr-route-header { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 4px; }
.gr-endpoint { font-size: 22px; font-weight: 800; letter-spacing: .04em; }
.gr-arrow { font-size: 15px; color: var(--muted); font-weight: 700; }
.gr-input-bar { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; position: relative; }
.gr-code-inp { flex: 1 1 130px; max-width: 190px; font-size: 14px; font-weight: 700; text-align: center; }
.gr-sep { font-weight: 800; color: var(--muted); font-size: 16px; }
.gr-guesses-list {
  display: flex; flex-direction: column; gap: 6px; max-height: 165px; overflow-y: auto; padding-right: 2px;
}
.gr-guess-row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
}
.gr-side { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.gr-side:last-child { justify-content: flex-end; }
.gr-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-share-preview {
  font-family: inherit; font-size: 20px; line-height: 1.35; margin: 10px 0; background: var(--bg);
  padding: 10px; border-radius: 12px;
}

/* Connect the Trip */
.ct-chain-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.ct-stop-chip {
  font-size: 13px; font-weight: 700; background: var(--card); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px;
}
.ct-stop-chip.goal { border-color: var(--accent); color: var(--accent); background: #eef3fc; }
.ct-leg-arrow { font-size: 13px; color: var(--muted); font-weight: 700; }
.ct-substatus { font-size: 12px; color: var(--muted); text-align: center; }
.ct-res-route { font-size: 14px; margin: 6px 0; }

@media (max-width: 520px) {
  .iata { font-size: 32px; }
  .rm-headline { font-size: 15.5px; }
  .map-wrap { margin: 0 8px; min-height: 150px; }
  .rm-choice-btn { padding: 8px 10px; font-size: 13px; }
  .btn { height: 40px; padding: 0 14px; font-size: 14px; }
  .row { grid-template-columns: 22px 40px 1fr auto 42px; font-size: 13px; }
  .gr-side { flex-direction: column; align-items: center; gap: 2px; }
  .gr-guesses-list { max-height: 120px; }
}

/* ---------- Daily Boarding Pass (ticket modal) ---------- */
.bp-actions { display: inline-flex; align-items: center; gap: 8px; }
.bp-streak { font-weight: 800; color: var(--ink); font-size: 13px; }
.bp-modal { padding: 20px; }
.ticket {
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  margin: 6px 0 14px;
}
.tk-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px;
  font-weight: 800; letter-spacing: .08em; font-size: 13px;
}
.tk-kind { font-size: 11px; opacity: .9; }
.tk-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px 14px 0; }
.tk-fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 10px; }
.tk-label { font-size: 9.5px; font-weight: 800; letter-spacing: .1em; color: var(--muted); }
.tk-value { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tk-perf {
  position: relative; height: 0; border-top: 2px dashed var(--line); margin: 14px 0;
}
.tk-perf::before, .tk-perf::after {
  content: ''; position: absolute; top: -10px; width: 18px; height: 18px; border-radius: 50%; background: var(--card);
}
.tk-perf::before { left: -10px; }
.tk-perf::after { right: -10px; }
.tk-rows { display: flex; flex-direction: column; gap: 6px; padding: 0 14px; }
.tk-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 52px; align-items: center; gap: 8px;
  font-size: 14px; color: var(--ink); text-decoration: none;
}
.tk-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-sq { font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
.tk-pts { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.tk-todo .tk-sq { color: var(--muted); font-size: 12px; letter-spacing: 0; }
.tk-todo .tk-go { color: var(--accent); font-size: 12px; }
.tk-todo:hover .tk-name { text-decoration: underline; }
.tk-total { display: flex; justify-content: space-between; align-items: baseline; padding: 0 14px 14px; }
.tk-score { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tk-score .of { font-size: 13px; color: var(--muted); font-weight: 600; }
.tk-note { text-align: center; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.bp-cta { animation: bp-pulse 1.6s ease-in-out 2; }
@keyframes bp-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@media (max-width: 380px) {
  .tk-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tk-row { grid-template-columns: 20px minmax(0, 1fr) auto 46px; font-size: 13px; }
  .tk-sq { font-size: 11px; }
}
