* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: system-ui, sans-serif; }
body { display: flex; }
#panel { width: 320px; padding: 16px; overflow-y: auto; background: #fff; z-index: 1000; box-shadow: 2px 0 8px rgba(0,0,0,.15); }
#panelWrap { position: relative; display: flex; flex: none; z-index: 1100; }
#panelWrap.collapsed #panel { display: none; }
#panelToggle { position: absolute; left: calc(100% + 10px); top: 128px; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 6px; background: #fff; color: #333; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
#panelToggle:hover { background: #f4f5f5; }
#panelToggle:focus-visible { outline: 2px solid #6f42c1; outline-offset: 2px; }
#panelWrap.collapsed #panelToggle span { display: inline-block; transform: rotate(180deg); }
#map { flex: 1; background: #f1f2f2; }
/* Map controls and attribution, in the soft white style of the grey basemap. */
.leaflet-bar { border: 0; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.25); overflow: hidden; }
.leaflet-bar a, .leaflet-bar a:hover { color: #333; border-bottom-color: #e3e5e6; }
.leaflet-bar a:hover { background: #f4f5f5; }
.leaflet-control-attribution { background: rgba(255,255,255,.75) !important; color: #555; font-size: 11px; }
.leaflet-container { font-family: system-ui, sans-serif; }
h1 { font-size: 1.25rem; margin: 0 0 4px; }
.sub { color: #555; font-size: .9rem; margin: 0 0 12px; }
#search { width: 100%; padding: 10px; font-size: 1rem; border: 1px solid #bbb; border-radius: 6px; }
.searchbox { position: relative; }
#suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 2000; background: #fff; border: 1px solid #bbb; border-radius: 6px; margin-top: 4px; max-height: 320px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
#suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; font: inherit; border-bottom: 1px solid #eee; }
#suggest button:hover, #suggest button:focus { background: #f1ecfa; }
#suggest button span { display: block; font-size: .8rem; color: #555; }
#suggest .group { padding: 6px 10px; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; background: #f7f7f7; color: #555; }
#chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { display: inline-flex; align-items: stretch; border-radius: 16px; color: #fff; font-weight: 600; font-size: .95rem; overflow: hidden; }
.chip button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px; }
.chip button:hover, .chip button:focus-visible { background: rgba(255,255,255,.18); }
.chip .star { padding-right: 4px; }
.chip .chip-label { padding-left: 4px; }
.chip small { font-weight: 400; opacity: .9; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .8rem; color: #333; margin: 12px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; border: 1px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.early { background: #3b82f6; } .ontime { background: #1a9850; } .late { background: #f5a300; } .vlate { background: #d7191c; } .unknown { background: #999; }
#status { font-size: .85rem; color: #555; }
#demoBanner { background: #fff3cd; padding: 6px 10px; border-radius: 6px; font-size: .85rem; margin-bottom: 10px; }
.bus { position: absolute; }   /* Leaflet places marker icons absolutely; "relative" shifted buses off their true spot, more so when zoomed out */
.bus .badge { display: flex; align-items: center; justify-content: center; min-width: 42px; height: 30px; padding: 0 8px; box-sizing: border-box; border-radius: 12px; color: #fff; font-weight: 700; font-size: 13px; border: 2px solid #fff; box-shadow: inset 0 0 0 3px var(--status, #999), inset 0 0 0 4px #fff, 0 1px 4px rgba(0,0,0,.5); }   /* status ring, then a thin white line, between the white border and the route colour */
.bus .badge.early { --status: #3b82f6; } .bus .badge.ontime { --status: #1a9850; } .bus .badge.late { --status: #f5a300; } .bus .badge.vlate { --status: #d7191c; } .bus .badge.unknown { --status: #999; }
.bus .heading { position: absolute; z-index: 2; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.bus .heading[hidden] { display: none; }
.bus .heading svg { position: absolute; left: -6px; top: -36px; overflow: visible; }
.bus .heading polygon { fill: #000; stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; }
@media (max-width: 700px) {
    body { flex-direction: column-reverse; }
    #panelWrap { width: 100%; }
    #panel { width: 100%; max-height: 40vh; }
    #panelToggle { left: auto; right: 14px; top: auto; bottom: calc(100% + 34px + env(safe-area-inset-bottom, 0px)); width: 48px; height: 48px; font-size: 26px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.35); }   /* big, up off the screen edge and over to the right, within easy reach of a thumb (clear of the attribution line) */
    #panelToggle span { display: inline-block; transform: rotate(-90deg); }
    #panelWrap.collapsed #panelToggle span { transform: rotate(90deg); }
}

.stop-popup h3 { margin: 0 0 6px; font-size: 1rem; }
.stop-popup table { border-collapse: collapse; width: 100%; }
.stop-popup td { padding: 4px 6px 4px 0; vertical-align: top; border-bottom: 1px solid #eee; font-size: .85rem; }
.stop-popup td small { display: block; color: #666; font-size: .72rem; }
.stop-popup .ln { font-weight: 700; white-space: nowrap; }
.stop-popup .when { text-align: right; white-space: nowrap; }
.stop-popup .when .dot { margin-right: 5px; }
.stop-popup tr.sel .ln { color: #6f42c1; }
.stop-popup .muted { color: #666; font-size: .75rem; margin: 6px 0 0; }
.chip.stop { background: #444; }
/* Long lists scroll inside the popup instead of growing past the map. */
.stop-popup .deps { max-height: 330px; overflow-y: auto; }

#nearMe { width: 100%; margin-top: 8px; padding: 9px 10px; font: inherit; font-weight: 600; color: #4a2c8f; background: #f1ecfa; border: 1px solid #d6c9f0; border-radius: 6px; cursor: pointer; }
#nearMe:hover:not(:disabled) { background: #e6ddf6; }
#nearMe:disabled { opacity: .6; cursor: progress; }
#nearby { margin-top: 8px; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; font-size: .85rem; }
#nearby .msg { padding: 10px; color: #444; }
#nearby .msg.error { color: #8a1c1c; background: #fdecec; }
#nearby .head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: #f7f7f7; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #555; }
#nearby .head button { border: 0; background: none; cursor: pointer; color: #555; font: inherit; text-transform: none; }
#nearby .row { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid #eee; background: #fff; padding: 8px 10px; cursor: pointer; font: inherit; }
#nearby .row:hover, #nearby .row:focus { background: #f1ecfa; }
#nearby .row span { display: block; font-size: .78rem; color: #555; }
#nearby .row .dist { color: #4a2c8f; font-weight: 600; }
.me-dot { position: relative; width: 22px; height: 22px; }
.me-dot .dot { position: absolute; left: 4px; top: 4px; width: 14px; height: 14px; box-sizing: border-box; background: #1a73e8; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.me-dot .pulse { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: rgba(26,115,232,.45); animation: me-pulse 2s ease-out infinite; }
@keyframes me-pulse { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .me-dot .pulse { animation: none; transform: scale(1.3); opacity: .35; } }
.locate-control a { display: flex; align-items: center; justify-content: center; color: #1a73e8; }

.star { background: none; border: 0; cursor: pointer; font-size: 1.1rem; line-height: 1; color: #b58900; padding: 2px 4px; }
.star[aria-pressed="true"] { color: #f5a300; }
.chip .star { color: #fff; }
.stop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stop-head h3 { margin: 0 0 6px; }
#favourites { margin-top: 8px; border: 1px solid #e6d9a8; border-radius: 6px; overflow: hidden; font-size: .85rem; background: #fffdf4; }
#favourites .head { padding: 6px 10px; background: #fbf3d4; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #6b5600; }
.fav-row { display: flex; align-items: stretch; border-top: 1px solid #f0e8c4; }
.fav-row.on { background: #f1ecfa; }
.fav-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; font: inherit; }
.fav-main:hover, .fav-main:focus-visible { background: rgba(111,66,193,.08); }
.fav-main .sub { display: block; font-size: .78rem; color: #555; }
.fav-del { border: 0; background: none; cursor: pointer; color: #777; padding: 0 10px; font-size: .9rem; }
.fav-del:hover, .fav-del:focus-visible { color: #b00020; }
#favourites .note { margin: 0; padding: 8px 10px; font-size: .78rem; color: #6b5600; border-top: 1px solid #f0e8c4; }

/* Bus popup: how old the position is. Turns amber when the bus has not reported for a while. */
.leaflet-popup .ago { font-size: .85em; color: #555; }
.leaflet-popup .ago.stale { color: #b45309; font-weight: 600; }
.plan-button { display: block; margin: 12px 0 0; padding: 10px 14px; border-radius: 8px; background: #6f42c1; color: #fff; font-weight: 600; font-size: .95rem; text-align: center; text-decoration: none; }
.plan-button:hover { background: #5e35a8; }
.plan-button:focus-visible, .stats-links a:focus-visible { outline: 3px solid #8e44ec; outline-offset: 2px; }
.stats-links { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: .9rem; }
.stats-links a { color: #6f42c1; font-weight: 600; text-decoration: none; }
.stats-links a:hover { text-decoration: underline; }
.bus-link { color: #6f42c1; font-weight: 600; text-decoration: none; }
.bus-link:hover { text-decoration: underline; }

/* Disruption notices on the map panel and stop cards. Colour always goes with a text label. */
#disruptions { margin: 12px 0; padding: 10px 12px; background: #fff8e6; border: 1px solid #f0d58a; border-radius: 8px; }
#disruptions .head { font-weight: 700; font-size: .9rem; margin-bottom: 6px; } #disruptionCount { color: #5b626a; font-weight: 400; }
.mapnotice { border-left: 5px solid #8b9097; background: #fff; border-radius: 6px; padding: 6px 8px; margin: 6px 0; font-size: .86rem; }
.mapnotice.sev-major { border-left-color: #d7191c; } .mapnotice.sev-moderate { border-left-color: #f5a300; } .mapnotice.sev-minor { border-left-color: #3b82f6; }
.mapnotice summary { cursor: pointer; line-height: 1.35; }
.mapnotice .n-sev { display: inline-block; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 0 6px; border-radius: 8px; color: #fff; background: #8b9097; vertical-align: 1px; }
.mapnotice.sev-major .n-sev { background: #d7191c; } .mapnotice.sev-moderate .n-sev { background: #f5a300; color: #3d2a00; } .mapnotice.sev-minor .n-sev { background: #3b82f6; }
.mapnotice p { margin: 5px 0; } .mapnotice .n-meta { color: #5b626a; font-size: .8rem; }
.mapnotice .n-lines { display: flex; flex-wrap: wrap; gap: 4px; }
.mapnotice .n-line { padding: 1px 8px; border-radius: 10px; background: #6f42c1; color: #fff; font-weight: 700; font-size: .8rem; }
.mapnotice .n-show { font: inherit; font-size: .82rem; color: #6f42c1; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.mapnotice a { color: #6f42c1; font-weight: 600; }
.stop-notice { display: block; margin: 0 0 6px; padding: 4px 8px; border-left: 5px solid #8b9097; background: #fff8e6; border-radius: 4px; font-size: .82rem; color: #1f2328; text-decoration: none; }
.stop-notice.sev-major { border-left-color: #d7191c; } .stop-notice.sev-moderate { border-left-color: #f5a300; } .stop-notice.sev-minor { border-left-color: #3b82f6; }
.stop-notice strong { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }

/* Side-by-side route lines toggle */
.lane-toggle { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 12px; cursor: pointer; font-size: .92rem; line-height: 1.3; }
.lane-toggle input { margin-top: 3px; }
.lane-toggle small { display: block; color: #666; font-size: .8rem; }

/* ---- Buses / Trains / Both ---- */
.mode-switch { display: flex; gap: 0; margin: 0 0 12px; border: 1px solid #bbb; border-radius: 8px; overflow: hidden; }
.mode-switch button { flex: 1; padding: 8px 4px; border: 0; background: #fff; font: inherit; font-size: .9rem; cursor: pointer; }
.mode-switch button + button { border-left: 1px solid #bbb; }
.mode-switch button[aria-pressed="true"] { background: #1f3a5f; color: #fff; }
.mode-switch button:focus-visible { outline: 3px solid #8e44ec; outline-offset: -3px; }
body.mode-trains .bus-only { display: none !important; }
body.mode-buses .train-only { display: none !important; }
/* Trains only: hide everything the bus layer draws (markers, route lines, popups); the train panes below are separate. */
body.mode-trains #map .leaflet-marker-pane, body.mode-trains #map .leaflet-overlay-pane, body.mode-trains #map .leaflet-routes-pane,
body.mode-trains #map .leaflet-shadow-pane { display: none; }
body.mode-buses #map .leaflet-trainLines-pane, body.mode-buses #map .leaflet-trains-pane, body.mode-buses #map .leaflet-stations-pane { display: none; }
#liveStatus { font-size: .9rem; margin: 0 0 12px; color: #333; }
#liveStatus.warn { color: #8a4b00; font-weight: 600; }
.train-icon { display: flex; align-items: center; justify-content: center; width: 38px; height: 22px; border-radius: 11px; border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,.35); color: #fff; font: 700 11px/1 system-ui, sans-serif; text-shadow: 0 0 2px rgba(0,0,0,.6); }
/* The body is the line's colour (Merseyrail's own map: Wirral green, Northern blue). The status ring is drawn the way the bus badge's
   is: a ring in the delay colour, then a thin white line, inside the white border. */
.train-icon { position: relative; box-sizing: border-box; width: 52px; height: 28px; border-radius: 12px;
    box-shadow: inset 0 0 0 3px var(--status, #999), inset 0 0 0 4px #fff, 0 1px 4px rgba(0,0,0,.5); }
.train-icon.line-wirral { background: #03a749; } .train-icon.line-northern { background: #0070b9; }
.train-icon.line-unknown { background: #1f3a5f; } .train-icon.cancelled { background: #555; text-decoration: line-through; }
.train-icon.early { --status: #3b82f6; } .train-icon.ontime { --status: #1a9850; } .train-icon.late { --status: #f5a300; }
.train-icon.vlate { --status: #d7191c; } .train-icon.unknown { --status: #999; }
/* The heading arrow is the bus's (a black arrow just outside the badge, rotated to the compass bearing), set further out for the wider icon. */
.train-icon .heading { position: absolute; z-index: 2; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.train-icon .heading[hidden] { display: none; }
.train-icon .heading svg { position: absolute; left: -6px; top: -40px; overflow: visible; }
.train-icon .heading polygon { fill: #000; stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; text-shadow: none; }
.ferry-icon { position: relative; box-sizing: border-box; width: 34px; height: 34px; border-radius: 50%; background: #0b7285; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
    display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; }
.ferry-terminal-icon { box-sizing: border-box; width: 28px; height: 28px; border-radius: 6px; background: #fff; border: 2px solid #0b7285; color: #0b7285;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; }
.ferry-popup .board td.w { text-align: right; white-space: nowrap; }
.ferry-popup .cruise { display: inline-block; background: #e3f4f7; color: #0b7285; border-radius: 3px; padding: 0 5px; font-size: .75rem; }
.ferry-popup small { font-weight: 400; color: #666; font-size: .75rem; }
.ferry-icon.stale { background: #7a8793; }
.ferry-icon .heading { position: absolute; z-index: 2; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.ferry-icon .heading svg { position: absolute; left: -6px; top: -34px; overflow: visible; }
.ferry-icon .heading polygon { fill: #000; stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; }
.train-popup h3 { margin: 0 0 4px; font-size: 1rem; }
.train-popup .row { font-size: .88rem; margin: 2px 0; }
.train-popup .note { color: #666; font-size: .78rem; margin-top: 6px; }
.station-popup .board { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 4px 0; }
.station-popup .board th { text-align: left; font-weight: 600; color: #555; border-bottom: 1px solid #ddd; padding: 2px 4px; }
.station-popup .board td { padding: 3px 4px; border-bottom: 1px solid #eee; vertical-align: top; }
.station-popup .board td:nth-child(2) { min-width: 130px; }
.station-popup .board td.t { white-space: nowrap; }
.station-popup .board td.p { text-align: center; }
.station-popup .board td.s { white-space: nowrap; }
.station-popup .board small { display: block; color: #666; font-size: .75rem; }
.station-popup h4 { margin: 0 0 6px; font-size: .9rem; color: #1f3a5f; }
/* Two columns: departures on the left, a buses panel that slides out on the right. Both parts keep a fixed width so Leaflet can size the popup. */
.station-popup .sp-wrap { display: flex; align-items: flex-start; white-space: normal; }
.station-popup .sp-main { flex: 0 0 360px; width: 360px; min-width: 0; }
.station-popup .deps { max-height: 330px; overflow-y: auto; }
.station-popup .sp-side { flex: 0 0 290px; width: 290px; margin-left: 14px; padding-left: 14px; border-left: 1px solid #ddd; overflow: hidden; }
.station-popup .sp-side[hidden] { display: none; }
.station-popup .sp-side-inner { max-height: 380px; overflow-y: auto; transition: transform .24s ease, opacity .24s ease; }
.station-popup .sp-wrap.sliding .sp-side-inner { transform: translateX(-32px); opacity: 0; }
.station-popup .sp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.station-popup .sp-head h3 { margin: 0 0 4px; }
.station-popup .sp-toggle { flex: none; display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: .78rem; color: #1f3a5f; background: #eef2fb;
    border: 1px solid #c9d3ea; border-radius: 14px; padding: 3px 9px 3px 10px; cursor: pointer; white-space: nowrap; }
.station-popup .sp-toggle:hover { background: #e2e9f8; }
.station-popup .sp-toggle:focus-visible { outline: 3px solid #8e44ec; outline-offset: 1px; }
.station-popup .sp-toggle .chev { font-size: 1.1rem; line-height: 1; margin-top: -1px; }
.station-popup .sp-toggle[aria-expanded="true"] { background: #1f3a5f; color: #fff; border-color: #1f3a5f; }
@media (max-width: 700px) {
    /* Too narrow for two columns: the panel opens underneath instead. */
    .station-popup .sp-wrap { flex-direction: column; }
    .station-popup .sp-main { flex-basis: auto; width: 100%; }
    .station-popup .deps { max-height: 190px; }
    .station-popup .sp-side { flex-basis: auto; width: 100%; margin: 8px 0 0; padding: 8px 0 0; border-left: 0; border-top: 1px solid #ddd; }
    .station-popup .sp-wrap.sliding .sp-side-inner { transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) { .station-popup .sp-side-inner { transition: none; } }
.station-popup .busstop { display: block; width: 100%; text-align: left; font: inherit; font-size: .85rem; background: #f7f8fa; border: 1px solid #e1e4ea;
    border-radius: 6px; padding: 6px 8px; margin: 0 0 6px; cursor: pointer; }
.station-popup .busstop:hover, .station-popup .busstop:focus-visible { background: #eef2fb; border-color: #8e44ec; outline: none; }
.station-popup .bs-name { display: block; font-weight: 600; }
.station-popup .bs-name small { display: block; font-weight: 400; color: #666; font-size: .75rem; }
.station-popup .bs-lines em { display: inline-block; font-style: normal; font-size: .72rem; font-weight: 700; background: #8e44ec; color: #fff; border-radius: 4px; padding: 0 5px; margin: 3px 3px 0 0; }
.station-popup .bs-next { display: block; margin-top: 3px; color: #333; }
.station-popup .bn { display: block; font-size: .8rem; }
.station-popup .bn.none { color: #777; }

/* ---- Trains nearby, inside a bus stop's popup ---- */
@media (min-width: 701px) { .stop-popup.with-side .sp-main { flex-basis: 280px; width: 280px; } }
.stop-popup.with-side .sp-toggle[hidden] { display: none; }
.stop-popup.with-side .stop-head { gap: 6px; }
.stop-popup.with-side .stop-head h3 { margin-right: auto; }
.stop-popup .tn-station { display: block; width: 100%; text-align: left; font: inherit; font-size: .88rem; font-weight: 600; background: #eef2fb; border: 1px solid #c9d3ea;
    border-radius: 6px; padding: 4px 8px; margin: 6px 0 2px; cursor: pointer; color: #1f3a5f; }
.stop-popup .tn-station:hover, .stop-popup .tn-station:focus-visible { background: #e2e9f8; border-color: #8e44ec; outline: none; }
.stop-popup .tn-station small { font-weight: 400; color: #555; margin-left: 6px; font-size: .75rem; }
.stop-popup .tn-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.stop-popup .tn-table td { padding: 3px 4px; border-bottom: 1px solid #eee; vertical-align: top; }
.stop-popup .tn-table td.t { white-space: nowrap; width: 5.2em; }
.stop-popup .tn-table td small { display: block; color: #555; }
.stop-popup .tn-table td.none { color: #777; }
.stop-popup .sp-side .note { color: #666; font-size: .75rem; margin: 4px 0 0; }

/* ---- Small screens: stop and station popups fill the screen as a card (assets/sheet.js moves them out of the map and adds .sheet) ---- */
.leaflet-popup.sheet {
    position: fixed !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;
    width: auto !important; margin: 0 !important; transform: none !important; opacity: 1;
    z-index: 3000; pointer-events: auto; display: flex; flex-direction: column; background: #fff; color: #222;
    font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-align: left;
}
.leaflet-popup.sheet .leaflet-popup-tip-container { display: none; }
.leaflet-popup.sheet .leaflet-popup-content-wrapper { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 0; box-shadow: none; padding: 0; background: #fff; }
.leaflet-popup.sheet .leaflet-popup-content { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; width: auto !important; height: auto !important; max-height: none !important; overflow: hidden; line-height: 1.4; font-size: 1rem; }
.leaflet-popup.sheet a.leaflet-popup-close-button {
    position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; left: auto; z-index: 2; width: 44px; height: 44px; padding: 0;
    font: 30px/44px system-ui, sans-serif; text-align: center; color: #222; background: #eef0f4; border-radius: 50%;
}
.leaflet-popup.sheet h3 { font-size: 1.25rem; }
/* Each page scrolls on its own; the header keeps clear of the close button. */
.leaflet-popup.sheet .stop-popup, .leaflet-popup.sheet .station-popup { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.leaflet-popup.sheet .stop-popup:not(.with-side) { display: block; overflow-y: auto; padding: calc(14px + env(safe-area-inset-top)) 16px 16px; }
.leaflet-popup.sheet .stop-head, .leaflet-popup.sheet .sp-head { padding-right: 52px; }
.leaflet-popup.sheet .sp-wrap { flex: 1; min-height: 0; width: 100%; flex-direction: row; align-items: stretch; transition: transform .24s ease; }
.leaflet-popup.sheet .sp-wrap.open:not(.sliding) { transform: translateX(-100%); }
.leaflet-popup.sheet .sp-main, .leaflet-popup.sheet .sp-side {
    flex: 0 0 100%; width: 100%; box-sizing: border-box; margin: 0; border: 0; overflow-x: hidden; overflow-y: auto;
    padding: calc(14px + env(safe-area-inset-top)) 16px 16px;
}
.leaflet-popup.sheet .sp-side-inner { max-height: none; overflow: visible; transform: none !important; opacity: 1 !important; transition: none; }
.leaflet-popup.sheet .deps { max-height: none; overflow: visible; }
.leaflet-popup.sheet .sp-toggle { display: none; }   /* the tabs at the bottom (and swiping) replace it */
.leaflet-popup.sheet .sheet-tabs { flex: none; display: flex; border-top: 1px solid #ddd; background: #f7f8fa; padding-bottom: env(safe-area-inset-bottom); }
.leaflet-popup.sheet .sheet-tabs[hidden] { display: none; }
.leaflet-popup.sheet .sheet-tabs button {
    flex: 1; min-height: 52px; font: inherit; font-weight: 600; color: #555; background: none; border: 0; border-top: 3px solid transparent; cursor: pointer;
}
.leaflet-popup.sheet .sheet-tabs button[aria-selected="true"] { color: #1f3a5f; background: #fff; border-top-color: #6f42c1; }
.leaflet-popup.sheet .sheet-tabs button:focus-visible { outline: 3px solid #8e44ec; outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) { .leaflet-popup.sheet .sp-wrap { transition: none; } }

/* Bigger text on the cards: the popup sizes above are tuned for a small floating window. */
.leaflet-popup.sheet .leaflet-popup-content { font-size: 1.1rem; }
.leaflet-popup.sheet h3 { font-size: 1.45rem; }
.leaflet-popup.sheet h4 { font-size: 1.15rem; }
.leaflet-popup.sheet .stop-popup td, .leaflet-popup.sheet .station-popup .board, .leaflet-popup.sheet .station-popup .board td,
.leaflet-popup.sheet .station-popup .board th, .leaflet-popup.sheet .stop-popup .tn-table, .leaflet-popup.sheet .stop-popup .tn-table td { font-size: 1.05rem; }
.leaflet-popup.sheet .stop-popup td small, .leaflet-popup.sheet .station-popup .board small, .leaflet-popup.sheet .stop-popup .tn-table td small,
.leaflet-popup.sheet .station-popup .bs-name small, .leaflet-popup.sheet .stop-popup .tn-station small { font-size: .9rem; }
.leaflet-popup.sheet .stop-popup td, .leaflet-popup.sheet .station-popup .board td { padding-top: 7px; padding-bottom: 7px; }
.leaflet-popup.sheet .stop-popup .muted, .leaflet-popup.sheet .train-popup .note, .leaflet-popup.sheet .sp-side .note, .leaflet-popup.sheet .ago { font-size: .9rem; }
.leaflet-popup.sheet .station-popup .busstop, .leaflet-popup.sheet .stop-popup .tn-station { font-size: 1.05rem; padding: 10px 12px; }
.leaflet-popup.sheet .station-popup .bn { font-size: 1rem; }
.leaflet-popup.sheet .station-popup .bs-lines em { font-size: .85rem; }
.leaflet-popup.sheet .sheet-tabs button { font-size: 1.05rem; }

/* The codes on the train icons, when the destination is shown instead of the ID */
.train-key { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: -4px 0 10px; font-size: .8rem; color: #444; }
.train-key[hidden] { display: none; }
.train-key b { display: inline-block; min-width: 2.2em; color: #1f3a5f; }
#trainPanel .plan-button { margin: 4px 0 12px; }   /* in the Trains section but shown in every mode, so the section itself is not hidden with the buses */
.trainlabel-group { margin-top: 12px; }

/* Favourite stations: the star in a station popup's header, and the Favourites box in a single mode (only when it has something for that mode) */
.station-popup .sp-head .station-star { flex: none; margin-top: -2px; }
body.mode-trains #favourites:not([data-has-stations]) { display: none !important; }
body.mode-buses #favourites:not([data-has-buses]) { display: none !important; }

/* "Tracking updated hh:mm:ss" at the foot of the panel */
.page-updated { margin: 14px 0 0; font-size: .8rem; color: #777; }
.page-updated:empty { display: none; }

/* Subtle dividers, so the blocks at the foot of the panel do not read as one. They are borders on the blocks, so a block that a mode hides takes its divider with it. */
.ring-note { margin: 14px 0 8px; padding-top: 14px; border-top: 1px solid #e9e9ef; }
.legend { margin: 0; padding-bottom: 14px; border-bottom: 1px solid #e9e9ef; }
label.bus-only.lane-toggle { margin: 12px 0 0; padding-bottom: 14px; border-bottom: 1px solid #e9e9ef; }
label.ferry-toggle { margin: 12px 0 0; padding-bottom: 14px; border-bottom: 1px solid #e9e9ef; }   /* a line under the ferries section, as under the others */
.trainlabel-group { margin-top: 12px; padding-bottom: 2px; border-bottom: 1px solid #e9e9ef; }
.double-arrow-icon { background: none; border: 0; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.double-arrow-icon img { display: block; }
.airport-icon { box-sizing: border-box; width: 30px; height: 30px; border-radius: 50%; background: #1d4ed8; border: 2px solid #fff; color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
    display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; }
.airport-popup small { font-weight: 400; color: #666; font-size: .75rem; }
