/* ==========================================================================
   Zrozumiałość informacji pasażerskiej — system wizualny
   Świat: płynna szyba nad peronem. Szkło jest materiałem funkcjonalnym —
   rozmywa światło stacji, trzyma krawędź i odpowiada na dotyk.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;

  /* --- światło peronu: dzień, tablica odjazdów, zielona strzałka wyjścia --- */
  --field: #e2ebf5;
  --field-2: #d4e1ef;
  --bloom-sun: rgb(255 255 255 / 88%);
  --bloom-amber: rgb(255 168 28 / 28%);
  --bloom-emerald: rgb(16 190 133 / 22%);
  --bloom-sky: rgb(96 154 236 / 34%);
  --shaft: rgb(255 255 255 / 30%);
  --vignette: rgb(16 33 50 / 14%);
  --grain-opacity: 0.16;

  /* --- szkło --- */
  --glass: rgb(255 255 255 / 52%);
  --glass-strong: rgb(255 255 255 / 68%);
  --glass-soft: rgb(255 255 255 / 36%);
  --glass-well: rgb(255 255 255 / 26%);
  --glass-deep: rgb(255 255 255 / 16%);
  --well: rgb(11 20 32 / 5%);
  --well-2: rgb(11 20 32 / 9%);
  --rim-top: rgb(255 255 255 / 100%);
  --rim-bottom: rgb(255 255 255 / 26%);
  --edge: rgb(16 33 50 / 15%);
  --edge-strong: rgb(16 33 50 / 28%);
  --rim: inset 0 1px 0 var(--rim-top), inset 0 -1px 0 var(--rim-bottom),
    inset 0 -22px 34px -30px rgb(16 33 50 / 40%);
  --glass-filter: blur(28px) saturate(2.05) brightness(1.03);
  --glass-filter-soft: blur(16px) saturate(1.85) brightness(1.02);
  --sheen: rgb(255 255 255 / 78%);
  --pane-light: rgb(255 255 255 / 34%);
  --pane-light-2: rgb(255 255 255 / 15%);
  --lens-fill: rgb(255 255 255 / 86%);
  --lens-sheen: rgb(255 255 255 / 62%);
  --lens-shade: rgb(16 33 50 / 9%);
  --lens-edge: rgb(16 33 50 / 11%);

  /* --- atrament --- */
  --ink: #0b1420;
  --ink-2: #2f4055;
  --ink-3: #3b4a57;
  --ink-solid: #0b1420;
  --on-ink: #f5f8fb;
  --ink-glass: rgb(11 20 32 / 90%);

  /* --- sygnały: wyłącznie jakość informacji --- */
  --amber: #6f3b00;
  --amber-fill: #f5a524;
  --amber-tint: rgb(245 165 36 / 14%);
  --emerald: #034c32;
  --emerald-fill: #10b981;
  --emerald-tint: rgb(16 185 129 / 12%);
  --red: #8c1a10;
  --red-fill: #ef4444;
  --red-tint: rgb(239 68 68 / 12%);
  --slate: #64748b;
  --slate-tint: rgb(100 116 139 / 12%);

  /* Znacznik „tu jesteś” na mapie — pozycja, nie ocena. */
  --self: #0b57d0;

  /* Wypełnienia pasków i słupków: jaśniejsze od tekstu, ≥3:1 wobec tła. */
  --bar-low: #c0392b;
  --bar-mid: #c47a00;
  --bar-high: #0f7b57;

  --focus: #0b1420;
  --shadow-contact: 0 1px 2px rgb(11 20 32 / 8%);
  --shadow-float: 0 1px 1px rgb(11 20 32 / 4%), 0 18px 40px -22px rgb(11 20 32 / 30%),
    0 2px 8px -4px rgb(11 20 32 / 12%);
  --shadow-lift: 0 2px 6px rgb(11 20 32 / 7%), 0 44px 90px -46px rgb(11 20 32 / 48%);
  --shadow-dock: 0 1px 1px rgb(11 20 32 / 5%), 0 26px 60px -30px rgb(11 20 32 / 45%);

  /* Promienie: skala ciągła. Element zagnieżdżony w promieniu R i wsunięty o padding p
     dostaje R − p, żeby jego łuk był równoległy do łuku rodzica (patrz `.mini-map__chip`). */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-control: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* Odstępy: jedna siatka 4 px. Wartości 1–3 px i 9–11 px są optyczne (ikona ↔ tekst,
     hairline), nie rytmiczne — nie wchodzą do skali. */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;

  --tap: 48px;
  --shell: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --topbar-h: 64px;

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;

  /* Ruch: jedna skala czasu i trzy krzywe. Wbudowane `ease`/`ease-in-out` są zbyt słabe,
     a `ease-in` na interfejsie opóźnia dokładnie ten moment, na który patrzy użytkownik.
     Krzywe wg easing.dev; `--ease-drawer` to krzywa szuflady iOS (Ionic). */
  --dur-press: 120ms;
  --dur-micro: 160ms;
  --dur-hover: 180ms;
  --dur-pop: 220ms;
  --dur-route: 260ms;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --field: #071019;
  --field-2: #030910;
  --bloom-sun: rgb(150 198 246 / 22%);
  --bloom-amber: rgb(255 176 32 / 26%);
  --bloom-emerald: rgb(20 200 140 / 22%);
  --bloom-sky: rgb(76 132 214 / 36%);
  --shaft: rgb(168 206 255 / 12%);
  --vignette: rgb(0 0 0 / 55%);
  --grain-opacity: 0.24;

  --glass: rgb(24 40 57 / 60%);
  --glass-strong: rgb(22 38 55 / 80%);
  --glass-soft: rgb(19 32 47 / 40%);
  --glass-well: rgb(255 255 255 / 5%);
  --glass-deep: rgb(255 255 255 / 3%);
  --well: rgb(255 255 255 / 7%);
  --well-2: rgb(255 255 255 / 11%);
  --rim-top: rgb(255 255 255 / 24%);
  --rim-bottom: rgb(0 0 0 / 28%);
  --edge: rgb(255 255 255 / 13%);
  --edge-strong: rgb(255 255 255 / 26%);
  --glass-filter: blur(26px) saturate(1.55) brightness(1.14);
  --glass-filter-soft: blur(14px) saturate(1.45) brightness(1.1);
  --sheen: rgb(190 225 255 / 22%);
  --pane-light: rgb(226 240 255 / 10%);
  --pane-light-2: rgb(226 240 255 / 5%);
  --lens-fill: rgb(255 255 255 / 17%);
  --lens-sheen: rgb(255 255 255 / 9%);
  --lens-shade: rgb(0 0 0 / 24%);
  --lens-edge: rgb(255 255 255 / 18%);

  --ink: #f2f6fa;
  --ink-2: #c3d0dc;
  --ink-3: #b4c2d0;
  --ink-solid: #f2f6fa;
  --on-ink: #06101a;
  --ink-glass: rgb(242 246 250 / 92%);

  --amber: #ffb020;
  --amber-fill: #ffb020;
  --amber-tint: rgb(255 176 32 / 16%);
  --emerald: #3ddc97;
  --emerald-fill: #3ddc97;
  --emerald-tint: rgb(61 220 151 / 14%);
  --red: #ffa89d;
  --red-fill: #ff7a6b;
  --red-tint: rgb(255 122 107 / 14%);
  --slate: #8fa0b1;
  --slate-tint: rgb(143 160 177 / 14%);
  --self: #7cb2ff;
  --bar-low: #ff7a6b;
  --bar-mid: #ffb020;
  --bar-high: #3ddc97;

  --focus: #f2f6fa;
  --shadow-contact: 0 1px 2px rgb(0 0 0 / 45%);
  --shadow-float: 0 1px 1px rgb(0 0 0 / 38%), 0 22px 48px -24px rgb(0 0 0 / 72%),
    0 2px 10px -4px rgb(0 0 0 / 50%);
  --shadow-lift: 0 2px 8px rgb(0 0 0 / 45%), 0 52px 96px -48px rgb(0 0 0 / 85%);
  --shadow-dock: 0 1px 1px rgb(0 0 0 / 40%), 0 30px 64px -32px rgb(0 0 0 / 85%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

    --field: #071019;
    --field-2: #030910;
    --bloom-sun: rgb(150 198 246 / 22%);
    --bloom-amber: rgb(255 176 32 / 26%);
    --bloom-emerald: rgb(20 200 140 / 22%);
    --bloom-sky: rgb(76 132 214 / 36%);
    --shaft: rgb(168 206 255 / 12%);
    --vignette: rgb(0 0 0 / 55%);
    --grain-opacity: 0.24;

    --glass: rgb(24 40 57 / 60%);
    --glass-strong: rgb(22 38 55 / 80%);
    --glass-soft: rgb(19 32 47 / 40%);
    --glass-well: rgb(255 255 255 / 5%);
    --glass-deep: rgb(255 255 255 / 3%);
    --well: rgb(255 255 255 / 7%);
    --well-2: rgb(255 255 255 / 11%);
    --rim-top: rgb(255 255 255 / 24%);
    --rim-bottom: rgb(0 0 0 / 28%);
    --edge: rgb(255 255 255 / 13%);
    --edge-strong: rgb(255 255 255 / 26%);
    --glass-filter: blur(26px) saturate(1.55) brightness(1.14);
    --glass-filter-soft: blur(14px) saturate(1.45) brightness(1.1);
    --sheen: rgb(190 225 255 / 22%);
    --pane-light: rgb(226 240 255 / 10%);
    --pane-light-2: rgb(226 240 255 / 5%);
    --lens-fill: rgb(255 255 255 / 17%);
    --lens-sheen: rgb(255 255 255 / 9%);
    --lens-shade: rgb(0 0 0 / 24%);
    --lens-edge: rgb(255 255 255 / 18%);

    --ink: #f2f6fa;
    --ink-2: #c3d0dc;
    --ink-3: #b4c2d0;
    --ink-solid: #f2f6fa;
    --on-ink: #06101a;
    --ink-glass: rgb(242 246 250 / 92%);

    --amber: #ffb020;
    --amber-fill: #ffb020;
    --amber-tint: rgb(255 176 32 / 16%);
    --emerald: #3ddc97;
    --emerald-fill: #3ddc97;
    --emerald-tint: rgb(61 220 151 / 14%);
    --red: #ffa89d;
    --red-fill: #ff7a6b;
    --red-tint: rgb(255 122 107 / 14%);
    --slate: #8fa0b1;
    --slate-tint: rgb(143 160 177 / 14%);
    --self: #7cb2ff;
    --bar-low: #ff7a6b;
    --bar-mid: #ffb020;
    --bar-high: #3ddc97;

    --focus: #f2f6fa;
    --shadow-contact: 0 1px 2px rgb(0 0 0 / 45%);
    --shadow-float: 0 1px 1px rgb(0 0 0 / 38%), 0 22px 48px -24px rgb(0 0 0 / 72%),
      0 2px 10px -4px rgb(0 0 0 / 50%);
    --shadow-lift: 0 2px 8px rgb(0 0 0 / 45%), 0 52px 96px -48px rgb(0 0 0 / 85%);
    --shadow-dock: 0 1px 1px rgb(0 0 0 / 40%), 0 30px 64px -32px rgb(0 0 0 / 85%);
  }
}

/* ------------------------------- reset --------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: color-mix(in srgb, var(--ink) 30%, transparent) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--field);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: 'cv05' 1, 'ss03' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: 610;
  letter-spacing: -0.024em;
  line-height: 1.1;
  text-wrap: balance;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

::selection {
  background: color-mix(in srgb, var(--amber-fill) 62%, transparent);
  color: var(--ink);
}

input,
textarea {
  caret-color: var(--amber);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ------------------------------- światło ------------------------------- */

/* Warstwa, przez którą patrzy szkło: dzienne światło peronu, bursztyn tablicy
   odjazdów i zieleń strzałki wyjścia. To scena, nie paleta — kolory sygnałów
   nie przenoszą się na oceny. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(178deg, var(--field) 0%, var(--field-2) 62%, var(--field) 100%);
}

.ambient__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  will-change: transform;
}

.ambient__glow--sun {
  width: 62vmax;
  height: 62vmax;
  top: -34vmax;
  left: 8vw;
  background: radial-gradient(circle, var(--bloom-sun) 0%, transparent 66%);
  animation: drift-a 46s var(--ease-in-out) infinite alternate;
}

.ambient__glow--amber {
  width: 58vmax;
  height: 58vmax;
  top: 26vh;
  left: -20vmax;
  background: radial-gradient(circle, var(--bloom-amber) 0%, transparent 68%);
  animation: drift-b 38s var(--ease-in-out) infinite alternate;
}

.ambient__glow--emerald {
  width: 52vmax;
  height: 52vmax;
  right: -16vmax;
  bottom: -18vmax;
  background: radial-gradient(circle, var(--bloom-emerald) 0%, transparent 70%);
  animation: drift-c 52s var(--ease-in-out) infinite alternate;
}

.ambient__glow--sky {
  width: 70vmax;
  height: 70vmax;
  right: -22vmax;
  top: -18vmax;
  background: radial-gradient(circle, var(--bloom-sky) 0%, transparent 72%);
  animation: drift-a 60s var(--ease-in-out) infinite alternate-reverse;
}

/* Światło prześwitujące przez wiatę: pasy, które szkło faktycznie rozmywa. */
.ambient__shafts {
  position: absolute;
  inset: -30%;
  background:
    linear-gradient(104deg, transparent 26%, var(--shaft) 36%, transparent 47%),
    linear-gradient(104deg, transparent 58%, var(--shaft) 66%, transparent 75%);
  filter: blur(28px);
  opacity: 0.85;
}

.ambient::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, transparent 42%, var(--vignette) 100%);
}

.ambient__grain {
  position: absolute;
  inset: -20%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: var(--grain-opacity);
  mix-blend-mode: soft-light;
}

/* --------------------------- materiał: szkło --------------------------- */

/* Jeden przepis na szkło: wypełnienie, krawędź, rim light i cień z przesunięciem.
   Komponenty nadpisują tylko wypełnienie, promień i wagę cienia — nigdy fakturę. */
.panel,
.station-head,
.kpis,
.cat,
.success,
.notice,
.submitbar,
.mini-map,
.map-shell,
.map-legend,
.map-sheet,
.map-dialog__panel,
.field,
.textarea,
.btn--ghost,
.map-btn,
.topbar,
.tabbar,
.toast,
.skip {
  position: relative;
  background-color: var(--glass-fill, var(--glass));
  background-image:
    radial-gradient(120% 165% at 4% -30%, var(--pane-light) 0%, transparent 46%),
    radial-gradient(70% 110% at 97% -36%, var(--pane-light-2) 0%, transparent 58%);
  border: 1px solid var(--edge);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--rim), var(--shadow-float);
}

/* Podświetlenie za kursorem: gra świateł na powierzchni, nie ozdoba. */
.btn,
.iconbtn,
.tab,
.tabbar__item,
.scale__btn,
.map-btn,
.row,
[data-sheen] {
  --gx: 50%;
  --gy: -20%;
  --glow: 0;
  position: relative;
  isolation: isolate;
}

.btn::before,
.iconbtn::before,
.tab::before,
.tabbar__item::before,
.scale__btn::before,
.map-btn::before,
.row::before,
[data-sheen]::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(
    160px circle at var(--gx) var(--gy),
    var(--sheen) 0%,
    transparent 72%
  );
  opacity: var(--glow);
  transition: opacity var(--dur-hover) var(--ease-out);
  pointer-events: none;
}

@media (hover: hover) {
  .btn:hover,
  .iconbtn:hover,
  .scale__btn:hover,
  .map-btn:hover,
  .row:hover,
  [data-sheen]:hover {
    --glow: 0.55;
  }

  .btn:active,
  .scale__btn:active,
  .map-btn:active {
    --glow: 0.85;
  }
}

/* ------------------------------ utilities ------------------------------ */

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.skip {
  position: absolute;
  left: var(--s-4);
  top: 0;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  background: var(--ink-solid);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 600;
  /* `top` to właściwość układu — link wjeżdża transformacją, więc nie rusza layoutu. */
  transform: translateY(-140%);
  transition: transform var(--dur-pop) var(--ease-out);
}

.skip:focus {
  transform: translateY(16px);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
}

@keyframes drift-a {
  from {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(4%, 3%, 0) scale(1.08);
  }
}

@keyframes drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1.04);
  }
  to {
    transform: translate3d(6%, -4%, 0) scale(0.96);
  }
}

@keyframes drift-c {
  from {
    transform: translate3d(2%, 2%, 0) scale(0.98);
  }
  to {
    transform: translate3d(-5%, -3%, 0) scale(1.1);
  }
}
/* ------------------------------- chrome -------------------------------- */

/* Górna belka jest taflą zawieszoną nad treścią, nie paskiem przyklejonym
   do krawędzi ekranu — dlatego ma własny promień, margines i cień. */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(calc(var(--shell) + var(--gutter) * 2), calc(100% - 24px));
  height: var(--topbar-h);
  margin: 10px auto 0;
  padding: 0 8px 0 12px;
  --glass-fill: var(--glass-strong);
  border-radius: var(--r-pill);
  box-shadow: var(--rim), var(--shadow-float);
}

.mark {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  min-height: var(--tap);
  margin-left: -4px;
  padding-right: 6px;
  border-radius: var(--r-pill);
  position: relative;
  z-index: 1;
}

.mark:focus-visible {
  outline-offset: 4px;
}

.mark__plate {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--ink-solid);
  color: var(--on-ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.05em;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 28%), 0 6px 14px -8px rgb(11 20 32 / 55%);
}

.mark__body {
  display: grid;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}

.mark__name {
  font-size: 13px;
  font-weight: 640;
  letter-spacing: -0.014em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mark__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Segmentowany rail: soczewka pod aktywnym widokiem przesuwa się, zamiast
   zapalać się w nowym miejscu — to jedyny „morphing” w interfejsie. */
.tabs--top {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: var(--glass-deep);
  box-shadow: inset 0 1px 0 var(--rim-top), inset 0 -1px 0 var(--rim-bottom);
}

/* Soczewka: kropla szkła pod aktywnym widokiem. Materiał robią trzy rzeczy —
   górny blask, dolne przyciemnienie (grubość) i rim light. Ruch opisuje app.js. */
.tabs__lens,
.tabbar__lens {
  position: absolute;
  z-index: 0;
  border: 1px solid var(--lens-edge);
  border-radius: var(--r-pill);
  background-color: var(--lens-fill, var(--glass-strong));
  background-image:
    linear-gradient(180deg, var(--lens-sheen) 0%, transparent 58%, var(--lens-shade) 100%),
    radial-gradient(90% 150% at 26% -60%, var(--pane-light) 0%, transparent 62%);
  box-shadow:
    inset 0 1px 0 var(--rim-top),
    inset 0 -1px 0 var(--rim-bottom),
    inset 0 -12px 16px -14px var(--lens-shade),
    0 1px 2px rgb(11 20 32 / 7%),
    0 10px 22px -16px rgb(11 20 32 / 48%);
  pointer-events: none;
}

/* Blask zapala się na czas przejścia — szkło łapie światło, gdy się przesuwa. */
.tabs__lens::after,
.tabbar__lens::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(78% 130% at 50% -14%, var(--rim-top) 0%, transparent 74%);
  opacity: 0;
  transition: opacity var(--dur-pop) var(--ease-out);
}

.tabs--top.is-travelling .tabs__lens::after,
.tabbar.is-travelling .tabbar__lens::after {
  opacity: 0.55;
  transition-duration: var(--dur-press);
}

.tabs--top.is-travelling .tabs__lens,
.tabbar.is-travelling .tabbar__lens {
  will-change: transform;
}

.tabs__lens {
  top: 4px;
  bottom: 4px;
  left: 4px;
  /* 4 px wsunięcia z każdej strony + dwie 2 px przerwy między kolumnami. */
  width: calc((100% - 8px - 4px) / 3);
}

.tab {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  font-size: 13.5px;
  font-weight: 560;
  letter-spacing: -0.006em;
  color: var(--ink-2);
  transition: color var(--dur-hover) var(--ease-out), transform var(--dur-press) var(--ease-out);
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .tab:hover {
    color: var(--ink);
  }
}

.tab:active {
  transform: scale(0.97);
}

/* Etykieta celu zapala się dopiero, gdy soczewka jest w połowie drogi —
   inaczej napis wyprzedza kroplę szkła, która go wiezie. */
.tab[aria-current='page'] {
  color: var(--ink);
  font-weight: 620;
  transition-delay: 90ms, 0s;
}

.iconbtn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  margin-right: -2px;
  border-radius: 50%;
  color: var(--ink-2);
  background: var(--glass-deep);
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 var(--rim-top);
  transition: color var(--dur-hover) var(--ease-out),
    background-color var(--dur-hover) var(--ease-out),
    border-color var(--dur-hover) var(--ease-out), transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .iconbtn:hover {
    color: var(--ink);
    background: var(--glass-soft);
    border-color: var(--edge);
  }
}

.iconbtn:active {
  transform: scale(0.96);
}

.view {
  display: block;
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 44px) var(--gutter) calc(96px + env(safe-area-inset-bottom));
}

.route--enter {
  animation: routeIn var(--dur-route) var(--ease-out) backwards;
}

.tabbar {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translate(-50%, 14px);
  max-width: min(420px, calc(100vw - 28px));
  padding: 13px 18px;
  --glass-fill: var(--ink-glass);
  color: var(--on-ink);
  border-color: rgb(255 255 255 / 18%);
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.42;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%), var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  /* Wyjście jest krótsze niż wejście: system odpowiada szybciej, niż się zapowiada. */
  transition: opacity var(--dur-micro) var(--ease-out), transform var(--dur-hover) var(--ease-out);
}

.toast[data-show='true'] {
  opacity: 1;
  transform: translate(-50%, 0);
  transition: opacity var(--dur-pop) var(--ease-out), transform var(--dur-route) var(--ease-out);
}

.toast[data-kind='error'] {
  --glass-fill: color-mix(in srgb, var(--red) 88%, transparent);
  color: #fff;
  border-color: rgb(255 255 255 / 24%);
}

/* ----------------------------- typography ------------------------------ */

.page-head {
  display: grid;
  gap: var(--s-4);
  margin-bottom: clamp(24px, 4vw, 38px);
}

.page-head__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3) var(--s-6);
}

.page-title {
  max-width: 15ch;
  font-size: clamp(2rem, 5.4vw, 3.35rem);
  font-weight: 640;
  letter-spacing: -0.038em;
  line-height: 0.98;
}

.page-title--tight {
  max-width: 24ch;
  font-size: clamp(1.6rem, 4.4vw, 2.35rem);
  letter-spacing: -0.032em;
  line-height: 1.02;
}

.page-lede {
  max-width: 58ch;
  color: var(--ink-2);
  font-size: clamp(0.96rem, 1.6vw, 1.06rem);
  line-height: 1.52;
  text-wrap: pretty;
}

/* Proza pomocnicza w panelach i pod formularzami — jeden stopień zamiast lokalnych nadpisań. */
.page-lede--small {
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* Licznik nad listą jest szkłem w kropli: czyta się jak soczewka na tablicy. */
/* Licznik czeka w układzie, zanim przyjdą dane: `visibility`, nie `display`, żeby
   jego pojawienie się nie przesuwało listy pod nim (CLS przy zimnym wejściu). */
.readout--pending {
  visibility: hidden;
}

/* Pusty element nie ma linii, więc byłby o wiersz niższy od wypełnionego.
   Zero-width space daje mu tę samą wysokość co tekst, który dopiero przyjdzie. */
.readout--pending::before {
  content: 'B';
  font-size: 13px;
  font-weight: 700;
}

.readout {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  background: var(--glass-soft);
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-contact);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.readout b {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0;
}

/* Licznik stacji startuje z myślnikiem, zanim przyjdą dane. Rezerwacja szerokości
   typowej liczby i wyrównanie do prawej trzymają kapsułkę w miejscu po podmianie —
   inaczej rosnąca liczba zawija tytuł obok. */
#map-count {
  min-width: 4ch;
  text-align: right;
}

.helper {
  max-width: 62ch;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* ------------------------------ controls ------------------------------- */

.search {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Pusty slot nie może dokładać odstępu — lista stacji ma stać tuż pod polem. */
.search__slot:empty {
  display: none;
}

.field {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  padding: 0 8px 0 18px;
  --glass-fill: var(--glass-strong);
  border-color: var(--edge-strong);
  border-radius: var(--r-pill);
  transition: border-color var(--dur-hover) var(--ease-out), box-shadow var(--dur-hover) var(--ease-out);
}

.field:focus-within {
  border-color: var(--ink);
  box-shadow: var(--rim), 0 0 0 4px color-mix(in srgb, var(--ink) 14%, transparent),
    var(--shadow-float);
}

.field__icon {
  color: var(--ink-3);
}

.field input {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  border: 0;
  background: none;
  font-size: 16.5px;
  font-weight: 460;
  letter-spacing: -0.012em;
  outline: none;
}

.field input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

/* Własny przycisk czyszczenia; natywny „×” z WebKita dawałby drugi, niepasujący. */
.field input::-webkit-search-cancel-button,
.field input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.field__clear {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -2px;
  border-radius: 50%;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .field__clear:hover {
    background: var(--well);
    color: var(--ink);
  }
}

.field__clear:active {
  transform: scale(0.92);
}

/* Lokalizacja siedzi w kapsule pola jako jedna ikona — zamiast paska przycisków
   pod wyszukiwaniem, który spychał listę stacji o dwie linie. */
.field__gps {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink-2);
  background: var(--glass-soft);
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 var(--rim-top);
  transition: color var(--dur-hover) var(--ease-out),
    background-color var(--dur-hover) var(--ease-out),
    border-color var(--dur-hover) var(--ease-out), transform var(--dur-press) var(--ease-out);
}

.field__gps .icon {
  width: 19px;
  height: 19px;
}

@media (hover: hover) and (pointer: fine) {
  .field__gps:hover:not(:disabled) {
    color: var(--ink);
    border-color: var(--edge-strong);
  }
}

.field__gps:active:not(:disabled) {
  transform: scale(0.92);
}

.field__gps:disabled {
  opacity: 0.55;
  cursor: progress;
}

.field__gps[data-busy='true'] .icon {
  animation: pulse 1.1s infinite var(--ease-in-out);
}

/* Po ustaleniu pozycji ikona zostaje zapalona — sortowanie po odległości widać w polu. */
.field__gps[data-live='true'] {
  color: var(--ink);
  background: var(--well-2);
  border-color: var(--edge-strong);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: -0.008em;
  transition: background-color var(--dur-hover) var(--ease-out),
    border-color var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}

/* Odpowiedź na dotyk: 0.97 wystarcza, by palec poczuł, że interfejs usłyszał.
   Cień i obramowanie zmieniają się bez przejścia — to warstwa malowania, nie ruchu. */
.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background-color: var(--ink-glass);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 16%), transparent 46%,
      rgb(0 0 0 / 14%));
  color: var(--on-ink);
  -webkit-backdrop-filter: var(--glass-filter-soft);
  backdrop-filter: var(--glass-filter-soft);
  border-color: color-mix(in srgb, var(--ink) 30%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%), 0 1px 2px rgb(11 20 32 / 18%),
    0 16px 30px -18px rgb(11 20 32 / 55%);
}

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--ink-solid) 88%, var(--amber-fill));
  }
}

.btn--ghost {
  --glass-fill: var(--glass-soft);
  color: var(--ink);
  border-color: var(--edge);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-contact);
}

@media (hover: hover) and (pointer: fine) {
  .btn--ghost:hover:not(:disabled) {
    --glass-fill: var(--glass-strong);
    border-color: var(--edge-strong);
  }
}

.btn--block {
  width: 100%;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn[data-busy='true'] .icon {
  animation: pulse 1.1s infinite var(--ease-in-out);
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 48px;
  font-size: 13.5px;
  font-weight: 580;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink) 32%, transparent);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color var(--dur-micro) var(--ease-out), text-decoration-color var(--dur-micro) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .link:hover {
    color: var(--ink);
    text-decoration-color: currentColor;
  }
}

.link .icon {
  width: 16px;
  height: 16px;
}

.noscript {
  display: grid;
  gap: 10px;
  max-width: 52ch;
  margin: 40px auto;
  padding: 0 var(--gutter);
}

.noscript h1 {
  font-size: 22px;
}

.noscript p {
  color: var(--ink-2);
  font-size: 14.5px;
}

/* -------------------------------- board -------------------------------- */

.board {
  margin-top: 28px;
  border: 1px solid var(--edge);
  border-radius: var(--r-xl);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--rim), var(--shadow-float);
  overflow: hidden;
}

.board__head {
  display: grid;
  grid-template-columns: 1fr 148px 104px;
  gap: 16px;
  align-items: center;
  padding: var(--s-3) 28px var(--s-3) var(--s-5);
  background: var(--glass-deep);
  border-bottom: 1px solid var(--edge);
  color: var(--ink-3);
  box-shadow: inset 0 1px 0 var(--rim-top);
}

.board__head span:last-child {
  text-align: right;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 148px 104px;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: var(--s-3) 28px var(--s-3) var(--s-5);
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  transition: background-color var(--dur-hover) var(--ease-out);
}

.row:last-of-type {
  border-bottom: 0;
}

.row::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 1.5px solid var(--edge-strong);
  border-right: 1.5px solid var(--edge-strong);
  transform: translateY(-50%) rotate(45deg);
  transition: transform var(--dur-hover) var(--ease-out), border-color var(--dur-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  /* Tło i strzałka — bez animowanego cienia: wiersz jest najeżdżany dziesiątki razy
     dziennie, a `box-shadow` w przejściu to przemalowanie całej tafli na każdą klatkę. */
  .row:hover {
    background: var(--glass-soft);
  }

  .row:hover::after {
    border-color: var(--ink);
    transform: translate(2px, -50%) rotate(45deg);
  }
}

.row:focus-visible {
  outline-offset: -3px;
}

.row__name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.row__title {
  font-size: 16.5px;
  font-weight: 570;
  letter-spacing: -0.018em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
}

.row__type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.row__type::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--edge-strong);
}

.row__type--halt::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--edge-strong);
}

.row__score {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.row__dist {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row__dist--idle {
  color: var(--ink-3);
  font-weight: 500;
}

/* pasek ocen: cztery krople światła, jeden na kategorię */
.meter {
  display: flex;
  gap: 3px;
  flex: 1;
  min-width: 72px;
}

.meter span {
  position: relative;
  flex: 1;
  height: 10px;
  background: var(--well-2);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 2px rgb(11 20 32 / 12%);
  overflow: hidden;
}

.meter i {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: var(--fill, 0%);
  background-color: var(--bar, var(--slate));
  background-image: linear-gradient(180deg, rgb(255 255 255 / 42%), transparent 62%);
  border-radius: var(--r-pill);
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 12%);
}

.score {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 44px;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.score__num {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.028em;
  color: var(--tone, var(--ink));
}

.score__word {
  display: none;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.score--none .score__num {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.tone-low {
  --tone: var(--red);
  --bar: var(--bar-low);
}
.tone-mid {
  --tone: var(--amber);
  --bar: var(--bar-mid);
}
.tone-high {
  --tone: var(--emerald);
  --bar: var(--bar-high);
}
.tone-none {
  --tone: var(--slate);
  --bar: var(--slate);
}

.board__empty {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 34px 20px 38px;
  border-bottom: 1px solid var(--edge);
  max-width: 54ch;
}

.board__empty h3 {
  font-size: 17px;
}

.board__empty p {
  color: var(--ink-2);
  font-size: 14.5px;
}

.board__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px 16px;
  background: var(--glass-deep);
  box-shadow: inset 0 1px 0 var(--rim-top);
}

.board__count {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------- station ------------------------------- */

.station-head {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 26px);
  --glass-fill: var(--glass);
  border-radius: var(--r-xl);
}

.station-head__title {
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  font-weight: 640;
  letter-spacing: -0.034em;
  line-height: 1.03;
}

.station-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.station-head__meta b {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.station-head__score {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.station-head__id {
  display: grid;
  gap: 16px;
  align-content: start;
}

.station-head__text {
  display: grid;
  gap: 10px;
}

/* Bez ocen nie ma czego ustawiać w rząd — blok mówi po jednym zdaniu w kolumnie. */
.station-head__score--empty {
  display: grid;
  align-content: start;
  gap: 2px;
  max-width: 36ch;
}

.station-head__score--empty .helper {
  margin-top: 8px;
}

/* Soczewka oceny: cyfra siedzi w kropli szkła zabarwionej progiem.
   To jedyne miejsce, w którym kolor progu ma prawo świecić. */
.big-score {
  display: grid;
  place-items: center;
  width: clamp(100px, 24vw, 122px);
  aspect-ratio: 1;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 18%, rgb(255 255 255 / 88%) 0%, transparent 46%),
    radial-gradient(circle at 50% 124%, color-mix(in srgb, var(--tone, var(--ink)) 30%, transparent) 0%,
      transparent 64%),
    var(--glass-well);
  -webkit-backdrop-filter: var(--glass-filter-soft);
  backdrop-filter: var(--glass-filter-soft);
  box-shadow: inset 0 1px 0 var(--rim-top), inset 0 -10px 22px -16px rgb(11 20 32 / 30%),
    var(--shadow-contact);
  font-family: var(--font-mono);
  font-size: clamp(2.1rem, 5.6vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--ink));
}

.station-head__figure {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.head-empty {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.012em;
  color: var(--ink-3);
}

.head-meter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.head-meter .meter {
  flex: none;
  width: 168px;
}

.head-meter__word {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tone, var(--ink-3));
}

.station-head__legend {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

/* Wiersz legendy prowadzi kropkowana linia jak w papierowym rozkładzie. */
.legend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.legend-row::after {
  content: '';
  order: 2;
  align-self: end;
  margin-bottom: 4px;
  border-bottom: 1px dotted color-mix(in srgb, var(--ink) 26%, transparent);
}

.legend-row b {
  order: 3;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------- minimapa ------------------------------ */

/* Podgląd położenia stacji w nagłówku karty. Cała płytka jest przyciskiem
   powiększenia, więc nie ma drugiego, mniejszego celu do trafienia. */
.mini-map {
  height: clamp(132px, 24vw, 176px);
  overflow: hidden;
  --glass-fill: var(--glass-soft);
  border-radius: var(--r-md);
  box-shadow: var(--rim), var(--shadow-contact);
}

.mini-map__canvas {
  position: absolute;
  inset: 0;
  /* Własny kontekst stosu: panele Leafleta mają z-index 200–800 i bez tego
     przykrywają przycisk powiększenia oraz podpis źródła kafelków. */
  z-index: 0;
  background: var(--well);
}

/* Podgląd nie reaguje na gesty — pan i zoom są w powiększeniu. */
.mini-map__canvas.leaflet-container {
  background: var(--well);
  font-family: var(--font-sans);
  pointer-events: none;
}

.mini-map__open {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  background: transparent;
}

.mini-map__chip {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-filter-soft);
  backdrop-filter: var(--glass-filter-soft);
  border: 1px solid var(--edge);
  /* Promień współśrodkowy: 18 px płytki − 10 px wsunięcia = 8 px, więc łuk chipu
     biegnie równolegle do łuku minimapy. */
  border-radius: calc(var(--r-md) - 10px);
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-contact);
  color: var(--ink);
  transition: background-color var(--dur-hover) var(--ease-out), color var(--dur-hover) var(--ease-out),
    border-color var(--dur-hover) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}

.mini-map__chip .icon {
  width: 16px;
  height: 16px;
}

.mini-map__open:focus-visible .mini-map__chip {
  background: var(--ink-glass);
  border-color: transparent;
  color: var(--on-ink);
  transform: scale(1.04);
}

@media (hover: hover) and (pointer: fine) {
  .mini-map__open:hover .mini-map__chip {
    background: var(--ink-glass);
    border-color: transparent;
    color: var(--on-ink);
    transform: scale(1.04);
  }
}

/* Obrys przycisku rysujemy na płytce — outline samego przycisku ucina overflow. */
.mini-map__open:focus-visible {
  outline: none;
}

.mini-map:has(.mini-map__open:focus-visible) {
  border-color: var(--edge-strong);
}

@media (hover: hover) and (pointer: fine) {
  .mini-map:has(.mini-map__open:hover) {
    border-color: var(--edge-strong);
  }
}

.mini-map:has(.mini-map__open:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.mini-map__credit {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 3;
  padding: 3px 7px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-filter-soft);
  backdrop-filter: var(--glass-filter-soft);
  border: 1px solid var(--edge);
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  pointer-events: none;
}

/* Bez Leafleta nie ma czego powiększać — podgląd mówi to wprost. */
.mini-map--failed .mini-map__canvas {
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-2);
}

.mini-map--failed .mini-map__open,
.mini-map--failed .mini-map__credit {
  display: none;
}

/* -------------------------------- panels ------------------------------- */

.stack {
  display: grid;
  gap: clamp(16px, 2.6vw, 22px);
}

.panel {
  padding: clamp(18px, 3vw, 24px);
  --glass-fill: var(--glass);
  border-radius: var(--r-lg);
}

.panel--flush {
  padding: 0;
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel__title {
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: -0.018em;
}

.panel__note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Panel bez wewnętrznego paddingu (np. lista ankiet) trzyma własny rytm nagłówka. */
.panel__head--flush {
  padding: 18px 18px 0;
  margin-bottom: 10px;
}

/* Stan pusty w panelu: mówi, czego brakuje, i podaje drogę wyjścia. */
.panel__empty {
  display: grid;
  justify-items: start;
  gap: 4px;
  max-width: 46ch;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.5;
}

.panel--flush .panel__empty {
  padding: 0 18px 18px;
}

.form-grid {
  display: grid;
  gap: clamp(18px, 3vw, 28px);
}

/* ------------------------------ categories ----------------------------- */

.cats {
  display: grid;
  gap: 10px;
}

.cat {
  display: grid;
  gap: 12px;
  padding: clamp(16px, 3vw, 20px);
  --glass-fill: var(--glass-soft);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--rim-top), 0 14px 28px -26px rgb(11 20 32 / 50%);
}

.cat__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.cat__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: 1px;
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  background: var(--glass-well);
  box-shadow: inset 0 1px 0 var(--rim-top);
  color: var(--ink-2);
}

.cat__icon .icon {
  width: 18px;
  height: 18px;
}

.cat__title {
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: -0.016em;
}

.cat__hint {
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.42;
  color: var(--ink-3);
  max-width: 48ch;
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.scale__btn {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-height: 52px;
  border: 1px solid var(--edge);
  border-radius: var(--r-control);
  background: var(--cell-tint, var(--glass-well));
  box-shadow: inset 0 1px 0 var(--rim-top), inset 0 -1px 0 var(--rim-bottom);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out),
    border-color var(--dur-micro) var(--ease-out), transform var(--dur-press) var(--ease-out);
}

.scale__num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.scale__word {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.1;
  text-align: center;
}

/* Skala nie ma własnej palety: komórka 1–2 bierze próg „do poprawy”, 3 „przeciętnie”,
   4–5 „czytelnie” — te same trzy kolory co pasek i pinezka mapy. Tła stonowane,
   a tekst na nich trzyma ≥7:1 w obu motywach. */
.scale__btn[data-value='1'],
.scale__btn[data-value='2'] {
  --cell-tint: color-mix(in srgb, var(--red) 10%, var(--glass-deep));
}

.scale__btn[data-value='3'] {
  --cell-tint: color-mix(in srgb, var(--amber) 12%, var(--glass-deep));
}

.scale__btn[data-value='4'],
.scale__btn[data-value='5'] {
  --cell-tint: color-mix(in srgb, var(--emerald) 10%, var(--glass-deep));
}

@media (hover: hover) and (pointer: fine) {
  .scale__btn:hover {
    border-color: var(--edge-strong);
    background: color-mix(in srgb, var(--cell-tint, var(--glass-well)) 72%, var(--glass-strong));
  }

  .scale__btn:hover .scale__word {
    color: var(--ink);
  }
}

.scale__btn:active {
  transform: scale(0.97);
}

.scale__btn[aria-checked='true'] {
  background: var(--ink-glass);
  border-color: color-mix(in srgb, var(--ink) 40%, transparent);
  color: var(--on-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 34%), 0 12px 24px -16px rgb(11 20 32 / 65%);
}

.scale__btn[aria-checked='true'] .scale__word {
  color: color-mix(in srgb, var(--on-ink) 76%, transparent);
}

.cat__value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 20px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.cat__value b {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-transform: uppercase;
}

/* ------------------------------- comment ------------------------------- */

.field-block {
  display: grid;
  gap: 8px;
}

.textarea {
  width: 100%;
  min-height: 104px;
  padding: 14px 16px;
  --glass-fill: var(--glass-soft);
  border-color: var(--edge-strong);
  border-radius: var(--r-md);
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--dur-hover) var(--ease-out), box-shadow var(--dur-hover) var(--ease-out);
}

.textarea::placeholder {
  color: var(--ink-3);
}

.textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: var(--rim), 0 0 0 4px color-mix(in srgb, var(--ink) 14%, transparent);
}

.field-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
}

.counter {
  font-variant-numeric: tabular-nums;
}

.counter[data-over='true'] {
  color: var(--red);
  font-weight: 600;
}

/* --------------------------- pytania dodatkowe -------------------------- */

.qs {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.q {
  display: grid;
  gap: 8px;
}

.q__label {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-2);
}

.q__opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 6px;
}

/* Radio leży pod etykietą: klawiatura i czytnik dostają natywną grupę, oko — chip. */
.opt {
  position: relative;
  display: flex;
  min-width: 0;
}

.opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.opt__text {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--r-sm);
  background: var(--glass-well);
  box-shadow: inset 0 1px 0 var(--rim-top);
  font-size: 13px;
  line-height: 1.32;
  text-align: center;
  color: var(--ink-2);
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out),
    border-color var(--dur-micro) var(--ease-out), transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .opt:hover .opt__text {
    border-color: var(--edge-strong);
    color: var(--ink);
  }
}

.opt input:active + .opt__text {
  transform: scale(0.98);
}

.opt input:checked + .opt__text {
  background: var(--ink-glass);
  border-color: color-mix(in srgb, var(--ink) 40%, transparent);
  color: var(--on-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 34%);
}

/* Ukryte radio nie narysuje pierścienia, więc fokus idzie na widoczny chip. */
.opt input:focus-visible + .opt__text {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* ------------------------------- submit -------------------------------- */

.submitbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px 12px 18px;
  --glass-fill: var(--glass-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--rim), var(--shadow-float);
}

.submitbar__score {
  display: flex;
  align-items: center;
  gap: 12px;
}

.submitbar__num {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--ink));
  transition: color var(--dur-hover) var(--ease-out);
}

.submitbar__meta {
  display: grid;
  gap: 1px;
}

.submitbar__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.submitbar__word {
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-2);
}

.submitbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* ------------------------------- reviews ------------------------------- */

.review {
  display: grid;
  gap: 8px;
  padding: 15px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  transition: background-color var(--dur-hover) var(--ease-out);
}

.review:last-child {
  border-bottom: 0;
}

@media (hover: hover) {
  .review:hover {
    background: var(--glass-well);
  }
}

.review__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review__when {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.review__scores {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.review__scores b {
  color: var(--ink);
  font-weight: 600;
}
/* -------------------------------- stats -------------------------------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  --glass-fill: var(--glass);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.kpi {
  display: grid;
  gap: 6px;
  padding: clamp(16px, 3vw, 24px);
  border-right: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  box-shadow: inset 0 1px 0 var(--rim-top);
}

.kpi:nth-child(2n) {
  border-right: 0;
}

.kpi__num {
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 4.4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--tone, var(--ink));
  font-variant-numeric: tabular-nums;
}

.kpi__num small {
  font-size: 0.45em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-3);
  margin-left: 4px;
}

.kpi__label {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.35;
}

/* --- statystyki: siatka paneli w dwóch równych kolumnach --- */

.stats-grid {
  display: grid;
  gap: clamp(16px, 2.6vw, 22px);
}

/* --- statystyki: notki i legenda pod wykresami --- */

.chart-note {
  margin-top: 14px;
  max-width: 64ch;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
  text-wrap: pretty;
}

.method {
  display: grid;
  gap: 12px;
}

.chart-note--strong {
  font-size: 13px;
  color: var(--ink-2);
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.chart-note--foot {
  max-width: 72ch;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
}

/* --- trend: słupki ankiet i linia średniej w jednej osi tygodni --- */

.trend {
  display: grid;
  gap: 12px;
}

.trend__block {
  display: grid;
  gap: 8px;
}

.trend__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.trend__note {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trend__plot {
  display: grid;
  grid-template-columns: repeat(var(--cols, 12), minmax(0, 1fr));
  align-items: end;
  gap: clamp(4px, 1.2vw, 10px);
  height: 96px;
  border-bottom: 1px solid var(--edge-strong);
}

.trend__cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  height: 100%;
}

.trend__value {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.trend__value.is-zero {
  font-weight: 500;
  color: var(--ink-3);
}

.trend__bar {
  width: 100%;
  max-width: 40px;
  background-color: var(--ink-2);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 34%), transparent 58%);
  border-radius: var(--r-xs) var(--r-xs) 2px 2px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%);
  transform-origin: bottom;
  animation: grow var(--dur-route) var(--ease-out) both;
}

/* Cztery–sześć tygodni to nie dwanaście kolumn: słupek może być szerszy, żeby nie wisiał w pustce. */
.trend--sparse .trend__bar {
  max-width: 96px;
}

.trend__plot--line {
  position: relative;
  height: 58px;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
}

.trend__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.trend__svg polyline {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.trend__dot {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: 0 0 -4.5px -4.5px;
  border-radius: 50%;
  background: var(--bar, var(--slate));
  box-shadow: 0 0 0 2px var(--glass-strong), inset 0 1px 0 rgb(255 255 255 / 45%);
}

.trend__threshold {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(58px * 0.75);
  border-top: 1px dashed var(--edge-strong);
}

.trend__mark {
  position: absolute;
  right: 0;
  top: 0;
  padding: 1px 0 1px 8px;
  background: var(--glass-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
  transform: translateY(-50%);
}

.trend__x {
  display: grid;
  grid-template-columns: repeat(var(--cols, 12), minmax(0, 1fr));
  gap: clamp(4px, 1.2vw, 10px);
  margin-top: -4px;
}

.trend__x span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- rozkład ocen: histogram z liczbą nad słupkiem --- */

.hist {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(8px, 2.4vw, 20px);
  align-items: end;
}

.hist__col {
  display: grid;
  gap: 10px;
}

.hist__stack {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 160px;
  border-bottom: 1px solid var(--edge-strong);
}

.hist__count {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.hist__count.is-zero {
  font-weight: 500;
  color: var(--ink-3);
}

.hist__bar {
  width: 100%;
  background-color: var(--bar, var(--slate));
  background-image: linear-gradient(180deg, rgb(255 255 255 / 34%), transparent 58%);
  border-radius: var(--r-xs) var(--r-xs) 2px 2px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%);
  transform-origin: bottom;
  animation: grow var(--dur-route) var(--ease-out) both;
}

.hist__bar.is-zero {
  background-color: var(--well-2);
  background-image: none;
  box-shadow: none;
}

.hist__x {
  display: grid;
  gap: 2px;
  justify-items: center;
}

.hist__x b {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.hist__x span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* --- pasek trzech progów pod histogramem --- */

.bands {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.bands__bar {
  display: flex;
  gap: 2px;
  height: 10px;
  overflow: hidden;
  padding: 0;
  background: var(--well-2);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 2px rgb(11 20 32 / 12%);
}

.bands__seg {
  flex: var(--w, 0) 1 0%;
  background: var(--bar, var(--slate));
  background-image: linear-gradient(180deg, rgb(255 255 255 / 32%), transparent 60%);
}

.bands__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.bands__item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
}

.bands__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bar, var(--slate));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 45%);
  flex: none;
}

.bands__range {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}

.bands__pct {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.bands__count {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* --- cztery kanały: udział progów w każdym kanale --- */

.cats-chart {
  display: grid;
  gap: 14px;
}

.cats-chart__head {
  display: grid;
  grid-template-columns: minmax(76px, 108px) 1fr 52px;
  gap: 14px;
  align-items: center;
}

.cats-chart__keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.cats-chart__key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.cats-chart__key i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--bar, var(--slate));
}

.cats-chart__avg-label {
  text-align: right;
}

.cats-chart__row {
  display: grid;
  grid-template-columns: minmax(76px, 108px) 1fr 52px;
  gap: 14px;
  align-items: center;
}

.cats-chart__name {
  font-size: 13.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cats-chart__bar {
  display: flex;
  gap: 2px;
  height: 14px;
  overflow: hidden;
  padding: 0;
  background: var(--well-2);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 2px rgb(11 20 32 / 12%);
}

.cats-chart__bar i {
  flex: var(--w, 0) 1 0%;
  background: var(--bar, var(--slate));
  background-image: linear-gradient(180deg, rgb(255 255 255 / 30%), transparent 62%);
}

.cats-chart__empty {
  width: 100%;
  height: 100%;
  background: var(--well);
}

.cats-chart__avg {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: right;
  color: var(--tone, var(--ink));
  font-variant-numeric: tabular-nums;
}

/* --- pokrycie badania --- */

.coverage__lead {
  font-size: 13px;
  color: var(--ink-2);
}

.coverage__lead b {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.coverage__bar {
  display: flex;
  height: 10px;
  margin-top: 10px;
  overflow: hidden;
  background: var(--well-2);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 2px rgb(11 20 32 / 12%);
}

.coverage__seg {
  display: block;
  height: 100%;
  min-width: 2px;
}

.coverage__seg--ready {
  background: var(--ink);
}

.coverage__seg--thin {
  background: color-mix(in srgb, var(--ink) 42%, transparent);
}

.coverage__seg--none {
  background: var(--well-2);
}

.coverage__legend {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.coverage__legend li {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  gap: 9px;
  align-items: center;
  font-size: 12.5px;
  color: var(--ink-2);
}

.coverage__legend b {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.coverage__dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--well-2);
}

.coverage__dot--ready {
  background: var(--ink);
}

.coverage__dot--thin {
  background: color-mix(in srgb, var(--ink) 42%, transparent);
}

.coverage__dot--none {
  background: var(--well-2);
  box-shadow: inset 0 0 0 1px var(--edge-strong);
}

.coverage__need {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}

.coverage__need b {
  font-weight: 620;
  color: var(--ink);
}

.kinds {
  display: grid;
  gap: 2px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
}

.kinds__head,
.kinds__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 58px;
  gap: 10px;
  align-items: baseline;
}

.kinds__head {
  margin-bottom: 4px;
}

/* Nagłówki kolumn liczbowych muszą zmieścić się nad 58 px, więc ciaśniej niż `.label`. */
.kinds__head .label {
  letter-spacing: 0.06em;
}

.kinds__head span:not(:first-child) {
  text-align: right;
}

.kinds__row {
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--ink-2);
}

.kinds__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kinds__count {
  margin-left: 6px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.kinds__avg,
.kinds__n {
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kinds__avg {
  color: var(--tone, var(--ink));
}

/* --- kanały w kontraście --- */

.splits {
  display: grid;
  gap: 16px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  min-height: 48px;
  padding: 2px 0;
}

.split__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.split__name {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 560;
  letter-spacing: -0.012em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .split:hover .split__name {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }
}

.split__spread {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Pasek czterech kanałów trzyma szerokość z karty stacji — rozciągnięty na cały
   panel czyta się jak jedna poprzerywana belka, nie jak cztery osobne oceny. */
.split__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.split .meter {
  flex: 0 0 168px;
  width: 168px;
  min-width: 0;
}

.split__meta {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* --- rankingi --- */

.rank {
  display: grid;
}

.rank__item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  min-height: 56px;
  padding: 11px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
}

.rank__item:last-child {
  border-bottom: 0;
}

.rank__pos {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.rank__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.rank__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.rank__name {
  min-width: 0;
  font-size: 14px;
  font-weight: 540;
  letter-spacing: -0.012em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank__score {
  flex: none;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--tone, var(--ink));
  font-variant-numeric: tabular-nums;
}

.rank__under {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.rank__bar {
  height: 6px;
  overflow: hidden;
  background: var(--well-2);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 2px rgb(11 20 32 / 12%);
}

.rank__bar i {
  display: block;
  width: var(--w, 0%);
  height: 100%;
  background-color: var(--bar, var(--slate));
  background-image: linear-gradient(180deg, rgb(255 255 255 / 34%), transparent 60%);
  border-radius: var(--r-pill);
}

.rank__votes {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------- map --------------------------------- */

.map-view {
  display: grid;
  gap: 10px;
}

.map-view__head .page-head {
  margin-bottom: 14px;
}

/* Mapa leży pod taflą szkła: krawędź świeci, a kafelki pozostają nietknięte. */
.map-shell {
  height: clamp(380px, 62dvh, 700px);
  --glass-fill: var(--glass-soft);
  border-radius: var(--r-xl);
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Leaflet dokłada swój styles.css po naszym, a `.leaflet-container` ma tam tło #ddd.
   Id w selektorze wygrywa niezależnie od kolejności arkuszy — inaczej podczas
   wczytywania kafelków przez mapę prześwituje jasnoszare pole. */
#map.leaflet-container {
  background: var(--well);
  font-family: var(--font-sans);
}

/* Positron jest już stonowany i ma osobną wersję ciemną — żaden filtr nie jest potrzebny. */

.leaflet-control-attribution {
  font-family: var(--font-mono);
  font-size: 9px !important;
  background: color-mix(in srgb, var(--glass-strong) 92%, transparent) !important;
  color: var(--ink-3) !important;
  border-radius: var(--r-xs) 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--ink-2) !important;
}

.leaflet-bar {
  border: 1px solid var(--edge) !important;
  border-radius: var(--r-control) !important;
  overflow: hidden;
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-contact) !important;
}

.leaflet-bar a {
  width: 48px !important;
  height: 48px !important;
  line-height: 48px !important;
  background: var(--glass-strong) !important;
  -webkit-backdrop-filter: var(--glass-filter-soft);
  backdrop-filter: var(--glass-filter-soft);
  color: var(--ink) !important;
  border-color: var(--edge) !important;
  font-size: 20px !important;
}

@media (hover: hover) and (pointer: fine) {
  .leaflet-bar a:hover {
    background: var(--glass-well) !important;
  }
}

.map-legend {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 500;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  --glass-fill: var(--glass-strong);
  border-radius: var(--r-md);
  box-shadow: var(--rim), var(--shadow-contact);
}

.map-legend__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bar, var(--slate));
  box-shadow: 0 0 0 2px var(--glass-strong), inset 0 1px 0 rgb(255 255 255 / 45%);
  flex: none;
}

.map-tools {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 500;
  display: grid;
  gap: 8px;
}

.map-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  --glass-fill: var(--glass-strong);
  border-radius: var(--r-control);
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-contact);
  color: var(--ink);
}

.map-btn[data-busy='true'] .icon {
  animation: pulse 1.1s infinite var(--ease-in-out);
}

.pin-hit {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
}

/* Pinezka to kropla szkła z kolorem progu w środku — nie plastikowy marker. */
.pin {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--tone, var(--slate));
  border: 2px solid var(--glass-strong);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 45%), 0 1px 4px rgb(0 0 0 / 38%);
}

.pin--self {
  background: var(--self);
}

.cluster-wrap {
  background: none;
  border: 0;
}

.cluster {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-filter-soft);
  backdrop-filter: var(--glass-filter-soft);
  color: var(--ink);
  border: 1px solid var(--edge-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-float);
}

.map-sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  display: grid;
  gap: var(--s-3);
  padding: var(--s-4);
  --glass-fill: var(--glass-strong);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-lift);
  /* Wejście przez `@starting-style`, wyjście przez `[data-state]` — przejście daje się
     przerwać w połowie, więc klik w kolejną pinezkę przejmuje kartę, zamiast ją restartować. */
  transform: translateY(0) scale(1);
  transition: opacity var(--dur-pop) var(--ease-out), transform var(--dur-route) var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.map-sheet[data-state='closed'] {
  opacity: 0;
  transform: translateY(8px) scale(0.99);
  pointer-events: none;
  transition-duration: var(--dur-micro);
}

.map-sheet[hidden] {
  display: none;
}

.map-sheet__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.map-sheet__name {
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -0.022em;
  line-height: 1.2;
}

.map-sheet__meta {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.map-sheet__close {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: -10px -10px 0 0;
  border-radius: 50%;
  color: var(--ink-3);
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}

.map-sheet__close .icon {
  width: 18px;
  height: 18px;
}

@media (hover: hover) and (pointer: fine) {
  .map-sheet__close:hover {
    background: var(--well);
    color: var(--ink);
  }
}

.map-sheet__close:active {
  transform: scale(0.92);
}

.map-sheet__body {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.map-sheet__score {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--ink));
}

.map-sheet__word {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.map-sheet__legend {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.map-sheet__foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.map-sheet__foot .btn {
  width: 100%;
}

.map-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-top: 12px;
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  background: var(--glass-soft);
  box-shadow: inset 0 1px 0 var(--rim-top);
  color: var(--ink-2);
  font-size: 12.5px;
}

[hidden] {
  display: none !important;
}

.form-grid > .success {
  grid-column: 1 / -1;
}

#gps-slot:not(:empty) {
  margin-top: 12px;
}

/* --------------------------- powiększenie mapy -------------------------- */

html.map-dialog-open {
  overflow: hidden;
}

.map-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 32px);
  opacity: 1;
  transition: opacity var(--dur-pop) var(--ease-out);

  @starting-style {
    opacity: 0;
  }
}

.map-dialog[data-state='closed'] {
  opacity: 0;
  pointer-events: none;
  transition-duration: var(--dur-micro);
}

.map-dialog__scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--field-2) 62%, transparent);
  -webkit-backdrop-filter: blur(6px) saturate(1.2);
  backdrop-filter: blur(6px) saturate(1.2);
}

.map-dialog__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 880px);
  max-height: 100%;
  overflow: hidden;
  --glass-fill: var(--glass-strong);
  border-radius: var(--r-xl);
  box-shadow: inset 0 1px 0 var(--rim-top), var(--shadow-lift);
  /* Modal zostaje wyśrodkowany, więc rośnie z własnego środka — inaczej niż popover. */
  transform: translateY(0) scale(1);
  transition: transform var(--dur-route) var(--ease-out);

  @starting-style {
    transform: translateY(14px) scale(0.985);
  }
}

.map-dialog[data-state='closed'] .map-dialog__panel {
  transform: translateY(10px) scale(0.99);
  transition-duration: var(--dur-micro);
}

.map-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px 20px;
  border-bottom: 1px solid var(--edge);
}

.map-dialog__titles {
  display: grid;
  gap: 4px;
}

.map-dialog__title {
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.map-dialog__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.map-dialog__close {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: -8px -8px 0 0;
  border-radius: 50%;
  color: var(--ink-3);
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .map-dialog__close:hover {
    background: var(--well);
    color: var(--ink);
  }
}

.map-dialog__close:active {
  transform: scale(0.92);
}

.map-dialog__close .icon {
  width: 18px;
  height: 18px;
}

.map-dialog__canvas {
  min-height: clamp(260px, 52dvh, 520px);
  /* Panele Leafleta (z-index 200–800) zostają w obrębie mapy, nie nad nagłówkiem okna. */
  isolation: isolate;
  background: var(--well);
}

.map-dialog__canvas.leaflet-container {
  background: var(--well);
  font-family: var(--font-sans);
}

.map-dialog__canvas--empty {
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 14.5px;
  color: var(--ink-2);
}

.map-dialog__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--edge);
}

.map-dialog__hint {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

@media (max-width: 719px) {
  .map-dialog {
    padding: 0;
  }

  .map-dialog__panel {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .map-dialog__canvas {
    min-height: 0;
  }

  .map-dialog__foot {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .map-dialog__foot .btn {
    flex: 1 1 100%;
  }
}

/* ------------------------------- states -------------------------------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  --glass-fill: var(--glass);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.notice .icon {
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  margin-top: 1px;
}

.notice--warn {
  --glass-fill: color-mix(in srgb, var(--amber-fill) 16%, var(--glass-strong));
  border-color: color-mix(in srgb, var(--amber) 30%, var(--edge));
  color: color-mix(in srgb, var(--amber) 70%, var(--ink));
}

.notice--warn .icon {
  color: var(--amber);
}

.notice--error {
  --glass-fill: color-mix(in srgb, var(--red-fill) 16%, var(--glass-strong));
  border-color: color-mix(in srgb, var(--red) 30%, var(--edge));
  color: color-mix(in srgb, var(--red) 60%, var(--ink));
}

.notice--error .icon {
  color: var(--red);
}

.notice--ok {
  --glass-fill: color-mix(in srgb, var(--emerald-fill) 16%, var(--glass-strong));
  border-color: color-mix(in srgb, var(--emerald) 30%, var(--edge));
  color: color-mix(in srgb, var(--emerald) 62%, var(--ink));
}

.notice--ok .icon {
  color: var(--emerald);
}

.skeleton {
  display: grid;
  gap: 1px;
}

/* Szkielet trzyma wysokość wiersza listy, więc podmiana danych nie przesuwa treści (CLS).
   Poświata jedzie na `transform`, a nie na `background-position`: gradient przesuwany
   tłem przemalowuje wiersz w każdej klatce, przesunięcie warstwy — nie. */
.skeleton__row {
  position: relative;
  height: 72px;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 60%, transparent);
}

.skeleton__row::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--glass-strong) 70%, transparent) 42%,
    transparent 82%
  );
  transform: translateX(-100%);
  animation: shimmer 1.6s linear infinite;
}

.empty-state {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 40px 0;
  max-width: 52ch;
}

.empty-state h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.empty-state p {
  color: var(--ink-2);
  font-size: 14.5px;
}

.success {
  display: grid;
  gap: 16px;
  padding: clamp(20px, 4vw, 28px);
  --glass-fill: color-mix(in srgb, var(--emerald-fill) 8%, var(--glass));
  border-radius: var(--r-xl);
}

.success__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.success__mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--emerald) 32%, var(--edge));
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 20%, rgb(255 255 255 / 80%), transparent 52%),
    var(--emerald-tint);
  box-shadow: inset 0 1px 0 var(--rim-top);
  color: var(--emerald);
}

.success__mark .icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.success h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.success p {
  color: var(--ink-2);
  font-size: 14.5px;
  max-width: 56ch;
}

.success__score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
}
/* ------------------------------ responsive ----------------------------- */

@media (min-width: 720px) {
  .scale__btn {
    min-height: 62px;
    gap: 5px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
    align-items: start;
  }

  .form-grid > .is-sticky {
    position: sticky;
    top: calc(var(--topbar-h) + 28px);
  }

  .kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .kpi {
    border-bottom: 0;
  }

  .kpi:nth-child(2n) {
    border-right: 1px solid color-mix(in srgb, var(--edge) 70%, transparent);
  }

  .kpi:last-child {
    border-right: 0;
  }

  .score__word {
    display: inline;
  }

  .rank-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
    align-items: start;
  }

  .map-sheet {
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 348px;
  }

  .map-sheet__legend {
    font-size: 11px;
  }

  .map-sheet__foot .btn {
    width: auto;
  }
}

@media (min-width: 880px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .stats-grid__full {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .station-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 32px;
  }

  /* Ocena czyta się jak jedna soczewka: kropla z cyfrą, obok pasek i słowo,
     a legenda kanałów domyka rząd po prawej. */
  .station-head__score {
    display: grid;
    grid-template-columns: auto 196px;
    align-items: center;
    gap: 20px 26px;
  }

  .station-head__figure {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 6px 18px;
  }

  .station-head__figure .label {
    grid-column: 1 / -1;
  }

  .station-head__figure .big-score {
    grid-row: 2;
  }

  .head-meter {
    grid-column: 2;
    grid-row: 2;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
  }

  .head-meter .meter {
    width: 168px;
  }

  .station-head__score--empty {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Od 1100 px nazwa i minimapa stoją obok siebie; niżej mapa jest pasem pod
   metadanymi, bo kolumna z nazwą jest za wąska na długie nazwy stacji. */
@media (min-width: 1100px) {
  .station-head__id {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 176px);
    align-items: start;
    gap: 20px;
  }

  .mini-map {
    height: 136px;
  }
}

@media (min-width: 1020px) {
  .rank-cols--3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
  }

  .method {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 32px;
  }
}

@media (max-width: 719px) {
  :root {
    --topbar-h: 60px;
  }

  /* Domyślnie licznik dostaje własny wiersz: inaczej po dojściu danych przeskakuje
     z linii tytułu pod niego i spycha całą treść. Mapa i Statystyki są wyjątkiem —
     trzymają licznik w linii tytułu, patrz `--inline` niżej. */
  .page-head__top {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Mapa i Statystyki trzymają licznik w linii tytułu, przy prawej krawędzi —
     nad treścią zostaje jeden wiersz mniej. Kapsułka jest tu węższa, żeby
     zmieściła się obok tytułu bez zawijania. */
  .page-head__top.page-head__top--inline {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 4px 10px;
  }

  .page-head__top--inline .readout {
    flex: 0 0 auto;
    gap: 5px;
    padding: 5px 10px;
    font-size: 10px;
    letter-spacing: 0.05em;
  }

  .page-head__top--inline .readout b {
    font-size: 12px;
  }

  /* Wiersz na telefonie ma dwie linie — szkielet musi mieć tę samą wysokość. */
  .skeleton__row {
    height: 96px;
  }

  .topbar {
    top: 8px;
    width: calc(100% - 16px);
    margin-top: 8px;
    gap: 10px;
    padding: 0 6px 0 10px;
  }

  .mark__plate {
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
  }

  .mark__name {
    font-size: 12.5px;
  }

  .mark__sub {
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .tabs--top {
    display: none;
  }

  .topbar > .iconbtn {
    margin-left: auto;
  }

  .view {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  /* Pływający dok: jedna tafla szkła, w niej soczewka pod aktywnym widokiem. */
  .tabbar {
    position: fixed;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: min(420px, calc(100% - 24px));
    height: 68px;
    padding: 5px;
    transform: translateX(-50%);
    --glass-fill: var(--glass-strong);
    border-radius: var(--r-pill);
    box-shadow: var(--rim), var(--shadow-dock);
  }

  .tabbar__lens {
    top: 5px;
    bottom: 5px;
    left: 5px;
    width: calc((100% - 10px) / 3);
  }

  .tabbar__item {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    min-height: 58px;
    border-radius: var(--r-pill);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 560;
    letter-spacing: 0.02em;
    transition: color var(--dur-hover) var(--ease-out), transform var(--dur-press) var(--ease-out);
  }

  .tabbar__item:active {
    transform: scale(0.96);
  }

  .tabbar__item .icon {
    width: 21px;
    height: 21px;
  }

  .tabbar__item[aria-current='page'] {
    color: var(--ink);
    font-weight: 620;
    transition-delay: 90ms, 0s;
  }

  .tabbar__item[aria-current='page'] .icon {
    stroke-width: 2;
  }

  .toast {
    bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'name name'
      'score dist';
    gap: 10px 14px;
    min-height: 0;
    padding: 15px 20px;
  }

  .row::after {
    display: none;
  }

  .row__name {
    grid-area: name;
  }

  .row__score {
    grid-area: score;
    justify-content: flex-start;
  }

  .row__score .meter {
    flex: 0 0 92px;
  }

  .row__dist {
    grid-area: dist;
    align-self: center;
    text-align: right;
    font-size: 11.5px;
  }

  .board__head {
    grid-template-columns: 1fr auto;
    padding: 9px 20px;
  }

  .board__head span:nth-child(2) {
    display: none;
  }

  .actions .btn {
    flex: 1 1 100%;
  }

  .station-head {
    padding: 18px;
  }

  .big-score {
    width: clamp(92px, 26vw, 108px);
  }

  /* Pięć komórek w jednym rzędzie to definicja skali. Na 390 px słowo progu
     nie mieści się w 62 px, więc w komórce zostaje sama cyfra, a nazwę progu
     pokazuje wiersz pod skalą — ten sam, który czyta się przy najechaniu. */
  .scale {
    gap: 5px;
  }

  .scale__btn {
    min-height: 58px;
    padding: 0;
  }

  .scale__num {
    font-size: 19px;
  }

  .scale__word {
    display: none;
  }

  .head-meter .meter {
    width: 148px;
  }

  .map-view {
    margin: 0;
    padding-bottom: 0;
  }

  .map-view__head,
  .map-view__foot {
    padding: 0;
  }

  .map-shell {
    height: clamp(340px, 56dvh, 560px);
    border-radius: var(--r-lg);
  }

  /* Dwanaście tygodni na 390 px: etykiety co trzeci. `visibility`, a nie `display`,
     bo ukryty element musi nadal trzymać swoją kolumnę — inaczej etykiety zjeżdżają
     do pierwszych czterech kolumn i zlepiają się w jeden ciąg dat. */
  .trend__x span {
    visibility: hidden;
  }

  .trend__x span:nth-child(3n + 1),
  .trend__x span:last-child {
    visibility: visible;
  }

  .cats-chart__head {
    grid-template-columns: minmax(62px, 96px) 1fr 46px;
    gap: 10px;
  }

  .cats-chart__row {
    grid-template-columns: minmax(62px, 96px) 1fr 46px;
    gap: 10px;
  }

  .kinds__head,
  .kinds__row {
    grid-template-columns: minmax(0, 1fr) 58px 58px;
  }

  .bands__legend {
    gap: 6px 14px;
  }
}

@media (min-width: 720px) {
  .toast {
    bottom: 28px;
  }
}

/* W paśmie tabletów pełna linia „badanie · …” nie mieści się obok zakładek,
   więc zostaje samo imię badania — jak na telefonie. */
@media (max-width: 839px) {
  .mark__sub {
    display: none;
  }
}

@media (max-width: 420px) {
  .board__head span:nth-child(3) {
    display: none;
  }

  .mark__sub {
    display: none;
  }

  .page-title {
    max-width: 20ch;
  }

  .scale {
    gap: 4px;
  }

  .score__num {
    font-size: 17px;
  }

  .meter {
    min-width: 56px;
  }

  .kpi__num {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }
}

/* -------------------------------- motion ------------------------------- */

/* Zasada: `transform` i `opacity` jadą na kompozytorze. `filter: blur()` w klatce
   animacji to przemalowanie całej tafli na każdą klatkę — dlatego wejścia używają
   wyłącznie przesunięcia i krycia, a rozmycie zostaje w materiale szkła. */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes routeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Słupek rośnie z podstawy jak poziom cieczy: 0 traktujemy jak 0,02, żeby kształt
   istniał od pierwszej klatki (nic w świecie nie powstaje z niczego). */
@keyframes grow {
  from {
    transform: scaleY(0.02);
    opacity: 0.4;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes countIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wejście wierszy: 30 pozycji × 16 ms odraczało ostatni wiersz o pół sekundy.
   Opóźnienie kończy się na ósmym elemencie — dalej lista wchodzi jednym ruchem.
   `backwards` trzyma stan początkowy w trakcie opóźnienia, więc nic nie miga. */
.row[data-enter='true'] {
  animation: rowIn var(--dur-pop) var(--ease-out) backwards;
  animation-delay: calc(min(var(--i, 0), 7) * 24ms);
}

.count-in {
  animation: countIn var(--dur-pop) var(--ease-out);
}

/* Ruch ograniczony, nie wyłączony: znikają przesunięcia, rozmycia i skale,
   zostaje zmiana krycia i koloru, która potwierdza stan. */
@media (prefers-reduced-motion: reduce) {
  .ambient__glow {
    animation: none;
    filter: blur(48px);
  }

  .route--enter,
  .row[data-enter='true'],
  .count-in {
    animation: fadeIn var(--dur-micro) linear backwards;
    animation-delay: 0s;
  }

  .trend__bar,
  .hist__bar,
  .skeleton__row::after {
    animation: none;
  }

  /* Powierzchnie: zostaje samo krycie, bez przejazdu i skali. */
  .map-sheet,
  .map-dialog__panel {
    transform: none !important;
    transition-property: opacity;
  }

  .btn:active,
  .iconbtn:active,
  .tab:active,
  .tabbar__item:active,
  .scale__btn:active,
  .map-btn:active,
  .field__clear:active,
  .field__gps:active,
  .map-sheet__close:active,
  .map-dialog__close:active {
    transform: none;
  }

  .opt input:active + .opt__text {
    transform: none;
  }

  .skip {
    transition-property: opacity;
  }

  .toast {
    transition-property: opacity;
  }

  .tab[aria-current='page'],
  .tabbar__item[aria-current='page'] {
    transition-delay: 0s;
  }

  .btn,
  .iconbtn,
  .scale__btn,
  .map-btn,
  .row,
  [data-sheen] {
    --glow: 0;
  }
}

/* Szkło bez przezroczystości: dla użytkowników, którzy jej nie chcą, tafla staje się
   pełna, a rozmycie znika — czytelność wygrywa z materiałem. */
@media (prefers-reduced-transparency: reduce) {
  .panel,
  .station-head,
  .kpis,
  .cat,
  .success,
  .notice,
  .submitbar,
  .mini-map,
  .map-shell,
  .map-legend,
  .map-sheet,
  .map-dialog__panel,
  .field,
  .textarea,
  .btn--ghost,
  .map-btn,
  .topbar,
  .tabbar,
  .toast,
  .skip {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-color: var(--field);
  }
}
