/* ==========================================================================
   上海地铁票价对比图 · 方案 B (沉浸式全屏地图) — 亮/暗双模式样式系统
   ========================================================================== */

:root,
[data-theme="light"] {
  --map-bg: #edf2f7;
  --map-grid: rgba(15, 23, 42, 0.045);
  --river-fill: #dbeafe;
  --coast-stroke: #bfdbfe;
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-solid: #ffffff;
  --surface: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;
  --inverse-bg: #0f172a;
  --inverse-text: #ffffff;
  --orange: #ea580c;
  --orange-soft: #fff7ed;
  --green: #059669;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --red: #ef4444;
  --teal: #009ca6;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.15), 0 4px 12px rgba(15, 23, 42, 0.06);
  --node-fill: #ffffff;
  --node-stroke: #0f172a;
  --station-label: #1e293b;
  --station-label-halo: rgba(237, 242, 247, 0.92);
}

[data-theme="dark"] {
  --map-bg: #090e1a;
  --map-grid: rgba(148, 163, 184, 0.07);
  --river-fill: #112240;
  --coast-stroke: #1e3a5f;
  --glass-bg: rgba(19, 28, 49, 0.92);
  --glass-solid: #131c31;
  --surface: #1b263f;
  --surface-hover: #243352;
  --border: #2d3d5e;
  --border-strong: #3d517a;
  --text: #f8fafc;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  --inverse-bg: #f8fafc;
  --inverse-text: #0f172a;
  --orange: #f97316;
  --orange-soft: #3b1f0f;
  --green: #10b981;
  --green-soft: #0b2e24;
  --amber: #f59e0b;
  --red: #ef4444;
  --teal: #00b8c4;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.48), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.56), 0 4px 14px rgba(0, 0, 0, 0.35);
  --node-fill: #0f172a;
  --node-stroke: #f8fafc;
  --station-label: #e2e8f0;
  --station-label-halo: rgba(9, 14, 26, 0.9);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--map-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.hidden {
  display: none !important;
}

/* App Shell & Map Viewport */
.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.map-viewport {
  position: absolute;
  inset: 0;
  background: var(--map-bg);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: background-color 0.25s ease;
}

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

.metro-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* SVG Interactive Elements */
.metro-line-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.22s ease, stroke-width 0.22s ease;
}

.metro-line-path.dimmed {
  opacity: 0.14 !important;
}

.active-route-glow {
  fill: none;
  stroke: var(--orange);
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.28;
}

.active-route-dash {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3.2;
  stroke-dasharray: 8 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.station-group {
  cursor: pointer;
}

.station-group:hover .station-circle {
  stroke-width: 3.5;
}

.station-label {
  font-family: "Noto Sans SC", sans-serif;
  fill: var(--station-label);
  letter-spacing: 0.09em;
  paint-order: stroke;
  stroke: var(--station-label-halo);
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.station-group:hover .station-label {
  opacity: 1 !important;
}

/* Floating Cards (lightweight compositing — avoids 60fps full-screen blur lag) */
.floating-card {
  position: absolute;
  background: var(--glass-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 20;
  contain: layout style;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* ==========================================================================
   1. Top-Left Floating Omnibox Card
   ========================================================================== */
.omni-card {
  top: 20px;
  left: 20px;
  width: 368px;
  padding: 16px;
  border-radius: 20px;
}

.omni-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lang-btn {
  font-family: "JetBrains Mono", "Noto Sans SC", sans-serif;
  padding: 5px 9px;
  font-weight: 700;
}

.icon-btn {
  padding: 5px 8px;
  text-decoration: none;
}

.legend-repo-link {
  font-family: "JetBrains Mono", "Noto Sans SC", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  text-decoration: none;
  transition: color 0.15s ease;
}

.legend-repo-link:hover {
  color: var(--orange);
  text-decoration: underline;
}

.brand-badge {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #e4002b;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
}

.brand-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.theme-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-hover);
}

/* OD Input Box */
.od-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 10px 4px 12px;
  margin-bottom: 12px;
}

.od-inputs {
  flex: 1;
  min-width: 0;
}

.od-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
}

.od-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.origin-dot {
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.dest-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.od-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  outline: none;
}

.od-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.od-line-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.od-clear-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.od-clear-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Selection Toast & Station Action Popover */
.selection-toast {
  position: absolute;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.station-popover {
  position: fixed;
  z-index: 75;
  width: 220px;
  padding: 12px;
  border-radius: 14px;
  background: var(--glass-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
}

.popover-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.popover-lines {
  display: flex;
  gap: 3px;
}

.popover-fare {
  font-family: "JetBrains Mono", "Noto Sans SC", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 10px;
}

.popover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.popover-btn {
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.popover-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.popover-btn.origin-btn {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.popover-btn.dest-btn {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.mini-line-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.2;
}

.od-divider {
  height: 1px;
  background: var(--border);
  margin-left: 18px;
  margin-right: 6px;
}

.swap-btn {
  width: 32px;
  height: 32px;
  margin-left: 8px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass-solid);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, background-color 0.18s ease, color 0.18s ease;
}

.swap-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: rotate(180deg);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 42px;
  left: -12px;
  right: -42px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--glass-solid);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  padding: 4px;
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.ac-item:hover,
.ac-item.selected {
  background: var(--surface-hover);
}

.ac-name {
  font-weight: 600;
}

.ac-lines {
  display: flex;
  gap: 4px;
}

/* Mode Pills */
.mode-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mode-pill {
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mode-pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.mode-pill.active {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  border-color: var(--inverse-bg);
}

.data-status-bar {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ==========================================================================
   2. Top-Center Floating Line Filter Bar
   ========================================================================== */
.line-filter-bar {
  top: 20px;
  left: 50%;
  transform: translateX(-52%);
  height: 46px;
  padding: 6px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 820px);
}

.line-chips-scroll {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.line-chips-scroll::-webkit-scrollbar {
  display: none;
}

.line-chip {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-family: "JetBrains Mono", "Noto Sans SC", sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.line-chip:hover {
  transform: translateY(-1px);
}

.line-chip.all-chip {
  font-family: "Noto Sans SC", sans-serif;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text-sub);
  border-color: var(--border);
}

.line-chip.all-chip.active {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  border-color: var(--inverse-bg);
}

.line-chip.active-line {
  box-shadow: 0 0 0 2px var(--glass-solid), 0 0 0 4px var(--text);
}

.line-chip.suburban-chip {
  font-family: "Noto Sans SC", sans-serif;
  padding: 0 10px;
  background: rgba(0, 156, 166, 0.15);
  color: var(--teal);
  border-color: var(--teal);
  font-size: 11px;
}

.more-lines-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.more-lines-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.more-lines-popover {
  top: 54px;
  right: 0;
  width: 320px;
  padding: 12px;
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 40;
}

/* ==========================================================================
   3. Right Floating Comparison Drawer
   ========================================================================== */
.detail-drawer {
  top: 20px;
  right: 20px;
  width: 384px;
  max-height: calc(100vh - 96px);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.drawer-drag-handle {
  display: none;
}

.drawer-scroll-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.drawer-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}

.drawer-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  margin-top: 3px;
}

.delta-pill {
  padding: 5px 11px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  flex-shrink: 0;
}

.delta-zero { background: #10b981; }
.delta-low  { background: #f59e0b; }
.delta-mid  { background: #f97316; }
.delta-high { background: #ef4444; }
.delta-sub  { background: #009ca6; }

/* Split Fare Comparison Card */
.split-fare-card {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 16px;
}

.split-sep {
  background: var(--border);
  margin: 4px 0;
}

.split-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.split-label.new-label {
  color: var(--orange);
  font-weight: 600;
}

.split-price {
  font-family: "JetBrains Mono", monospace;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  margin: 6px 0 8px;
}

.old-price {
  color: var(--text-sub);
  font-weight: 700;
}

.new-price {
  color: var(--text);
}

.bar-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 6px;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.old-bar { background: var(--text-muted); opacity: 0.65; }
.new-bar { background: var(--orange); }

.split-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}

.split-sub.new-sub {
  color: var(--orange);
  font-weight: 500;
}

/* Section Headers */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.section-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Along-the-route Stops List */
.along-stops-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.stop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}

.stop-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.stop-row.active-stop {
  background: var(--orange-soft);
  border-color: var(--orange);
}

.stop-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stop-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stop-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.stop-fare-pair {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.stop-diff-tag {
  min-width: 44px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  font-family: "JetBrains Mono", "Noto Sans SC", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Path Box */
.path-box {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 14px;
}

.path-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.path-box-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.line-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-hover);
  color: var(--text-sub);
  border: 1px solid var(--border);
}

.path-box-text {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-sub);
}

.official-time-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  margin: 8px 0 9px;
  border-radius: 10px;
  background: var(--orange-soft);
  border: 1px solid rgba(249, 115, 22, 0.35);
}

.official-time-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--orange);
}

.official-time-val {
  font-family: "JetBrains Mono", "Noto Sans SC", monospace;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

/* Pass Summary Banner */
.pass-banner {
  padding: 14px;
  background: var(--green-soft);
  border: 1.5px solid var(--green);
  border-radius: 16px;
}

.pass-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pass-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--green);
  color: #ffffff;
}

.pass-freq {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}

.pass-banner-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pass-rec-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.pass-rec-unit {
  font-family: "JetBrains Mono", monospace;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--green);
}

.pass-rec-desc {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-sub);
}

/* Heatmap Stats Grid */
.heatmap-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.hm-stat-card {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.hm-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hm-stat-val {
  font-family: "JetBrains Mono", monospace;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
}

/* Pass Calculator Controls */
.slider-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.slider-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.slider-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  font-weight: 800;
  color: var(--orange);
}

.rides-slider {
  width: 100%;
  accent-color: var(--orange);
  cursor: pointer;
  margin-bottom: 10px;
}

.slider-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.preset-chip {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass-solid);
  color: var(--text-sub);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.preset-chip.active {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: var(--orange);
}

.pass-comparison-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.pass-comp-row {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pass-comp-row.best-plan {
  background: var(--green-soft);
  border-color: var(--green);
  border-width: 1.5px;
}

.pass-comp-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}

.pass-comp-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pass-comp-right {
  text-align: right;
  flex-shrink: 0;
}

.pass-comp-price {
  font-family: "JetBrains Mono", monospace;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
}

.pass-comp-badge {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
}

/* ==========================================================================
   4. Bottom-Left Legend Pill & Bottom-Right Zoom Pill
   ========================================================================== */
.legend-pill {
  left: 20px;
  bottom: 20px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}

.legend-item .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.legend-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.legend-note {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.zoom-pill {
  right: 20px;
  bottom: 20px;
  height: 44px;
  padding: 0 6px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.zoom-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.zoom-btn:hover {
  background: var(--surface-hover);
}

.zoom-pct {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 600;
  min-width: 46px;
  cursor: pointer;
}

.zoom-pct:hover {
  color: var(--text);
}

/* Hover Tooltip */
.station-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 80;
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--glass-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  min-width: 175px;
}

.tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.tooltip-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.tooltip-lines {
  display: flex;
  gap: 3px;
}

.tooltip-fare {
  font-family: "JetBrains Mono", "Noto Sans SC", monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 3px;
}

.tooltip-hint {
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   Responsive Layout
   ========================================================================== */
@media (max-width: 1160px) {
  .line-filter-bar {
    top: auto;
    bottom: 72px;
    left: 20px;
    transform: none;
    max-width: calc(100vw - 440px);
  }
}

@media (max-width: 820px) {
  .app-shell {
    --sheet-height: 54vh;
  }

  .omni-card {
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    width: auto;
    padding: 12px 13px;
    border-radius: 16px;
  }

  .omni-header {
    margin-bottom: 8px;
  }

  .brand-title {
    font-size: 14.5px;
  }

  .od-box {
    margin-bottom: 8px;
  }

  .od-row {
    height: 36px;
  }

  .mode-pill {
    height: 28px;
    font-size: 11px;
  }

  .line-filter-bar {
    display: none;
  }

  .legend-pill {
    display: none;
  }

  /* Zoom pill dynamically rides right above the swipeable bottom sheet */
  .zoom-pill {
    right: 12px;
    bottom: calc(var(--sheet-height) + 12px + env(safe-area-inset-bottom, 0px));
    height: 40px;
    transition: bottom 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .app-shell.sheet-dragging .zoom-pill {
    transition: none;
  }

  /* Swipeable Bottom Sheet */
  .detail-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: var(--sheet-height);
    max-height: 78vh;
    border-radius: 22px 22px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: height 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .app-shell.sheet-dragging .detail-drawer {
    transition: none;
  }

  .drawer-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
    user-select: none;
  }

  .drawer-drag-handle:active {
    cursor: grabbing;
  }

  .drag-pill {
    width: 40px;
    height: 4.5px;
    border-radius: 999px;
    background: var(--border-strong);
  }

  .drawer-scroll-body {
    padding: 4px 16px 20px;
    -webkit-overflow-scrolling: touch;
  }

  .detail-drawer.collapsed .drawer-scroll-body {
    overflow: hidden;
  }
}
