/* Bordercross — visual identity
   A field-atlas / boarding-pass motif: ticket stubs for start & destination,
   a customs-stamp for the difficulty readout, a flight-log chain of flags
   for the route, and a cartogram for the map. */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --paper-100: #eef1ec;
  --paper-050: #f8faf6;
  --ink-900: #12181f;
  --ink-700: #1e2730;
  --ink-500: #3a4650;

  --gold: #d9a441;
  --gold-ink: #3d2c0d;
  --teal: #2b8c82;
  --ok: #3e9b6f;
  --danger: #c6564b;

  --bg: var(--paper-100);
  --surface: var(--paper-050);
  --surface-raised: #ffffff;
  --text: #1b2129;
  --text-muted: #5c6a63;
  --hairline: rgba(27, 33, 41, 0.16);
  --hairline-strong: rgba(27, 33, 41, 0.32);
  --accent: var(--gold);
  --accent-ink: var(--gold-ink);
  --shadow: 0 12px 32px -16px rgba(18, 24, 31, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--ink-900);
    --surface: var(--ink-700);
    --surface-raised: #232e39;
    --text: #eaece5;
    --text-muted: #9caaa2;
    --hairline: rgba(234, 236, 229, 0.16);
    --hairline-strong: rgba(234, 236, 229, 0.32);
    --shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: var(--ink-900);
  --surface: var(--ink-700);
  --surface-raised: #232e39;
  --text: #eaece5;
  --text-muted: #9caaa2;
  --hairline: rgba(234, 236, 229, 0.16);
  --hairline-strong: rgba(234, 236, 229, 0.32);
  --shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding: clamp(16px, 4vw, 40px); }

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 24px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 16px;
}

.brand { display: flex; flex-direction: column; gap: 4px; }

.brand-lockup { display: flex; align-items: center; gap: 12px; }

.brand-icon { flex-shrink: 0; border-radius: 28%; }

.brand-name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.01em;
  margin: 0;
}

.brand-tag {
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.topbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.primary-actions { display: flex; align-items: center; gap: 8px; }
.icon-buttons { display: flex; align-items: center; gap: 8px; }

.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
}

.mode-toggle button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.mode-toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.difficulty-picker {
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 30px 8px 14px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--text-muted);
}

.difficulty-picker:hover { border-color: var(--accent); }

.icon-btn {
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.icon-btn:hover, .mode-toggle button:hover { border-color: var(--accent); }

.btn {
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 700;
  font-size: 13.5px;
}

.btn:hover { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover { color: var(--danger); border-color: transparent; }

button:focus-visible, input:focus-visible, .suggestion-item:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ---------- Ticket (start / destination / difficulty) ---------- */

.ticket {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  align-items: stretch;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.stub {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.stub.dest { text-align: right; align-items: flex-end; }

.stub-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stub-country {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(20px, 2.6vw, 28px);
}

.stub.dest .stub-country { flex-direction: row-reverse; }

.stub-flag { font-size: 1.25em; line-height: 1; }

/* Self-hosted SVG flags (assets/flags/) instead of Unicode flag emoji —
   see js/lookup.js for why. Sized in em so it scales with whatever text
   it's sitting next to, wherever a flag shows up. */
.flag-icon {
  display: inline-block;
  height: 0.85em;
  width: auto;
  vertical-align: -0.1em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--hairline-strong);
  background: var(--surface);
}

.stub-flag .flag-icon { height: 1em; }

.perforation {
  position: relative;
  width: 0;
  height: 100%;
  border-left: 2px dashed var(--hairline-strong);
}

.perforation::before, .perforation::after {
  content: "";
  position: absolute;
  left: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--hairline);
}

.perforation::before { top: -9px; }
.perforation::after { bottom: -9px; }

.stamp {
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transform: rotate(-3deg);
}

.daily-number {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stamp-moves {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  border: 2px solid currentColor;
  border-radius: 8px;
  padding: 5px 10px;
}

.difficulty-badge {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 999px;
}

.difficulty-easy { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.difficulty-medium { background: color-mix(in srgb, var(--gold) 26%, transparent); color: color-mix(in srgb, var(--gold) 70%, black); }
.difficulty-hard { background: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .difficulty-medium { color: var(--gold); }
}
:root[data-theme="dark"] .difficulty-medium { color: var(--gold); }

/* ---------- Main grid ---------- */

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 760px) {
  .main-grid { grid-template-columns: 1fr; }
  .ticket { grid-template-columns: 1fr; }
  .stub.dest { text-align: left; align-items: flex-start; }
  .stub.dest .stub-country { flex-direction: row; }
  .perforation { width: 100%; height: 0; border-left: none; border-top: 2px dashed var(--hairline-strong); }
  .perforation::before { left: 50%; top: -9px; transform: translateX(-50%); }
  .perforation::after { left: auto; right: -9px; top: -9px; bottom: auto; }
  .stamp { transform: none; }
}

@media (max-width: 700px) {
  .topbar { gap: 14px; padding-bottom: 14px; }
  .topbar-controls { flex-direction: column; align-items: stretch; width: 100%; gap: 10px; }
  .mode-toggle button { flex: 1; }
  /* Unlimited can show up to three dropdowns (difficulty/restrictions/
     region) plus New Game at once — on a narrow screen that's too much
     for one unbroken row, so it wraps: dropdowns flow two-ish per line,
     and New Game always gets its own full-width row as a clear, large
     tap target rather than fighting them for space. */
  .primary-actions { flex-wrap: wrap; width: 100%; }
  .primary-actions #newGameBtn { flex: 1 1 100%; }
  .difficulty-picker { flex: 1 1 130px; min-width: 0; }
  .icon-buttons { justify-content: space-between; }
  .icon-btn { width: 42px; height: 42px; }
}

/* ---------- Restrictions ---------- */

.restrictions-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface-raised));
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--hairline-strong));
  border-radius: 12px;
  padding: 12px 18px;
}

/* `.restrictions-banner`'s own `display: flex` ties in specificity with the
   browser default `[hidden] { display: none }` — and author styles win
   ties over the UA stylesheet, so without this the banner would show
   (empty) even when the `hidden` attribute is set. */
.restrictions-banner[hidden] { display: none; }

/* ---------- Catch-up banner (missed-yesterday replay) ---------- */

.catch-up-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  background: color-mix(in srgb, var(--teal) 10%, var(--surface-raised));
  border: 1px solid color-mix(in srgb, var(--teal) 32%, var(--hairline-strong));
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
}

.catch-up-banner[hidden] { display: none; }

/* ---------- Install prompt banner (result modal) ---------- */

.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  background: color-mix(in srgb, var(--gold) 12%, var(--surface-raised));
  border: 1px solid color-mix(in srgb, var(--gold) 36%, var(--hairline-strong));
  border-radius: 12px;
  padding: 10px 16px;
  margin-top: 14px;
  font-size: 13.5px;
  font-weight: 600;
}

.install-banner[hidden] { display: none; }

.install-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

.restrictions-label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger);
  white-space: nowrap;
}

.restrictions-list { display: inline-flex; flex-wrap: wrap; gap: 8px; }

.restriction-chip {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--hairline-strong));
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent);
}

.panel {
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ---------- Route chain ---------- */

.route-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  margin-bottom: 16px;
  min-height: 36px;
}

.chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  font-weight: 700;
  font-size: 13.5px;
  background: var(--surface);
}

.chain-chip.start { border-color: var(--teal); color: var(--teal); }
.chain-chip.visited { border-color: var(--hairline-strong); }
.chain-chip.current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.chain-chip.dest { border-style: dashed; color: var(--text-muted); }
.chain-chip.dest.reached { border-style: solid; border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.chain-chip.blank {
  border-style: dashed;
  color: var(--text-muted);
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  min-width: 2.2em;
  justify-content: center;
}

.chain-arrow { color: var(--text-muted); font-size: 13px; }

/* ---------- Input console ---------- */

.move-form { position: relative; display: flex; gap: 8px; }

.move-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--text);
}

.move-input::placeholder { color: var(--text-muted); font-weight: 500; }
.move-input:focus { border-color: var(--teal); outline: none; }

.move-submit {
  border: none;
  background: var(--ink-900);
  color: var(--paper-050);
  font-weight: 700;
  border-radius: 10px;
  padding: 0 20px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .move-submit { background: var(--accent); color: var(--accent-ink); }
}
:root[data-theme="dark"] .move-submit { background: var(--accent); color: var(--accent-ink); }

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 88px;
  background: var(--surface-raised);
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 5;
}

.suggestions:empty { display: none; }

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
}

.suggestion-item:hover, .suggestion-item.active { background: var(--surface); }

.feedback {
  margin-top: 12px;
  min-height: 24px;
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback.ok { color: var(--ok); }
.feedback.err { color: var(--danger); }
.feedback.info { color: var(--teal); }
.feedback .connection-tag {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  padding: 1px 8px;
}

.console-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.hint-log {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.wrong-guesses {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wrong-guesses:empty { display: none; }

.wrong-guesses-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 2px;
}

.wrong-guess-chip {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--hairline-strong));
  border-radius: 999px;
  padding: 3px 10px;
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--danger) 55%, transparent);
}

/* ---------- Map panel ---------- */

.map-panel { padding: 12px; }

.map-svg {
  width: 100%;
  height: 420px;
  display: block;
  background: color-mix(in srgb, var(--teal) 10%, var(--surface));
  border-radius: 8px;
  z-index: 0;
}

@media (max-width: 760px) {
  .map-svg { height: 300px; }
}

/* Leaflet chrome, restyled to match the ticket/console design language. */

.leaflet-control-zoom a {
  background: var(--surface-raised) !important;
  color: var(--text) !important;
  border-color: var(--hairline-strong) !important;
}
.leaflet-control-zoom a:hover { border-color: var(--accent) !important; }
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--surface-raised) 85%, transparent) !important;
  color: var(--text-muted) !important;
  font-size: 10.5px !important;
}
.leaflet-control-attribution a { color: var(--text-muted) !important; }
.leaflet-tooltip {
  background: var(--surface-raised) !important;
  color: var(--text) !important;
  border: 1px solid var(--hairline-strong) !important;
  font-family: "Manrope", sans-serif !important;
  font-weight: 700 !important;
  font-size: 12.5px !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-tooltip-top::before { border-top-color: var(--hairline-strong) !important; }

/* Route pins */

.map-pin { background: none; border: none; }
.map-pin-dot {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--surface-raised);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.pin-start .map-pin-dot { background: var(--teal); }
.pin-visited .map-pin-dot { background: var(--accent); }
.pin-dest-pending .map-pin-dot { background: transparent; border-style: dashed; border-color: var(--text-muted); box-shadow: none; }
.pin-dest-reached .map-pin-dot { background: var(--ok); }

/* A physical-relief basemap reads naturally in light mode; invert + shift
   hue so it sits comfortably on the dark palette instead of glowing white. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.8);
  }
}
:root[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.8);
}

.map-caption {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 10px 6px 2px;
  line-height: 1.5;
}

/* ---------- Modals ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  position: relative;
  background: var(--surface-raised);
  border-radius: 16px;
  border: 1px solid var(--hairline);
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow);
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confetti-fall var(--duration) var(--delay) ease-in forwards;
}

@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--drift), 340px) rotate(var(--rotate)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-piece { display: none; }
}

.modal h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 24px;
  margin: 0 0 14px;
}

.modal-close-row { display: flex; justify-content: flex-end; margin-bottom: -6px; }

.modal p, .modal li { line-height: 1.6; color: var(--text); font-size: 14.5px; }
.modal .muted { color: var(--text-muted); }

.rule-block {
  border-left: 3px solid var(--hairline-strong);
  padding-left: 14px;
  margin: 16px 0;
}

.rule-block.land { border-color: var(--ok); }
.rule-block.sea { border-color: var(--teal); }

.rule-title { font-weight: 800; margin-bottom: 4px; }

/* Stats grid */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.stat-tile {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
}

.stat-value {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 22px;
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 2px;
}

/* Achievements */

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 480px) { .achievements-grid { grid-template-columns: 1fr; } }

.achievement-tile {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: opacity 0.15s ease;
}

.achievement-tile.locked {
  opacity: 0.45;
  filter: grayscale(1);
}

.achievement-icon { font-size: 24px; line-height: 1; }

.achievement-title { font-weight: 800; font-size: 14px; }

.achievement-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }

.achievement-unlock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.achievement-unlock-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ok);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  font-size: 13.5px;
  line-height: 1.5;
}

.achievement-unlock-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }

.achievement-unlock-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ok);
}

/* Custom mode picker */

.custom-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0;
}

@media (max-width: 480px) { .custom-picker { grid-template-columns: 1fr; } }

.picker-field { position: relative; display: flex; flex-direction: column; gap: 6px; }
.picker-field label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

.custom-error { color: var(--danger); font-size: 13.5px; font-weight: 600; min-height: 18px; }

/* Result modal */

.result-headline {
  font-family: "Fraunces", Georgia, serif;
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 4px;
}

.result-route {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0;
  line-height: 1.7;
  word-break: break-word;
}

.result-highlight-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.result-highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 12px;
  padding: 8px 20px;
  line-height: 1.15;
}

.result-highlight-number {
  font-family: "Fraunces", Georgia, serif;
  font-size: 44px;
  font-weight: 700;
}

.result-highlight-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.75;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .result-highlight { color: var(--accent-ink); }
}

.result-meta { display: flex; flex-direction: column; gap: 2px; }
.result-meta .big { font-size: 18px; font-weight: 700; }

.perfect-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ok);
}

.daily-next-note {
  font-size: 12.5px;
  margin: 14px 0 0;
  font-family: "IBM Plex Mono", monospace;
}

.modal-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-row input { margin: 0; }

/* Move distribution chart */

.dist-section { margin-top: 18px; }

.dist-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.dist-empty { font-size: 13px; }

.trend-svg {
  width: 100%;
  height: 56px;
  color: var(--teal);
  display: block;
}

.trend-caption {
  font-size: 11.5px;
  margin-top: 6px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.dist-label {
  width: 66px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.dist-bar-track {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
  height: 20px;
}

.dist-bar {
  display: block;
  height: 100%;
  background: var(--text-muted);
  border-radius: 4px 0 0 4px;
}

.dist-bar-current { background: var(--accent); }

.dist-count {
  width: 26px;
  text-align: right;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .stub, .route-line, .map-marker { transition: all 0.2s ease; }
  .dist-bar { transition: width 0.4s ease; }

  @keyframes result-pop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
  }
  .result-highlight { animation: result-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
  .result-headline { animation: result-pop 0.35s ease-out both; }
}
