/* ═══════════════════════════════════════════════════════════
   QR Quest PoC-v2 — styl „Editorial premium"
   Jasne tło kość słoniowa, tusz zamiast bieli, hairline'y
   zamiast kart, serif systemowy w nagłówkach i treściach
   fabularnych, sans (system-ui) w etykietach CAPS.
   CTA zawsze czarne; akcent per gra (JS: --accent/--accent-rgb/
   --accent-dark z branding.accent) tylko w detalach.
   Skaner i mapa = ciemne wyspy (kamera / kafelki OSM).
   ═══════════════════════════════════════════════════════════ */

:root {
  /* motyw gry (nadpisywany z JS) */
  --accent: #0d9488;
  --accent-rgb: 13, 148, 136;
  --accent-dark: rgb(8, 89, 82);

  /* powierzchnie i tekst — jasny papier + tusz */
  --bg: #faf9f6;
  --ink: 28, 27, 24;                       /* triplet: rgba(var(--ink), x) */
  --text-hi: rgb(var(--ink));              /* nagłówki, kluczowe dane */
  --text: #44403a;                         /* tekst podstawowy */
  --text-dim: #5f5b52;                     /* drugorzędny */
  --text-faint: #6f6b62;                   /* etykiety, placeholdery — AA na jasnym tle (gra plenerowa) */
  --line: #e3e0d8;                         /* hairline'y */
  --line-soft: #eeece5;                    /* separatory list */
  --line-strong: rgb(var(--ink));          /* ramki editorial */
  --surface-1: #ffffff;                    /* pola formularzy */
  --surface-2: #f3f1ea;                    /* wyróżnienia (paper tint) */
  --danger: #b3542e;
  --danger-rgb: 179, 84, 46;
  --success: #3f6212;

  /* typografia — --font-display nadpisuje JS wg branding.style/font gry */
  --font-display: 'Iowan Old Style', 'Palatino Nova', Palatino, Georgia, serif;
  --serif: var(--font-display);
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* skala tekstu ze superpanelu: --qq-fs-scale (1 = bez zmian) mnoży cały
     system typograficzny gry naraz. JS ustawia zmienną z presetu fontScale. */
  --qq-fs-scale: 1;
  --fs-xs: calc(0.72rem * var(--qq-fs-scale, 1));
  --fs-sm: calc(0.875rem * var(--qq-fs-scale, 1));
  --fs-base: calc(1rem * var(--qq-fs-scale, 1));
  --fs-lg: calc(1.25rem * var(--qq-fs-scale, 1));
  --fs-xl: calc(1.75rem * var(--qq-fs-scale, 1));
  --fs-display: calc(2.4rem * var(--qq-fs-scale, 1));
  --ls-caps: 0.18em;
  --ls-caps-wide: 0.25em;

  /* promienie — editorial, ostro */
  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 3px;
}

/* ─── Style wizualne gry (branding.style; JS ustawia data-style na <html>) ───
   elegancki = wartości bazowe :root (dotychczasowy editorial).            */

:root[data-style="nowoczesny"] {
  /* Classic (handoff „QR Quest Classic"): mroczna kronika / dark academia —
     czerń przy świecy, złoto, kremowy atrament, strona starej księgi */
  --bg: #14100b;
  --ink: 232, 221, 198;         /* #E8DDC6 — kremowy „atrament" na czerni */
  --text: rgba(232, 221, 198, 0.9);    /* WCAG: 10.9:1 na czerni */
  --text-dim: rgba(232, 221, 198, 0.72); /* 7.5:1 — AAA dla drobnego */
  --text-faint: rgba(232, 221, 198, 0.58); /* 5.4:1 — AA dla drobnego (było 3.7:1) */
  --surface-1: #1d1710;
  --surface-2: #241c12;
  --line: rgba(201, 162, 39, 0.35);      /* złota linia */
  --line-soft: rgba(232, 221, 198, 0.15);
  --line-strong: var(--g-gold);
  --danger: #c46a74;            /* lak rozjaśniony — czytelny na czerni */
  --success: #6f8f5a;           /* butelkowa zieleń biblioteki */
  --r-sm: 0px;                  /* editorial ostrość — kanty jak w księdze */
  --r-md: 0px;
  --r-lg: 0px;
  --ls-caps: 0.18em;
  --ls-caps-wide: 0.22em;
  /* stałe skinowe Classic */
  --g-gold: #c9a227;
  --g-wax: #8e2a35;
  --g-cream: #e8ddc6;
  --sans: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  /* HUD: ciemna karta z kremowym tekstem (tokeny superpanelu wygrywają inline) */
  --qq-hud-bg: #1d1710;
  --qq-hud-ink: #e8ddc6;
  --qq-hud-ink-2: rgba(232, 221, 198, 0.65);
}

:root[data-style="zabawny"] {
  /* Fun (handoff „QR Quest Kids"): krem + atrament-fiolet + cukierkowa paleta */
  --bg: #fff8f0;                /* kremowy papier */
  --ink: 42, 33, 64;            /* #2A2140 — ciemny fiolet zamiast czerni */
  --text: #4a4160;
  --text-dim: rgba(42, 33, 64, 0.8);   /* było 0.72 */
  --text-faint: rgba(42, 33, 64, 0.7); /* było 0.55 (3.5:1) → ~4.8:1 na białym */
  --surface-2: #fff1e0;
  --line: #f0e9df;
  --line-soft: #f5efe6;
  --success: #38d39f;           /* zielone potwierdzenia */
  --r-sm: 14px;
  --r-md: 18px;                 /* chipy odpowiedzi */
  --r-lg: 22px;                 /* przyciski, karty */
  --ls-caps: 0.08em;            /* mniej sztywne wersaliki */
  --ls-caps-wide: 0.12em;
  /* stałe skinowe Fun */
  --k-yellow: #ffc93c;
  --k-purple: #8b5cf6;
  --k-sel-bg: #e9fbf3;          /* tło zaznaczonej odpowiedzi (tint zieleni) */
  --sans: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  /* HUD Fun: fiolet (globalne --qq-hud-* z qq-design nadpisujemy per styl;
     tokeny superpanelu i tak wygrywają — JS ustawia je inline na <html>) */
  --qq-hud-bg: #8b5cf6;
  --qq-hud-ink: #ffffff;
  --qq-hud-ink-2: rgba(255, 255, 255, 0.75);
}

:root[data-style="bazowy"] {
  /* Base: szkieletowy wireframe — biel dominuje, zinc-szarości, jeden
     funkcjonalny akcent (niebieski per gra), natywny sans. Kwadratowe
     rogi, płaskie hairline'y, zero dekoracji. Priorytet: czytelność. */
  --bg: #ffffff;
  --ink: 24, 24, 27;            /* #18181B (zinc-950) */
  --text: #3f3f46;             /* zinc-700 — tekst podstawowy */
  --text-dim: #52525b;         /* zinc-600 */
  --text-faint: #71717a;       /* zinc-500 — 4.6:1 na bieli (AA) */
  --surface-1: #ffffff;        /* karty/pola — biel */
  --surface-2: #f4f4f5;        /* delikatne wypełnienia (zinc-100) */
  --line: #e4e4e7;             /* zinc-200 */
  --line-soft: #f4f4f5;        /* zinc-100 */
  --line-strong: #d4d4d8;      /* zinc-300 */
  --danger: #dc2626;
  --success: #16a34a;
  /* wireframe: idealnie kwadratowe rogi wszędzie */
  --r-sm: 0px;
  --r-md: 0px;
  --r-lg: 0px;
  --ls-caps: 0.06em;
  --ls-caps-wide: 0.1em;
}

/* ─── Tryb ciemny per gra (branding.mode; JS ustawia data-mode na <html>) ───
   Cała paleta płynie przez zmienne, więc wystarczy odwrócić tokeny.       */
:root[data-mode="dark"] {
  --bg: #16150f;
  --ink: 240, 237, 228;                    /* „tusz" staje się jasny */
  --text: #cfcabe;
  --text-dim: #a8a396;
  --text-faint: #94907f;
  --line: #37342b;
  --line-soft: #2b2922;
  --surface-1: #201e17;
  --surface-2: #26241b;
  --danger: #e0805c;
  --success: #9bc054;
}
:root[data-mode="dark"][data-style="nowoczesny"] {
  /* Classic jest z natury ciemny — tryb ciemny nie zmienia palety
     (nadpisujemy generyczny dark, żeby nie rozjaśnił kremowego atramentu) */
  --bg: #14100b;
  --ink: 232, 221, 198;
  --text: rgba(232, 221, 198, 0.9);
  --text-dim: rgba(232, 221, 198, 0.72);
  --text-faint: rgba(232, 221, 198, 0.58);
  --surface-1: #1d1710;
  --surface-2: #241c12;
  --line: rgba(201, 162, 39, 0.35);
  --line-soft: rgba(232, 221, 198, 0.15);
  --danger: #c46a74;
  --success: #6f8f5a;
}
:root[data-mode="dark"][data-style="zabawny"] {
  /* fioletowa noc — ciemny wariant palety Fun (#2A2140 jako powierzchnia) */
  --bg: #1e1833;
  --ink: 240, 236, 250;
  --text: #d8d2e8;
  --text-dim: #b3abcc;
  --text-faint: #948cae;
  --surface-1: #2a2140;
  --surface-2: #322850;
  --line: #3a3154;
  --line-soft: #332b4a;
  --k-sel-bg: rgba(56, 211, 159, 0.16);
}
:root[data-mode="dark"][data-style="bazowy"] {
  /* Base ciemny: neutralna czerń zinc (nie ciepły editorial) */
  --bg: #0b0b0d;
  --ink: 250, 250, 250;
  --text: #d4d4d8;
  --text-dim: #a1a1aa;
  --text-faint: #8a8a93;
  --surface-1: #18181b;
  --surface-2: #1f1f23;
  --line: #27272a;
  --line-soft: #1f1f23;
  --line-strong: #3f3f46;
  --danger: #f87171;
  --success: #4ade80;
}

/* ─── Sygnatury stylów ──────────────────────────────────────
   To, co odróżnia style na pierwszy rzut oka: kształt CTA,
   pola, quiz, pasek postępu, sygnet, ramki zdjęć. Wszystko
   płynie z --accent gry. elegancki = editorial bazowy + kilka
   własnych detali (ostre CTA, pinstripe).                    */

/* ELEGANCKI — pełny editorial: CTA idealnie ostre, szerokie
   wersaliki, pinstripe w kolorze papieru wewnątrz czarnego CTA */
:root[data-style="elegancki"] .btn {
  border-radius: 0;
  letter-spacing: 0.2em;
}
:root[data-style="elegancki"] .btn-primary {
  /* podwójna rama jak w albumie: tusz / papier / tusz */
  box-shadow: inset 0 0 0 2px rgb(var(--ink)), inset 0 0 0 3.5px var(--bg);
}

/* CLASSIC (nowoczesny) — mroczna kronika (handoff QR Quest Classic):
   złote CTA z atramentowym tekstem, szerokie wersaliki Garamond, kanty,
   linie atramentu zamiast pól, lakowe pieczęcie na osi, złota poświata */
:root[data-style="nowoczesny"] .btn {
  border-radius: 0;
  letter-spacing: 0.22em;
  font-weight: 600;
  font-size: var(--fs-sm);
}
:root[data-style="nowoczesny"] .btn-primary {
  background: var(--accent);
  color: var(--qq-on-acc, #14100b);
  box-shadow: none;
}
:root[data-style="nowoczesny"] .btn-primary:active:not(:disabled) {
  transform: none;
  opacity: 0.85;
}
:root[data-style="nowoczesny"] .btn-secondary {
  background: rgba(20, 16, 11, 0.55);
  border: 1px solid var(--line);
  color: var(--g-cream);
}
:root[data-style="nowoczesny"] .btn-ghost {
  border: 1px solid var(--line-soft);
  color: var(--text-dim);
}
:root[data-style="nowoczesny"] .game-display {
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
  text-shadow: 0 2px 18px rgba(var(--accent-rgb), 0.25);
}
:root[data-style="nowoczesny"] h2,
:root[data-style="nowoczesny"] .finish-hero h2 {
  font-weight: 600;
}
:root[data-style="nowoczesny"] .brand-eyebrow {
  font-family: var(--sans);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}
:root[data-style="nowoczesny"] .brand-logo {
  border: 1px solid var(--line);
  box-shadow: 0 0 0 6px rgba(var(--accent-rgb), 0.1);
}
/* pola = linia atramentu (złota), italik Garamond — jak wpis do księgi */
:root[data-style="nowoczesny"] .text-input,
:root[data-style="nowoczesny"] .challenge-input,
:root[data-style="nowoczesny"] .taskqr-manual-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  border-radius: 0;
  padding: calc(12px * var(--qq-sp-scale, 1)) 4px;
  font-family: var(--sans);
  font-style: italic;
  color: var(--g-cream);
}
:root[data-style="nowoczesny"] .text-input:focus,
:root[data-style="nowoczesny"] .challenge-input:focus,
:root[data-style="nowoczesny"] .taskqr-manual-input:focus {
  border-bottom-color: var(--g-cream);
  box-shadow: 0 1px 0 0 var(--g-cream);
}
/* opcje = wpisy w księdze: wyraźny złoty obrys, kremowy podkład, litera
   jako lakowa pieczęć (chip). Zdania odpowiedzi Garamondem — czytelność. */
:root[data-style="nowoczesny"] .quiz-options { gap: 10px; }
:root[data-style="nowoczesny"] .quiz-option {
  background: rgba(232, 221, 198, 0.04);
  border: 1px solid var(--line);
  border-left-width: 2px;
  border-radius: 0;
  padding: calc(13px * var(--qq-sp-scale, 1)) calc(16px * var(--qq-sp-scale, 1));
  font-family: var(--sans);
  font-style: normal;
  align-items: center;
  gap: 13px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
:root[data-style="nowoczesny"] .quiz-option:active { background: rgba(232, 221, 198, 0.08); }
:root[data-style="nowoczesny"] .quiz-option.selected {
  color: var(--g-cream);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  box-shadow: none;
}
/* litera odpowiedzi = pieczęć: kwadratowy złoty chip z Cormorant Unicase */
:root[data-style="nowoczesny"] .quiz-option-letter {
  width: 27px; height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(20, 16, 11, 0.4);
  font-family: var(--font-display);
  font-style: normal;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  color: var(--g-gold);
  flex-shrink: 0;
}
:root[data-style="nowoczesny"] .quiz-option.selected .quiz-option-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--qq-on-acc, #14100b);
  font-weight: 600;
}
/* pasek gry: ciemna karta ze złotą linią i złotym postępem */
:root[data-style="nowoczesny"] .tasks-header {
  background: var(--qq-hud-bg);
  border-bottom: 1px solid var(--line);
}
:root[data-style="nowoczesny"] .tasks-header h2 {
  color: var(--accent);
  font-weight: 600;
}
:root[data-style="nowoczesny"] .tasks-header .eyebrow,
:root[data-style="nowoczesny"] .tasks-header .timer-chip {
  color: var(--qq-hud-ink);
}
:root[data-style="nowoczesny"] .tasks-header .timer-chip { border: none; padding: 0; }
:root[data-style="nowoczesny"] .progress-bar {
  height: 2px;
  border-radius: 0;
  overflow: hidden;
  background: var(--line-soft);
}
:root[data-style="nowoczesny"] .progress-fill { height: 100%; background: var(--accent); }
/* karta zadania: rama z linii atramentu, etykieta złotem */
:root[data-style="nowoczesny"] .desc-card {
  background: transparent;
  border: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: calc(16px * var(--qq-sp-scale, 1)) 2px;
}
:root[data-style="nowoczesny"] .desc-card .text { font-style: italic; }
/* treść składana Garamondem (nagłówki zostają w Cormorant/--font-display) */
:root[data-style="nowoczesny"] .briefing-section p,
:root[data-style="nowoczesny"] .briefing-section ul li,
:root[data-style="nowoczesny"] .briefing-hint,
:root[data-style="nowoczesny"] .desc-card .text,
:root[data-style="nowoczesny"] .tl-sub,
:root[data-style="nowoczesny"] .tl-desc,
:root[data-style="nowoczesny"] .finish-summary-item .title,
:root[data-style="nowoczesny"] .modal-box p {
  font-family: var(--sans);
}
:root[data-style="nowoczesny"] .task-question {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
}
:root[data-style="nowoczesny"] .hint-btn {
  border: 1px dashed var(--accent);
  border-radius: 0;
  background: rgba(var(--accent-rgb), 0.06);
}
:root[data-style="nowoczesny"] .hint-revealed {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0;
}
/* zdjęcia: winieta do czerni u dołu — fotograficzny charakter stylu */
:root[data-style="nowoczesny"] .task-image,
:root[data-style="nowoczesny"] .welcome-hero {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}
:root[data-style="nowoczesny"] .task-image::after,
:root[data-style="nowoczesny"] .welcome-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 16, 11, 0.15) 55%, rgba(20, 16, 11, 0.75) 100%);
  pointer-events: none;
}
/* oś podróży: waypointy jak lakowe pieczęcie */
:root[data-style="nowoczesny"] .tl::before { background: var(--line-soft); }
:root[data-style="nowoczesny"] .tl-dot {
  width: 13px;
  height: 13px;
  border: 1px solid var(--text-faint);
  background: rgba(20, 16, 11, 0.7);
  transform: rotate(-6deg);
}
:root[data-style="nowoczesny"] .tl-item.done-ok .tl-dot {
  /* ukończone = złota pieczęć woskowa */
  background: radial-gradient(circle at 35% 30%, #e6cb62, var(--g-gold) 52%, #7f6414);
  border-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 1px 4px rgba(0, 0, 0, 0.45);
}
:root[data-style="nowoczesny"] .tl-item.current .tl-dot {
  /* jesteś tu = świeży czerwony lak */
  background: radial-gradient(circle at 35% 30%, #a8404c, var(--g-wax) 55%, #651c26);
  border-color: transparent;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.6),
    0 0 0 3px rgba(142, 42, 53, 0.18);
}
/* finisz: kronika — statystyki między złotymi liniami, wartości złotem */
:root[data-style="nowoczesny"] .finish-hero .trophy {
  font-family: var(--sans);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}
:root[data-style="nowoczesny"] .finish-score {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(20, 16, 11, 0.55);
}
:root[data-style="nowoczesny"] .finish-score-item {
  border: none;
  border-radius: 0;
}
:root[data-style="nowoczesny"] .finish-score-item .value { color: var(--accent); }
:root[data-style="nowoczesny"] .modal-box {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-1);
}

/* FUN — cukierkowe „bąbelki" (handoff QR Quest Kids): pełnokolorowe 3D-cienie
   (0 6px 0), wciskane przyciski, wielkie rogi, Baloo 2 + Fredoka, fioletowy
   HUD z żółtym paskiem postępu, zielone zaznaczenia, złoty finisz */
:root[data-style="zabawny"] .btn {
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-display);
  font-size: calc(18px * var(--qq-fs-scale, 1));
  font-weight: 700;
  border-radius: var(--r-lg);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
:root[data-style="zabawny"] .btn-primary {
  background: var(--accent);
  color: var(--qq-on-acc, #fff);
  border: none;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
}
:root[data-style="zabawny"] .btn-primary:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  opacity: 1;
}
:root[data-style="zabawny"] .btn-secondary {
  background: var(--surface-1);
  color: var(--text-hi);
  border: none;
  box-shadow: 0 4px 0 rgba(var(--ink), 0.12);
}
:root[data-style="zabawny"] .btn-secondary:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(var(--ink), 0.12);
  opacity: 1;
}
:root[data-style="zabawny"] .btn-ghost {
  border: 3px solid var(--line);
  border-radius: var(--r-lg);
}
:root[data-style="zabawny"] .btn-danger { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18); }
:root[data-style="zabawny"] .game-display { font-weight: 800; }
/* ekran startowy: gradient nieba jak w handoffie; plakietka marki jako pill */
:root[data-style="zabawny"] .view[data-view="welcome"] {
  background: linear-gradient(180deg, #7ad0ff 0%, #b6e3ff 55%, #dff2ff 100%);
}
:root[data-mode="dark"][data-style="zabawny"] .view[data-view="welcome"] {
  background: linear-gradient(180deg, #241c44 0%, #1e1833 70%);
}
:root[data-style="zabawny"] .brand-eyebrow {
  display: inline-flex;
  align-self: center;
  align-items: center;
  gap: 4px;
  background: var(--accent);
  color: var(--qq-on-acc, #fff);
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
  letter-spacing: 0.1em;
}
/* Nadkreślenie Fun to plakietka NA AKCENCIE, a .brand-eyebrow span maluje
   nazwę marki akcentem — wychodził akcent na akcencie, czyli tekst niewidoczny.
   Na plakietce span dziedziczy kolor tekstu (jak w sygnaturze Ekspedycja). */
:root[data-style="zabawny"] .brand-eyebrow span { color: inherit; }
:root[data-style="zabawny"] .brand-logo {
  border: 3px solid #fff;
  box-shadow: 0 4px 0 rgba(var(--ink), 0.12);
}
:root[data-style="zabawny"] .text-input,
:root[data-style="zabawny"] .challenge-input,
:root[data-style="zabawny"] .taskqr-manual-input {
  background: var(--surface-1);
  border: 3px solid var(--k-yellow);
  border-radius: 20px;
  padding: calc(14px * var(--qq-sp-scale, 1)) calc(16px * var(--qq-sp-scale, 1));
  box-shadow: 0 4px 0 rgba(255, 201, 60, 0.4);
}
:root[data-style="zabawny"] .text-input:focus,
:root[data-style="zabawny"] .challenge-input:focus,
:root[data-style="zabawny"] .taskqr-manual-input:focus {
  border-color: var(--accent);
  box-shadow: 0 4px 0 rgba(var(--accent-rgb), 0.35);
}
:root[data-style="zabawny"] .quiz-options { gap: 11px; }
:root[data-style="zabawny"] .quiz-option {
  background: var(--surface-1);
  border: 3px solid var(--line);
  border-radius: var(--r-md);
  padding: calc(13px * var(--qq-sp-scale, 1)) calc(15px * var(--qq-sp-scale, 1));
  align-items: center;
  box-shadow: 0 3px 0 rgba(var(--ink), 0.06);
  transition: transform 0.12s ease;
}
:root[data-style="zabawny"] .quiz-option:active { transform: translateY(2px); }
:root[data-style="zabawny"] .quiz-option.selected {
  color: var(--text-hi);
  border-color: var(--success);
  background: var(--k-sel-bg);
  box-shadow: 0 4px 0 rgba(56, 211, 159, 0.35);
  font-weight: 700;
}
:root[data-style="zabawny"] .quiz-option-letter {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 12px;
  background: #efe9ff;              /* miękki fiolet — spójny z HUD */
  color: var(--k-purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 800;
  font-size: var(--fs-base);
  text-transform: uppercase;
  flex: none;
}
:root[data-style="zabawny"] .quiz-option.selected .quiz-option-letter {
  background: var(--success);
  color: #fff;
}
/* pasek gry (HUD): fiolet + żółty pasek postępu — sygnaturowy element Fun */
:root[data-style="zabawny"] .tasks-header {
  background: var(--qq-hud-bg, var(--k-purple));
  gap: 10px;
}
:root[data-style="zabawny"] .tasks-header h2,
:root[data-style="zabawny"] .tasks-header .eyebrow,
:root[data-style="zabawny"] .tasks-header .nick-label,
:root[data-style="zabawny"] .tasks-header .nick-value,
:root[data-style="zabawny"] .tasks-header .progress-label,
:root[data-style="zabawny"] .tasks-header .timer-chip {
  color: var(--qq-hud-ink, #fff);
}
:root[data-style="zabawny"] .tasks-header .eyebrow .acc,
:root[data-style="zabawny"] .tasks-header .score,
:root[data-style="zabawny"] .tasks-header .progress-label .done {
  color: var(--k-yellow);
}
:root[data-style="zabawny"] .tasks-header .timer-chip { border: none; padding: 0; }
:root[data-style="zabawny"] .tasks-header .timer-chip.danger { color: #ffb3c8; }
:root[data-style="zabawny"] .tasks-header .map-open-btn {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: var(--qq-hud-ink, #fff);
  border-radius: 14px;
}
:root[data-style="zabawny"] .tasks-header .progress-bar {
  height: 10px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
:root[data-style="zabawny"] .tasks-header .progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--k-yellow);
}
/* pasek postępu poza HUD (briefing itd.) — gruby, zaokrąglony */
:root[data-style="zabawny"] .progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}
:root[data-style="zabawny"] .progress-fill { height: 100%; border-radius: 999px; background: var(--k-yellow); }
:root[data-style="zabawny"] .desc-card {
  background: var(--surface-1);
  border: none;
  border-radius: var(--r-md);
  padding: calc(14px * var(--qq-sp-scale, 1)) calc(16px * var(--qq-sp-scale, 1));
  box-shadow: 0 3px 0 rgba(var(--ink), 0.06);
}
:root[data-style="zabawny"] .hint-btn {
  border: 3px dashed var(--accent);
  border-radius: 999px;
}
:root[data-style="zabawny"] .hint-revealed {
  background: var(--surface-1);
  border: none;
  border-left: 6px solid var(--k-yellow);
  border-radius: var(--r-sm);
  box-shadow: 0 3px 0 rgba(var(--ink), 0.06);
}
:root[data-style="zabawny"] .task-image,
:root[data-style="zabawny"] .welcome-hero {
  border: 3px solid #fff;
  border-radius: var(--r-lg);
  box-shadow: 0 4px 0 rgba(var(--ink), 0.06);
}
/* lista zadań = „poziomy" na mapie: każde zadanie to cukierkowa karta
   z kwadratowym pipem-statusem, pigułką punktów i różowym CTA na bieżącym */
:root[data-style="zabawny"] .tl { padding-left: 0; }
:root[data-style="zabawny"] .tl::before { display: none; }   /* bez osi — samodzielne karty */
:root[data-style="zabawny"] .tl-item {
  background: var(--surface-1);
  border: 2px solid transparent;
  border-radius: 18px;
  box-shadow: 0 3px 0 rgba(var(--ink), 0.08);
  padding: calc(13px * var(--qq-sp-scale, 1)) calc(16px * var(--qq-sp-scale, 1))
           calc(13px * var(--qq-sp-scale, 1)) 52px;
  margin-bottom: 12px;
}
:root[data-style="zabawny"] .tl-item + .tl-item { border-top: none; }
:root[data-style="zabawny"] .tl-item.current {
  border-color: var(--accent);
  box-shadow: 0 4px 0 rgba(var(--accent-rgb), 0.28);
  padding-bottom: calc(16px * var(--qq-sp-scale, 1));
}
:root[data-style="zabawny"] .tl-item.done-ok,
:root[data-style="zabawny"] .tl-item.done-fail { opacity: 0.72; }
:root[data-style="zabawny"] .tl-item.locked { opacity: 0.6; }
/* pip statusu: kwadratowy cukierek w karcie (żółty=do zrobienia,
   różowy=tu jesteś, zielony=zaliczone, szary=zamknięte) */
:root[data-style="zabawny"] .tl-dot {
  left: 16px; top: 16px;
  width: 22px; height: 22px;
  border-radius: 8px;
  border: 3px solid #fff;
  background: var(--k-yellow);
  box-shadow: 0 2px 0 rgba(var(--ink), 0.15);
}
:root[data-style="zabawny"] .tl-item.current .tl-dot {
  left: 16px; top: 16px;
  width: 22px; height: 22px;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 0 rgba(var(--ink), 0.15), 0 0 0 3px rgba(var(--accent-rgb), 0.22);
}
:root[data-style="zabawny"] .tl-item.done-ok .tl-dot { background: var(--success); border-color: #fff; }
:root[data-style="zabawny"] .tl-item.done-fail .tl-dot { background: var(--danger); border-color: #fff; }
:root[data-style="zabawny"] .tl-item.locked .tl-dot { background: #d9d3ea; border-color: #fff; }
/* punkty jako żółta pigułka; opis czytelną Fredoką */
:root[data-style="zabawny"] .tl-pts {
  display: inline-block;
  margin-top: 7px;
  padding: 2px 11px;
  border-radius: 999px;
  background: var(--k-yellow);
  color: #6b4e00;
  text-transform: none;
  letter-spacing: 0.02em;
}
:root[data-style="zabawny"] .tl-desc {
  font-family: var(--sans);
  font-style: normal;
  color: var(--text-dim);
}
/* CTA bieżącego poziomu = różowy cukierkowy przycisk */
:root[data-style="zabawny"] .tl-cta {
  background: var(--accent);
  color: var(--qq-on-acc, #fff);
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(var(--ink), 0.15);
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-display);
  font-weight: 700;
}
:root[data-style="zabawny"] .tl-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(var(--ink), 0.15); }
/* finisz: złoty gradient + białe karty statystyk — jak ekran nagród */
:root[data-style="zabawny"] .view[data-view="finish"] {
  background: linear-gradient(180deg, #ffd86b 0%, #ffb347 100%);
}
:root[data-mode="dark"][data-style="zabawny"] .view[data-view="finish"] {
  background: linear-gradient(180deg, #4a3a14 0%, #1e1833 75%);
}
:root[data-style="zabawny"] .finish-score-item {
  background: var(--surface-1);
  border: none;
  border-radius: 20px;
  box-shadow: 0 4px 0 rgba(var(--ink), 0.12);
}
:root[data-style="zabawny"] .finish-org {
  background: var(--surface-1);
  border: none;
  border-radius: var(--r-lg);
  padding: calc(16px * var(--qq-sp-scale, 1));
  box-shadow: 0 4px 0 rgba(var(--ink), 0.12);
}
:root[data-style="zabawny"] .modal-box { border-radius: 26px; }

/* BASE (bazowy) — szkieletowy wireframe: biel, hairline'y, jeden akcent,
   kwadratowe rogi, płaskie wiersze zamiast kart, kwadratowe znaczniki
   (jak checkbox). Wyraźne stany i ringi focus. Priorytet: czytelność. */
:root[data-style="bazowy"] .btn {
  border-radius: var(--r-md);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: var(--fs-sm);
}
:root[data-style="bazowy"] .btn-primary {
  background: var(--accent);
  color: var(--qq-on-acc, #fff);
  box-shadow: none;
}
:root[data-style="bazowy"] .btn-primary:active:not(:disabled) { opacity: 0.9; transform: translateY(1px); }
:root[data-style="bazowy"] .btn-secondary {
  background: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--text-hi);
  box-shadow: none;
}
:root[data-style="bazowy"] .btn-ghost { border: 1px solid transparent; color: var(--text-dim); }
/* dostępność: wyraźny ring klawiaturowy na wszystkim interaktywnym */
:root[data-style="bazowy"] .btn:focus-visible,
:root[data-style="bazowy"] .quiz-option:focus-visible,
:root[data-style="bazowy"] .tl-row:focus-visible,
:root[data-style="bazowy"] .tl-cta:focus-visible,
:root[data-style="bazowy"] .footer-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
:root[data-style="bazowy"] .game-display {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-hi);
  text-shadow: none;
}
:root[data-style="bazowy"] h2 { font-weight: 700; letter-spacing: -0.01em; }
:root[data-style="bazowy"] .brand-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
:root[data-style="bazowy"] .brand-logo {
  border: 1px solid var(--line);
  box-shadow: none;
  border-radius: 0;               /* wireframe: sygnet w kwadracie, nie kole */
}
:root[data-style="bazowy"] .brand-logo img { border-radius: 0; }
/* pola formularzy: obrys hairline + ring akcentu na focusie */
:root[data-style="bazowy"] .text-input,
:root[data-style="bazowy"] .challenge-input,
:root[data-style="bazowy"] .taskqr-manual-input {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: calc(12px * var(--qq-sp-scale, 1)) calc(14px * var(--qq-sp-scale, 1));
  color: var(--text-hi);
  font-family: var(--sans);
}
:root[data-style="bazowy"] .text-input:focus,
:root[data-style="bazowy"] .challenge-input:focus,
:root[data-style="bazowy"] .taskqr-manual-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--qq-acc-soft, rgba(37, 99, 235, 0.15));
}
/* quiz: czyste karty odpowiedzi, litera jako okrągły badge */
:root[data-style="bazowy"] .quiz-options { gap: 10px; }
:root[data-style="bazowy"] .quiz-option {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: calc(14px * var(--qq-sp-scale, 1)) calc(16px * var(--qq-sp-scale, 1));
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  transition: border-color 0.12s ease, background 0.12s ease;
}
:root[data-style="bazowy"] .quiz-option:hover { border-color: var(--line-strong); }
:root[data-style="bazowy"] .quiz-option.selected {
  border-color: var(--accent);
  background: var(--qq-acc-soft, rgba(37, 99, 235, 0.1));
  color: var(--text-hi);
  box-shadow: none;
}
:root[data-style="bazowy"] .quiz-option-letter {
  width: 26px; height: 26px;
  border-radius: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  color: var(--text-dim);
  flex-shrink: 0;
}
:root[data-style="bazowy"] .quiz-option.selected .quiz-option-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--qq-on-acc, #fff);
}
:root[data-style="bazowy"] .task-question {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
}
/* HUD: jasny pasek z hairline'em, akcentowy progress */
:root[data-style="bazowy"] .tasks-header {
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
}
:root[data-style="bazowy"] .tasks-header h2 { color: var(--text-hi); font-weight: 700; }
:root[data-style="bazowy"] .tasks-header .eyebrow,
:root[data-style="bazowy"] .tasks-header .nick-label,
:root[data-style="bazowy"] .tasks-header .progress-label,
:root[data-style="bazowy"] .tasks-header .timer-chip { color: var(--text-dim); }
:root[data-style="bazowy"] .tasks-header .nick-value,
:root[data-style="bazowy"] .tasks-header .score,
:root[data-style="bazowy"] .tasks-header .progress-label .done { color: var(--accent); }
:root[data-style="bazowy"] .tasks-header .timer-chip { border: none; padding: 0; }
:root[data-style="bazowy"] .tasks-header .map-open-btn {
  border: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--text-dim);
  border-radius: var(--r-sm);
}
:root[data-style="bazowy"] .progress-bar {
  height: 4px;
  border-radius: 0;
  background: var(--surface-2);
  overflow: hidden;
}
:root[data-style="bazowy"] .progress-fill { height: 100%; background: var(--accent); }
/* lista zadań: szkieletowe wiersze rozdzielone hairline'ami (żadnych kart);
   znacznik statusu = kwadracik jak checkbox — done dostaje wypełnienie */
:root[data-style="bazowy"] .tl { padding-left: 30px; }
:root[data-style="bazowy"] .tl::before { display: none; }
:root[data-style="bazowy"] .tl-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: calc(13px * var(--qq-sp-scale, 1)) 0;
  margin-bottom: 0;
}
:root[data-style="bazowy"] .tl-item:first-child { border-top: 1px solid var(--line); }
:root[data-style="bazowy"] .tl-item.current {
  border-bottom-color: var(--line);
  box-shadow: none;
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  margin-left: -16px;
}
:root[data-style="bazowy"] .tl-item.done-ok,
:root[data-style="bazowy"] .tl-item.done-fail { opacity: 0.65; }
:root[data-style="bazowy"] .tl-item.locked { opacity: 0.55; }
:root[data-style="bazowy"] .tl-dot {
  left: -30px; top: 17px;
  width: 14px; height: 14px;
  border-radius: 0;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-1);
}
:root[data-style="bazowy"] .tl-item.current .tl-dot {
  /* current ma margin-left -16px + padding 14px → punkt odniesienia przesunięty
     o 14px; -16px wyrównuje kwadracik z pozostałymi (wizualnie -30px) */
  left: -16px; top: 17px;
  width: 14px; height: 14px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  box-shadow: none;
}
:root[data-style="bazowy"] .tl-item.done-ok .tl-dot { background: var(--success); border-color: var(--success); }
:root[data-style="bazowy"] .tl-item.done-fail .tl-dot { background: var(--danger); border-color: var(--danger); }
:root[data-style="bazowy"] .tl-item.locked .tl-dot { border-style: dashed; border-color: var(--line-strong); }
:root[data-style="bazowy"] .tl-kicker { color: var(--accent); letter-spacing: 0.04em; }
:root[data-style="bazowy"] .tl-pts {
  color: var(--text-faint);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
:root[data-style="bazowy"] .tl-desc {
  font-family: var(--sans);
  font-style: normal;
  color: var(--text-dim);
}
:root[data-style="bazowy"] .tl-cta {
  background: var(--accent);
  color: var(--qq-on-acc, #fff);
  border-radius: var(--r-md);
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-weight: 600;
}
:root[data-style="bazowy"] .tl-cta:active { opacity: 0.9; }
/* zdjęcia, karty, finisz, modal — hairline, bez cieni ozdobnych */
:root[data-style="bazowy"] .desc-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
:root[data-style="bazowy"] .hint-btn {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text-dim);
}
:root[data-style="bazowy"] .hint-revealed {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
}
:root[data-style="bazowy"] .task-image,
:root[data-style="bazowy"] .welcome-hero {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: none;
}
:root[data-style="bazowy"] .finish-score {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
}
:root[data-style="bazowy"] .finish-score-item { border: none; border-radius: 0; }
:root[data-style="bazowy"] .finish-score-item .value { color: var(--accent); }
:root[data-style="bazowy"] .modal-box {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
}

/* ─── Grafika zadania (task.image) ─── */
.task-image {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  margin: 12px 0;
}
.task-image img {
  display: block;
  width: 100%;
  max-height: 38vh;
  object-fit: cover;
}

/* ─── Logo organizatora (white-label, branding.logo) ─── */
.brand-logo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.brand-logo img[hidden] { display: none; }  /* [hidden] musi wygrać z display:block */

/* ─── Blok organizatora na finiszu (finish.note / CTA) ─── */
.finish-org {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  border-top: 1px solid var(--line);
  padding-top: calc(18px * var(--qq-sp-scale, 1));
}
.finish-org-note {
  font-family: var(--serif);
  font-size: var(--fs-lg);
  font-style: italic;
  color: var(--text-hi);
  margin: 0;
}

/* ─── Header gry (branding.headerImage) ─── */
.welcome-hero {
  width: 100%;
  flex-shrink: 0;              /* rodzice bywają flex-column z overflow — nie zgniataj */
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid var(--line);
}
.welcome-hero img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
}
:root[data-style="elegancki"] .welcome-hero,
:root:not([data-style]) .welcome-hero {
  border: 1px solid var(--line-strong);   /* editorial: rama jak w albumie */
}

/* ─── Welcome z headerem: zdjęcie na spad, sygnet nachodzi kółkiem ───
   (klasę has-hero ustawia basic.js, gdy gra ma branding.headerImage)  */
:root .view.has-hero {
  padding: 0;                              /* zdjęcie wchodzi pod notch i na boki */
}
:root .view.has-hero .welcome-body {
  gap: 18px;
  justify-content: flex-start;             /* zdjęcie startuje od samej góry */
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
}
:root .view.has-hero .welcome-actions { margin-top: auto; }  /* CTA przy dole */
:root .view.has-hero .welcome-hero {
  margin: 0;
  border: none;                            /* spad = bez ramy, także w eleganckim */
  border-radius: 0;
  box-shadow: none;                        /* zabawny dodaje naklejkowy cień — nie na spadzie */
}
:root .view.has-hero .welcome-hero img {
  aspect-ratio: auto;
  height: 34vh;                            /* ~1/3 wysokości na mobile */
}
@media (min-width: 768px) {
  :root .view.has-hero .welcome-hero img { height: 26vh; }  /* ~1/4 na desktopie */
}
:root .view.has-hero .brand-intro {
  position: relative;
  z-index: 1;
  margin-top: -44px;                       /* sygnet (88px) w połowie na zdjęciu */
  padding: 0 22px;
}
:root .view.has-hero .welcome-actions { padding: 0 22px; }

/* większy tytuł gry na ekranie startowym */
.view[data-view="welcome"] .game-display {
  font-size: clamp(2.6rem, 9vw, 3.4rem);
  max-width: 380px;
}

/* Krótki opis gry — jedno zdanie pod tytułem. Świadomie drugorzędny:
   tytuł zostaje bohaterem ekranu, opis tylko odpowiada „o czym to jest". */
.welcome-subtitle {
  margin-top: 10px;
  max-width: 380px;
  font-size: 0.975rem;
  line-height: 1.45;
  color: var(--text-dim);
  text-wrap: balance;
}

/* Podpis autorstwa gry publicznej — nad tytułem, pod nadkreśleniem:
   pierwsza linia to napis, druga to znak marki. Stoi wysoko, więc znak jest
   przygaszony kolorem, żeby prowadził wzrok DO tytułu, a nie zabierał mu uwagę. */
.welcome-credit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 14px 0 16px;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.welcome-credit-mark {
  height: 22px;
  width: auto;
  color: var(--text-dim);
  flex-shrink: 0;
}
/* Gra bez własnej ikony nie dostaje sygnetu, więc nie ma czego wsuwać
   na zdjęcie headera — inaczej nadkreślenie wjechałoby pod jego krawędź.
   [data-view] dokładamy dla CIĘŻARU selektora: sygnatura Ekspedycja ustawia
   ten sam ujemny margines własną regułą o równej specyficzności w qq-skin.css,
   a ta wczytuje się później i wygrywałaby remis. */
.brand-logo[hidden] { display: none; }
:root .view.has-hero.no-mark[data-view="welcome"] .brand-intro {
  margin-top: 0;
  padding-top: 20px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.55;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--text-hi); line-height: 1.2; font-family: var(--serif); font-weight: 600; }
h1 em, h2 em, .game-display em { font-style: italic; }

/* ── Etykiety CAPS (wspólny wzorzec editorial) ── */
.eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps-wide);
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.eyebrow .acc { color: var(--accent); }
.eyebrow-right { color: var(--accent); display: inline-flex; align-items: center; gap: 8px; }

/* ── View dispatcher ── */
.view { display: none; position: fixed; inset: 0; flex-direction: column; }
.view.active { display: flex; }
.view-padded {
  padding: calc(env(safe-area-inset-top, 0px) + 20px * var(--qq-sp-scale, 1)) calc(22px * var(--qq-sp-scale, 1)) calc(env(safe-area-inset-bottom, 0px) + 20px * var(--qq-sp-scale, 1));
  overflow-y: auto;
}

/* ── Przyciski ── */
.btn {
  border: none;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
  padding: calc(15px * var(--qq-sp-scale, 1)) calc(20px * var(--qq-sp-scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active:not(:disabled) { transform: scale(0.985); opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: rgb(var(--ink)); color: var(--bg); }
.btn-secondary {
  background: transparent;
  color: var(--text-hi);
  border: 1px solid rgb(var(--ink));
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--line);
}
.btn-danger { background: var(--danger); color: #fff; }

/* ── Nagłówek widoku (back + tytuł-kicker) ── */
.view-header {
  padding: calc(env(safe-area-inset-top, 0px) + 16px * var(--qq-sp-scale, 1)) calc(20px * var(--qq-sp-scale, 1)) calc(10px * var(--qq-sp-scale, 1));
  display: flex;
  align-items: center;
  gap: 12px;
}
.view-header h2 {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--text-faint);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.back-btn:active { background: var(--surface-2); }
.back-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ── Welcome / picker ── */
.welcome-body {
  flex: 1;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 26px;
  display: flex;
  flex-direction: column;
}
.brand-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps-wide);
  color: var(--text-faint);
  margin-bottom: 12px;
}
.brand-eyebrow span { color: var(--accent); }

.brand-logo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid rgb(var(--ink));
  background: var(--surface-1);
  color: rgb(var(--ink));
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 6px var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.brand-logo svg { width: 46px; height: 46px; display: block; }
.brand-logo svg[hidden] { display: none; }  /* [hidden] musi wygrać z display:block */

/* ─── Ikona gry (branding.icon) w sygnecie ─── */
/* Glif w kolorze akcentu — ten sam kształt co na okładce PWA i na liście gier
   w panelu; tam jest neutralny, tu niesie kolor gry. */
.brand-logo svg.brand-logo-icon {
  color: var(--accent);
  width: 42px;
  height: 42px;
}

@media (prefers-reduced-motion: no-preference) {
  .view.active .brand-intro {
    animation: brand-in 0.55s ease both;
  }
  .view.active .brand-intro .brand-logo {
    animation: brand-in 0.55s ease 0.08s both;
  }
}
@keyframes brand-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.game-display {
  font-family: var(--serif);
  font-size: var(--fs-display);
  font-weight: 600;
  line-height: 1.1;
  max-width: 320px;
}
/* długi tytuł gry schodzi o stopień (klasę nadaje basic.js przy >24 znakach) —
   pełny stopień łamał się na cztery linijki i spychał przycisk startu */
.game-display.long-title {
  font-size: calc(var(--fs-display) * 0.78);
  max-width: 380px;
}

.welcome-body h1 {
  font-size: var(--fs-xl);
  font-weight: 600;
}
.welcome-body h1 span { color: var(--accent); }
.welcome-body .intro {
  color: var(--text-dim);
  font-size: var(--fs-sm);
  line-height: 1.6;
  max-width: 320px;
}

.welcome-actions { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.welcome-actions .btn { width: 100%; }

/* ── Nick ── */
.nick-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}
.nick-body h2 { font-size: var(--fs-xl); text-align: center; }
.nick-body p { color: var(--text-dim); font-size: var(--fs-sm); text-align: center; }

.text-input {
  width: 100%;
  padding: 14px 4px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgb(var(--ink));
  border-radius: 0;
  color: var(--text-hi);
  font-size: var(--fs-lg);
  font-family: var(--serif);
  outline: none;
  text-align: center;
}
.text-input:focus { border-bottom-color: var(--accent); }
.text-input::placeholder { color: var(--text-faint); font-style: italic; }

.nick-actions { display: flex; gap: 12px; }
.nick-actions .btn { flex: 1; }

/* ── Briefing (strona książki) ── */
.briefing-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}
.briefing-greeting {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--text-faint);
}
.briefing-greeting span { color: var(--accent); }
.briefing-body h2 { font-size: var(--fs-display); line-height: 1.08; margin-top: 6px; }
.briefing-body h2::after {
  content: '';
  display: block;
  width: 36px;
  height: 1px;
  background: var(--accent);
  margin-top: 14px;
}
.briefing-section-label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  margin-bottom: 10px;
  font-weight: 600;
}
.briefing-section p {
  color: var(--text);
  font-family: var(--serif);
  font-size: var(--fs-base);
  line-height: 1.7;
}
.briefing-section ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  counter-reset: howto;
}
.briefing-section ul li {
  position: relative;
  counter-increment: howto;
  padding: 9px 0 9px 34px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.briefing-section ul li:last-child { border-bottom: none; }
.briefing-section ul li::before {
  content: counter(howto, lower-roman) '.';
  position: absolute;
  left: 4px;
  top: 8px;
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--fs-base);
  color: var(--accent);
}
.briefing-hint {
  padding: calc(13px * var(--qq-sp-scale, 1)) calc(16px * var(--qq-sp-scale, 1));
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 0;
  color: var(--text);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.briefing-body .btn { width: 100%; margin-top: 4px; }

/* ── Lista zadań: nagłówek + oś podróży ── */
.tasks-header {
  padding: calc(env(safe-area-inset-top, 0px) + 18px * var(--qq-sp-scale, 1)) calc(22px * var(--qq-sp-scale, 1)) calc(6px * var(--qq-sp-scale, 1));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tasks-header h2 { font-size: var(--fs-xl); line-height: 1.1; }
/* klasy starego nagłówka — zachowane do czasu Taska 3 */
.tasks-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nick-label { font-size: var(--fs-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: var(--ls-caps); }
.nick-value { font-size: var(--fs-base); font-weight: 600; color: var(--text-hi); font-family: var(--serif); }
.tasks-header-right { display: flex; align-items: center; gap: 10px; }
.score {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  background: transparent;
}
.timer-chip.limit { color: var(--accent); border-color: var(--accent); }
.timer-chip.danger { color: var(--danger); border-color: var(--danger); }
.map-open-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-hi);
  font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.map-open-btn:active { background: var(--surface-2); }

.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-bar { position: relative; height: 1px; background: var(--line); overflow: visible; }
.progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  height: 1px; background: var(--accent);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-label {
  display: flex; justify-content: space-between;
  font-size: var(--fs-xs); color: var(--text-faint);
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  font-variant-numeric: tabular-nums;
}
.progress-label .done { color: var(--accent); font-weight: 600; }

.tasks-list { flex: 1; overflow-y: auto; padding: calc(14px * var(--qq-sp-scale, 1)) calc(22px * var(--qq-sp-scale, 1)) calc(8px * var(--qq-sp-scale, 1)); }
.tasks-footer { padding: 10px 22px calc(env(safe-area-inset-bottom, 0px) + 14px); border-top: 1px solid var(--line); }
.tasks-footer .btn { width: 100%; }

/* ── Oś podróży (nowy układ listy — markup w Tasku 3) ── */
.tl { position: relative; padding-left: 22px; }
.tl::before {
  content: '';
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--line);
}
.tl-item { position: relative; padding: 9px 0; }
.tl-item + .tl-item { border-top: 1px solid transparent; }
.tl-dot {
  position: absolute;
  left: -22px; top: 14px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--text-faint);
  box-sizing: border-box;
}
.tl-item.done-ok .tl-dot { background: var(--accent); border-color: var(--accent); }
.tl-item.done-fail .tl-dot { background: var(--danger); border-color: var(--danger); }
.tl-item.current .tl-dot {
  left: -24px; top: 12px;
  width: 15px; height: 15px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}
.tl-item.done-ok, .tl-item.done-fail { opacity: 0.55; }
.tl-item.locked { opacity: 0.4; }
/* Zadanie za bramką terenową jest DOSTĘPNE (gracz może iść je odblokować),
   więc nie przygaszamy go jak zablokowanego — sygnałem jest kłódka przy
   punktach i kropka w kolorze akcentu z pierścieniem. */
.tl-item.gated .tl-dot { background: transparent; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.tl-gate-note { font-style: italic; }
/* zwinięty wiersz zadania za bramką: podpowiedź, KTÓRY kod je otwiera
   (kod ręczny jest wydrukowany na tabliczce pod QR-em) */
.tl-gate-hint {
  font-size: var(--fs-xs);
  font-style: italic;
  color: var(--text-dim);
  margin-top: 2px;
}
.tl-title { font-family: var(--serif); font-size: var(--fs-base); font-weight: 600; color: var(--text-hi); }
.tl-item.done-ok .tl-title, .tl-item.done-fail .tl-title { text-decoration: line-through; font-weight: 400; }
.tl-pts {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin-top: 2px;
}
.tl-item.done-fail .tl-pts { color: var(--danger); }
.tl-item.locked .tl-pts { color: var(--text-faint); }
.tl-kicker {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--accent);
  margin-bottom: 3px;
}
.tl-item.current .tl-title { font-size: var(--fs-lg); }
.tl-desc {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  line-height: 1.55;
  margin: 4px 0 10px;
}
.tl-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgb(var(--ink));
  color: var(--bg);
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
}
.tl-cta:active { opacity: 0.85; }
.tl-row { cursor: pointer; }
.tl-row:active .tl-title { color: var(--accent); }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 22px;
}
.footer-link {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
  cursor: pointer;
  padding: 8px 2px;
}
.footer-link:active { color: var(--text-hi); }
.footer-link.danger { color: var(--danger); }

/* ── Korpus zadania (quiz / challenge / taskqr / photo) ── */
.task-body {
  flex: 1;
  padding: calc(14px * var(--qq-sp-scale, 1)) calc(22px * var(--qq-sp-scale, 1)) calc(20px * var(--qq-sp-scale, 1));
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}
.task-kicker {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--accent);
  margin-bottom: 8px;
}
.task-question {
  font-family: var(--serif);
  font-size: var(--fs-lg);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-hi);
}
.task-attempts {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  margin-top: 10px;
}
.task-footer { padding: calc(12px * var(--qq-sp-scale, 1)) calc(22px * var(--qq-sp-scale, 1)) calc(env(safe-area-inset-bottom, 0px) + 16px * var(--qq-sp-scale, 1)); }
.task-footer .btn { width: 100%; }

.quiz-options { display: flex; flex-direction: column; }
.quiz-option {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  padding: calc(14px * var(--qq-sp-scale, 1)) calc(4px * var(--qq-sp-scale, 1));
  color: var(--text);
  font-size: var(--fs-base);
  font-family: var(--serif);
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.quiz-option:first-child { border-top: 1px solid var(--line-soft); }
.quiz-option:active { background: var(--surface-2); }
.quiz-option.selected { color: var(--text-hi); border-bottom-color: rgb(var(--ink)); }
.quiz-option-letter {
  width: auto; height: auto;
  background: none;
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--text-faint);
  flex-shrink: 0;
  text-transform: lowercase;
}
.quiz-option.selected .quiz-option-letter { color: var(--accent); font-weight: 600; }

/* ── Challenge (tekst / liczba / zagadka) ── */
.challenge-input-wrap { display: flex; flex-direction: column; gap: 6px; }
.challenge-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--text-faint);
}
.challenge-input {
  width: 100%;
  padding: 12px 2px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgb(var(--ink));
  border-radius: 0;
  color: var(--text-hi);
  font-size: var(--fs-lg);
  font-family: var(--serif);
  outline: none;
}
.challenge-input:focus { border-bottom-color: var(--accent); }
.challenge-input::placeholder { color: var(--text-faint); font-style: italic; font-size: var(--fs-base); }
.challenge-input.num { font-variant-numeric: tabular-nums; text-align: center; letter-spacing: 0.08em; font-family: var(--sans); }

/* ── Zdanie z luką (typ „Uzupełnij lukę") ──
   Cytat w ramce, a w miejscu brakującego wyrazu podkreślona przerwa,
   która wypełnia się na żywo tym, co gracz wpisuje niżej. Tylko zmienne
   sygnatur — wygląd jedzie automatycznie z wybranym stylem gry. */
.gap-sentence {
  font-family: var(--serif);
  font-size: var(--fs-lg);
  line-height: 1.8;
  color: var(--text-hi);
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-md);
  padding: calc(14px * var(--qq-sp-scale, 1)) calc(16px * var(--qq-sp-scale, 1));
}
.gap-blank {
  display: inline-block;
  min-width: 5.5ch;
  margin: 0 3px;
  padding: 0 4px;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
  /* pusta luka nie może się zapaść do zera — inline-block bez treści
     ma zerową wysokość, a wtedy kreska ląduje na linii bazowej tekstu */
  min-height: 1.2em;
  vertical-align: baseline;
}

/* ── Sejf: cyfrowa kłódka (typ „safe") ──
   Bębny jak w szyfrowej kłódce: pionowy pasek cyfr w okienku, środek
   = ustawiona cyfra, sąsiednie wystają przycięte u góry i u dołu.
   Geometrię paska liczy js/views/safe.js z realnych wymiarów okienka,
   więc --safe-digit-h to jedyne źródło prawdy o wysokości wiersza.
   Kolory wyłącznie ze zmiennych sygnatur + neutralne rgba — walec
   wygląda metalicznie i w jasnych, i w ciemnych stylach. */
.safe-lock {
  --safe-digit-h: 44px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: calc(14px * var(--qq-sp-scale, 1)) calc(10px * var(--qq-sp-scale, 1));
}
.safe-dials { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.safe-dial { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.safe-dial-btn {
  border: none;
  background: transparent;
  color: var(--text-faint);
  width: 52px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--r-sm);
  padding: 0;
}
.safe-dial-btn svg { width: 22px; height: 22px; fill: currentColor; }
.safe-dial-btn:active { color: var(--accent); }
.safe-dial-window {
  position: relative;
  width: 52px;
  height: calc(var(--safe-digit-h) * 2.5); /* ~2,5 wiersza: sąsiedzi wystają jak na walcu */
  overflow: hidden;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: var(--surface-1);
  touch-action: none;   /* przeciąganie bębna nie może scrollować widoku */
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.safe-dial-window:active { cursor: grabbing; }
.safe-dial-window:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* krawędź walca: cień u góry i dołu NAD cyframi + delikatny blik w środku */
.safe-dial-window::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg,
      rgba(0, 0, 0, 0.38) 0%, rgba(0, 0, 0, 0.10) 22%, rgba(0, 0, 0, 0) 38%,
      rgba(255, 255, 255, 0.07) 50%,
      rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, 0.10) 78%, rgba(0, 0, 0, 0.38) 100%);
}
/* zaznaczenie środkowego wiersza — linie „okienka odczytu" */
.safe-dial-window::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: var(--safe-digit-h);
  transform: translateY(-50%);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  pointer-events: none;
}
.safe-dial-strip {
  transition: transform 0.22s cubic-bezier(0.22, 0.9, 0.36, 1);
  will-change: transform;
}
.safe-dial-strip.no-anim { transition: none; }
.safe-digit {
  height: var(--safe-digit-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-hi);
}
/* zły kod — kłódka trzęsie się jak szarpnięta */
.safe-lock.shake { animation: safe-shake 0.45s; }
@keyframes safe-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
/* dobry kod — rama i cyfry łapią kolor sukcesu na moment przed finałem */
.safe-lock.open { border-color: var(--success); animation: safe-open 0.4s; }
.safe-lock.open .safe-digit { color: var(--success); }
@keyframes safe-open {
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ── Ekran bez gry (nolink): drogi wejścia ──
   W zainstalowanej aplikacji nie ma paska adresu, więc te przyciski są
   JEDYNYM sposobem, żeby gracz dostał się do gry. */
.nolink-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin: 26px auto 0;
}
.nolink-form { display: flex; gap: 8px; }
.nolink-form input {
  flex: 1;
  min-width: 0;
  font-family: var(--sans);
  font-size: 16px; /* < 16px = iOS zoomuje pole przy fokusie */
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text-hi);
}
.nolink-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nolink-form .btn { flex: 0 0 auto; }
.nolink-error {
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--danger);
  text-align: center;
}

/* ── Bramka wejścia (hasło / e-mail od organizatora) ──
   Ten sam wąski słupek co „brak linku": ekran stoi przed konfiguracją gry,
   więc jedzie na skórce aplikacji, nie na brandingu organizatora. */
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 340px;
  margin: 26px auto 0;
}
.gate-field { display: flex; flex-direction: column; gap: 6px; }
.gate-label {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-dim);
}
.gate-field input {
  width: 100%;
  min-width: 0;
  font-family: var(--sans);
  font-size: 16px; /* < 16px = iOS zoomuje pole przy fokusie */
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--text-hi);
}
.gate-field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Kolejność: układanie kart (typ „sequence") ──
   Pionowa lista kart z uchwytem po lewej i strzałkami po prawej. Etykiety
   kierunku (np. „Najstarsze" / „Najnowsze") obejmują listę z góry i z dołu —
   bez nich gracz nie wie, w którą stronę rośnie porządek.
   Karta ma touch-action: none, bo przeciąganie w pionie musi trafić do nas,
   a nie do przewijania strony; widok scrolluje się palcem poza listą. */
.seq-board {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: calc(12px * var(--qq-sp-scale, 1)) calc(10px * var(--qq-sp-scale, 1));
}
.seq-edge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 4px 6px;
}
.seq-edge::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}
#seq-bottom { padding: 6px 4px 0; }
.seq-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.seq-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: calc(10px * var(--qq-sp-scale, 1)) calc(8px * var(--qq-sp-scale, 1));
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.18s cubic-bezier(0.22, 0.9, 0.36, 1), box-shadow 0.18s, border-color 0.18s;
  will-change: transform;
}
.seq-num {
  width: 18px;
  flex-shrink: 0;
  text-align: right;
  font-family: var(--sans);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.seq-grip { display: flex; flex-shrink: 0; color: var(--text-faint); }
.seq-grip svg { width: 18px; height: 18px; fill: currentColor; }
.seq-text {
  flex: 1;
  min-width: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.35;
  color: var(--text-hi);
}
.seq-moves { display: flex; flex-shrink: 0; gap: 2px; }
.seq-move {
  border: none;
  background: transparent;
  color: var(--text-faint);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.seq-move svg { width: 20px; height: 20px; fill: currentColor; }
.seq-move:active { color: var(--accent); }
.seq-move:disabled { opacity: 0.3; cursor: default; }
.seq-move:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* karta w ręku: unosi się nad resztą i nie animuje transformu (jedzie za palcem) */
.seq-item.dragging {
  transition: box-shadow 0.18s, border-color 0.18s;
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  cursor: grabbing;
  position: relative;
  z-index: 2;
}
/* zła kolejność — plansza szarpie jak przy sejfie (ten sam język zwrotny) */
.seq-board.shake { animation: safe-shake 0.45s; }
.seq-board.solved { border-color: var(--success); animation: safe-open 0.4s; }
.seq-board.solved .seq-item { border-color: var(--success); }
.seq-board.solved .seq-num { color: var(--success); }

/* ── Podpowiedzi (przypisy z marginesu) ── */
.hints-box { display: flex; flex-direction: column; gap: 10px; }
.hint-btn {
  background: transparent;
  border: 1px dashed var(--accent);
  border-radius: var(--r-md);
  padding: 12px 16px;
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hint-btn:active { background: var(--surface-2); }
.hint-btn .cost { color: var(--danger); font-variant-numeric: tabular-nums; }
.hint-revealed {
  padding: 12px 16px;
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 0;
  color: var(--text);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.hint-revealed .hint-tag {
  font-family: var(--sans);
  font-style: normal;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--accent);
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
}

/* ── Zadanie QR (intro) ── */
.taskqr-body { flex: 1; padding: 14px 22px 20px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.desc-card { background: transparent; border: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; padding: calc(16px * var(--qq-sp-scale, 1)) calc(2px * var(--qq-sp-scale, 1)); }
.desc-card .label { font-size: var(--fs-xs); color: var(--accent); text-transform: uppercase; letter-spacing: var(--ls-caps); font-weight: 600; margin-bottom: 8px; }
.desc-card .text { font-family: var(--serif); font-size: var(--fs-base); line-height: 1.65; color: var(--text-hi); }
.taskqr-scan-btn { padding: 18px !important; }
.taskqr-scan-btn svg { width: 20px; height: 20px; fill: currentColor; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-caps); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.taskqr-manual-label { font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: 8px; }
.taskqr-manual-input {
  width: 100%;
  padding: 14px 4px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgb(var(--ink));
  border-radius: 0;
  color: var(--text-hi);
  font-size: var(--fs-lg);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  margin-bottom: 12px;
}
.taskqr-manual-input:focus { border-bottom-color: var(--accent); }
.taskqr-manual-input::placeholder { color: var(--text-faint); letter-spacing: normal; text-transform: none; font-family: var(--sans); font-size: var(--fs-sm); }

/* ── Foto-misja ── */
.photo-body { flex: 1; padding: 14px 22px 20px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.photo-preview-wrap {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-preview-wrap img { width: 100%; max-height: 45vh; object-fit: contain; display: block; }
.photo-placeholder { padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: var(--fs-sm); font-family: var(--serif); font-style: italic; line-height: 1.6; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.photo-placeholder .cam { font-size: 2rem; }
.photo-actions { display: flex; gap: 10px; }
.photo-actions .btn { flex: 1; }

/* ═══ CIEMNA WYSPA: Skaner ═══ */
.scan-camera-wrap { position: relative; flex: 1; overflow: hidden; background: #060708; }
/* Podgląd kamery powiększamy TRANSFORMEM, a nie object-fit: cover — i to jest
   decyzja o tym, czy skaner w ogóle czyta kody. html5-qrcode wycina fragment
   klatki, przeliczając go przez clientWidth/clientHeight elementu <video>,
   osobno w poziomie i w pionie. Rozciągnięcie podglądu na cały ekran
   (390×844 z klatki 640×480) dawało kanwę spłaszczoną prawie trzykrotnie —
   kod był na niej nieczytelny dla dekodera. Transform nie zmienia
   clientWidth/clientHeight, więc biblioteka liczy na naturalnych
   proporcjach, a gracz i tak widzi obraz na pełnym ekranie.
   Skalę ustawia js/views/scan.js (--scan-zoom) po starcie kamery. */
.scan-stage {
  position: absolute; top: 50%; left: 50%; width: 100%;
  transform: translate(-50%, -50%) scale(var(--scan-zoom, 1));
  transform-origin: center center;
}
#reader { width: 100%; }
#reader video { display: block; width: 100% !important; height: auto !important; border: none !important; }
#reader canvas { position: absolute !important; opacity: 0 !important; pointer-events: none !important; }
#reader br, #reader img[alt="Info icon"], #reader a[href*="scanapp"], #reader span { display: none !important; }
.overlay { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
/* przyciemnienie wyśrodkowane na celowniku (ten stoi 13px nad środkiem) */
.overlay::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% calc(50% - 13px), transparent 120px, rgba(0, 0, 0, 0.55) 180px); }
.scan-frame { position: absolute; top: 50%; left: 50%; width: 260px; height: 260px; transform: translate(-50%, -55%); }
/* Celownik w akcencie gry — skaner ma należeć do tej samej gry, co reszta
   ekranów. Ale kadr z aparatu bywa dowolnie jasny albo ciemny, a akcent
   dowolnie ciemny albo jasny, więc sam kolor nie wystarcza: biała obwódka
   plus ciemna poświata trzymają celownik widocznym na każdym tle.
   Czytelność przed dekoracją. */
.corner { position: absolute; width: 30px; height: 30px; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.7)); }
.corner::before, .corner::after {
  content: ''; position: absolute;
  background: var(--accent, #fff);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}
.corner--tl { top: 0; left: 0; }
.corner--tl::before { top: 0; left: 0; width: 30px; height: 2px; }
.corner--tl::after  { top: 0; left: 0; width: 2px; height: 30px; }
.corner--tr { top: 0; right: 0; }
.corner--tr::before { top: 0; right: 0; width: 30px; height: 2px; }
.corner--tr::after  { top: 0; right: 0; width: 2px; height: 30px; }
.corner--bl { bottom: 0; left: 0; }
.corner--bl::before { bottom: 0; left: 0; width: 30px; height: 2px; }
.corner--bl::after  { bottom: 0; left: 0; width: 2px; height: 30px; }
.corner--br { bottom: 0; right: 0; }
.corner--br::before { bottom: 0; right: 0; width: 30px; height: 2px; }
.corner--br::after  { bottom: 0; right: 0; width: 2px; height: 30px; }
.scan-line {
  position: absolute; left: 8px; right: 8px; height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--accent, #fff), transparent);
  animation: scanMove 2.5s ease-in-out infinite;
}
@keyframes scanMove { 0%, 100% { top: 8px; opacity: 0.4; } 50% { top: calc(100% - 10px); opacity: 1; } }
/* z-index 46 na obu paskach: NAD ekranem „Brak dostępu do kamery" (40) i nad
   ekranem odmowy uprawnień (45). Oba ekrany zasłaniały sobą przycisk powrotu,
   więc gracz zostawał na nich bez wyjścia, a dolny pasek niesie pole na kod
   z tabliczki — bez kamery jedyne wejście do zadania w terenie. */
.scan-top-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 46;
  padding: calc(env(safe-area-inset-top, 12px) + 12px) 16px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
  display: flex; align-items: center; gap: 12px;
}
.scan-top-bar .back-btn { background: rgba(0, 0, 0, 0.4); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.scan-top-bar .title {
  flex: 1; text-align: center;
  font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: #fff; padding-right: 40px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.scan-top-bar .title span { color: #fff; opacity: 0.7; }
.scan-bottom-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 46;
  padding: 16px 20px calc(env(safe-area-inset-bottom, 12px) + 16px);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  display: flex; flex-direction: column; gap: 12px;
}
/* Ekran błędu ma jasne tło gry — paski przestają być „na ciemnym obrazie".
   Bez tego biały napis i biały przycisk znikały na jasnym, a czarna poświata
   gradientu wyglądała jak brud u dołu ekranu. */
.scan-camera-wrap.is-error .scan-top-bar,
.scan-camera-wrap.is-error .scan-bottom-bar { background: none; }
.scan-camera-wrap.is-error .scan-top-bar .back-btn {
  background: var(--surface-1); border-color: var(--line); color: var(--text);
}
.scan-camera-wrap.is-error .scan-top-bar .title { color: var(--text-dim); text-shadow: none; }
.scan-camera-wrap.is-error .scan-top-bar .title span { color: var(--accent); opacity: 1; }
.scan-camera-wrap.is-error .manual-token-toggle { display: none; }
.scan-camera-wrap.is-error .manual-token-form input {
  background: var(--surface-1); border-color: var(--line); color: var(--text);
}
.scan-camera-wrap.is-error .manual-token-form input::placeholder { color: var(--text-faint); }
.scan-bottom-actions { display: flex; justify-content: center; gap: 24px; }
.tool-btn {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.15s; pointer-events: auto;
}
.tool-btn:active { transform: scale(0.9); }
.tool-btn.active { background: #fff; border-color: #fff; color: #0a0a0a; }
.tool-btn svg { width: 22px; height: 22px; fill: currentColor; }
.manual-token { display: flex; flex-direction: column; gap: 8px; }
.manual-token-toggle {
  background: none; border: none; color: rgba(255, 255, 255, 0.8);
  font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  font-family: var(--sans); cursor: pointer; padding: 10px;
  text-decoration: underline; text-underline-offset: 3px; align-self: center;
}
.manual-token-form { display: none; gap: 8px; }
.manual-token-form.visible { display: flex; }
.manual-token-form input {
  flex: 1; padding: 12px 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: var(--r-sm);
  color: #fff; font-size: var(--fs-sm); font-family: inherit; outline: none;
}
/* Przycisk w akcencie gry — tak samo jak każde „dalej" w tej grze
   (--qq-btn--primary: akcent + biały tekst) */
.manual-token-form button {
  padding: 12px 18px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-sm); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--fs-xs);
  cursor: pointer; font-family: var(--sans);
}
.manual-token-form button:active { background: var(--accent-dark); }
.manual-token-form input:focus { border-color: var(--accent); }
#scan-loading {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #060708; transition: opacity 0.4s;
}
#scan-loading.hidden { opacity: 0; pointer-events: none; }
.loader {
  width: 36px; height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#scan-loading p { color: rgba(255, 255, 255, 0.6); font-size: var(--fs-sm); }
#scan-camera-error {
  position: absolute; inset: 0; z-index: 40; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  /* zapas u góry na pasek powrotu, u dołu na pole z kodem z tabliczki */
  padding: calc(env(safe-area-inset-top, 12px) + 68px) 32px 150px;
  background: var(--bg); text-align: center;
}
#scan-camera-error.visible { display: flex; }
.error-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: transparent; border: 1px solid var(--danger);
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
}
.error-icon svg { width: 26px; height: 26px; fill: var(--danger); }
#scan-camera-error h2 { margin-bottom: 12px; font-size: var(--fs-lg); }
#scan-camera-error p { color: var(--text-dim); line-height: 1.6; font-size: var(--fs-sm); max-width: 320px; }
#scan-perm-denied {
  position: absolute; inset: 0; z-index: 45; display: none;
  /* margin:auto na panelu zamiast justify-content:center — przy centrowaniu
     flexem treść wyższa od ekranu ucieka górą poza zasięg przewijania,
     a instrukcja odblokowania kamery bywa długa (mały telefon, 4 kroki).
     Dolny zapas: pole na kod z tabliczki leży na dole ekranu. */
  flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top, 12px) + 68px) 24px 120px;
  background: var(--bg); overflow-y: auto;
}
#scan-perm-denied.visible { display: flex; }
#scan-perm-denied .panel { max-width: 360px; width: 100%; margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
/* przekreślona kamera to rysunek konturowy — wypełnienie robiło z niej plamę */
#scan-perm-denied .error-icon svg {
  fill: none; stroke: var(--danger); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
#scan-perm-denied h2 { font-size: var(--fs-lg); }
#scan-perm-denied .lead { color: var(--text-dim); line-height: 1.6; font-size: var(--fs-sm); }
#scan-perm-denied .steps { background: var(--surface-2); border: none; border-radius: var(--r-md); padding: 14px 18px; text-align: left; width: 100%; }
#scan-perm-denied .steps-title { font-size: var(--fs-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: var(--ls-caps); font-weight: 600; margin-bottom: 10px; }
#scan-perm-denied ol { padding-left: 20px; color: var(--text); font-size: var(--fs-sm); line-height: 1.6; display: flex; flex-direction: column; gap: 6px; }
#scan-perm-denied ol code { background: rgba(var(--accent-rgb), 0.12); color: var(--accent-dark); padding: 1px 6px; border-radius: 3px; font-size: 0.8em; }
#scan-perm-denied .platform-tabs { display: flex; gap: 6px; width: 100%; }
#scan-perm-denied .platform-tabs button {
  flex: 1; padding: 9px 10px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-dim); border-radius: var(--r-sm);
  font-family: var(--sans); font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
}
#scan-perm-denied .platform-tabs button.active { border-color: rgb(var(--ink)); color: var(--text-hi); }
#scan-perm-denied .actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px; }
#scan-perm-denied .actions .btn { width: 100%; }

/* ═══ CIEMNA WYSPA: Mapa ═══ */
.map-wrap { position: relative; flex: 1; background: #101114; }
#map-container { position: absolute; inset: 0; }
.map-top-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 500;
  padding: calc(env(safe-area-inset-top, 12px) + 12px) 16px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
  display: flex; align-items: center; gap: 12px; pointer-events: none;
}
.map-top-bar .back-btn { pointer-events: auto; background: rgba(0, 0, 0, 0.55); border-color: rgba(255,255,255,0.2); color: #fff; }
.map-top-bar .title {
  flex: 1; text-align: center;
  font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: #fff; padding-right: 40px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.map-switch {
  position: absolute;
  top: calc(env(safe-area-inset-top, 12px) + 66px);
  left: 50%; transform: translateX(-50%);
  z-index: 500;
  display: flex; gap: 4px; max-width: calc(100% - 32px); overflow-x: auto;
  background: rgba(250, 249, 246, 0.94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.map-switch[hidden] { display: none; }
.map-switch button {
  border: none; background: transparent; border-radius: var(--r-sm);
  padding: 7px 12px; white-space: nowrap;
  font-family: var(--sans); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); cursor: pointer;
}
.map-switch button.active { background: rgb(var(--ink)); color: var(--bg); }

.map-legend {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  left: 16px; right: 16px; z-index: 500;
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex; justify-content: center; gap: 18px;
  font-size: var(--fs-xs); color: var(--text);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.poi-marker {
  width: 34px; height: 34px;
  border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
.poi-marker > span { transform: rotate(45deg); font-size: var(--fs-sm); font-weight: 800; color: #fff; line-height: 1; font-family: var(--sans); }
.poi-marker.available { background: var(--accent); }
/* bramka terenowa: kolor akcentu (zadanie na wyciągnięcie ręki), ale obrys
   przerywany — sygnał, że najpierw trzeba tam zeskanować kod */
.poi-marker.gated { background: var(--accent); box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 4px var(--accent); }
.poi-marker.locked { background: #64748b; }
.poi-marker.done-ok { background: #16a34a; }
.poi-marker.done-fail { background: var(--danger); }
/* lokalizacja gracza (opt-in organizatora): przycisk + niebieska kropka */
.geo-locate-btn {
  width: 44px; height: 44px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text-hi);
  border: 1px solid rgba(127, 127, 127, 0.35); cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}
.geo-locate-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.geo-me-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #2563eb; border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.leaflet-popup-content-wrapper { background: var(--bg); color: var(--text-hi); border-radius: var(--r-md); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); }
.leaflet-popup-tip { background: var(--bg); }
.poi-popup { min-width: 170px; }
.poi-popup .t { font-weight: 600; font-family: var(--serif); font-size: var(--fs-sm); margin-bottom: 2px; }
.poi-popup .s { font-size: var(--fs-xs); color: var(--text-dim); font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.poi-popup button {
  width: 100%; padding: 9px 12px;
  background: rgb(var(--ink)); color: var(--bg);
  border: none; border-radius: var(--r-sm);
  font-weight: 600; font-family: var(--sans); cursor: pointer;
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em;
}

/* ── Finisz (epilog) ── */
.finish-body {
  flex: 1;
  padding: calc(env(safe-area-inset-top, 0px) + 30px) 22px 20px;
  display: flex; flex-direction: column; gap: 20px; overflow-y: auto;
}
.finish-hero { text-align: center; padding: 8px 0 0; }
.finish-hero .trophy {
  width: auto; height: auto; margin: 0 auto 12px;
  border-radius: 0; background: none; border: none; box-shadow: none;
  display: block; font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: var(--ls-caps-wide); text-transform: uppercase; color: var(--text-faint);
}
.finish-hero h2 { font-size: var(--fs-display); line-height: 1.1; margin-bottom: 6px; }
.finish-hero .nick { color: var(--text-hi); font-style: italic; }
.finish-timeout {
  margin: 8px auto 0; display: inline-block; padding: 5px 12px;
  border: 1px solid var(--danger); border-radius: var(--r-sm);
  color: var(--danger); font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
}
/* flex-wrap: przy pełnym wyniku typu „265 / 265" dwa kafle przestawały się
   mieścić na telefonie i wypychały layout w bok — w ostateczności schodzą
   pod siebie zamiast rozjeżdżać ekran */
.finish-score { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; }
.finish-score-item { text-align: center; border: 1px solid rgb(var(--ink)); border-radius: var(--r-md); padding: calc(12px * var(--qq-sp-scale, 1)) calc(18px * var(--qq-sp-scale, 1)); min-width: 104px; }
/* stopień wartości: mniejszy niż display (cyfry nie mają dominować nad
   nagłówkiem) i ograniczony szerokością ekranu — wynik „0 / 265" ma
   7+ znaków i w pełnym stopniu nie mieścił się na telefonie */
.finish-score-item .value { font-family: var(--serif); font-size: clamp(1.4rem, 6.5vw, calc(var(--fs-display) * 0.8)); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text-hi); }
.finish-score-item .label { font-size: var(--fs-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: var(--ls-caps); margin-top: 8px; }
.finish-summary { background: transparent; border: none; border-top: 1px solid var(--line); border-radius: 0; padding: 4px 0; }
.finish-summary-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.finish-summary-item:last-child { border-bottom: 1px solid var(--line); }
.finish-summary-item .icon { font-size: var(--fs-sm); width: 22px; text-align: center; }
.finish-summary-item .title { flex: 1; font-family: var(--serif); font-size: var(--fs-sm); color: var(--text); }
.finish-summary-item .sub { display: block; font-family: var(--sans); font-size: var(--fs-xs); color: var(--text-faint); margin-top: 2px; }
.finish-summary-item .pts { font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.06em; }
.finish-summary-item.fail .pts { color: var(--danger); }
.finish-gallery-label { font-size: var(--fs-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: var(--ls-caps); font-weight: 600; }
.finish-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.finish-gallery figure { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.finish-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.finish-gallery figcaption { padding: 7px 9px; font-size: var(--fs-xs); color: var(--text-dim); font-family: var(--serif); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finish-footer { padding: 12px 22px calc(env(safe-area-inset-bottom, 0px) + 16px); display: flex; flex-direction: column; gap: 10px; }
.finish-footer .btn { width: 100%; }

/* ── Toast ── */
#toast-container {
  position: fixed; left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateX(-50%); z-index: 1000;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: calc(100% - 32px); max-width: 400px;
}
.toast {
  background: rgb(var(--ink));
  color: var(--bg);
  padding: 13px 18px;
  border: none;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 28px rgba(28, 27, 24, 0.35);
  animation: toastIn 0.25s ease-out, toastOut 0.25s ease-in 2.75s forwards;
  max-width: 100%;
}
.toast.success { box-shadow: 0 8px 28px rgba(28, 27, 24, 0.35), inset 0 0 0 1px var(--accent); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(20px); } }

/* ── Modal ── */
#modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(28, 27, 24, 0.35);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
#modal-backdrop.visible { display: flex; }
.modal-box {
  background: var(--bg);
  border: 1px solid rgb(var(--ink));
  border-radius: var(--r-md);
  padding: 24px 20px;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 24px 64px rgba(28, 27, 24, 0.3);
  animation: toastIn 0.2s ease-out;
}
.modal-box h3 { font-size: var(--fs-lg); }
.modal-box p { font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; padding: 12px 12px; font-size: var(--fs-xs); }
.modal-actions--stack { flex-direction: column; }

/* ── Fatal error ── */
.fatal-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; gap: 16px; }
.fatal-body h2 { font-size: var(--fs-lg); }
.fatal-body p { color: var(--text-dim); font-size: var(--fs-sm); line-height: 1.6; max-width: 320px; }

/* ── Dostępność: ograniczony ruch ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .scan-line { display: none; }
  .toast { animation: none; }
}
