:root {
  --bg: #02040a;
  --ink: #e9eefb;
  --ink-2: #aab5cf;
  --ink-3: #6c7894;
  --glass: rgba(9, 13, 24, 0.58);
  --glass-2: rgba(16, 22, 38, 0.72);
  --edge: rgba(160, 190, 255, 0.10);
  --edge-2: rgba(160, 190, 255, 0.18);
  --accent: #27c9ff;
  --bad: #ff3b5c;
  --warn: #ffb31a;
  --ok: #3ef0a0;
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --pad: 16px;
  --ticker: 34px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
canvas#gl, canvas#ov { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#ov { cursor: grab; touch-action: none; }
canvas#ov:active { cursor: grabbing; }

.glass {
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: 16px;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── loader ───────────────────────────────────────────── */
#loader { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 22px; background: radial-gradient(ellipse at center, #07101f 0%, #02040a 70%); z-index: 50; transition: opacity 1.2s ease, visibility 1.2s; }
body.ready #loader { opacity: 0; visibility: hidden; }
#loader p { margin: 0; color: var(--ink-2); font-size: 13px; letter-spacing: .08em; }
.mark { position: relative; width: 84px; height: 84px; }
.mark i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; animation: spin 1.6s linear infinite; }
.mark i:nth-child(1) { border-top-color: #27c9ff; }
.mark i:nth-child(2) { inset: 12px; border-right-color: #ff6a3d; animation-duration: 1.1s; animation-direction: reverse; }
.mark i:nth-child(3) { inset: 24px; border-bottom-color: #9a38a1; animation-duration: .8s; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── reveal choreography ──────────────────────────────── */
.brand, .stats, .lines, .dock, .ticker { opacity: 0; transform: translateY(8px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .8, .2, 1); }
body.ready .brand { opacity: 1; transform: none; transition-delay: 1.4s; }
body.ready .stats { opacity: 1; transform: none; transition-delay: 2.0s; }
body.ready .lines { opacity: 1; transform: none; transition-delay: 2.3s; }
body.ready .dock { opacity: 1; transform: none; transition-delay: 2.7s; }
body.ready .ticker { opacity: 1; transform: none; transition-delay: 3.0s; }

/* ── brand ────────────────────────────────────────────── */
.brand { position: fixed; top: var(--pad); left: var(--pad); display: flex; align-items: center; gap: 12px; pointer-events: none; z-index: 5; }
.logo { width: 40px; height: 40px; filter: drop-shadow(0 0 10px rgba(39, 201, 255, .5)); }
.brand h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; background: linear-gradient(90deg, #fff, #b9d6ff 60%, #8aa4d6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand p { margin: 2px 0 0; font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }

/* ── stats ────────────────────────────────────────────── */
.stats { position: fixed; top: 74px; left: var(--pad); width: 300px; padding: 16px 18px 14px; z-index: 5; }
.clock { display: flex; align-items: baseline; justify-content: space-between; }
.clock #clock { font-size: 30px; font-weight: 300; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.clock small { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .12em; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(62, 240, 160, .6); animation: live 2s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(62, 240, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 240, 160, 0); } }
.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 14px; }
.counts div { display: flex; flex-direction: column; }
.counts b { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.counts div:first-child b { background: linear-gradient(180deg, #fff, #9cc9ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.counts div:last-child b { background: linear-gradient(180deg, #fff, #ffc98a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.counts span { font-size: 11px; color: var(--ink-3); letter-spacing: .04em; margin-top: 3px; }
.speed .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 7px; }
.speed .row b { color: var(--ink); font-variant-numeric: tabular-nums; }
#hist { width: 100%; height: 38px; display: block; }
.scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-3); margin-top: 4px; }
.boro { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; font-size: 11.5px; color: var(--ink-2); }
.boro span { display: flex; align-items: center; gap: 7px; }
.boro i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.facts { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--edge); display: grid; gap: 10px; }
.facts li { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "k k" "b v" "d d"; column-gap: 8px; row-gap: 3px; align-items: center; }
.facts .k { grid-area: k; font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); }
.facts .bullet, .facts .bus-badge { grid-area: b; }
.facts .v { grid-area: v; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.facts .d { grid-area: d; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── bullets ──────────────────────────────────────────── */
.bullet { --c: #888; --t: #fff; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: var(--t); font-weight: 700; font-size: 15px; letter-spacing: -.02em; flex: none; box-shadow: 0 0 14px -2px var(--c); }
.bullet i { font-style: normal; line-height: 1; }
.bullet.sm { width: 19px; height: 19px; font-size: 11.5px; box-shadow: none; vertical-align: -4px; margin: 0 2px; }
.bullet.diamond { border-radius: 3px; transform: rotate(45deg) scale(.86); }
.bullet.diamond i { transform: rotate(-45deg); }
.bus-badge { --c: #27c9ff; display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px; background: var(--c); color: #041018; font-weight: 800; font-size: 13px; letter-spacing: .01em; flex: none; box-shadow: 0 0 14px -3px var(--c); }
.bus-badge.sm { height: 18px; padding: 0 6px; font-size: 11px; border-radius: 4px; box-shadow: none; }

/* ── lines panel ──────────────────────────────────────── */
.lines { position: fixed; top: var(--pad); right: var(--pad); width: 254px; padding: 14px 14px 10px; z-index: 5; transition: opacity .35s, transform .35s; }
.lines h2 { margin: 0 0 10px 2px; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2); display: flex; justify-content: space-between; align-items: baseline; }
.lines h2 span { font-weight: 400; letter-spacing: .02em; text-transform: none; color: var(--ink-3); font-size: 10.5px; }
#bullets { display: flex; flex-wrap: wrap; gap: 6px 10px; }
#bullets .grp { display: flex; gap: 3px; }
.line { position: relative; background: none; border: 0; padding: 3px 2px 1px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: background .2s, opacity .2s; }
.line:hover { background: rgba(255, 255, 255, .06); }
.line em { font-style: normal; font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.line s { position: absolute; top: 1px; right: 0; width: 8px; height: 8px; border-radius: 50%; border: 2px solid #0a0f1c; display: none; }
.line s.bad { display: block; background: var(--bad); box-shadow: 0 0 8px var(--bad); animation: blink 1.6s infinite; }
.line s.warn { display: block; background: var(--warn); }
@keyframes blink { 50% { opacity: .35; } }
body.focused .line:not(.on) { opacity: .38; }
.line.on { background: rgba(255, 255, 255, .1); }
#linetip { position: fixed; right: 282px; width: 290px; padding: 12px 14px; background: var(--glass-2); border: 1px solid var(--edge-2); border-radius: 12px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); font-size: 12.5px; line-height: 1.45; color: var(--ink-2); z-index: 20; opacity: 0; pointer-events: none; transform: translateX(6px); transition: opacity .15s, transform .15s; }
#linetip.show { opacity: 1; transform: none; }
#linetip .lt-h { display: flex; gap: 9px; align-items: center; color: var(--ink); margin-bottom: 6px; }
#linetip p { margin: 6px 0 0; }
#linetip .ok { color: var(--ok); }
.tag { display: inline-block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; padding: 2px 6px; border-radius: 4px; margin-right: 7px; vertical-align: 1px; }
.tag.bad { background: rgba(255, 59, 92, .18); color: #ff7d93; }
.tag.warn { background: rgba(255, 179, 26, .16); color: #ffc452; }

/* ── info card ────────────────────────────────────────── */
#card { position: fixed; top: var(--pad); right: var(--pad); width: 330px; padding: 16px; z-index: 8; opacity: 0; transform: translateX(20px); pointer-events: none; transition: opacity .3s, transform .35s cubic-bezier(.2, .8, .2, 1); }
#card.show { opacity: 1; transform: none; pointer-events: auto; }
body:has(#card.show) .lines { opacity: 0; transform: translateX(20px); pointer-events: none; }
#card header { display: flex; gap: 12px; align-items: center; }
#card header .bullet { width: 38px; height: 38px; font-size: 22px; }
#card header .bus-badge { height: 30px; font-size: 15px; }
#card .title { font-size: 16px; font-weight: 700; line-height: 1.2; }
#card .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
#card header > div { flex: 1; min-width: 0; }
.x { background: rgba(255, 255, 255, .06); border: 0; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-2); flex: none; }
.x:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.now { display: flex; align-items: center; gap: 8px; margin: 14px 0 12px; font-size: 13px; color: var(--ink-2); }
.now b { color: var(--ink); font-weight: 600; }
.now .eta { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 700; font-size: 15px; }
.pulse { --c: #fff; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 0 var(--c); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 70%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.metrics div { background: rgba(255, 255, 255, .04); border: 1px solid var(--edge); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.metrics b { font-size: 19px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metrics span { font-size: 10px; color: var(--ink-3); letter-spacing: .04em; }
.stops { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; position: relative; max-height: 34vh; overflow: auto; }
.stops::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--ink-3), transparent); border-radius: 2px; }
.stops li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid rgba(255, 255, 255, .03); }
.stops li::before { content: ""; position: absolute; left: -13px; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #0b1120; }
.stops .nm { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stops .t { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; white-space: nowrap; }
.stops .t small { color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.actions { display: flex; gap: 8px; margin-top: 14px; }
.actions button { flex: 1; background: rgba(255, 255, 255, .06); border: 1px solid var(--edge-2); border-radius: 10px; padding: 9px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .2s; }
.actions button:hover { background: rgba(255, 255, 255, .12); }
.actions button.on { background: var(--accent); color: #031018; border-color: transparent; }
.fine { margin: 12px 0 0; font-size: 10.5px; color: var(--ink-3); line-height: 1.45; }

/* ── dock ─────────────────────────────────────────────── */
.dock { position: fixed; left: 50%; bottom: calc(var(--ticker) + 14px); translate: -50% 0; display: flex; align-items: center; gap: 10px; padding: 7px; border-radius: 18px; z-index: 6; max-width: calc(100vw - 2 * var(--pad)); }
.seg { display: flex; align-items: center; gap: 3px; }
.seg + .seg, .seg + .searchwrap, .searchwrap + .seg { border-left: 1px solid var(--edge); padding-left: 10px; }
.seg button { display: flex; align-items: center; gap: 7px; background: transparent; border: 0; border-radius: 12px; padding: 8px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s; white-space: nowrap; }
.seg button:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.seg button.on { background: rgba(39, 201, 255, .14); color: #bdeeff; box-shadow: inset 0 0 0 1px rgba(39, 201, 255, .35); }
.seg svg, .searchwrap svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.seg.small button { padding: 7px 10px; font-size: 12px; }
.seg .lbl { font-size: 11px; color: var(--ink-3); padding: 0 4px 0 2px; white-space: nowrap; }
.tour svg { fill: currentColor; stroke: none; }
.tour { position: relative; }
.tour.on { background: linear-gradient(90deg, rgba(255, 106, 61, .25), rgba(154, 56, 161, .25)) !important; color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255, 140, 100, .4) !important; }
.searchwrap { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.searchwrap input { width: 220px; background: rgba(255, 255, 255, .05); border: 1px solid var(--edge); border-radius: 11px; padding: 9px 12px; color: var(--ink); font: 500 13px var(--font); outline: none; transition: border-color .2s, background .2s; }
.searchwrap input:focus { border-color: rgba(39, 201, 255, .5); background: rgba(255, 255, 255, .08); }
.searchwrap input.nope { animation: nope .4s; border-color: var(--bad); }
@keyframes nope { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ── ticker ───────────────────────────────────────────── */
.ticker { position: fixed; left: 0; right: 0; bottom: 0; height: var(--ticker); display: flex; align-items: center; background: rgba(4, 7, 14, .82); border-top: 1px solid var(--edge); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 6; font-size: 12.5px; }
.ticker .label { display: flex; align-items: center; gap: 8px; padding: 0 14px 0 var(--pad); height: 100%; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); border-right: 1px solid var(--edge); white-space: nowrap; }
.ticker .label i { width: 7px; height: 7px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 8px var(--bad); animation: blink 1.6s infinite; }
.track { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center; mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.run { display: flex; white-space: nowrap; animation: tick linear infinite; will-change: transform; }
.track:hover .run { animation-play-state: paused; }
.run .item { padding: 0 34px 0 0; color: var(--ink-2); }
.calm { color: var(--ok); padding-left: 16px; }
@keyframes tick { to { transform: translateX(-50%); } }
#feeds { display: flex; gap: 10px; padding: 0 var(--pad) 0 14px; border-left: 1px solid var(--edge); height: 100%; align-items: center; }
.fd { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--ink-3); letter-spacing: .04em; }
.fd i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.fd.ok i { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.fd.warn i { background: var(--warn); }
.fd.bad i { background: var(--bad); box-shadow: 0 0 6px var(--bad); }

/* ── floating bits ───────────────────────────────────── */
#tip { position: fixed; left: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 7px 11px; background: var(--glass-2); border: 1px solid var(--edge-2); border-radius: 10px; font-size: 12.5px; color: var(--ink-2); pointer-events: none; z-index: 30; opacity: 0; transition: opacity .12s; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); white-space: nowrap; }
#tip.show { opacity: 1; }
#tip b { color: var(--ink); }
#focusChip { position: fixed; top: var(--pad); left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; background: var(--glass-2); border: 1px solid var(--edge-2); border-radius: 999px; font-size: 12px; color: var(--ink-2); z-index: 7; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: opacity .25s, transform .25s; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#focusChip.show { opacity: 1; transform: none; pointer-events: auto; }
#focusChip button { background: rgba(255, 255, 255, .08); border: 0; border-radius: 50%; width: 22px; height: 22px; cursor: pointer; color: var(--ink); }
#caption { position: fixed; left: 50%; top: 22%; translate: -50% 0; text-align: center; pointer-events: none; z-index: 4; opacity: 0; }
#caption b { display: block; font-size: clamp(26px, 4.4vw, 54px); font-weight: 200; letter-spacing: .04em; color: #fff; text-shadow: 0 0 40px rgba(39, 201, 255, .45), 0 2px 20px rgba(0, 0, 0, .8); }
#caption span { display: block; margin-top: 8px; font-size: 13px; letter-spacing: .28em; text-transform: uppercase; color: var(--ink-2); text-shadow: 0 2px 12px #000; }
#caption.show { animation: cap 6.5s ease forwards; }
@keyframes cap { 0% { opacity: 0; transform: translateY(12px); filter: blur(8px); } 14% { opacity: 1; transform: none; filter: none; } 72% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); filter: blur(4px); } }

#about { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2, 4, 10, .5); z-index: 40; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; padding: var(--pad); }
#about.show { opacity: 1; visibility: visible; }
#about .sheet { position: relative; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 26px 28px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); background: rgba(9, 13, 24, .88); }
#about h2 { margin: 0 0 12px; font-size: 20px; color: var(--ink); font-weight: 600; }
#about h3 { margin: 18px 0 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
#about b { color: var(--ink); }
#about .x { position: absolute; top: 14px; right: 14px; }
.keys { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
kbd { font: 600 11px var(--font); background: rgba(255, 255, 255, .08); border: 1px solid var(--edge-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--ink); }

/* ── small screens ───────────────────────────────────── */
@media (max-width: 1100px) {
  .dock .seg.small, .dock .seg button span { display: none; }
  .searchwrap input { width: 170px; }
}
@media (max-width: 760px) {
  :root { --pad: 12px; --ticker: 30px; }
  .brand h1 { font-size: 15px; }
  .brand p { display: none; }
  .logo { width: 32px; height: 32px; }
  .stats { top: 56px; width: auto; right: auto; padding: 10px 12px; }
  .stats .speed, .stats .facts { display: none; }
  .clock #clock { font-size: 18px; }
  .clock small { display: none; }
  .counts { margin: 4px 0 0; gap: 14px; }
  .counts b { font-size: 22px; }
  .counts span { font-size: 10px; }
  .lines { display: none; }
  #feeds { display: none; }
  .dock { bottom: calc(var(--ticker) + 10px + env(safe-area-inset-bottom)); gap: 4px; padding: 5px; }
  .seg + .seg, .seg + .searchwrap, .searchwrap + .seg { padding-left: 4px; }
  .searchwrap input { width: 96px; font-size: 16px; padding: 7px 9px; }
  [data-toggle="trails"] { display: none !important; }
  .searchwrap > svg { display: none; }
  .seg button { padding: 8px; }
  #card { top: auto; bottom: calc(var(--ticker) + 72px); left: var(--pad); right: var(--pad); width: auto; transform: translateY(20px); }
  #card .stops { max-height: 22vh; }
  .ticker { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--ticker) + env(safe-area-inset-bottom)); }
  .ticker .label { font-size: 0; gap: 0; padding: 0 10px; }
}
