:root {
  color-scheme: dark;
  --surface-0: #0c0c0c;
  --surface-1: #161615;
  --surface-2: #1f1f1d;
  --hairline: #2c2c29;
  --text-primary: #f4f3ee;
  --text-secondary: #c3c2b7;
  --text-muted: #8a897f;

  --water: #3987e5;
  --water-deep: #1c5cab;
  --tram: #eb6834;

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --panel-w: 400px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--surface-0); color: var(--text-primary); }
body { overflow: hidden; }

#map { position: absolute; inset: 0 0 0 var(--panel-w); }

#panel {
  position: absolute; inset: 0 auto 0 0; width: var(--panel-w);
  overflow-y: auto; background: var(--surface-1);
  border-right: 1px solid var(--hairline);
  padding: 22px 18px 28px;
  scrollbar-width: thin; scrollbar-color: #3a3a36 transparent;
}

.masthead { padding: 0 4px 14px; }
.kicker { margin: 0 0 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.kicker::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--critical); margin-right: 7px; vertical-align: 1px; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.kicker.is-replay::before { background: var(--tram); animation: none; }
h1 { margin: 0; font-size: 30px; line-height: 1.05; letter-spacing: -.02em; font-weight: 750; }
h1 .x { color: var(--text-muted); font-weight: 400; }
.lede { margin: 10px 0 0; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }

.card { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 14px 16px; margin-top: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
h2 { margin: 0; font-size: 15px; font-weight: 650; }
h3 { margin: 16px 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.meta { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.body { color: var(--text-secondary); font-size: 13px; line-height: 1.5; margin: 8px 0 12px; }
.fine { color: var(--text-muted); font-size: 11px; line-height: 1.4; margin: 4px 0 0; }

.hero-label { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 999px; background: #262624; color: var(--text-primary); white-space: nowrap; }
.status svg { flex: none; }

/* stations */
.stations { list-style: none; margin: 0; padding: 0; }
.stations li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 0; border-top: 1px solid var(--hairline); font-size: 13px; }
.stations li:first-child { border-top: 0; }
.st-name { font-weight: 600; }
.st-river { color: var(--text-muted); font-size: 11.5px; }
.st-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.st-bar { grid-column: 1 / -1; height: 4px; background: #2a2a27; border-radius: 2px; position: relative; overflow: hidden; }
.st-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--water); }
.st-sub { text-align: right; font-size: 11px; color: var(--text-muted); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.tile { background: var(--surface-1); border-radius: 9px; padding: 10px 10px 9px; }
.tile-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile-label { font-size: 11px; color: var(--text-secondary); line-height: 1.3; margin-top: 2px; }

/* bars */
.bars { display: grid; gap: 5px; }
.bar-row { display: grid; grid-template-columns: 112px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; }
.bar-row:hover, .bar-row:focus-visible { background: #2a2a27; outline: none; }
.bar-name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; position: relative; }
.bar-track > i { position: absolute; inset: 0 auto 0 0; background: var(--tram); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .6s ease; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.empty { color: var(--text-muted); font-size: 12px; }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.feed li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--hairline); }
.feed li:first-child { border-top: 0; }
.feed .line-badge { flex: none; }
.feed .where { flex: 1; min-width: 0; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-badge { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 5px; border-radius: 5px; background: var(--tram); color: #1a0d06; font-weight: 750; font-size: 12px; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; color: var(--text-secondary); max-width: min(560px, calc(100% - 24px)); }
.legend-title { color: var(--text-primary); font-weight: 650; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.legend i.ln { height: 3px; border-radius: 2px; }
.legend i.dot { width: 10px; height: 10px; border-radius: 50%; }

.sources { padding: 14px 4px 0; font-size: 11px; line-height: 1.5; color: var(--text-muted); }
.sources a { color: var(--text-secondary); }

/* tooltip */
#tooltip {
  position: fixed; z-index: 10; pointer-events: none; max-width: 260px;
  background: rgba(22,22,21,.96); border: 1px solid #3a3a36; border-radius: 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.45; color: var(--text-secondary);
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
#tooltip .tt-v { color: var(--text-primary); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
#tooltip .tt-t { color: var(--text-primary); font-weight: 600; }

/* map overlay chips */
.map-chip {
  position: absolute; z-index: 2; right: 12px; top: 12px; left: auto;
  background: rgba(22,22,21,.9); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 8px 11px; font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; align-items: center;
}
.maplibregl-ctrl-attrib { background: rgba(12,12,12,.7) !important; color: var(--text-muted); }
.maplibregl-ctrl-attrib a { color: var(--text-secondary) !important; }
.maplibregl-ctrl-group { background: #1f1f1d !important; }
.maplibregl-ctrl-group button + button { border-top-color: #333 !important; }
.maplibregl-ctrl-icon { filter: invert(1); }

/* pasek odtwarzania */
.timebar {
  position: absolute; z-index: 2; left: 50%; bottom: 38px; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 110px);
  display: flex; align-items: center; gap: 10px;
  background: rgba(22,22,21,.94); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 7px 8px 7px 14px; font-size: 12px; color: var(--text-secondary);
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
.timebar button { font: inherit; cursor: pointer; border: 0; }
.timebar button:focus-visible, .tb-range:focus-visible { outline: 2px solid var(--water); outline-offset: 2px; }
.tb-live { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tb-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--critical); animation: blink 2s infinite; }
.tb-cta {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--tram); color: #1a0d06; font-weight: 650; padding: 7px 12px; border-radius: 8px;
}
.tb-cta:hover { filter: brightness(1.08); }
.tb-cta:disabled { background: #2a2a27; color: var(--text-muted); cursor: default; filter: none; }
.timebar.is-replay { width: min(720px, calc(100% - 110px)); padding-left: 8px; }
.tb-icon {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px;
  background: var(--tram); color: #1a0d06;
}
.tb-speeds { flex: none; display: flex; gap: 2px; background: var(--surface-0); border-radius: 8px; padding: 2px; }
.tb-speeds button { background: transparent; color: var(--text-secondary); padding: 5px 7px; border-radius: 6px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tb-speeds button:hover { color: var(--text-primary); }
.tb-speeds button[aria-checked="true"] { background: #33332f; color: var(--text-primary); }
.tb-edge { flex: none; color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tb-range {
  --p: 0%; flex: 1; min-width: 60px; height: 18px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.tb-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--tram) var(--p), #3a3a36 var(--p)); }
.tb-range::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--tram) var(--p), #3a3a36 var(--p)); }
.tb-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--text-primary); border: 0; }
.tb-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text-primary); border: 0; }
.tb-clock { flex: none; min-width: 64px; display: grid; text-align: right; line-height: 1.15; }
.tb-clock small { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--tram); font-weight: 650; }
.tb-clock b { color: var(--text-primary); font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; }
.tb-back { flex: none; background: #2a2a27; color: var(--text-primary); padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.tb-back:hover { background: #33332f; }

/* karta wybranego tramwaju */
#tooltip .tt-hint { color: var(--tram); font-size: 11px; margin-top: 2px; }
.feed li[role="button"], .alerts li[role="button"] { cursor: pointer; border-radius: 6px; margin: 0 -4px; padding-left: 4px; padding-right: 4px; }
.feed li[role="button"]:hover, .feed li[role="button"]:focus-visible { background: #2a2a27; outline: none; }

.tram-card {
  position: absolute; z-index: 3; left: 12px; top: 12px; width: 300px;
  max-height: calc(100% - 120px); overflow-y: auto; scrollbar-width: thin;
  background: rgba(22,22,21,.96); border: 1px solid var(--hairline); border-radius: 14px;
  padding: 12px 14px 12px; font-size: 12.5px; color: var(--text-secondary);
  box-shadow: 0 10px 34px rgba(0,0,0,.55);
  animation: card-in .22s ease-out;
}
.tram-card[hidden], .tram-card [hidden] { display: none; }
@keyframes card-in { from { opacity: 0; transform: translateY(-6px); } }
.tc-head { display: flex; align-items: center; gap: 10px; }
.tc-badge {
  flex: none; display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 6px; border-radius: 10px;
  background: var(--tram); color: #1a0d06; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.tc-title { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.tc-title small { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.tc-dir { color: var(--text-primary); font-size: 16px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.tc-close {
  flex: none; align-self: flex-start; width: 28px; height: 28px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 7px; color: var(--text-muted); cursor: pointer;
}
.tc-close:hover { background: #2a2a27; color: var(--text-primary); }
.tram-card button:focus-visible { outline: 2px solid var(--water); outline-offset: 2px; }
.tc-status { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; color: var(--text-primary); font-size: 13px; }
.tc-status i { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.tram-card.is-lost .tc-stats, .tram-card.is-lost .tc-spark, .tram-card.is-lost .tc-route, .tram-card.is-lost .tc-meta, .tram-card.is-lost .tc-alerts { display: none; }
.tc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.tc-stats > div { background: var(--surface-0); border-radius: 8px; padding: 7px 8px 6px; display: grid; }
.tc-stats b { color: var(--text-primary); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.tc-stats small { font-size: 10.5px; color: var(--text-muted); }
.tc-spark { position: relative; height: 38px; margin-top: 22px; }
.tc-spark svg { display: block; width: 100%; height: 100%; }
.tc-spark-max { position: absolute; left: 0; top: -15px; font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tc-route { margin-top: 10px; border-top: 1px solid var(--hairline); padding-top: 10px; }
.tc-ends { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--text-muted); }
.tc-ends span:last-child { text-align: right; color: var(--text-secondary); }
.tc-bar { --p: 0%; position: relative; height: 4px; margin: 6px 0 2px; border-radius: 2px; background: linear-gradient(to right, var(--tram) var(--p), #3a3a36 var(--p)); }
.tc-bar i { position: absolute; top: 50%; left: var(--p); width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--text-primary); box-shadow: 0 0 0 2px var(--tram); }
.tram-card h4 { margin: 12px 0 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.tc-stops { list-style: none; margin: 0; padding: 0 0 0 14px; position: relative; }
.tc-stops::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: #4a2a1c; border-radius: 1px; }
.tc-stops li { position: relative; display: flex; align-items: baseline; gap: 8px; padding: 3px 0; }
.tc-stops li::before { content: ""; position: absolute; left: -14px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--surface-0); box-shadow: 0 0 0 2px var(--tram); }
.tc-stops li.tc-next .tc-stop-name { color: var(--text-primary); font-weight: 650; }
.tc-stops li.tc-next::before { background: var(--tram); box-shadow: 0 0 0 2px var(--text-primary); }
.tc-stops li.tc-prev { color: var(--text-muted); }
.tc-stops li.tc-prev::before { box-shadow: 0 0 0 2px #6b6a63; }
.tc-stops li.tc-gap { color: var(--text-muted); padding: 0; line-height: 1; }
.tc-stops li.tc-gap::before { display: none; }
.tc-stops li.tc-gap-btn { padding: 2px 0; }
.tc-more { display: inline-flex; align-items: center; gap: 6px; margin-left: -8px; padding: 3px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--tram); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.tc-more::before { content: "…"; color: var(--text-muted); font-weight: 400; }
.tc-more::after { content: ""; width: 5px; height: 5px; margin-top: -3px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.tc-more[aria-expanded="true"]::before { display: none; }
.tc-more[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(-135deg); }
.tc-more:hover { background: #2a1d16; }
.tc-stop-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-stop-dist, .tc-stop-eta { flex: none; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 11.5px; }
.tc-stop-eta { min-width: 46px; text-align: right; color: var(--text-secondary); }
.tc-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.tc-follow {
  flex: none; display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 650; font-size: 12px;
  border: 0; border-radius: 8px; padding: 7px 11px; cursor: pointer; background: var(--tram); color: #1a0d06;
}
.tc-follow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px currentColor; }
.tc-follow[aria-pressed="true"] { background: #2a2a27; color: var(--text-primary); }
.tc-follow[aria-pressed="true"]::before { background: var(--tram); box-shadow: 0 0 0 2px rgba(235,104,52,.35); animation: blink 1.6s infinite; }
.tc-hint { font-size: 11px; color: var(--text-muted); }


/* Telefon poziomo: mało wysokości – panel z boku (a nie mapa na 60% wysokości nad nim), bez ozdobników. */
@media (max-height: 500px) and (min-width: 560px) and (orientation: landscape) {
  :root { --panel-w: clamp(240px, 34vw, 300px); }
  body { overflow: hidden; }
  #map, .has-card #map { position: absolute; inset: 0 0 0 var(--panel-w); height: auto; }
  #panel { position: absolute; inset: 0 auto 0 0; width: var(--panel-w); border-right: 1px solid var(--hairline); padding: 14px 12px 20px; }
  .tram-card { left: 8px; right: auto; width: min(320px, calc(100% - 16px)); }
  .timebar .tb-cta { font-size: 11.5px; }
  .masthead .lede, .legend { display: none; }
  .masthead h1 { font-size: 26px; }
  .timebar { bottom: 10px; max-width: calc(100% - 70px); }
  .tb-live { display: none; }
  .tram-card, .stop-card, .line-card { max-height: calc(100% - 16px); top: 8px; }
  .tc-spark, .tc-meta, .tc-hint { display: none; }
}

/* Dotyk: przyciski co najmniej ~40 px. */
@media (pointer: coarse) {
  .maplibregl-ctrl-group button { width: 40px; height: 40px; }
  .near-btn { min-height: 40px; padding: 8px 12px; }
  .tc-close, .sc-fav { width: 40px; height: 40px; }
  .sc-dir { padding: 10px 12px; }
  .sc-tabs button { padding: 9px 6px; }
  .tb-cta { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .kicker::before, .tb-live::before, .tc-follow[aria-pressed="true"]::before { animation: none; }
  .tram-card { animation: none; }
  .bar-track > i { transition: none; }
  .live-dot { animation: none; }
}

/* ---------------------------------------------------------------- tramwaje, przystanki, rozkład */

.line-badge.is-link { cursor: pointer; }
.line-badge.is-link:hover, .line-badge.is-link:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 1px; }
.line-badge.is-small { min-width: 22px; height: 17px; font-size: 11px; border-radius: 4px; }
.bar-name { display: flex; align-items: center; gap: 4px; }
.bar-name small { color: var(--text-muted); font-size: 11px; }
.tile-label small { color: var(--text-muted); font-size: 10.5px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* plakietka opóźnienia: --c = kolor klasy */
.pill {
  --c: var(--text-muted);
  display: inline-flex; align-items: center; flex: none; white-space: nowrap;
  padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent);
}

/* wyszukiwarka */
.search { position: relative; margin: 2px 0 0; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
#search {
  width: 100%; font: inherit; font-size: 14px; color: var(--text-primary);
  background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 10px; padding: 10px 12px 10px 34px;
}
#search::placeholder { color: var(--text-muted); }
#search:focus { outline: 2px solid var(--tram); outline-offset: 1px; border-color: transparent; }
.search-results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  background: #1c1c1a; border: 1px solid #3a3a36; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
  max-height: 340px; overflow-y: auto;
}
.search-results li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 9px; align-items: center; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.search-results li > :first-child { grid-row: 1 / 3; }
.search-results li small { color: var(--text-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results li[aria-selected="true"], .search-results li:hover { background: #2a2a27; }
.search-results .sr-label { color: var(--text-primary); font-weight: 600; }
.search-results .sr-empty { display: block; color: var(--text-muted); cursor: default; }
.search-results .sr-head { display: block; padding: 8px 8px 3px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; cursor: default; }
.search-results .sr-head:hover { background: none; }
.sr-stop { display: grid; place-items: center; width: 26px; height: 20px; border-radius: 5px; background: #e9e7df; color: #161615; font-weight: 800; font-size: 11px; }
.sr-locate { background: var(--tram); color: #fff; }

/* ostrzeżenie powodziowe – tylko gdy trzeba */
.water-alert { margin: 0 0 10px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); border-left: 3px solid var(--warning); background: #241f14; }
.water-alert.is-alarm { border-left-color: var(--critical); background: #2a1515; }
.water-alert b { color: var(--text-primary); }
.water-alert a { color: var(--text-primary); }

/* moje przystanki */
.fav { padding: 8px 0 6px; border-top: 1px solid var(--hairline); }
.fav:first-child { border-top: 0; padding-top: 4px; }
.fav-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: 0 -4px 4px; }
.fav-head:hover, .fav-head:focus-visible { background: #2a2a27; outline: none; }
.fav-head b { font-size: 13.5px; }
.fav-go { font-size: 11px; color: var(--text-muted); }
#favs .empty { margin: 8px 0 0; line-height: 1.45; }

/* lista odjazdów */
.deps { list-style: none; margin: 8px 0 0; padding: 0; }
.deps li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 6px 4px; margin: 0 -4px; border-top: 1px solid var(--hairline); border-radius: 0; }
.deps li:first-child { border-top: 0; }
.deps li[role="button"] { cursor: pointer; border-radius: 7px; }
.deps li[role="button"]:hover, .deps li[role="button"]:focus-visible { background: #2a2a27; outline: none; }
.deps li.empty { display: block; }
.dep-head { min-width: 0; display: grid; }
.dep-to { color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.dep-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 5px; color: var(--text-muted); font-size: 11px; line-height: 1.35; margin-top: 2px; }
.dep-late { font-weight: 600; color: var(--text-secondary); }
.dep-sub s { color: var(--text-muted); }
.dep-when { display: grid; justify-items: end; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dep-when b { color: var(--text-primary); font-size: 15px; font-weight: 700; }
.dep-when small { color: var(--text-muted); font-size: 11px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(12,163,12,.22); animation: blink 2s infinite; flex: none; }
.deps.is-compact { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.deps.is-compact li { display: inline-flex; gap: 6px; padding: 4px 7px 4px 4px; margin: 0; border: 0; background: var(--surface-1); border-radius: 7px; max-width: 100%; }
.deps.is-compact .dep-to { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); max-width: 92px; }
.deps.is-compact .dep-when b { font-size: 12.5px; }
.deps.is-compact li.empty { background: none; padding: 0; color: var(--text-muted); font-size: 12px; }

/* alerty MPK */
.alerts { list-style: none; margin: 8px 0 0; padding: 0; }
.alerts li { padding: 7px 0; border-top: 1px solid var(--hairline); font-size: 12.5px; line-height: 1.4; }
.alerts li:first-child { border-top: 0; }
.alerts a { color: var(--text-primary); text-decoration: none; }
.alerts a:hover { text-decoration: underline; }
.alert-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.alert-meta small { color: var(--text-muted); font-size: 11px; margin-left: 4px; }
.alert-more { text-align: left; }
.link-btn { font: inherit; font-size: 12px; background: none; border: 0; padding: 0; color: var(--tram); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.line-alerts { margin-top: 10px; border-top: 1px solid var(--hairline); padding-top: 8px; font-size: 12px; }
.line-alerts summary { cursor: pointer; color: var(--warning); font-weight: 600; }
.line-alerts .alerts li { font-size: 12px; }

/* Odra – mały kafelek */
.card-small { padding: 12px 14px; }
.river-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 8px; }
.river-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.river-value small { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-left: 3px; letter-spacing: 0; }
.river-trend { font-size: 11.5px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-left: 6px; }
.river-spark { position: relative; height: 34px; margin-top: 10px; }
.river-spark svg { display: block; width: 100%; height: 100%; }
.river-spark small { position: absolute; right: 0; top: -2px; font-size: 10px; color: var(--text-muted); }
.river-more { margin-top: 8px; font-size: 12px; }
.river-more summary { cursor: pointer; color: var(--text-muted); }
.river-more .stations { margin-top: 6px; }
.stations .st-sub { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }

/* karta tramwaju – dodatki */
.tc-back {
  flex: none; align-self: center; width: 26px; height: 32px; display: grid; place-items: center; margin-right: -4px;
  background: transparent; border: 0; border-radius: 7px; color: var(--text-secondary); cursor: pointer;
}
.tc-back:hover { background: #2a2a27; color: var(--text-primary); }
.tc-delay-tile b { font-size: 22px; }
.tc-stop-time { flex: none; font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 11.5px; }
.tc-stop-sched { flex: none; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 11px; }
.tc-stops .tc-stop-name[role="button"] { cursor: pointer; }
.tc-stops .tc-stop-name[role="button"]:hover { text-decoration: underline; }
.tc-meta { margin: 10px 0 0; padding-top: 9px; border-top: 1px solid var(--hairline); line-height: 1.45; font-size: 11.5px; color: var(--text-muted); }

/* karta przystanku */
.stop-card { width: 340px; }
.sc-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #e9e7df; color: #161615; }
.sc-name { color: var(--text-primary); font-size: 16px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.sc-fav {
  flex: none; align-self: flex-start; width: 30px; height: 30px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 7px; color: var(--text-muted); cursor: pointer;
}
.sc-fav:hover { background: #2a2a27; color: var(--text-primary); }
.sc-fav[aria-pressed="true"] { color: #f2c94c; }
.sc-tabs { display: flex; gap: 2px; margin-top: 12px; background: var(--surface-0); border-radius: 9px; padding: 3px; }
.sc-tabs button { flex: 1; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); background: transparent; border: 0; border-radius: 7px; padding: 6px; cursor: pointer; }
.sc-tabs button[aria-selected="true"] { background: #33332f; color: var(--text-primary); }
.sc-note { color: var(--text-muted); font-size: 12px; line-height: 1.45; margin: 10px 0 0; }
.sc-note:empty { display: none; }
.tt-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tt-pick[hidden] { display: none; }
.tt-pick button { font: inherit; font-size: 13px; font-weight: 600; color: var(--text-secondary); background: var(--surface-0); border: 1px solid var(--hairline); border-radius: 8px; padding: 6px 11px; cursor: pointer; }
.tt-pick button[aria-checked="true"] { background: var(--tram); border-color: var(--tram); color: #1a0d06; }
.tt-days button[aria-checked="true"] { background: #33332f; border-color: #4a4a44; color: var(--text-primary); }
.tt-dir { margin-top: 16px; }
.tt-dir h4 { color: var(--text-primary) !important; letter-spacing: 0 !important; text-transform: none !important; font-size: 14px !important; margin: 0 0 4px !important; }
.tt-grid { display: grid; font-variant-numeric: tabular-nums; }
.tt-row { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: baseline; padding: 7px 6px; margin: 0 -6px; border-top: 1px solid #232321; font-size: 15px; line-height: 1.3; }
.tt-grid > .tt-row:first-child { border-top-color: transparent; }
.tt-row b { color: var(--text-secondary); font-weight: 700; }
.tt-row span { display: flex; flex-wrap: wrap; gap: 3px 4px; }
.tt-row span > span { min-width: 32px; padding: 1px 6px; text-align: center; border-radius: 6px; color: var(--text-primary); }
.tt-row .is-past { color: #5c5b55 !important; }
.tt-row .is-next { color: #1a0d06 !important; background: var(--tram); font-weight: 700; }
.tt-row.is-now { background: rgba(255,255,255,.045); border-radius: 9px; border-top-color: transparent; }
.tt-row.is-now b { color: var(--text-primary); }
.tt-past > summary, .tt-depot > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; padding: 9px 0; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.tt-past > summary::-webkit-details-marker, .tt-depot > summary::-webkit-details-marker { display: none; }
.tt-past > summary::before, .tt-depot > summary::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin: 0 3px 0 2px; }
.tt-past[open] > summary::before, .tt-depot[open] > summary::before { transform: rotate(45deg); }
.tt-past > summary:hover, .tt-depot > summary:hover { color: var(--text-primary); }
.tt-depot { margin-top: 18px; border-top: 1px solid var(--hairline); }
.tt-end { margin: 8px 0 0; color: var(--text-muted); font-size: 12.5px; }

/* karta linii */
.line-card { width: 320px; }
.lc-ends { color: var(--text-primary); font-size: 15px; font-weight: 700; line-height: 1.25; }
.lc-sum { margin: 8px 0 0; color: var(--text-muted); font-size: 11.5px; }
.lc-trams li { justify-content: space-between; }
.lc-dir { margin-top: 10px; border-top: 1px solid var(--hairline); padding-top: 8px; }
.lc-dir summary { cursor: pointer; display: flex; justify-content: space-between; gap: 8px; color: var(--text-primary); font-weight: 600; }
.lc-dir summary small { color: var(--text-muted); font-weight: 400; font-size: 11px; white-space: nowrap; }
.lc-stops { list-style: none; margin: 6px 0 0; padding: 0 0 0 14px; position: relative; }
.lc-stops::before { content: ""; position: absolute; left: 4px; top: 7px; bottom: 7px; width: 2px; background: #4a2a1c; }
.lc-stops li { position: relative; padding: 2px 0; }
.lc-stops li::before { content: ""; position: absolute; left: -13px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--surface-0); box-shadow: 0 0 0 2px var(--tram); }
.lc-stops li[role="button"] { cursor: pointer; }
.lc-stops li[role="button"]:hover { color: var(--text-primary); text-decoration: underline; }

/* w pobliżu */
.near-btn {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 8px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--hairline); border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.near-btn:hover { color: var(--text-primary); background: #2a2a27; }
.near-btn:focus-visible { outline: 2px solid var(--tram); outline-offset: 1px; }
#near .empty { margin: 8px 0 0; line-height: 1.45; }

/* tablica przystanku: linia × kierunek */
.board { list-style: none; margin: 6px 0 0; padding: 0; }
.board-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 11px 8px; margin: 0 -8px; border-top: 1px solid var(--hairline); border-radius: 10px; }
.board-row:first-child { border-top-color: transparent; }
.board-row[role="button"] { cursor: pointer; }
.board-row[role="button"]:hover, .board-row[role="button"]:focus-visible { background: #20201e; outline: none; }
.board-row[role="button"]:focus-visible { box-shadow: inset 0 0 0 2px var(--tram); }
.board-row.is-depot { opacity: .62; }
.br-main { min-width: 0; }
.br-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.br-dir { color: var(--text-primary); font-size: 14.5px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.br-late { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); white-space: nowrap; }
.br-next { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; }
.br-when { display: grid; justify-items: end; padding-right: 15px; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; }
.br-when b { position: relative; color: var(--text-primary); font-size: 18px; font-weight: 700; }
.br-when .live-dot { position: absolute; left: 100%; top: 50%; margin: -3.5px 0 0 7px; }
.br-when small { margin-top: 2px; color: var(--text-muted); font-size: 12px; }

/* kierunek (peron) w karcie przystanku i w panelu */
.sc-dirs { margin-top: 10px; }
.sc-dir-one { display: block; color: var(--text-secondary); font-size: 13.5px; font-weight: 600; }
.sc-dir-now {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 12px;
  font: inherit; text-align: left; color: var(--text-primary); background: var(--surface-0); border: 1px solid var(--hairline); border-radius: 10px; cursor: pointer;
}
.sc-dir-now:hover { border-color: var(--text-muted); }
.sc-dir-now:focus-visible, .sc-dir:focus-visible { outline: 2px solid var(--tram); outline-offset: 1px; }
.sd-label { min-width: 0; font-size: 14px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.sd-change { flex: none; color: var(--tram); font-size: 12.5px; font-weight: 600; }
.sc-dir-list { display: grid; gap: 5px; margin-top: 6px; }
.sc-dir-list[hidden] { display: none; }
.sc-dir {
  font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; color: var(--text-secondary); cursor: pointer;
  background: var(--surface-0); border: 1px solid var(--hairline); border-radius: 9px; padding: 8px 12px;
}
.sc-dir:hover { color: var(--text-primary); border-color: var(--text-muted); }
.sc-dir[aria-checked="true"] { color: var(--text-primary); border-color: var(--tram); box-shadow: inset 0 0 0 1px var(--tram); }
.fav-name { display: grid; min-width: 0; }
.fav-name small { color: var(--text-muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ telefon (pionowo): jak aplikacja
   Mapa na cały ekran, pływająca wyszukiwarka, panel jako arkusz przeciągany palcem (3 wysokości), karty tramwaju,
   przystanku i linii jako arkusze od dołu, dolny pasek sekcji. Stan arkuszy ustawia skrypt (body.is-mobile). */
.m-top, .m-tabs, .m-fab, .sheet-grab, .sheet-sum, .card-grab, .m-back, .m-clear { display: none; }

@media (max-width: 820px) and (orientation: portrait) {
  :root {
    --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
    --top-h: calc(var(--safe-t) + 62px);           /* pas pływającej wyszukiwarki */
    --tabs-h: calc(58px + var(--safe-b));          /* dolny pasek */
    --ease-sheet: cubic-bezier(.2, .9, .25, 1);
  }
  html, body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
  body { position: fixed; inset: 0; overflow: hidden; -webkit-tap-highlight-color: transparent; }
  button, [role=button], a, summary, input { touch-action: manipulation; }
  #map { position: fixed; inset: 0; }
  .legend, .masthead, .near-btn, .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none !important; }
  /* Atrybucja OSM musi być widoczna – nad arkuszem, pod wyszukiwarką. */
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { top: calc(var(--top-h) + 2px); bottom: auto; }
  .maplibregl-ctrl-attrib.maplibregl-compact { margin: 0 8px; }

  /* pływająca wyszukiwarka */
  .m-top { display: block; position: fixed; z-index: 8; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 8px) 10px 8px;
    pointer-events: none; }
  .m-top::before { content: ""; position: absolute; inset: 0 0 -24px; background: linear-gradient(rgba(12,12,12,.72), rgba(12,12,12,0)); pointer-events: none; }
  .m-top .search { pointer-events: auto; margin: 0; }
  .m-top #search { height: 46px; border-radius: 23px; padding: 0 44px 0 42px; font-size: 16px; /* 16 px: iOS nie powiększa strony */
    background: rgba(31,31,29,.94); border: 1px solid rgba(255,255,255,.06); box-shadow: 0 6px 22px rgba(0,0,0,.5);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .m-top #search::-webkit-search-cancel-button { -webkit-appearance: none; display: none; } /* własny ✕ w polu */
  .m-top #search:focus { outline: none; border-color: rgba(235,104,52,.7); }
  .m-top .search-icon { left: 16px; width: 17px; height: 17px; z-index: 1; }
  .m-top .search-results { top: calc(100% + 8px); max-height: min(calc(var(--vvh, 100dvh) - var(--top-h) - 16px), 460px); border-radius: 16px; padding: 6px;
    background: rgba(28,28,26,.98); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  .m-top .search-results li { padding: 10px; font-size: 15px; border-radius: 10px; }
  .m-top .search-results li small { font-size: 12.5px; }
  body.is-searching .m-top { bottom: 0; background: rgba(12,12,12,.55); pointer-events: auto; }

  /* przycisk „moja lokalizacja” – nad arkuszem */
  .m-fab { display: grid; place-items: center; position: fixed; z-index: 5; right: 12px; width: 46px; height: 46px; border-radius: 15px;
    border: 1px solid rgba(255,255,255,.07); background: rgba(31,31,29,.94); color: var(--text-primary); box-shadow: 0 6px 18px rgba(0,0,0,.45);
    bottom: calc(var(--sheet-vis, 200px) + 12px); transition: bottom .38s var(--ease-sheet), opacity .2s, transform .15s; }
  .m-fab.is-on { color: #5aa2ff; }
  body.sheet-full .m-fab, body.has-card .m-fab, body.is-searching .m-fab { opacity: 0; pointer-events: none; }

  /* panel = arkusz */
  #panel { position: fixed; z-index: 4; left: 0; right: 0; top: var(--top-h); bottom: 0; width: auto; height: auto;
    border: 0; border-radius: 20px 20px 0 0; padding: 0 12px calc(var(--tabs-h) + 18px); background: var(--surface-1);
    box-shadow: 0 -10px 34px rgba(0,0,0,.55); overflow-y: hidden; overscroll-behavior: contain;
    transform: translate3d(0, var(--sheet-y, 70%), 0); transition: transform .38s var(--ease-sheet); will-change: transform; }
  body.sheet-full #panel { overflow-y: auto; }
  #panel.is-dragging, .tram-card.is-dragging { transition: none; }
  body.has-card #panel, body.is-searching #panel { transform: translate3d(0, 100%, 0); }
  .sheet-grab { display: grid; place-items: center; position: sticky; top: 0; z-index: 2; height: 24px; margin: 0 -12px;
    background: var(--surface-1); border-radius: 20px 20px 0 0; touch-action: none; cursor: grab; }
  .sheet-grab::before, .card-grab::before { content: ""; width: 38px; height: 5px; border-radius: 3px; background: #4a4a45; }
  .sheet-sum { display: block; margin: 0 4px 8px; font-size: 13px; color: var(--text-secondary); }
  .sheet-sum b { color: var(--text-primary); font-weight: 650; }
  #panel .card { margin-top: 10px; border-radius: 14px; }
  #panel .card:first-of-type { margin-top: 0; }
  /* sekcje wg dolnego paska */
  body[data-tab="map"] #near, body[data-tab="map"] #alerts,
  body[data-tab="favs"] #panel > :not(.sheet-grab):not(#favs),
  body[data-tab="near"] #panel > :not(.sheet-grab):not(#near),
  body[data-tab="alerts"] #panel > :not(.sheet-grab):not(#alerts) { display: none; }

  /* dolny pasek */
  .m-tabs { display: flex; position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; height: var(--tabs-h); padding-bottom: var(--safe-b);
    background: rgba(20,20,19,.92); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
    border-top: 1px solid rgba(255,255,255,.06); transition: transform .3s var(--ease-sheet); }
  body.has-card .m-tabs, body.is-searching .m-tabs { transform: translate3d(0, 105%, 0); }
  .m-tabs button { position: relative; flex: 1; display: grid; justify-items: center; align-content: center; gap: 3px; padding: 0;
    font: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: .01em; color: var(--text-muted); background: none; border: 0; }
  .m-tabs svg { width: 24px; height: 24px; }
  .m-tabs button[aria-current="page"] { color: var(--tram); }
  .m-tabs button:active svg { transform: scale(.88); }
  .m-tabs svg { transition: transform .12s; }
  .m-badge { position: absolute; top: 7px; left: calc(50% + 7px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--critical); color: #fff; font-size: 10px; font-style: normal; font-weight: 700; line-height: 16px; text-align: center; }

  /* karty → arkusze od dołu */
  .tram-card, .tram-card.stop-card, .tram-card.line-card { position: fixed; z-index: 7; left: 0; right: 0; top: auto; bottom: 0; width: auto;
    max-height: calc(100dvh - var(--top-h)); border: 0; border-radius: 20px 20px 0 0; padding: 0 16px calc(16px + var(--safe-b));
    background: #191917; box-shadow: 0 -10px 34px rgba(0,0,0,.55); overscroll-behavior: contain;
    transform: translate3d(0, var(--card-y, 0px), 0); transition: transform .34s var(--ease-sheet), max-height .34s var(--ease-sheet);
    animation: sheet-in .36s var(--ease-sheet); font-size: 13px; }
  .tram-card { overflow-y: auto; } /* zwinięta też się przewija (kółko myszy); dotykiem ruch w górę ją rozwija */
  .card-grab { display: grid; place-items: center; position: sticky; top: 0; z-index: 2; height: 22px; margin: 0 -16px 2px;
    background: inherit; touch-action: none; cursor: grab; }
  .tc-head { gap: 12px; }
  .tc-badge { min-width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }
  .tc-dir, .sc-name { font-size: 18px; }
  .tc-stats b { font-size: 19px; }
  .tc-follow { padding: 11px 16px; font-size: 14px; border-radius: 12px; }
  /* zwinięta karta tramwaju: najważniejsze na jeden rzut oka; rozwinięta – przystanki kursu, wykres, szczegóły */
  .is-tram:not(.is-expanded) :is(.tc-spark, h4, .tc-ends, .tc-meta, .tc-hint, .tc-alerts) { display: none; }
  .is-tram:not(.is-expanded) .tc-stops li:not(.tc-next) { display: none; }
  .tc-route { margin-top: 10px; padding-top: 10px; }
  .tc-more { min-height: 40px; padding: 0 10px; font-size: 13.5px; }
  .tc-foot { margin-top: 12px; }
  /* karta przystanku: odjazdy widać od razu, kierunek w jednej linii */
  .stop-card .sc-dir-now { min-height: 46px; padding: 9px 14px; border-radius: 12px; }
  .stop-card .sd-label { font-size: 15px; }
  .stop-card .sc-dir { padding: 12px 14px; font-size: 14.5px; border-radius: 12px; }
  .board-row { padding: 12px 8px; }
  .br-dir { font-size: 15px; }
  .stop-card:not(.is-expanded) { max-height: min(62dvh, calc(100dvh - var(--top-h))); }
  .line-card:not(.is-expanded) { max-height: 46dvh; }
  .sc-tabs { margin-top: 10px; }
  .sc-tabs button { padding: 9px 6px; font-size: 13.5px; }
  .tram-card.is-expanded { overflow-y: auto; }

  .tram-card.is-growing { overflow-y: hidden; transition: none; }
  .tram-card.no-anim { transition: none; animation: none; }
  /* Otwarte wyszukiwanie: lupa zamienia się w strzałkę „wstecz”, ✕ czyści tekst – oba w polu, pole ma pełną szerokość. */
  .m-back, .m-clear { display: grid; place-items: center; position: absolute; top: 0; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 23px;
    background: none; color: var(--text-primary); z-index: 1; opacity: 0; visibility: hidden; transition: opacity .15s; }
  .m-back { left: 0; }
  .m-clear { right: 0; color: var(--text-muted); }
  .m-top .search-icon { transition: opacity .15s; }
  body.is-searching .m-top .search-icon { opacity: 0; }
  body.is-searching .m-back, body.is-searching .search.has-text .m-clear { opacity: 1; visibility: visible; }
  :is(.m-back, .m-clear):active { background: rgba(255,255,255,.08); }

  /* dotyk: reakcja przycisków */
  :is(.tc-follow, .sc-dir, .sc-dir-now, .sc-tabs button, .tc-close, .tc-back, .sc-fav, .m-fab, .tb-cta):active { transform: scale(.96); }
  .board-row[role="button"]:active { background: #262624; }
  :is(.tc-follow, .sc-dir, .sc-dir-now, .sc-tabs button, .tc-close, .tc-back, .sc-fav) { transition: transform .12s, background-color .15s; }
}
/* Tablet pionowo: arkusze nie rozciągają się na całą szerokość. */
@media (min-width: 600px) and (max-width: 820px) and (orientation: portrait) {
  #panel, .tram-card, .tram-card.stop-card, .tram-card.line-card { left: calc(50% - 300px); right: calc(50% - 300px); }
  .m-top .search { max-width: 600px; margin: 0 auto; }
  .m-fab { right: calc(50% - 300px + 12px); }
}
@keyframes sheet-in { from { transform: translate3d(0, 100%, 0); } }

/* Telefon poziomo: karta przystanku zwięźle – odjazdy widać od razu. */
@media (max-height: 500px) and (min-width: 560px) and (orientation: landscape) {
  .stop-card .sc-dirs { margin-top: 8px; }
  .stop-card .sc-dir-now { min-height: 40px; }
  .board-row { padding: 8px; }
}

/* Start: dane torów jeszcze niedostępne (serwer wstaje) – mapa ruszy sama po połączeniu. */
#boot-note {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 100; margin: 0;
  padding: 10px 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--hairline);
  color: var(--text-secondary); font-size: 14px;
}
