/* Szyfr Jadwigi – jedna, celowo ciemna oprawa: kartki papieru na nocnym biurku detektywa.
   Układ: jedna kolumna (max 520px), ilustracja u góry kartki, tekst, wybory; stały pasek zakładek na dole. */
:root {
  --noc: #191b22; --noc2: #23262f; --noc3: #2f333e; --linia: #434858;
  --papier: #f0e6d1; --papier2: #e4d6b8; --tusz: #2b2119; --tusz2: #6a5a48;
  --sepia: #8a5a2b; --pieczec: #a8322a; --mosiadz: #c99a3e; --ziel: #4f7d55;
  --f-tekst: "Spectral", Georgia, "Times New Roman", serif;
  --f-maszyna: "Special Elite", "Courier New", monospace;
  --f-reka: "Caveat", "Segoe Print", cursive;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow-x: hidden; }
#app { overflow-x: clip; }
body { background: var(--noc); color: var(--papier); font-family: var(--f-tekst); font-size: 17px; line-height: 1.55; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--mosiadz); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100%; padding: calc(8px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) calc(92px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); }
.gora { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
#akt { font-family: var(--f-maszyna); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--mosiadz); }
#menuBtn { border: 1px solid var(--linia); background: transparent; border-radius: 8px; height: 40px; padding: 0 14px; font-family: var(--f-maszyna); font-size: 14px; }
body.tytul .gora, body.tytul #nav { display: none; }

/* Przyciski */
.btn { border: 0; border-radius: 8px; padding: 13px 18px; min-height: 48px; background: var(--mosiadz); color: #20170a; font-weight: 600; font-family: var(--f-tekst); font-size: 17px; }
.btn small { display: block; font-weight: 400; font-size: 13px; opacity: .8; }
.btn.jasny { background: transparent; color: inherit; border: 1px solid var(--linia); }
.btn.czerw { background: var(--pieczec); color: #fff; }
.btn.mini { padding: 8px 14px; min-height: 40px; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: default; }
.rzad { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.rzad.srodek { justify-content: space-between; }
.stos { display: flex; flex-direction: column; gap: 10px; }

/* Ekran tytułowy */
.tytulowy { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-block: 30px; }
.tytulowy h1 { font-family: var(--f-maszyna); font-weight: 400; font-size: clamp(56px, 18vw, 84px); line-height: .95; margin: 0; letter-spacing: .02em; }
.tytulowy .pod { color: #b8b2a6; margin: 0 0 18px; max-width: 30ch; }
.pieczec { align-self: flex-start; font-family: var(--f-maszyna); color: var(--pieczec); border: 3px solid var(--pieczec); padding: 2px 12px; letter-spacing: .25em; transform: rotate(-6deg); animation: stempel .6s cubic-bezier(.2, 1.6, .4, 1) both .3s; }

/* Kartka sceny */
.kartka { background: var(--papier); color: var(--tusz); border-radius: 4px 4px 10px 10px; overflow: hidden; box-shadow: 0 1px 0 var(--papier2), 0 18px 40px rgba(0, 0, 0, .35); margin-top: 6px; }
.kartka.retro { background: #e9dfc9; }
.kartka.retro .tresc { background-image: repeating-linear-gradient(transparent 0 30px, rgba(138, 90, 43, .08) 30px 31px); }
.kartka.wjazd { animation: kartka .55s cubic-bezier(.25, .8, .3, 1) both; transform-origin: left center; }
@keyframes kartka { from { transform: perspective(1200px) rotateY(-28deg) translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.ilustracja { margin: 0; position: relative; aspect-ratio: 4 / 3; max-height: 42vh; width: 100%; background: linear-gradient(160deg, #3a3128, #1f1b17); overflow: hidden; }
.ilustracja img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ilustracja.archiwum img { filter: sepia(.35) contrast(1.05); }
.ilustracja .zastepczy { display: none; }
.ilustracja.brak .zastepczy { display: grid; place-items: center; position: absolute; inset: 0; padding: 20px; text-align: center; color: #d9c9a8; font-family: var(--f-maszyna); font-size: 15px; background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .03) 0 10px, transparent 10px 20px); }
.ilustracja.brak .zastepczy span { border: 1px dashed rgba(217, 201, 168, .4); padding: 10px 14px; }
.rok { position: absolute; left: 12px; bottom: 10px; font-family: var(--f-maszyna); background: var(--papier); color: var(--sepia); padding: 2px 10px; font-size: 15px; letter-spacing: .1em; transform: rotate(-3deg); }
.tresc { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.miejsce { font-family: var(--f-maszyna); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--sepia); }
.tresc h2 { margin: 0; font-family: var(--f-maszyna); font-weight: 400; font-size: 24px; }
.tekst { display: flex; flex-direction: column; gap: 10px; }
.tekst p, .notka p { margin: 0; }
.kwestia { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; }
.kwestia .av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-maszyna); font-size: 13px; color: var(--papier); background: var(--tusz2); }
.k-mama .av { background: #5f6f52; } .k-babcia .av { background: #7a5c74; } .k-jadwiga .av { background: var(--sepia); }
.k-glos .av { background: #222; } .k-marek .av { background: #3e5d7e; } .k-oficer .av { background: #4b5240; }
.kwestia b { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--tusz2); font-family: var(--f-maszyna); font-weight: 400; }
.kwestia p { margin: 2px 0 0; }
.kwestia .tl { font-size: 14px; font-style: italic; color: var(--tusz2); }
.list { margin: 0; padding: 14px 16px; background: #f7f0df; border: 1px solid var(--papier2); font-family: var(--f-reka); font-size: 22px; line-height: 1.3; display: flex; flex-direction: column; gap: 8px; transform: rotate(-.6deg); }
.szyfrogram { font-family: var(--f-mono); font-size: 18px; letter-spacing: .08em; background: rgba(43, 33, 25, .08); border-left: 3px solid var(--pieczec); padding: 10px 12px; word-break: break-word; }
.szyfrogram.morse { font-size: 20px; letter-spacing: .12em; }
.reakcja:empty { display: none; }
.notka { background: #f8f2e3; border: 1px dashed var(--papier2); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 10px; animation: notka .35s ease-out; }
@keyframes notka { from { opacity: 0; transform: translateY(-6px); } }
.wybory { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.wybor { text-align: left; border: 1px solid #cdbd9c; background: #f7efdc; color: var(--tusz); border-radius: 8px; padding: 12px 14px 12px 36px; min-height: 48px; position: relative; font-size: 16px; line-height: 1.35; transition: background .15s, transform .1s; }
.wybor::before { content: "›"; position: absolute; left: 14px; top: 50%; transform: translateY(-52%); font-size: 22px; color: var(--sepia); }
.wybor.idz::before { content: "→"; font-size: 17px; }
.wybor.zag { border-color: var(--pieczec); }
.wybor.zag::before { content: "✎"; color: var(--pieczec); font-size: 16px; }
.wybor:active { transform: scale(.985); background: var(--papier2); }
.imieForm { display: flex; flex-direction: column; gap: 8px; }
.imieForm label, .zagadka label { font-family: var(--f-maszyna); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--tusz2); }
.imieForm input, .pole { font: inherit; font-family: var(--f-mono); font-size: 18px; padding: 12px; border-radius: 8px; border: 1px solid #c7b590; background: #fffaf0; color: var(--tusz); width: 100%; }
.imieForm .btn { align-self: flex-start; }

/* Pasek zakładek */
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--noc2); border-top: 1px solid var(--linia); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
#nav .in { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
#nav button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-width: 0; border-radius: 8px; font-size: 11px; letter-spacing: -.02em; font-family: var(--f-maszyna); color: #c9c3b6; min-height: 52px; }
#nav svg { width: 24px; height: 24px; stroke: var(--mosiadz); fill: none; stroke-width: 1.6; }
#nav button:active { background: var(--noc3); }

/* Warstwy: arkusze */
#warstwa { position: fixed; inset: 0; z-index: 40; background: rgba(10, 11, 15, .72); display: flex; align-items: flex-end; justify-content: center; }
.arkusz { width: 100%; max-width: 520px; max-height: 90vh; background: var(--papier); color: var(--tusz); border-radius: 14px 14px 0 0; display: flex; flex-direction: column; animation: arkusz .3s cubic-bezier(.2, .8, .3, 1); padding-bottom: env(safe-area-inset-bottom, 0px); }
.arkusz.duzy { max-height: 96vh; height: 96vh; }
.arkusz.maly { padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px)); gap: 14px; }
.arkusz.maly p { margin: 0 0 12px; }
@keyframes arkusz { from { transform: translateY(40px); opacity: .3; } }
.arkusz header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 18px; border-bottom: 1px solid var(--papier2); }
.arkusz header h3 { margin: 0; font-family: var(--f-maszyna); font-weight: 400; font-size: 21px; }
.zamknij { border: 0; background: transparent; font-size: 28px; width: 44px; height: 44px; color: var(--tusz2); }
.zaw { overflow-y: auto; padding: 14px 18px 22px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.sekcja { font-family: var(--f-maszyna); font-weight: 400; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--sepia); margin: 8px 0 0; }
.pusto, .info { color: var(--tusz2); font-size: 15px; margin: 0; }
.siatka { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.przedm { border: 1px solid var(--papier2); background: #f8f1e0; border-radius: 8px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; line-height: 1.2; text-align: center; }
.miniatura { width: 56px; height: 56px; border-radius: 50%; background: var(--tusz); color: var(--papier); display: grid; place-items: center; overflow: hidden; position: relative; font-family: var(--f-maszyna); font-size: 22px; }
.miniatura img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.opisP:empty { display: none; }
.opisP { background: #f8f1e0; border-radius: 8px; padding: 10px 12px; }
.opisP h4 { margin: 0 0 4px; } .opisP p { margin: 0; font-size: 15px; }
.znajdzki { display: grid; grid-template-columns: 1fr; gap: 6px; }
.zn { border: 1px dashed #c7b590; border-radius: 8px; padding: 8px 10px; font-size: 14px; color: var(--tusz2); display: flex; flex-direction: column; }
.zn.ok { border-style: solid; background: #f8f1e0; color: var(--tusz); }
.tropy { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.szyfrK { border: 1px solid var(--papier2); border-radius: 8px; padding: 10px 12px; background: #f8f1e0; }
.szyfrK summary { font-weight: 600; cursor: pointer; }
.szyfrK p { margin: 6px 0; font-size: 15px; }
.szyfrK pre, .mtab { font-family: var(--f-mono); font-size: 13px; overflow-x: auto; margin: 0; }
.archiwum { display: flex; flex-direction: column; gap: 8px; }
.fakt { background: #f8f1e0; border-radius: 8px; padding: 10px 12px; border-left: 3px solid var(--pieczec); }
.fakt .r { font-family: var(--f-maszyna); font-size: 12px; color: var(--pieczec); letter-spacing: .08em; }
.fakt h4 { margin: 2px 0 4px; } .fakt p { margin: 0; font-size: 15px; }
.fakt.zamk { background: transparent; border: 1px dashed #c7b590; color: var(--tusz2); }
.fakt.zamk h4 { font-weight: 400; font-style: italic; margin: 0; }
.sloty { display: flex; flex-direction: column; gap: 8px; }
.slot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; background: #f8f1e0; border-radius: 8px; padding: 10px 12px; }
.slot span { display: block; font-size: 13px; color: var(--tusz2); }
textarea#kodPole { font-family: var(--f-mono); font-size: 13px; padding: 10px; border-radius: 8px; border: 1px solid #c7b590; background: #fffaf0; color: var(--tusz); width: 100%; resize: vertical; }
.zagadka .btn.jasny, .arkusz .btn.jasny { border-color: #c7b590; }

/* Zeszyt Jadwigi */
.zeszyt { perspective: 1400px; }
.strona { background: #fbf5e6; background-image: repeating-linear-gradient(transparent 0 33px, #d8e3ea 33px 34px); border-left: 2px solid #e2a4a0; padding: 18px 16px 34px 22px; border-radius: 2px 8px 8px 2px; min-height: 340px; position: relative; font-family: var(--f-reka); font-size: 23px; line-height: 34px; color: #2c3446; box-shadow: 3px 3px 0 #e6dcc6; }
.strona h4 { margin: 0; font-size: 28px; font-weight: 700; }
.strona .data { font-size: 18px; color: var(--sepia); }
.strona p { margin: 0 0 6px; }
.strona .szyfrogram { font-size: 16px; line-height: 1.6; margin: 6px 0; background: transparent; }
.strona .nr { position: absolute; right: 14px; bottom: 6px; font-size: 18px; color: var(--tusz2); }
.flip-dalej { animation: flipD .5s ease-out; transform-origin: left center; }
.flip-wstecz { animation: flipW .5s ease-out; transform-origin: right center; }
@keyframes flipD { from { transform: rotateY(-75deg); opacity: .2; } }
@keyframes flipW { from { transform: rotateY(75deg); opacity: .2; } }
.licz { font-family: var(--f-maszyna); font-size: 14px; color: var(--tusz2); }

/* Odkrycie (znajdźki, przedmioty, ciekawostki) */
#odkrycie { position: fixed; inset: 0; z-index: 50; background: rgba(10, 11, 15, .78); display: flex; align-items: center; justify-content: center; padding: 20px max(18px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); }
.karta-odkrycia { position: relative; overflow: hidden; width: 100%; min-width: 0; box-sizing: border-box; max-width: 380px; max-height: 86vh; overflow-y: auto; background: var(--papier); color: var(--tusz); border-radius: 12px; padding: 22px 20px 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; animation: odkryj .6s cubic-bezier(.2, 1.3, .4, 1) both; box-shadow: 0 0 0 1px var(--mosiadz), 0 20px 60px rgba(0, 0, 0, .5); }
@keyframes odkryj { 0% { transform: perspective(900px) rotateY(90deg) scale(.7); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.blysk { position: absolute; inset: -40% -60%; background: linear-gradient(105deg, transparent 40%, rgba(255, 240, 200, .75) 50%, transparent 60%); animation: blysk 1.2s ease-out .45s both; pointer-events: none; }
@keyframes blysk { from { transform: translateX(-60%); } to { transform: translateX(60%); opacity: 0; } }
.karta-odkrycia .etykieta { font-family: var(--f-maszyna); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--pieczec); }
.karta-odkrycia h3 { margin: 0; font-family: var(--f-maszyna); font-weight: 400; font-size: 24px; }
.karta-odkrycia p { margin: 0; font-size: 16px; }
.karta-odkrycia .miniatura { width: 84px; height: 84px; font-size: 34px; box-shadow: 0 0 0 3px var(--mosiadz); }
.karta-odkrycia.znajdzka { box-shadow: 0 0 0 2px var(--mosiadz), 0 0 40px rgba(201, 154, 62, .45), 0 20px 60px rgba(0, 0, 0, .5); }
.karta-odkrycia.fakt { border-top: 5px solid var(--pieczec); }
.karta-odkrycia .rzad { margin-top: 6px; }

/* Zagadki */
.zagadka .zaw > p { margin: 0; }
.narzedzie { display: flex; flex-direction: column; gap: 10px; background: #f8f1e0; border: 1px solid var(--papier2); border-radius: 10px; padding: 12px; }
.klodka { display: flex; justify-content: center; gap: 6px; padding: 10px 0; }
.kolko { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kolko button { width: clamp(38px, 11vw, 54px); height: 42px; border: 1px solid #b89c62; background: #efe0bd; border-radius: 8px; color: var(--sepia); }
.kolko output { width: clamp(38px, 11vw, 54px); height: 64px; display: grid; place-items: center; font-family: var(--f-mono); font-size: 34px; background: linear-gradient(#b8893a, #e2bd6c 45%, #b8893a); color: #2b1d08; border-radius: 6px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .3); }
.obrot { animation: obrot .25s ease-out; }
@keyframes obrot { from { transform: translateY(-30%); opacity: .3; } }
.kolo { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; align-items: center; }
.kolo button { height: 56px; border-radius: 10px; border: 1px solid #b89c62; background: #efe0bd; font-size: 26px; color: var(--sepia); }
.kolo output { text-align: center; font-family: var(--f-maszyna); font-size: 36px; }
.pasek { overflow-x: auto; }
.pasek table { border-collapse: collapse; font-family: var(--f-mono); font-size: 14px; }
.pasek td, .pasek th { padding: 3px 5px; text-align: center; }
.pasek th { font-size: 10px; text-transform: uppercase; color: var(--tusz2); font-weight: 400; text-align: left; }
.pasek tr:first-child td { border-bottom: 1px solid var(--papier2); color: var(--pieczec); }
.podglad { font-family: var(--f-mono); font-size: 19px; letter-spacing: .06em; background: #fffaf0; border: 1px solid var(--papier2); border-radius: 8px; padding: 12px; min-height: 52px; word-break: break-word; }
.tabelaM summary { cursor: pointer; font-family: var(--f-maszyna); }
.mtab { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.mtab div { background: #fffaf0; border-radius: 4px; padding: 3px 5px; display: flex; justify-content: space-between; }
.mtab b { color: var(--pieczec); }
.blad { color: var(--pieczec); font-size: 15px; min-height: 22px; }
.trzes { animation: trzes .4s; }
@keyframes trzes { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.podpowiedz { background: #fff6dc; border-left: 3px solid var(--mosiadz); padding: 8px 10px; border-radius: 4px; font-size: 15px; margin-bottom: 6px; }
.lekcja { border-top: 1px solid var(--papier2); padding-top: 8px; }
.lekcja summary { cursor: pointer; font-family: var(--f-maszyna); color: var(--sepia); }
.lekcja p { font-size: 15px; margin: 8px 0 0; }
.stempel { position: absolute; top: 40%; left: 50%; z-index: 3; font-family: var(--f-maszyna); font-size: 34px; color: var(--pieczec); border: 4px solid var(--pieczec); padding: 4px 16px; background: rgba(240, 230, 209, .85); letter-spacing: .1em; transform: translate(-50%, -50%) rotate(-8deg); animation: stempelZ .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stempel { from { transform: rotate(-6deg) scale(2); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
@keyframes stempelZ { from { transform: translate(-50%, -50%) rotate(-8deg) scale(2.2); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; } }
.seg { display: flex; gap: 4px; background: var(--papier2); padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 8px; font-size: 15px; color: var(--tusz2); }
.seg button.on { background: var(--papier); color: var(--tusz); font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--tusz); color: var(--papier); border: 1px solid var(--mosiadz); padding: 8px 16px; border-radius: 20px; font-size: 14px; font-family: var(--f-maszyna); white-space: nowrap; }
#toast.pokaz { animation: toast .3s ease-out; }
@keyframes toast { from { transform: translate(-50%, 10px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* --- Akt II: podstawienie, kolejność, Enigma --- */
.eyebrow-z { font-family: var(--f-maszyna); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--sepia); }
.freq { display: flex; align-items: flex-end; gap: 3px; height: 70px; overflow-x: auto; }
.freq div { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--f-mono); font-size: 10px; color: var(--tusz2); }
.freq i { display: block; width: 11px; background: var(--sepia); border-radius: 2px 2px 0 0; }
.slowa { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.slowo { display: flex; gap: 3px; flex-wrap: wrap; }
.lt { width: 28px; border: 0; background: #fffaf0; border-radius: 4px; padding: 2px 0; display: flex; flex-direction: column; align-items: center; font-family: var(--f-mono); box-shadow: inset 0 0 0 1px var(--papier2); }
.lt .g { font-size: 17px; font-weight: 600; height: 22px; color: var(--tusz); }
.lt .c { font-size: 10px; color: var(--tusz2); border-top: 1px solid var(--papier2); width: 80%; text-align: center; }
.lt.sel { background: var(--mosiadz); }
.lt.blok .g { color: var(--ziel); }
.znak { font-family: var(--f-mono); font-size: 17px; align-self: flex-start; padding-top: 2px; }
.kb { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; position: sticky; bottom: 0; background: #f8f1e0; padding-top: 6px; }
.kb button { height: 42px; border-radius: 6px; border: 1px solid #c7b590; background: #fffaf0; font-family: var(--f-mono); font-size: 16px; color: var(--tusz); }
.kb button.uzyta { color: #b3a68b; background: #efe6d2; }
.kb button.del { grid-column: span 2; background: var(--papier2); }
.tor { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.tor li { color: #b3a68b; }
.tor li.jest { color: var(--ziel); font-weight: 600; animation: notka .3s; }
.pula { display: flex; flex-direction: column; gap: 6px; }
.pula .wybor small { display: block; font-size: 13px; color: var(--tusz2); }
.wirniki { display: flex; justify-content: center; gap: 12px; }
.okienko { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.okienko button { width: 52px; height: 38px; border: 1px solid #b89c62; background: #efe0bd; border-radius: 8px; color: var(--sepia); }
.okienko output { width: 52px; height: 52px; display: grid; place-items: center; font-family: var(--f-mono); font-size: 28px; background: #1d1a16; color: #f3e6c4; border-radius: 6px; box-shadow: inset 0 3px 8px rgba(0, 0, 0, .6); }
.lampki, .klaw { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.rzadL { display: flex; gap: 3px; }
.lampki span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-mono); font-size: 13px; background: #2b2722; color: #6f675b; transition: background .15s, color .15s, box-shadow .15s; }
.lampki span.swieci { background: #ffd66b; color: #2b1d08; box-shadow: 0 0 14px #ffc93c; }
.klaw button { width: 34px; height: 38px; border-radius: 50%; border: 2px solid #3a332b; background: #f7f0de; font-family: var(--f-mono); font-size: 14px; color: var(--tusz); padding: 0; }
.klaw button:active { transform: translateY(2px); background: var(--papier2); }

/* --- Akt III: Polibiusz, zdrapka, ściąga --- */
.polib { display: grid; grid-template-columns: 26px repeat(5, minmax(0, 1fr)); gap: 4px; align-items: center; text-align: center; font-family: var(--f-mono); }
.polib b { color: var(--pieczec); font-size: 15px; }
.polib button { height: 44px; border-radius: 6px; border: 1px solid #c7b590; background: #fffaf0; font-family: var(--f-mono); font-size: 16px; color: var(--tusz); padding: 0; }
.polib button:active { background: var(--mosiadz); }
.zdrapka { position: relative; height: 210px; border-radius: 8px; overflow: hidden; background: #f3ead6; box-shadow: inset 0 0 0 1px var(--papier2); }
.zdrapka .ukryte { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 14px; font-family: var(--f-reka); font-size: 22px; line-height: 1.25; color: #8a4b12; text-align: center; }
.zdrapka .ukryte p { margin: 0; }
.zdrapka.kalka { background: #3b3a38; }
.zdrapka.kalka .ukryte { color: #e6e1d6; font-family: var(--f-maszyna); font-size: 15px; text-align: left; }
.zdrapka canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; transition: opacity .7s; }
.zdrapka canvas.znika { opacity: 0; }
.sciaga { font-family: var(--f-mono); font-size: 14px; background: #fffaf0; border: 1px dashed #c7b590; border-radius: 6px; padding: 8px 10px; margin: 0; overflow-x: auto; }
.k-hart .av { background: #3b5b8c; } .k-colette .av { background: #8a5a7a; } .k-garnier .av { background: #6a6a4a; } .k-szary .av { background: #444; }

/* --- Akt V: skrót, ściągawka, XOR --- */
.skrot { font-family: var(--f-mono); font-size: 13px; line-height: 1.5; word-break: break-all; background: #fffaf0; border: 1px solid var(--papier2); border-radius: 6px; padding: 8px 10px; }
.skrot.zgodny { border-color: var(--ziel); color: var(--ziel); box-shadow: 0 0 0 2px rgba(79, 125, 85, .25); }
.szyfrogram.male { font-size: 13px; letter-spacing: .04em; }
.crib { overflow-x: auto; padding-bottom: 4px; }
.cribRz { display: flex; gap: 2px; width: max-content; }
.cribRz span { width: 20px; height: 28px; display: grid; place-items: center; font-family: var(--f-mono); font-size: 15px; border-radius: 3px; background: #fffaf0; }
.cribRz span.puste { background: transparent; }
.cribRz span.nad { background: #efe0bd; }
.cribRz span.kr { background: #dfe9dc; color: var(--ziel); font-weight: 600; }
.cribRz span.zle { background: #f2c9c2; color: var(--pieczec); font-weight: 600; }
.bity { display: grid; grid-template-columns: 70px repeat(5, minmax(0, 1fr)); gap: 4px; align-items: center; font-family: var(--f-mono); }
.bity span { font-size: 11px; color: var(--tusz2); text-transform: uppercase; }
.bity .b { height: 40px; display: grid; place-items: center; background: #fffaf0; border-radius: 4px; font-size: 18px; border: 1px solid var(--papier2); }
.bity button.b { border: 1px dashed var(--sepia); background: #efe0bd; color: var(--tusz); }
.bajty { display: flex; flex-wrap: wrap; gap: 4px; font-family: var(--f-mono); font-size: 11px; }
.bajty div { background: #fffaf0; border-radius: 4px; padding: 3px 5px; text-align: center; min-width: 52px; }
.bajty b { display: block; font-size: 16px; color: var(--pieczec); height: 20px; }
.k-peters .av { background: #5a6b3c; } .k-margaret .av { background: #6b4f7a; }

/* --- Akt VI: wybór, statystyki, lampa UV --- */
.opcje { display: flex; flex-direction: column; gap: 8px; }
.dokument { background: #f7f0df; border: 1px solid var(--papier2); padding: 12px 14px; font-family: var(--f-maszyna); font-size: 14px; line-height: 1.5; transform: rotate(-.4deg); box-shadow: 2px 3px 0 var(--papier2); }
.dokument p { margin: 0 0 6px; }
.statystyki { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.statystyki div { background: #f8f1e0; border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.statystyki span { font-size: 12px; color: var(--tusz2); font-family: var(--f-maszyna); text-transform: uppercase; letter-spacing: .06em; }
.statystyki b { font-size: 20px; font-family: var(--f-maszyna); font-weight: 400; }
.zdrapka.uv { background: #1a1030; }
.zdrapka.uv .ukryte { color: #c9b8ff; font-family: var(--f-reka); font-size: 34px; text-shadow: 0 0 12px #8f6bff; }
.k-schatten .av { background: #444; } .k-przewodniczacy .av { background: #3a4a6a; }

/* --- Telefon: paski przeglądarki (Safari/Chrome) zasłaniały dół ekranu (2026-11-08, uwaga użytkownika) ---
   Mniej miejsca u góry, więcej na dole; wysokości warstw liczone od widocznej części ekranu (dvh). */
#app { padding-top: calc(2px + env(safe-area-inset-top, 0px)); padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)); }
.gora { min-height: 38px; }
#menuBtn { height: 34px; }
.kartka { margin-top: 2px; }
.tytulowy { min-height: 70vh; min-height: 70dvh; padding-block: 12px 40px; }
.ilustracja { max-height: 38vh; max-height: 36dvh; }
#nav { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
#warstwa { align-items: flex-end; }
.arkusz { max-height: 86vh; max-height: calc(100dvh - 24px); padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.arkusz.duzy { height: auto; max-height: 92vh; max-height: calc(100dvh - 16px); }
.zaw { padding-bottom: 48px; }
#odkrycie { align-items: center; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
.karta-odkrycia { max-height: 80vh; max-height: calc(100dvh - 90px); }
#toast { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
.kb { padding-bottom: 6px; }

/* --- Telefon: podwójne stuknięcie powiększało stronę (2026-11-08, uwaga użytkownika) ---
   touch-action: manipulation wyłącza przybliżanie podwójnym stuknięciem; pola ≥16px – iOS nie przybliża przy pisaniu. */
html, body, button, input, textarea, canvas, .lt, .kolko, .okienko, .klaw, .kb, .polib, .bity { touch-action: manipulation; }
.zdrapka canvas { touch-action: none; }
input, textarea, select, .pole, textarea#kodPole { font-size: 16px; }
.pole { font-size: 18px; }
button { -webkit-user-select: none; user-select: none; }

/* --- Telefon: górę obniżona, bo wchodziła pod cień paska przeglądarki (2026-11-08, uwaga użytkownika) --- */
#app { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.gora { min-height: 42px; }
.arkusz { max-height: calc(100dvh - 60px); }
.arkusz.duzy { max-height: calc(100dvh - 52px); }
.karta-odkrycia { max-height: calc(100dvh - 120px); }
#odkrycie { padding-top: calc(30px + env(safe-area-inset-top, 0px)); }
/* (obrazki w tekście i porcjowanie – style) */
.ukryty { display: none !important; }
.pojaw { animation: pojaw .45s ease-out both; }
@keyframes pojaw { from { opacity: 0; transform: translateY(8px); } }
.dalejTekst { align-self: center; margin-top: 4px; border: 0; border-radius: 999px; padding: 12px 28px; min-height: 48px; background: var(--tusz); color: var(--papier); font-family: var(--f-maszyna); font-size: 17px; letter-spacing: .06em; box-shadow: 0 3px 0 #000; }
.dalejTekst span { display: inline-block; animation: strzalka 1s ease-in-out infinite; }
@keyframes strzalka { 50% { transform: translateX(5px); } }
.dalejTekst:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.wstawka { margin: 2px auto; width: 78%; max-width: 320px; transform: rotate(-1.2deg); background: #fff; padding: 6px 6px 4px; box-shadow: 0 6px 16px rgba(43, 33, 25, .25); animation: wstawka .6s cubic-bezier(.2, 1.3, .4, 1) both; }
.wstawka img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.wstawka figcaption { font-family: var(--f-reka); font-size: 19px; text-align: center; color: var(--tusz2); padding-top: 2px; }
@keyframes wstawka { from { opacity: 0; transform: scale(.85) rotate(-6deg); } }
.notka .wstawka { width: 70%; }
.zagObraz { margin: -4px -4px 0; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; box-shadow: 0 4px 12px rgba(43, 33, 25, .2); animation: zagObraz .7s ease-out both; }
.zagObraz img { width: 100%; height: 100%; object-fit: cover; display: block; animation: kenburns 9s ease-in-out infinite alternate; }
@keyframes zagObraz { from { opacity: 0; transform: scale(.96); } }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.08) translate(-2%, -1%); } }
@media (prefers-reduced-motion: reduce) { .zagObraz img, .dalejTekst span { animation: none; } }
