/* ==========================================================================
   Zrozumiałość informacji pasażerskiej — system wizualny
   Świat: tablice kierunkowe i rozkłady kolei — siatka, hairline, mono na danych.
   ========================================================================== */

@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;

  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --surface-3: #e4e9ee;
  --ink: #0b1420;
  --ink-2: #3f4e5e;
  --ink-3: #46545f;
  --line: #d7dee5;
  --line-strong: #aebbc7;

  --amber: #7d4300;
  --amber-fill: #f5a524;
  --amber-tint: #fdf1db;
  --emerald: #045a3b;
  --emerald-fill: #10b981;
  --emerald-tint: #e3f7ef;
  --red: #9c1d12;
  --red-fill: #ef4444;
  --red-tint: #fdecea;
  --slate: #64748b;
  --slate-tint: #eef1f4;

  /* Znacznik „tu jesteś” na mapie — pozycja, nie ocena, więc poza paletą sygnałów. */
  --self: #0b57d0;

  /* Kolory wypełnień (paski, pinezki, słupki) — jaśniejsze od kolorów tekstu,
     ale nadal ≥3:1 wobec tła, więc czytelne jako nośnik informacji. */
  --bar-low: #c0392b;
  --bar-mid: #c47a00;
  --bar-high: #0f7b57;

  --focus: #0b1420;
  --shadow: 0 1px 0 rgb(11 20 32 / 4%), 0 8px 24px -12px rgb(11 20 32 / 18%);
  --shadow-lift: 0 2px 0 rgb(11 20 32 / 4%), 0 18px 40px -20px rgb(11 20 32 / 28%);

  --r-xs: 3px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

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

  --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;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}

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

  --bg: #070d14;
  --surface: #0d1620;
  --surface-2: #121d29;
  --surface-3: #172534;
  --ink: #f2f6fa;
  --ink-2: #b3c1cf;
  --ink-3: #93a3b2;
  --line: #1e2c3a;
  --line-strong: #33475b;

  --amber: #ffb020;
  --amber-fill: #ffb020;
  --amber-tint: #241a08;
  --emerald: #3ddc97;
  --emerald-fill: #3ddc97;
  --emerald-tint: #08251b;
  --red: #ff8a7a;
  --red-fill: #ff7a6b;
  --red-tint: #2a0f0c;
  --slate: #8fa0b1;
  --slate-tint: #121d29;
  --self: #7cb2ff;
  --bar-low: #ff7a6b;
  --bar-mid: #ffb020;
  --bar-high: #3ddc97;

  --focus: #f2f6fa;
  --shadow: 0 1px 0 rgb(0 0 0 / 40%), 0 10px 30px -14px rgb(0 0 0 / 70%);
  --shadow-lift: 0 2px 0 rgb(0 0 0 / 40%), 0 22px 48px -24px rgb(0 0 0 / 80%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #070d14;
    --surface: #0d1620;
    --surface-2: #121d29;
    --surface-3: #172534;
    --ink: #f2f6fa;
    --ink-2: #b3c1cf;
    --ink-3: #93a3b2;
    --line: #1e2c3a;
    --line-strong: #33475b;
    --amber: #ffb020;
    --amber-fill: #ffb020;
    --amber-tint: #241a08;
    --emerald: #3ddc97;
    --emerald-fill: #3ddc97;
    --emerald-tint: #08251b;
    --red: #ff8a7a;
    --red-fill: #ff7a6b;
    --red-tint: #2a0f0c;
    --slate: #8fa0b1;
    --slate-tint: #121d29;
    --self: #7cb2ff;
    --bar-low: #ff7a6b;
    --bar-mid: #ffb020;
    --bar-high: #3ddc97;
    --focus: #f2f6fa;
    --shadow: 0 1px 0 rgb(0 0 0 / 40%), 0 10px 30px -14px rgb(0 0 0 / 70%);
    --shadow-lift: 0 2px 0 rgb(0 0 0 / 40%), 0 22px 48px -24px rgb(0 0 0 / 80%);
  }
}

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

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  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;
}

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

h1,
h2,
h3,
h4 {
  font-weight: 620;
  letter-spacing: -0.021em;
  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: var(--amber-fill);
  color: #1a1000;
}

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

html {
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

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

.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: 12px;
  top: -60px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-sm);
  transition: top 0.2s var(--ease);
}
.skip:focus {
  top: 12px;
}

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

/* ------------------------------- chrome -------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  margin-left: -4px;
  padding-right: 8px;
}

.mark__plate {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.04em;
}

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

.mark__name {
  font-size: 13px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

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

.tabs--top {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.tab {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 560;
  color: var(--ink-2);
  transition: color 0.15s, background-color 0.15s;
}

.tab:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.tab[aria-current='page'] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.iconbtn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  margin-right: -8px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  transition: color 0.15s, background-color 0.15s;
}

.iconbtn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

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

.tabbar {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translate(-50%, 12px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.3s var(--ease);
}

.toast[data-show='true'] {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-kind='error'] {
  background: var(--red);
  color: #fff;
}

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

.page-head {
  display: grid;
  gap: 14px;
  margin-bottom: clamp(22px, 4vw, 36px);
}

.page-head__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}

.page-title {
  max-width: 17ch;
  font-size: clamp(1.85rem, 5.2vw, 3.05rem);
  font-weight: 620;
  letter-spacing: -0.032em;
  line-height: 1.02;
}

.page-title--tight {
  max-width: 24ch;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  letter-spacing: -0.028em;
}

.page-lede {
  max-width: 58ch;
  color: var(--ink-2);
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.5;
  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;
}

.readout {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  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;
}

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

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

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

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

.search {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.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: 480;
  letter-spacing: -0.01em;
  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: 48px;
  height: 48px;
  margin-right: -10px;
  border-radius: 50%;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
}

.field__clear:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: var(--tap);
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.1s var(--ease);
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

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

.btn--primary {
  background: var(--ink);
  color: var(--bg);
}

.btn--primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--ink) 84%, var(--amber));
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--surface-2);
}

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

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

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

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

.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: 26px;
  border-top: 1px solid var(--line-strong);
}

.board__head {
  display: grid;
  grid-template-columns: 1fr 148px 104px;
  gap: 16px;
  align-items: center;
  padding: 9px 28px 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}

.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: 68px;
  padding: 12px 28px 12px 14px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.14s;
}

.row::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-top: 1.5px solid var(--line-strong);
  border-right: 1.5px solid var(--line-strong);
  transform: translateY(-50%) rotate(45deg);
  transition: transform 0.2s var(--ease), border-color 0.14s;
}

.row:hover {
  background: var(--surface);
}

.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: 560;
  letter-spacing: -0.016em;
  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(--line-strong);
}

.row__type--halt::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line-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 bloki, jeden na kategorię */
.meter {
  display: flex;
  gap: 3px;
  flex: 1;
  min-width: 72px;
}

.meter span {
  position: relative;
  flex: 1;
  height: 10px;
  background: color-mix(in srgb, var(--ink) 11%, transparent);
  border-radius: 2px;
  overflow: hidden;
}

.meter i {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: var(--fill, 0%);
  background: var(--bar, var(--slate));
  border-radius: 2px;
}

.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.04em;
  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;
  gap: 8px;
  padding: 34px 14px 40px;
  border-bottom: 1px solid var(--line);
  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 2px 0;
}

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

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

.station-head {
  display: grid;
  gap: 14px;
  padding: 22px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.station-head__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.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: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.station-head__id {
  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;
}

.big-score {
  font-family: var(--font-mono);
  font-size: clamp(2.6rem, 7vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--ink));
}

.station-head__figure {
  display: grid;
  gap: 4px;
}

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

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

.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: 6px;
  min-width: 180px;
}

.legend-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.legend-row b {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
}

.stack {
  display: grid;
  gap: clamp(18px, 3vw, 26px);
}

.panel {
  padding: clamp(18px, 3vw, 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  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: 15px;
  font-weight: 620;
  letter-spacing: -0.015em;
}

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

/* 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: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.cat {
  display: grid;
  gap: 12px;
  padding: clamp(16px, 3vw, 22px);
  background: var(--surface);
}

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

.cat__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-2);
}

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

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

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

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

.scale__btn {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s, transform 0.1s var(--ease);
}

.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-3);
  line-height: 1.1;
}

.scale__btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--surface-2);
}

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

.scale__btn[aria-checked='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

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

.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: 96px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

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

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

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

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

.submitbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.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.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tone, var(--ink));
  transition: color 0.2s;
}

.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: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.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__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.review__scores {
  display: flex;
  gap: 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));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}

.kpi {
  display: grid;
  gap: 6px;
  padding: clamp(16px, 3vw, 24px);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.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.04em;
  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(18px, 3vw, 26px);
}

/* --- 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 var(--line);
}

/* --- 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(--line-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: var(--ink-2);
  border-radius: 2px 2px 0 0;
  transform-origin: bottom;
  animation: grow 0.55s var(--ease) both;
}

.trend__plot--line {
  position: relative;
  height: 58px;
  border-bottom: 1px solid var(--line);
}

.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: 8px;
  height: 8px;
  margin: 0 0 -4px -4px;
  border-radius: 50%;
  background: var(--bar, var(--slate));
  box-shadow: 0 0 0 2px var(--surface);
}

.trend__threshold {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(58px * 0.75);
  border-top: 1px dashed var(--line-strong);
}

.trend__mark {
  position: absolute;
  right: 0;
  top: 0;
  padding-left: 8px;
  background: var(--surface);
  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(--line-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: var(--bar, var(--slate));
  border-radius: 2px 2px 0 0;
  transform-origin: bottom;
  animation: grow 0.55s var(--ease) both;
}

.hist__bar.is-zero {
  background: var(--line-strong);
}

.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;
  background: var(--surface-2);
  border-radius: 2px;
}

.bands__seg {
  flex: var(--w, 0) 1 0%;
  background: var(--bar, var(--slate));
}

.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));
  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: 2px;
  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: 12px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 2px;
}

.cats-chart__bar i {
  flex: var(--w, 0) 1 0%;
  background: var(--bar, var(--slate));
}

.cats-chart__empty {
  width: 100%;
  height: 100%;
  background: var(--surface-3);
}

.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(--surface-2);
  border-radius: 2px;
}

.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%, var(--surface));
}

.coverage__seg--none {
  background: var(--surface-3);
}

.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: 2px;
  background: var(--surface-3);
}

.coverage__dot--ready {
  background: var(--ink);
}

.coverage__dot--thin {
  background: color-mix(in srgb, var(--ink) 42%, var(--surface));
}

.coverage__dot--none {
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.coverage__need {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  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 var(--line);
}

.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;
}

.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;
}

.split .meter {
  min-width: 0;
}

.split__meta {
  font-size: 11.5px;
  color: var(--ink-3);
}

/* --- rankingi --- */

.rank {
  display: grid;
}

.rank__item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  min-height: 56px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.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: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  border-radius: 2px;
}

.rank__bar i {
  display: block;
  width: var(--w, 0%);
  height: 100%;
  background: var(--bar, var(--slate));
  border-radius: 2px;
}

.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;
}

/* --- cytaty z ankiet --- */

.quotes {
  display: grid;
  gap: 0 24px;
}

.quote {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-content: start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.quote__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.quote__station {
  min-width: 0;
  font-size: 13px;
  font-weight: 560;
  letter-spacing: -0.012em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote__score {
  font-size: 14px;
  font-weight: 700;
  color: var(--tone, var(--ink));
  font-variant-numeric: tabular-nums;
}

.quote__text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.quote__when {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

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

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

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

.map-shell {
  position: relative;
  height: clamp(380px, 62dvh, 700px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  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(--surface-2);
  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(--surface) 88%, transparent) !important;
  color: var(--ink-3) !important;
}

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

.leaflet-bar a {
  width: 48px !important;
  height: 48px !important;
  line-height: 48px !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  font-size: 20px !important;
}

.leaflet-bar a:hover {
  background: var(--surface-2) !important;
}

.map-legend {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 500;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.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 color-mix(in srgb, var(--surface) 80%, transparent);
  flex: none;
}

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

.map-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.map-btn:hover {
  background: var(--surface-2);
}

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

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

.pin {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tone, var(--slate));
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
}

.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(--ink);
  color: var(--bg);
  border: 2px solid var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.map-sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  animation: sheetIn 0.32s var(--ease) both;
}

.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.02em;
  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);
}

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

.map-sheet__close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.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.04em;
  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 14px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  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;
}

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

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  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 {
  border-color: color-mix(in srgb, var(--amber) 34%, var(--line));
  background: var(--amber-tint);
  color: color-mix(in srgb, var(--amber) 70%, var(--ink));
}

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

.notice--error {
  border-color: color-mix(in srgb, var(--red) 34%, var(--line));
  background: var(--red-tint);
  color: color-mix(in srgb, var(--red) 60%, var(--ink));
}

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

.notice--ok {
  border-color: color-mix(in srgb, var(--emerald) 34%, var(--line));
  background: var(--emerald-tint);
  color: color-mix(in srgb, var(--emerald) 62%, var(--ink));
}

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

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

.skeleton__row {
  height: 68px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--surface) 60%, transparent) 40%,
    transparent 80%
  );
  background-size: 240% 100%;
  animation: shimmer 1.5s linear infinite;
}

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

.empty-state h2 {
  font-size: 20px;
}

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

.success {
  display: grid;
  gap: 16px;
  padding: clamp(20px, 4vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

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

.success__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--emerald-tint);
  color: var(--emerald);
}

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

.success h2 {
  font-size: 20px;
}

.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 var(--line);
  border-bottom: 1px solid var(--line);
}

/* ------------------------------ responsive ----------------------------- */

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

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

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

  .form-grid > .is-sticky {
    position: sticky;
    top: 84px;
  }

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

  .kpi {
    border-bottom: 0;
  }

  .kpi:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

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

  .score__word {
    display: inline;
  }

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

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

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

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

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

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

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

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

@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 (max-width: 719px) {
  .tabs--top {
    display: none;
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px) saturate(1.2);
    border-top: 1px solid var(--line);
  }

  .tabbar__item {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-height: 54px;
    padding: 6px 4px 4px;
    border-radius: var(--r-sm);
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 560;
    letter-spacing: 0.02em;
  }

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

  .tabbar__item[aria-current='page'] {
    color: var(--ink);
  }

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

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

  .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: 8px 14px;
  }

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

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

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

  .station-head {
    padding: 18px;
  }

  .avg {
    grid-template-columns: 1fr 72px 42px;
    gap: 12px;
  }

  .chart {
    height: 160px;
  }

  .map-view {
    margin: 0 calc(var(--gutter) * -1);
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  /* 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: 4px;
  }

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

  .scale__num {
    font-size: 19px;
  }

  .scale__word {
    display: none;
  }

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

  .map-view__head,
  .map-view__foot {
    padding: 0 var(--gutter);
  }

  .map-shell {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    height: clamp(340px, 58dvh, 560px);
  }

  /* 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 (max-width: 420px) {
  .board__head span:nth-child(3) {
    display: none;
  }

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

  .scale {
    gap: 3px;
  }

  .score__num {
    font-size: 17px;
  }

  .meter {
    min-width: 56px;
  }
}

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

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

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

@keyframes grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

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

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

.row[data-enter='true'] {
  animation: rowIn 0.42s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 14ms);
}

.count-in {
  animation: countIn 0.24s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
