/* ── Design tokens ──────────────────────────────────────────────────── */
:root {
  /* --bg:          #13110D; */
  --bg-overlay:  rgba(15, 12, 8, 0.88);
  --text:        #D6CBBA;
  --text-muted:  #8A7B6A; /* #6E6355 */
  --text-bright: #F0E8D6;
  --border:      #2A2520;

  --frodo:       #C17F40;
  --aragorn:     #4A7C8E;
  --bilbo:       #5F8A5A;
  --gold:        #D4A853;
  --pause:       #8B5E3C;

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 4px;
  --transition: 120ms ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Welcome modal ──────────────────────────────────────────────────── */
.welcome-dialog {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem 3rem;
  max-width: 480px;
  width: 90vw;
  margin: auto;
  color: var(--text);
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  outline: none;
}

.welcome-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.welcome-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin: 0 0 1.4rem;
  text-transform: uppercase;
}

.welcome-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.2rem 0;
}

.welcome-characters {
  font-size: 15px;
  color: var(--text-bright);
  letter-spacing: 0.06em;
  margin: 1.2rem 0 0.6rem;
}

.welcome-tagline {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin: 0.4rem 0;
}

.welcome-stat {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  margin: 1rem 0 0.2rem;
}

.welcome-cta {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 1.8rem;
  opacity: 0.6;
}

@media (max-width: 640px) {
  .welcome-dialog { padding: 2rem 1.5rem; }
  .welcome-title  { font-size: 18px; }
}

/* ── Clock / controls popover ─────────────────────────────────────── */
.clock-popover {
  position: fixed;
  z-index: 2000;

  width: min(330px, calc(100vw - 24px));
  padding: 16px 18px 15px;

  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);

  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.35);

  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;

  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.clock-popover.visible {
  opacity: 1;
  transform: translateY(0);
}

.clock-popover[hidden] {
  display: none;
}

.clock-popover-title {
  margin-bottom: 7px;
  padding-right: 18px;

  color: var(--text-bright);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.clock-popover p {
  margin: 0;
}

.clock-popover strong {
  color: var(--gold);
  font-weight: 600;
}

.clock-popover-controls {
  margin-top: 10px !important;
  padding-top: 9px;

  border-top: 1px solid var(--border);
}

/* Little pointer toward the clock toggle */
.clock-popover::before {
  content: "";

  position: absolute;
  top: -7px;
  right: 34px;

  width: 12px;
  height: 12px;

  background: var(--bg-overlay);

  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);

  transform: rotate(45deg);
}

/* ── Journey completion modal ─────────────────────────────────────── */
.completion-dialog {
  width: min(520px, calc(100vw - 40px));
  margin: auto;
  padding: 0;
  border: 1px solid rgba(193, 127, 64, 0.45);
  border-radius: 4px;
  background: rgba(20, 25, 24, 0.97);
  color: #eee8dc;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
}

/* .completion-dialog::backdrop {
  background: rgba(8, 12, 11, 0.58);
  backdrop-filter: blur(3px);
} */

.completion-content {
  padding: 42px 38px 34px;
  text-align: center;
}

.completion-kicker {
  margin-bottom: 22px;
  color: #c17f40;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.completion-miles {
  margin-bottom: 24px;
  font-size: clamp(1.7rem, 5vw, 2.25rem);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.completion-journeys {
  color: #d8d2c7;
  font-size: 1rem;
  line-height: 1.65;
}

.completion-rule {
  width: 48px;
  height: 1px;
  margin: 28px auto;
  background: rgba(193, 127, 64, 0.55);
}

.completion-comparison {
  color: #aaa79f;
  font-size: 0.92rem;
  line-height: 1.65;
}

.completion-comparison strong {
  color: #eee8dc;
  font-size: 1.05rem;
  font-weight: 500;
}

.completion-aside {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.completion-prompt {
  margin-top: 30px;
  color: #88857e;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

@media (max-width: 600px) {
  .completion-content {
    padding: 34px 26px 28px;
  }

  .completion-dialog {
    width: calc(100vw - 28px);
  }
}

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  height: 48px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  /* background: rgba(10, 8, 5, 0.7); */
}

.header-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  flex-shrink: 0;
}
.title-main {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.title-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* About link */
.header-about {
  flex-shrink: 0;
  padding: 4px 8px;

  color: var(--text-muted);
  text-decoration: none;

  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  /* text-transform: uppercase; */

  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);

  transition:
    color var(--transition),
    border-color var(--transition);
}

.header-about:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.header-about:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Clock toggle */
.clock-toggle {
  display: flex;
  gap: 2px;
  margin-right: auto;
  flex-shrink: 0;
}

.clock-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.clock-btn:hover { color: var(--text); border-color: var(--text-muted); }
.clock-btn.active,
.clock-btn[aria-pressed="true"] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
}
.clock-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Mobile header break */
.mobile-header-break { display: none; }

/* Mode navigation */
.mode-nav {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.mode-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.05em;
  /* text-transform: uppercase; */
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

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

.mode-btn.active,
.mode-btn[aria-selected="true"] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(212, 168, 83, 0.08);
}

.mode-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Per-mode color accent when active */
.mode-btn[data-mode="Mordor"].active  { color: var(--frodo);   border-color: var(--frodo);   background: rgba(193, 127, 64, 0.1); }
.mode-btn[data-mode="Return"].active  { color: var(--aragorn); border-color: var(--aragorn); background: rgba(74, 124, 142, 0.1); }
.mode-btn[data-mode="Hobbit"].active  { color: var(--bilbo);   border-color: var(--bilbo);   background: rgba(95, 138, 90, 0.1); }

/* Play button */
.play-btn {
  margin-left: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.play-btn:hover    { border-color: var(--gold); background: rgba(212, 168, 83, 0.1); }
.play-btn.playing  { border-color: var(--gold); color: var(--gold); }
.play-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.play-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* ── Main area ──────────────────────────────────────────────────────── */
.main-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* ── Map container ──────────────────────────────────────────────────── */
.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;  /* pointer events own all map gestures */
}

.map-viewport.dragging {
  cursor: grabbing;
}

.map-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

#base-map {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  user-select: none;
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Info panel ─────────────────────────────────────────────────────── */
.info-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 180px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-date {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.info-place {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.2;
}

.info-miles {
  font-size: 13px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.info-journey {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.6;
}

.info-journey strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  margin-bottom: 1px;
}

.info-event {
  font-size: 11.5px;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  line-height: 1.55;
}
.info-event.pause-event { color: var(--pause); }

/* Journey progress rows */
.journey-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.journey-row {
  display: grid;
  grid-template-columns: 8px 50px 1fr 44px;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  opacity: 0.4;
  transition: opacity var(--transition);
}
.journey-row.has-progress { opacity: 1; }
.journey-row[hidden] {
  display: none;
}

.jr-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.jr-name { color: var(--text-muted); white-space: nowrap; }
.jr-bar  { height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.jr-fill { height: 100%; border-radius: 2px; transition: width 200ms ease; width: 0; }
.jr-val  { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

#fill-Mordor { background: var(--frodo); }
#fill-Return { background: var(--aragorn); }
#fill-Hobbit { background: var(--bilbo); }

/* Pause badges — centred near the top of the map area */
.pause-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  background: rgba(139, 94, 60, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--pause);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 11px;
  color: #E8C49A;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
}

/* Timeline state badges */
.timeline-badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  border: 1px solid;
  border-radius: var(--radius);
  padding: 5px 12px;

  font-size: 11px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
}

.timeline-badge--between {
  background: rgba(110, 99, 85, 0.82);
  border-color: var(--text-muted);
  color: var(--text);
}

.timeline-badge--gap {
  background: rgba(74, 124, 142, 0.82);
  border-color: var(--aragorn);
  color: var(--text-bright);
}

/* ── Map controls (zoom + reset) ────────────────────────────── */
.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-ctrl-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), border-color var(--transition);
}
.map-ctrl-btn:hover { border-color: var(--gold); color: var(--text); }
.map-ctrl-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Reset button hides until the view is non-default */
#reset-view { display: none; }
#reset-view.visible { display: flex; }

/* ── Timeline bar ──────────────────────────────────────────────────── */
.timeline-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  height: 48px;
}

/* ── Prev / Next nav buttons ───────────────────────────────── */
.tl-nav-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition);
}
.tl-nav-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--text); }
.tl-nav-btn:disabled { opacity: 0.3; cursor: default; }
.tl-nav-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Speed control ───────────────────────────────────────────── */
.tl-speed {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.speed-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 5px;
  cursor: pointer;
  font-family: var(--font);
  letter-spacing: 0.02em;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.speed-btn:hover { color: var(--text); border-color: var(--border); }
.speed-btn.active,
.speed-btn[aria-pressed="true"] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(212, 168, 83, 0.08);
}
.speed-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.tl-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  width: 80px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.tl-slider-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.timeline-slider {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  cursor: pointer;
  outline: none;
  accent-color: var(--gold);
  position: relative;
  z-index: 2;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg);
  cursor: pointer;
  transition: transform var(--transition);
}
.timeline-slider:hover::-webkit-slider-thumb { transform: scale(1.25); }
.timeline-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg);
  cursor: pointer;
}

.timeline-slider:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Segment tick marks (empty — no longer drawn) */
.tl-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Frodo My Time pause visual */
.tl-pause-range {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: rgba(139, 94, 60, 0.35);
  border-radius: 3px;
  pointer-events: none;
  z-index: 3;
}

/* ── SVG route styles ───────────────────────────────────────────────── */
.route-ghost {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-opacity 300ms ease;
}

.route-active {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .route-active { transition: none; }
  .play-btn { display: none; }
}

.marker-ring {
  fill: none;
  stroke-width: 2;
  opacity: 0.4;
}

/* Marker location cue */
@keyframes marker-location-cue {
  0% {
    transform: scale(0.65);
    opacity: 0;
    stroke-width: 2;
  }

  20% {
    transform: scale(1.7);
    opacity: 0.85;
    stroke-width: 7;
  }

  40% {
    transform: scale(1);
    opacity: 0.35;
    stroke-width: 2;
  }

  60% {
    transform: scale(1.5);
    opacity: 0.7;
    stroke-width: 5;
  }

  100% {
    transform: scale(1);
    opacity: 0.4;
    stroke-width: 2;
  }
}

.marker-ring.location-cue {
  transform-box: fill-box;
  transform-origin: center;
  animation: marker-location-cue 1200ms ease-out;
}

/* Reduced motion: brief static emphasis, no animation */
@media (prefers-reduced-motion: reduce) {
  .marker-ring.location-cue {
    animation: none;
    opacity: 0.9;
  }
}

.marker-core {
  /* fill: var(--gold); */
  stroke: #1a1612;
  stroke-width: 3;
}

/* Pulse animation for active marker */
@keyframes marker-pulse {
  0%   { r: 14; opacity: 0.7; }
  70%  { r: 22; opacity: 0; }
  100% { r: 22; opacity: 0; }
}

.marker-pulse {
  fill: var(--gold);
  opacity: 0;
  animation: marker-pulse 2s ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .marker-pulse { animation: none; display: none; }
}

/* ── Site footer ───────────────────────────────────────────────────── */

.site-footer {
  flex: 0 0 auto;

  min-height: 32px;
  padding: 7px 16px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;

  background: rgba(15, 12, 8, 0.94);
  border-top: 1px solid var(--border);

  color: var(--text-muted);
  font-size: 10px;
}

.footer-tagline {
  color: var(--text);
  font-style: italic;
}

.footer-owner {
  white-space: nowrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 120ms;
}

.footer-links a:hover,
.footer-links a:focus {
  color: var(--text-bright);
  text-decoration: underline;
}

@media (max-width: 640px) {
  .site-footer {
    min-height: 28px;
    padding: 6px 10px;
    gap: 10px;
    font-size: 9px;
  }

  .footer-tagline {
    display: none;
  }

  .footer-links {
    gap: 9px;
  }
  /* .site-footer {
    flex-direction: column;
    gap: 2px;
    padding: 5px 10px;
    height: auto;
    min-height: 38px;
  }

  .footer-tagline {
    display: block;
    font-size: 9px;
  }

  .footer-owner,
  .footer-links {
    font-size: 9px;
  } */
}

/* ── Responsive ─────────────────────────────────────────────────────── */

/* Dynamic viewport height where supported (avoids mobile browser chrome issues) */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

/* ─── Compact header / info layout ───────────────────── */
@media (max-width: 1024px) {
  /* Header: two-row layout */
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding: 5px 10px;
    gap: 4px;
    align-items: center;
  }
  /* Force everything after this element onto row 2 */
  .mobile-header-break { display: block; flex-basis: 100%; height: 0; }
  /* Row 1: title + About left, clocks right */
  .title-sub { font-size: 8px; }
  .header-about { padding: 4px 8px; font-size: 10px; border-right: none; }
  .clock-toggle { margin-left: auto; margin-right: 0; }
  /* Row 2: journeys on the left */
  .mode-nav     { flex: 0 0; gap: 3px; }
  .mode-btn     { padding: 5px 9px; font-size: 10px; letter-spacing: 0.03em; }
  /* Group prev/play/next/speed together to the right */
  .tl-nav-btn   { margin-left: 0; }
  #tl-prev      { margin-left: auto; }
  .play-btn     { margin-left: 4px; width: 28px; height: 28px; }
  .tl-speed     { margin-left: 6px; }

  /* Info panel moves from top-left to bottom-left */
  .info-panel { top: auto; bottom: 16px; }
}

/* ─── Narrow phones (portrait and most landscape) ───────────────────── */
@media (max-width: 640px) {
  .clock-btn { padding: 3px 6px; font-size: 11px; }
  /* Compact mode buttons for narrow phones */
  .mode-btn { padding: 4px 6px; }
  .tl-speed { margin-left: 4px; }
  /* Info panel — bottom overlay; map controls no longer on right side */
  .info-panel {
    top: auto;
    bottom: 8px;
    left: 8px;
    right: 8px;
    max-width: none;
    min-width: 0;
    padding: 10px 12px;
    gap: 6px;
    max-height: 40%;
    overflow-y: auto;
  }
  .info-place  { font-size: 15px; }
  .journey-rows { display: flex; }

  /* Map viewport shrinks to leave room for info panel */
  .map-viewport { bottom: 165px; }

  /* Timeline — slider on top row, labels + controls on bottom row */
  .timeline-bar {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 10px;
    gap: 2px;
  }
  .tl-slider-wrap {
    order: -1;
    flex: 1 1 100%;
    margin-bottom: 2px;
  }
  .tl-label {
    display: block;
    width: auto;
    flex: 1;
    font-size: 10px;
  }
  .tl-label:first-child { text-align: left; }
  .tl-label:last-child  { text-align: right; }

  /* Larger thumb for touch */
  .timeline-slider::-webkit-slider-thumb { width: 20px; height: 20px; }
  .timeline-slider::-moz-range-thumb     { width: 20px; height: 20px; }
}

/* ─── Landscape phones (short viewport — overrides portrait-only styles) ── */
@media (max-height: 480px) {
  .site-header  { height: 36px; padding: 0 10px; gap: 8px; flex-wrap: nowrap; }
  .title-sub    { display: none; }
  .mode-btn     { padding: 3px 8px; font-size: 10.5px; }

  /* Info panel — stays top-left in landscape, compact */
  .info-panel {
    top: 48px;     /* below map-controls */
    left: 8px;
    right: auto;
    bottom: auto;
    max-width: 190px;
    max-height: none;
    overflow-y: visible;
    padding: 8px 10px;
    gap: 6px;
  }
  .info-place { font-size: 14px; }

  /* Restore map viewport in landscape */
  .map-viewport { bottom: 0; }

  /* Compact timeline */
  .timeline-bar   { height: 36px; padding: 6px 10px; flex-wrap: nowrap; }
  .tl-slider-wrap { order: 0; flex: 1; margin-bottom: 0; }
  .tl-label       { display: block; font-size: 10px; width: 60px; }
  .tl-label:first-child { text-align: left; }
  .tl-label:last-child  { text-align: right; }
}

/* ── Loading state ───────────────────────────────────────────────────── */
body.loading .main-area::after {
  content: 'Loading…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
}

body.loading .timeline-bar,
body.loading .mode-nav,
body.loading .play-btn { opacity: 0.3; pointer-events: none; }
