:root {
  --bg: #0b0905;
  --fg: #f3e7cf;
  --muted: #a8977a;
  --led: #ffb000;
  --tram: #d7261e;
  --bus: #1f6fd1;
  --both: #8a3fb8;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 system-ui, sans-serif; }
#map { position: absolute; inset: 0; background: #ddd; }
.leaflet-tile-pane { filter: saturate(0.55) brightness(1.02); }

#hud {
  position: absolute; z-index: 1000; top: 10px; left: 56px; right: 16px; max-width: max-content;
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  padding: 6px 12px; background: rgba(11, 9, 5, 0.88); border-radius: 6px;
}
#hud a { color: var(--led); font-weight: 600; text-decoration: none; }
#hud .key { color: var(--muted); white-space: nowrap; }
#hud .key i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1.5px solid #fff; }
#hud .tram { background: var(--tram); }
#hud .bus { background: var(--bus); }
#hud .both { background: var(--both); }
#status { color: var(--led); }
#status:empty { display: none; }

/* tiny LED boards (L.divIcon) */
.mini a { position: absolute; left: 0; top: 0; display: flex; gap: 4px; align-items: flex-start; line-height: 0; }
.mini .board { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
/* the sign's SVG includes the pole stub on a transparent background: shadow the drawn shapes, not the box */
.mini .sign svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45)); }
.mini a:hover .dip-housing, .mini a:focus .dip-housing { outline: 2px solid var(--led); }
/* słupek number tag, shown above a hovered board */
.mini .code {
  display: none; position: absolute; left: 0; bottom: 100%; margin-bottom: 4px;
  padding: 2px 7px; border-radius: 4px; background: rgba(11, 9, 5, 0.92); color: var(--led);
  font: 600 13px/1.3 system-ui, sans-serif; white-space: nowrap; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.mini a:hover .code, .mini a:focus .code { display: block; }
.mini svg.leader { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.mini svg.leader line { stroke: #111; stroke-width: 1.5; stroke-opacity: 0.75; }
.mini svg.leader circle { fill: #111; }

.leaflet-popup-content { font: 13px/1.45 system-ui, sans-serif; margin: 10px 12px; }
.leaflet-popup-content b { font-size: 14px; }
.leaflet-popup-content .lines { color: #555; margin: 2px 0 6px; }
.leaflet-popup-content a.open { font-weight: 600; }

/* the vehicle of the departure under the pointer */
.vehicle { pointer-events: none; white-space: nowrap; }
.vehicle span { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; box-sizing: border-box;
  border-radius: 14px; border: 2px solid #fff; background: #ffb000; color: #111; font: 700 14px/1 system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.vehicle span.tram { background: #ff5a4f; color: #fff; }
.vehicle em { margin-left: 6px; padding: 2px 6px; border-radius: 4px; background: rgba(17,17,17,.85); color: #ffb000; font: 600 12px/1.4 system-ui, sans-serif; font-style: normal; vertical-align: middle; }

/* full-screen stop: board + sign, close, link to kiosk mode */
#full { position: fixed; inset: 0; z-index: 3000; background: rgba(8, 8, 10, 0.94); display: flex; flex-direction: column;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
#full[hidden] { display: none; }
#full .bar { display: flex; align-items: center; gap: 16px; color: #eee; font: 600 15px/1.3 system-ui, sans-serif; }
#full .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#full .kiosk { color: #111; background: var(--led, #ffb000); padding: 8px 14px; border-radius: 6px; text-decoration: none; white-space: nowrap; }
#full .close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #2a2a2e; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
#full .close:hover, #full .kiosk:hover { filter: brightness(1.15); }
#full .close:focus-visible, #full .kiosk:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#full .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 24px; }
#full .stage.stacked { flex-direction: column; gap: 16px; }
#full .sign svg { display: block; width: 100%; height: 100%; }

#hud .design { display: inline-flex; align-items: center; gap: 6px; color: #ccc; }
#hud .design select { max-width: 46vw; font: 600 13px system-ui, sans-serif; background: #1d1d20; color: #fff; border: 1px solid #444; border-radius: 4px; padding: 3px 6px; }

#hud .dirmode { display: inline-flex; align-items: center; gap: 5px; color: #ddd; cursor: pointer; }
#dirlegend { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); bottom: max(28px, env(safe-area-inset-bottom, 0px)); z-index: 2000;
  max-width: min(420px, calc(100vw - 24px)); background: rgba(20, 20, 22, 0.94); color: #eee; border-radius: 8px; padding: 10px 12px;
  font: 13px/1.45 system-ui, sans-serif; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
#dirlegend[hidden] { display: none; }
#dirlegend .h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#dirlegend .h b { font-size: 14px; }
#dirlegend .pid { background: #039; color: #fff; border-radius: 10px; padding: 0 7px; font-weight: 700; }
#dirlegend .code { color: #999; }
#dirlegend button { margin-left: auto; background: #333; color: #fff; border: 0; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }
#dirlegend .via { color: #bbb; font-style: italic; margin-bottom: 4px; }
#dirlegend .row { display: grid; grid-template-columns: 14px auto 1fr; gap: 8px; align-items: baseline; padding: 2px 0; }
#dirlegend .row i { width: 14px; height: 6px; border-radius: 2px; align-self: center; }
#dirlegend .to { font-weight: 600; white-space: nowrap; }
#dirlegend .lines { color: #ccc; font-family: ui-monospace, Menlo, monospace; }

#dirlegend { padding: 8px; top: 64px; bottom: auto; }
#dirlegend > button { position: absolute; top: 6px; right: 6px; z-index: 1; }
#dirlegend .sign svg { display: block; height: calc(100vh - 110px); max-height: 900px; width: auto; max-width: 60vw; }

/* live tram labels: line, next stop, minutes */
.tramlabel { white-space: nowrap; pointer-events: none; font: 600 11px/1.2 system-ui, sans-serif; color: #fff;
  background: rgba(20, 20, 22, 0.85); border-radius: 4px; padding: 2px 5px; display: inline-flex; gap: 5px; align-items: baseline; }
.tramlabel b { color: #ff7b72; font-size: 12px; }
.tramlabel i { font-style: normal; color: #ffb000; }

/* toggles: hide the boards or the poles */
/* hidden, not removed, so the pole stays standing on its stop */
body.noboards .mini .board { visibility: hidden; }
body.nosigns .mini .sign { visibility: hidden; }
body.noboards.nosigns .mini { display: none; }

.leaflet-tooltip.dirplace { font: 700 12px system-ui, sans-serif; background: #141416; color: #fff; border: 0; border-radius: 4px; padding: 2px 6px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.leaflet-tooltip.dirplace::before { display: none; }
#dirlegend [data-line], #dirlegend [data-dir] { cursor: pointer; }

/* reach mode: pin + radius, reachable routes, hub list */
.reachopts { font-size: 12px; }
.reachopts input { width: 3.4em; font: inherit; }
#reachpanel { position: fixed; right: max(12px, env(safe-area-inset-right, 0px)); top: 64px; bottom: 28px; z-index: 2000; width: 320px; max-width: calc(100vw - 32px);
  overflow: auto; background: #fff; color: #111; border-radius: 8px; box-shadow: 0 4px 18px rgba(0,0,0,.35); padding: 10px 12px; font: 13px/1.35 system-ui, sans-serif; }
#reachpanel[hidden] { display: none; }
#reachpanel h3 { margin: 0 0 4px; font-size: 14px; }
#reachpanel .meta { color: #555; margin-bottom: 8px; }
#reachpanel table { border-collapse: collapse; width: 100%; }
#reachpanel td { padding: 3px 4px; border-bottom: 1px solid #eee; vertical-align: top; }
#reachpanel tr { cursor: pointer; }
#reachpanel tr:hover { background: #f0f4ff; }
#reachpanel .mins { font-weight: 700; text-align: right; white-space: nowrap; }
#reachpanel .ln { font-weight: 700; }
#reachpanel small { color: #666; }
#reachpanel button { float: right; border: 0; background: none; font-size: 18px; cursor: pointer; }
.reachhandle { width: 14px !important; height: 14px !important; margin: -7px 0 0 -7px !important; border-radius: 50%; background: #fff; border: 3px solid #e6194b; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: ew-resize; }
@media (prefers-color-scheme: dark) { #reachpanel { background: #1e1e1e; color: #eee; } #reachpanel td { border-color: #333; } #reachpanel small, #reachpanel .meta { color: #aaa; } #reachpanel tr:hover { background: #2a3350; } }

/* reach panel, sign-like: a grey "przez" strip per destination, line cells under it */
#reachpanel .rdest { margin: 0 0 10px; border-radius: 4px; overflow: hidden; border: 1px solid #c9ccd0; }
#reachpanel .rhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; background: #5f6368; color: #fff; padding: 5px 8px; cursor: pointer; }
#reachpanel .rname { font-weight: 800; letter-spacing: .01em; font-size: 13px; }
#reachpanel .rmins { font-weight: 800; white-space: nowrap; }
#reachpanel .ropt { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 8px; padding: 4px 6px; border-top: 1px solid #e3e5e8; cursor: pointer; }
#reachpanel .ropt:hover { background: #eef3ff; }
#reachpanel .rbadge { display: inline-block; min-width: 40px; text-align: center; font: 800 18px/1.15 'Arial Narrow', Arial, sans-serif; color: #141414; background: #fff; border: 2px solid #55565a; border-radius: 2px; padding: 1px 3px; }
#reachpanel .rbadge.fast { color: #d8121b; }
#reachpanel .rbadge.night { color: #fff; background: #141414; }
#reachpanel .rdep { font-size: 12px; } #reachpanel .rdep b { font-size: 13px; }
#reachpanel .rarr { font-size: 12px; color: #444; white-space: nowrap; }
@media (prefers-color-scheme: dark) { #reachpanel .rdest { border-color: #3a3d42; } #reachpanel .ropt { border-color: #33363a; } #reachpanel .ropt:hover { background: #2a3350; } #reachpanel .rarr { color: #bbb; } }
