:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --surface: #121722;
  --surface-2: #181f2c;
  --line: #2a3446;
  --text: #f5f7fb;
  --muted: #aab3c2;
  --accent: #ffcf33;
  --accent-2: #ffe785;
  --ok: #7ee2a8;
  --warn: #ffd166;
  --bad: #ff7b7b;
  --blue: #8bbcff;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% -10%, rgba(255, 207, 51, .16), transparent 32rem),
    radial-gradient(circle at 95% 20%, rgba(80, 125, 255, .10), transparent 30rem),
    var(--bg);
  color: var(--text);
}

.shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }

.hero { padding: 54px 0 26px; }
.eyebrow, .kicker {
  color: var(--accent);
  font-size: .76rem;
  letter-spacing: .14em;
  font-weight: 800;
}

.hero-grid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

h1 {
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: .9;
  margin: 10px 0 18px;
  letter-spacing: -.065em;
}

.route-title {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.route-title span {
  color: var(--accent);
  margin: 0 .45rem;
}

.train-badge {
  min-width: 170px;
  border: 1px solid var(--line);
  background: rgba(18,23,34,.78);
  padding: 18px 20px;
  border-radius: 18px;
  backdrop-filter: blur(12px);
}

.train-badge span {
  display: block;
  color: var(--muted);
  font-size: .85rem;
}

.train-badge strong {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  margin-top: 6px;
}

.countdown {
  margin-top: 30px;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  background: rgba(255, 207, 51, .08);
  border-radius: 0 12px 12px 0;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.page-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 18px;
  padding-bottom: 20px;
}

.card {
  border: 1px solid var(--line);
  background: rgba(18,23,34,.86);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0,0,0,.18);
}

.trip-card {
  padding: 26px;
  grid-row: span 2;
}

.live-card,
.practical-card {
  padding: 26px;
}

.map-card {
  grid-column: 1 / -1;
  overflow: hidden;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 1.65rem;
  letter-spacing: -.03em;
}

.pill {
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.pill.live {
  color: var(--ok);
  border-color: rgba(126,226,168,.4);
  background: rgba(126,226,168,.07);
}

.pill.demo {
  color: var(--warn);
  border-color: rgba(255,209,102,.38);
  background: rgba(255,209,102,.07);
}

/* Timeline */
.timeline {
  margin-top: 28px;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 14px;
  bottom: 30px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--line));
}

.stop-card {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 16px;
  position: relative;
  padding: 0 0 32px;
}

.stop-dot {
  width: 20px;
  height: 20px;
  border: 4px solid var(--surface);
  background: var(--muted);
  border-radius: 50%;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 1px var(--line);
}

.stop-card.important .stop-dot {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(255,207,51,.24);
}

.stop-card.destination .stop-dot {
  background: var(--blue);
}

.stop-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.stop-topline h3 {
  margin: 0;
  font-size: 1.25rem;
}

.stop-topline span {
  color: var(--muted);
  font-size: .82rem;
}

.time-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-top: 7px;
  flex-wrap: wrap;
}

.time-row strong {
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}

.status {
  font-size: .78rem;
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 700;
}

.status.neutral {
  color: var(--muted);
  background: rgba(170,179,194,.09);
}

.status.ok {
  color: var(--ok);
  background: rgba(126,226,168,.10);
}

.status.delay {
  color: var(--warn);
  background: rgba(255,209,102,.10);
}

.status.cancelled {
  color: var(--bad);
  background: rgba(255,123,123,.10);
}

.stop-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

/* Booking and practical info */
.trip-notes {
  margin-top: 12px;
  padding-top: 8px;
}

.subsection-title h3,
.info-block h3 {
  margin: 6px 0 12px;
  font-size: 1.15rem;
  letter-spacing: -.02em;
}

.booking-box {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.03);
  border-radius: 18px;
  padding: 18px;
}

.wagon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.wagon-label {
  color: var(--muted);
  font-size: .95rem;
}

.wagon-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255, 207, 51, .14);
  color: var(--accent);
  border: 1px solid rgba(255, 207, 51, .35);
  font-size: 1.5rem;
}

.seat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.seat-chip {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(139,188,255,.10);
  color: var(--blue);
  border: 1px solid rgba(139,188,255,.22);
  font-size: .88rem;
  font-weight: 700;
}

.info-block + .info-block {
  margin-top: 18px;
}

.transfer-item {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface-2);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.03);
}

.transfer-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 207, 51, .10);
  border: 1px solid rgba(255, 207, 51, .22);
  font-size: 1.25rem;
}

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

.transfer-copy strong {
  font-size: .98rem;
}

.transfer-copy span {
  color: var(--muted);
  font-size: .88rem;
}

.mini-note {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: .9rem;
}

/* Live stats */
.signal {
  color: var(--muted);
  font-size: .8rem;
  display: flex;
  gap: 8px;
  align-items: center;
}

.signal span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 12px rgba(126,226,168,.7);
}

.stats {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  padding: 15px;
  background: var(--surface-2);
  border-radius: 14px;
  min-width: 0;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: .73rem;
  margin-bottom: 7px;
}

.stat strong {
  display: block;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice {
  margin-top: 14px;
  color: var(--warn);
  background: rgba(255,209,102,.08);
  border: 1px solid rgba(255,209,102,.22);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .84rem;
}

/* Map */
.map-heading {
  padding: 24px 26px 18px;
  align-items: flex-end;
}

.osm-note {
  color: var(--muted);
  font-size: .75rem;
}

#map {
  height: min(62vh, 650px);
  min-height: 450px;
  background: #cbd5df;
}

.map-footer {
  display: flex;
  gap: 18px;
  padding: 14px 24px 18px;
  color: var(--muted);
  font-size: .78rem;
  flex-wrap: wrap;
}

.map-footer span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #45556e;
}

.legend-dot.selected {
  background: var(--accent);
}

.legend-train {
  font-style: normal;
}

/* Default map markers */
.train-marker {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #111722;
  border: 3px solid #ffcf33;
  box-shadow: 0 7px 24px rgba(0,0,0,.35);
  font-size: 21px;
}

.station-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #435269;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.station-marker.selected {
  width: 18px;
  height: 18px;
  background: #ffcf33;
  border-color: #111722;
}

/* Retro people */
.retro-character {
  position: relative;
  width: 34px;
  height: 50px;
  animation: retro-wiggle 1.8s ease-in-out infinite;
  transform-origin: center bottom;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}

.retro-character .shadow {
  position: absolute;
  left: 8px;
  bottom: 1px;
  width: 18px;
  height: 5px;
  background: rgba(0,0,0,.25);
  border-radius: 50%;
  animation: retro-shadow 1.8s ease-in-out infinite;
}

.retro-character .head {
  position: absolute;
  top: 4px;
  left: 11px;
  width: 10px;
  height: 10px;
  background: var(--skin, #f4c9a3);
  border: 2px solid #101419;
  border-radius: 2px;
  z-index: 2;
}

.retro-character .hair {
  position: absolute;
  top: 2px;
  left: 10px;
  width: 12px;
  height: 5px;
  background: var(--hair, #3c2a1a);
  border: 2px solid #101419;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  z-index: 3;
}

.retro-character .body {
  position: absolute;
  top: 16px;
  left: 10px;
  width: 12px;
  height: 13px;
  background: var(--shirt, #ff6b6b);
  border: 2px solid #101419;
  border-radius: 2px;
}

.retro-character .arm {
  position: absolute;
  top: 17px;
  width: 4px;
  height: 11px;
  background: var(--shirt, #ff6b6b);
  border: 2px solid #101419;
  border-radius: 2px;
}

.retro-character .arm-left { left: 6px; }
.retro-character .arm-right { left: 24px; }

.retro-character .leg {
  position: absolute;
  top: 30px;
  width: 4px;
  height: 14px;
  background: #6a768c;
  border: 2px solid #101419;
  border-radius: 2px;
}

.retro-character .leg-left {
  left: 11px;
  animation: retro-step-left 1.2s ease-in-out infinite;
}

.retro-character .leg-right {
  left: 19px;
  animation: retro-step-right 1.2s ease-in-out infinite;
}

.retro-character .glasses,
.retro-character .hat,
.retro-character .bag,
.retro-character .scarf {
  display: none;
}

.retro-character.has-glasses .glasses {
  display: block;
  position: absolute;
  top: 10px;
  left: 10px;
  width: 12px;
  height: 3px;
  border-top: 2px solid #111;
  z-index: 4;
}

.retro-character.has-cap .hat {
  display: block;
  position: absolute;
  top: 0px;
  left: 8px;
  width: 16px;
  height: 5px;
  background: #2a7fff;
  border: 2px solid #101419;
  border-radius: 2px 2px 0 0;
  z-index: 5;
}

.retro-character.has-bag .bag {
  display: block;
  position: absolute;
  top: 19px;
  left: 22px;
  width: 6px;
  height: 8px;
  background: #8b5a2b;
  border: 2px solid #101419;
  border-radius: 1px;
}

.retro-character.has-scarf .scarf {
  display: block;
  position: absolute;
  top: 15px;
  left: 9px;
  width: 14px;
  height: 4px;
  background: #ffcf33;
  border: 1px solid #101419;
  z-index: 4;
}

/* Retro bus */
.retro-bus-marker {
  position: relative;
  width: 56px;
  height: 38px;
  animation: retro-vehicle 1.6s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}

.retro-bus-marker .bus-shadow {
  position: absolute;
  left: 10px;
  bottom: 2px;
  width: 32px;
  height: 5px;
  background: rgba(0,0,0,.22);
  border-radius: 50%;
}

.retro-bus-marker .bus-body {
  position: absolute;
  left: 6px;
  top: 9px;
  width: 38px;
  height: 18px;
  background: #ffcf33;
  border: 2px solid #101419;
  border-radius: 3px;
}

.retro-bus-marker .bus-window {
  position: absolute;
  top: 12px;
  width: 8px;
  height: 6px;
  background: #8bbcff;
  border: 2px solid #101419;
}

.retro-bus-marker .w1 { left: 11px; }
.retro-bus-marker .w2 { left: 21px; }
.retro-bus-marker .w3 { left: 31px; }

.retro-bus-marker .bus-wheel {
  position: absolute;
  bottom: 5px;
  width: 8px;
  height: 8px;
  background: #1b2330;
  border: 2px solid #101419;
  border-radius: 50%;
}

.retro-bus-marker .wheel-left { left: 12px; }
.retro-bus-marker .wheel-right { left: 32px; }

.retro-bus-marker .bus-label {
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 6px;
  background: rgba(18, 23, 34, .92);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}

/* Retro boat */
.retro-boat-marker {
  position: relative;
  width: 64px;
  height: 42px;
  animation: retro-boat-float 2s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}

.retro-boat-marker .boat-shadow {
  position: absolute;
  left: 12px;
  bottom: 3px;
  width: 34px;
  height: 5px;
  background: rgba(0,0,0,.22);
  border-radius: 50%;
}

.retro-boat-marker .hull {
  position: absolute;
  left: 9px;
  top: 21px;
  width: 34px;
  height: 10px;
  background: #ff6b6b;
  border: 2px solid #101419;
  clip-path: polygon(0 70%, 100% 70%, 86% 100%, 12% 100%);
}

.retro-boat-marker .deck {
  position: absolute;
  left: 16px;
  top: 12px;
  width: 18px;
  height: 10px;
  background: #f5f7fb;
  border: 2px solid #101419;
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}

.retro-boat-marker .chimney {
  position: absolute;
  left: 27px;
  top: 8px;
  width: 5px;
  height: 6px;
  background: #ffcf33;
  border: 2px solid #101419;
  border-radius: 1px;
}

.retro-boat-marker .wave {
  position: absolute;
  left: 6px;
  top: 31px;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8bbcff 20%, transparent 20% 35%, #8bbcff 35% 60%, transparent 60% 75%, #8bbcff 75%);
  opacity: .95;
}

.retro-boat-marker .boat-label {
  position: absolute;
  top: 0;
  right: 0;
  padding: 2px 6px;
  background: rgba(18, 23, 34, .92);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}

/* Leaflet theme */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #141b27;
  color: #f5f7fb;
}

.leaflet-popup-content {
  line-height: 1.45;
}

.leaflet-control-zoom a {
  background: #141b27 !important;
  color: #fff !important;
  border-color: #2a3446 !important;
}

.footer {
  color: #778397;
  font-size: .78rem;
  padding: 18px 0 40px;
}

/* Animations */
@keyframes retro-wiggle {
  0%, 100% { transform: translateX(-2px) translateY(0) rotate(-2deg); }
  50% { transform: translateX(2px) translateY(-1px) rotate(2deg); }
}

@keyframes retro-shadow {
  0%, 100% { transform: scaleX(.92); opacity: .22; }
  50% { transform: scaleX(1); opacity: .3; }
}

@keyframes retro-step-left {
  0%, 100% { transform: translateY(0) rotate(4deg); }
  50% { transform: translateY(1px) rotate(-6deg); }
}

@keyframes retro-step-right {
  0%, 100% { transform: translateY(1px) rotate(-6deg); }
  50% { transform: translateY(0) rotate(4deg); }
}

@keyframes retro-vehicle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes retro-boat-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-2px) rotate(1deg); }
}

@media (max-width: 800px) {
  .hero { padding-top: 34px; }

  .hero-grid {
    align-items: flex-start;
    flex-direction: column;
  }

  .train-badge {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: auto;
  }

  .train-badge strong {
    font-size: 1.7rem;
  }

  .page-grid {
    grid-template-columns: 1fr;
  }

  .trip-card {
    grid-row: auto;
  }

  .map-card {
    grid-column: auto;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat strong {
    white-space: normal;
  }

  #map {
    min-height: 420px;
    height: 58vh;
  }

  .map-heading {
    align-items: flex-start;
  }

  .seat-list {
    gap: 8px;
  }

  .seat-chip {
    font-size: .82rem;
  }
}