:root {
  color-scheme: dark;
  --page: #151722;
  --surface: #1c1e2b;
  --raised: #242637;
  --raised-hover: #2b2e42;
  --line: #34374b;
  --ink: #f4f5f8;
  --muted: #b6b9cc;
  --dim: #979bb4;
  --accent: #c5f66b;
  --accent-ink: #1c2a14;
  --accent-faint: #29372c;
  --violet: #bba8ff;
  --amber: #ffcb82;
  --bad: #ff9b99;
  --shadow: 0 20px 55px #08091638;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f6ed;
  --surface: #fffef7;
  --raised: #eeefe7;
  --raised-hover: #e4eadb;
  --line: #d9ddcf;
  --ink: #232838;
  --muted: #4e5665;
  --dim: #5c6576;
  --accent: #335e1b;
  --accent-ink: #f9fff1;
  --accent-faint: #e2eed6;
  --violet: #583eb0;
  --amber: #7e4a08;
  --bad: #a32933;
  --shadow: 0 18px 44px #2a3c2a11;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--page); color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { flex-shrink: 0; vertical-align: middle; }
img { display: block; }
small { font-size: .8rem; }
p { color: var(--muted); line-height: 1.65; margin: 0; }
h1, h2, h3 { margin: 0; letter-spacing: -.035em; }
ol, ul { margin: 0; padding-inline-start: 1.3rem; }
li + li { margin-top: .35rem; }
[hidden] { display: none !important; }

.skip-link { position: absolute; inset: .5rem auto auto .5rem; z-index: 20; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; border-radius: .5rem; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner { max-width: 1216px; margin: auto; padding: .85rem 1.5rem; min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .75rem; min-width: max-content; }
.brand strong { display: block; font-size: 1.1rem; letter-spacing: -.04em; line-height: 1.2; }
.brand small { display: block; color: var(--dim); margin-top: .2rem; font-size: .7rem; }
#top-nav { display: flex; gap: .3rem; }
.nav-link { display: flex; align-items: center; gap: .42rem; min-height: 42px; padding: .45rem .72rem; border-radius: .7rem; color: var(--muted); font-weight: 650; font-size: .82rem; white-space: nowrap; }
.nav-link:hover { background: var(--raised); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--accent-faint); color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: .8rem; }
.header-clock { color: var(--dim); white-space: nowrap; font-size: .75rem; font-variant-numeric: tabular-nums; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; background: var(--raised); border: 1px solid var(--line); border-radius: .7rem; color: var(--ink); }
.icon-button:hover { background: var(--raised-hover); }
.bottom-nav { display: none; }

.main { max-width: 1216px; min-height: calc(100vh - 180px); padding: 1.6rem 1.5rem 3.2rem; margin: auto; outline: none; }
.initial { padding: 2rem; }
.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .58fr); gap: 1.5rem; padding: clamp(1.55rem, 4vw, 3.05rem); border: 1px solid #40405b; border-radius: 1.4rem; background: radial-gradient(ellipse at 94% 12%, #3f365b 0%, #28283d 52%, #212337 100%); box-shadow: var(--shadow); overflow: hidden; color: #f4f5f8; }
.hero p { max-width: 47ch; margin: .9rem 0 1.4rem; color: #c5c8df; }
.eyebrow { display: flex; align-items: center; gap: .5rem; font-size: .72rem; font-weight: 760; color: var(--accent); letter-spacing: .12em; text-transform: uppercase; line-height: 1.35; }
.hero .eyebrow { color: #c5f66b; }
.eyebrow .dot { width: .46rem; height: .46rem; border-radius: 100%; background: currentColor; }
.hero h1 { max-width: 13ch; margin-top: .7rem; font-size: clamp(2.45rem, 5.8vw, 4.65rem); line-height: .99; letter-spacing: -.07em; }
.hero h1 span { color: #c5f66b; }
.hero-art { position: relative; display: grid; align-items: center; min-width: 0; }
.hero-art svg { width: 100%; height: auto; overflow: visible; }
.hero-caption { position: absolute; right: 0; bottom: .05rem; font-size: .65rem; font-weight: 680; letter-spacing: .13em; text-transform: uppercase; color: #c2b7e4; }
.hero .quick-form { display: grid; grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr) auto; gap: .55rem; align-items: end; }
.hero label { color: #c9cbe0; }
.hero input { background: #161929; border-color: #50536e; color: #f7f7fc; }
.hero input::placeholder { color: #aaadc4; }
.hero .icon-button { border-color: #52546d; background: #383950; color: #f0edff; }
.hero .button.primary { background: #c5f66b; border-color: #c5f66b; color: #19251a; }
.hero .button.primary:hover { background: #ddff9c; }
.quick-form .button { min-height: 44px; }

.section { margin-top: 2rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.section-heading h2 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); }
.section-heading p { font-size: .85rem; margin-top: .28rem; }
.tile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .72rem; }
.tile { min-height: 106px; display: flex; align-items: flex-start; gap: .85rem; position: relative; padding: .95rem .95rem 1rem; border: 1px solid var(--line); border-radius: .93rem; background: var(--surface); transition: background .16s ease, transform .16s ease; }
.tile:hover { background: var(--raised); transform: translateY(-2px); }
.tile .mode-icon, .section-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; color: #202334; background: var(--tile-color, #c5f66b); border-radius: .72rem; }
.tile .tile-copy { min-width: 0; }
.tile strong { display: block; font-size: .96rem; letter-spacing: -.02em; padding-top: .07rem; }
.tile small { color: var(--muted); line-height: 1.45; display: block; margin-top: .3rem; font-size: .76rem; }
.tile > svg { position: absolute; bottom: .68rem; right: .62rem; color: var(--dim); }
.shortcut-row { display: flex; gap: .65rem; flex-wrap: wrap; }
.shortcut { display: inline-flex; align-items: center; gap: .5rem; min-height: 41px; border-radius: .67rem; background: var(--raised); color: var(--ink); border: 1px solid var(--line); padding: .55rem .8rem; font-size: .82rem; font-weight: 660; }
.shortcut:hover { color: var(--accent); background: var(--raised-hover); }
.shortcut svg { color: var(--accent); }
.footer { max-width: 1216px; margin: auto; padding: 1.05rem 1.5rem 1.5rem; border-top: 1px solid var(--line); display: flex; gap: .8rem; justify-content: space-between; align-items: start; color: var(--dim); font-size: .78rem; }
.footer strong { color: var(--ink); margin-right: .65rem; }
.footer a { color: var(--accent); }

.screen-header { display: flex; align-items: center; gap: .95rem; margin-bottom: 1.25rem; }
.screen-header .section-icon { width: 56px; height: 56px; border-radius: .95rem; }
.screen-header h1 { font-size: clamp(1.75rem, 4vw, 2.65rem); line-height: 1.05; }
.screen-header p { margin-top: .28rem; font-size: .89rem; }
.breadcrumb { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .8rem; margin: .25rem 0 .95rem; }
.breadcrumb:hover { color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); padding: clamp(.95rem, 2vw, 1.35rem); border-radius: 1rem; }
.panel + .panel { margin-top: .75rem; }
.panel h2 { font-size: 1.32rem; }
.panel h3 { font-size: 1.06rem; }
.panel > p + .button, .panel > p + .link-list { margin-top: .8rem; }
.panel > p, .coverage-note { margin-top: .4rem; font-size: .86rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .8rem; align-items: start; }
.two-col > .panel + .panel { margin: 0; }
.notice { display: flex; align-items: flex-start; gap: .58rem; border: 1px solid var(--line); border-radius: .75rem; padding: .7rem .85rem; background: var(--raised); color: var(--muted); font-size: .83rem; line-height: 1.5; }
.notice svg { margin-top: .11rem; color: var(--violet); }
.notice.warning svg { color: var(--amber); }
.notice a, .text-link { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
.screen-content > .notice, .screen-content > .panel + .notice { margin-bottom: .85rem; }
.results { margin-top: 1.15rem; }
.results .notice + .notice, .results .panel + .notice, .results .notice + .panel { margin-top: .7rem; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); align-items: end; gap: .65rem; }
.form-grid .span { grid-column: 1 / -1; }
.form-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: end; }
.form-row > label { flex: 1 1 9rem; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; margin-top: .15rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-weight: 660; font-size: .8rem; min-width: 0; }
input:not([type="checkbox"]), select { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: .65rem; background: var(--page); color: var(--ink); padding: .5rem .65rem; font-size: .92rem; }
input::placeholder { color: var(--dim); }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.checkbox { display: flex; align-items: center; gap: .45rem; min-height: 44px; }
.station-field { position: relative; }
.station-list { position: absolute; z-index: 6; top: calc(100% + .25rem); left: 0; right: 0; max-height: 17rem; overflow: auto; border-radius: .7rem; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); }
.station-option { display: flex; align-items: center; justify-content: space-between; gap: .45rem; width: 100%; color: var(--ink); text-align: left; background: transparent; border: none; padding: .65rem; font-size: .83rem; cursor: pointer; }
.station-option + .station-option { border-top: 1px solid var(--line); }
.station-option:hover, .station-option[aria-selected="true"] { background: var(--accent-faint); color: var(--accent); }
.station-option small { color: var(--dim); }
.hero:focus-within { overflow: visible; }
.hero .station-list { z-index: 8; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .48rem; max-width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: .65rem; padding: .58rem .85rem; font-weight: 740; background: var(--raised); color: var(--ink); font-size: .84rem; }
.button:hover { background: var(--raised-hover); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.primary:hover { filter: brightness(1.08); }
.button.danger { color: var(--bad); }
.tabs .button[aria-current="page"] { color: var(--accent); background: var(--accent-faint); }
.tabs { display: flex; flex-wrap: wrap; gap: .42rem; margin-bottom: .85rem; }
.tabs .button { font-size: .79rem; min-height: 37px; padding: .45rem .68rem; }

.result-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.result-heading h2 { font-size: 1.17rem; }
.badge { display: inline-flex; align-items: center; gap: .34rem; min-height: 23px; border: 1px solid var(--line); border-radius: 1rem; background: var(--raised); color: var(--muted); padding: .16rem .52rem; font-size: .68rem; font-weight: 730; white-space: nowrap; }
.badge.good { color: var(--accent); }
.badge.warn { color: var(--amber); }
.line-dot { width: 8px; height: 8px; background: var(--line-color, var(--accent)); border-radius: 50%; display: inline-block; flex-shrink: 0; }
.trip { background: var(--surface); border: 1px solid var(--line); border-radius: .82rem; margin-top: .55rem; }
.trip summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .8rem .9rem; }
.trip summary::-webkit-details-marker { display: none; }
.trip summary::after { content: "+"; display: grid; grid-column: 2; grid-row: 1; place-items: center; justify-self: end; width: 24px; height: 24px; border-radius: .4rem; background: var(--raised); color: var(--muted); }
.trip[open] summary::after { content: "−"; }
.trip summary > div { grid-column: 1; grid-row: 1; }
.trip summary:hover { background: var(--raised); border-radius: .76rem; }
.trip summary small { display: block; color: var(--muted); margin-top: .22rem; line-height: 1.45; }
.trip strong { font-size: .95rem; }
.trip .times { font-size: 1.14rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.trip .badge { margin-left: .3rem; vertical-align: middle; }
.trip-body { border-top: 1px solid var(--line); padding: .75rem .95rem .9rem; }
.trip-body .text-link { display: inline-block; font-size: .78rem; margin-top: .55rem; }
.timeline { display: grid; gap: .45rem; list-style: none; padding: 0; margin: .5rem 0; }
.timeline li { position: relative; display: flex; justify-content: space-between; align-items: center; gap: .6rem; font-size: .86rem; margin: 0; padding-left: 1rem; }
.timeline li::before { content: ""; position: absolute; left: 0; width: .48rem; height: .48rem; border-radius: 50%; border: 1px solid var(--line-color, var(--accent)); }
.timeline time { font-variant-numeric: tabular-nums; color: var(--dim); white-space: nowrap; }
.route-branch { overflow-x: auto; padding: .65rem 0 .35rem; }
.route-strip { display: flex; min-width: max-content; list-style: none; padding: 0; }
.route-strip li { position: relative; color: var(--muted); text-align: center; margin: 0; width: 108px; white-space: normal; font-size: .72rem; padding: 1.4rem .25rem .15rem; }
.route-strip li::before { position: absolute; content: ""; top: .36rem; left: 0; right: 0; height: 2px; background: var(--line-color, var(--accent)); }
.route-strip li:first-child::before { left: 50%; }
.route-strip li:last-child::before { right: 50%; }
.route-strip li::after { content: ""; position: absolute; top: .12rem; left: calc(50% - .31rem); width: .63rem; height: .63rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-color, var(--accent)); }
.leg { border-left: 3px solid var(--line-color, var(--line)); padding-left: .78rem; margin-top: .7rem; }
.leg p { font-size: .8rem; }
.leg summary { cursor: pointer; color: var(--muted); font-size: .8rem; margin-top: .4rem; }
.link-list { display: grid; gap: .55rem; }
.link-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .68rem .72rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--raised); font-size: .88rem; font-weight: 650; }
.link-row:hover { background: var(--raised-hover); color: var(--accent); }
.link-row small { color: var(--muted); display: block; font-size: .76rem; line-height: 1.45; font-weight: 450; margin-top: .2rem; }
.panel .tabs, .panel .form-row { margin-top: .7rem; }
.simple-list { margin-top: .6rem; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.inline-controls { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin-top: .7rem; }
.inline-controls .button { flex-shrink: 0; }
.tool-status { font-size: .79rem; min-height: 1.2em; }
.fare-total { font-size: clamp(1.8rem, 4vw, 2.8rem); color: var(--accent); font-weight: 760; letter-spacing: -.05em; line-height: 1.1; }
.toast { position: fixed; z-index: 15; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--raised); color: var(--ink); border: 1px solid var(--line); border-radius: .75rem; padding: .7rem 1.05rem; max-width: calc(100vw - 2rem); box-shadow: var(--shadow); font-size: .83rem; }

@media (max-width: 1000px) {
  .header-clock { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(200px, .43fr); }
  .tile { gap: .66rem; padding: .8rem .7rem; }
  .tile .mode-icon { width: 37px; height: 37px; }
}
@media (max-width: 780px) {
  #top-nav { display: none; }
  .topbar-inner { padding: .65rem 1rem; min-height: 65px; }
  .main { padding: 1rem 1rem 2rem; }
  .hero { grid-template-columns: 1fr; gap: 0; }
  .hero-art { display: none; }
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer { padding: 1rem 1rem calc(5rem + env(safe-area-inset-bottom)); }
  .footer strong, .footer span { display: block; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); z-index: 10; position: fixed; inset: auto 0 0; background: var(--surface); border-top: 1px solid var(--line); padding: .35rem .35rem calc(.35rem + env(safe-area-inset-bottom)); }
  .bottom-nav .nav-link { flex-direction: column; gap: .2rem; min-height: 47px; justify-content: center; padding: .25rem .1rem; font-size: .66rem; }
  .toast { bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 510px) {
  .hero .quick-form { grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr); }
  .hero .quick-form .button.primary { grid-column: 1 / -1; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .tile { min-height: 93px; }
  .tile > svg { display: none; }
  .tile strong { font-size: .84rem; }
  .tile small { font-size: .7rem; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .screen-header { gap: .7rem; }
  .screen-header .section-icon { width: 44px; height: 44px; }
  .trip .badge { margin-top: .2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
