@font-face { font-family: "Alegreya SC"; src: url("../fonts/AlegreyaSC-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/AlegreyaSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("../fonts/AlegreyaSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
/* Wirtualna księga — styl spójny z landingiem (krem, granat, złoto, biurko w tle) */
:root {
  --krem: #f6f1e6;
  --granat: #16203A;
  --granat-2: #262f49;
  --zloto: #C9A258;
  --zloto-jasne: #DDBB7A;
  --serif: "Alegreya SC", Georgia, serif;
  --sans: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --pasek: 56px;
  --dol: 40px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--sans); color: var(--granat);
  background: #e9dfcb url("../img/bureau.webp") center / cover no-repeat fixed;
  overflow: hidden;
}
@media (max-width: 760px) { body { background-image: url("../img/bureau-m.webp"); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; }

.czytnik { height: 100%; height: 100dvh; display: flex; flex-direction: column; position: relative; }
.czytnik:fullscreen { background: #e9dfcb url("../img/bureau.webp") center / cover no-repeat; }

/* ---------- górny pasek ---------- */
.pasek {
  height: var(--pasek); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(17, 29, 59, .97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--krem);
  position: relative; z-index: 20;
}
.logo { font-family: var(--serif); font-size: 1.25rem; color: var(--krem); text-decoration: none; white-space: nowrap; }
.logo span { color: var(--zloto-jasne); }
.wybor { flex: 0 1 auto; min-width: 0; }
.wybor select {
  font: inherit; font-size: .95rem; color: var(--krem); background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(217, 184, 103, .45); border-radius: 999px; padding: .35rem 2rem .35rem .9rem; max-width: 100%; width: 100%; text-overflow: ellipsis;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23d9b867' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 11px;
}
.wybor select option { color: var(--granat); }
.pasek-prawo { margin-left: auto; display: flex; gap: 6px; flex: none; }
.ikona {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 10px;
  border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--krem); cursor: pointer;
}
.ikona:hover, .ikona[aria-expanded="true"] { background: rgba(255, 255, 255, .1); }
.ikona:focus-visible, .strzalka:focus-visible, .wybor select:focus-visible { outline: 2px solid var(--zloto-jasne); outline-offset: 2px; }
.ikona svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#btn-dzwiek .fala { display: none; }
#btn-dzwiek[aria-pressed="true"] .fala { display: inline; }
#btn-dzwiek[aria-pressed="true"] .krzyz { display: none; }
#btn-dzwiek[aria-pressed="true"] { color: var(--zloto-jasne); }
@media (max-width: 560px) { .ikona .tekst { display: none; } .logo { font-size: 1.05rem; } .pasek { gap: 8px; padding: 0 10px; } }

/* ---------- spis treści ---------- */
.spis {
  position: absolute; top: calc(var(--pasek) + 8px); right: 12px; z-index: 30;
  width: min(340px, calc(100vw - 24px)); max-height: calc(100% - var(--pasek) - 24px); overflow: auto;
  background: rgba(250, 247, 239, .97); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); padding: 14px 8px 10px;
}
.spis[hidden] { display: none; }
.spis-tytul { font-family: var(--serif); font-size: 1.15rem; padding: 0 12px 8px; border-bottom: 1px solid rgba(22, 32, 58, .12); }
.spis ol { list-style: none; margin: 6px 0 0; padding: 0; }
.spis button {
  width: 100%; display: flex; justify-content: space-between; gap: 12px; text-align: left; padding: 8px 12px;
  border: 0; background: none; border-radius: 8px; color: var(--granat); cursor: pointer; font-size: .98rem;
}
.spis button:hover, .spis button:focus-visible { background: rgba(184, 145, 63, .14); outline: none; }
.spis button.aktywny { font-weight: 700; color: var(--zloto); }
.spis .nr { color: #8a8678; font-size: .88rem; flex: none; }

/* ---------- scena z księgą ---------- */
.scena { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 12px 0; position: relative; }
.ksiega-ramka {
  /* szerokość wyliczana w JS (zmienna --szer), tak by rozkładówka zmieściła się w oknie */
  width: var(--szer, 90vw); max-width: 100%; flex: none; position: relative;
}
.ksiega-ramka::after {
  /* miękki cień księgi na blacie */
  content: ""; position: absolute; left: 4%; right: 4%; bottom: -14px; height: 28px; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(40, 28, 10, .38), transparent 70%); filter: blur(4px);
}
.ksiega { margin: 0 auto; }
.strona { background: #f4efe3; overflow: hidden; }
.strona img { width: 100%; height: 100%; object-fit: contain; display: block; opacity: 0; transition: opacity .25s; user-select: none; -webkit-user-drag: none; }
.strona img.zaladowana { opacity: 1; }
.strona.ladowanie { background: #f4efe3 linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, .55) 50%, transparent 60%) 0 0 / 250% 100%; animation: lsk 1.4s linear infinite; }
@keyframes lsk { to { background-position: -150% 0; } }
.strona[data-density="hard"] { background: #efe8d8; }

.strzalka {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; z-index: 5;
  background: rgba(22, 32, 58, .85); color: var(--zloto-jasne); display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25); transition: opacity .2s, transform .15s;
}
.strzalka:hover { transform: scale(1.06); }
.strzalka:disabled { opacity: .25; cursor: default; transform: none; }
.strzalka svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) {
  .strzalka { position: absolute; bottom: -2px; width: 40px; height: 40px; }
  .strzalka.lewo { left: 12px; } .strzalka.prawo { right: 12px; }
  .scena { padding: 10px 10px 0; }
}

/* ---------- dół ---------- */
.dol { height: var(--dol); flex: none; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: .92rem; }
.licznik {
  background: rgba(22, 32, 58, .85); color: var(--krem); padding: .2rem .8rem; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.podpowiedz { color: #3f3a2e; background: rgba(250, 247, 239, .75); padding: .15rem .6rem; border-radius: 999px; transition: opacity .6s; }
.podpowiedz.ukryj { opacity: 0; }
@media (max-width: 760px) { .podpowiedz { display: none; } .podpowiedz.obroc { display: inline; position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%); white-space: nowrap; } }
@media (max-width: 400px) { .logo { display: none; } .ikona { padding: 0 6px; min-width: 34px; } }

@media (prefers-reduced-motion: reduce) { .strona.ladowanie { animation: none; } }

.logo { display: inline-flex; align-items: center; }
.logo img { width: 34px; height: 40px; margin-right: .5rem; }

.taalkeuze { display: inline-flex; gap: 2px; margin-left: auto; background: rgba(255, 255, 255, .08); border: 1px solid rgba(221, 187, 122, .35); border-radius: 999px; padding: 2px; flex: none; }
.taalkeuze a { color: var(--krem); text-decoration: none; font-size: .8rem; font-weight: 700; padding: .25rem .55rem; border-radius: 999px; }
.taalkeuze a[aria-current] { background: var(--zloto); color: var(--granat); }
.taalkeuze + .pasek-prawo { margin-left: 6px; }
.podglad-pasek { background: #7a2a2a; color: #fff; text-align: center; font-size: .82rem; font-weight: 700; padding: .35rem 1rem; }
