/*
  WreszcieZdam · style aplikacji
  Tokeny i komponenty (przyciski, karty, odpowiedzi, chipy, pola) są w css/system.css, wczytywanym przed tym plikiem.
  Tutaj: krój pisma i układ ekranów (start, kroki, gra, podsumowanie, arkusz „i”, okna); wygląd elementów jest w systemie.
  Kontrast par tekst/tło: node tools/contrast.mjs
*/
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* tylko tu: kolory sceny startowej */
  --asphalt: #6a5949; /* asfalt przy dolnej krawędzi ilustracji startowej (zmierzony z img/word-base.webp) */
  --sky: #fde8c4;     /* niebo z ilustracji */
  --mark: #f7d58b;    /* wyróżnienie dopasowania w wyszukiwarce */

  /* nazwy sprzed systemu v2, używane jeszcze przez grę i podsumowanie */
  --surface-2: var(--sunken);
  --line: #e6d8c3;
  --line-2: #cdb89b;
  --mustard: var(--warn);
  --mustard-ink: var(--warn-ink);
  --shade: var(--scrim);
  --font-display: var(--font);
  --font-text: var(--font);
  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-18: 18px; --fs-22: 22px; --fs-28: 28px; --fs-36: 36px; --fs-44: 44px;
  --lh-text: 1.5; --lh-tight: 1.2; --lh-display: 1.04;
  --s-7: 28px; --s-9: 36px;
  --edge: 12px; /* odstęp pływających elementów od krawędzi ekranu gry */
  --border: 1px solid var(--line);
  --border-2: 1px solid var(--line-2);
  --lift: var(--e-2);
  --lift-up: var(--e-3);
  --dash: repeating-linear-gradient(to right, var(--line-2) 0 10px, transparent 10px 18px);
  --t-press: 80ms; --t-fast: 120ms; --t-med: 180ms; --t-slow: 250ms; --t-enter: 280ms;
  --t-screen: 220ms; /* przejście ekranów = SCREEN_OUT_MS w main.js */
  --ease-out: cubic-bezier(.2, .8, .3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--sunken); color: var(--ink); font: var(--t-body);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

#app { position: relative; max-width: 480px; height: 100vh; height: 100dvh; margin: 0 auto; background: var(--bg); overflow: hidden; }
.screen { position: absolute; inset: 0; isolation: isolate; }

/* przejścia ekranów: wprzód z prawej, wstecz z lewej, bez kierunku lekko od dołu; czas = SCREEN_OUT_MS w main.js */
.screen:not([hidden]) { animation: screen-in var(--t-screen) var(--ease-out) both; }
.screen.leaving { animation: screen-out var(--t-screen) ease-in both; pointer-events: none; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes screen-out { to { opacity: 0; transform: translateY(-6px); } }
.screen[data-dir="fwd"]:not([hidden]) { animation-name: screen-in-fwd; }
.screen[data-dir="back"]:not([hidden]) { animation-name: screen-in-back; }
.screen.leaving[data-dir="fwd"] { animation-name: screen-out-fwd; }
.screen.leaving[data-dir="back"] { animation-name: screen-out-back; }
@keyframes screen-in-fwd { from { opacity: 0; transform: translateX(28px); } }
@keyframes screen-in-back { from { opacity: 0; transform: translateX(-28px); } }
@keyframes screen-out-fwd { to { opacity: 0; transform: translateX(-28px); } }
@keyframes screen-out-back { to { opacity: 0; transform: translateX(28px); } }

.btn span { display: inline-flex; }
.btn-row { display: flex; gap: var(--s-2); }
.btn-row .btn { flex: 1; }

/* marka */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: block; width: 30px; height: 30px; flex: none; }
.brand-name { font: 800 20px/1 var(--font); letter-spacing: -.02em; }
.brand-name em { font-style: normal; color: var(--good); }

/* ---------- ekran 0: scena startowa ---------- */
.start {
  --pills: 0px;
  --extra: 0px;
  --h1: clamp(28px, 8.6vw, 34px);
  --panel: calc(140px + var(--extra) + max(var(--s-3), var(--safe-b))); /* kremowy arkusz z przyciskami; ilustracja kończy się nad nim */
  --title-h: calc(56px + var(--safe-t) + var(--h1) * 3.25 + 10px + var(--pills));
  background: var(--asphalt); /* pod zaokrąglonymi rogami arkusza widać kolor jezdni */
  overflow: hidden;
}
.start.has-last { --extra: 26px; }
@media (min-height: 700px) { .start { --pills: 44px; } }
/* telefon poziomo (niski ekran): mniejszy nagłówek, bez „Ostatnio” i drobnego druku, żeby ilustracja nie zniknęła */
@media (max-height: 520px) {
  .start, .start.has-last { --h1: 26px; --extra: -20px; }
  .scene-last, .scene-legal { display: none; }
}
.screen.start[data-dir=""]:not([hidden]) { animation: none; } /* scena wchodzi własnym zanikiem (.ready) */
.start > .home-loading { position: absolute; top: calc(56px + var(--safe-t)); left: var(--gutter); color: var(--bg); }
.start.failed { display: flex; flex-direction: column; background: var(--bg); padding: calc(var(--s-5) + var(--safe-t)) max(var(--gutter), var(--safe-r)) var(--s-8) max(var(--gutter), var(--safe-l)); }
.start.failed .state { margin: auto; padding-top: 0; }

.scene-art { position: absolute; inset: var(--title-h) 0 var(--panel) 0; container-type: size; overflow: hidden; background: var(--sky); }
.hero-art {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); margin: 0; cursor: pointer;
  width: min(calc(100cqw * 1.1), calc(100cqh * 880 / 1168 / .88)); height: auto; aspect-ratio: 880 / 1168;
}
.hero-art img { position: absolute; display: block; user-select: none; -webkit-user-drag: none; }
.hero-base { left: -38.89%; top: 0; width: 177.78%; height: 100%; } /* szersze płótno 4:3: oryginał 880×1168 jest w środku, boki wystają poza ramkę */
.hero-lcar { left: 36.36%; top: 80.05%; width: 27.27%; height: auto; transform-origin: 50% 90%; animation: hero-nerv 3.2s ease-in-out infinite; }
.hero-art .lid { position: absolute; background: #2f3a3c; border-radius: 45%; opacity: .94; transform: scaleY(0); animation: hero-blink 5.2s infinite; }
@keyframes hero-blink { 0%, 91% { transform: scaleY(0); } 94%, 96% { transform: scaleY(1); } 99%, 100% { transform: scaleY(0); } }
@keyframes hero-nerv {
  0%, 60% { transform: translate(0, 0) rotate(0); } 66% { transform: translate(-.2%, 0) rotate(-.3deg); } 72% { transform: translate(.2%, 0) rotate(.3deg); }
  78% { transform: translate(-.1%, 0) rotate(-.15deg); } 84%, 100% { transform: translate(0, 0) rotate(0); }
}
.scene-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; pointer-events: none;
  height: calc(56px + var(--safe-t)); padding: var(--safe-t) max(10px, var(--safe-r)) 0 max(var(--gutter), var(--safe-l));
}
.scene-top .icon-btn { pointer-events: auto; }
.scene-copy {
  position: absolute; z-index: 1; top: 0; left: 0; right: 0; height: var(--title-h); pointer-events: none; background: var(--sky);
  padding: calc(56px + var(--safe-t) + 4px) max(var(--gutter), var(--safe-r)) 0 max(var(--gutter), var(--safe-l));
}
.scene-title { font: 800 var(--h1)/1.07 var(--font); letter-spacing: var(--track-tight); text-wrap: balance; }
.scene-title .accent { color: var(--accent-ink); }
.pills { display: none; gap: var(--s-2); margin-top: 14px; }
@media (min-height: 700px) { .pills { display: flex; } }
.pill-note {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  background: rgba(255, 253, 248, .94); box-shadow: var(--e-2); font: 700 13px/1 var(--font); white-space: nowrap;
}
.pill-note svg { color: var(--accent-ink); }
.scene-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: grid; gap: var(--s-1);
  padding: var(--s-4) max(var(--gutter), var(--safe-r)) max(var(--s-3), var(--safe-b)) max(var(--gutter), var(--safe-l));
  border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--bg); box-shadow: var(--e-3);
}
.scene-last { height: 22px; margin-bottom: 0; font: var(--t-small); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-bottom .btn-text { min-height: 44px; }
.scene-legal { height: 16px; font: 500 12px/16px var(--font); color: var(--ink-2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* wejście sceny: obraz przez opacity, napisy i przyciski dojeżdżają o kilka pikseli (po 80 ms jeden po drugim) */
.start .scene-art, .start .scene-top, .start .in-1, .start .in-2, .start .in-3, .start .in-4 { opacity: 0; }
.start .in-1, .start .in-2, .start .in-3, .start .in-4 { transform: translateY(8px); }
.start.ready .scene-art, .start.ready .scene-top { opacity: 1; transition: opacity 300ms ease-out; }
.start.ready .in-1, .start.ready .in-2, .start.ready .in-3, .start.ready .in-4 {
  opacity: 1; transform: none; transition: opacity var(--t-enter) var(--ease-out), transform var(--t-enter) var(--ease-out);
}
.start.ready .in-1 { transition-delay: 300ms; } .start.ready .in-2 { transition-delay: 380ms; }
.start.ready .in-3 { transition-delay: 460ms; } .start.ready .in-4 { transition-delay: 540ms; }
.start.paused .hero-art * { animation-play-state: paused; }
.hero-art.react .hero-lcar { animation: hero-shake 1s ease-in-out 1; }
.hero-art.react .lid { animation: hero-blink-all 700ms ease-in-out 1 !important; }
@keyframes hero-blink-all { 0%, 100% { transform: scaleY(0); } 25%, 75% { transform: scaleY(1); } }
@keyframes hero-shake {
  0% { transform: translate(0, 0) rotate(0); } 15% { transform: translate(-.7%, 0) rotate(-1deg); } 30% { transform: translate(.7%, .1%) rotate(1deg); }
  45% { transform: translate(-.5%, 0) rotate(-.7deg); } 60% { transform: translate(.4%, 0) rotate(.5deg); } 80%, 100% { transform: translate(0, 0) rotate(0); }
}

/* ---------- kroki: tryb → ośrodek → trasa (jeden ekran = jedna decyzja, bez przewijania strony) ---------- */
.flow { display: flex; flex-direction: column; --pad-l: max(var(--gutter), var(--safe-l)); --pad-r: max(var(--gutter), var(--safe-r)); }
.flow-bar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  height: calc(56px + var(--safe-t)); padding: var(--safe-t) max(10px, var(--safe-r)) 0 max(10px, var(--safe-l));
}
.dots { display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: var(--r-pill); background: rgba(42, 31, 22, .16); }
.dots i.on { width: 24px; background: var(--accent); }
.dots i.done { background: var(--ink); }
.flow-head { flex: none; padding: var(--s-2) var(--pad-r) 0 var(--pad-l); }
.flow-head h1 { font: var(--t-h1); letter-spacing: var(--track-tight); text-wrap: balance; }
.flow-head p { margin-top: 6px; color: var(--ink-2); }
.flow-over {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; margin: -8px 0 2px -2px; padding: 0 2px; border: 0; border-radius: var(--r-s); background: none;
  font: var(--t-overline); letter-spacing: var(--track-overline); text-transform: uppercase; color: var(--ink-2);
}
.flow-over:active { background: var(--sunken); }
.flow-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: var(--s-5) var(--pad-r) var(--s-4) var(--pad-l); }
.flow-foot { flex: none; display: grid; gap: var(--s-2); padding: var(--s-3) var(--pad-r) max(var(--s-5), var(--safe-b)) var(--pad-l); }

/* krok 1: tryb */
.mode { display: grid; grid-template-columns: 104px 1fr 24px; align-items: center; gap: 14px; width: 100%; padding: var(--s-4) 18px var(--s-4) var(--s-3); border: 0; text-align: left; }
.mode + .mode { margin-top: var(--s-3); }
.mode img { width: 104px; height: 88px; object-fit: contain; transition: opacity var(--d-2) ease-out; }
.mode:not(.selected) img { opacity: .7; }
.mode-text { display: block; min-width: 0; }
.mode-text b { display: block; font: var(--t-title); }
.mode-text .d { display: block; margin-top: 4px; font: var(--t-small); color: var(--ink-2); }
.mode-text .tag { margin-top: 10px; }
.radio { width: 24px; height: 24px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 2px var(--field); transition: box-shadow var(--d-2) ease-out; }
.selected > .radio { box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 6px var(--surface), inset 0 0 0 24px var(--accent); }
.hint-line { display: flex; align-items: flex-start; gap: var(--s-2); margin-top: 18px; font: var(--t-small); color: var(--ink-2); }
.hint-line span { display: inline-flex; flex: none; margin-top: 1px; }

/* krok 2: ośrodek */
.step-osrodek .flow-head { padding-bottom: 14px; }
.step-osrodek .field { margin: 0 var(--pad-r) 0 var(--pad-l); }
.step-osrodek .flow-body { padding-top: 0; padding-bottom: max(var(--s-8), var(--safe-b)); mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 40px), transparent 100%); }
.field input[type="search"]::-webkit-search-cancel-button, .field input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.field .ico { position: absolute; left: 14px; top: 50%; display: inline-flex; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.field-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.field.has-ico input { padding-right: 52px; }
.list-label { display: flex; justify-content: space-between; margin: 22px 0 var(--s-2); font: var(--t-overline); letter-spacing: var(--track-overline); text-transform: uppercase; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.list { padding: 4px 0; overflow: hidden; }
.ico-wrap { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--good-soft); color: var(--good-ink); }
.row-end { display: inline-flex; color: var(--ink-3); }
.row.soon { cursor: default; }
.row.soon:active { background: transparent; }
.row.soon .ico-wrap { background: var(--sunken); color: var(--ink-3); }
.row.soon b { color: var(--ink-2); }
mark { padding: 0 1px; background: var(--mark); color: inherit; }
.demo-row {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; margin-top: 14px; padding: 10px 14px 10px 10px; border: 0; border-radius: var(--r);
  background: var(--accent-soft); color: var(--accent-ink); text-align: left; transition: transform var(--d-1) ease-out;
}
.demo-row:active { transform: scale(.985); }
.demo-row img { width: 56px; height: 44px; object-fit: contain; flex: none; }
.demo-row b { display: block; font: 700 15px/1.25 var(--font); color: var(--ink); }
.demo-row .s { display: block; font: 500 13px/1.3 var(--font); }
.demo-row .row-end { margin-left: auto; color: inherit; }

/* krok 3: trasa */
.step-trasa .flow-body { padding-top: var(--s-4); }
.route { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; padding: 14px; }
.route + .route { margin-top: 10px; }
.thumb { width: 72px; height: 72px; border-radius: var(--r); overflow: hidden; background: #b9cf9a; }
.thumb svg { display: block; width: 100%; height: 100%; }
.route-main { display: block; min-width: 0; }
.route-no { display: flex; align-items: center; gap: var(--s-2); font: var(--t-overline); letter-spacing: var(--track-overline); text-transform: uppercase; color: var(--accent-ink); }
.route-no .tag { margin-left: auto; text-transform: none; letter-spacing: 0; }
.route-no svg { color: var(--ink-2); }
.route-title { display: block; margin-top: 4px; font: 700 17px/1.25 var(--font); letter-spacing: -.005em; }
.route-meta { display: block; margin-top: 4px; font: var(--t-small); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.route-more { grid-column: 1 / -1; display: grid; gap: 10px; justify-items: start; padding-top: var(--s-3); box-shadow: inset 0 1px 0 var(--hairline); animation: item-in var(--t-slow) var(--ease-out) both; }
.route-more p { font: var(--t-small); color: var(--ink-2); }
.route-more ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.route-more .btn-text { min-height: 40px; margin: -4px 0 -6px -12px; font-size: 15px; }
.mode-switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); font: var(--t-small); color: var(--ink-2); }
.mode-switch .segment { width: 172px; }
.mode-switch .segment button { min-height: 36px; font-size: 14px; }
@keyframes item-in { from { opacity: 0; transform: translateY(6px); } }
.enter { animation: item-in 220ms var(--ease-out) both; }

/* ---------- arkusz „i”: informacja, kod dostępu, wersja ---------- */
.info { position: absolute; inset: 0; z-index: 30; }
.info-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--t-slow) ease-out; }
.info-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--bg); box-shadow: var(--e-3);
  transform: translateY(100%); transition: transform var(--t-slow) var(--ease-out);
}
.info.open .info-scrim { opacity: 1; }
.info.open .info-panel { transform: none; }
/* nagłówek (uchwyt, tytuł, zamknięcie) stoi w miejscu, przewija się tylko treść */
.info-top { flex: none; padding: var(--s-3) max(var(--gutter), var(--safe-r)) var(--s-1) max(var(--gutter), var(--safe-l)); transition: box-shadow var(--d-2) var(--ease); }
.info-top.scrolled { box-shadow: 0 1px 0 var(--hairline); }
.info-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 max(var(--gutter), var(--safe-r)) max(var(--s-6), var(--safe-b)) max(var(--gutter), var(--safe-l));
}
.info-top .sheet-grab { display: block; margin: 0 auto var(--s-1); }
.info-head { display: flex; align-items: center; justify-content: space-between; margin-right: -10px; }
.info-head h2 { font: var(--t-title); }
.info-lead { margin: var(--s-1) 0 var(--s-4); color: var(--ink-2); text-wrap: pretty; }
.info-list { padding: 4px 0; }
.info-row { cursor: default; }
.info-row:active { background: transparent; }
.info-row .ico-wrap, .code-box .ico-wrap { background: var(--accent-soft); color: var(--accent-ink); }
.code-box { margin-top: var(--s-3); padding: 0; }
.code-box > summary { list-style: none; }
.code-box > summary::-webkit-details-marker { display: none; }
.code-box .chev { display: inline-flex; color: var(--ink-3); transition: transform var(--d-2) var(--ease); }
.code-box[open] .chev { transform: rotate(180deg); }
.code-open { padding: 0 var(--s-4) var(--s-4); }
.code-row { display: flex; gap: var(--s-2); }
.code {
  flex: 1; min-width: 0; min-height: var(--tap); padding: 0 14px; border: 1.5px solid var(--field); border-radius: var(--r);
  font: 700 16px/1.2 var(--font); text-transform: uppercase; background: var(--surface); color: var(--ink);
}
.code::placeholder { text-transform: none; font-weight: 500; color: var(--ink-2); }
.code-msg { margin-top: var(--s-2); color: var(--bad-ink); font-weight: 700; }
.code-msg:empty { display: none; }
.info-fine { margin: var(--s-4) 0 var(--s-3); font: var(--t-small); color: var(--ink-2); text-wrap: pretty; }
.beta { display: inline-flex; align-items: center; }

/* komunikat na dole ekranu: ładowanie trasy, błąd */
.status {
  position: absolute; z-index: 20; left: 50%; bottom: max(var(--s-5), calc(var(--safe-b) + var(--s-3)));
  max-width: calc(100% - 2 * var(--s-5)); padding: var(--s-3) var(--s-4); transform: translateX(-50%);
  border-radius: var(--r); background: var(--ink); color: var(--bg); box-shadow: var(--e-2);
  font: 600 14px/1.4 var(--font); text-align: center;
  animation: status-in var(--t-slow) var(--ease-out) both;
}
.status.error { background: var(--bad-ink); color: #fff; }
@keyframes status-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- gra (układ; wygląd elementów z system.css) ---------- */
.game { background: var(--map-grass); }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#view.shake { animation: shake .36s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

.game .hud { position: absolute; top: calc(var(--safe-t) + var(--edge)); left: max(var(--edge), var(--safe-l)); right: max(var(--edge), var(--safe-r)); }
.steps-bar span { transition: background-color var(--d-3) ease; }

.game .toast {
  position: absolute; top: calc(var(--safe-t) + var(--edge) + 64px); left: max(var(--edge), var(--safe-l)); right: max(var(--edge), var(--safe-r));
  animation: drop 220ms var(--ease-out);
}
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }

/* panel od dołu: uchwyt, stała głowa (czas), przewijana treść, stopka z głównym działaniem (budowa w system.css) */
.game .sheet {
  position: absolute; left: 0; right: 0; bottom: 0; --sheet-gap: var(--s-3); overflow: hidden;
  max-height: min(74%, calc(100% - 200px)); /* nad panelem zawsze zostaje kawałek mapy z autem */
}
.game .sheet.intro { max-height: min(62%, calc(100% - 220px)); }
.game .sheet.explain { max-height: min(62%, calc(100% - 240px)); } /* czytanie bez presji czasu: mapa z autem i szpilkami zostaje widoczna */
.game .sheet .sheet-body { gap: var(--s-3); }
.game .sheet.ask .sheet-body:last-child { padding-bottom: max(var(--s-4), var(--safe-b)); } /* tylko bez stopki (wtedy body jest ostatnie): zapas na pasek systemowy */
.game .sheet.driving {
  left: 50%; right: auto; bottom: max(var(--s-4), var(--safe-b)); transform: translateX(-50%); max-height: none;
  flex-direction: row; align-items: center; gap: var(--s-2); padding: 10px var(--s-4); white-space: nowrap;
  border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--e-2);
}
/* panel wjeżdża od dołu razem z ruchem kamery (kamera: CAMERA_TUNING.frame.duration w camera.js) */
.sheet.enter { animation: sheet-in var(--d-3) var(--ease) both; }
.sheet.driving.enter { animation: pill-in var(--d-3) var(--ease) both; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes pill-in { from { opacity: 0; transform: translate(-50%, 14px); } }
@keyframes body-in { from { opacity: 0; transform: translateY(6px); } }
.sheet.swap .sheet-body { animation: body-in var(--d-2) var(--ease) both; }
#drive-label { font: 700 14px/1 var(--font); }
.pulse { width: 9px; height: 9px; border-radius: var(--r-pill); background: var(--good); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.sheet-title { font: var(--t-h1); letter-spacing: var(--track-tight); text-wrap: balance; }
.lead { font: var(--t-small); color: var(--ink-2); }
.facts { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.sheet .lead, .sheet .question, .sheet .quote, .sheet .why, .sheet .hint { max-width: var(--measure); }

/* czas na decyzję: w panelu (zegar, tor, sekundy), nie na jego krawędzi */
.timer { flex: none; display: flex; align-items: center; gap: 10px; min-height: 22px; }
.timer-ico { display: inline-flex; color: var(--ink-2); }
.timer .track { flex: 1; height: 6px; border-radius: var(--r-pill); background: rgba(42, 31, 22, .12); overflow: hidden; }
.timer-bar { display: block; width: 100%; height: 100%; background: var(--ink); transform-origin: left center; transition: background-color 900ms linear; } /* ostatnie 3 s: płynnie w czerwień */
.timer-bar.low { background: var(--bad); }
.timer-sec { min-width: 3ch; text-align: right; font: 800 14px/1 var(--font); font-variant-numeric: tabular-nums; transition: color 900ms linear; }
.timer-sec.low { color: var(--bad-ink); }

/* polecenie egzaminatora, obserwacja, odpowiedzi */
.quote { display: flex; gap: 10px; margin: 0; padding: var(--s-3) 14px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent-ink); font: 700 15px/1.4 var(--font); }
.quote-ico { display: inline-flex; flex: none; margin-top: 1px; }
.hint { font: var(--t-small); color: var(--ink-2); }
.look { display: flex; align-items: center; gap: var(--s-2); }
.look-ico { display: inline-flex; flex: none; color: var(--ink-2); }
.look .chip { flex: 1; min-width: 0; justify-content: center; gap: 4px; padding: 0 6px; font-size: 14px; white-space: nowrap; }
.look .obs-ico { display: inline-flex; }
.options { display: grid; gap: var(--s-2); }

/* wyjaśnienie: odpowiedzi jako karty w stanach z systemu (zielona poprawna, czerwona wybrana błędnie) */
.answers { display: grid; gap: var(--s-3); }
.ans-label { margin-bottom: 6px; font: var(--t-overline); letter-spacing: var(--track-overline); text-transform: uppercase; }
.ans-label.bad { color: var(--bad-ink); }
.ans-label.good { color: var(--good-ink); }
.opt.static { cursor: default; }
.opt.static:active { transform: none; }
.opt .key .ico, .opt .key svg { display: block; }
.why { font: var(--t-body); color: var(--ink); text-wrap: pretty; }
.why.minor { font: var(--t-small); color: var(--ink-2); }

/* długie pytanie: ciaśniejszy rytm (klasy dodaje fitSheet w main.js: .tight, gdy panel zająłby ponad 56% ekranu, .tighter, gdy treść i tak się nie mieści) */
.game .sheet.tight { --sheet-gap: var(--s-2); }
.game .sheet.tight .sheet-body { gap: 10px; }
.game .sheet.tight .question { font-size: 17px; line-height: 1.3; }
.game .sheet.tight .quote { padding: 9px 12px; font-size: 14px; }
.game .sheet.tight .chip { min-height: 40px; }
.game .sheet.tight .opt { min-height: 50px; padding: 9px var(--s-3) 9px 10px; font-size: 15px; }
.game .sheet.tight .opt .key { width: 28px; height: 28px; font-size: 14px; }
.game .sheet.tight .options { gap: 6px; }
.game .sheet.tighter { --sheet-gap: 6px; padding-top: 10px; }
.game .sheet.tighter .sheet-grab { display: none; }
.game .sheet.tighter .timer { min-height: 18px; }
.game .sheet.tighter .sheet-body { gap: 8px; }
.game .sheet.tighter .question { font-size: 16px; line-height: 1.28; }
.game .sheet.tighter .quote { padding: 7px 10px; font-size: 13.5px; }
.game .sheet.tighter .chip { min-height: 36px; font-size: 13.5px; }
.game .sheet.tighter .opt { min-height: 44px; padding: 7px 10px 7px 8px; font-size: 14.5px; line-height: 1.3; }
.game .sheet.tighter .opt .key { width: 26px; height: 26px; font-size: 13px; }
.game .sheet.tighter .options { gap: 5px; }
.game .sheet.ask .sheet-body.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }

/* pauza, pytanie „Przerwać jazdę?” i komunikaty o błędzie (ta sama karta) */
.pause, .dialog { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: var(--s-6); background: var(--scrim); animation: fade-in var(--t-med) ease-out both; }
.dialog { z-index: 40; } /* nad arkuszem „i” (30) i komunikatem na dole (20) */
.pause-card, .dialog-card { width: 100%; max-width: 340px; display: grid; gap: var(--s-2); padding: var(--s-6) var(--s-5) var(--s-4); border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--e-2); text-align: center; animation: pop-in var(--t-slow) var(--ease-out) both; }
.pause-card h2, .dialog-card h2 { font: var(--t-title); }
.pause-card p, .dialog-card p { margin-bottom: 10px; color: var(--ink-2); text-wrap: pretty; }
.dialog-card .state-ico { justify-self: center; margin-bottom: var(--s-2); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- podsumowanie: werdykt z ilustracją, liczby, błędy jako akordeon, stałe działania na dole ---------- */
.summary { display: flex; flex-direction: column; --pad-l: max(var(--gutter), var(--safe-l)); --pad-r: max(var(--gutter), var(--safe-r)); }
.sum-bar { flex: none; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: calc(56px + var(--safe-t)); padding: var(--safe-t) max(10px, var(--safe-r)) 0 max(10px, var(--safe-l)); }
.sum-over { justify-self: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: var(--t-overline); letter-spacing: var(--track-overline); text-transform: uppercase; color: var(--ink-2); }
.sum-scroll { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--s-5); padding: var(--s-1) var(--pad-r) var(--s-8) var(--pad-l); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sum-hero { display: grid; justify-items: center; gap: var(--s-2); text-align: center; }
.tone-czysto, .tone-zdane { --tone: var(--good-soft); }
.tone-prawie { --tone: var(--warn-soft); }
.tone-jeszcze { --tone: var(--accent-soft); }
.sum-art { position: relative; display: flex; justify-content: center; width: min(240px, 70%); height: 164px; }
.sum-art::before { content: ""; position: absolute; inset: 22px 0 0; border-radius: 50%; background: var(--tone); }
.sum-art img { position: relative; width: auto; max-width: 100%; height: 100%; }
.sum-hero h1 { margin-top: var(--s-2); font: var(--t-display); letter-spacing: var(--track-tight); text-wrap: balance; }
.sum-hero h1:focus { outline: 0; }
.sum-hero p { max-width: 30ch; color: var(--ink-2); text-wrap: balance; }
.sum-label { margin: 0 0 var(--s-2); font: var(--t-overline); letter-spacing: var(--track-overline); text-transform: uppercase; color: var(--ink-2); }
.sum-fine { padding: 0 var(--s-1); font: var(--t-small); color: var(--ink-2); text-wrap: pretty; }
.rev { display: grid; gap: var(--s-3); }
.rev + .rev { padding-top: var(--s-5); box-shadow: inset 0 1px 0 var(--hairline); }
.rev-q { font: 700 15px/1.4 var(--font); text-wrap: pretty; }
.rev-line { font: 600 15px/1.4 var(--font); text-wrap: pretty; }
.rev-line small { display: block; margin-bottom: 2px; font: var(--t-overline); letter-spacing: var(--track-overline); text-transform: uppercase; }
.rev-line.bad, .rev-line.bad small { color: var(--bad-ink); }
.rev-line.good { font-weight: 700; }
.rev-line.good small { color: var(--good-ink); }
.rev .why { font: var(--t-small); color: var(--ink-2); }
.sum-foot { flex: none; position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 56px; gap: var(--s-2) var(--s-3); padding: var(--s-4) var(--pad-r) max(var(--s-3), var(--safe-b)) var(--pad-l); background: var(--bg); box-shadow: 0 -1px 0 var(--hairline), 0 -12px 24px rgba(42, 31, 22, .06); }
.sum-foot .sq { width: 56px; min-height: 56px; padding: 0; border-radius: 16px; }
.sum-links { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.sum-links.one { grid-template-columns: 1fr; }
.sum-links .btn { min-height: 44px; padding: 0 var(--s-2); }
/* bardzo wąskie telefony (320 px): ten sam układ, tylko mniejsze napisy, żeby etykiety przycisków i nagłówek nie łamały się */
@media (max-width: 340px) {
  .sum-hero h1 { font-size: 30px; }
  .sum-foot .btn-l { padding-inline: 10px; gap: 6px; font-size: 16px; white-space: nowrap; }
  .sum-links .btn { padding: 0 4px; font-size: 15px; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  #view.shake, .pulse, .toast, .screen:not([hidden]), .screen.leaving, .screen[data-dir]:not([hidden]), .screen.leaving[data-dir], .sheet.enter, .sheet.driving.enter, .sheet.swap .sheet-body, .status, .pause, .pause-card, .dialog, .dialog-card, .route-more, .enter { animation: none; }
  .steps-bar span, .timer-bar, .timer-sec, .mode img, .radio, .demo-row { transition: none; }
  .hero-lcar, .hero-art .lid { animation: none; }
  .start .scene-art, .start .scene-top, .start .in-1, .start .in-2, .start .in-3, .start .in-4 { opacity: 1; transform: none; transition: none; }
  .info-scrim, .info-panel, .info-top, .code-box .chev { transition: none; }
  .demo-row:active { transform: none; }
}

/* ---------- szeroki ekran (makieta 8): kolumna telefonu w karcie, obok opis produktu ---------- */
.desk-intro { display: none; }
@media (min-width: 1000px) and (min-height: 600px) {
  body { display: grid; grid-template-columns: minmax(0, 1fr) 480px; background: var(--sky); }
  #app { grid-column: 2; width: 480px; height: calc(100dvh - 56px); margin: 28px 28px 28px 0; border-radius: 36px; box-shadow: 0 0 0 1px var(--hairline), 0 8px 16px rgba(42, 31, 22, .08), 0 28px 60px rgba(42, 31, 22, .20); }
  .desk-intro {
    grid-column: 1; grid-row: 1; position: relative; display: flex; flex-direction: column; align-items: flex-start; overflow: hidden;
    padding: clamp(32px, 7vh, 56px) clamp(40px, 6vw, 96px);
  }
  .desk-intro .brand-name { font-size: 26px; }
  .desk-title { margin-top: clamp(32px, 9vh, 72px); max-width: 12ch; font: 800 clamp(40px, 4.4vw, 56px)/1.04 var(--font); letter-spacing: var(--track-tight); text-wrap: balance; }
  .desk-title .accent { color: var(--accent-ink); }
  .desk-lead { margin-top: 18px; max-width: 30ch; font: 500 20px/1.5 var(--font); color: var(--ink-2); text-wrap: pretty; }
  .desk-list { display: grid; gap: 12px; margin: 32px 0 0; padding: 0; list-style: none; font: 700 17px/1.3 var(--font); }
  .desk-list li { display: flex; align-items: center; gap: 12px; }
  .desk-list svg { flex: none; color: var(--good); }
  .desk-car { position: absolute; right: clamp(40px, 6vw, 96px); bottom: 96px; width: clamp(160px, 17vw, 240px); height: auto; }
  .desk-legal { position: absolute; left: clamp(40px, 6vw, 96px); bottom: 32px; max-width: 46ch; font: var(--t-small); color: var(--ink-2); text-wrap: pretty; }
}
/* tablet pionowo i okna pośrednie: kolumna telefonu na środku, delikatnie oddzielona od tła */
@media (min-width: 520px) and (max-width: 999.98px) { #app { box-shadow: 0 0 0 1px var(--hairline), var(--e-2); } }

/* cele dotyku: wygląd zostaje, a pole trafienia sięga 44 px wysokości (WCAG 2.5.8 wymaga 24 px, my trzymamy 44) */
.look .chip, .flow-over { position: relative; }
.mode-switch .segment button::after, .look .chip::after, .flow-over::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
