:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --ink: #15243a;
  --muted: #607087;
  --line: #dce4ee;
  --primary: #2264d1;
  --primary-hover: #174da8;
  --mint: #e6f2ef;
  --lime: #87d9c8;
  --amber: #76520c;
  --amber-bg: #fff4d8;
  --red: #a83731;
  --red-bg: #fff0ed;
  --shadow: 0 8px 24px rgb(20 42 74 / 6%);
  --radius: 18px;
  --sidebar: 0px;
  --sans: system-ui, "Roboto", "Noto Sans", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1726;
  --surface: #182438;
  --surface-2: #202f46;
  --ink: #edf3fc;
  --muted: #a9b8cc;
  --line: #34455d;
  --primary: #83b2ff;
  --primary-hover: #a4c7ff;
  --mint: #1c3c43;
  --lime: #78cdbf;
  --amber: #f1cc78;
  --amber-bg: #392f1e;
  --red: #ffaaa0;
  --red-bg: #3c272c;
  --shadow: 0 10px 28px rgb(0 0 0 / 20%);
  color-scheme: dark;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55; }
button, input, select, summary { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #4e8ded;
  outline-offset: 3px;
}
h1, h2, h3 { letter-spacing: -.025em; }
h1 { color: #142a4a; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.06; }
[data-theme="dark"] h1 { color: var(--ink); }

.app-shell { min-height: 100vh; padding-bottom: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  gap: 24px;
  padding: 0 max(24px, calc((100vw - 1320px) / 2));
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
}
.topbar .brand { min-width: 150px; }
.topbar .brand-mark { width: 34px; height: 36px; color: #2264d1; }
.topbar .brand-mark svg { width: 34px; height: 34px; }
.topbar .brand-word { font-size: 21px; letter-spacing: -.8px; }
.topbar .brand-word > span { margin-top: 4px; font-size: 8px; letter-spacing: 2.5px; }
.primary-nav { display: flex; align-items: center; gap: 4px; margin-inline: auto; }
.primary-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px;
  padding: 0 14px; border-radius: 12px; color: var(--muted); font-size: 13px;
}
.primary-link .icon { width: 17px; height: 17px; }
.primary-link:hover { background: var(--surface-2); color: var(--ink); }
.primary-link.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); font-weight: 650; }
.top-actions { gap: 8px; }
.local-clock { padding-inline: 8px; font-size: 10px; letter-spacing: 1px; }
.icon-btn { width: 44px; height: 44px; color: var(--muted); }

.demo-banner {
  min-height: 42px; gap: 10px; padding: 8px max(24px, calc((100vw - 1320px) / 2));
  background: #eaf1fb; color: #244c80; font-size: 12px;
}
[data-theme="dark"] .demo-banner { background: #1d2d45; color: #c3d8fb; }
.demo-banner > .icon { width: 17px; height: 17px; }
.demo-banner button { min-height: 34px; padding: 6px 8px; border-radius: 8px; font-size: 11px; }
.demo-banner button:hover { background: rgb(34 100 209 / 8%); }

.page-main { max-width: 1320px; min-height: calc(100vh - 180px); margin-inline: auto; padding: 34px 28px 0; }
.page-heading { align-items: flex-end; margin-bottom: 24px; }
.page-heading .eyebrow { color: #3972c8; font-size: 10px; letter-spacing: 1.5px; }
.page-heading p { max-width: 700px; font-size: 14px; }
.card, .journey-card, .tool-card, .query-summary, .popular-route, .directory-card {
  border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card { padding: 24px; }
.btn { min-height: 46px; border-radius: 12px; font-size: 13px; transition: background .16s, transform .16s; }
.btn:hover { transform: translateY(-1px); }
.primary { background: #2264d1; color: white; }
.primary:hover { background: #174da8; }
.secondary { background: var(--surface); border-color: var(--line); }
.quiet:hover, .secondary:hover { background: var(--surface-2); }
.text { color: var(--primary); }
.field { min-height: 68px; border-color: var(--line); border-radius: 13px; background: var(--surface); font-size: 10px; }
.field input, .field select, .large-input, .node-selectors select, .setting-select select {
  min-height: 34px; font-size: 15px; color: var(--ink);
}
.swap-btn { width: 38px; height: 38px; border-color: var(--line); box-shadow: var(--shadow); }
.segmented { gap: 5px; padding: 5px; border-radius: 12px; }
.segmented label { min-height: 40px; border-radius: 9px; font-size: 12px; }
.segmented label:has(input:checked) { color: #1d56aa; }
[data-theme="dark"] .segmented label:has(input:checked) { color: var(--primary); }
.search-cta { min-height: 54px; border-radius: 14px; font-size: 14px; }
.search-panel { padding: clamp(20px, 3vw, 32px); border-radius: 22px; }
.search-panel-title h2 { font-size: 19px; }
.journey-inspiration { min-height: 450px; border-radius: 22px; background: #142a4a; }
.journey-inspiration h2 { font-size: clamp(28px, 3.4vw, 42px); }
.journey-inspiration .eyebrow { color: #a9d7ff; }
.map-land { fill: #1d426d; }
.map-route { stroke: #72d1c2; }
.scenic-map { opacity: .92; }
.quick-tools { gap: 12px; }
.tool-card { min-height: 150px; padding: 20px; background: var(--surface); }
.tool-card:hover, .directory-card:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); transform: translateY(-2px); }
.tile-icon { width: 42px; height: 42px; border-radius: 13px; background: color-mix(in srgb, var(--primary) 9%, var(--surface)); color: var(--primary); }
.journey-card { padding: 18px 22px 0; }
.journey-card.preferred { border-color: var(--primary); box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent), var(--shadow); }
.kicker { letter-spacing: 1px; }
.route-mini strong { font-size: 25px; }
.status, .pill, .chip { border-radius: 999px; }
.chip { min-height: 40px; padding-inline: 15px; }
.chip.selected { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.availability-badge, .status { min-height: 27px; }
.query-summary { padding: 18px 20px; }
.notice { border-radius: 14px; }
.sheet, dialog#sheet { border-radius: 22px; }
dialog#sheet { max-width: min(640px, calc(100vw - 24px)); border: 1px solid var(--line); color: var(--ink); background: var(--surface); box-shadow: 0 24px 70px rgb(12 24 42 / 28%); }
dialog#sheet::backdrop { background: rgb(10 22 39 / 42%); backdrop-filter: blur(3px); }
.main-footer { margin-top: 50px; padding-block: 24px 30px; }
.policy-page { max-width: 760px; margin: 6vh auto; padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.policy-page h1 { margin-top: 14px; font-size: clamp(32px, 5vw, 48px); }
.policy-page h2 { margin-top: 30px; font-size: 20px; }
.policy-page p { line-height: 1.75; }
.policy-page a { color: var(--primary); }

@media (max-width: 860px) {
  .topbar { height: 58px; padding-inline: 16px; gap: 10px; }
  .topbar .brand { min-width: unset; }
  .topbar .brand-mark { width: 30px; height: 32px; }
  .topbar .brand-word { font-size: 19px; }
  .primary-nav { gap: 0; }
  .primary-link { min-height: 40px; padding-inline: 10px; }
  .primary-link span { display: none; }
  .local-clock { display: none; }
  .demo-banner { padding-inline: 16px; }
  .page-main { padding: 25px 18px 0; }
  .home-layout { grid-template-columns: 1fr; }
  .journey-inspiration { min-height: 330px; }
  .journey-inspiration .scenic-map svg { height: 170px; }
  .main-footer { padding-bottom: 20px; }
}

@media (max-width: 600px) {
  body { font-size: 14px; }
  .topbar { position: sticky; height: 54px; padding-inline: 12px; }
  .topbar .brand-mark { display: none; }
  .topbar .brand-word { font-size: 18px; }
  .topbar .brand-word > span { font-size: 7px; letter-spacing: 2px; }
  .primary-nav { margin-left: auto; gap: 2px; }
  .primary-link { width: 40px; min-height: 40px; justify-content: center; padding: 0; border-radius: 11px; }
  .primary-link .icon { width: 19px; height: 19px; }
  .top-actions { gap: 0; }
  .settings-action { display: none; }
  .demo-banner { align-items: flex-start; gap: 8px; padding: 9px 14px; font-size: 11px; line-height: 1.35; }
  .demo-banner > .icon { margin-top: 1px; }
  .demo-banner button { min-width: 32px; margin-left: auto; padding: 5px; }
  .demo-desktop-label { display: none; }
  .page-main { min-height: calc(100vh - 180px); padding: 23px 14px 0; }
  .page-heading { display: block; margin-bottom: 18px; }
  .page-heading h1 { margin-bottom: 8px; font-size: 31px; }
  .page-heading p { font-size: 13px; }
  .card { padding: 18px; border-radius: 17px; }
  .home-layout { gap: 14px; }
  .search-panel { padding: 17px 15px; }
  .station-fields { gap: 10px; }
  .field { min-height: 64px; padding: 10px; font-size: 9px; }
  .field input, .field select { font-size: 14px; }
  .form-two { gap: 10px; }
  .train-quota { grid-template-columns: 1fr 1fr; }
  .search-cta { min-height: 52px; }
  .journey-inspiration { min-height: 300px; padding: 21px; }
  .journey-inspiration h2 { max-width: 310px; font-size: 31px; }
  .journey-inspiration .scenic-map svg { height: 150px; }
  .quick-tools { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .tool-card { min-height: 126px; padding: 14px; border-radius: 15px; }
  .tool-card strong { font-size: 12px; }
  .tool-card > span:not(.tile-icon) { font-size: 10px; }
  .section-title { margin: 23px 0 13px; }
  .section-title h2 { font-size: 18px; }
  .popular-routes { grid-template-columns: 1fr; gap: 8px; }
  .discovery-banner { gap: 12px; padding: 17px; align-items: flex-start; }
  .discovery-banner .btn { margin-left: 0; }
  .main-footer { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 28px; padding-bottom: 18px; font-size: 10px; }
  .main-footer > span:last-child { grid-column: 1 / -1; }
  .bottom-nav {
    position: fixed; z-index: 50; inset: auto 0 0; display: flex; justify-content: space-around;
    min-height: calc(64px + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(18px);
  }
  .bottom-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10px; }
  .bottom-tab .nav-indicator { width: 52px; height: 28px; display: grid; place-items: center; border-radius: 999px; }
  .bottom-tab .icon { width: 19px; height: 19px; }
  .bottom-tab.active { color: #1e57ad; font-weight: 650; }
  [data-theme="dark"] .bottom-tab.active { color: var(--primary); }
  .bottom-tab.active .nav-indicator { background: color-mix(in srgb, var(--primary) 13%, var(--surface)); }
  .journey-grid { grid-template-columns: 1fr; }
  .journey-card { padding: 15px 15px 0; }
  .route-mini { gap: 9px; margin-bottom: 17px; }
  .route-mini strong { font-size: 21px; }
  .route-mini span { font-size: 11px; }
  .query-summary { align-items: flex-start; padding: 14px; }
  .query-summary strong { gap: 6px; font-size: 14px; }
  .query-summary .btn { min-width: 44px; padding-inline: 10px; }
  .results-toolbar, .results-meta { align-items: flex-start; flex-direction: column; }
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .chip { flex: none; }
  .settings-grid, .saved-grid, .trip-grid, .fare-grid { grid-template-columns: 1fr; }
  .policy-page { margin: 16px 10px; padding: 22px 18px; }
  .offline-banner { margin-bottom: 12px; }
}

@media (max-width: 380px) {
  .topbar .brand-word { font-size: 16px; }
  .primary-link { width: 36px; }
  .station-fields { grid-template-columns: 1fr; }
  .swap-btn { left: auto; right: 12px; top: 50%; }
  .form-two { grid-template-columns: 1fr; }
  .train-quota { grid-template-columns: 1fr; }
  .quick-tools { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
