:root {
  --bg: #040a18;
  --surface: rgba(9, 17, 38, 0.78);
  --surface-2: rgba(16, 28, 58, 0.9);
  --border: rgba(120, 150, 220, 0.14);
  --hairline: rgba(120, 150, 220, 0.1);
  --text: #e6edff;
  --muted: #8396bf;
  --dim: #7486a8; /* ≥ 4.5:1 on --bg, it's used for small text */
  --accent: #5cc8ff;
  --late: #ffd23f;
  --very-late: #ff4d4d;
  --warn: #ffb547;
  --ok: #3ddc97;
  --r: 14px;
  --row: 30px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13.5px/1.45 Inter, system-ui, sans-serif; font-feature-settings: "tnum", "cv11"; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
a { color: inherit; }
#map { position: fixed; inset: 0; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.6) 100%); }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-bottom-right { display: none !important; }
.maplibregl-canvas:focus { outline: none; }
.mono { font-variant-numeric: tabular-nums; }
/* one visible focus ring for every control, keyboard only */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* surfaces */
.ui { position: fixed; z-index: 2; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; color: var(--muted); cursor: pointer; }
.icon svg { width: 16px; height: 16px; }
.icon:hover, .icon:focus-visible, .icon[aria-pressed="true"], .icon[aria-expanded="true"] { color: var(--text); background: rgba(255, 255, 255, 0.07); }

/* loading */
#loading { position: fixed; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); background: var(--bg); transition: opacity 0.5s; }
#loading[hidden] { display: grid; opacity: 0; pointer-events: none; }
#loading .mark { width: 56px; fill: var(--accent); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; transform: scale(0.94); } }

/* top bar */
#bar { top: 14px; left: 14px; right: 14px; height: 52px; display: flex; align-items: center; gap: 18px; padding: 0 10px 0 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: 0.1em; font-size: 12.5px; text-transform: uppercase; }
.brand .mark { width: 26px; fill: var(--accent); filter: drop-shadow(0 0 6px rgba(92, 200, 255, 0.45)); }
.search { position: relative; flex: 0 1 360px; min-width: 150px; display: flex; align-items: center; height: 34px; padding: 0 10px; gap: 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--hairline); color: var(--muted); }
.search:focus-within { border-color: rgba(92, 200, 255, 0.45); color: var(--text); }
.search svg { width: 15px; height: 15px; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--text); font: inherit; outline: none; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { font: 10.5px/1 Inter, system-ui; color: var(--dim); border: 1px solid var(--hairline); border-radius: 5px; padding: 3px 5px; }
#results { position: absolute; top: calc(100% + 8px); left: -1px; right: -1px; margin: 0; padding: 6px; list-style: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5); max-height: 60vh; overflow: auto; }
#results li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
#results li:hover, #results li[aria-selected="true"] { background: rgba(92, 200, 255, 0.12); }
#results li small { color: var(--muted); }
#results .rkind { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.stats { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; white-space: nowrap; min-width: 0; }
#status-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stats .sep { width: 1px; height: 18px; background: var(--hairline); }
#clock { color: var(--text); font-weight: 500; }
#issues { display: flex; gap: 6px; }
#issues:empty { display: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.pill::before, .sev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
button.pill { border: 0; cursor: pointer; font-family: inherit; }
button.pill:hover, button.pill:focus-visible { background: color-mix(in srgb, var(--c) 26%, transparent); }
.pill.quiet { font-weight: 500; background: color-mix(in srgb, var(--c) 9%, transparent); }
.pill.alarm::before { animation: blink 1s steps(1) infinite; box-shadow: 0 0 6px var(--c); }
@keyframes blink { 55% { opacity: 0.15; } }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
#spark { width: 120px; height: 26px; }
#spark .area { fill: rgba(92, 200, 255, 0.12); }
#spark .line { fill: none; stroke: var(--ok); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6); animation: pulse 2.4s infinite; }
.dot.stale { background: var(--dim); animation: none; box-shadow: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }

/* category chips */
#chips { bottom: 16px; left: 14px; max-width: calc(100% - 28px); display: flex; gap: 4px; padding: 5px; align-items: center; overflow-x: auto; scrollbar-width: none; }
#chips button { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; white-space: nowrap; flex: none; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: 12px; font-weight: 500; cursor: pointer; transition: opacity 0.15s, background 0.15s; }
#chips button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 60%, transparent); }
#chips button.rainbow::before { background: conic-gradient(#f66, #fd6, #6f9, #6cf, #c6f, #f66); }
#chips button:hover { background: rgba(255, 255, 255, 0.06); }
#chips button.off { opacity: 0.38; }
#chips button.off::before { box-shadow: none; }
#chips .gap { width: 1px; height: 18px; background: var(--hairline); margin: 0 4px; }

/* tooltip */
#tip { position: fixed; z-index: 4; pointer-events: none; padding: 7px 11px; font-size: 12px; white-space: nowrap; display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
#tip .sub { margin: 0; color: var(--muted); }
#tip[hidden] { display: none; } /* the id rule's display:flex would otherwise beat the hidden attribute */

/* credits */
#credits { bottom: 16px; right: 14px; padding: 6px 12px; font-size: 11px; color: var(--dim); border-radius: 999px; z-index: 1; } /* under the panel and sheet */
#credits a { text-decoration: none; }
body:has(#panel:not([hidden])) #credits, body:has(#key:not([hidden])) #credits { right: 430px; } /* beside the panel, not under it */
#credits a:hover { color: var(--muted); }

/* panel */
#panel { top: 80px; right: 14px; bottom: 16px; width: 400px; padding: 18px 18px 14px; overflow-y: auto; animation: slide 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); scrollbar-width: thin; scrollbar-color: var(--border) transparent; border-top: 3px solid var(--line, var(--accent)); }
@keyframes slide { from { transform: translateX(18px); opacity: 0; } }
#close { position: absolute; top: 10px; right: 10px; }
#panel h2 { margin: 0 34px 2px 0; font-size: 18px; font-weight: 600; display: flex; gap: 9px; align-items: center; letter-spacing: -0.01em; }
.badge { padding: 2px 8px; border-radius: 6px; color: #040a18; font-weight: 700; font-size: 12px; letter-spacing: 0.02em; }
.sub { color: var(--muted); margin: 2px 0 10px; }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(61, 220, 151, 0.12); color: var(--ok); }
.chip.late { background: rgba(255, 210, 63, 0.14); color: var(--late); }
.chip.very-late, .chip.off { background: rgba(255, 77, 77, 0.14); color: var(--very-late); }
.late { color: var(--late); } .very-late { color: var(--very-late); } .standing { color: #ff9f5a; }
.progress { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin: 6px 0 12px; overflow: hidden; }
.progress i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--line); border-radius: 2px; transition: width 1s linear; }
.actions { display: flex; gap: 6px; margin: 0 0 6px; }
.actions button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--hairline); background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.actions button:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.actions button[aria-pressed="true"] { color: var(--accent); border-color: rgba(92, 200, 255, 0.4); background: rgba(92, 200, 255, 0.1); }
.actions svg { width: 14px; height: 14px; }
.actions a { display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--hairline); background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: none; margin-left: auto; }
.actions a:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
a.inline { color: var(--accent); text-decoration: none; }
.unit-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.unit-row .unit { display: inline-flex; border-radius: 7px; border: 1px solid var(--hairline); background: rgba(255, 255, 255, 0.04); overflow: hidden; }
.unit-row a { padding: 4px 8px; color: var(--muted); font-size: 12px; text-decoration: none; }
.unit-row a + a { border-left: 1px solid var(--hairline); }
.unit-row a b { color: var(--text); font-weight: 600; }
.unit-row a:hover { background: rgba(255, 255, 255, 0.08); }

.alert { border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 9%, transparent); padding: 8px 11px; margin: 8px 0; border-radius: 0 10px 10px 0; }
.alert .sev { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--c); font-weight: 600; }
.alert strong { display: block; font-weight: 500; margin-top: 2px; }
.alert p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; white-space: pre-line; }
.alert a { display: inline-block; margin-top: 5px; font-size: 12px; color: var(--accent); text-decoration: none; }
.alert .more { display: block; background: none; border: 0; padding: 0; margin-top: 6px; color: var(--accent); font: 500 12px Inter, system-ui, sans-serif; cursor: pointer; }

/* disruption panel */
.sev-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--c); font-weight: 700; }
.sev-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.kind-title { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; margin: 6px 34px 2px 0; }
.headline { margin: 14px 0 4px; font-weight: 500; }
.desc { margin: 0; color: var(--muted); font-size: 12.5px; white-space: pre-line; }
.ticker { display: inline-block; margin-top: 10px; color: var(--accent); text-decoration: none; font-size: 12.5px; font-weight: 500; }
.span, .lines { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.stn { border: 1px solid var(--hairline); background: rgba(255, 255, 255, 0.04); color: var(--text); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: 500 12.5px Inter, system-ui, sans-serif; }
.stn:hover, .stn:focus-visible { background: rgba(255, 255, 255, 0.09); }
.arrow { color: var(--dim); }
.banner { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 1px solid rgba(255, 77, 77, 0.35); background: rgba(255, 77, 77, 0.09); color: var(--text); border-radius: 10px; padding: 9px 12px; margin: 6px 0 10px; font: inherit; }
button.banner { cursor: pointer; }
.banner.quiet { border-color: color-mix(in srgb, #ff9f5a 30%, transparent); background: color-mix(in srgb, #ff9f5a 7%, transparent); }
.banner.quiet strong { color: #ff9f5a; }
button.banner:hover { background: rgba(255, 77, 77, 0.15); }
.banner strong { color: var(--very-late); font-weight: 600; }
.banner span { color: var(--muted); font-size: 12.5px; }
.issues { list-style: none; margin: 8px 0 0; padding: 0; }
.issues li { display: grid; grid-template-columns: 8px 1fr; gap: 12px; align-items: start; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.issues li + li { border-top: 1px solid var(--hairline); }
.issues li:hover, .issues li:focus-visible { background: rgba(255, 255, 255, 0.05); }
.issues .sev-dot { margin-top: 6px; }
.issues strong { display: block; font-weight: 500; }
.issues small { color: var(--muted); font-size: 12px; }
details.planned { margin-top: 10px; }
details.planned summary { cursor: pointer; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; list-style: none; }
details.planned summary::before { content: "▸ "; } details.planned[open] summary::before { content: "▾ "; }

h3 small { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--muted); font-weight: 500; }
.moved { color: var(--late); font-weight: 600; }
.age { color: var(--dim); }
h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); margin: 18px 0 8px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
h3::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.tabs { display: flex; gap: 2px; padding: 3px; margin: 12px 0 4px; background: rgba(255, 255, 255, 0.04); border-radius: 9px; }
.tabs button { flex: 1; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.formation { display: flex; gap: 2px; margin: 4px 0 6px; overflow-x: auto; padding-bottom: 2px; align-items: flex-start; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.car { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.car i { font: 600 10px/1 Inter, system-ui, sans-serif; color: var(--muted); min-height: 10px; font-style: normal; }
.coach { min-width: 26px; height: 20px; border-radius: 3px; background: #223c74; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; flex: none; color: #cfdcff; padding: 0 3px; }
.coach.c1 { background: #d4af37; color: #1a1400; }
.coach.c12 { background: linear-gradient(90deg, #d4af37 50%, #223c74 50%); color: #fff; text-shadow: 0 0 2px #000; }
.coach.odd { box-shadow: inset 0 0 0 1.5px var(--late); }
.coach.wr { background: #c0423f; color: #fff; }
.coach.loco { min-width: 18px; background: #314469; color: transparent; }
.coach.loco:first-child { border-radius: 11px 3px 3px 11px; }
.coach.loco:last-child { border-radius: 3px 11px 11px 3px; }
.coach.closed { opacity: 0.3; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; }
.facts span { display: inline-flex; align-items: center; gap: 5px; }
.facts.hints { margin: 8px 0 2px; }
.facts.hints span:not(:last-child)::after { content: "·"; margin-left: 14px; color: var(--dim); }
.facts.hints span { gap: 0; }
.through { display: flex; align-items: center; gap: 7px; width: 100%; margin: 6px 0; padding: 8px 10px; border-radius: 9px; border: 1px dashed var(--border); background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; text-align: left; }
.through:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.facts svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.stops { list-style: none; margin: 0; padding: 0; position: relative; --p: 0; }
.stops li { display: grid; grid-template-columns: 42px 34px 1fr auto auto; gap: 8px; height: var(--row); align-items: center; position: relative; padding-left: 20px; }
.stops li::before { content: ""; position: absolute; left: 4px; top: 50%; width: 8px; height: 8px; margin-top: -5px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); }
.stops li.past::before { background: var(--line); }
.stops li.past { color: var(--muted); }
.stops li.skipped .name { text-decoration: line-through; color: var(--very-late); }
.stops .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stops .name small { color: var(--dim); font-size: 11px; }
.stops.stem::after { content: ""; position: absolute; left: 7px; width: 2px; top: calc(var(--row) / 2); bottom: calc(var(--row) / 2); border-radius: 1px; z-index: -1;
  background: linear-gradient(to bottom, var(--line) calc(var(--p) * 100%), rgba(255, 255, 255, 0.1) calc(var(--p) * 100%)); }
.stops.stem .pos { position: absolute; left: 3px; top: calc(var(--row) / 2 + var(--p) * (100% - var(--row)) - 5px); width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--line) 45%, transparent); transition: top 1s linear; }
.stops .exp { font-size: 12px; }
.stops .pl { font-size: 11px; color: var(--dim); min-width: 28px; text-align: right; }
.meters { display: inline-flex; gap: 5px; }
.meter { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; width: 13px; }
.meter i { width: 3px; background: #2a3f6b; border-radius: 1px; height: 100%; }
.meter.o1 i:nth-child(1) { background: var(--ok); } .meter.o2 i:nth-child(-n+2) { background: var(--late); } .meter.o3 i { background: var(--very-late); }
.meter i:nth-child(1) { height: 40%; } .meter i:nth-child(2) { height: 70%; }
.deps li { grid-template-columns: 42px auto 1fr auto auto; padding-left: 4px; cursor: pointer; border-radius: 8px; }
.deps li::before { display: none; }
.deps li:hover, .deps li:focus-visible { background: rgba(92, 200, 255, 0.08); }
.empty { color: var(--dim); padding: 10px 4px; }
.stops li.empty { display: block; height: auto; padding: 10px 4px; cursor: default; }
.stops li.empty:hover { background: none; }

/* map key */
#key { top: 80px; right: 14px; width: 360px; max-height: calc(100% - 110px); overflow-y: auto; padding: 16px 18px; z-index: 3; }
#key [data-close] { position: absolute; top: 10px; right: 10px; }
#key h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
#key h3 { margin: 14px 0 6px; }
#key ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); }
#key li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
#key .ki { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#key:focus-visible { outline: none; }
#key p { margin: 0; font-size: 12.5px; color: var(--muted); }
#key kbd { font: 11px/1 Inter, system-ui; border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px; color: var(--text); }
.k-train { display: inline-block; flex: none; width: 18px; height: 9px; border-radius: 3px 5px 5px 3px; background: var(--c); box-shadow: 0 0 0 1.5px var(--o, #040a18); }
.k-train.rainbow { background: linear-gradient(90deg, #f66, #fd6, #6f9, #6cf, #c6f); }
.k-train.blink, .k-line.blink { animation: blink 1s steps(1) infinite; }
.k-line { display: inline-block; flex: none; width: 20px; height: 3px; border-radius: 2px; background: var(--c); }
.k-line.dashed { background: repeating-linear-gradient(90deg, #7486a8 0 4px, transparent 4px 8px); height: 2px; }
.k-line.tunnel { background: repeating-linear-gradient(90deg, #4a74c9 0 3px, transparent 3px 6px); height: 2px; opacity: 0.6; }
.k-diamond { display: inline-block; flex: none; width: 8px; height: 8px; background: #ffb547; transform: rotate(45deg); margin: 0 2px; }
.k-hub { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.6px solid #c7d6ff; background: radial-gradient(#c7d6ff 25%, #040a18 30%); }
.k-stn { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #93aadb; }

/* zen: a tap shows the way out */
#zen-exit { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 5; height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer; }
body:not(.zen) #zen-exit { display: none; }

/* zen */
body.zen #bar, body.zen #chips, body.zen #panel, body.zen #credits, body.zen #tip, body.zen #vignette, body.zen #key { display: none; }
body.zen.idle { cursor: none; }

@media (max-width: 1180px) {
  #spark { display: none; }
  #credits { bottom: 66px; } /* above the chips, which span the bottom here */
  #credits .long { display: none; } /* the licences stay credited, just shorter */
  .brand span { display: none; }
}
@media (max-width: 960px) {
  #issues .pill:not(.alarm) { display: none; } /* reported incidents stay reachable on small screens */
  .stats { gap: 8px; }
}
@media (max-width: 760px) {
  /* a blur over a canvas redrawn 20× a second is expensive on phone GPUs */
  .ui { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(9, 17, 38, 0.94); }
  #bar { top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; height: auto; flex-wrap: wrap; padding: 6px 8px; gap: 6px 8px; }
  .brand span { display: none; }
  .search { flex: 1 1 100%; order: 3; height: 40px; }
  .search input { font-size: 16px; } /* below 16 px iOS zooms the page on focus */
  .search kbd { display: none; }
  .stats { gap: 6px; font-size: 12px; flex: 1; justify-content: flex-end; }
  .stats .sep, #clock { display: none; }
  #spark { display: none; }
  .icon { width: 40px; height: 40px; }
  #chips { left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); overflow-x: auto; scrollbar-width: none; }
  #chips button { padding: 9px 11px; }
  #credits, body:has(#panel:not([hidden])) #credits, body:has(#key:not([hidden])) #credits { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 52px); right: 10px; padding: 3px 9px; font-size: 10px; }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 58dvh; border-radius: 16px 16px 0 0; padding-top: 22px; padding-bottom: max(14px, env(safe-area-inset-bottom)); animation: up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
  #panel::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--border); } /* drag handle: swipe down to close */
  #key { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 70dvh; border-radius: 16px 16px 0 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  @keyframes up { from { transform: translateY(20px); opacity: 0; } }
  #tip { display: none; }
  .actions button, .actions a, .tabs button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .dot, #panel, #loading .mark, .pill.alarm::before, .k-train.blink, .k-line.blink { animation: none; } }
