/* Leave Home board: full-screen Google map with a floating panel */
.board-page { overflow: hidden; }
/* Google sets its own position on the map element, so a host element does the sizing */
.map-host { position: fixed; inset: 0; background: var(--surface-2); }
.map-host #map { position: relative; inset: auto; width: 100%; height: 100%; }

.sheet {
  position: fixed; top: 12px; left: 12px; bottom: 12px; width: 404px; z-index: 5;
  display: flex; flex-direction: column; gap: 10px; padding: 14px; overflow: hidden auto; overscroll-behavior: contain;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 34px rgba(16, 24, 40, .22);
}
.top { display: flex; align-items: center; gap: 12px; }
.top-text { flex: 1; min-width: 0; }
.top h1 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.top p { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
#status { color: var(--ink-3); }
#status.live { color: var(--good); font-weight: 600; }

.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 4px; vertical-align: 1px; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); } 100% { box-shadow: 0 0 0 6px transparent; } }

/* line filter */
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters button { border: 1.5px solid transparent; background: none; padding: 2px; border-radius: 999px; line-height: 0; opacity: .95; transition: opacity .12s, transform .12s; }
.filters button:hover { transform: scale(1.12); }
.filters.filtering button:not(.on) { opacity: .28; }
.filters button.on { border-color: var(--ink); }
.filters .all { font-size: 12px; font-weight: 700; line-height: 1; padding: 6px 11px; color: var(--ink-2); border-color: var(--line); background: var(--surface); }
.filters .all.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.filters .bullet { min-width: 26px; height: 26px; font-size: 13.5px; }
.filters .bus { font-size: 12.5px; padding: 6px 8px; }

/* stop cards */
.stops { display: flex; flex-direction: column; gap: 10px; }
.stop {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 10px; cursor: pointer;
  box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s, opacity .15s, transform .12s;
}
.stop:hover, .stop.hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.stop.focus { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), 0 6px 18px rgba(16, 24, 40, .14); }
.stops.has-focus .stop:not(.focus) { opacity: .62; }
.stops.has-focus .stop:not(.focus):hover { opacity: 1; }
.stop.empty { opacity: .45; }
.stop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stop header { display: flex; align-items: center; gap: 10px; }
.stop .chips { display: flex; flex-wrap: wrap; gap: 3px; max-width: 56px; padding: 0; overflow: visible; flex: none; }
.stop .where { flex: 1; min-width: 0; }
.stop h2 { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop h2 em { font-style: normal; font-weight: 400; color: var(--ink-2); font-size: 12.5px; }
.stop .where p { color: var(--ink-3); font-size: 12.5px; }

.count { text-align: right; flex: none; min-width: 84px; }
.count small { display: block; color: var(--ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.count strong { display: block; font-size: 25px; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.count.go strong { color: var(--good); }
.count.go { animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: scale(1.04); } }
.count.none strong { color: var(--ink-3); font-size: 17px; }

.target { margin-top: 6px; color: var(--ink-2); font-size: 12.5px; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.target .to { overflow: hidden; text-overflow: ellipsis; }
.target .bullet { min-width: 18px; height: 18px; font-size: 11px; flex: none; }
.target .bus { font-size: 10.5px; padding: 2px 5px; flex: none; }
.target b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* timeline: the next 30 minutes at this stop */
.tl { position: relative; margin-top: 10px; height: 76px; }
.tl-track { position: absolute; left: 0; right: 0; top: 0; height: 58px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.tl-zone {
  position: absolute; left: 0; top: 0; bottom: 0; border-right: 2px solid var(--good);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink-3) 16%, transparent) 0 5px, transparent 5px 10px);
  transition: width .25s;
}
.tl-zone span { position: absolute; left: 6px; bottom: 3px; font-size: 9.5px; overflow: hidden; max-width: calc(100% - 8px); font-weight: 700; color: var(--ink-3); white-space: nowrap; letter-spacing: .03em; }
.tl-chips { position: absolute; left: 0; right: 0; top: 0; height: 58px; overflow: clip; overflow-clip-margin: 6px; }
.tl-chip {
  position: absolute; top: calc(5px + var(--lane, 0) * 15px); transform: translateX(-50%); border: 0; padding: 0; background: none; line-height: 0;
  transition: left 1s linear, opacity .2s, filter .2s; z-index: 1;
}
.tl-chip .bullet { min-width: 20px; height: 20px; font-size: 11.5px; box-shadow: 0 0 0 1.5px var(--surface-2); }
.tl-chip .bus { font-size: 10.5px; padding: 3px 5px; box-shadow: 0 0 0 1.5px var(--surface-2); }
.tl-chip.sched > * { outline: 1.5px dashed color-mix(in srgb, var(--ink) 45%, transparent); outline-offset: 1px; }
.tl-chip.late { opacity: .32; filter: grayscale(.7); }
.tl-chip.off { opacity: 0; pointer-events: none; }
.tl-chip.yours { z-index: 3; }
.tl-chip.yours > * { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--good); }
.tl-chip:hover, .tl-chip.hot { z-index: 4; opacity: 1; filter: none; }
.tl-chip:hover > *, .tl-chip.hot > * { transform: scale(1.25); }
.tl-chip > * { transition: transform .1s; }
.tl-axis { position: absolute; left: 0; right: 0; top: 61px; height: 14px; font-size: 10.5px; white-space: nowrap; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-axis span:first-child { transform: none; }
.tl-axis span:last-child { transform: translateX(-100%); }

/* departure list, shown on the focused stop */
.deps { list-style: none; margin: 4px 0 0; padding: 6px 0 0; border-top: 1px solid var(--line); display: none; }
.stop.focus .deps { display: block; }
.deps li { display: grid; grid-template-columns: 40px 1fr auto 92px; gap: 8px; align-items: center; padding: 5px 6px; margin: 0 -6px; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
.deps li:hover, .deps li.hot { background: var(--accent-soft); }
.deps li.yours { color: var(--ink); font-weight: 600; }
.deps li.late { opacity: .45; }
.deps .to { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.deps .dep, .deps .lv { font-variant-numeric: tabular-nums; white-space: nowrap; }
.deps .lv { text-align: right; color: var(--good); }
.deps li.late .lv { color: var(--ink-3); }
.deps .bullet { min-width: 20px; height: 20px; font-size: 11.5px; justify-self: start; }
.deps .bus { font-size: 11px; padding: 2px 5px; justify-self: start; }

.settings { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 2px; }
.buffer { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12.5px; }
.buffer select { width: auto; padding: 5px 8px; }
.sheet .foot { padding: 0 2px; }

/* map chrome */
.map-ui { position: fixed; top: 12px; right: 12px; z-index: 4; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.map-ui .btn { box-shadow: 0 2px 8px rgba(16, 24, 40, .2); }
.legend { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 2px 8px rgba(16, 24, 40, .2); }
.legend span { display: flex; align-items: center; gap: 7px; }
.lg { width: 12px; height: 12px; border-radius: 50%; background: #0039a6; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.lg.yours { box-shadow: 0 0 0 2px var(--good); }
.lg.late { opacity: .35; }
.map-note { position: fixed; left: 428px; right: 12px; bottom: 12px; z-index: 4; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; color: var(--ink-2); box-shadow: 0 2px 8px rgba(16, 24, 40, .2); max-width: 560px; }

/* ---- things drawn on the map (Google advanced markers anchor at bottom-centre) ---- */
.mk-home { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #14171c; color: #fff; border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); transform: translateY(50%); }
.mk-home svg { width: 17px; height: 17px; }

.mk-stop { display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: opacity .15s, transform .12s; transform-origin: bottom center; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.mk-stop .pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; background: #fff; color: #14171c; border: 1px solid rgba(0, 0, 0, .18); border-radius: 999px; padding: 3px 10px 3px 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); font-weight: 700; font-size: 12.5px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.mk-stop .pill .chips { display: inline-flex; gap: 2px; padding: 0; overflow: visible; }
.mk-stop .bullet { min-width: 18px; height: 18px; font-size: 11px; }
.mk-stop .bus { font-size: 10.5px; padding: 2px 4px; }
.mk-stop .dir { color: #7b8394; font-weight: 400; font-size: 11.5px; }
.mk-stop .stem { width: 2px; height: 9px; background: #14171c; }
.mk-stop .dot { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 3px solid var(--c, #14171c); margin-bottom: -5px; }
.mk-stop.go .pill { background: #0a7d43; color: #fff; border-color: #0a7d43; }
.mk-stop.go .dir { color: #cfeedd; }
.mk-stop.focus .pill { box-shadow: 0 0 0 2.5px #0039a6, 0 2px 8px rgba(0, 0, 0, .3); }
.mk-stop:hover, .mk-stop.hover { transform: scale(1.08); }
.mk-stop.dim { opacity: .4; }
.mk-stop.second .stem { height: 40px; } /* second platform at the same station sits higher */

.mk-veh { transform: translateY(50%); display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: opacity .2s, filter .2s; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.mk-veh .body { position: relative; display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; background: var(--c, #555); color: var(--t, #fff); font-weight: 700; font-size: 11px; line-height: 1; white-space: nowrap; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .55); transition: transform .15s; }
.mk-veh.subway .body { border-radius: 50%; padding: 0; width: 24px; }
.mk-veh.bus .body { border-radius: 6px; }
.mk-veh .eta { position: absolute; top: 100%; margin-top: 2px; background: rgba(20, 23, 28, .88); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1; padding: 2px 5px; border-radius: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mk-veh.sched .body { border-style: dashed; }
.mk-veh.late { opacity: .38; filter: grayscale(.6); }
.mk-veh.late .eta { display: none; }
.mk-veh.yours .body { transform: scale(1.3); box-shadow: 0 0 0 3px #0a7d43, 0 2px 8px rgba(0, 0, 0, .5); }
.mk-veh.yours .eta { background: #0a7d43; margin-top: 7px; font-size: 11.5px; }
.mk-veh.yours .body::after { content: ""; position: absolute; inset: -7px; border-radius: inherit; border: 2px solid #0a7d43; animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { opacity: .8; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.4); } }
.mk-veh.hot { opacity: 1; filter: none; }
.mk-veh.hot .body { transform: scale(1.4); }
.mk-veh.hot .eta { display: block; }
.mk-veh.dim { opacity: .14; }
.mk-veh.dim .eta { display: none; }
.mk-veh.hidden, .mk-stop.hidden { display: none; }
@media (prefers-reduced-motion: reduce) { .live-dot, .count.go, .mk-veh.yours .body::after { animation: none; } .tl-chip { transition: none; } }

@media (max-width: 820px) {
  .board-page { overflow: auto; }
  .map-host { position: sticky; top: 0; height: 46vh; inset: auto; width: 100%; z-index: 1; }
  .sheet { position: relative; inset: auto; width: auto; margin: -14px 0 0; border-radius: 18px 18px 0 0; border-width: 1px 0 0; overflow: visible; z-index: 2; backdrop-filter: none; background: var(--bg); }
  .map-ui { position: absolute; top: 8px; right: 8px; }
  .legend { display: none; }
  .map-note { position: absolute; left: 8px; right: 150px; top: 8px; bottom: auto; font-size: 11.5px; padding: 6px 9px; }
}

.map-note .link { margin-left: 6px; }
.map-host .leaflet-container { background: var(--surface-2); }
.stop .where p em { font-style: normal; color: var(--ink-2); font-weight: 600; }

/* next departure + the one after */
.count .then { display: block; font-style: normal; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: 1px; }
.target { display: block; white-space: normal; }
.tg { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; padding: 1px 0; }
.tg .to { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tg .by { flex: none; color: var(--good); font-weight: 600; font-variant-numeric: tabular-nums; }
.tg .sch { color: var(--ink-3); }
.tg .lbl { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.tg.after { opacity: .78; }
.tg.after .by { color: var(--ink-2); font-weight: 400; }
.tl-chip.next2 { z-index: 2; }
.tl-chip.next2 > * { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--good) 55%, transparent); }
.deps li.next2 { color: var(--ink); }
.lg.next2 { box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 50%, transparent); }
.mk-stop .then { color: #7b8394; font-weight: 600; font-size: 11.5px; }
.mk-stop .then:empty { display: none; }
.mk-stop.go .then { color: #cfeedd; }
.mk-veh.next2 .body { transform: scale(1.12); box-shadow: 0 0 0 2.5px rgba(10, 125, 67, .55), 0 1px 5px rgba(0, 0, 0, .5); }
.mk-veh.next2 .eta { background: rgba(10, 125, 67, .8); margin-top: 5px; }
.count .then { white-space: nowrap; }
.lg.wait { border-style: dashed; border-color: #0039a6; background: #fff; }
.mk-veh.sched .body { opacity: .85; }

/* bus stops on the map are just a dot: the moving buses carry the minutes */
.mk-stop.bus .pill, .mk-stop.bus .stem { display: none; }
.mk-stop.bus .dot { width: 15px; height: 15px; border-width: 4px; margin-bottom: -7px; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.mk-stop.bus.focus .dot, .mk-stop.bus.hover .dot { box-shadow: 0 0 0 3px #0039a6, 0 1px 4px rgba(0, 0, 0, .45); }
.tg .by { max-width: 60%; overflow: hidden; text-overflow: ellipsis; }

/* subway: next three trains per line */
.by-line { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
.by-line thead th { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding: 0 6px 3px; }
.by-line tbody th { width: 30px; padding: 3px 0; text-align: left; }
.by-line td { padding: 4px 6px; border-top: 1px solid var(--line); border-radius: 0; cursor: pointer; line-height: 1.2; }
.by-line td b { font-size: 14px; font-weight: 700; }
.by-line td small { display: block; font-size: 11px; color: var(--good); }
.by-line td i { font-style: normal; font-size: 10px; color: var(--ink-3); margin-left: 4px; }
.by-line td:hover { background: var(--accent-soft); }
.by-line td.yours { background: var(--good-soft); }
.by-line td.none { color: var(--ink-3); cursor: default; }
.by-line .bullet { min-width: 22px; height: 22px; font-size: 12.5px; }

/* every stop on the map is just a dot; the panel and the moving vehicles carry the times */
.mk-stop .pill, .mk-stop .stem { display: none; }
.mk-stop .dot { width: 15px; height: 15px; border-width: 4px; margin-bottom: -7px; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.mk-stop.focus .dot, .mk-stop.hover .dot { box-shadow: 0 0 0 3px #0039a6, 0 1px 4px rgba(0, 0, 0, .45); }

/* pointers to vehicles that are off the visible map */
.edges { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.edge { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; background: #14171c; color: #fff; border: 2px solid #fff; border-radius: 999px; padding: 3px 9px 3px 7px; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); font: 700 12px/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif; font-variant-numeric: tabular-nums; transition: left .2s linear, top .2s linear; }
.edge:hover { background: #0039a6; }
.edge .arrow { display: inline-block; font-size: 11px; line-height: 1; }
.edge .bullet { min-width: 18px; height: 18px; font-size: 11px; }
.edge .bus { font-size: 10.5px; padding: 2px 4px; }
@media (max-width: 820px) { .edges { position: absolute; height: 46vh; inset: 0 0 auto 0; z-index: 2; } }

/* buses on your routes that aren't heading to your stop: no countdown, a little smaller */
.mk-veh.other { cursor: default; }
.mk-veh.other .body { transform: scale(.9); }
.mk-veh.other .eta { display: none !important; }
/* which way a bus is heading: a small arrow orbiting its badge */
.mk-veh .hd { position: absolute; left: 50%; top: 12px; width: 0; height: 0; pointer-events: none; transform: rotate(var(--h, 0deg)); }
.mk-veh .hd::before { content: ""; position: absolute; left: -7px; top: -29px; border: 7px solid transparent; border-top-width: 0; border-bottom: 11px solid var(--c, #333); filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 1.5px #fff) drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.mk-veh.yours .hd::before { top: -34px; }
.mk-veh[data-nohd] .hd, .mk-veh.late .hd { display: none; }

/* trains: larger badges so they stand out against the map */
.mk-veh.subway .body { width: 34px; min-width: 34px; height: 34px; font-size: 16px; border-width: 2.5px; box-shadow: 0 2px 7px rgba(0, 0, 0, .6); }
.mk-veh.subway .eta { font-size: 11.5px; }
.mk-veh.subway.late { opacity: .85; filter: grayscale(.45); }
.mk-veh.subway .hd { top: 17px; }
.mk-veh.subway .hd::before { top: -36px; left: -8px; border-width: 0 8px 13px; border-bottom-color: #14171c; }
.mk-veh.subway.yours .hd::before { top: -41px; }
.mk-veh.subway.late .hd { display: block; }
.mk-veh.subway[data-nohd] .hd { display: none; }
/* every train says how far it is from the station, including ones too close to catch */
.mk-veh.subway.late .eta { display: block; }
.mk-veh.subway.late.dim .eta { display: none; }

/* ---------- arrivals panel: next three per route ---------- */
.arr-group { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 6px; }
.arr-group + .arr-group { margin-top: 12px; }
.arr-group h2 { margin: 0 0 4px; font-size: 15px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.arr-group h2 span { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.arr { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.arr tr + tr th, .arr tr + tr td { border-top: 1px solid var(--line); }
.arr th { width: 46%; padding: 8px 0; text-align: left; font-weight: 500; }
.arr th > * { vertical-align: middle; }
.arr th .dir { display: inline-block; margin-left: 8px; font-size: 13px; line-height: 1.2; max-width: calc(100% - 52px); }
.arr th .dir small { display: block; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arr td { padding: 6px 6px; line-height: 1.15; border-radius: 6px; }
.arr td b { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; }
.arr td small { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.arr td:first-of-type b { color: var(--good); }
.arr td.late b, .arr td.late:first-of-type b { color: var(--ink-3); font-weight: 600; }
.arr td.sched b { font-weight: 500; }
.arr td.hot, .arr td[data-vid]:hover { background: var(--accent-soft); }
.arr td.none { color: var(--ink-3); }
.arr .bullet { min-width: 24px; height: 24px; font-size: 13.5px; }
/* a vehicle that has already called at your stop is heading away: no timer */
.mk-veh.past .eta, .mk-veh.subway.late.past .eta { display: none; }

/* page tabs */
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; flex: none; }
.tabs a { flex: 1; text-align: center; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
