/* Prevent Mobile Input Focus Zoom & Scaling Shifts */
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
:root {
  color-scheme: dark;
  --bg: #05070b;
  --page-bg: linear-gradient(180deg, #111827 0%, #05070b 42%, #0b0f17 100%);
  --card-bg: rgba(28, 31, 38, 0.78);
  --surface-bg: rgba(255, 255, 255, 0.07);
  --surface-hover: rgba(255, 255, 255, 0.12);
  --dropdown-bg: #1c1f26;
  --text: #f5f5f7;
  --text-muted: #a1a1aa;
  --purple-line: #bf5af2;
  --green-line: #30d158;
  --yellow-line: #ffd60a;
  --border: rgba(255, 255, 255, 0.13);
  --accent: #64d2ff;
  --highlight: #ff375f;
  --warning: #ffd60a;
  --footer-muted: #8e8e93;
  --card-shadow: 0 18px 50px rgba(0,0,0,0.32);
  --dropdown-shadow: 0 18px 36px rgba(0,0,0,0.46);
  --accent-soft: rgba(100, 210, 255, 0.10);
  --accent-medium: rgba(100, 210, 255, 0.18);
  --accent-border: rgba(100, 210, 255, 0.28);
  --accent-border-strong: rgba(100, 210, 255, 0.42);
  --highlight-soft: rgba(244, 63, 94, 0.1);
  --highlight-medium: rgba(244, 63, 94, 0.12);
  --highlight-border: rgba(244, 63, 94, 0.3);
  --warning-soft: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);
  --item-border: rgba(51, 65, 85, 0.4);
  --badge-ring: #ffffff;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f5f7;
    --page-bg: linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 54%, #eef2f6 100%);
    --card-bg: rgba(255, 255, 255, 0.82);
    --surface-bg: rgba(118, 118, 128, 0.10);
    --surface-hover: rgba(118, 118, 128, 0.16);
    --dropdown-bg: #ffffff;
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --purple-line: #af52de;
    --green-line: #34c759;
    --yellow-line: #ffcc00;
    --border: rgba(60, 60, 67, 0.16);
    --accent: #007aff;
    --highlight: #ff2d55;
    --warning: #b25000;
    --footer-muted: #86868b;
    --card-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
    --dropdown-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
    --accent-soft: rgba(0, 122, 255, 0.08);
    --accent-medium: rgba(0, 122, 255, 0.14);
    --accent-border: rgba(0, 122, 255, 0.22);
    --accent-border-strong: rgba(0, 122, 255, 0.34);
    --highlight-soft: rgba(190, 18, 60, 0.08);
    --highlight-medium: rgba(190, 18, 60, 0.11);
    --highlight-border: rgba(190, 18, 60, 0.25);
    --warning-soft: rgba(146, 64, 14, 0.08);
    --warning-border: rgba(146, 64, 14, 0.24);
    --item-border: rgba(216, 224, 235, 0.9);
    --badge-ring: #ffffff;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif; }

body {
  background: var(--page-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.header {
  text-align: center;
  padding: 18px 8px 10px;
}

.header h1 {
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  line-height: 1.05;
  letter-spacing: 0;
  color: var(--text);
  font-weight: 850;
}

.header p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 7px;
  font-weight: 520;
}

.clock-banner {
  background: var(--surface-bg);
  border: 1px solid var(--border);
  padding: 8px 13px;
  border-radius: 999px;
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 700;
  backdrop-filter: blur(18px);
}

.card {
  background: var(--card-bg);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(26px);
}
/* Destination Alarm Toggle Button */
.alarm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #3b82f6;
  background-color: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.alarm-btn.alarm-active {
  background-color: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
}

/* Overlay Alarm Modal */
.alarm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.alarm-modal-content {
  background: var(--card-bg);
  color: var(--text);
  padding: 24px;
  border-radius: 16px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  animation: popIn 0.3s ease;
}

.alarm-modal-content p {
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 8px;
}

.alarm-modal-content strong {
  color: var(--text);
}

.alarm-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.dismiss-alarm-btn {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #dc2626;
  color: white;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Destination Label Header Row & Inline Alarm Button */
.destination-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.destination-actions { display: flex; align-items: center; gap: 6px; }

.map-picker-btn {
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.inline-alarm-btn {
  margin-top: 0 !important;
  width: auto !important;
  padding: 4px 10px !important;
  font-size: 0.72rem !important;
  border-radius: 999px !important;
  line-height: 1;
}

.alarm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--accent);
  background-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.alarm-btn.alarm-active {
  background-color: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

.search-card {
  position: relative;
  z-index: 30;
  overflow: visible;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  position: relative;
}

label { 
  font-size: 0.72rem; 
  font-weight: 780; 
  text-transform: uppercase; 
  letter-spacing: 0.06em; 
  color: var(--text-muted); 
}

.input-wrapper { position: relative; width: 100%; }

input {
  width: 100%;
  padding: 14px 42px 14px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-bg);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--card-bg);
}

input:disabled { opacity: 0.6; cursor: not-allowed; background: var(--surface-hover); }
input[readonly] { cursor: default; }

.collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.collapsible-toggle h2 { margin: 0; }
.collapsible-icon { font-size: 1.25rem; font-weight: 600; line-height: 1; }
.collapsible-content[hidden] { display: none; }

.clear-input-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  transform: translateY(-50%);
}

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

.source-helper {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
  margin-top: 2px;
}

.autocomplete-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: var(--dropdown-bg);
  border: 1px solid var(--accent);
  border-radius: 14px;
  z-index: 1000;
  display: none;
  box-shadow: var(--dropdown-shadow);
  backdrop-filter: blur(24px);
}

.autocomplete-item {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  border-bottom: 1px solid var(--item-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--surface-hover); }

.item-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
}

.station-match-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 2px;
  width: fit-content;
}

.line-badge-sm { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; font-weight: bold; }
.line-badge-sm.Purple { background: var(--purple-line); color: #fff; }
.line-badge-sm.Green { background: var(--green-line); color: #fff; }
.line-badge-sm.Yellow { background: var(--yellow-line); color: #000; }
.line-badge-sm.Interchange { background: #f59e0b; color: #000; }

.gps-status { font-size: 0.8rem; color: var(--accent); margin-top: 6px; line-height: 1.3; }

/* Quick Schedules Bar */
.quick-schedules-container {
  margin-bottom: 14px;
  background: var(--surface-bg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 14px;
}

.quick-schedules-label {
  font-size: 0.72rem;
  font-weight: 780;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.quick-schedules-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-schedule-chip {
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.quick-schedule-chip:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.quick-schedule-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-border-strong);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* View Switcher */
.view-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-bg);
}

.view-switcher button {
  border: 0;
  border-radius: 11px;
  padding: 10px 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.view-switcher button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.20);
}

.sponsor-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--accent-border);
  background:
    linear-gradient(90deg, rgba(100, 210, 255, 0.18), rgba(52, 199, 89, 0.12)),
    var(--card-bg);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(22px);
}

.sponsor-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--green-line));
}

.sponsor-link {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px 8px 14px;
  color: var(--text);
  text-decoration: none;
}

.sponsor-label,
.sponsor-action {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
}

.sponsor-label {
  padding: 0 7px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-bg);
  text-transform: uppercase;
}

.sponsor-text {
  overflow: hidden;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 620;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sponsor-text strong {
  color: var(--accent);
  font-weight: 900;
}

.sponsor-action {
  padding: 0 10px;
  border: 1px solid var(--accent-border-strong);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(0, 122, 255, 0.18);
}

.sponsor-card:hover,
.sponsor-card:focus-within {
  border-color: var(--accent-border-strong);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

/* Map Card */
.map-card {
  display: none;
  overflow: hidden;
  padding: 0;
  border-radius: 24px;
  position: relative;
  z-index: 5;
  background:
    linear-gradient(180deg, var(--accent-soft), rgba(255,255,255,0.02)),
    var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(26px);
}

.map-card[style*="display: block"] {
  animation: mapCardReveal 320ms ease both;
}

@keyframes mapCardReveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .map-card[style*="display: block"] { animation: none; }
}

.metro-map-wrap { position: relative; }

.map-pick-overlay {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 700;
  width: min(330px, calc(100% - 28px));
  padding: 12px;
  border: 1px solid var(--accent-border-strong);
  border-radius: 12px;
  background: var(--dropdown-bg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.map-pick-overlay[hidden] { display: none; }
.map-pick-kicker { color: var(--accent); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.map-pick-search { position: relative; margin-top: 8px; }
.map-pick-search input { padding: 9px 10px; border-radius: 8px; font-size: 0.8rem; }
.map-place-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 2; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--dropdown-bg); box-shadow: var(--dropdown-shadow); }
.map-place-results:empty { display: none; }
.map-place-result { display: block; width: 100%; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; font-size: 0.76rem; line-height: 1.3; cursor: pointer; }
.map-place-result:last-child { border-bottom: 0; }
.map-place-result:hover, .map-place-result:focus { background: var(--surface-hover); outline: none; }
.map-pick-coordinates { margin-top: 4px; color: var(--text-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.map-pick-station { margin-top: 7px; color: var(--text); font-size: 0.84rem; line-height: 1.35; padding-right: 20px; }
.map-pick-station span { color: var(--text-muted); }
.map-pick-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.map-pick-actions button { border: 0; border-radius: 8px; padding: 7px 9px; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 800; cursor: pointer; }
.map-pick-actions .map-pick-dismiss { margin-left: auto; padding: 4px 8px; background: transparent; color: var(--text-muted); font-size: 1.1rem; }

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, var(--card-bg), var(--surface-bg)),
    linear-gradient(90deg, var(--accent-soft), rgba(52,199,89,0.08));
  backdrop-filter: blur(22px);
}

.map-toolbar h2 {
  font-size: 1.22rem;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: 0;
  font-weight: 850;
}

.map-toolbar p {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 5px;
  font-weight: 550;
}

.map-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  background: linear-gradient(145deg, #007aff, #34c759);
  box-shadow: 0 10px 20px rgba(0, 122, 255, 0.26);
  flex: 0 0 auto;
}

.map-status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.map-live-pill {
  align-self: flex-start;
  white-space: nowrap;
  border: 1px solid var(--highlight-border);
  background: var(--highlight-soft);
  color: var(--highlight);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.72rem;
  font-weight: 800;
}

.map-mini-stats {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-mini-stat {
  border: 1px solid var(--border);
  background: var(--surface-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.metro-map-wrap {
  width: 100%;
  overflow: auto;
  position: relative;
  background:
    radial-gradient(circle at 18% 20%, rgba(110, 134, 82, 0.42), transparent 24%),
    radial-gradient(circle at 74% 18%, rgba(67, 96, 78, 0.48), transparent 29%),
    radial-gradient(circle at 60% 76%, rgba(93, 111, 82, 0.44), transparent 31%),
    radial-gradient(circle at 28% 78%, rgba(54, 81, 78, 0.38), transparent 34%),
    linear-gradient(31deg, transparent 0 45%, rgba(226, 218, 192, 0.25) 47% 49%, transparent 51% 100%),
    linear-gradient(119deg, transparent 0 57%, rgba(229, 222, 196, 0.20) 59% 60%, transparent 62% 100%),
    linear-gradient(180deg, #2f3a31 0%, #23322c 46%, #1d2b2b 100%);
  background-size: auto, auto, auto, auto, 260px 260px, 310px 310px, auto;
}

.leaflet-metro-map {
  position: relative;
  z-index: 2;
  width: 100%;
  height: min(68vh, 620px);
  min-height: 430px;
  background: var(--surface-bg);
  display: none;
}

.leaflet-metro-map.active { display: block; }
.leaflet-metro-map .leaflet-control-attribution { font-size: 10px; }

.leaflet-metro-map .leaflet-tooltip {
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  color: var(--text);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  padding: 5px 7px;
  white-space: nowrap;
}

.leaflet-metro-map .leaflet-tooltip.route-station-label {
  border-color: var(--accent-border);
  background: color-mix(in srgb, var(--accent-soft) 72%, var(--card-bg));
}

.leaflet-metro-map .leaflet-tooltip.live-location-label {
  border-color: var(--highlight-border);
  background: color-mix(in srgb, var(--highlight-soft) 76%, var(--card-bg));
  color: var(--highlight);
}

.leaflet-station-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--marker-color, #38bdf8);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.30);
}

.leaflet-station-marker.selected {
  width: 20px;
  height: 20px;
  border-width: 4px;
}

.leaflet-train-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 28px;
  border-radius: 999px;
  background: var(--highlight);
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(255, 45, 85, 0.35);
  border: 2px solid #ffffff;
}

.html-metro-map {
  position: relative;
  z-index: 1;
  padding: 14px;
  background:
    radial-gradient(circle at 15% 15%, rgba(163, 173, 112, 0.20), transparent 24%),
    radial-gradient(circle at 82% 16%, rgba(59, 101, 82, 0.22), transparent 28%),
    linear-gradient(45deg, rgba(255,255,255,0.04) 0 24%, transparent 25% 100%),
    rgba(16, 28, 25, 0.28);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-bg);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.legend-line {
  width: 26px;
  height: 4px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 5px;
  vertical-align: middle;
}

.legend-line.purple { background: var(--purple-line); }
.legend-line.green { background: var(--green-line); }
.legend-line.yellow { background: var(--yellow-line); }

/* Results Section Cards */
.unselected-card, .result-card { position: relative; z-index: 1; }
.unselected-card { display: block; }
.result-card { display: none; }

.card-section-title {
  margin-bottom: 10px; 
  font-size: 0.82rem; 
  color: var(--accent); 
  text-transform: uppercase; 
  letter-spacing: 0.06em;
}

.card-section-title.muted { color: var(--text-muted); margin-bottom: 8px; }
.card-section-title.path-title { margin: 16px 0 12px 0; color: var(--text-muted); letter-spacing: 0.5px; }

.card-section-desc {
  font-size: 0.8rem; 
  color: var(--text-muted); 
  margin-bottom: 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.metric-card {
  background: var(--surface-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
}

.metric-card .val { font-size: 1.15rem; font-weight: 850; color: var(--accent); }
.metric-card .lbl { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.dual-train-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.next-train-box {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 12px 13px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.next-train-box.active-route-dir {
  border-color: var(--accent);
  background: var(--accent-medium);
}

.next-train-box .time-title { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.next-train-box .time-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.next-train-box .time-val { font-size: 0.95rem; font-weight: 700; color: var(--accent); white-space: nowrap; text-align: right; }
.next-train-box .time-val.no-service { color: var(--highlight); }

/* Route Timeline */
.route-timeline { display: flex; flex-direction: column; gap: 0; position: relative; }

.step {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 20px;
  border-radius: 6px;
  transition: background 0.3s ease;
}

.step:last-child { padding-bottom: 0; }
.step::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 3px;
  background: var(--border);
}

.step:last-child::before { display: none; }

.badge {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  z-index: 1;
  flex-shrink: 0;
}

.badge.purple { background: var(--purple-line); color: white; }
.badge.green { background: var(--green-line); color: white; }
.badge.yellow { background: var(--yellow-line); color: black; }
.badge.interchange { background: #f59e0b; color: black; }

.step-content { flex: 1; min-width: 0; }
.step-header-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.step-title { font-weight: 600; font-size: 0.9rem; word-break: break-word; }

.arrival-time-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}

.arrival-time-tag.no-service-tag {
  color: var(--highlight);
  background: var(--highlight-soft);
  border-color: var(--highlight-border);
}

.step-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }

.step.live-location-active {
  background: var(--highlight-medium);
  border-left: 4px solid var(--highlight);
  padding: 8px 10px 12px 10px;
  margin-left: -10px;
  border-radius: 14px;
}

.step.live-location-active .badge { box-shadow: 0 0 10px var(--highlight); border: 2px solid var(--badge-ring); }

.live-tag {
  display: inline-block;
  background: var(--highlight);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 999px;
  margin-left: 6px;
  letter-spacing: 0.5px;
  animation: pulse 1.5s infinite;
}

.live-tag.approaching {
  background: var(--warning);
  color: #000000;
}
/* Location Toggle Switch */
.location-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-label {
  font-size: 0.72rem;
  font-weight: 780;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.25s ease;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s ease;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(16px);
}
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

.platform-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-medium);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
  border: 1px solid var(--accent-border-strong);
}

.alert {
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  padding: 8px;
  border-radius: 14px;
  font-size: 0.8rem;
  margin-top: 6px;
}

.alert.danger {
  background: var(--highlight-soft);
  border-color: var(--highlight-border);
  color: var(--highlight);
  margin-bottom: 12px;
}

.seo-content {
  width: 100%;
  max-width: 720px;
  margin-top: 16px;
  color: var(--text);
  line-height: 1.55;
}

.seo-content h2 { font-size: 1rem; margin-bottom: 8px; color: var(--text); }
.seo-content h3 { font-size: 0.88rem; margin: 14px 0 6px; color: var(--accent); }
.seo-content p, .seo-content li { color: var(--text-muted); font-size: 0.82rem; }
.seo-content ul { margin: 8px 0 0 18px; }
.seo-content a { color: var(--accent); font-weight: 700; text-decoration: none; }
.seo-content a:hover, .seo-content a:focus { text-decoration: underline; }

footer {
  width: 100%;
  max-width: 720px;
  margin-top: 20px;
  padding: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

footer p.disclaimer { margin-bottom: 8px; color: var(--footer-muted); }
footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

footer p.copyright { font-weight: 600; color: var(--text-muted); }
footer a { color: var(--accent); font-weight: 700; text-decoration: none; }
footer a:hover, footer a:focus { text-decoration: underline; }

@media (max-width: 480px) {
  body { padding: 10px; }
  .card { padding: 12px; }
  .header h1 { font-size: 1.2rem; }
  .sponsor-link {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 42px;
    padding: 8px 9px 8px 13px;
  }
  .sponsor-text {
    font-size: 0.76rem;
  }
  .sponsor-action {
    justify-self: end;
  }
  .map-toolbar { flex-direction: column; }
  .map-live-pill { align-self: flex-start; }
  .metric-card .val { font-size: 0.95rem; }
  .metric-card .lbl { font-size: 0.65rem; }
}

/* Force 16px input size only on mobile/touch screens to prevent zoom */
@media (pointer: coarse), (max-width: 1024px) {
  input[type="text"],
  input {
    font-size: 16px !important;
    touch-action: manipulation;
  }
}
