:root {
  --orange: #FC4C02; --charcoal: #242428; --ink: #fff; --muted: #A7A7B1;
  --panel: rgba(36,36,40,.94); --line: #3a3a41; --bus: #2B2B33; --tram: #0073E6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--charcoal); color: var(--ink);
  font: 14px/1.35 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
#map { position: fixed; inset: 0; background: #e5e3df; }
.leaflet-container { font: inherit; }

#bar { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 1000;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px;
  background: var(--panel); border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.3); max-width: 720px; }
.brand { font-weight: 800; letter-spacing: .5px; color: var(--orange); font-size: 18px; }
/* The logo links to the "O serwisie" page; the small (i) hints that it is clickable. */
a.brand { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; border-radius: 6px; padding: 2px 4px; margin: -2px -4px;
  -webkit-tap-highlight-color: transparent; }
a.brand svg { width: 15px; height: 15px; flex: none; opacity: .85; }
a.brand:hover { background: rgba(252,76,2,.15); }
a.brand:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#search { flex: 1 1 140px; min-width: 140px; background: #34343a; color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 16px; }
#search:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #34343a; color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 699px) { .leaflet-top.leaflet-right { margin-top: 150px; } body.when-on .leaflet-top.leaflet-right { margin-top: 190px; } }
#status { position: fixed; left: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 1000;
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel);
  border-radius: 999px; font-size: 12px; color: var(--muted); max-width: calc(100% - 80px); }
#dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
#status.ok #dot { background: #3ddc84; animation: pulse 2s infinite; }
#status.loading #dot { background: var(--orange); animation: pulse 1s infinite; }
#status.err #dot { background: #ff4d4d; }
#status.err { color: #ffb3b3; }
@keyframes pulse { 50% { opacity: .35; } }

#panel { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; max-height: 55vh; overflow: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px;
  background: var(--panel); border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#panel[hidden] { display: none; }
#p-fleet { flex: 1 0 100%; margin: 0; padding-top: 8px; border-top: 1px solid var(--line); }
#p-fleet[hidden] { display: none; }
.line-badge { min-width: 56px; padding: 8px 10px; text-align: center; border-radius: 10px; background: var(--orange);
  font-weight: 800; font-size: 22px; }
.meta { flex: 1; min-width: 0; }
#p-type { font-weight: 700; }
#p-details { color: var(--muted); font-size: 12px; }
/* Every panel: ⌄ (collapse) next to × in the top right corner; "Śledź" sits at the bottom of the first row, clear of them. */
.p-ctrl { position: absolute; top: 4px; right: 6px; display: flex; }
.p-ctrl button { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 24px; cursor: pointer;
  display: grid; place-items: center; padding: 0; }
.p-ctrl button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.p-collapse svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s; }
#follow { align-self: flex-end; margin-top: 36px; }
.sheet .p-head { padding-right: 64px; }
/* Collapsed panel: one bar with the badge and the name (vehicles: line, direction and "Śledź"), so the map stays visible.
   Tapping the bar or ⌃ expands it. */
#panel.min, .sheet.min { padding: 8px 76px 8px 12px; overflow: hidden; }
.min .p-ctrl { top: 50%; transform: translateY(-50%); }
.min .p-collapse svg { transform: rotate(180deg); }
#panel.min { flex-wrap: nowrap; gap: 10px; }
#panel.min #follow { align-self: center; margin-top: 0; }
#panel.min .line-badge { min-width: 44px; padding: 4px 8px; font-size: 18px; }
#panel.min .meta, .sheet.min .p-head { cursor: pointer; }
#panel.min #p-details, #panel.min .p-route-src, #panel.min #p-fleet { display: none; }
#panel.min #p-type, #panel.min #p-route, #panel.min #p-route > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#panel.min #p-route { margin-top: 0; color: var(--muted); }
.sheet.min > :not(.p-ctrl):not(.p-head) { display: none; }
.sheet.min .p-head { padding-right: 0; }
.sheet.min .p-name, .sheet.min .p-addr { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hl { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--orange); background: rgba(252,76,2,.2);
  animation: ring 1.6s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.3); opacity: .2; } }
.lbl { color: #fff; font-weight: 800; font-size: 11px; text-align: center; line-height: 20px; border-radius: 10px;
  min-width: 26px; padding: 0 5px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); white-space: nowrap; }
.lbl.bus { background: var(--bus); } .lbl.tram { background: var(--tram); } .lbl.sel { background: var(--orange); }

@media (min-width: 700px) { #panel { left: 10px; right: auto; } }

.chip { display: inline-flex; align-items: center; gap: 6px; }
.pico { width: 16px; height: 16px; flex: none; }
/* Icon-only chips (vehicle types, metro, parking, incidents): the name is in title and aria-label. */
.chip.icon { padding: 6px 10px; }
.chip.icon .pico { width: 20px; height: 20px; }
.chip.on { --picon-bg: var(--orange); }
.chip.on .pico rect { fill: #fff; }

#ppanel { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; max-height: 55vh; overflow: auto; padding: 12px; background: var(--panel);
  border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#ppanel[hidden] { display: none; }
.p-head { display: flex; gap: 12px; align-items: center; }
.p-badge { min-width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 22px; background: #00A878; }
.p-badge.none { background: #D93025; }
.p-name { font-weight: 700; } .p-addr { color: var(--muted); font-size: 12px; }
.p-free { margin: 10px 0 4px; display: flex; align-items: baseline; gap: 8px; }
.p-num { font-size: 30px; font-weight: 800; } .p-of { color: var(--muted); }
.p-rows { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: 13px; }
.p-rows dt { color: var(--muted); } .p-rows dd { margin: 0; overflow-wrap: anywhere; }
.p-rows a { color: #fff; }

.pk { color: #fff; font-weight: 800; font-size: 12px; line-height: 22px; text-align: center; border-radius: 6px; min-width: 34px; padding: 0 6px;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); white-space: nowrap; background: #00A878; }
.pk.none { background: #D93025; } .pk.sel { background: var(--orange); outline: 3px solid rgba(252,76,2,.35); }
@media (min-width: 700px) { #ppanel { left: 10px; right: auto; } }

#ipanel { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; max-height: 55vh; overflow: auto; padding: 12px; background: var(--panel);
  border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#ipanel[hidden] { display: none; }
.i-badge { min-width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 24px; background: #F5A100; color: #242428; }
.i-badge.planned { background: #7A8BA6; } .i-badge.ended { background: #5a5a63; color: #ddd; }
.i-status { margin: 10px 0 6px; font-weight: 700; font-size: 13px; }
.i-status.active { color: #F5A100; } .i-status.planned { color: #9FB0CC; } .i-status.ended { color: var(--muted); }
.i-body p { margin: 0 0 8px; font-size: 13px; }
.i-link { color: #fff; font-size: 13px; }
.ic { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: #F5A100; border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.5); font-weight: 800; color: #242428; font-size: 16px; transform: rotate(0deg); }
.ic.planned { background: #7A8BA6; } .ic.ended { background: #8a8a92; opacity: .8; } .ic.sel { outline: 3px solid rgba(252,76,2,.55); border-color: var(--orange); }
@media (min-width: 700px) { #ipanel { left: 10px; right: auto; } }
/* Landscape phones: keep most of the map visible. */
@media (max-height: 480px) { #panel, #ppanel, #ipanel { max-height: 40vh; } }

/* "Show my location" button and the position dot, after Google Maps. */
.locate { position: fixed; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 24px); z-index: 1000;
  width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 50%; background: #fff; color: #5F6368; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: bottom .2s; -webkit-tap-highlight-color: transparent; }
.locate svg { display: block; width: 24px; height: 24px; }
.locate .loc-dot, .locate .loc-off { display: none; }
.locate.found .loc-dot, .locate.on .loc-dot { display: inline; }
.locate.on, .locate.busy { color: #1A73E8; }
.locate.busy svg { animation: pulse 1s infinite; }
.locate.off .loc-off { display: inline; }
.locate:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.me { position: relative; width: 22px; height: 22px; }
.me-dot { position: absolute; inset: 2px; border-radius: 50%; background: #1A73E8; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.me-pulse { position: absolute; inset: 0; border-radius: 50%; background: rgba(26,115,232,.4); animation: me-pulse 2s ease-out infinite; }
@keyframes me-pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(3); opacity: 0; } }
.me-beam { display: none; position: absolute; left: -21px; bottom: 11px; width: 64px; height: 58px; transform-origin: 50% 100%;
  background: radial-gradient(circle 58px at 50% 100%, rgba(26,115,232,.75), rgba(26,115,232,0)); clip-path: polygon(50% 100%, 0 0, 100% 0);
  transition: transform .2s linear; }
.me.heading .me-beam { display: block; }
.me.lost .me-dot { background: #9AA0A6; } .me.lost .me-pulse { display: none; }
#toast { position: fixed; left: 50%; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 80px); transform: translateX(-50%); z-index: 1001;
  width: max-content; max-width: calc(100% - 20px); padding: 10px 14px; background: var(--panel); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4); font-size: 13px; }
#toast[hidden] { display: none; }

/* Zone layers: a button under the zoom control with a menu of switches, and a panel with the zone's rules. */
.zones { position: relative; margin-top: 10px; }
#zones-btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 2px solid rgba(0,0,0,.2); border-radius: 6px;
  background: #fff; color: #5F6368; cursor: pointer; background-clip: padding-box; -webkit-tap-highlight-color: transparent; }
#zones-btn svg { width: 20px; height: 20px; }
#zones-btn.on { color: var(--orange); }
#zones-btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
#zmenu { position: absolute; top: 0; right: 42px; width: 250px; max-width: calc(100vw - 72px); padding: 10px 12px; background: var(--panel); color: var(--ink);
  border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.4); font-size: 13px; }
#zmenu[hidden] { display: none; }
.z-title { font-weight: 700; margin-bottom: 6px; }
.z-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.z-row label { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.z-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--orange); flex: none; }
.z-sw { width: 18px; height: 12px; border-radius: 3px; flex: none; }
.z-sw.sppn { background: #FDD8DA; border: 2px dashed #D64550; } /* fill as the city's WMS draws it, dashed edge from #sppn-edge (index.html) */
.sppn-wms img.leaflet-tile { filter: url(#sppn-edge); }
.z-sw.sct { background: rgba(0,168,120,.2); border: 2px dashed #00A878; }
.z-info { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: #34343a; color: #fff;
  font: italic 700 14px Georgia, serif; cursor: pointer; }
.z-info:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.z-note { margin-top: 6px; color: var(--muted); font-size: 12px; }

#zpanel { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; max-height: 55vh; overflow: auto; padding: 12px; background: var(--panel);
  border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#zpanel[hidden] { display: none; }
.z-badge { min-width: 44px; height: 44px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.z-badge.sppn { background: #D64550; } .z-badge.sct { background: #00A878; }
.z-foot { margin: 10px 0 6px; color: var(--muted); font-size: 12px; }
#zpanel .p-rows dd { white-space: pre-line; }
@media (min-width: 700px) { #zpanel { left: 10px; right: auto; } }
@media (max-height: 480px) { #zpanel { max-height: 40vh; } }
/* Sport classes ("Zajęcia sportowe"): violet, a colour no other layer uses. */
:root { --sport: #7B5CFF; }
#t-sport.on { background: var(--sport); border-color: var(--sport); --picon-bg: var(--sport); }
#sfilter { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
#sfilter[hidden] { display: none; }
#sfilter span { font-weight: 600; margin-right: 4px; }
#sfilter button { background: #34343a; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  font: 600 12px/1.2 inherit; cursor: pointer; }
#sfilter button.on { background: #fff; border-color: #fff; color: var(--charcoal); }
#sfilter button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sp { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px 0 5px; border-radius: 12px; background: var(--sport); color: #fff;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); font-weight: 800; font-size: 12px; white-space: nowrap; }
.sp svg { width: 14px; height: 14px; flex: none; }
.sp.sel { background: var(--orange); outline: 3px solid rgba(252,76,2,.4); }
#spanel { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; max-height: 55vh; overflow: auto; padding: 12px; background: var(--panel);
  border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#spanel[hidden] { display: none; }
.s-badge { min-width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--sport); color: #fff; }
.s-badge svg { width: 26px; height: 26px; }
.s-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.s-list li { padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.s-when { font-weight: 800; color: #B9A8FF; font-size: 13px; }
.s-title { font-weight: 700; }
.s-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.s-tags span { font-size: 11px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.s-desc { font-size: 12px; color: var(--muted); }
.s-list a { color: #fff; font-size: 13px; }
.s-note { margin-top: 10px; font-size: 11px; color: var(--muted); }
@media (min-width: 700px) { #spanel { left: 10px; right: auto; } }
@media (max-height: 480px) { #spanel { max-height: 40vh; } }

/* City events ("DziejeSię", Kalendarz wydarzeń): sea green. */
:root { --events: #0B8A8F; }
#t-events.on { background: var(--events); border-color: var(--events); --picon-bg: var(--events); }
.ev { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px 0 5px; border-radius: 12px; background: var(--events); color: #fff;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); font-weight: 800; font-size: 12px; white-space: nowrap; --picon-bg: var(--events); }
.ev svg { width: 15px; height: 15px; flex: none; }
.ev.sel { background: var(--orange); --picon-bg: var(--orange); outline: 3px solid rgba(252,76,2,.4); }
#epanel { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; max-height: 55vh; overflow: auto; padding: 12px; background: var(--panel);
  border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#epanel[hidden] { display: none; }
.e-badge { min-width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--events); color: #fff; }
.e-badge svg { width: 28px; height: 28px; }
#epanel .s-when { color: #7FD8DB; }
@media (min-width: 700px) { #epanel { left: 10px; right: auto; } }
@media (max-height: 480px) { #epanel { max-height: 40vh; } }

/* Metro (M1, M2): station panel like the zone panel, line badges in the line colours (set by app.js). */
#mpanel { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; max-height: 55vh; overflow: auto; padding: 12px; background: var(--panel);
  border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#mpanel[hidden] { display: none; }
.m-badges { display: flex; gap: 4px; flex: none; }
.m-badge { min-width: 44px; height: 44px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; }
@media (min-width: 700px) { #mpanel { left: 10px; right: auto; } }
@media (max-height: 480px) { #mpanel { max-height: 40vh; } }

/* Route of the selected vehicle's line (direction and timetable date in the vehicle panel; stop names as tooltips). */
.p-route { margin-top: 4px; font-size: 12px; }
.p-route-src { color: var(--muted); }
.p-route-src.old { color: #FFB020; }
.stop-tip { font-size: 12px; font-weight: 600; }

/* Timelapse bar (prediction): above the status line; on wide screens on the right, clear of the details panels on the left. */
#lapse { position: fixed; z-index: 1000; left: 10px; right: 10px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
  max-width: 420px; padding: 10px 12px; background: var(--panel); border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
#lapse[hidden] { display: none; }
@media (min-width: 700px) { #lapse { left: auto; right: 66px; width: 380px; } }
.l-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.l-title { font-weight: 700; }
.l-time { flex: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.l-head button svg { width: 20px; height: 20px; display: block; margin: auto; }
.l-head button.busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.l-head button { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; padding: 0; }
.l-head button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.l-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.l-row span { width: 46px; flex: none; }
.l-row input { flex: 1; min-width: 0; accent-color: var(--orange); height: 28px; }
.l-row output { width: 92px; flex: none; text-align: right; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.l-note { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
