/* Bahn-Atlas travel app: a full-screen map with one calm panel (left on desktop, bottom sheet on phones).
   Native system font, soft shadows, one accent colour, and motion that only confirms what changed. */
:root {
  --t-font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t-ink: #1f2328; --t-muted: #5f6368; --t-faint: #80868b; --t-line: #e8eaed; --t-soft: #f1f3f4; --t-hover: #f6f8fa;
  --t-blue: #1a73e8; --t-blue-ink: #1558b0; --t-blue-soft: #e8f0fe;
  --t-late: #d93025; --t-ok: #188038;
  --t-ld: #1b2230; --t-re: #d52b1e; --t-s: #2f8f46;
  --t-shadow-1: 0 1px 2px rgba(60,64,67,.24), 0 1px 3px 1px rgba(60,64,67,.12);
  --t-shadow-2: 0 1px 3px rgba(60,64,67,.2), 0 6px 16px 2px rgba(60,64,67,.12);
  --t-ease: cubic-bezier(.2, .8, .2, 1);
  --topbar-h: 56px;
  --t-surface: #fff; --t-glass: rgba(255,255,255,.92); --t-page: #f5f4f1;
}

/* Top bar */
.topbar { background: var(--t-surface); color: var(--t-ink); border-bottom: 1px solid var(--t-line); padding: 0 clamp(1rem, 3vw, 2rem);
  height: var(--topbar-h); font-family: var(--t-font); gap: 1.6rem; }
.wordmark { color: #23282d; border: 0; padding: 0; font-size: 1.3rem; letter-spacing: -.01em;
  display: inline-flex; align-items: center; gap: .5rem; }
.wordmark img { width: 30px; height: 30px; flex: none; display: block; }
.topbar nav { display: flex; gap: .25rem; }
.topbar nav a { color: var(--t-muted); font-weight: 500; font-size: .94rem; padding: .45rem .75rem; border-radius: 999px; transition: background .15s, color .15s; }
.topbar nav a:hover { color: var(--t-ink); background: var(--t-soft); text-decoration: none; }
.topbar nav a[aria-current=page] { color: var(--t-blue-ink); background: var(--t-blue-soft); }
.lang-switch { border: 0; background: none; font: 600 .82rem var(--t-font); color: var(--t-muted); padding: .45rem .6rem; border-radius: 999px; cursor: pointer; }
.lang-switch:hover { color: var(--t-ink); background: var(--t-soft); }
/* The map page is the whole window: no page scroll behind the map. */
.app-page { overflow: hidden; overscroll-behavior: none; }
.period { color: var(--t-faint); opacity: 1; font-size: .82rem; }
.topbar :focus-visible { outline: 2px solid var(--t-blue); outline-offset: 2px; box-shadow: none; }

/* Stage */
.travel { position: relative; height: calc(100vh - var(--topbar-h)); height: calc(100svh - var(--topbar-h)); min-height: 520px;
  overflow: hidden; background: var(--t-page); font-family: var(--t-font); color: var(--t-ink); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; }
.travel :focus { outline: none; }
.travel :focus-visible { outline: 2px solid var(--t-blue); outline-offset: 2px; box-shadow: none; }
.tmap { position: absolute; inset: 0; background: #f5f4f1; }
.tmap .maplibregl-canvas:focus { outline: none; }
.train-canvas { position: absolute; left: 0; top: 0; pointer-events: none; }

/* Map overlays */
.tmap-top { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none; }
.live-pill { display: inline-flex; align-items: center; gap: .5rem; background: var(--t-glass); backdrop-filter: blur(8px);
  border-radius: 999px; padding: .38rem .85rem; box-shadow: var(--t-shadow-1); font-size: .82rem; font-weight: 500; color: var(--t-ink);
  white-space: nowrap; pointer-events: auto; }
.live-pill.is-error { color: var(--t-late); white-space: normal; max-width: 80vw; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t-ok); box-shadow: 0 0 0 0 rgba(24,128,56,.4); animation: t-pulse 2.4s infinite; flex: none; }
.live-dot.off { background: #bdc1c6; animation: none; }
.live-pill.is-error .live-dot { background: var(--t-late); }
@keyframes t-pulse { 70% { box-shadow: 0 0 0 7px rgba(24,128,56,0); } 100% { box-shadow: 0 0 0 0 rgba(24,128,56,0); } }

.tmap-zoom, .tmap-tools { position: absolute; right: 16px; z-index: 5; display: grid; }
.tmap-zoom { bottom: 40px; border-radius: 12px; background: var(--t-surface); box-shadow: var(--t-shadow-1); overflow: hidden; }
.tmap-zoom .tool { box-shadow: none; border-radius: 0; }
.tmap-zoom .tool + .tool { border-top: 1px solid var(--t-line); }
.tmap-tools { bottom: 136px; gap: 10px; }
.tool-text { font: 700 .8rem var(--t-font); letter-spacing: .02em; }

/* Filter menu: which kinds of vehicle the map shows */
.filter-pop { position: absolute; z-index: 12; right: 66px; bottom: 136px; width: 270px; background: var(--t-surface); border-radius: 16px;
  box-shadow: var(--t-shadow-2); padding: 12px 8px 8px; animation: t-rise .18s var(--t-ease); }
.filter-pop[hidden] { display: none; }
.filter-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px 6px; font-size: .9rem; }
.filter-head span { color: var(--t-faint); font-size: .78rem; }
.filter-list { display: grid; }
.mode-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 34px; gap: 10px; align-items: center; width: 100%; border: 0; background: none;
  padding: 9px 8px; border-radius: 10px; font: 500 .9rem var(--t-font); color: var(--t-ink); text-align: left; cursor: pointer; }
.mode-row:hover { background: var(--t-hover); }
.mode-text { display: grid; }
.mode-text small { color: var(--t-faint); font-size: .74rem; font-weight: 400; }
.mode-dot { width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.mode-n { color: var(--t-faint); font-variant-numeric: tabular-nums; font-size: .82rem; }
.switch { width: 34px; height: 20px; border-radius: 999px; background: #dadce0; position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--t-surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s var(--t-ease); }
.mode-row[aria-checked=true] .switch { background: var(--t-blue); }
.mode-row[aria-checked=true] .switch::after { transform: translateX(14px); }
.mode-row[aria-checked=false] .mode-dot { opacity: .35; }
.mode-row[aria-checked=false] > span:nth-child(2) { color: var(--t-faint); }
#btn-filter { position: relative; }
#btn-filter[aria-expanded=true] { background: var(--t-blue-soft); color: var(--t-blue); }
#btn-filter.has-filter::after { content: ""; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--t-blue); border: 2px solid #fff; }
.tool { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--t-surface); box-shadow: var(--t-shadow-1); cursor: pointer;
  display: grid; place-items: center; color: var(--t-muted); transition: background .15s, color .15s; }
.tool svg, .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool svg circle:first-child { fill: currentColor; }
.tool:hover { background: var(--t-hover); color: var(--t-ink); }
.tool[aria-pressed=true] { background: var(--t-blue); color: #fff; }

.train-tip { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; display: grid; grid-template-columns: auto 1fr; gap: .2rem .5rem;
  align-items: center; background: var(--t-surface); border-radius: 12px; padding: .55rem .7rem; box-shadow: var(--t-shadow-2); font-size: .82rem; max-width: 260px; }
.train-tip span:last-child { grid-column: 1 / -1; color: var(--t-muted); }
.train-tip[hidden] { display: none; }

/* Labels and pop-ups on the map */
.map-label { font: 600 12px/1.2 var(--t-font); color: var(--t-ink); background: var(--t-surface); padding: 4px 9px; border-radius: 8px;
  box-shadow: var(--t-shadow-1); white-space: nowrap; pointer-events: none; }
.map-label.next { background: var(--t-ink); color: #fff; }
.stop-pop .maplibregl-popup-content { padding: 5px 10px; border-radius: 8px; font: 500 12px var(--t-font); color: var(--t-ink); box-shadow: var(--t-shadow-1); }
.stop-pop .maplibregl-popup-tip { display: none; }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--t-blue); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.18), var(--t-shadow-1); }
.tmap .maplibregl-ctrl-attrib { font: 11px var(--t-font); background: var(--t-glass); }
.tmap .maplibregl-ctrl-attrib a { color: var(--t-muted); }
/* Credits button: a crisp outlined "i" in a white round button like the other map tools
   (MapLibre's own icon is a small filled blob that looks smudged on phones). */
.tmap .maplibregl-ctrl-attrib.maplibregl-compact { min-height: 32px; min-width: 32px; padding: 0; border-radius: 16px; background: var(--t-surface);
  box-shadow: var(--t-shadow-1); box-sizing: border-box; }
.tmap .maplibregl-ctrl-attrib.maplibregl-compact-show { padding: 7px 40px 7px 12px; max-width: min(360px, calc(100vw - 32px)); line-height: 1.5; }
.tmap .maplibregl-ctrl-top-left > .maplibregl-ctrl-attrib.maplibregl-compact-show,
.tmap .maplibregl-ctrl-bottom-left > .maplibregl-ctrl-attrib.maplibregl-compact-show { padding: 7px 12px 7px 40px; }
.tmap .maplibregl-ctrl-attrib-button { width: 32px; height: 32px; border-radius: 50%;
  background: var(--t-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%235f6368' stroke-width='1.8'/%3E%3Cpath d='M12 11v5.5' stroke='%235f6368' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='7.8' r='1.25' fill='%235f6368'/%3E%3C/svg%3E") center / 20px 20px no-repeat; }
.tmap .maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button,
.tmap .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button { left: 0; right: auto; }
.tmap .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button { background-color: var(--t-soft); }
/* When open, the credits sit above the live status pill and the map tools. */
.tmap .maplibregl-control-container > div:has(.maplibregl-compact-show) { z-index: 12; }
.tmap .maplibregl-ctrl-bottom-right { right: 66px; }

/* Panel */
.sheet { position: absolute; z-index: 10; top: 16px; left: 16px; bottom: 16px; width: min(400px, calc(100% - 32px)); display: flex; flex-direction: column;
  background: var(--t-surface); border-radius: 18px; box-shadow: var(--t-shadow-2); overflow: hidden; }
.sheet-grip { display: none; }
.sheet-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 14px 14px 4px; padding: 3px; background: var(--t-soft); border-radius: 999px; flex: none; }
.sheet-tabs [role=tab] { border: 0; background: none; padding: .5rem .3rem; font: 600 .86rem var(--t-font); color: var(--t-muted);
  border-radius: 999px; cursor: pointer; transition: background .2s var(--t-ease), color .2s, box-shadow .2s; }
.sheet-tabs [role=tab]:hover { color: var(--t-ink); }
.sheet-tabs [role=tab][aria-selected=true] { background: var(--t-surface); color: var(--t-ink); box-shadow: 0 1px 2px rgba(60,64,67,.22); }
.sheet-body { flex: 1; overflow-y: auto; padding: 10px 16px 18px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #dadce0 transparent; }
.sheet-more { flex: none; display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin: 0; padding: .65rem 1rem;
  border-top: 1px solid var(--t-line); font-size: .8rem; color: var(--t-faint); }
.sheet-more a { color: var(--t-faint); text-decoration: none; }
.sheet-more a:hover { color: var(--t-blue); text-decoration: underline; }

/* Impressum and Datenschutz */
.legal { max-width: 46rem; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem) 4rem; font-family: var(--t-font); color: var(--t-ink); line-height: 1.6; }
.legal h1 { font-size: 2rem; margin-bottom: .2rem; }
.legal h2 { font-size: 1.15rem; margin: 1.8rem 0 .4rem; }
.legal p, .legal li { font-size: .98rem; }
.legal a { color: var(--t-blue-ink); }
.legal-en { color: var(--t-muted); margin-top: 0; }
.legal-links { margin-top: 2.5rem; color: var(--t-muted); }
.legal-missing { color: var(--t-late); font-weight: 600; }
[data-panel][hidden], .sheet [hidden] { display: none !important; }
[data-panel]:not([hidden]) { animation: t-fade .25s var(--t-ease); }

/* Search card */
.search-card { display: grid; gap: .7rem; }
.od { position: relative; border-radius: 14px; background: var(--t-soft); transition: background .15s, box-shadow .15s; }
.od:focus-within, .od-row.single:focus-within { background: var(--t-surface); box-shadow: 0 0 0 2px var(--t-blue); }
.od-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 40px; align-items: center; gap: .3rem; padding: 0 .25rem 0 .85rem; }
.od-row + .od-row { box-shadow: inset 0 1px 0 #e1e3e6; }
.od-row.single { grid-template-columns: minmax(0, 1fr) 40px; border-radius: 14px; background: var(--t-soft); padding-left: .5rem; transition: background .15s, box-shadow .15s; }
.od-dot { width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid var(--t-faint); background: var(--t-surface); }
.od-dot.to { border-color: var(--t-late); }
.ac { position: relative; }
.ac input, .search-input { width: 100%; border: 0; background: transparent; font: 500 1rem var(--t-font); color: var(--t-ink); padding: .9rem .35rem; outline: none; }
.ac input:focus-visible, .search-input:focus-visible { outline: none; }
.ac input::placeholder, .search-input::placeholder { color: var(--t-faint); font-weight: 400; }
.search-input { border-radius: 14px; padding: .85rem 1rem; background: var(--t-soft); transition: background .15s, box-shadow .15s; }
.search-input:focus { background: var(--t-surface); box-shadow: 0 0 0 2px var(--t-blue); }
.ac-list { position: absolute; z-index: 20; left: -2rem; right: -2.6rem; top: calc(100% + 6px); margin: 0; padding: .35rem; list-style: none;
  background: var(--t-surface); border-radius: 14px; box-shadow: var(--t-shadow-2); animation: t-fade .15s var(--t-ease); }
.ac-list:empty { display: none; }
.od-row.single .ac-list { left: -.5rem; right: -2.8rem; }
.ac-item { display: grid; padding: .55rem .75rem; border-radius: 10px; cursor: pointer; }
.ac-item strong { font-weight: 500; }
.ac-item small { color: var(--t-faint); font-size: .8rem; }
.ac-item small:empty { display: none; }
.ac-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; }
.mt { font-size: .68rem; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--t-soft); color: var(--t-muted); }
.mt-train { background: #fce8e6; color: #b3261e; }
.mt-ubahn { background: #e3effa; color: #0065ae; }
.mt-tram { background: #fde7e9; color: #c4001a; }
.mt-bus { background: #efe9f7; color: #5e4585; }
.mt-ferry { background: #e0f4f6; color: #00727e; }
.mt-place { background: #fef1e6; color: #a84300; }
.ac-head { list-style: none; padding: .55rem .75rem .2rem; font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--t-faint); cursor: default; }
.ac-place strong::before { content: ""; display: inline-block; width: .62em; height: .62em; margin-right: .45em;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg) translateY(-1px); background: #e8590c; vertical-align: .05em; }
.ac-item[aria-selected=true], .ac-item:hover { background: var(--t-hover); }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--t-muted); cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s; }
.icon-btn:hover { background: rgba(60,64,67,.08); color: var(--t-blue); }
.when-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.when-row select, .when-row input, .opts select { font: 500 .88rem var(--t-font); color: var(--t-ink); border: 1px solid var(--t-line); border-radius: 999px;
  padding: .42rem .85rem; background: var(--t-surface); transition: border-color .15s, box-shadow .15s; }
.when-row select:focus-visible, .when-row input:focus-visible, .opts select:focus-visible { outline: none; border-color: var(--t-blue); box-shadow: 0 0 0 3px var(--t-blue-soft); }
.opts { position: relative; }
.opts summary { list-style: none; cursor: pointer; font-size: .88rem; font-weight: 500; color: var(--t-muted); padding: .42rem .85rem;
  border: 1px solid var(--t-line); border-radius: 999px; transition: color .15s, border-color .15s; }
.opts summary::-webkit-details-marker { display: none; }
.opts[open] summary { color: var(--t-blue); border-color: var(--t-blue); }
.opts-body { display: grid; gap: .6rem; margin-top: .7rem; font-size: .88rem; color: var(--t-muted); }
.opts-body label { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.go { border: 0; border-radius: 999px; background: var(--t-blue); color: #fff; font: 600 .95rem var(--t-font); padding: .8rem 1.1rem; cursor: pointer;
  box-shadow: 0 1px 2px rgba(26,115,232,.3); transition: background .15s, box-shadow .15s, transform .1s; }
.go:hover { background: var(--t-blue-ink); box-shadow: 0 1px 3px rgba(26,115,232,.35), 0 2px 8px rgba(26,115,232,.2); }
.go:active { transform: scale(.98); }
.go:disabled { opacity: .55; cursor: progress; }
.go.small { padding: .5rem .95rem; font-size: .86rem; justify-self: start; }
.go[aria-pressed=true] { background: var(--t-ok); box-shadow: none; }
.go.ghost { background: var(--t-surface); color: var(--t-blue); box-shadow: inset 0 0 0 1px #dadce0; }
.go.ghost:hover { background: var(--t-blue-soft); box-shadow: inset 0 0 0 1px #d2e3fc; }
.edit-search { display: none; }
.note { margin: .7rem 0 0; font-size: .85rem; color: var(--t-muted); }
.note:empty { display: none; }
.t-fine { font-size: .78rem; color: var(--t-faint); margin: .9rem 0 0; }
.muted, .t-empty { color: var(--t-muted); font-size: .88rem; list-style: none; }

/* Times and line badges */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 .5rem; border-radius: 6px; font: 700 .78rem/1 var(--t-font); letter-spacing: .01em; white-space: nowrap; }
.pill-ld { background: var(--t-surface); color: var(--t-ld); box-shadow: inset 0 0 0 1.5px #cfd3d8; border-left: 4px solid var(--t-re); }
.pill-re { background: var(--t-re); color: #fff; }
.pill-s { background: var(--t-s); color: #fff; }
.pill-u { background: #0065ae; color: #fff; }
.pill-t { background: #e2001a; color: #fff; }
.pill-b { background: #7b5ea7; color: #fff; }
.pill-walk { background: var(--t-soft); color: var(--t-muted); font-weight: 600; }
.tp { display: inline-flex; align-items: baseline; gap: .35rem; font-variant-numeric: tabular-nums; }
.tp strong { font-weight: 600; }
.late { color: var(--t-late); font-weight: 600; }
.ontime { color: var(--t-ok); font-weight: 600; }

/* Results */
.results-head { display: flex; justify-content: space-between; align-items: baseline; margin: 1.1rem 0 .3rem; }
.results-head h2 { font: 600 .95rem var(--t-font); margin: 0; }
.results-src { font-size: .78rem; color: var(--t-faint); }
.jcard { display: grid; gap: .4rem; width: 100%; text-align: left; background: var(--t-surface); color: var(--t-ink); font: inherit; cursor: pointer;
  border: 1px solid var(--t-line); border-radius: 16px; padding: .9rem 1rem; margin-top: .6rem;
  transition: box-shadow .2s var(--t-ease), border-color .2s, transform .2s var(--t-ease); animation: t-rise .3s var(--t-ease) both; }
.jcard:nth-of-type(2) { animation-delay: .04s; } .jcard:nth-of-type(3) { animation-delay: .08s; } .jcard:nth-of-type(4) { animation-delay: .12s; }
.jcard:hover { border-color: transparent; box-shadow: var(--t-shadow-2); transform: translateY(-1px); }
.jtimes { display: flex; align-items: baseline; gap: .45rem; font-size: 1.12rem; }
.jtimes.big { font-size: 1.5rem; letter-spacing: -.01em; }
.dash { color: var(--t-faint); }
.jmeta { color: var(--t-muted); font-size: .86rem; }
.jlines { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.jarrow { color: #bdc1c6; }
.jlive { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; font-size: .84rem; color: var(--t-muted); }
.jlive:empty { display: none; }
.skeleton-card { height: 116px; border-radius: 16px; margin-top: .6rem; background: linear-gradient(90deg, #f1f3f4 25%, #e8eaed 50%, #f1f3f4 75%); background-size: 200% 100%; animation: t-shimmer 1.2s infinite; }
@keyframes t-shimmer { to { background-position: -200% 0; } }

/* Journey detail */
.route-detail, .train-detail { animation: t-rise .3s var(--t-ease) both; }
.back { border: 0; background: none; color: var(--t-blue); font: 600 .88rem var(--t-font); padding: .35rem .5rem .35rem 0; cursor: pointer; border-radius: 8px; }
.back:hover { color: var(--t-blue-ink); }
.jd-head { display: grid; gap: .4rem; margin: .35rem 0 1.1rem; }
.itin { list-style: none; margin: 0; padding: 0; }
.it-stop { display: grid; grid-template-columns: 4.4rem 1fr; gap: .6rem; align-items: start; padding: .3rem 0; position: relative; }
.it-stop .tp { flex-direction: column; gap: 0; font-size: .92rem; }
.it-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; padding-left: 1.4rem; position: relative; }
.it-name::before { content: ""; position: absolute; left: 0; top: .3rem; width: 12px; height: 12px; border-radius: 50%; background: var(--t-surface); border: 3px solid var(--t-ink); }
.it-name strong { font-weight: 600; }
.it-ride { margin-left: 4.95rem; padding: .5rem 0 .6rem 1.5rem; border-left: 4px solid var(--t-ld); display: grid; gap: .4rem; position: relative; left: 5px; }
.it-ride.regional { border-color: var(--t-re); }
.it-ride.sbahn { border-color: var(--t-s); }
.ride-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.towards { font-size: .86rem; color: var(--t-muted); }
.ride-stops summary { cursor: pointer; font-size: .84rem; color: var(--t-muted); width: fit-content; }
.ride-stops ol { list-style: none; margin: .45rem 0 0; padding: 0; display: grid; gap: .25rem; font-size: .84rem; }
.ride-stops li { display: grid; grid-template-columns: 3rem 1fr auto; gap: .4rem; }
.ride-stops .t { color: var(--t-faint); font-variant-numeric: tabular-nums; }
.it-walk { margin: .2rem 0 .2rem 4.95rem; padding: .45rem 0 .45rem 1.5rem; border-left: 4px dotted #9aa0a6; position: relative; left: 5px;
  display: grid; gap: .05rem; font-size: .86rem; color: var(--t-muted); }
.it-walk strong { color: var(--t-ink); font-weight: 600; }
.it-change { margin: .35rem 0 .35rem 4.95rem; padding: .6rem .8rem; background: var(--t-soft); border-radius: 12px; font-size: .86rem; display: grid; gap: .1rem; }
.it-change small { color: var(--t-muted); }
.it-change.tight { background: #fef7e0; }
/* Delay history and change risk (last two months of DB records) */
.ride-history { font-size: .8rem; color: var(--t-muted); }
.risk { font-weight: 600; }
.risk-high { color: var(--t-late); }
.risk-mid { color: #b06000; }
.risk-low { color: var(--t-ok); font-weight: 500; }
.it-walk .risk { display: block; margin-top: .15rem; }
.link { border: 0; background: none; padding: 0; color: var(--t-blue); font: 600 .84rem var(--t-font); cursor: pointer; justify-self: start; }
.link.small { font-size: .78rem; font-weight: 500; }
.link:hover { color: var(--t-blue-ink); text-decoration: underline; text-underline-offset: 2px; }

/* Departures */
.board-title { font: 600 1.1rem var(--t-font); margin: 1.1rem 0 0; }
.board-title:empty { display: none; }
.depboard { list-style: none; margin: .5rem 0 0; padding: 0; }
.dep { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: .7rem; align-items: center; padding: .65rem .1rem; border-bottom: 1px solid var(--t-line);
  animation: t-fade .25s var(--t-ease) both; }
.dep-time { display: grid; font-size: .92rem; font-variant-numeric: tabular-nums; }
.dep-time span { font-size: .8rem; }
.dep-mid { display: grid; gap: .25rem; justify-items: start; min-width: 0; }
.dep-dest { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.plat { display: inline-grid; place-items: center; min-width: 2.1rem; height: 2.1rem; padding: 0 .35rem; border-radius: 10px; background: var(--t-soft); font-weight: 600; }
.plat.changed { background: #fce8e6; color: var(--t-late); }
.dep.cancelled .dep-dest, .dep.cancelled .dep-time strong { text-decoration: line-through; color: var(--t-faint); }

/* Live trains */
.list-title { font: 600 .76rem var(--t-font); text-transform: uppercase; letter-spacing: .07em; color: var(--t-faint); margin: 1.1rem 0 .3rem; }
.trains { list-style: none; margin: 0; padding: 0; }
.trow { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .7rem; align-items: center; padding: .65rem .5rem; border: 0;
  border-radius: 12px; background: none; font: inherit; color: var(--t-ink); text-align: left; cursor: pointer; transition: background .15s; }
.trow:hover { background: var(--t-hover); }
.trow-info { display: grid; min-width: 0; }
.trow-info strong, .trow-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow-info strong { font-weight: 500; }
.trow-info small { color: var(--t-faint); }
.train-detail { display: grid; gap: .8rem; }
.td-head { display: grid; grid-template-columns: auto 1fr; gap: .75rem; align-items: center; }
.td-head .pill { height: 28px; font-size: .9rem; }
.td-head strong { display: block; font-size: 1.12rem; font-weight: 600; }
.td-head small { color: var(--t-muted); }
.progress { height: 4px; border-radius: 2px; background: var(--t-soft); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--t-blue); border-radius: 2px; transition: width 1s linear; }
.facts { display: grid; gap: .45rem; }
.fact { display: grid; grid-template-columns: 7rem 1fr; gap: .5rem; font-size: .88rem; }
.fact > span { color: var(--t-muted); }
.fact strong { font-weight: 500; }
.td-actions, .jd-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
/* The line and the dots sit inside the scrolling list (a dot outside it would be cut in half): the line is a
   background that scrolls with the stops, centred 10px from the left edge, and each dot is centred on it. */
.td-stops { list-style: none; margin: 0; padding: 0 0 0 1.75rem; max-height: 21rem; overflow: auto; position: relative; scrollbar-width: thin;
  background: linear-gradient(var(--t-line), var(--t-line)) 9px 0 / 2px 100% no-repeat local; }
.td-stops li { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .45rem; padding: .32rem 0; font-size: .88rem; position: relative; }
.td-stops li::before { content: ""; position: absolute; left: calc(10px - 5.5px - 1.75rem); top: .62rem; width: 11px; height: 11px; box-sizing: border-box;
  border-radius: 50%; background: var(--t-surface); border: 2px solid #bdc1c6; }
.td-stops li.past { color: var(--t-faint); }
.td-stops li.past::before { background: #dadce0; border-color: #dadce0; }
.td-stops li.current { font-weight: 600; }
.td-stops li.current::before { background: var(--t-blue); border-color: var(--t-blue); box-shadow: 0 0 0 4px rgba(26,115,232,.18); }
.td-stops .t { color: var(--t-faint); font-variant-numeric: tabular-nums; }

/* Motion: small and quick, only to confirm what changed */
@keyframes t-fade { from { opacity: 0; } }
@keyframes t-rise { from { opacity: 0; transform: translateY(6px); } }

/* Insights below the app */
.insights-anchor { scroll-margin-top: var(--topbar-h); }

/* Phones: the panel becomes a bottom sheet you can drag. */
@media (max-width: 760px) {
  :root { --topbar-h: 52px; }
  .topbar { gap: 1rem; }
  .topbar .period { display: none; }
  .wordmark { white-space: nowrap; font-size: 1.15rem; }
  .topbar nav { flex-wrap: nowrap; gap: .1rem; margin-left: auto; }
  .topbar nav a { font-size: .86rem; padding: .4rem .6rem; white-space: nowrap; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: calc(100% - 58px); border-radius: 20px 20px 0 0;
    box-shadow: 0 -2px 16px rgba(60,64,67,.18); transform: translateY(50%); transition: transform .32s var(--t-ease); will-change: transform; }
  .sheet.dragging { transition: none; }
  /* Until the sheet is fully open, every vertical drag on it moves the sheet (see travel.js), so the
     browser must not scroll its content or the page meanwhile. */
  .sheet:not([data-snap="full"]) { touch-action: none; }
  .sheet:not([data-snap="full"]) .sheet-body { overflow-y: hidden; }
  .sheet-grip { display: grid; place-items: center; height: 22px; border: 0; background: none; cursor: grab; touch-action: none; flex: none; padding: 0; }
  .sheet-grip span { width: 36px; height: 4px; border-radius: 2px; background: #dadce0; }
  .sheet-tabs { margin-top: 2px; touch-action: none; }
  .tmap-top { top: 10px; }
  .live-pill { font-size: .76rem; max-width: calc(100vw - 132px); }  /* clear of the buttons on both sides */
  #live-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .tmap-tools { bottom: auto; top: 56px; right: 12px; }
  .tmap-zoom { display: none; }
  .filter-pop { right: 60px; bottom: auto; top: 56px; width: min(270px, calc(100vw - 76px)); }
  .search-card.collapsed { gap: .45rem; }
  .search-card.collapsed .when-row, .search-card.collapsed > .go { display: none; }
  .search-card.collapsed .edit-search { display: block; }
  .results-head { margin-top: .7rem; }
  .detail-open .search-card, .detail-open #route-note { display: none; }
  .mode-row { padding: 11px 8px; }
  .tmap .maplibregl-ctrl-top-left { top: 4px; }
  .ac input { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot, .skeleton-card, .jcard, .route-detail, .train-detail, .dep, .ac-list, [data-panel]:not([hidden]) { animation: none; }
  .sheet, .progress span, .jcard { transition: none; }
}
@media print { .travel { display: none; } }

/* Plan B: chance of each change and the best way on (app/guard.py) */
.guard { margin: .2rem 0 .8rem; padding: .85rem .95rem; border: 1px solid var(--t-line); border-radius: 14px; background: var(--t-surface);
  display: grid; gap: .55rem; }
.guard-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.guard-head h3 { margin: 0; font-size: 1rem; }
.guard-head .muted, .guard .muted { color: var(--t-muted); font-size: .8rem; }
.guard-meter { display: flex; align-items: baseline; gap: .5rem; font-size: .88rem; }
.guard-meter strong { font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.guard-meter.good strong, .guard .good { color: var(--t-ok); }
.guard-meter.fair strong, .guard .fair { color: #b06000; }
.guard-meter.poor strong, .guard .poor { color: var(--t-late); }
.guard-bar { height: 6px; border-radius: 3px; background: var(--t-soft); overflow: hidden; }
.guard-bar span { display: block; height: 100%; border-radius: 3px; background: currentColor; }
.guard-meter.good + .guard-bar { color: var(--t-ok); }
.guard-meter.fair + .guard-bar { color: #e37400; }
.guard-meter.poor + .guard-bar { color: var(--t-late); }
.guard-advice { margin: 0; padding: .5rem .7rem; border-radius: 10px; font-size: .88rem; font-weight: 500; }
.guard-advice.ok { background: #e6f4ea; color: #0d652d; }
.guard-advice.watch { background: #fef7e0; color: #8a4a00; }
.guard-advice.act { background: #fce8e6; color: #a50e0e; }
.guard-change { display: grid; gap: .1rem; font-size: .86rem; }
.guard h4 { margin: .3rem 0 0; font-size: .86rem; color: var(--t-muted); font-weight: 600; }
.guard-option { display: grid; gap: .3rem; padding: .6rem .7rem; border-radius: 12px; background: var(--t-soft); transition: box-shadow .15s, background .15s; }
.guard-option.missed { background: var(--t-surface); border: 1px dashed var(--t-line); }
.guard-option.is-preview { box-shadow: inset 0 0 0 2px var(--t-blue); background: #f8faff; }
.guard-option-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; }
.guard-option .jmeta.better { color: var(--t-ok); font-weight: 600; }
.guard-actions { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; }
.guard-more { display: grid; gap: .45rem; }
.guard-more > summary { cursor: pointer; font: 600 .82rem var(--t-font); color: var(--t-blue); list-style-position: inside; padding: .15rem 0; }
.guard-controls { display: grid; gap: .4rem; }
.guard-gps { display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center; font-size: .82rem; color: var(--t-muted); }
.guard-foot { color: var(--t-faint); font-size: .74rem; }
.guard .go.small { justify-self: stretch; }
.back-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; }
.it-stop.is-near .it-name::before { border-color: var(--t-blue); background: var(--t-blue); box-shadow: 0 0 0 4px rgba(26,115,232,.2); }
.guard-chip { margin-left: auto; font-size: .76rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; background: var(--t-soft); }
.guard-alert { position: absolute; z-index: 30; top: 56px; left: 50%; transform: translateX(-50%);
  width: min(92vw, 460px); display: grid; gap: .1rem; text-align: left; padding: .65rem .9rem; border-radius: 14px; border: 0;
  font: .88rem var(--t-font); box-shadow: var(--t-shadow-2); cursor: pointer; background: var(--t-surface); color: var(--t-ink); }
.guard-alert.watch { background: #fef7e0; }
.guard-alert.act { background: #fce8e6; animation: guard-pulse 1.6s ease-in-out 3; }
.guard-alert.ok { background: #e6f4ea; }
@keyframes guard-pulse { 50% { box-shadow: 0 0 0 6px rgba(217, 48, 37, .25), var(--t-shadow-2); } }
@media (prefers-reduced-motion: reduce) { .guard-alert.act { animation: none; } }
@media (max-width: 760px) {
  .guard-alert { top: 48px; left: 12px; right: 64px; width: auto; transform: none; max-width: none; white-space: normal; }
}

/* Tickets: Deutschlandticket or a ticket to buy, and passenger rights after a delay */
.tk { display: inline-block; font-size: .74rem; font-weight: 600; padding: .05rem .45rem; border-radius: 999px; }
.tk-dt { background: #e6f4ea; color: #0d652d; }
.tk-buy { background: #fef7e0; color: #8a4a00; }
.ticket-box { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; margin-top: .55rem; font-size: .84rem; }
.ticket-box small { color: var(--t-muted); }
.ticket-box .book { text-decoration: none; }
.ticket-note { flex-basis: 100%; color: var(--t-faint) !important; font-size: .74rem; }
.opt-check { display: flex !important; align-items: center; gap: .45rem; }
.rights { display: grid; gap: .35rem; padding: .7rem .8rem; border-radius: 12px; background: #fef7e0; font-size: .86rem; }
.rights.claim { background: #e8f0fe; }
.rights p { margin: 0; }
.rights-steps { margin: .1rem 0 0; padding-left: 1.2rem; display: grid; gap: .2rem; }
.rights-links { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }

/* Language menu: a short code with the native list on top of it */
.lang-switch { position: relative; display: inline-flex; align-items: center; }
.lang-switch select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.lang-switch:focus-within { outline: 2px solid var(--t-blue); outline-offset: 2px; }

/* Feedback page and the owner's inbox */
.fb-form { display: grid; gap: .45rem; max-width: 640px; }
.fb-form label { font-weight: 600; font-size: .9rem; margin-top: .5rem; }
.fb-form select, .fb-form textarea, .fb-form input[type=email], .fb-form input[type=file] {
  font: 1rem var(--t-font); padding: .6rem .75rem; border: 1px solid var(--t-line); border-radius: 10px; background: var(--t-surface); width: 100%; box-sizing: border-box; }
.fb-form textarea { resize: vertical; min-height: 8rem; }
.fb-form .go { margin-top: .6rem; justify-self: start; }
.fb-consent { display: flex !important; gap: .55rem; align-items: flex-start; font-weight: 400 !important; font-size: .86rem !important; }
.fb-consent input { margin-top: .2rem; flex: none; }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-previews { display: flex; flex-wrap: wrap; gap: .5rem; }
.fb-preview { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--t-line); }
.fb-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fb-preview button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
.fb-thanks { padding: 1rem 1.2rem; border-radius: 14px; background: #e6f4ea; }
.fb-inbox { display: grid; gap: .8rem; }
.fb-entry { padding: .8rem 1rem; border: 1px solid var(--t-line); border-radius: 14px; background: var(--t-surface); display: grid; gap: .45rem; }
.fb-entry-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; }
.fb-entry .muted { color: var(--t-muted); font-size: .82rem; }
.fb-text { white-space: pre-wrap; margin: 0; }

.later-note { margin: 0 0 .6rem; padding: .55rem .75rem; border-radius: 10px; background: #fef7e0; color: #8a4a00; font-size: .86rem; }

/* Copyright and data credits under the panel (they used to sit in a button on the map) */
.sheet-credits { flex: none; margin: 0; padding: 0 1rem .6rem; font-size: .7rem; line-height: 1.45; color: var(--t-faint);
  display: flex; flex-wrap: wrap; gap: .1rem .6rem; }
.sheet-credits a { color: var(--t-faint); }
.sheet-credits a:hover { color: var(--t-blue); }
.copyright { margin: 1.5rem 0 .5rem; font-size: .8rem; color: var(--t-faint); }

/* ---------- Dark mode (theme.js sets data-theme="dark") ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --t-ink: #f1f3f4; --t-muted: #a8adb3; --t-faint: #80868b; --t-line: #232323; --t-soft: #141414; --t-hover: #1b1b1b;
  --t-blue: #8ab4f8; --t-blue-ink: #aecbfa; --t-blue-soft: #0f1a2b; --t-late: #f28b82; --t-ok: #81c995;
  --t-ld: #f1f3f4; --t-surface: #000; --t-glass: rgba(0,0,0,.86); --t-page: #000;
  --t-shadow-1: 0 0 0 1px #262626; --t-shadow-2: 0 0 0 1px #262626;
  --paper: #000; --ink: #f1f3f4;
}
:root[data-theme="dark"] body { background: var(--t-page); color: var(--t-ink); }
:root[data-theme="dark"] .wordmark { color: var(--t-ink); }
:root[data-theme="dark"] .go:not(.ghost) { background: #1a73e8; color: #fff; }
:root[data-theme="dark"] .go.ghost { box-shadow: inset 0 0 0 1px var(--t-line); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { color: var(--t-ink); background-color: var(--t-surface); }
:root[data-theme="dark"] .guard-advice.ok, :root[data-theme="dark"] .tk-dt, :root[data-theme="dark"] .fb-thanks { background: #173823; color: #a8dab5; }
:root[data-theme="dark"] .guard-advice.watch, :root[data-theme="dark"] .tk-buy, :root[data-theme="dark"] .later-note,
:root[data-theme="dark"] .rights, :root[data-theme="dark"] .it-change.tight, :root[data-theme="dark"] .guard-alert.watch { background: #3a2e12; color: #f6d68b; }
:root[data-theme="dark"] .guard-advice.act, :root[data-theme="dark"] .guard-alert.act { background: #3c1a18; color: #f6aea9; }
:root[data-theme="dark"] .rights.claim { background: #1f2a3a; color: var(--t-ink); }
:root[data-theme="dark"] .guard-alert.ok { background: #173823; }
:root[data-theme="dark"] .mt { filter: brightness(.85) saturate(.9); }
:root[data-theme="dark"] .sheet-grip span { background: #5f6368; }

/* Display slider in the top bar: Light · Dark · Simple, a knob slides to the chosen one */
.mode-slider { position: relative; display: inline-grid; grid-template-columns: repeat(3, 30px); height: 30px; padding: 2px;
  border-radius: 999px; background: var(--t-soft); border: 1px solid var(--t-line); flex: none; }
.mode-slider button { position: relative; z-index: 1; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 999px;
  font: 600 .9rem var(--t-font); color: var(--t-faint); line-height: 1; }
.mode-slider button[aria-checked="true"] { color: var(--t-ink); }
.mode-slider button:focus-visible { outline: 2px solid var(--t-blue); outline-offset: 1px; }
.ms-knob { position: absolute; top: 2px; left: 2px; width: 30px; height: 30px; border-radius: 999px; background: var(--t-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .22s var(--t-ease); }
:root[data-theme="dark"] .ms-knob { background: #2a2a2a; box-shadow: none; }
.mode-slider[data-pos="1"] .ms-knob { transform: translateX(30px); }
.mode-slider[data-pos="2"] .ms-knob { transform: translateX(60px); }
@media (prefers-reduced-motion: reduce) { .ms-knob { transition: none; } }

/* ---------- Text only (data-view="text"): no map, no 3D; the panel is the page ---------- */
:root[data-view="text"] .travel { height: auto; min-height: calc(100svh - var(--topbar-h)); overflow: visible; }
:root[data-view="text"] .tmap { position: fixed; inset: 0; visibility: hidden; pointer-events: none; z-index: -1; }
:root[data-view="text"] .travel > :not(.sheet):not(.tmap):not(.guard-alert) { display: none !important; }
:root[data-view="text"] .guard-alert { position: fixed; top: calc(var(--topbar-h) + 8px); }
:root[data-view="text"] .sheet { position: relative !important; inset: auto !important; transform: none !important; height: auto !important;
  width: min(760px, 100%) !important; margin: 0 auto; border-radius: 0; box-shadow: none; touch-action: auto !important; }
:root[data-view="text"] .sheet-body { overflow: visible !important; }
:root[data-view="text"] .sheet-grip, :root[data-view="text"] .map-only { display: none !important; }
.text-stats { display: grid; gap: .6rem; margin: 14px 14px 4px; padding: .9rem 1rem; border: 1px solid var(--t-line); border-radius: 14px; }
.text-stats h2 { margin: 0; font-size: .95rem; }
.text-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; }
.text-stat strong { display: block; font-size: 1.45rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.text-stat span { font-size: .8rem; color: var(--t-muted); }
.text-stats-modes { font-size: .82rem; color: var(--t-muted); }
:root[data-theme="dark"] .od input { background-color: transparent; }
/* Narrow phones: the logo already leads to the map, so the "Live map" link gives its room to the controls */
@media (max-width: 480px) {
  .topbar { gap: .5rem; padding: 0 .75rem; }
  .topbar nav { gap: .15rem; flex-wrap: nowrap; align-items: center; }
  .topbar nav a[href="/"] { display: none; }
  .topbar nav a { padding: .4rem .55rem; }
  .wordmark { font-size: 1.08rem; gap: .4rem; }
  .mode-slider { grid-template-columns: repeat(3, 27px); height: 28px; }
  .ms-knob { width: 27px; height: 28px; }
  .mode-slider[data-pos="1"] .ms-knob { transform: translateX(27px); }
  .mode-slider[data-pos="2"] .ms-knob { transform: translateX(54px); }
}

/* Short introduction under the search form (for first visits and search engines); hidden after a search */
.intro { margin: .4rem 2px 0; padding: .9rem 1rem; border-radius: 14px; background: var(--t-soft); font-size: .86rem; color: var(--t-muted); }
.intro h1 { margin: 0 0 .35rem; font-size: 1rem; color: var(--t-ink); }
.intro p { margin: 0 0 .45rem; }
.intro ul { margin: 0 0 .45rem; padding-left: 1.1rem; display: grid; gap: .3rem; }
.intro strong { color: var(--t-ink); font-weight: 600; }
.intro-note { color: var(--t-faint); margin: 0 !important; }
