/* Blätter-Ansicht für Flipbooks (23.11.2026). Farben kommen je Projekt aus :root (--fb-grund, --fb-grund2, --fb-akzent, --fb-text).
   Wird beim Veröffentlichen aus TTR/assets/flipbook/ nach <seite>/blaettern/_viewer/ kopiert. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: radial-gradient(120% 90% at 50% 40%, var(--fb-grund2) 0%, var(--fb-grund) 70%);
    background-color: var(--fb-grund);
    color: var(--fb-text);
    font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }

.fb { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* Kopf: Logo, Titel, Zähler */
.fb-kopf { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 56px; }
.fb-logo { flex: none; display: block; line-height: 0; }
.fb-logo img { height: 38px; width: auto; max-width: 140px; object-fit: contain; }
.fb-titel { flex: 1; min-width: 0; margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.fb-zaehler { flex: none; font-size: .85rem; opacity: .8; font-variant-numeric: tabular-nums; }

/* Bühne mit Buch */
.fb-buehne { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 56px; }
.fb-buch { margin: 0 auto; }
.fb-buch .stf__parent, .fb-buch.stf__parent { margin: 0 auto; }
.fb-seite { background: #fff; overflow: hidden; }
.fb-seite img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; pointer-events: none; opacity: 0; transition: opacity .25s; }
.fb-seite img.da { opacity: 1; }
.fb-seite::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, #f1f1f1 30%, #fafafa 50%, #f1f1f1 70%); background-size: 300% 100%; animation: fb-laden 1.4s linear infinite; z-index: -1; }
@keyframes fb-laden { from { background-position: 100% 0; } to { background-position: 0 0; } }
.fb-schatten { filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45)); }

.fb-pfeil { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s, opacity .2s; }
.fb-pfeil:hover { background: rgba(255, 255, 255, .18); }
.fb-pfeil:disabled { opacity: .2; cursor: default; }
.fb-pfeil svg { width: 26px; height: 26px; }
.fb-zurueck { left: 6px; }
.fb-weiter { right: 6px; }

/* Leiste unten */
.fb-leiste { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
.fb-knopf { height: 40px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s; }
.fb-knopf:hover { background: rgba(255, 255, 255, .2); }
.fb-knopf.an { background: var(--fb-akzent); color: var(--fb-akzent-text); }
.fb-knopf svg { width: 20px; height: 20px; flex: none; }
.fb-knopf[hidden] { display: none; }
.fb-trenner { width: 1px; height: 24px; background: rgba(255, 255, 255, .2); margin: 0 4px; }
.fb-seitenwahl { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-size: .9rem; }
.fb-seitenwahl input { width: 52px; height: 36px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; background: rgba(0, 0, 0, .25); color: inherit; text-align: center; font: inherit; }
.fb-seitenwahl input:focus { outline: 2px solid var(--fb-akzent); border-color: transparent; }
.fb-fortschritt { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .08); }
.fb-fortschritt i { display: block; height: 100%; width: 0; background: var(--fb-akzent); transition: width .35s; }

/* Seitenübersicht */
.fb-uebersicht { position: absolute; inset: 0; z-index: 30; background: color-mix(in srgb, var(--fb-grund) 94%, transparent); overflow-y: auto; padding: 70px 16px 40px; -webkit-overflow-scrolling: touch; }
.fb-uebersicht[hidden], .fb-zoom[hidden] { display: none; }
.fb-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; max-width: 1200px; margin: 0 auto; }
.fb-mini { border: 0; padding: 0; background: none; cursor: pointer; text-align: center; font-size: .8rem; opacity: .9; }
.fb-mini img { display: block; width: 100%; height: auto; aspect-ratio: var(--fb-seitenformat); object-fit: contain; background: #fff; border-radius: 4px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); margin-bottom: 6px; transition: transform .15s, outline-color .15s; outline: 3px solid transparent; outline-offset: 2px; }
.fb-mini:hover img { transform: translateY(-2px); }
.fb-mini.aktuell img { outline-color: var(--fb-akzent); }
.fb-schliessen { position: absolute; top: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); z-index: 2; }
.fb-uebersicht .fb-schliessen { position: fixed; }

/* Zoom */
.fb-zoom { position: absolute; inset: 0; z-index: 40; background: rgba(10, 10, 14, .96); }
.fb-zoom-flaeche { position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; cursor: grab; }
.fb-zoom-flaeche.zieht { cursor: grabbing; }
.fb-zoom-inhalt { display: flex; margin: auto; min-height: 100%; min-width: 100%; align-items: center; justify-content: center; padding: 24px; width: max-content; }
.fb-zoom-inhalt img { display: block; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); user-select: none; -webkit-user-drag: none; }
.fb-zoom-knoepfe { position: absolute; left: 50%; bottom: 16px; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 6px; background: rgba(0, 0, 0, .55); padding: 6px; border-radius: 14px; z-index: 2; }
.fb-zoom-knoepfe .fb-stufe { min-width: 56px; font-size: .9rem; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; color: #fff; }

/* Für Suchmaschinen und Bildschirmleser: Seitentexte unsichtbar, aber vorhanden */
.fb-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: normal; }

.fb-hinweis { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgba(0, 0, 0, .6); color: #fff; padding: 8px 14px; border-radius: 20px; font-size: .85rem; pointer-events: none; transition: opacity .6s; z-index: 5; white-space: nowrap; }

@media (max-width: 700px) {
    .fb-buehne { padding: 6px 8px; }
    .fb-pfeil { display: none; }
    .fb-kopf { min-height: 48px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); gap: 10px; }
    .fb-logo img { height: 30px; }
    .fb-titel { font-size: .9rem; }
    .fb-leiste { gap: 4px; padding: 6px 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
    .fb-knopf { min-width: 38px; height: 38px; padding: 0 8px; }
    .fb-knopf .wort, .fb-trenner, .fb-nur-breit { display: none; }
    .fb-raster { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { .fb-seite::before { animation: none; } }
