/* ==========================================================================
   轨迹 · China Rail Atlas
   A paper-and-ink railway archive wrapped around a dark operational map.
   ========================================================================== */

:root {
  --ink: #17212b;
  --ink-soft: #4f5a63;
  --ink-faint: #7d858b;
  --paper: #eee8dc;
  --paper-deep: #e4dccd;
  --paper-light: #f8f3e9;
  --line: rgba(23, 33, 43, 0.14);
  --line-strong: rgba(23, 33, 43, 0.26);
  --night: #08121d;
  --night-2: #0d1a28;
  --night-3: #132335;
  --gold: #e8ad5f;
  --gold-bright: #f5c878;
  --gold-dark: #9b5c22;
  --teal: #55c8b4;
  --teal-dark: #0c7567;
  --red: #c4573e;
  --paper-shadow: 0 32px 90px rgba(0, 0, 0, 0.38);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --mono: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", sans-serif;
  --panel: 428px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

::selection { background: var(--gold); color: var(--night); }

[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }

.app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row-reverse;
}

/* --------------------------------------------------------------------------
   Map canvas
   -------------------------------------------------------------------------- */

.map-shell {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  background:
    radial-gradient(circle at 77% 34%, rgba(45, 86, 103, 0.25), transparent 45%),
    radial-gradient(circle at 35% 73%, rgba(94, 67, 39, 0.18), transparent 50%),
    #08121d;
  overflow: hidden;
}

.map { position: absolute; inset: 0; z-index: 1; background: transparent; }

.leaflet-container {
  background: #08121d !important;
  font-family: var(--sans) !important;
  outline: none;
}
.leaflet-tile-pane { filter: saturate(0.7) contrast(1.04) brightness(0.94); }
.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom { display: none !important; }
.leaflet-interactive { cursor: pointer; }

.map-tint {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 18, 29, 0.52) 0%, rgba(8, 18, 29, 0.08) 24%, transparent 45%),
    linear-gradient(0deg, rgba(8, 18, 29, 0.72) 0%, transparent 22%),
    linear-gradient(180deg, rgba(8, 18, 29, 0.68) 0%, transparent 18%);
}

.map-grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.16;
  pointer-events: none;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 22px 30px 0 30px;
  display: flex;
  align-items: center;
  gap: 22px;
  color: rgba(245, 238, 224, 0.92);
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.topbar-brand .brand-cn {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.topbar-brand .brand-en {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: rgba(245, 238, 224, 0.47);
  margin-top: 3px;
}

.brand-mark {
  position: relative;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  padding: 3px;
}
.brand-mark i {
  display: block;
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
  transform-origin: bottom;
}
.brand-mark i:nth-child(1) { height: 9px; opacity: 0.55; }
.brand-mark i:nth-child(2) { height: 17px; opacity: 0.8; }
.brand-mark i:nth-child(3) { height: 24px; }
.brand-mark::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  background: var(--gold);
  opacity: 0.45;
}
.brand-mark.small { width: 22px; height: 22px; }
.brand-mark.small i:nth-child(1) { height: 7px; }
.brand-mark.small i:nth-child(2) { height: 13px; }
.brand-mark.small i:nth-child(3) { height: 19px; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(245, 238, 224, 0.48);
  white-space: nowrap;
}
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(85, 200, 180, 0.08);
  animation: breathe 3s ease-in-out infinite;
}
.topbar-divider { width: 1px; height: 11px; background: rgba(245, 238, 224, 0.16); margin: 0 3px; }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn, .ghost-btn {
  color: rgba(245, 238, 224, 0.7);
  border: 1px solid rgba(245, 238, 224, 0.14);
  background: rgba(9, 20, 31, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.22s ease;
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 15px;
}
.ghost-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.icon-btn:hover, .ghost-btn:hover {
  color: var(--gold-bright);
  border-color: rgba(232, 173, 95, 0.5);
  background: rgba(232, 173, 95, 0.08);
}

/* --------------------------------------------------------------------------
   Map HUD
   -------------------------------------------------------------------------- */

.map-hud {
  position: absolute;
  z-index: 12;
  top: 92px;
  left: 30px;
  width: min(430px, calc(100vw - var(--panel) - 90px));
  color: var(--paper);
  animation: hud-in 0.7s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}
.map-hud[hidden] { display: none; }
.hud-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.25em;
  color: rgba(245, 238, 224, 0.5);
  margin-bottom: 11px;
}
.hud-line { width: 36px; height: 1px; background: var(--gold); opacity: 0.7; }
.hud-route { display: flex; align-items: flex-end; gap: 16px; }
.hud-code {
  font-family: var(--mono);
  font-size: 58px;
  line-height: 0.82;
  font-weight: 700;
  letter-spacing: -0.045em;
  color: var(--gold-bright);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
}
.hud-cities {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 5px;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.04em;
  color: rgba(245, 238, 224, 0.9);
  white-space: nowrap;
}
.hud-cities svg { font-size: 13px; color: var(--gold); }
.hud-stats {
  display: flex;
  gap: 18px;
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(245, 238, 224, 0.52);
}
.hud-stats b { color: var(--paper); font-size: 13px; font-weight: 600; margin-right: 2px; }
.hud-line-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}
.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid rgba(245, 238, 224, 0.14);
  background: rgba(10, 21, 33, 0.48);
  backdrop-filter: blur(10px);
  border-radius: 3px;
  font-size: 10px;
  color: rgba(245, 238, 224, 0.76);
  letter-spacing: 0.03em;
}
.hud-chip::before {
  content: "";
  width: 13px;
  height: 2px;
  background: var(--gold);
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Map chrome
   -------------------------------------------------------------------------- */

.map-legend {
  position: absolute;
  left: 30px;
  bottom: 46px;
  z-index: 11;
  display: flex;
  gap: 17px;
  align-items: center;
  color: rgba(245, 238, 224, 0.55);
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 9px 13px;
  border: 1px solid rgba(245, 238, 224, 0.1);
  background: rgba(8, 18, 29, 0.5);
  backdrop-filter: blur(12px);
  border-radius: 3px;
  transition: opacity 0.3s;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-line { width: 17px; height: 2px; background: var(--gold); box-shadow: 0 0 8px rgba(232, 173, 95, 0.4); }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.legend-dot.start { background: var(--gold-bright); box-shadow: 0 0 0 3px rgba(232, 173, 95, 0.17); }
.legend-dot.end { background: #f2ede1; }
.legend-dot.stop { width: 4px; height: 4px; background: var(--teal); opacity: 0.8; }

.map-tools {
  position: absolute;
  right: 26px;
  bottom: 46px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.map-tool {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  color: rgba(245, 238, 224, 0.7);
  border: 1px solid rgba(245, 238, 224, 0.13);
  background: rgba(8, 18, 29, 0.62);
  backdrop-filter: blur(14px);
  transition: 0.2s ease;
  font-size: 15px;
}
.map-tool:hover, .map-tool.active {
  color: var(--gold-bright);
  border-color: rgba(232, 173, 95, 0.45);
  background: rgba(20, 35, 48, 0.9);
}

.map-caption {
  position: absolute;
  left: 30px;
  right: 90px;
  bottom: 18px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: rgba(245, 238, 224, 0.28);
  text-transform: uppercase;
  pointer-events: none;
}
.caption-source { color: rgba(245, 238, 224, 0.2); }

.map-loading {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #08121d;
  color: rgba(245, 238, 224, 0.55);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: opacity 0.6s ease, visibility 0.6s;
}
.map-loading.ready { opacity: 0; visibility: hidden; }
.loading-rail { width: 80px; height: 1px; background: rgba(245, 238, 224, 0.15); position: relative; overflow: hidden; }
.loading-rail i {
  position: absolute;
  left: -30%;
  top: 0;
  width: 30%;
  height: 100%;
  background: var(--gold);
  animation: rail-load 1.4s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Side panel / paper
   -------------------------------------------------------------------------- */

.panel {
  position: relative;
  z-index: 30;
  width: var(--panel);
  flex: 0 0 var(--panel);
  height: 100%;
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 255, 255, 0.5), transparent 34%),
    radial-gradient(circle at 92% 80%, rgba(150, 117, 72, 0.08), transparent 45%),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(23, 33, 43, 0.018) 23px 24px),
    var(--paper);
  box-shadow: 16px 0 60px rgba(0, 0, 0, 0.28);
  border-right: 1px solid rgba(0, 0, 0, 0.2);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.panel-scroll {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 25px 30px 34px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 33, 43, 0.2) transparent;
  scroll-behavior: smooth;
}
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(23, 33, 43, 0.18); border-radius: 5px; }

.panel-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.panel-brand-main {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.panel-brand-main em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 7.5px;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  display: block;
  margin-top: 4px;
}
.panel-brand-main .brand-mark i { background: var(--gold-dark); }
.panel-brand-main .brand-mark::after { background: var(--gold-dark); }
.mobile-close { display: none; }

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */

.search-block { position: relative; z-index: 45; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  height: 51px;
  background: var(--paper-light);
  border: 1px solid rgba(23, 33, 43, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 3px 11px rgba(50, 39, 22, 0.05);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.search-box:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 33, 43, 0.07), inset 0 1px 0 #fff;
  background: #fffaf0;
}
.search-icon {
  margin: 0 12px 0 15px;
  font-size: 17px;
  color: var(--ink-soft);
  flex: 0 0 auto;
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  letter-spacing: 0.015em;
  color: var(--ink);
  padding: 0;
}
.search-box input::placeholder { color: #8b8d88; letter-spacing: 0.02em; }
.search-clear {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 6px;
  color: var(--ink-faint);
  border-radius: 50%;
}
.search-clear:hover { background: rgba(23, 33, 43, 0.07); color: var(--ink); }
.search-kbd {
  margin-right: 13px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 33, 43, 0.18);
  border-radius: 3px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
}
.search-box:focus-within .search-kbd { opacity: 0; }
.search-hint {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: #858981;
  white-space: nowrap;
}
.hint-sep { width: 1px; height: 8px; background: rgba(23, 33, 43, 0.2); }

.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 360px;
  overflow-y: auto;
  background: var(--paper-light);
  border: 1px solid rgba(23, 33, 43, 0.28);
  box-shadow: 0 22px 48px rgba(29, 23, 13, 0.22);
  padding: 6px;
  z-index: 60;
}
.search-suggest[hidden] { display: none; }
.suggest-head {
  padding: 8px 10px 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
}
.suggest-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  text-align: left;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.suggest-item:hover, .suggest-item.active {
  background: #fffaf0;
  border-color: rgba(23, 33, 43, 0.13);
}
.suggest-code {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  min-width: 52px;
  letter-spacing: -0.02em;
}
.suggest-route {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.suggest-route b {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggest-route span {
  font-size: 9px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.suggest-type {
  font-size: 8px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}
.suggest-empty { padding: 17px 12px; font-size: 11px; color: var(--ink-faint); text-align: center; }
.suggest-station { padding: 10px; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.suggest-station:hover { background: #fffaf0; }
.station-glyph { font-family: var(--mono); font-size: 9px; color: var(--teal-dark); border: 1px solid rgba(12, 117, 103, 0.3); padding: 3px 4px; }

/* --------------------------------------------------------------------------
   Home view
   -------------------------------------------------------------------------- */

.home-view { padding-top: 36px; animation: rise 0.6s 0.08s both; }
.home-view[hidden] { display: none; }
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.15em;
  color: var(--gold-dark);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.spark { width: 5px; height: 5px; background: var(--gold-dark); transform: rotate(45deg); display: inline-block; }
.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 39px;
  line-height: 1.22;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--ink);
}
.hero h1 span { color: var(--gold-dark); position: relative; }
.hero h1 span::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 4px;
  bottom: 1px;
  height: 5px;
  background: rgba(232, 173, 95, 0.19);
  z-index: -1;
}
.hero-copy {
  margin: 16px 0 0;
  font-size: 11.5px;
  line-height: 1.9;
  color: var(--ink-soft);
  max-width: 330px;
  letter-spacing: 0.02em;
}
.rule { height: 1px; background: var(--line); margin: 27px 0 22px; position: relative; }
.rule::before { content: ""; position: absolute; left: 0; top: -1px; width: 38px; height: 2px; background: var(--ink); }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  padding: 15px 0 14px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; padding-left: 16px; }
.stat:nth-child(2) { padding-left: 16px; }
.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 25px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat span {
  display: block;
  margin-top: 7px;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.quick-section { margin-top: 27px; }
.section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink);
  font-weight: 600;
}
.section-line { flex: 1; height: 1px; background: var(--line); }
.section-note { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.18em; color: var(--ink-faint); font-weight: 400; }
.quick-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 13px 13px 12px;
  min-height: 69px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background 0.2s, transform 0.2s;
  overflow: hidden;
}
.quick-card:hover { background: var(--paper-light); }
.quick-card::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--gold-dark);
  transition: width 0.25s;
}
.quick-card:hover::after { width: 100%; }
.q-code { font-family: var(--mono); font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.q-route { font-size: 9px; color: var(--ink-faint); letter-spacing: 0.02em; }
.q-arrow { position: absolute; right: 10px; bottom: 11px; font-size: 10px; color: var(--ink-faint); opacity: 0; transform: translateX(-4px); transition: 0.2s; }
.quick-card:hover .q-arrow { opacity: 1; transform: translateX(0); }

.browse-all {
  width: 100%;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  background: var(--night-2);
  color: var(--paper);
  text-align: left;
  transition: background 0.2s, transform 0.2s;
}
.browse-all:hover { background: var(--night-3); transform: translateY(-1px); }
.browse-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(245, 238, 224, 0.16);
  color: var(--gold);
  font-size: 14px;
}
.browse-all > span:nth-child(2) { display: flex; flex-direction: column; gap: 3px; }
.browse-all b { font-size: 11px; font-weight: 500; letter-spacing: 0.05em; }
.browse-all small { font-size: 8.5px; color: rgba(245, 238, 224, 0.5); letter-spacing: 0.03em; }
.browse-count { margin-left: auto; font-family: var(--mono); font-size: 18px; color: var(--gold); font-weight: 600; }

.home-foot { margin-top: 31px; padding-top: 15px; border-top: 1px solid var(--line); }
.foot-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.19em;
  color: var(--ink-faint);
}
.foot-mark span { width: 5px; height: 5px; border: 1px solid var(--ink-faint); transform: rotate(45deg); }
.home-foot p { font-size: 9.5px; line-height: 1.8; color: var(--ink-faint); margin: 8px 0 0; letter-spacing: 0.01em; }

/* --------------------------------------------------------------------------
   Train view
   -------------------------------------------------------------------------- */

.train-view { animation: rise 0.5s both; }
.train-view[hidden] { display: none; }
.train-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  margin-top: -3px;
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 0;
}
.back-btn svg { transform: rotate(180deg); font-size: 11px; }
.back-btn:hover { color: var(--ink); }
.train-nav-right { display: flex; gap: 5px; }
.mini-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  border: 1px solid transparent;
  font-size: 12px;
}
.mini-icon:hover { color: var(--ink); border-color: var(--line); }

.train-ticket {
  position: relative;
  padding: 20px 20px 15px;
  background:
    radial-gradient(circle at 83% 12%, rgba(232, 173, 95, 0.16), transparent 31%),
    linear-gradient(135deg, #132232, #0c1724 62%, #101c2a);
  color: var(--paper);
  box-shadow: 0 15px 35px rgba(12, 23, 36, 0.19);
  overflow: hidden;
}
.train-ticket::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 21px 21px;
  pointer-events: none;
}
.ticket-top { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.train-code-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.type-pill {
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--gold);
  border: 1px solid rgba(232, 173, 95, 0.38);
  padding: 3px 7px;
  background: rgba(232, 173, 95, 0.06);
}
.train-code-wrap h2.long { font-size: 40px; letter-spacing: -0.035em; }
.train-code-wrap h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 59px;
  line-height: 0.85;
  letter-spacing: -0.055em;
  font-weight: 700;
  color: #f8f0e2;
}
.ticket-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; max-width: 165px; }
.ticket-tag {
  font-size: 8px;
  letter-spacing: 0.05em;
  color: rgba(245, 238, 224, 0.68);
  border: 1px solid rgba(245, 238, 224, 0.15);
  padding: 3px 6px;
  white-space: nowrap;
}
.ticket-tag.gold { color: var(--gold-bright); border-color: rgba(232, 173, 95, 0.36); }
.ticket-route {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 9px;
  margin-top: 22px;
}
.route-end { display: flex; flex-direction: column; gap: 5px; }
.route-end.right { align-items: flex-end; text-align: right; }
.route-end b { font-family: var(--serif); font-size: 19px; letter-spacing: 0.02em; font-weight: 500; color: #f5ede0; white-space: nowrap; }
.route-end span { font-family: var(--mono); font-size: 19px; letter-spacing: -0.01em; color: var(--gold); }
.route-end.right span { color: #d8d0c1; }
.route-mid {
  position: relative;
  min-width: 30px;
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}
.route-mid .route-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(232, 173, 95, 0.35) 0 3px, transparent 3px 6px);
}
.route-mid svg { position: relative; z-index: 1; background: #101c2a; padding: 0 3px; font-size: 13px; }
.route-mid em {
  position: absolute;
  left: 50%;
  top: calc(50% + 10px);
  transform: translateX(-50%);
  font-family: var(--mono);
  font-style: normal;
  font-size: 8px;
  letter-spacing: 0.04em;
  color: rgba(245, 238, 224, 0.42);
  white-space: nowrap;
}
.ticket-meta {
  position: relative;
  margin-top: 16px;
  padding-top: 11px;
  border-top: 1px solid rgba(245, 238, 224, 0.12);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: rgba(245, 238, 224, 0.48);
}
.ticket-dot { width: 3px; height: 3px; border-radius: 50%; background: rgba(245, 238, 224, 0.3); }
.ticket-notches {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 53px;
  height: 1px;
  border-top: 1px dashed rgba(245, 238, 224, 0.12);
  pointer-events: none;
}
.ticket-notches i {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--paper);
  border-radius: 50%;
  top: -8px;
}
.ticket-notches i:first-child { left: -28px; }
.ticket-notches i:last-child { right: -28px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 15px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.metric {
  position: relative;
  padding: 11px 8px 10px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.metric:last-child { border-right: 0; }
.metric-icon { display: block; font-size: 10px; color: var(--gold-dark); margin-bottom: 7px; height: 12px; }
.metric b {
  display: block;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}
.metric b small { font-size: 8px; font-weight: 400; letter-spacing: 0.02em; color: var(--ink-faint); margin-left: 1px; }
.metric em { display: block; margin-top: 5px; font-style: normal; font-size: 8px; letter-spacing: 0.04em; color: var(--ink-faint); white-space: nowrap; }

.calendar-card {
  margin-top: 17px;
  padding: 13px 14px 12px;
  border: 1px solid var(--line);
  background: rgba(256, 252, 245, 0.38);
}
.calendar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.calendar-head > div { display: flex; flex-direction: column; gap: 3px; }
.section-label-text { font-size: 8.5px; letter-spacing: 0.13em; color: var(--ink-faint); }
.calendar-head b { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: 0.01em; }
.calendar-range { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: var(--ink-faint); padding-top: 3px; white-space: nowrap; }
.calendar-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 11px; }
.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 1px 4px;
  border: 1px solid transparent;
  color: var(--ink-faint);
}
.cal-day span { font-family: var(--mono); font-size: 7px; letter-spacing: 0.04em; opacity: 0.72; }
.cal-day b { font-family: var(--mono); font-size: 10px; font-weight: 500; }
.cal-day.on { color: var(--ink); background: rgba(232, 173, 95, 0.16); border-color: rgba(155, 92, 34, 0.15); }
.cal-day.on::after { content: ""; position: absolute; bottom: 2px; width: 2px; height: 2px; border-radius: 50%; background: var(--gold-dark); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--ink); }
.cal-day.today span { color: var(--ink); opacity: 1; }
.calendar-note { margin-top: 9px; font-size: 8.5px; color: var(--ink-faint); letter-spacing: 0.015em; }

.tabs {
  display: flex;
  margin-top: 22px;
  border-bottom: 1px solid var(--line);
  gap: 0;
}
.tab {
  position: relative;
  flex: 1;
  padding: 10px 0 11px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-align: center;
  transition: color 0.2s;
}
.tab::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: -1px;
  height: 2px;
  background: transparent;
  transition: background 0.2s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { background: var(--ink); }
.tab-panel { display: none; animation: fade 0.3s both; }
.tab-panel.active { display: block; }

/* Timetable */
.table-head {
  display: grid;
  grid-template-columns: 1fr 54px 54px 43px;
  padding: 11px 0 8px;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
}
.table-head span:nth-child(n+2) { text-align: right; }
.stop-list { padding-top: 2px; }
.stop-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 54px 54px 43px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid rgba(23, 33, 43, 0.075);
  cursor: pointer;
  transition: background 0.18s;
}
.stop-row:hover, .stop-row.highlight { background: rgba(232, 173, 95, 0.13); }
.stop-main { position: relative; display: flex; align-items: center; min-width: 0; padding-left: 20px; }
.stop-track {
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.stop-row:first-child .stop-track { top: 50%; }
.stop-row:last-child .stop-track { bottom: 50%; }
.stop-dot {
  position: absolute;
  left: 1px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border: 1.5px solid var(--gold-dark);
  background: var(--paper);
  border-radius: 50%;
  z-index: 1;
}
.stop-row.start .stop-dot { background: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 33, 43, 0.1); }
.stop-row.end .stop-dot { background: var(--gold-dark); border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(155, 92, 34, 0.13); }
.stop-name { min-width: 0; }
.stop-name b {
  display: block;
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stop-name span {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.stop-time {
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stop-time em {
  display: inline-block;
  font-style: normal;
  font-size: 7px;
  color: var(--gold-dark);
  vertical-align: top;
  margin-left: 1px;
  margin-top: -1px;
}
.stop-time.dim { color: #a3a29b; }
.stop-km { text-align: right; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.stop-km small { font-size: 7px; margin-left: 1px; }
.stop-row.expanded .stop-track { background: var(--gold-dark); }

/* Route tab */
.route-summary { padding: 18px 0 12px; display: flex; align-items: flex-start; gap: 14px; }
.route-summary-number {
  font-family: var(--mono);
  font-size: 31px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-weight: 600;
}
.route-summary-copy { padding-top: 2px; }
.route-summary-copy b { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; }
.route-summary-copy span { display: block; margin-top: 4px; font-size: 9px; color: var(--ink-faint); line-height: 1.6; }
.line-list { border-top: 1px solid var(--line); }
.line-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.line-index { font-family: var(--mono); font-size: 9px; color: var(--gold-dark); }
.line-main b { display: block; font-family: var(--serif); font-size: 13.5px; font-weight: 600; }
.line-main span { display: block; margin-top: 3px; font-size: 8.5px; color: var(--ink-faint); }
.line-km { font-family: var(--mono); font-size: 12px; color: var(--ink); white-space: nowrap; }
.line-km small { font-size: 7px; color: var(--ink-faint); margin-left: 1px; }
.line-bar { grid-column: 2 / 4; height: 2px; background: rgba(23,33,43,0.08); margin-top: 4px; overflow: hidden; }
.line-bar i { display: block; height: 100%; background: var(--gold-dark); }
.route-tip {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding: 9px 10px;
  background: rgba(23, 33, 43, 0.035);
  color: var(--ink-faint);
  font-size: 8.5px;
  line-height: 1.6;
}
.route-tip svg { flex: 0 0 auto; font-size: 11px; margin-top: 1px; color: var(--gold-dark); }

/* Formation tab */
.formation-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px 0 15px;
}
.model-badge {
  min-width: 76px;
  padding: 8px 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--paper);
  background: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.formation-head b { display: block; font-family: var(--serif); font-size: 14px; font-weight: 600; }
.formation-head span { display: block; margin-top: 4px; font-size: 9px; color: var(--ink-faint); }
.train-consist {
  display: flex;
  align-items: stretch;
  gap: 2px;
  overflow-x: auto;
  padding: 7px 0 11px;
  scrollbar-width: thin;
}
.coach {
  flex: 0 0 auto;
  min-width: 27px;
  padding: 7px 2px 6px;
  text-align: center;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.52);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.coach b { font-family: var(--mono); font-size: 8.5px; font-weight: 600; color: var(--ink); }
.coach small { font-size: 6.5px; color: var(--ink-faint); writing-mode: horizontal-tb; letter-spacing: 0.02em; white-space: nowrap; }
.coach.zy { background: rgba(232, 173, 95, 0.2); border-color: rgba(155, 92, 34, 0.28); }
.coach.ze { background: rgba(85, 200, 180, 0.13); border-color: rgba(12, 117, 103, 0.2); }
.coach.zec, .coach.ca { background: rgba(196, 87, 62, 0.12); border-color: rgba(196, 87, 62, 0.26); }
.coach.rw, .coach.yw { background: rgba(23, 33, 43, 0.07); }
.coach.engine { background: var(--ink); border-color: var(--ink); }
.coach.engine b, .coach.engine small { color: var(--paper); }
.consist-caption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 8px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
  margin-top: 1px;
}
.model-facts {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.fact {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.fact span { display: block; font-size: 7.5px; letter-spacing: 0.08em; color: var(--ink-faint); }
.fact b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--ink); }

.train-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 25px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 8px;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}
.foot-sep { flex: 1; height: 1px; background: var(--line); margin: 0 3px; }
.train-foot button { color: var(--ink-faint); border-bottom: 1px solid var(--line); padding: 0; font-size: 8px; }
.train-foot button:hover { color: var(--gold-dark); border-color: var(--gold-dark); }

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */

.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 10, 17, 0.74); backdrop-filter: blur(7px); animation: fade 0.25s both; }
.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: min(82vh, 780px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 80% 0, rgba(232, 173, 95, 0.14), transparent 33%),
    var(--paper);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
  animation: modal-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 0;
}
.modal-eyebrow { font-family: var(--mono); font-size: 8px; letter-spacing: 0.2em; color: var(--gold-dark); }
.modal-head h3 { margin: 6px 0 0; font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: -0.02em; }
.modal-close { width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink-soft); font-size: 17px; border: 1px solid var(--line); }
.modal-close:hover { color: var(--ink); background: var(--paper-light); }
.modal-search {
  margin: 20px 24px 0;
  height: 41px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  background: var(--paper-light);
  padding: 0 11px;
}
.modal-search svg { color: var(--ink-faint); font-size: 14px; }
.modal-search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 11px; }
.modal-search span { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); white-space: nowrap; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 13px 24px 12px; border-bottom: 1px solid var(--line); }
.filter {
  padding: 5px 9px;
  border: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  transition: 0.15s;
}
.filter:hover { border-color: var(--ink-soft); }
.filter.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.browse-list { flex: 1; overflow-y: auto; padding: 2px 24px; scrollbar-width: thin; }
.browse-row {
  width: 100%;
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background 0.15s;
}
.browse-row:hover { background: rgba(255, 250, 240, 0.7); }
.browse-code { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.browse-route b { display: block; font-size: 10.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browse-route span { display: block; margin-top: 3px; font-size: 8.5px; color: var(--ink-faint); }
.browse-meta { text-align: right; font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.browse-meta b { display: block; font-size: 10px; font-weight: 500; color: var(--ink-soft); margin-bottom: 3px; }
.browse-pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 13px 24px 17px; border-top: 1px solid var(--line); }
.browse-pager button { font-size: 9px; color: var(--ink-soft); border-bottom: 1px solid var(--line); padding: 2px 0; }
.browse-pager button:disabled { opacity: 0.3; cursor: default; }
.browse-pager span { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.browse-empty { padding: 50px 20px; text-align: center; color: var(--ink-faint); font-size: 11px; }

.about-card { width: min(590px, 100%); }
.about-body { padding: 19px 24px 25px; overflow-y: auto; }
.about-body p { font-size: 11px; line-height: 1.9; color: var(--ink-soft); margin: 0 0 14px; letter-spacing: 0.01em; }
.about-body p b { color: var(--ink); font-weight: 600; }
.about-sources { display: flex; flex-wrap: wrap; gap: 7px; margin: 19px 0 17px; }
.about-sources a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  padding: 6px 8px;
  font-size: 9px;
  color: var(--ink-soft);
  transition: 0.15s;
}
.about-sources a:hover { border-color: var(--gold-dark); color: var(--gold-dark); }
.about-sources svg { font-size: 9px; }
.about-disclaimer { font-size: 9px !important; color: var(--ink-faint) !important; border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 0 !important; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--paper);
  padding: 9px 14px;
  font-size: 10px;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------------------
   Leaflet custom markers
   -------------------------------------------------------------------------- */

.station-marker { position: relative; width: 14px; height: 14px; }
.station-marker::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0b1722;
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 173, 95, 0.1);
}
.station-marker.major::before { width: 8px; height: 8px; left: 3px; top: 3px; background: var(--gold-bright); border-color: #f6dfb8; }
.station-marker.terminal::before { width: 11px; height: 11px; left: 1px; top: 1px; background: var(--paper); border: 3px solid var(--gold); box-shadow: 0 0 0 4px rgba(232, 173, 95, 0.16); }
.station-marker.terminal.end::before { background: var(--teal); border-color: #d8f7f1; }
.station-label {
  background: rgba(8, 18, 29, 0.72) !important;
  border: 1px solid rgba(245, 238, 224, 0.17) !important;
  color: rgba(245, 238, 224, 0.8) !important;
  font-family: var(--sans) !important;
  font-size: 10px !important;
  letter-spacing: 0.04em !important;
  padding: 3px 6px !important;
  box-shadow: none !important;
  border-radius: 2px !important;
  white-space: nowrap;
}
.station-label::before { display: none !important; }
.station-label.hub-label { opacity: .52 !important; font-family: var(--mono) !important; font-size: 8px !important; border: 0 !important; background: transparent !important; color: rgba(245,238,224,.5) !important; letter-spacing: .12em !important; }
.station-label.big { font-family: var(--serif) !important; font-size: 12px !important; color: #f7ead7 !important; border-color: rgba(232, 173, 95, 0.3) !important; }
.train-marker-wrap { width: 34px; height: 34px; }
.train-marker {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--night);
  background: var(--gold-bright);
  border: 2px solid #fff2d8;
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(232, 173, 95, 0.14), 0 3px 18px rgba(0, 0, 0, 0.5);
  font-size: 15px;
  animation: marker-pulse 2.8s infinite;
}
.train-marker::after {
  content: "";
  position: absolute;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(232, 173, 95, 0.25);
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hud-in { from { opacity: 0; transform: translateY(-9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rail-load { 0% { left: -30%; } 100% { left: 100%; } }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes marker-pulse { 0%, 100% { box-shadow: 0 0 0 7px rgba(232, 173, 95, 0.14), 0 3px 18px rgba(0,0,0,.5); } 50% { box-shadow: 0 0 0 12px rgba(232, 173, 95, 0.04), 0 3px 18px rgba(0,0,0,.5); } }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  :root { --panel: 390px; }
  .hero h1 { font-size: 35px; }
  .map-hud { width: min(380px, calc(100vw - var(--panel) - 60px)); }
  .hud-code { font-size: 48px; }
}

@media (max-width: 900px) {
  body { overflow: auto; background: var(--paper); }
  .app { display: flex; flex-direction: column; height: auto; min-height: 100%; }
  .map-shell { height: 47vh; min-height: 330px; flex: none; width: 100%; }
  .panel { width: 100%; flex: none; height: auto; min-height: 53vh; border-right: 0; box-shadow: 0 -18px 50px rgba(0,0,0,.2); }
  .panel-scroll { overflow: visible; height: auto; padding: 20px 22px 36px; }
  .topbar { padding: 16px 18px 0; }
  .topbar-brand .brand-en, .topbar-meta { display: none; }
  .topbar-actions { gap: 7px; }
  .topbar-actions .ghost-btn { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; font-size: 9px; }
  .map-hud { top: 64px; left: 18px; right: 18px; width: auto; }
  .hud-code { font-size: 38px; }
  .hud-route { gap: 11px; }
  .hud-cities { font-size: 14px; }
  .hud-stats { margin-top: 11px; }
  .hud-line-row { display: none; }
  .map-legend { left: 18px; bottom: 29px; font-size: 8px; gap: 10px; padding: 7px 9px; }
  .map-tools { right: 14px; bottom: 29px; }
  .map-caption { display: none; }
  .map-tint { background: linear-gradient(0deg, rgba(8,18,29,.72), transparent 35%), linear-gradient(180deg, rgba(8,18,29,.5), transparent 22%); }
  .panel-brand { display: none; }
  .mobile-close { display: none; }
  .home-view { padding-top: 25px; }
  .hero h1 { font-size: 34px; }
  .hero-copy { max-width: none; }
  .panel-brand-main { font-size: 15px; }
  .stats-strip { max-width: 440px; }
  .quick-grid { max-width: 480px; }
}

@media (max-width: 560px) {
  .map-shell { height: 43vh; min-height: 290px; }
  .panel-scroll { padding: 17px 17px 30px; }
  .hero h1 { font-size: 31px; }
  .hero-copy { font-size: 10.5px; }
  .search-box { height: 47px; }
  .search-hint { font-size: 8px; gap: 6px; }
  .stats-strip .stat b { font-size: 21px; }
  .quick-card { padding: 11px; min-height: 63px; }
  .q-code { font-size: 15px; }
  .q-route { font-size: 8px; }
  .train-code-wrap h2 { font-size: 51px; }
  .route-end b { font-size: 16px; }
  .route-end span { font-size: 16px; }
  .train-ticket { padding: 16px 15px 13px; }
  .ticket-tags { max-width: 130px; }
  .metric b { font-size: 16px; }
  .metric { padding-left: 5px; padding-right: 4px; }
  .metric em { font-size: 7px; }
  .metric-icon { font-size: 9px; }
  .calendar-days { gap: 2px; }
  .table-head, .stop-row { grid-template-columns: 1fr 46px 46px 36px; }
  .stop-name b { font-size: 12.5px; }
  .stop-time { font-size: 12px; }
  .map-legend { display: none; }
  .map-tools { bottom: 16px; right: 12px; flex-direction: row; }
  .map-tool { width: 32px; height: 32px; }
  .modal { padding: 12px; }
  .modal-card { max-height: 90vh; }
  .modal-head, .modal-search, .filter-row, .browse-list, .browse-pager { padding-left: 16px; padding-right: 16px; }
  .browse-row { grid-template-columns: 56px 1fr auto; gap: 8px; }
  .browse-code { font-size: 13px; }
  .modal-head h3 { font-size: 23px; }
  .tabs { margin-top: 18px; }
  .tab { font-size: 9.5px; }
}

@media (max-height: 720px) and (min-width: 901px) {
  .home-view { padding-top: 23px; }
  .hero h1 { font-size: 33px; }
  .hero-copy { margin-top: 10px; line-height: 1.7; }
  .rule { margin: 18px 0 15px; }
  .quick-section { margin-top: 19px; }
  .home-foot { margin-top: 20px; }
  .panel-scroll { padding-top: 20px; }
  .panel-brand { margin-bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
