/* ════════════════════════════════════════════════════════════════════
   style_v2.css — CityFox UI  (design migration, part 2)
   Tokens: inferred from Figma lzGDJKeEclZr9k9FbHfssT screenshots.
   Full token extraction blocked by Figma Starter rate limit —
   re-run get_variable_defs once plan upgraded.
   Undesigned zones: see DESIGN.md § Undesigned Components
   ════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
  /* Shell — from Figma (light) */
  --c-bg:              #ffffff;
  --c-surface:         #ffffff;
  --c-header-bg:       #ffffff;
  --c-header-border:   #e5e7eb;
  --c-text-primary:    #111827;
  --c-text-secondary:  #6b7280;
  --c-text-placeholder:#9ca3af;
  --c-accent:          #f97316;        /* CityFox brand orange — single source of truth */
  --c-accent-hover:    #ea6c0a;
  --c-waypoint-b:      #a855f7;        /* B-pin / round-route purple */
  --c-input-bg:        #ffffff;
  --c-input-border:    #d1d5db;
  --c-input-focus:     #f97316;
  --c-divider:         #e5e7eb;
  --c-danger:          #ef4444;

  /* Layout — from Figma */
  --sidebar-width:     352px;
  --header-height:     68px;

  /* Undesigned zones — dark fallback from v1, pending Figma screens */
  --c-bg-dark:         #0f0f1a;
  --c-surface-dark:    #1a1a2e;
  --c-border-dark:     #2a2a4a;
  --c-text-dark:       #e0e0e0;
  --c-muted-dark:      #888;
  --c-blue:            #6ab0f5;
  --c-red:             #e94560;
  --c-field-bg:        #12122a;
  --c-field-border:    #333;

  /* Quiz parchment — implicit design, kept from v1 */
  --c-parchment:       #f5f0e8;
  --c-parchment-text:  #1a1208;
  --c-parchment-brown: #7a5c2e;
  --c-parchment-gold:  #c9a96e;
  --c-parchment-green: #4a7c3f;

  /* ── Typography tokens (see .claude/skills/frontend-typography/SKILL.md) ──
     Lexend 700 for headings, Work Sans 400/600 for body. The .t-* classes
     defined below are the only place font-size / font-weight / line-height
     should be set across the codebase. */
  --t-font-heading: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --t-font-body:    "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --t-h1-size: 64px;   --t-h1-lh: 72px;   --t-h1-ps: 64px;   --t-h1-ls: -0.03em;
  --t-h2-size: 48px;   --t-h2-lh: 56px;   --t-h2-ps: 48px;   --t-h2-ls: -0.02em;
  --t-h3-size: 36px;   --t-h3-lh: 44px;   --t-h3-ps: 32px;   --t-h3-ls: -0.01em;
  --t-h4-size: 32px;   --t-h4-lh: 36px;   --t-h4-ps: 20px;   --t-h4-ls: -0.01em;
  --t-h5-size: 24px;   --t-h5-lh: 28px;   --t-h5-ps: 20px;   --t-h5-ls: 0;
  --t-h6-size: 20px;   --t-h6-lh: 24px;   --t-h6-ps: 20px;   --t-h6-ls: 0;
  --t-h7-size: 16px;   --t-h7-lh: 20px;   --t-h7-ps: 20px;   --t-h7-ls: 0;

  --t-body-lg-size:  20px;  --t-body-lg-lh:  32px;
  --t-body-md-size:  16px;  --t-body-md-lh:  20px;
  --t-body-sm-size:  14px;  --t-body-sm-lh:  16px;
  --t-body-xsm-size: 12px;  --t-body-xsm-lh: 16px;
  --t-body-ps:       20px;

  --t-weight-bold:     700;
  --t-weight-semibold: 600;
  --t-weight-regular:  400;

  /* ── Control & elevation tokens — repeated values, kept single-source.
     Add to / change here rather than in component CSS to prevent drift. */
  --ctrl-radius:        10px;     /* default control corner radius (inputs, buttons, popup btns) */
  --ctrl-radius-sm:      6px;     /* compact controls (e.g. length-value box) */
  --ctrl-pad-y:          8px;
  --ctrl-pad-x:         10px;
  --ctrl-gap:           10px;
  --bg-control-hover:   #f3f4f6;  /* secondary btn / popup btn hover */
  --bg-toggle-off:      #d1d5db;  /* off-state track for toggles */
  --shadow-thumb:       0 1px 3px rgba(0,0,0,0.3);   /* slider thumbs */
  --shadow-marker:      0 2px 4px rgba(0,0,0,0.4);   /* POI markers */
  --shadow-pin:         0 2px 4px rgba(0,0,0,0.35);  /* teardrop pins */
  --shadow-popup:       0 6px 18px rgba(0,0,0,0.18); /* leaflet waypoint popup */
  --shadow-panel:       0 -6px 24px rgba(0,0,0,0.16);/* bottom route panel */
}

/* ── Typography classes — type-only by default, no margins.
   Paragraph spacing is opt-in via the .t-flow modifier (see below).
   This avoids accidentally inflating inline labels (button text,
   spans inside flex layouts) with a default 20px bottom margin. */
.t-h1, .t-h2, .t-h3, .t-h4, .t-h5, .t-h6, .t-h7 {
  font-family: var(--t-font-heading);
  font-weight: var(--t-weight-bold);
  margin: 0;
}
.t-h1 { font-size: var(--t-h1-size); line-height: var(--t-h1-lh); letter-spacing: var(--t-h1-ls); --t-flow-ps: var(--t-h1-ps); }
.t-h2 { font-size: var(--t-h2-size); line-height: var(--t-h2-lh); letter-spacing: var(--t-h2-ls); --t-flow-ps: var(--t-h2-ps); }
.t-h3 { font-size: var(--t-h3-size); line-height: var(--t-h3-lh); letter-spacing: var(--t-h3-ls); --t-flow-ps: var(--t-h3-ps); }
.t-h4 { font-size: var(--t-h4-size); line-height: var(--t-h4-lh); letter-spacing: var(--t-h4-ls); --t-flow-ps: var(--t-h4-ps); }
.t-h5 { font-size: var(--t-h5-size); line-height: var(--t-h5-lh); letter-spacing: var(--t-h5-ls); --t-flow-ps: var(--t-h5-ps); }
.t-h6 { font-size: var(--t-h6-size); line-height: var(--t-h6-lh); letter-spacing: var(--t-h6-ls); --t-flow-ps: var(--t-h6-ps); }
.t-h7 { font-size: var(--t-h7-size); line-height: var(--t-h7-lh); letter-spacing: var(--t-h7-ls); --t-flow-ps: var(--t-h7-ps); }

.t-body-lg, .t-body-md, .t-body-sm, .t-body-xsm {
  font-family: var(--t-font-body);
  letter-spacing: 0;
  margin: 0;
  --t-flow-ps: var(--t-body-ps);
}
.t-body-lg, .t-body-md  { font-weight: var(--t-weight-semibold); }
.t-body-sm, .t-body-xsm { font-weight: var(--t-weight-regular); }
.t-body-lg  { font-size: var(--t-body-lg-size);  line-height: var(--t-body-lg-lh);  }
.t-body-md  { font-size: var(--t-body-md-size);  line-height: var(--t-body-md-lh);  }
.t-body-sm  { font-size: var(--t-body-sm-size);  line-height: var(--t-body-sm-lh);  }
.t-body-xsm { font-size: var(--t-body-xsm-size); line-height: var(--t-body-xsm-lh); }

/* Paragraph spacing — opt-in. Picks up --t-flow-ps from the type class. */
.t-flow      { margin-bottom: var(--t-flow-ps, var(--t-body-ps)); }
.t-link      { text-decoration: underline; }
.t-semibold  { font-weight: var(--t-weight-semibold); }
.t-regular   { font-weight: var(--t-weight-regular); }

/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-text-primary);
}

/* ── Shared keyframes ───────────────────────────────────────────── */
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse    { 0%,100%{opacity:1} 50%{opacity:0.6} }
@keyframes unlockPop{ 0%{opacity:0;transform:scale(0.93)} 60%{transform:scale(1.03)} 100%{opacity:1;transform:scale(1)} }

/* ── Header ─────────────────────────────────────────────────────── */
header {
  background: var(--c-header-bg);
  border-bottom: 1px solid var(--c-header-border);
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 1000;
}
header h1 {
  font-size: 1.1rem; font-weight: 700; color: var(--c-text-primary);
  white-space: nowrap; letter-spacing: 0.02em; flex-shrink: 0;
}

.settings-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 20px;
  background: var(--c-surface); border: 1px solid var(--c-input-border);
  color: var(--c-text-secondary); font-size: 0.75rem; cursor: pointer;
  white-space: nowrap; flex-shrink: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
  transition: border-color 0.15s;
}
.settings-pill:hover { border-color: var(--c-accent); color: var(--c-text-primary); }
.settings-pill .pill-icon { font-size: 0.85rem; flex-shrink: 0; }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; flex-wrap: nowrap; }

.btn-logout {
  flex-shrink: 0;
  background: transparent; border: 1px solid var(--c-input-border); color: var(--c-text-secondary);
  padding: 5px 9px; font-size: 1rem; line-height: 1;
}
.btn-logout:hover { border-color: var(--c-danger); color: var(--c-danger); }

.coins-badge {
  color: #b45309; font-size: 0.78rem; padding: 4px 7px;
  background: rgba(180,83,9,0.08); border: 1px solid rgba(180,83,9,0.2);
  border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.coins-badge.gems-clickable { cursor: pointer; }

.btn-profile {
  background: none; border: 1px solid var(--c-input-border); border-radius: 50%;
  width: 32px; height: 32px; font-size: 1rem; cursor: pointer;
  color: var(--c-text-secondary); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.btn-profile:hover { background: #f3f4f6; border-color: var(--c-accent); }

.quizzes-dropdown { position: relative; display: none; }
.quizzes-dropdown.visible { display: block; }
.quizzes-btn {
  display: flex; align-items: center; gap: 5px; font-size: 0.75rem;
  padding: 5px 9px; background: var(--c-surface); color: var(--c-text-secondary);
  border: 1px solid var(--c-input-border); border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.quizzes-btn:hover { border-color: var(--c-accent); color: var(--c-text-primary); }
.quizzes-btn-label { display: inline; }
.quizzes-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--c-surface); border: 1px solid var(--c-divider);
  border-radius: 6px; min-width: 180px; z-index: 2000;
  box-shadow: 0 4px 16px rgba(0,0,0,.1); display: none;
}
.quizzes-menu.open { display: block; }
.quizzes-menu-item {
  padding: 8px 12px; font-size: 0.78rem; color: var(--c-text-secondary);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quizzes-menu-item:hover { background: #f9fafb; color: var(--c-text-primary); }

@media (max-width: 480px) {
  .quizzes-btn-label { display: none; }
  #pillLabel { display: none; }
  .btn { padding: 6px 10px; font-size: 0.75rem; }
  header h1 { font-size: 1.1rem; }
  .settings-pill { font-size: 0.7rem; padding: 4px 8px; }
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  padding: 6px 14px; border: none; border-radius: 7px; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active  { transform: scale(0.97); }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary   { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-hover); }
.btn-secondary { background: #f3f4f6; color: var(--c-text-secondary); border: 1px solid var(--c-divider); }
.btn-secondary:hover { background: #e5e7eb; }
.btn-quiz      { background: var(--c-parchment-brown); color: #fff8ee; }
.btn-icon      { padding: 6px 10px; font-size: 1rem; }

/* ── Map area ────────────────────────────────────────────────────── */
.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  transition: flex 0.25s ease;
}
#map { width: 100%; height: 100%; }

body.quiz-open { overflow: hidden; }
body.quiz-open .map-wrap { flex: 0 0 38vh; min-height: 38vh; }

/* ── Map sidebar panel (from Figma: Desktop 1-5) ─────────────────── */
.map-sidebar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--c-surface);
  border-right: 1px solid var(--c-divider);
  box-shadow: 2px 0 8px rgba(0,0,0,.06);
  z-index: 500;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.map-sidebar-heading {
  font-size: 1.25rem; font-weight: 700; color: var(--c-text-primary);
  padding: 24px 24px 16px;
}
.map-sidebar-section {
  padding: 16px 24px;
  border-bottom: 1px solid var(--c-divider);
}
.map-sidebar-label {
  font-size: 0.8rem; font-weight: 600; color: var(--c-text-primary); margin-bottom: 4px;
}
.map-sidebar-hint { font-size: 0.75rem; color: var(--c-text-secondary); margin-bottom: 10px; }
.map-sidebar-footer { padding: 16px 24px; margin-top: auto; }

/* Waypoint items (from Figma) */
.waypoint-item {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 12px;
  border: 1px solid var(--c-input-border); border-radius: 8px;
  background: var(--c-input-bg); margin-bottom: 8px;
  cursor: pointer; transition: border-color 0.15s;
}
.waypoint-item:last-child  { margin-bottom: 0; }
.waypoint-item:hover       { border-color: var(--c-accent); }
.waypoint-badge {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-text-primary); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.waypoint-text {
  font-size: 0.875rem; color: var(--c-text-placeholder);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.waypoint-text--set { color: var(--c-text-primary); }
.waypoint-connector { width: 2px; height: 12px; background: var(--c-divider); margin: 0 21px; }

/* Waypoint context popup (from Figma Desktop-2) */
.waypoint-popup {
  background: var(--c-surface); border: 1px solid var(--c-divider);
  border-radius: 12px; padding: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.12); min-width: 240px;
}
.waypoint-popup-title {
  font-size: 1rem; font-weight: 700; color: var(--c-text-primary); margin-bottom: 12px;
}
.waypoint-popup-action {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; cursor: pointer; border-radius: 6px; transition: background 0.12s;
}
.waypoint-popup-action + .waypoint-popup-action { border-top: 1px solid var(--c-divider); }
.waypoint-popup-action:hover { background: #f9fafb; }
.waypoint-popup-label { font-size: 0.875rem; color: var(--c-text-primary); }

/* Route length slider */
.route-slider { width: 100%; accent-color: var(--c-accent); }

/* Round route toggle */
.round-route-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.round-route-row label { font-size: 0.85rem; color: var(--c-text-secondary); cursor: pointer; }

/* ════════════════════════════════════════════════════════════════════
   AGGREGATED BASE CLASSES
   (shared foundations replacing duplicated selectors from v1)
   ════════════════════════════════════════════════════════════════════ */

/* ── .overlay — replaces: #auth-overlay, .modal-overlay, .profile-overlay, #feedbackOverlay ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.overlay.open   { display: flex; }
.overlay--top   { z-index: 9000; }
.overlay--cover { background: var(--c-bg-dark); z-index: 9999; } /* auth-overlay variant */

/* ── .field-input — replaces: .auth-input, inline form inputs in setting-row / submit-field / qa-pair ── */
/* TODO: auth/settings screens not in Figma yet — keeping dark palette as fallback */
.field-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--c-field-bg);
  border: 1px solid var(--c-field-border);
  border-radius: 8px;
  color: var(--c-text-dark);
  font-size: 0.875rem;
  outline: none;
}
.field-input:focus       { border-color: var(--c-blue); }
.field-input::placeholder{ color: #555; }
.field-input--sm         { font-size: 0.82rem; padding: 7px 9px; }
.field-input--area       { min-height: 72px; resize: vertical; }

/* ── .alert — replaces: .auth-alert + modifiers, .auth-error, .auth-info (legacy) ── */
.alert {
  border-radius: 6px; padding: 8px 10px;
  font-size: 0.8rem; margin-bottom: 10px;
  border-width: 1px; border-style: solid;
}
.alert--error { background: rgba(233,69,96,.15); border-color: rgba(233,69,96,.4);  color: #f08; }
.alert--info  { background: rgba(106,176,245,.1); border-color: rgba(106,176,245,.3); color: var(--c-blue); }

/* ── .status-text — replaces: .loading-text, .loading-error, .gem-error-text, .gem-empty-text ── */
.status-text         { font-size: 0.82rem; }
.status-text--muted  { color: var(--c-muted-dark); }
.status-text--error  { color: #c55; }
.status-text--warn   { color: #f0c040; }

/* ── .quiz-btn — replaces: .quiz-serif-btn + modifiers, .quiz-check-btn, .riddle-btn, .unlock-btn, .quiz-finish-btn ── */
.quiz-btn {
  border: none; border-radius: 4px; cursor: pointer;
  font-family: Georgia, serif; font-weight: bold;
  transition: background 0.2s, transform 0.1s;
}
.quiz-btn:active              { transform: scale(0.96); }
.quiz-btn--brown              { background: var(--c-parchment-brown); color: #fff8ee; }
.quiz-btn--brown:hover        { background: #5a3c1e; }
.quiz-btn--green              { background: var(--c-parchment-green); color: #fff; }
.quiz-btn--green:hover        { background: #355a2e; }
.quiz-btn--green:disabled     { background: #9a9a9a; cursor: default; }
/* Size modifiers */
.quiz-btn--check  { padding: 6px 14px;  font-size: 0.8rem; }
.quiz-btn--riddle { padding: 10px 32px; font-size: 0.92rem; letter-spacing: 0.06em; }
.quiz-btn--unlock { padding: 9px 28px;  font-size: 0.88rem; letter-spacing: 0.04em; }
.quiz-btn--finish { padding: 10px 28px; font-size: 0.9rem;  letter-spacing: 0.05em; }
.quiz-btn--unlock:disabled { background: #b0a090; cursor: not-allowed; }

/* ── .station-context — replaces: .station-context, .hidden-place-hint, .final-quiz-hint ── */
.station-context     { font-size: 0.88rem; color: #5a4020; font-style: italic; line-height: 1.5; margin-bottom: 10px; }
.station-context--lg { margin-bottom: 12px; }
.station-no-info     { font-size: 0.88rem; color: #9a7c50; }

/* ── .quiz-text-input — replaces: .quiz-text-input, .hidden-place-input, .final-quiz-input (identical) ── */
.quiz-text-input {
  width: 100%; max-width: 300px; font-size: 0.95rem;
  padding: 6px 10px; border-radius: 4px;
  border: 1px solid #4a3a2a; background: #1a1a2e; color: #e0d5c5;
}

/* ════════════════════════════════════════════════════════════════════
   BACKWARD-COMPAT ALIASES
   Keep old names working until HTML / app.js are updated.
   Each alias is a one-liner pointing at the base class values.
   Remove after HTML migration (tracked in DESIGN.md).
   ════════════════════════════════════════════════════════════════════ */
.auth-input      { width:100%; padding:9px 12px; background:var(--c-field-bg); border:1px solid var(--c-field-border); border-radius:8px; color:var(--c-text-dark); font-size:.875rem; outline:none; }
.auth-input:focus{ border-color:var(--c-blue); }
.auth-input::placeholder{ color:#555; }

.auth-error { border-radius:6px; padding:8px 10px; font-size:.8rem; margin-bottom:10px; background:rgba(233,69,96,.15); border:1px solid rgba(233,69,96,.4); color:#f08; }
.auth-info  { border-radius:6px; padding:8px 10px; font-size:.8rem; margin-bottom:10px; background:rgba(106,176,245,.1); border:1px solid rgba(106,176,245,.3); color:var(--c-blue); }

.hidden-place-input { width:100%; max-width:300px; font-size:.95rem; padding:6px 10px; border-radius:4px; border:1px solid #4a3a2a; background:#1a1a2e; color:#e0d5c5; }
.final-quiz-input   { width:100%; max-width:300px; font-size:.95rem; padding:6px 10px; border-radius:4px; border:1px solid #4a3a2a; background:#1a1a2e; color:#e0d5c5; }

.hidden-place-hint { font-size:.88rem; color:#5a4020; font-style:italic; margin-bottom:12px; line-height:1.5; }
.final-quiz-hint   { font-size:.88rem; color:#5a4020; font-style:italic; margin-bottom:12px; line-height:1.5; }

/* quiz button old names → new base (app.js outputs these class names) */
.quiz-serif-btn        { border:none; border-radius:4px; cursor:pointer; font-family:Georgia,serif; font-weight:bold; transition:background .2s,transform .1s; }
.quiz-serif-btn:active { transform:scale(.96); }
.quiz-serif-btn--brown { background:var(--c-parchment-brown); color:#fff8ee; }
.quiz-serif-btn--brown:hover { background:#5a3c1e; }
.quiz-serif-btn--green { background:var(--c-parchment-green); color:#fff; }
.quiz-serif-btn--green:hover { background:#355a2e; }
.quiz-serif-btn--green:disabled { background:#9a9a9a; cursor:default; }
.quiz-check-btn  { padding:6px 14px;  font-size:.8rem;  background:var(--c-parchment-brown); color:#fff8ee; border:none; border-radius:4px; cursor:pointer; font-family:Georgia,serif; font-weight:bold; }
.quiz-check-btn:hover { background:#5a3c1e; }
.riddle-btn      { padding:10px 32px; font-size:.92rem; letter-spacing:.06em; background:var(--c-parchment-brown); color:#fff8ee; border:none; border-radius:4px; cursor:pointer; font-family:Georgia,serif; font-weight:bold; }
.riddle-btn:hover { background:#5a3c1e; }
.riddle-btn:active { transform:scale(.96); }
.unlock-btn      { padding:9px 28px;  font-size:.88rem; letter-spacing:.04em; background:var(--c-parchment-green); color:#fff; border:none; border-radius:4px; cursor:pointer; font-family:Georgia,serif; font-weight:bold; transition:background .2s,transform .1s; }
.unlock-btn:hover { background:#355a2e; }
.unlock-btn:disabled { background:#b0a090; cursor:not-allowed; }
.unlock-btn:not(:disabled):active { transform:scale(.96); }
.quiz-finish-btn { padding:10px 28px; font-size:.9rem;  letter-spacing:.05em; background:var(--c-parchment-green); color:#fff; border:none; border-radius:4px; cursor:pointer; font-family:Georgia,serif; font-weight:bold; transition:background .2s,transform .1s; }
.quiz-finish-btn:hover { background:#355a2e; }
.quiz-finish-btn:disabled { background:#9a9a9a; cursor:default; }

.loading-text  { color:#666; font-size:.85rem; }
.loading-error { color:#c55; font-size:.85rem; }
.gem-error-text{ color:#f08; font-size:.82rem; }
.gem-empty-text{ color:#999; font-size:.82rem; }

/* ════════════════════════════════════════════════════════════════════
   UNDESIGNED ZONES  (dark v1 fallback — TODO: get Figma screens)
   ════════════════════════════════════════════════════════════════════ */

/* ── Auth overlay ── */
#auth-overlay {
  position: fixed; inset: 0;
  background: var(--c-bg-dark);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
#auth-overlay.hidden { display: none; }

.auth-card {
  background: var(--c-surface-dark); border: 1px solid var(--c-border-dark);
  border-radius: 12px; padding: 32px 28px; width: 100%; max-width: 360px;
}
.auth-card--narrow { max-width: 340px; width: 92%; }
.auth-card h2 { color: #fff; font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; text-align: center; }
.auth-card .subtitle { color: var(--c-muted-dark); font-size: .8rem; text-align: center; margin-bottom: 24px; }
.auth-card .subtitle.confirm-subtitle { margin-bottom: 16px; }

.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--c-border-dark); }
.auth-tab { flex:1; padding:8px; text-align:center; color:var(--c-muted-dark); font-size:.85rem; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; transition:color .15s,border-color .15s; }
.auth-tab.active { color: var(--c-blue); border-bottom-color: var(--c-blue); }

.auth-btn { width:100%; padding:10px; border:none; border-radius:6px; background:var(--c-blue); color:var(--c-bg-dark); font-size:.875rem; font-weight:700; cursor:pointer; transition:background .15s; margin-top:4px; }
.auth-btn:hover    { background: #8ec5ff; }
.auth-btn:disabled { background: var(--c-field-border); color: #666; cursor: default; }

.auth-btn-google { width:100%; padding:9px; border:1px solid #444; border-radius:6px; background:transparent; color:#ccc; font-size:.85rem; cursor:pointer; margin-top:10px; transition:border-color .15s; }
.auth-btn-google:hover { border-color: #888; color: #fff; }

.auth-divider  { text-align:center; color:#555; font-size:.75rem; margin:12px 0; }
.auth-spinner  { width:36px; height:36px; border:3px solid var(--c-border-dark); border-top-color:var(--c-blue); border-radius:50%; animation:spin .75s linear infinite; margin:0 auto 14px; }
#auth-boot-loading { text-align:center; padding:16px 0 8px; color:var(--c-muted-dark); font-size:.85rem; }

.city-wrap { position:relative; margin-bottom:12px; }
.city-wrap .auth-input { margin-bottom: 0; }
.city-drop { position:absolute; left:0; right:0; top:calc(100% + 2px); z-index:9999; background:#1e1e3a; border:1px solid #3a3a5a; border-radius:6px; max-height:200px; overflow-y:auto; display:none; box-shadow:0 8px 24px rgba(0,0,0,.5); }
.city-drop.open { display: block; }
.city-opt { padding:8px 12px; font-size:.85rem; color:#ccc; cursor:pointer; border-bottom:1px solid var(--c-border-dark); }
.city-opt:last-child { border-bottom: none; }
.city-opt:hover, .city-opt.active { background:#2a2a5a; color:#fff; }

/* ── Toast notifications ── */
#notifyContainer { position:fixed; top:60px; left:50%; transform:translateX(-50%); z-index:9999; display:flex; flex-direction:column; align-items:center; gap:8px; pointer-events:none; }
.toast { pointer-events:auto; min-width:260px; max-width:420px; padding:11px 16px; border-radius:6px; font-size:.82rem; line-height:1.45; color:var(--c-text-dark); box-shadow:0 4px 18px rgba(0,0,0,.5); display:flex; align-items:flex-start; gap:10px; animation:toastIn .2s ease; cursor:pointer; }
.toast.info    { background:#1e3a5f; border-left:4px solid #4a9eff; }
.toast.success { background:#1a3d2e; border-left:4px solid #4caf50; }
.toast.warning { background:#3d2e0a; border-left:4px solid #f0c040; color:#f5e0a0; }
.toast.error   { background:#3d1010; border-left:4px solid var(--c-red); color:#f5c0c0; }
.toast-icon    { flex-shrink:0; font-size:1rem; margin-top:1px; }
.toast-close   { margin-left:auto; flex-shrink:0; opacity:.6; font-size:1rem; line-height:1; }
.toast-close:hover { opacity: 1; }
.poll-spinner  { display:inline-block; width:11px; height:11px; border:2px solid var(--c-field-border); border-top-color:var(--c-red); border-radius:50%; animation:spin .8s linear infinite; margin-right:5px; vertical-align:middle; }

/* ── Add node FAB ── */
.fab-add-node { position:fixed; bottom:88px; right:16px; z-index:900; width:48px; height:48px; border-radius:50%; background:var(--c-accent); border:none; color:#fff; font-size:1.5rem; line-height:1; cursor:pointer; box-shadow:0 4px 16px rgba(249,115,22,.4); display:none; align-items:center; justify-content:center; }
.fab-add-node:hover    { background: var(--c-accent-hover); }
.fab-add-node.visible  { display: flex; }

/* ── Modals ── */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:2000; align-items:center; justify-content:center; padding:16px; }
.modal-overlay.open { display: flex; }
.modal-card { background:#13131f; border:1px solid var(--c-border-dark); border-radius:14px; padding:20px; width:100%; max-width:360px; box-shadow:0 20px 60px rgba(0,0,0,.6); }
.modal-card h3 { font-size:.85rem; letter-spacing:.1em; text-transform:uppercase; color:var(--c-blue); margin-bottom:16px; }
.modal-card--profile  { max-width:480px; max-height:90vh; overflow-y:auto; }
.modal-card--featured { max-width:480px; width:92%; }
.modal-close  { float:right; background:none; border:none; color:#666; font-size:1.2rem; cursor:pointer; line-height:1; margin-top:-2px; }
.modal-close:hover { color: #ccc; }
.modal-footer { margin-top:16px; display:flex; justify-content:flex-end; }

/* ── Settings rows ── */
.setting-row { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.setting-row label { font-size:.78rem; color:#999; width:90px; flex-shrink:0; }
.setting-row select, .setting-row input[type=number] { flex:1; padding:7px 10px; background:var(--c-field-bg); border:1px solid var(--c-field-border); border-radius:8px; color:#eee; font-size:.85rem; }
.setting-row .unit { font-size:.75rem; color:#666; flex-shrink:0; }
.hint-text { font-size:.75rem; color:#9a7c50; }

/* Submit node modal: migrated to cf-modal — see component-library.css.
   .qa-pair flex layout for JS-generated rows lives in app.css. */
.audio-rec-btn.recording { background:var(--c-red) !important; animation:pulse 1s infinite; }
.label-optional { color:#555; font-size:.7rem; }

/* ── Featured routes ── */
/* .route-card: layout moved to app.css (uses cf-* tokens). */
/* .route-card-price / .route-card-btn: see app.css. */
.featured-routes-list { margin-top:14px; display:flex; flex-direction:column; gap:10px; }

/* ── Gem store ── */
.gem-store-notice  { color:#999; font-size:.82rem; margin-top:8px; }
.gem-store-list    { margin-top:16px; display:flex; flex-direction:column; gap:10px; }
.gem-store-item    { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:10px 12px; background:var(--c-field-bg); border:1px solid var(--c-field-border); border-radius:10px; }
.gem-store-item-info  { flex:1; }
.gem-store-item-title { color:#fff; font-weight:700; font-size:.9rem; }
.gem-store-item-desc  { color:#999; font-size:.78rem; margin-top:4px; }

/* ── Coat of arms ── */
.coat-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:3px; width:72px; height:72px; border-radius:6px; overflow:hidden; border:2px solid var(--c-field-border); flex-shrink:0; }
.coat-grid--complete { border-color:var(--c-blue); box-shadow:0 0 8px rgba(106,176,245,.4); }
.coat-part { background:#1e1e3a; position:relative; overflow:hidden; }
.coat-part img { position:absolute; object-fit:cover; }
.coat-part.owned img { opacity:1; }
.coat-part:not(.owned) img { opacity:0; }
.coat-part:not(.owned)::after { content:''; position:absolute; inset:0; background:#1a1a2e; }
.coat-label { font-size:.65rem; color:var(--c-muted-dark); text-align:center; margin-top:4px; text-transform:capitalize; }
.coat-item  { display:flex; flex-direction:column; align-items:center; }
.city-pill  { background:#1e2a3a; border:1px solid #2a4a6a; border-radius:12px; padding:3px 10px; font-size:.78rem; color:var(--c-blue); }

/* ── Profile modal ── */
.profile-section        { margin-top:16px; }
.profile-section--coat  { margin-bottom:8px; }
.profile-section-title  { font-size:.78rem; color:var(--c-muted-dark); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
.profile-section-body   { font-size:.85rem; color:#ccc; }
.profile-cities-list    { display:flex; flex-wrap:wrap; gap:6px; }
.profile-coats-list     { display:flex; flex-wrap:wrap; gap:14px; }
.profile-empty          { color:#555; font-size:.82rem; }
.profile-overlay        { position:fixed; inset:0; background:rgba(0,0,0,.7); z-index:9000; display:none; align-items:center; justify-content:center; }
.profile-overlay.open   { display: flex; }
.welcome-heading        { margin-bottom:6px; }

/* Feedback modal: migrated to cf-modal — see component-library.css. */

/* ── Leaflet ── */
.map-pin-start { background: #4caf50; }
.map-pin-end   { background: var(--c-red); }
.leaflet-control-attribution { display: none !important; }

/* ── City popup ── */
.city-popup       { min-width:180px; }
.city-popup-title { font-weight:700; margin-bottom:8px; }
.city-popup-btn   { width:100%; }
.city-popup-btn--target { margin-bottom:8px; }

/* ── Leaderboard ── */
.leaderboard-table     { width:100%; border-collapse:collapse; font-size:.8rem; }
.leaderboard-row       { color:#bbb; }
.leaderboard-row--me   { color:var(--c-blue); font-weight:700; }
.leaderboard-cell-rank { padding:2px 6px 2px 0; width:24px; }
.leaderboard-cell-name { padding:2px 0; }
.leaderboard-cell-score{ padding:2px 0 2px 8px; text-align:right; color:var(--c-muted-dark); }
.leaderboard-ellipsis  { color:#555; }
.leaderboard-ellipsis td { padding:2px 0; font-size:.7rem; }

/* ── Misc utility ── */
.nimda-badge { position:fixed; bottom:60px; left:12px; z-index:9999; background:var(--c-red); color:#fff; font-size:.7rem; font-weight:700; padding:4px 10px; border-radius:6px; cursor:pointer; letter-spacing:.08em; }
.loot-layer  { position:fixed; inset:0; pointer-events:none; z-index:9998; }

/* ════════════════════════════════════════════════════════════════════
   QUIZ SECTION  (warm parchment — implicit design, kept from v1)
   ════════════════════════════════════════════════════════════════════ */
#quizSection {
  display: none; flex: 1; min-height: 0;
  overflow-y: scroll; -webkit-overflow-scrolling: touch;
  background: var(--c-parchment); color: var(--c-parchment-text);
  font-family: Georgia, 'Times New Roman', serif;
}
body.quiz-open #quizSection { display: block; }

.quiz-page   { max-width:760px; margin:0 auto; padding:32px 20px; }
.quiz-cover  { text-align:center; padding:40px 24px 32px; border-bottom:3px double var(--c-parchment-brown); margin-bottom:36px; }
.quiz-cover .eyebrow { font-size:.8rem; letter-spacing:.2em; text-transform:uppercase; color:var(--c-parchment-brown); margin-bottom:12px; }
.quiz-cover h2 { font-size:1.6rem; font-weight:bold; color:var(--c-parchment-text); margin-bottom:10px; }
.quiz-cover .route-info { display:inline-block; border:1px solid var(--c-parchment-brown); padding:6px 16px; font-size:.82rem; color:#5a4020; border-radius:3px; background:#fff8ee; }

.quiz-station { margin-bottom:44px; }
.quiz-station-header { display:flex; align-items:baseline; gap:12px; margin-bottom:8px; }
.quiz-station-num  { background:var(--c-parchment-brown); color:#fff8ee; font-size:.7rem; font-weight:bold; letter-spacing:.15em; text-transform:uppercase; padding:4px 12px; border-radius:2px; }
.quiz-station-num--hidden { background:#4a3070; }
.quiz-station-num--final  { background:#2e6b2e; }
.quiz-station-loc  { font-size:.76rem; color:var(--c-parchment-brown); font-style:italic; margin-bottom:14px; }
.quiz-hr { border:none; border-top:2px solid var(--c-parchment-gold); margin:32px 0 24px; }

.quiz-task-box   { background:#fff8ee; border:1px solid var(--c-parchment-gold); border-radius:4px; padding:14px 18px; margin-top:12px; }
.quiz-task-label { font-size:.7rem; letter-spacing:.15em; text-transform:uppercase; color:var(--c-parchment-brown); font-weight:bold; margin-bottom:8px; }
.quiz-task-q     { font-size:.98rem; font-weight:bold; color:var(--c-parchment-text); margin-bottom:14px; line-height:1.5; }

.quiz-answer-row  { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:4px; }
.quiz-letter-cells{ display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
.quiz-cell        { width:32px; height:38px; text-align:center; font-size:1rem; font-family:Georgia,serif; font-weight:bold; border:2px solid var(--c-parchment-brown); border-radius:4px; background:#fff; color:var(--c-parchment-text); text-transform:uppercase; padding:0; }
.quiz-cell:focus  { outline:none; border-color:var(--c-parchment-text); background:#fff8ee; }
.quiz-cell.prefilled { background:#fff8ee; color:var(--c-parchment-brown); border-color:var(--c-parchment-gold); cursor:default; }
.quiz-cell-space  { width:10px; display:inline-block; }
.quiz-cell-literal{ width:18px; height:38px; text-align:center; line-height:38px; font-size:1rem; font-family:Georgia,serif; font-weight:bold; color:var(--c-parchment-brown); display:inline-block; }

.quiz-rotate-btn  { background:none; border:1px solid var(--c-parchment-gold); border-radius:50%; width:26px; height:26px; cursor:pointer; font-size:1rem; color:var(--c-parchment-brown); line-height:1; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.quiz-rotate-btn:hover { background: #f5e9d0; }

.quiz-choices { display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.quiz-choice-label { display:flex; align-items:center; gap:10px; padding:8px 12px; border:1px solid var(--c-parchment-gold); border-radius:4px; cursor:pointer; font-size:.92rem; color:var(--c-parchment-text); background:#fffdf7; transition:background .15s; }
.quiz-choice-label:hover { background: #f5e9d0; }
.quiz-choice-label input[type="radio"] { accent-color:var(--c-parchment-brown); width:16px; height:16px; flex-shrink:0; }

.quiz-feedback       { margin-top:8px; padding:6px 10px; border-radius:3px; font-size:.85rem; display:none; }
.quiz-feedback.correct { background:#d4edda; color:#155724; display:block; }
.quiz-feedback.wrong   { background:#f8d7da; color:#721c24; display:block; }

.quiz-footer { margin-top:36px; padding-top:14px; border-top:1px solid var(--c-parchment-gold); text-align:center; font-size:.72rem; color:#9a7c50; font-style:italic; }

.quiz-gps-lock { background:#fff8ee; border:1px dashed var(--c-parchment-gold); border-radius:4px; padding:20px 18px; margin-top:12px; text-align:center; color:var(--c-parchment-brown); font-size:.88rem; line-height:1.6; }
.quiz-gps-lock .gps-icon { font-size:1.8rem; display:block; margin-bottom:6px; }
.quiz-gps-dist { font-size:.78rem; color:#9a7c50; margin-top:4px; }

.quiz-finish-row   { text-align:center; margin:28px 0 8px; }
.unlock-reveal     { animation:unlockPop .35s ease both; }
.quiz-riddle-hint  { margin-top:6px; font-size:.8rem; color:#7c4a1e; font-style:italic; }
.quiz-riddle-reveal{ text-align:center; margin-top:14px; }

.quiz-vote-row  { display:flex; align-items:center; gap:10px; margin-top:10px; padding-top:8px; border-top:1px solid #e8d8b8; }
.quiz-vote-btn  { background:none; border:1px solid var(--c-parchment-gold); border-radius:4px; padding:3px 10px; cursor:pointer; font-size:.8rem; color:var(--c-parchment-brown); transition:background .1s; }
.quiz-vote-btn:hover { background: #f5e9d0; }
.quiz-vote-btn.voted { background:#f5e9d0; font-weight:bold; }
.quiz-vote-count    { font-size:.75rem; color:#9a7c50; }
.vote-helpful-label { font-size:.75rem; color:#9a7c50; }
.quiz-report-btn    { margin-left:auto; background:none; border:none; cursor:pointer; font-size:.75rem; color:#b0906a; padding:2px 4px; opacity:.7; }
.quiz-report-btn:hover { opacity:1; color:#7a3010; }

.hidden-place-answer-row  { flex-wrap:wrap; gap:8px; }
.hidden-place-context     { margin-top:10px; font-size:.88rem; color:#5a4020; font-style:italic; line-height:1.5; background:#fff3e0; border-left:3px solid var(--c-parchment-gold); padding:8px 12px; border-radius:2px; }
.final-quiz-question      { margin-bottom:12px; }
.final-quiz-check-row     { margin-top:10px; }

/* ── Print ── */
@media print {
  header, .map-wrap { display: none !important; }
  body { height: auto; overflow: visible; background: white; }
  #quizSection { overflow: visible !important; }
  .quiz-check-btn, .quiz-feedback { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════════
   Route panel — always-visible bottom overlay (mobile-first)
   Replaces the legacy Settings modal + Route/Reset/Quiz topbar buttons.
   See adr/NEW_ROUTE_FLOW.md for the spec.
   ════════════════════════════════════════════════════════════════════ */

.route-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 1100;                          /* above leaflet controls (1000) */
  background: var(--c-surface);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
  box-shadow: var(--shadow-panel);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--c-text-primary);
  max-height: 70vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.route-panel__title {
  /* Typography comes from .t-h6 on the element. Keep only layout here. */
  margin: 0 0 14px;
}

.route-panel__section { margin-bottom: 14px; }
.route-panel__section:last-of-type { margin-bottom: 0; }

.route-panel__section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.route-panel__section-title {
  /* Apply .t-body-md (Body md-semibold) via the HTML class. */
  color: var(--c-text-primary);
}
.route-panel__hint {
  /* Apply .t-body-xsm via the HTML class. Layout/colour only here. */
  margin: 0 0 10px;
  color: var(--c-text-secondary);
}

.route-panel__waypoint {
  display: flex; align-items: center; gap: var(--ctrl-gap);
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
  border: 1px solid var(--c-input-border);
  border-radius: var(--ctrl-radius);
  background: var(--c-input-bg);
  margin-bottom: 8px;
  position: relative;
}
.route-panel__waypoint:nth-child(3)::before {
  /* connecting line between A and B inputs */
  content: "";
  position: absolute;
  left: 22px;
  top: 100%;
  height: 8px;
  width: 1px;
  background: var(--c-divider);
}
.route-panel__waypoint-badge {
  /* Letter A/B inside circle. Glyph; sized by .t-body-xsm.t-semibold via HTML. */
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
}
.route-panel__waypoint-badge--a { background: var(--c-accent); }
.route-panel__waypoint-badge--b { background: var(--c-waypoint-b); }
.route-panel__waypoint-input {
  /* Apply .t-body-md via HTML. Default UI text. */
  flex: 1;
  border: none;
  background: transparent;
  color: var(--c-text-primary);
  outline: none;
  min-width: 0;                         /* allow flex shrink in narrow viewports */
}
.route-panel__waypoint-input::placeholder { color: var(--c-text-placeholder); }

.route-panel__toggle {
  display: flex; align-items: center; gap: var(--ctrl-gap);
  margin-top: 10px;
  cursor: pointer;
  user-select: none;
}
.route-panel__toggle input { display: none; }
.route-panel__toggle-track {
  position: relative;
  width: 36px; height: 20px;
  background: var(--bg-toggle-off);
  border-radius: 999px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.route-panel__toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-thumb);
  transition: transform 0.15s;
}
.route-panel__toggle input:checked + .route-panel__toggle-track { background: var(--c-accent); }
.route-panel__toggle input:checked + .route-panel__toggle-track .route-panel__toggle-thumb { transform: translateX(16px); }
.route-panel__toggle-label { color: var(--c-text-primary); }      /* .t-body-md via HTML */

.route-panel__length-header {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 6px;
}
.route-panel__length-header .route-panel__section-title { margin-right: auto; }
.route-panel__length-unit { color: var(--c-text-secondary); }     /* .t-body-xsm via HTML */
.route-panel__length-value {
  /* Apply .t-body-sm via HTML. */
  display: inline-block;
  min-width: 28px;
  padding: 2px 8px;
  border: 1px solid var(--c-input-border);
  border-radius: var(--ctrl-radius-sm);
  text-align: center;
}
.route-panel__slider {
  --slider-fill: 26%;                   /* updated by JS to mirror current value */
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right,
    var(--c-accent) 0%,
    var(--c-accent) var(--slider-fill),
    #1f2937 var(--slider-fill),
    #1f2937 100%);
  outline: none;
}
.route-panel__slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--c-accent);
  border: 2px solid #fff;
  box-shadow: var(--shadow-thumb);
  cursor: pointer;
}
.route-panel__slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--c-accent);
  border: 2px solid #fff;
  box-shadow: var(--shadow-thumb);
  cursor: pointer;
}

.route-panel__actions {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px;
}
.route-panel__actions[hidden] { display: none; }
.route-panel__btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--ctrl-radius);
  /* Button label uses .t-body-md via inner span (per skill) */
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, opacity 0.12s;
}
.route-panel__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.route-panel__btn--primary {
  background: var(--c-accent);
  color: #fff;
}
.route-panel__btn--primary:hover:not(:disabled) { background: var(--c-accent-hover); }
.route-panel__btn--secondary {
  background: #fff;
  color: var(--c-text-primary);
  border-color: var(--c-input-border);
}
.route-panel__btn--secondary:hover:not(:disabled) { background: var(--bg-control-hover); }

/* ── Map waypoint popup (shown on every map click) ── */
.waypoint-popup .leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow-popup);
}
.waypoint-popup .leaflet-popup-content {
  margin: 12px 14px;
  min-width: 180px;
}
.waypoint-popup__title {
  /* Apply .t-h7 via HTML; type owns no margin so we don't need .t-no-margin. */
  margin: 0 0 8px;
  color: var(--c-text-primary);
}
.waypoint-popup__btn {
  /* Button label uses .t-body-sm via inner text node. */
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: var(--ctrl-pad-y) var(--ctrl-pad-x);
  margin-top: 6px;
  background: #fff;
  border: 1px solid var(--c-input-border);
  border-radius: var(--ctrl-radius);
  cursor: pointer;
  text-align: left;
}
.waypoint-popup__btn:hover { background: var(--bg-control-hover); }
.waypoint-popup__badge {
  /* Letter A/B inside circle. Sized via .t-body-xsm.t-semibold on HTML. */
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%; color: #fff;
}
.waypoint-popup__badge--a { background: var(--c-accent); }
.waypoint-popup__badge--b { background: var(--c-waypoint-b); }

/* ── Map markers: A/B route pins + brand-orange POI dots ──
   Leaflet's default `leaflet-div-icon` background+border is suppressed
   because we pass our own className on the divIcon (no leaflet-div-icon
   added when className is set explicitly). */
/* Teardrop A/B pins.
   Built from SVG so the tip is sharp and aligns exactly with the GPS
   coordinate (Leaflet iconAnchor at [16, 40] = tip). The bulb's fill
   uses `currentColor`, set per kind via the wrapper class — keeps colour
   selection in CSS rather than in JS-generated SVG attributes.
   The wrapper drops Leaflet's default white bg/border via filter:none
   on .leaflet-div-icon (none added when className is provided). */
.route-pin {
  width: 32px;
  height: 40px;
  filter: drop-shadow(var(--shadow-pin));
  background: transparent;
  border: 0;
  line-height: 0;
}
.route-pin--start { color: var(--c-accent); }
.route-pin--end   { color: var(--c-waypoint-b); }
.route-pin__letter {
  /* SVG glyph exception (see SKILL.md "Hard rules" — graphic icons are
     a recognised exception to the no-raw-font-size rule). The letter
     here lives inside an <svg><text> element generated in app.js, not
     in HTML body text. Keep these values aligned with .t-body-sm size
     and Lexend bold weight to feel consistent with the design system. */
  fill: #fff;
  font-weight: var(--t-weight-bold);
  font-size: var(--t-body-sm-size);
  font-family: var(--t-font-heading);
}

.poi-marker {
  /* Number is wrapped in a <span class="t-body-xsm t-semibold"> inside the
     divIcon html (set in app.js renderPlaces). Marker class owns shape. */
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--c-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-marker);
  text-align: center;
  line-height: 1;
}

/* ── Route panel loader + overlay (shown during /api/generate-route) ──
   Overlay is a semi-transparent layer over the entire panel that swallows
   pointer events on every control during the XHR. The loader sits with
   higher z-index so the spinner + text remain visible above the overlay. */
.route-panel__loader {
  /* Loader text uses .t-body-sm via the HTML span. Layout/colour only here. */
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  color: var(--c-text-secondary);
  position: relative;
  z-index: 6;
}
.route-panel__overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  z-index: 5;
  cursor: progress;
}
.route-panel.is-loading .route-panel__overlay { display: block; }
.route-panel.is-loading .route-panel__loader  { display: flex; }
.route-panel__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-input-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: route-panel-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes route-panel-spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive: landscape & wider viewports ──
   Panel stays anchored to the bottom and full-width. We just trim padding
   and cap content max-width so the form doesn't stretch into one ugly
   1-row strip on landscape phones / tablets. */
@media (orientation: landscape) and (max-height: 500px) {
  .route-panel { max-height: 80vh; padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)); }
}
@media (min-width: 768px) {
  .route-panel { padding-left: 24px; padding-right: 24px; }
  .route-panel__title,
  .route-panel__section,
  .route-panel__actions { max-width: 720px; margin-left: auto; margin-right: auto; }
}
