@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 400; font-display: block; src: url('../fonts/atkinson-hyperlegible-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 400; font-display: block; src: url('../fonts/atkinson-hyperlegible-latin-ext-400.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 700; font-display: block; src: url('../fonts/atkinson-hyperlegible-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 700; font-display: block; src: url('../fonts/atkinson-hyperlegible-latin-ext-700.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: block; src: url('../fonts/sora-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: block; src: url('../fonts/sora-latin-ext-700.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root { --ink: #000; --accent: #ff6200; }
* { box-sizing: border-box; }
html { background: #ece4d8; }
body { margin: 0; font-family: 'Atkinson Hyperlegible', Arial, sans-serif; color: var(--ink); font-size: 15pt; line-height: 1.35; }

/* ---------- pasek narzędzi (tylko ekran) ---------- */
.toolbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; background: #18120c; color: #f7f1e8; font-size: 12pt; }
.brand { color: var(--accent); font-family: 'Sora', sans-serif; font-weight: 700; text-decoration: none; font-size: 15pt; }
.tb-title { font-weight: 700; flex: 1 1 200px; }
.tb-tabs { display: flex; gap: 6px; }
.tb-tabs a, .tb-actions a, .tb-actions button { font: inherit; font-weight: 700; color: #f7f1e8; border: 1.5px solid #6b5a48; background: transparent; padding: 6px 12px; border-radius: 8px; text-decoration: none; cursor: pointer; }
.tb-tabs a.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb-actions { display: flex; gap: 6px; }
.tb-actions button { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb-note { max-width: 210mm; margin: 12px auto; font-size: 12pt; padding: 0 8px; }

/* ---------- arkusz A4 ---------- */
.sheet { background: #fff; width: 210mm; min-height: 297mm; margin: 12px auto 24px; padding: 14mm 15mm 16mm; box-shadow: 0 4px 24px rgba(0,0,0,.15); }
.sheet-wrap { border-collapse: collapse; width: 210mm; margin: 12px auto 24px; background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.15); }
.sheet-wrap > tbody > tr > td, .sheet-wrap > tfoot > tr > td { padding: 0; }
.sheet-wrap + .sheet-wrap { break-before: page; page-break-before: always; }
.sheet-wrap .sheet { margin: 0; box-shadow: none; min-height: 0; }
.sheet-foot { padding: 0 15mm 8mm !important; }
.niw-foot { display: block; width: 100%; max-width: 180mm; height: auto; margin: 0 auto; }
.niw-foot-fixed { display: none; }
.site-foot-niw { max-width: 900px; margin: 10px auto 24px; padding: 0 12px; text-align: center; font-size: 11pt; }
.site-foot-niw img { display: block; width: 100%; height: auto; background: #fff; border-radius: 6px; }
.site-foot-niw p { margin: 6px 0 0; }
.s-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; border-bottom: 2.5pt solid #000; padding-bottom: 4mm; margin-bottom: 5mm; }
.s-title { font-family: 'Sora', sans-serif; font-size: 24pt; font-weight: 700; margin: 0; line-height: 1.1; }
.s-title .k { display: inline-block; background: #000; color: #fff; padding: 0 3mm; border-radius: 2mm; margin-left: 2mm; }
.s-sub { margin: 1mm 0 0; font-size: 13pt; }
.s-brand { text-align: right; font-size: 11pt; white-space: nowrap; }
.s-brand b { font-family: 'Sora', sans-serif; font-size: 16pt; color: var(--accent); }
.fields { display: grid; grid-template-columns: auto 1fr; gap: 3mm 5mm; align-items: center; margin: 0 0 5mm; }
.f-label { font-weight: 700; font-size: 15pt; }
.code-boxes { display: flex; align-items: center; gap: 1.5mm; }
.code-boxes .bx { width: 11mm; height: 13mm; border: 2pt solid #000; border-radius: 1.5mm; display: flex; align-items: center; justify-content: center; font-family: 'Sora', monospace; font-size: 22pt; font-weight: 700; }
.code-boxes .dash { font-size: 22pt; font-weight: 700; padding: 0 1mm; }
.f-line { border-bottom: 1.5pt solid #000; min-height: 10mm; font-size: 15pt; display: flex; align-items: flex-end; padding-bottom: 1mm; font-weight: 700; }
.f-hint { font-size: 11pt; font-weight: 400; margin-left: 3mm; }
.howto { border: 2pt solid #000; border-radius: 3mm; padding: 2.5mm 5mm; margin: 0 0 5mm; font-size: 14pt; }
.howto p { margin: 0 0 1.5mm; }
.howto p:last-child { margin: 0; }
.mini-box { display: inline-block; width: 6mm; height: 6mm; border: 1.5pt solid #000; vertical-align: -1mm; text-align: center; line-height: 5mm; font-weight: 700; }

.q { break-inside: avoid; page-break-inside: avoid; margin: 0 0 5mm; }
.q-head { display: flex; gap: 3mm; align-items: baseline; margin: 0 0 2.5mm; }
.q-num { flex: 0 0 auto; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 15pt; background: #000; color: #fff; border-radius: 50%; width: 10mm; height: 10mm; display: inline-flex; align-items: center; justify-content: center; }
.q-text { font-weight: 700; font-size: 15pt; margin: 0; }
.q-note { font-size: 12.5pt; margin: 0 0 2.5mm 13mm; font-style: italic; }
.sms { margin: 0 0 3mm 13mm; border: 1.5pt solid #000; border-radius: 4mm; padding: 2.5mm 4mm; max-width: 150mm; background: #f4f4f4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sms-from { font-weight: 700; font-size: 13pt; margin: 0 0 1mm; }
.sms-from span { font-weight: 400; margin-left: 3mm; }
.sms-body { margin: 0; font-size: 14pt; }
.sms-link { margin: 1mm 0 0; font-size: 14pt; text-decoration: underline; word-break: break-all; }
.answers { list-style: none; margin: 0 0 0 13mm; padding: 0; }
.answers li { display: flex; gap: 3.5mm; align-items: flex-start; margin: 0 0 2mm; font-size: 14pt; }
.cb { flex: 0 0 auto; width: 9mm; height: 9mm; border: 2.2pt solid #000; border-radius: 1mm; margin-top: 0.3mm; }
.letter { flex: 0 0 auto; font-weight: 700; width: 6mm; }
.s-end { break-before: avoid; margin-top: 3mm; border-top: 1.5pt solid #000; padding-top: 3mm; font-size: 12.5pt; text-align: center; }

@page { size: A4 portrait; margin: 8mm 0 9mm; }
@media print {
  html, body { background: #fff; }
  .no-print { display: none !important; }
  .sheet { margin: 0; box-shadow: none; width: auto; min-height: 0; padding: 2mm 14mm 0; }
  .sheet-wrap { width: 100%; margin: 0; box-shadow: none; }
  /* Stopka grantowa: <tfoot> rezerwuje miejsce na każdej stronie, a element fixed
     rysuje ją zawsze przy dolnej krawędzi strony (Chrome powtarza fixed na każdej stronie). */
  tfoot { display: table-footer-group; }
  .sheet-foot { height: 30mm; padding: 0 !important; }
  .sheet-foot .niw-foot { visibility: hidden; }
  .niw-foot-fixed { display: block !important; position: fixed; left: 0; right: 0; bottom: 0; }
  .niw-foot-fixed .niw-foot { width: 176mm; max-width: none; margin: 0 auto; }
  .answers li { margin-bottom: 1.6mm; }
  .q { margin-bottom: 4mm; }
  .q-head { margin-bottom: 2mm; }
  .sms { margin-bottom: 2.5mm; padding: 2mm 4mm; }
  .fields { gap: 2mm 5mm; margin-bottom: 4mm; }
  .s-head { padding-bottom: 3mm; margin-bottom: 4mm; }
  /* 20 pytań: ciaśniej, ale nadal duża czcionka (pytania 14 pt, odpowiedzi 13,5 pt) — mniej kartek */
  body { line-height: 1.27; }
  .q-text { font-size: 14pt; }
  .answers li { font-size: 13.5pt; margin-bottom: 1.1mm; gap: 3mm; }
  .cb { width: 8mm; height: 8mm; }
  .q { margin-bottom: 3.2mm; }
  .q-head { margin-bottom: 1.5mm; }
  .sms { margin-bottom: 2mm; padding: 1.5mm 4mm; }
  .sms-body, .sms-link { font-size: 13.5pt; }
  .howto { font-size: 13pt; padding: 2mm 4mm; margin-bottom: 4mm; }
}
@media screen and (max-width: 820px) {
  .sheet { width: auto; margin: 8px; padding: 6mm; min-height: 0; }
  body { font-size: 13pt; }
}

/* ===== v5 — tylko ekran: cele dotyku 48 px, kontrast, „Wróć do początku”, brak poziomego przewijania strony ===== */
@media screen {
  .toolbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-top: max(10px, env(safe-area-inset-top)); }
  .brand { display: inline-flex; align-items: center; min-height: 48px; }
  .tb-home { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 14px 0 10px; border: 2px solid #f7f1e8; border-radius: 999px; color: #f7f1e8; font-weight: 700; text-decoration: none; white-space: nowrap; }
  .tb-home:hover { background: #f7f1e8; color: #18120c; }
  .tb-tabs a, .tb-actions a, .tb-actions button { display: inline-flex; align-items: center; min-height: 48px; padding: 0 14px; }
  .tb-tabs a.is-active, .tb-actions button { background: #c24a00; border-color: #c24a00; }   /* biały na #c24a00 = 4,9:1 (było 3:1) */
  :focus-visible { outline: 3px solid #4d9fff; outline-offset: 2px; }
  /* podgląd A4 (210 mm ≈ 794 px) przewija się w swoim pasku, strona nie „pływa” na boki */
  #sheets { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 8px; }
  .tb-note { max-width: min(210mm, 100%); }
  .site-foot-niw { max-width: min(900px, 100%); }
  @media (orientation: landscape) and (max-height: 520px) { .toolbar { position: static; } }
}
@media print { .tb-home { display: none !important; } }
@media screen and (max-width: 700px) { .toolbar { position: static; } .tb-title { flex-basis: 100%; order: 5; } }
