/* Buchregal – Fantasy-Bibliothek. Dunkel ist Standard, [data-theme="light"] schaltet um;
   Regal-Themes (themes.css, [data-shelf-theme]) überschreiben die Variablen, solange ein Regal gewählt ist. */

:root {
  --font-display: Cinzel, Georgia, serif; --font-body: 'EB Garamond', Georgia, serif;
  --app-bg: radial-gradient(ellipse 120% 55% at 50% 0%, var(--bg0) 0%, var(--bg1) 60%, var(--bg2) 100%);
  --gold-rgb: 201, 161, 74; --leather-title: #E6CB84; --on-gold: #241A13;
  --bg0: #3F2E1E; --bg1: #241A13; --bg2: #1D140E;
  --text: #EFE2C4; --muted: #A89878; --faint: #9C8A66;
  --gold: #C9A14A; --gold-bright: #E3C878; --gold-dark: #A47F35;
  --oxblood: #6E2B26; --oxblood-deep: #56201C;
  --border: #52402A; --border-soft: #6B573B;
  --wordmark: #E3C878; --icon: #C9A14A; --accent-label: #C9A14A; --count: #E3C878;
  --chip-active-bg: #C9A14A; --chip-active-fg: #241A13; --chip-fg: #CDB98E;
  --parch: #EFE3C8; --parch-deep: #E0CFA8; --parch-border: #C9B28B;
  --parch-ink: #2B2117; --parch-muted: #7A6A4E; --parch-field: #FBF6E8;
  --track-bg: #3C2E1F; --track-border: #52402A;
  --wood-hi: #6B4A2F; --wood-lo: #46301D; --wood-edge: #8A6A42;
  --nav-hi: #2A1E14; --nav-lo: #1C140E; --nav-active: #E3C878; --nav-idle: #9C8A66;
  --surface-btn: rgba(0, 0, 0, 0.25);
  --field-bg: #1D140E; --field-border: #52402A;
  --shadow-book: rgba(0, 0, 0, 0.5);
  --modal-bg: #2A1E14;
  --danger: #C25B4E;
  --focus: #E3C878;
  --world-veil-top: rgba(36, 26, 19, 0.45); --world-veil-mid: rgba(36, 26, 19, 0.68); --world-veil-bottom: rgba(29, 20, 14, 0.94);
}
[data-theme="light"] {
  --bg0: #FBF4E2; --bg1: #F3EAD2; --bg2: #EDE1C3;
  --text: #3A2E20; --muted: #6B5B40; --faint: #8A7658;
  --wordmark: #6E2B26; --icon: #8A6A42; --accent-label: #8A6420; --count: #6E2B26;
  --chip-active-bg: #6E2B26; --chip-active-fg: #F6EFD9; --chip-fg: #6B573B;
  --border: #D9C8A4; --border-soft: #C9B28B;
  --track-bg: #E4D7B8; --track-border: #D4C49C;
  --wood-hi: #D9A968; --wood-lo: #B3854C; --wood-edge: #EBC68B;
  --nav-hi: #F1E6CC; --nav-lo: #E8DABB; --nav-active: #6E2B26; --nav-idle: #8A7658;
  --surface-btn: rgba(255, 255, 255, 0.55);
  --field-bg: #FBF6E8; --field-border: #C9B28B;
  --shadow-book: rgba(110, 70, 30, 0.35);
  --modal-bg: #F6EDD6;
  --danger: #A33D30;
  --focus: #6E2B26;
  --world-veil-top: rgba(243, 234, 210, 0.55); --world-veil-mid: rgba(243, 234, 210, 0.74); --world-veil-bottom: rgba(237, 225, 195, 0.95);
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.45;
  color: var(--text);
  /* Der Verlauf liegt auf einer eigenen, fest stehenden Ebene (body::before): „background-attachment: fixed"
     galt nur für eine der Ebenen und wird von Handy-Browsern ignoriert – dann wiederholte sich der Verlauf
     alle Bildschirmhöhen und hatte beim Scrollen Kanten. Darunter die dunkelste Farbe als Grund. */
  background: var(--bg2, #1D140E);
  padding-top: env(safe-area-inset-top, 0px);
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--app-bg); background-repeat: no-repeat;
}
a { color: var(--gold); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sans { font-family: ui-sans-serif, system-ui, sans-serif; }
.cinzel { font-family: var(--font-display); }

/* Alle Seiten skalieren gleich: bis 920 px breit, zentriert (page-wide ist seitdem nur noch ein Name) */
/* Mindestens bildschirmhoch – wie das Regal: Auf dem iPhone (als App vom Home-Bildschirm) rutschte die
   untere Leiste auf kurzen Seiten (Quiz, Storys) sonst ein Stück nach oben. */
.page { max-width: 920px; margin: 0 auto; padding: 0 16px calc(90px + env(safe-area-inset-bottom, 0px)) 16px;
  min-height: 100vh; min-height: 100dvh; }
.page-wide { max-width: 920px; }
.page-nonav { padding-bottom: 32px; }

/* ---------- Genre-Welten: Hintergrund hinter der ganzen Seite ---------- */
/* overflow-x: clip – beim Blättern und Wischen ragt das Regal kurz seitlich hinaus; das darf das Dokument
   nicht breiter machen (sonst rechnet der Handy-Browser mit Layout und fixen Leisten neu) */
#app { position: relative; z-index: 1; overflow-x: clip; }
#world { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
/* Theme-Deko (deco.js) in der App kleiner und über der Navigationsleiste */
#deco .deco-pumpkin { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 78px; left: 6px; }
#deco .deco-pumpkin.right { width: 60px; left: auto; right: 6px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
#deco .deco-garland .swag { width: 90px; height: 45px; }
#deco .deco-web { width: 84px; }
.world-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease; }
.world-layer.on { opacity: 1; }
.world-layer::before {
  content: ""; position: absolute; inset: -16px;
  background: var(--world-img) center 30% / cover no-repeat;
  filter: blur(5px) saturate(1.1);
}
.world-layer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--world-veil-top) 0%, var(--world-veil-mid) 50%, var(--world-veil-bottom) 100%);
}
@media (prefers-reduced-motion: reduce) { .world-layer { transition: none; } }

/* ---------- Kopf ---------- */
/* Kopfzeile der Hauptseiten steht fest oben – fixed statt sticky, damit sie auch nicht mitrutscht, wenn
   das iPhone am oberen Rand nachfedert. Sie reicht über die Statusleiste (iPhone-App: der body hat dort
   oben Abstand) – sonst schiene beim Scrollen Inhalt hinter der Uhrzeit durch. Ihr Platzhalter
   .topbar-slot hält im Fluss die Höhe frei (nav.js misst nach). Ganz oben ist sie durchsichtig wie
   bisher; .stuck (nav.js) gibt ihr beim Scrollen Grund und Kante. Ohne Platzhalter (Lade-Skelett) liegt
   sie normal im Fluss. */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: calc(-1 * env(safe-area-inset-top, 0px)) -16px 0 -16px;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 8px 16px;
  border-bottom: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.topbar-slot { margin-top: calc(-1 * env(safe-area-inset-top, 0px)); height: calc(68px + env(safe-area-inset-top, 0px)); }
.topbar-slot > .topbar, .topbar-slot > .st-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 15; margin: 0 auto; max-width: 920px;
}
.topbar.stuck {
  background: var(--bg1);
  border-bottom-color: var(--border); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.wordmark { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wordmark .ghost-logo { width: 30px; height: 41px; margin: 0; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35)); }
.wordmark-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.eyebrow-brand {
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 2.5px; text-transform: uppercase; color: var(--accent-label);
}
.wordmark h1 {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  font-size: 22px; letter-spacing: 1px; line-height: 1.15; color: var(--wordmark);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
/* Schmale Schirme: Titel etwas kleiner und die Knöpfe enger, damit ein Regalname neben drei Knöpfe passt */
@media (max-width: 480px) {
  .wordmark h1 { font-size: 19px; letter-spacing: 0.5px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .iconbtn { width: 40px; height: 40px; }
}

.iconbtn {
  width: 42px; height: 42px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-btn); color: var(--icon);
  display: inline-flex; align-items: center; justify-content: center;
}
.backbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px 0; }
.backbar .screen-title {
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  letter-spacing: 2px; color: var(--accent-label); text-transform: uppercase;
}
.backlink { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--icon); text-decoration: none; }

/* ---------- Lesejahr ---------- */
.challenge { display: flex; flex-direction: column; gap: 7px; margin: 8px 0 12px 0; }
.challenge-head { display: flex; align-items: baseline; justify-content: space-between; }
.eyebrow {
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; color: var(--accent-label);
}
.challenge-count { font-size: 15px; color: var(--muted); }
.challenge-count b { color: var(--count); font-weight: 700; }
.track { height: 6px; border-radius: 3px; background: var(--track-bg); border: 1px solid var(--track-border); overflow: hidden; }
.track-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold-bright)); }
[data-theme="light"] .track-fill { background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }

/* ---------- Chips & Suche ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px 0; }
.chip {
  height: 34px; display: inline-flex; align-items: center; padding: 0 15px;
  border-radius: 17px; border: 1px solid var(--border-soft); background: none;
  color: var(--chip-fg); font-size: 14px;
}
.chip.active { background: var(--chip-active-bg); color: var(--chip-active-fg); border-color: var(--chip-active-bg); font-weight: 700; }

/* ---------- Regale blättern: schwebende Leiste über der Navigation, Pfeile und ein Punkt je Regal ---------- */
.shelf-pager {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 19; will-change: transform;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 4px; padding: 2px 6px; max-width: calc(100vw - 32px);
  border-radius: 24px; border: 1px solid var(--border);
  /* kein backdrop-filter: der Weichzeichner über einem animierten Regal lässt auf Handys die
     Leisten darunter flackern */
  background: var(--bg2); background: color-mix(in srgb, var(--bg2) 90%, transparent);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.page.has-pager { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
.iconbtn { position: relative; }
.iconbadge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: var(--gold); color: var(--on-gold);
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

/* ---------- Einräumen: Ablage oben, darunter ein Regal in seinem Theme, Bücher per Drag-and-drop ---------- */
.sort-intro { font-size: 14px; margin: 0 0 10px 0; }
.tray { margin-bottom: 16px; }
.tray-head { display: flex; align-items: baseline; justify-content: space-between; }
/* Die Ablage ist ein Streifen: wird sie lang, scrollt sie seitwärts */
.tray-books {
  display: flex; gap: 10px; align-items: flex-end; min-height: 104px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 4px 10px 4px; border-radius: 10px 10px 0 0; transition: background 0.15s, box-shadow 0.15s;
}
.tray-books::-webkit-scrollbar { display: none; }
.tray-surface {
  height: 10px; border-radius: 2px; background: linear-gradient(180deg, var(--wood-hi), var(--wood-lo));
  border-top: 1px solid var(--wood-edge); box-shadow: 0 6px 10px var(--shadow-book);
}
.tray-empty { font-size: 14px; color: var(--muted); align-self: center; padding: 8px 2px; }
.tray-book {
  position: relative; flex-shrink: 0; width: 58px; height: 84px; padding: 0; border: none; border-radius: 3px; overflow: hidden;
  background: var(--track-bg); box-shadow: 0 4px 10px var(--shadow-book); cursor: grab;
  touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.tray-book img, .drag-ghost img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tray-book img, .sort-book img, .sort-book .leather-title, .sort-book .leather-author, .drag-ghost img { pointer-events: none; }
.mini-leather {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 4px; box-sizing: border-box;
  font-size: 9px; line-height: 1.15; text-align: center; color: var(--leather-title); overflow: hidden; pointer-events: none;
}
/* Das Regal: Bücher groß wie auf der Startseite, zeilenweise auf Brettern (das Brett ist ein Hintergrundmuster je Zeile) */
.sort-stage-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 2px; }
.shelf.sort-stage {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 26px 13px; margin-top: 0;
  min-height: 176px; padding: 0 2px; border-radius: 6px; transition: box-shadow 0.15s;
  background: repeating-linear-gradient(180deg,
    transparent 0 164px, var(--wood-edge) 164px 165px, var(--wood-hi) 165px 168px, var(--wood-lo) 168px 176px,
    rgba(0, 0, 0, 0.35) 176px, transparent 184px 202px);
}
.sort-book {
  position: relative; width: 110px; height: 176px; flex-shrink: 0; display: flex; align-items: flex-end; padding: 0 0 12px 0;
  border: none; background: none; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.sort-cover { display: block; width: 100%; }
.sort-hint { align-self: center; width: 100%; text-align: center; padding-bottom: 20px; font-size: 14px; color: var(--faint); font-style: italic; }
/* Platznummer: die Reihenfolge im Regal */
.order-no {
  position: absolute; left: 2px; bottom: 2px; z-index: 1; min-width: 15px; height: 15px; padding: 0 3px; box-sizing: border-box;
  border-radius: 8px; background: rgba(0, 0, 0, 0.62); color: var(--parch); font-family: var(--font-display);
  font-size: 9px; line-height: 15px; text-align: center; pointer-events: none;
}
.sort-book .order-no { left: 11px; bottom: 17px; min-width: 18px; height: 18px; border-radius: 9px; font-size: 11px; line-height: 18px; }
/* Platzhalter: das gezogene Buch zeigt, wo es landen würde */
.dragging { opacity: 0.45; }
.tray-book.dragging { outline: 2px solid var(--gold); outline-offset: -2px; }
.sort-book.dragging .sort-cover { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 3px 8px 8px 3px; }
.dragging img, .dragging .mini-leather, .dragging .leather, .dragging .book-img { filter: grayscale(0.5); }
/* Ziel unter dem Zeiger */
.drop-over { box-shadow: 0 0 0 2px rgba(var(--gold-rgb), 0.35), 0 0 24px rgba(var(--gold-rgb), 0.35); }
.tray-books.drop-over { background: rgba(var(--gold-rgb), 0.08); }
/* Landung: ein ganz leichter goldener Schimmer am Rahmen, der sanft ausklingt */
.landed { animation: zone-landed 0.9s ease-out; }
@keyframes zone-landed {
  0% { box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.4), 0 0 14px rgba(var(--gold-rgb), 0.2); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.pop { animation: book-pop 0.3s ease-out; }
@keyframes book-pop {
  0% { transform: scale(0.88); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}
/* Der Geist: das gezogene Cover unter dem Zeiger */
.drag-ghost {
  position: fixed; z-index: 100; pointer-events: none; width: 76px; height: 108px; border-radius: 4px; overflow: hidden;
  background: var(--track-bg); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%) rotate(-4deg) scale(1.08);
}
.drag-ghost .mini-leather { font-size: 11px; }
/* Beim Ziehen leuchten die Ränder, hinter denen ein Nachbarregal wartet; dort verharren blättert um */
.sort-edge { position: fixed; top: 0; bottom: 0; width: 34px; z-index: 18; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.sort-edge.left { left: 0; background: linear-gradient(90deg, rgba(var(--gold-rgb), 0.45), transparent); }
.sort-edge.right { right: 0; background: linear-gradient(270deg, rgba(var(--gold-rgb), 0.45), transparent); }
.page.is-dragging .sort-edge.can { opacity: 0.55; }
.page.is-dragging .sort-edge.arm { opacity: 1; animation: edge-pulse 0.6s ease-in; }
@keyframes edge-pulse { from { opacity: 0.4; } to { opacity: 1; } }
.pager-btn.arm { color: var(--gold-bright); transform: scale(1.25); }
/* Ohne Navigation unten rückt die Blätterleiste tiefer */
.page-nonav .shelf-pager { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.page-nonav.has-pager { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
@media (prefers-reduced-motion: reduce) {
  .landed, .pop, .sort-edge.arm { animation: none; }
}
.pager-btn {
  width: 40px; height: 40px; border: none; border-radius: 20px; background: none; color: var(--icon);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pager-btn:disabled { opacity: 0.25; cursor: default; }
/* Höchstens drei Ringe auf einmal (3 × 20 px + 2 × 10 px Abstand + Innenabstand); bei mehr Regalen
   scrollt die Leiste zum gewählten Ring, die Ränder blenden weich aus */
.pager-dots { position: relative; display: flex; align-items: center; gap: 10px; padding: 0 4px; max-width: 88px; overflow-x: auto; scrollbar-width: none; }
.pager-dots::-webkit-scrollbar { display: none; }
.pager-dots.many {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 10px), transparent);
}
.pager-dot { position: relative; width: 20px; height: 20px; flex-shrink: 0; padding: 0; border: none; background: none; }
.pager-dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--dot, var(--gold));
}
/* Der Leuchtpunkt liegt über dem Ring des gewählten Regals; er gleitet beim Blättern und wandert beim Wischen mit */
.pager-thumb {
  position: absolute; left: 0; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold); pointer-events: none; will-change: transform;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.28s ease, box-shadow 0.28s ease;
}
@media (prefers-reduced-motion: reduce) { .pager-thumb { transition: none; } }
/* Blättern: das Regal schiebt sich in Wischrichtung hinaus, das nächste herein.
   Die Regalfläche reicht vom obersten Brett bis zur Leiste bzw. Navigation hinunter (die Seite ist eine
   Flex-Spalte in Bildschirmhöhe, das Regal füllt den Rest) – auf dieser ganzen Fläche wird gewischt:
   waagerecht blättert, senkrecht scrollt der Browser. Seitwärts scrollende Streifen wischen selbst. */
#shelf-page, #sort-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; box-sizing: border-box; }
#shelf-page > .shelf, .sort-stage-wrap { flex: 1 0 auto; }
.shelf, .sort-stage-wrap { touch-action: pan-y; }
.pager-dots, .tray-books { touch-action: pan-x pan-y; }
.shelf.slide-out-left { animation: shelf-out-left 0.22s ease-in forwards; }
.shelf.slide-out-right { animation: shelf-out-right 0.22s ease-in forwards; }
.shelf.slide-in-right { animation: shelf-in-right 0.28s ease-out; }
.shelf.slide-in-left { animation: shelf-in-left 0.28s ease-out; }
@keyframes shelf-out-left { to { transform: translateX(-14%); opacity: 0; } }
@keyframes shelf-out-right { to { transform: translateX(14%); opacity: 0; } }
@keyframes shelf-in-right { from { transform: translateX(14%); opacity: 0; } }
@keyframes shelf-in-left { from { transform: translateX(-14%); opacity: 0; } }
.shelf-pill { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.shelf-pill svg { opacity: 0.8; }
/* Regal-Verwaltung in den Einstellungen */
.shelf-item { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--parch-border); }
.shelf-item:first-child { border-top: none; padding-top: 0; }
.shelf-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.shelf-item-name { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-item-meta { font-size: 13px; color: var(--parch-muted); }
.iconbtn.small { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; }
/* Regal-Themes: Theme-Knopf am Regal, Auswahl-Kacheln im Dialog */
.theme-chip {
  align-self: flex-start; height: 28px; margin-top: 4px; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 9px 0 7px; border: 1px solid var(--parch-border); border-radius: 14px;
  background: var(--parch-field); color: var(--parch-ink); font-size: 13px;
}
.theme-chip svg { color: var(--parch-muted); }
.theme-dot { width: 12px; height: 12px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.25); flex-shrink: 0; }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-tile {
  position: relative; padding: 0; border: 2px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--bg2); color: var(--text); text-align: left;
  display: flex; flex-direction: column; align-items: stretch;
}
.theme-tile.selected { border-color: var(--gold-bright); }
.theme-tile-preview { height: 62px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.theme-tile-sample { font-size: 24px; font-weight: 700; line-height: 1; }
.theme-tile-text { padding: 7px 10px 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.theme-tile-name { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.theme-tile-tag { font-size: 12px; line-height: 1.3; color: var(--muted); }
.theme-tile-check {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 10px;
  background: var(--gold-bright); color: var(--on-gold); display: flex; align-items: center; justify-content: center;
}
.parchment .iconbtn { border-color: var(--parch-border); color: var(--oxblood); background: var(--parch-field); }

/* ---------- Genres ---------- */
/* Leise Zeile unter den Status-Chips: kleiner Genre-Knopf links, Gruppier-Schalter rechts. */
.genre-row { display: flex; align-items: center; gap: 2px; margin: -6px 0 12px 0; min-height: 28px; }
.genre-row .grow { flex: 1; }
.genre-trigger, .genre-toggle, .genre-clear {
  height: 28px; display: inline-flex; align-items: center; gap: 5px; padding: 0 10px;
  border-radius: 14px; border: 1px solid transparent; background: none;
  color: var(--muted); font-size: 13px; letter-spacing: 0.2px; white-space: nowrap;
}
.genre-trigger { min-width: 0; max-width: 62%; }
.genre-trigger-label { overflow: hidden; text-overflow: ellipsis; }
.genre-trigger svg, .genre-toggle svg { flex-shrink: 0; opacity: 0.75; }
.genre-trigger:hover, .genre-toggle:hover { color: var(--text); }
.genre-trigger.active, .genre-toggle.active {
  color: var(--gold-bright); border-color: var(--gold-dark); background: var(--surface-btn); font-weight: 600;
}
[data-theme="light"] .genre-trigger.active, [data-theme="light"] .genre-toggle.active { color: var(--oxblood); border-color: var(--oxblood); }
.genre-clear { width: 28px; padding: 0; justify-content: center; }
.genre-clear:hover { color: var(--danger); }
.genre-menu { gap: 7px; }
.genre-menu .chip { height: 32px; padding: 0 13px; font-size: 14px; }

.genre-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label-hint { text-transform: none; letter-spacing: 0; }
.genre-suggest { padding: 2px 4px; font-size: 13px; color: var(--oxblood); }
.genre-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.parchment .genre-picker .chip {
  height: 30px; padding: 0 11px; font-size: 13px; gap: 5px;
  border-color: var(--parch-border); color: var(--parch-ink); background: var(--parch-field);
}
.parchment .genre-picker .chip.active { background: var(--oxblood); border-color: var(--oxblood); color: #F6EFD9; }
.genre-pos {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; font-size: 11px; font-weight: 700;
  background: #F6EFD9; color: var(--oxblood);
}

.genre-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.genre-pill {
  border: 1px solid var(--gold-dark); border-radius: 12px; padding: 2px 10px;
  font-size: 12.5px; color: var(--count); text-decoration: none; background: var(--surface-btn);
}
.genre-pills .genre-pill:first-child { border-color: var(--gold); font-weight: 600; }

/* Genre-Bretter: jedes steht in seiner Welt (Hintergrund aus eigenen Covern/Karten). */
.genre-group {
  position: relative; isolation: isolate; margin: 0 -10px; padding: 10px 10px 18px 10px;
  border-radius: 14px; overflow: hidden;
}
.genre-group + .genre-group { margin-top: 8px; }
.genre-group.world::before {
  content: ""; position: absolute; inset: -20px; z-index: -1;
  background: var(--world-img) center / cover no-repeat;
  filter: blur(8px) saturate(1.1);
}
.genre-group.world::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--world-veil-mid) 0%, var(--world-veil-bottom) 100%);
}
.genre-heading {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px 0;
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; color: var(--accent-label);
}
.genre-heading::after { content: ""; flex: 1; height: 1px; background: var(--border); align-self: center; }
.genre-count { font-family: var(--font-body); font-size: 14px; letter-spacing: 0; color: var(--muted); }

.genre-bars { display: flex; flex-direction: column; gap: 2px; }
.genre-bar-row {
  display: grid; grid-template-columns: minmax(0, 9.5em) 1fr 2em; align-items: center; gap: 10px;
  padding: 6px 4px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 15px;
}
.genre-bar-row:hover, .genre-bar-row:focus-visible { background: var(--surface-btn); }
.gb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-track { height: 8px; }
.gb-bar { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--gold); }
[data-theme="light"] .gb-bar { background: var(--oxblood); }
.gb-count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.searchrow { margin: 2px 0 12px 0; }
.searchrow input { width: 100%; }

/* ---------- Felder ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.input, input.input, select.input, textarea.input {
  height: 42px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--field-border); background: var(--field-bg); color: var(--text);
  width: 100%;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.formgrid .span2 { grid-column: span 2; }

/* Pergament-Karten: Felder dunkel auf hell */
.parchment {
  background: var(--parch); color: var(--parch-ink);
  border-radius: 10px; box-shadow: 0 4px 12px var(--shadow-book);
  padding: 14px 16px;
}
.parchment .eyebrow { color: var(--oxblood); }
.parchment .field label { color: var(--parch-muted); }
.parchment .input, .parchment input.input, .parchment select.input, .parchment textarea.input {
  background: var(--parch-field); border-color: var(--parch-border); color: var(--parch-ink);
}
.parchment .hint { color: var(--parch-muted); }

/* ---------- Knöpfe ---------- */
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 24px; border-radius: 23px;
  border: 1px solid var(--gold-bright); color: var(--on-gold);
  background: linear-gradient(145deg, var(--gold-bright), var(--gold-dark));
  font-size: 17px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(var(--gold-rgb),0.35);
}
.btn-gold.big { width: 100%; height: 52px; border-radius: 26px; font-size: 19px; }
/* Runder Haken in der Kopfzeile (Einräumen): grau und leer, solange nichts zu speichern ist –
   golden wie die Speichern-Knöpfe, sobald sich etwas geändert hat */
.btn-done {
  width: 42px; height: 42px; padding: 0; border-radius: 21px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-soft); background: none; color: var(--faint);
  transition: background 0.25s, color 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.btn-done svg { display: block; }
.btn-done.dirty {
  border-color: var(--gold-bright); color: var(--on-gold);
  background: linear-gradient(145deg, var(--gold-bright), var(--gold-dark));
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), 0 0 16px rgba(var(--gold-rgb), 0.45);
  animation: done-pulse 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes done-pulse { 0% { transform: scale(0.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (max-width: 480px) { .topbar-actions .btn-done { width: 40px; height: 40px; } }
@media (prefers-reduced-motion: reduce) { .btn-done.dirty { animation: none; } }
.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 19px;
  border: 1px solid var(--border-soft); background: none; color: var(--gold);
  font-size: 14px;
}
.parchment .btn-outline { color: var(--oxblood); border-color: var(--parch-border); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-plain { border: none; background: none; color: var(--gold); font-size: 14px; padding: 6px 8px; }

.segmented { display: inline-flex; border: 1px solid var(--border-soft); border-radius: 19px; overflow: hidden; }
.parchment .segmented { border-color: var(--parch-border); }
.segmented button { height: 36px; padding: 0 16px; border: none; background: none; color: var(--chip-fg); font-size: 14px; }
.parchment .segmented button { color: var(--parch-muted); }
.segmented button.active { background: var(--oxblood); color: #F6EFD9; font-weight: 700; }

/* ---------- Regal ---------- */
.shelf { display: flex; flex-direction: column; gap: 26px; margin-top: 6px; }
.shelf-row-wrap { display: flex; flex-direction: column; }
.shelf-row { display: flex; gap: 13px; align-items: flex-end; padding: 0 2px; }
.shelf-board {
  height: 12px; border-radius: 2px;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood-lo));
  border-top: 1px solid var(--wood-edge);
  box-shadow: 0 6px 10px var(--shadow-book);
}
.book { position: relative; width: 110px; flex-shrink: 0; display: block; text-decoration: none; }
/* Cover liegt wie ein Schild auf dem Ledereinband – der Rand bleibt sichtbar. */
.book-img {
  position: relative; width: 100%; height: 100%; box-sizing: border-box;
  border-radius: 3px 8px 8px 3px; padding: 5px 5px 5px 8px;
  box-shadow: inset 5px 0 8px -4px rgba(0, 0, 0, 0.6), inset 0 0 18px rgba(0, 0, 0, 0.3), 0 4px 10px var(--shadow-book);
}
.book-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 1px 3px 3px 1px;
  box-shadow: 0 0 0 1px rgba(var(--gold-rgb),0.6), 0 1px 4px rgba(0, 0, 0, 0.55);
}
.leather {
  width: 100%; height: 100%;
  border-radius: 3px 8px 8px 3px; padding: 7px;
  box-shadow: inset 5px 0 8px -4px rgba(0, 0, 0, 0.6), inset 0 0 18px rgba(0, 0, 0, 0.3), 0 4px 10px var(--shadow-book);
}
.leather-frame {
  height: 100%; border: 1px solid rgba(var(--gold-rgb),0.55); border-radius: 2px 5px 5px 2px;
  display: flex; flex-direction: column; justify-content: space-between; padding: 12px 8px;
  overflow: hidden;
}
.leather-title { font-size: 15px; font-weight: 600; line-height: 1.25; color: var(--leather-title); overflow-wrap: break-word; }
.leather-author { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(236, 224, 192, 0.75); }
.book-badge {
  position: absolute; left: 8px; bottom: -12px; z-index: 1;
  background: var(--parch); color: var(--oxblood); border: 1px solid var(--gold);
  border-radius: 10px; font-size: 11px; font-weight: 700; padding: 3px 10px;
  box-shadow: 0 2px 6px var(--shadow-book); white-space: nowrap;
}
[data-theme="light"] .book-badge { background: var(--oxblood); color: #F6EFD9; }

.empty-shelf { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 17px; }
.empty-shelf .big { font-size: 40px; color: var(--gold); margin-bottom: 10px; }

/* ---------- Untere Navigation ---------- */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  /* eigene Compositing-Ebene: sonst flackert die Leiste, während das darunter liegende Regal
     beim Blättern animiert wird (die Regalfläche reicht bis unter die Leiste) */
  will-change: transform;
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  padding: 0 8px env(safe-area-inset-bottom, 0px) 8px;
  background: linear-gradient(180deg, var(--nav-hi), var(--nav-lo));
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch; justify-content: space-around;
}
/* Sechs Einträge plus der goldene Knopf: die Einträge teilen sich die Breite */
.navbar a, .navbar button {
  flex: 1 1 0; min-width: 0; max-width: 72px; padding: 0; border: none; background: none; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--nav-idle);
}
.navbar .active { color: var(--nav-active); }
.navbar .navlabel { font-family: var(--font-display); font-size: 9px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; }
.fab { margin-top: -20px; flex: 0 0 56px; width: 56px !important; }
@media (max-width: 480px) {
  .navbar { padding-left: 2px; padding-right: 2px; }
  .navbar .navlabel { font-size: 7.5px; letter-spacing: 0.3px; }
}
.fab span {
  width: 54px; height: 54px; border-radius: 27px;
  background: linear-gradient(145deg, var(--gold-bright), var(--gold-dark));
  border: 1px solid var(--gold-bright); box-shadow: 0 4px 14px rgba(var(--gold-rgb),0.45);
  display: flex; align-items: center; justify-content: center; color: var(--on-gold);
}

/* ---------- Login ---------- */
.login-wrap { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 24px 16px; }
.login-wordmark { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ghost-logo { width: 72px; height: 98px; margin-bottom: 4px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }
.login-wordmark h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 30px; letter-spacing: 4px; color: var(--wordmark); }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.form-error { color: var(--danger); font-size: 15px; min-height: 1.2em; }

/* ---------- Detailseite ---------- */
.hero { display: flex; gap: 16px; margin-bottom: 16px; }
.hero .book { width: 116px; height: 174px; flex-shrink: 0; }
.hero-info { display: flex; flex-direction: column; gap: 7px; min-width: 0; justify-content: center; }
.hero-title { font-size: 22px; font-weight: 600; line-height: 1.2; margin: 0; }
.hero-author { font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent-label); }
.hero-meta { font-size: 14px; color: var(--muted); }
.series-pill { align-self: flex-start; border: 1px solid var(--border-soft); border-radius: 12px; padding: 4px 11px; font-size: 13px; color: var(--muted); }
.stars { display: flex; gap: 2px; }
.stars button { border: none; background: none; padding: 2px; color: var(--border-soft); display: flex; }
.stars button.on { color: var(--gold-bright); }
[data-theme="light"] .stars button.on { color: var(--gold-dark); }

.status-row { display: flex; gap: 7px; margin-bottom: 6px; }
.status-row button {
  flex: 1; height: 36px; border-radius: 18px; border: 1px solid var(--border);
  background: none; color: var(--faint); font-size: 13px; padding: 0 4px;
}
.status-row button.active { background: var(--chip-active-bg); color: var(--chip-active-fg); border-color: var(--chip-active-bg); font-weight: 700; }
.status-dates { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 14px; }

.section { margin: 18px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; font-size: 15px; }
.kv-grid .k { display: block; color: var(--parch-muted); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; }

.lend-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; color: var(--muted);
}
.lend-row b { color: var(--text); }
.lend-row .grow { flex-grow: 1; }

.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 14px 2px; }
.gallery-item { position: relative; flex-shrink: 0; width: 92px; }
.gallery-item .thumb {
  width: 92px; height: 126px; object-fit: cover; display: block;
  border-radius: 6px; border: 1px solid var(--border);
  background: var(--track-bg); cursor: pointer;
}
.gallery-item .gname { font-size: 12px; color: var(--muted); margin-top: 3px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Lösch-Kreuz sitzt innerhalb der Kachel – die Galerie scrollt seitlich und würde
   alles abschneiden, was über den Rand ragt. Das Kreuz ist ein Icon, kein Textzeichen,
   damit es exakt in der Mitte des Kreises steht. */
.gallery-item .gx {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 12px;
  padding: 0; margin: 0; box-sizing: border-box;
  border: 1px solid var(--border-soft); background: var(--modal-bg); color: var(--danger);
  display: flex; align-items: center; justify-content: center; line-height: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.gallery-item .gx svg { display: block; }
/* Markierung des aktuellen Hauptcovers; gewählt wird in der Großansicht */
.gallery-item .gbadge {
  position: absolute; left: 5px; top: 103px; display: inline-flex; align-items: center; gap: 3px;
  border-radius: 9px; border: 1px solid var(--gold); background: rgba(0, 0, 0, 0.6);
  color: var(--gold-bright); font-size: 10px; font-weight: 700; letter-spacing: 0.5px; padding: 2px 7px 2px 5px;
  pointer-events: none;
}
.gallery-item .gbadge svg { width: 11px; height: 11px; }
.gallery-add {
  flex-shrink: 0; width: 92px; height: 126px; border: 1px dashed var(--border-soft); border-radius: 6px;
  background: none; color: var(--faint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px;
}

/* ---------- Admin ---------- */
.user-card { margin-bottom: 12px; }
.user-card .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.user-card .uname { font-size: 18px; font-weight: 700; }
.user-card .umeta { font-size: 13px; color: var(--parch-muted); }
.user-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.role-chip { border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 2px 8px; background: var(--oxblood); color: #F6EFD9; }
.role-chip.user { background: var(--parch-deep); color: var(--parch-ink); }
.inactive-note { color: var(--danger); font-weight: 700; }

/* ---------- Modale, Toasts, Scan ---------- */
#modal-root:empty { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 3, 0.65);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto;
  background: var(--modal-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.modal h3 { margin: 0; font-family: var(--font-display); font-size: 15px; letter-spacing: 1.5px; color: var(--accent-label); text-transform: uppercase; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-img { max-width: 92vw; max-height: 86vh; border-radius: 8px; }
/* Großansicht mit Aktionen unter dem Bild – immer auf dunklem Grund, egal welches Theme */
.viewer-box { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 92vw; }
.viewer-box .modal-img { max-height: 70vh; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6); }
.viewer-caption { font-size: 14px; color: #F6EFD9; opacity: 0.85; text-align: center; }
.viewer-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.viewer-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid rgba(246, 239, 217, 0.45); background: rgba(246, 239, 217, 0.08); color: #F6EFD9;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.viewer-btn.primary { border-color: var(--gold); background: var(--gold); color: var(--on-gold); }
.viewer-btn.current { border-color: var(--gold); color: var(--gold-bright); background: rgba(0, 0, 0, 0.35); cursor: default; }
.viewer-btn.current:disabled { opacity: 1; }
.viewer-btn.danger { color: #F2A7A0; border-color: rgba(242, 167, 160, 0.5); }
.viewer-btn svg { flex-shrink: 0; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 2px 0 10px 0; }
.menu-grid .btn-outline { padding: 0 10px; gap: 4px; font-size: 13px; }
.menu-grid .btn-outline:disabled { opacity: 0.4; }
.menu-grid svg { width: 16px; height: 16px; flex-shrink: 0; }
.menu-list { display: flex; flex-direction: column; gap: 4px; }
.menu-list button {
  display: flex; align-items: center; gap: 12px; border: none; background: none;
  color: var(--text); font-size: 17px; padding: 12px 8px; border-radius: 8px; text-align: left;
}
.menu-list button:hover { background: var(--surface-btn); }
.menu-list svg { color: var(--icon); flex-shrink: 0; }

#scan-video { width: 100%; border-radius: 10px; background: #000; }
#scan-fallback { width: 100%; }

#toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
  width: max-content; max-width: 92vw;
}
.toast {
  background: var(--modal-bg); color: var(--text); border: 1px solid var(--gold-dark);
  border-radius: 20px; padding: 9px 18px; font-size: 15px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.toast.error { border-color: var(--danger); color: var(--danger); }

.cover-picker { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px; }
.cover-picker button { flex-shrink: 0; border: 2px solid transparent; border-radius: 8px; background: none; padding: 2px; }
.cover-picker button.selected { border-color: var(--gold); }
.cover-picker img { width: 84px; height: 120px; object-fit: cover; border-radius: 6px; display: block; }

/* ---------- Reihen: mehrere je Brett, eine Reihe nie geteilt (gepackt in app.js) ---------- */
.series-flow, .series-row { display: flex; gap: 20px 34px; align-items: flex-end; padding: 0 2px; }
.series-flow { flex-wrap: wrap; }
.series-shelf { margin-bottom: 28px; }
.skeleton .series-card { margin-bottom: 26px; }
.series-card { flex: 0 0 auto; max-width: 100%; min-width: 150px; display: flex; flex-direction: column; }
/* Kopf, Zählung und Notiz richten sich nach der Breite der Bände, nicht umgekehrt */
.series-head, .series-meta, .series-notes { width: 0; min-width: 100%; box-sizing: border-box; }
.series-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.series-name {
  font-size: 20px; font-weight: 600; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.series-head .btn-plain { color: var(--icon); flex-shrink: 0; }
.series-meta { font-size: 14px; color: var(--muted); margin: 2px 0 8px 0; }
.series-next { color: var(--count); font-weight: 700; }
.series-notes { font-size: 14px; color: var(--faint); margin: -4px 0 8px 0; font-style: italic; }
.bands { display: flex; gap: 7px; align-items: flex-end; overflow-x: auto; padding: 4px 2px 0 2px; }
.band {
  position: relative; flex-shrink: 0; width: 38px; height: 96px;
  border-radius: 3px; border: none; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
}
.band.owned { color: var(--leather-title); box-shadow: 0 3px 8px var(--shadow-book); }
.band.owned::before, .band.owned::after {
  content: ""; position: absolute; left: 4px; right: 4px; height: 2px;
  background: rgba(var(--gold-rgb),0.55);
}
.band.owned::before { top: 10px; }
.band.owned::after { bottom: 10px; }
.band.missing, .band.wished {
  background: none; border: 1.5px dashed var(--border-soft); color: var(--faint);
  cursor: pointer;
}
.band.wished { border-style: solid; color: var(--gold); }
/* Geisterband: fehlender Band, ausgegraut, mit einem Nebelschleier, der langsam hindurchzieht */
.band.missing {
  overflow: hidden; opacity: 0.7;
  background: linear-gradient(180deg, rgba(227, 200, 120, 0.05), rgba(227, 200, 120, 0.01));
}
.band.missing::after {
  content: ""; position: absolute; left: -30%; right: -30%; top: -70%; height: 65%;
  background: radial-gradient(ellipse at center, rgba(227, 200, 120, 0.35), rgba(227, 200, 120, 0) 70%);
  filter: blur(3px); pointer-events: none; opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .band.missing { animation: band-breathe 7s ease-in-out infinite; animation-delay: var(--mist-delay, 0s); }
  .band.missing::after { animation: band-mist 7s ease-in-out infinite; animation-delay: var(--mist-delay, 0s); }
  @keyframes band-breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.9; } }
  @keyframes band-mist {
    0% { transform: translateY(0); opacity: 0; }
    25% { opacity: 1; }
    75% { opacity: 1; }
    100% { transform: translateY(270%); opacity: 0; }
  }
}
/* Band-Dialog auf der Reihen-Seite */
.vol-card { display: flex; gap: 14px; align-items: flex-start; }
.vol-cover {
  width: 96px; height: 136px; object-fit: cover; flex-shrink: 0; border-radius: 6px;
  border: 1px solid var(--border); background: var(--track-bg); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.vol-cover.placeholder {
  display: flex; align-items: center; justify-content: center; color: var(--faint);
  font-family: var(--font-display); font-size: 28px;
}
.vol-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.vol-title { font-weight: 700; font-size: 17px; line-height: 1.25; }
.vol-meta { color: var(--muted); font-size: 14px; }
.vol-meta.wished-note { color: var(--gold); display: inline-flex; align-items: center; gap: 5px; }
.vol-none { color: var(--muted); font-size: 14px; line-height: 1.45; }

/* ---------- Wunschliste ---------- */
.wish-card { margin-bottom: 14px; }
.wish-title { font-size: 18px; font-weight: 700; }
.wish-author { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--oxblood); margin-top: 2px; }
.wish-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; font-size: 14px; color: var(--parch-muted); }
.wish-meta .series-pill { border-color: var(--parch-border); color: var(--parch-muted); }
.wish-notes { font-size: 14px; color: var(--parch-muted); font-style: italic; margin-top: 6px; }
.wish-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Install-Hinweis ---------- */
.install-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 10px 14px; margin: 2px 0 12px 0;
  font-size: 14px; color: var(--muted);
}

/* ---------- Freunde & Einstellungen ---------- */
.friend-card {
  display: block; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px;
}
.friend-card:not(.private):hover { border-color: var(--gold-dark); }
.friend-card.private { opacity: 0.7; }
.friend-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.friend-name { font-size: 20px; font-weight: 600; }
.friend-covers { display: flex; gap: 8px; overflow: hidden; }
.friend-covers img {
  width: 52px; height: 76px; object-fit: cover; border-radius: 3px;
  box-shadow: 0 2px 6px var(--shadow-book);
}
.tabs { display: flex; gap: 6px; margin: 4px 0 16px 0; overflow-x: auto; }
.tabs button {
  height: 36px; padding: 0 16px; border-radius: 18px; flex-shrink: 0;
  border: 1px solid var(--border-soft); background: none; color: var(--chip-fg); font-size: 14px;
}
.tabs button.active { background: var(--chip-active-bg); color: var(--chip-active-fg); border-color: var(--chip-active-bg); font-weight: 700; }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow input { font-size: 13px; color: var(--muted); }

/* ---------- Rückblick ---------- */
.chart-months {
  display: flex; align-items: flex-end; gap: 6px;
  height: 150px; padding: 22px 2px 0 2px;
  border-bottom: 1px solid var(--border);
}
.cm-col {
  flex: 1; min-width: 0; height: 100%; border: none; background: none; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0;
  position: relative; color: var(--text);
}
.cm-bar {
  width: 100%; max-width: 26px; border-radius: 4px 4px 0 0;
  background: var(--gold);
}
[data-theme="light"] .cm-bar { background: var(--gold-dark); }
.cm-col:hover .cm-bar, .cm-col:focus-visible .cm-bar { background: var(--gold-bright); }
[data-theme="light"] .cm-col:hover .cm-bar, [data-theme="light"] .cm-col:focus-visible .cm-bar { background: var(--oxblood); }
.cm-label { font-size: 10px; color: var(--faint); margin-top: 4px; }
.cm-value {
  position: absolute; top: -20px; font-size: 12px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cm-col:hover::after, .cm-col:focus-visible::after {
  content: attr(aria-label); position: absolute; bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%); white-space: nowrap; z-index: 5;
  background: var(--modal-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; color: var(--text); pointer-events: none;
}

.stat-list { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.stat-list .k {
  display: block; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--faint); margin-bottom: 1px;
}
.stat-list b { color: var(--count); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; text-align: center; }
.stat-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-grid b {
  font-size: 20px; font-variant-numeric: tabular-nums; color: var(--oxblood);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat-grid span { font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--parch-muted); }
.top-stores { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--parch-border); font-size: 15px; display: flex; flex-direction: column; gap: 4px; }
.top-stores span { color: var(--parch-muted); font-size: 13px; }

/* ---------- Zitate ---------- */
.quote-row { display: flex; gap: 10px; margin: 14px 0; }
.quote-mark { font-family: Georgia, serif; font-size: 40px; line-height: 0.9; color: var(--gold); flex-shrink: 0; }
.quote-body { min-width: 0; flex-grow: 1; }
.quote-text { font-size: 16px; font-style: italic; line-height: 1.5; }
.quote-meta { font-size: 13px; color: var(--faint); margin-top: 4px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.quote-actions { display: flex; gap: 2px; }
.quote-actions button { border: none; background: none; color: var(--faint); padding: 2px 7px; font-size: 16px; line-height: 1; display: flex; align-items: center; }
.zitate-group { margin-bottom: 26px; }
.zitate-book { font-size: 19px; font-weight: 600; }
.zitate-book a { color: var(--text); text-decoration: none; }
.zitate-book a:hover { color: var(--gold-bright); }
.zitate-author { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent-label); margin-top: 1px; }

.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.muted { color: var(--muted); }

/* Hinweis zur Reihe aus dem ISBN-Lookup */
.series-note { font-size: 13px; line-height: 1.4; color: var(--parch-muted); margin-top: -4px; }
.series-note b { color: var(--parch-ink); font-weight: 600; }
.series-vols { display: block; margin-top: 3px; font-size: 12.5px; }

/* ---------- Bon: fotografieren, lesen, mit dem Buch abgleichen ---------- */
.receipt-pick { display: flex; flex-direction: column; gap: 10px; }
.receipt-pick .btn-gold, .receipt-pick .btn-outline { width: 100%; height: 44px; }
.receipt-note { font-size: 13px; text-align: center; line-height: 1.4; }
.receipt-review { display: flex; gap: 12px; align-items: flex-start; }
.receipt-preview {
  width: 84px; height: 112px; object-fit: cover; flex-shrink: 0;
  border-radius: 6px; border: 1px solid var(--border); background: var(--track-bg);
}
.receipt-rows { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; font-size: 14px; line-height: 1.35; }
.rc { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
.rc.ok { border-color: rgba(var(--gold-rgb),0.6); }
.rc.error { border-color: var(--danger); color: var(--danger); background: rgba(194, 91, 78, 0.08); font-weight: 600; }
.rc.warn { border-color: var(--gold-dark); color: var(--gold-bright); }
[data-theme="light"] .rc.warn { color: var(--gold-dark); }
.rc.info, .rc.unknown { color: var(--muted); border-style: dashed; }
.rc-take { display: flex; gap: 8px; align-items: flex-start; padding: 2px 0; cursor: pointer; }
.rc-take input { accent-color: var(--gold); margin: 3px 0 0 0; flex-shrink: 0; }
.rc-take .was { color: var(--muted); font-size: 12.5px; }

/* ---------- Zufallsbuch: Walze aus Covern ---------- */
.lottery { display: flex; flex-direction: column; gap: 12px; }
.reel-stage { position: relative; }
.reel-window {
  position: relative; width: 150px; height: 240px; margin: 0 auto; overflow: hidden; border-radius: 12px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 78%, transparent 100%);
}
.reel-strip { will-change: transform; }
.reel-strip.spinning { animation: reel-blur 3.8s ease-out forwards; }
@keyframes reel-blur {
  0% { filter: blur(0); } 12% { filter: blur(5px); } 70% { filter: blur(1.5px); } 100% { filter: blur(0); }
}
.reel-tile { height: 156px; margin-bottom: 14px; display: flex; justify-content: center; }
.reel-tile .book { transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
.reel-tile.won .book { transform: scale(1.1); }
.reel-tile.won .book-img, .reel-tile.won .leather {
  box-shadow: 0 0 0 2px var(--gold-bright), 0 0 30px rgba(var(--gold-rgb), 0.8), 0 4px 10px var(--shadow-book);
}
.reel-frame {
  position: absolute; left: 50%; top: 50%; width: 132px; height: 178px; transform: translate(-50%, -50%);
  border: 1px solid rgba(var(--gold-rgb),0.5); border-radius: 8px; pointer-events: none;
  transition: opacity 0.4s;
}
.reel-window.won .reel-frame { opacity: 0; }
.reel-sparks { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.spark {
  position: absolute; left: 0; top: 0; color: var(--gold-bright); font-size: 18px; line-height: 1;
  animation: spark-fly 1s ease-out var(--delay) both;
}
[data-theme="light"] .spark { color: var(--gold-dark); }
@keyframes spark-fly {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateX(12px) scale(0.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateX(var(--d)) scale(1.2); }
}
.lottery-text { text-align: center; min-height: 68px; }
.lottery-text > * { animation: rise-in 0.5s ease-out both; }
.lottery-hint { color: var(--muted); font-size: 14px; animation: hint-pulse 1.3s ease-in-out infinite alternate !important; }
@keyframes hint-pulse { from { opacity: 0.45; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lottery-title { font-size: 21px; font-weight: 600; line-height: 1.25; margin-top: 4px; animation-delay: 0.1s; }
.lottery-author { color: var(--muted); font-size: 15px; font-style: italic; animation-delay: 0.2s; }
.lottery-actions { justify-content: center; }
.lottery-actions .btn-outline { text-decoration: none; }
.lottery-actions .btn-gold { height: 38px; padding: 0 18px; font-size: 15px; border-radius: 19px; text-decoration: none; }
@media (prefers-reduced-motion: reduce) {
  .reel-strip.spinning, .spark, .lottery-text > * { animation: none !important; }
  .reel-tile .book { transition: none; }
}

.spinner { text-align: center; color: var(--faint); padding: 40px 0; font-size: 16px; }

/* ---------- Ladezustände: Fortschrittsbalken, Skelette, beschäftigte Knöpfe ---------- */
:root { --sk-bg: rgba(227, 200, 120, 0.11); }
[data-theme="light"] { --sk-bg: rgba(90, 60, 25, 0.13); }

/* Dünner Goldstreifen am oberen Rand, solange eine Anfrage läuft */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; pointer-events: none; opacity: 0; transition: opacity 0.2s; overflow: hidden; }
.progress.on { opacity: 1; }
.progress-bar {
  height: 100%; width: 35%; border-radius: 0 2px 2px 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--gold-bright), var(--gold));
  box-shadow: 0 0 8px rgba(227, 200, 120, 0.6);
}
.progress.on .progress-bar { animation: progress-slide 1.2s ease-in-out infinite; }
@keyframes progress-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* Skelette bilden das Layout nach, das gleich erscheint, und atmen leicht */
.sk { display: block; background: var(--sk-bg); border-radius: 6px; flex-shrink: 0; }
.sk-line { height: 14px; width: 100%; }
.sk-title { height: 22px; }
.sk-icon { width: 42px; height: 42px; border-radius: 10px; }
.sk-chip { height: 30px; width: 84px; border-radius: 15px; }
.sk-book { width: 110px; border-radius: 3px 8px 8px 3px; }
.sk-cover { width: 116px; height: 174px; border-radius: 3px 8px 8px 3px; }
.sk-thumb { width: 92px; height: 126px; }
.sk-band { width: 38px; height: 96px; border-radius: 3px; }
.sk-mini { width: 52px; height: 76px; border-radius: 3px; }
.sk-pick { width: 84px; height: 120px; margin: 2px; }
.sk-field { height: 44px; border-radius: 10px; margin-bottom: 14px; }
.sk-quote-mark { width: 22px; height: 36px; border-radius: 4px; }
.sk-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px; background: var(--surface-btn);
}
.sk-chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; margin-top: 10px; }
.sk-chart .sk-bar { flex: 1; border-radius: 3px 3px 0 0; }
.skeleton .chips, .skeleton .genre-row, .skeleton .tabs { display: flex; gap: 8px; }
.skeleton .hero-info { justify-content: center; flex-grow: 1; }
.skeleton .section .sk-line { margin-bottom: 10px; }
.skeleton .bands { margin-top: 12px; }
.skeleton .friend-covers { margin-top: 10px; }
/* Erst zeigen, wenn das Laden spürbar dauert – sonst blitzen die Rahmen nur kurz auf */
.skeleton { animation: sk-appear 0.01s linear 0.3s both; }
@keyframes sk-appear { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: sk-appear 0.25s ease 0.3s both, sk-pulse 1.8s ease-in-out 0.55s infinite; }
  @keyframes sk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
}
#shelf.loading { opacity: 0.55; transition: opacity 0.2s; }
/* Bilder: bis sie geladen sind, steht ein ruhiger Block an ihrer Stelle */
.book-img img, .gallery-item .thumb, .friend-covers img, .vol-cover, .cover-picker img { background-color: var(--sk-bg); }

/* Kleiner Ring in beschäftigten Knöpfen und Hinweiszeilen */
.btn-spin {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid currentColor; border-right-color: transparent; vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.inline-spin { display: inline-flex; align-items: center; gap: 8px; }
button.is-busy { opacity: 0.85; cursor: progress; }
button.is-busy .btn-spin + * { margin-left: 0; }
.btn-plain .btn-spin, .genre-suggest .btn-spin { margin-right: 6px; }
@media (prefers-reduced-motion: reduce) {
  .btn-spin { animation: none; border-right-color: currentColor; opacity: 0.6; }
  .progress.on .progress-bar { animation: none; transform: none; width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 0.25s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .modal { animation: modal-in 0.18s ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
}
@media (min-width: 700px) {
  .shelf-row { gap: 16px; }
}

/* ---------- KI: Verwaltungskarte ---------- */
.ai-keyrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.ai-keyhint { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; color: var(--parch-ink); }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
/* Statuszeilen auf Pergament lesbar */
.parchment .rc { border-color: var(--parch-border); }
.parchment .rc.warn { color: var(--gold-dark); }
.parchment .rc.info, .parchment .rc.unknown { color: var(--parch-muted); }
.parchment .rc a, #text-note .rc a { color: var(--oxblood); }

/* ---------- E-Book & Text, Buch-Bibel ---------- */
.text-stats { font-size: 13px; color: var(--muted); }
.text-intro { font-size: 14px; margin: 0 0 8px 0; }
.text-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.text-actions .text-gold { height: 40px; font-size: 15px; padding: 0 18px; }
.text-hint { font-size: 13px; line-height: 1.4; margin-top: 4px; }
#text-note:not(:empty) { margin-bottom: 8px; font-size: 14px; }
.job-row { display: flex; flex-direction: column; gap: 6px; }
.job-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.job-step { font-size: 13px; min-height: 1.2em; }
.bible-meta { font-size: 12px; color: var(--parch-muted); }
.bible-note { font-size: 12px; margin-top: 4px; }
.bible-text { margin: 6px 0; font-size: 14px; line-height: 1.5; }
.bible-part { border-top: 1px dashed var(--parch-border); padding: 8px 0; }
.bible-part > summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.bible-part > summary::-webkit-details-marker { display: none; }
.bible-part > summary::before {
  content: ""; width: 7px; height: 7px; flex-shrink: 0; margin-left: 2px;
  border-right: 2px solid var(--oxblood); border-bottom: 2px solid var(--oxblood);
  transform: rotate(-45deg); transition: transform 0.15s;
}
.bible-part[open] > summary::before { transform: rotate(45deg); }
.bible-content { padding-top: 6px; }
.spoiler-tag {
  font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; font-weight: 600;
  color: var(--parch-muted); border: 1px solid var(--parch-border); border-radius: 8px; padding: 1px 7px;
}
.parchment .bible-chips { margin: 4px 0 2px 0; }
.parchment .bible-chips .chip { color: var(--oxblood); border-color: var(--parch-border); background: none; height: 30px; font-size: 13px; padding: 0 12px; }
.parchment .bible-chips .chip.static { cursor: default; }
.bible-list { margin: 6px 0 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.bible-list.plain { list-style: none; padding-left: 0; }
.bible-list b { display: block; }
.bible-chapters { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.bible-chapter summary { cursor: pointer; font-size: 14px; }
.bible-chapter p { margin: 4px 0 6px 0; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .bible-part > summary::before { transition: none; } }
/* Seiten-Modal: Kacheln in Lesereihenfolge */
.pages-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pages-grid:empty { display: none; }
.pg { position: relative; width: 64px; }
.pg img { width: 64px; height: 88px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; background: var(--sk-bg); }
.pg .pg-no {
  position: absolute; left: 4px; bottom: 4px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: rgba(0, 0, 0, 0.6); color: var(--gold-bright); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.pg .gx {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0; border-radius: 11px;
  border: 1px solid var(--border-soft); background: var(--modal-bg); color: var(--danger);
  display: flex; align-items: center; justify-content: center; line-height: 0;
}
.pg .gx svg { display: block; width: 12px; height: 12px; }

/* ---------- Lesezimmer ---------- */
.lz-card {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-btn);
}
.lz-card:hover { border-color: var(--gold-dark); }
.lz-cover { width: 52px; height: 76px; object-fit: cover; border-radius: 3px; flex-shrink: 0; box-shadow: 0 2px 6px var(--shadow-book); background: var(--sk-bg); }
.lz-cover.placeholder { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 22px; color: var(--faint); }
.lz-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.lz-title { font-weight: 600; font-size: 16px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lz-author { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-label); }
.lz-status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lz-status .track { display: inline-block; width: 110px; vertical-align: middle; }
.lz-badge { border: 1px solid var(--gold); color: var(--gold-bright); border-radius: 9px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
[data-theme="light"] .lz-badge { color: var(--gold-dark); }
.lz-error { color: var(--danger); }
.lz-card > svg { color: var(--faint); flex-shrink: 0; }

/* ---------- Quiz ---------- */
.quiz-card .quiz-title { font-family: var(--font-display); font-size: 18px; letter-spacing: 0.5px; }
.quiz-duel-note { margin-top: 10px; font-size: 14px; }
.quiz-progress { margin: 4px 0 12px 0; display: flex; flex-direction: column; gap: 6px; }
.quiz-progress-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.quiz-q { margin-bottom: 12px; }
.quiz-question { font-size: 19px; line-height: 1.35; font-weight: 600; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px; box-sizing: border-box;
  border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface-btn); color: var(--text);
  font-size: 16px; line-height: 1.3; text-align: left; transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.quiz-opt .ltr {
  width: 26px; height: 26px; border-radius: 13px; border: 1px solid var(--border-soft); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--gold);
}
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { border: 2px solid var(--gold-bright); background: rgba(var(--gold-rgb), 0.18); box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.35); }
.quiz-opt.right .ltr { background: var(--gold-bright); color: var(--on-gold); border-color: var(--gold-bright); }
.quiz-opt.wrong { border-color: var(--danger); color: var(--danger); }
.quiz-opt.wrong .ltr { border-color: var(--danger); color: var(--danger); }
.quiz-opt.dim { opacity: 0.45; }
.quiz-feedback { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; min-height: 24px; }
.quiz-explain { font-size: 14px; line-height: 1.4; }
.quiz-actions { margin-top: 14px; }
.quiz-score { display: flex; align-items: baseline; gap: 10px; }
.quiz-score .big { font-family: var(--font-display); font-size: 40px; font-weight: 700; color: var(--oxblood); }
.quiz-verdict { font-size: 16px; margin: 4px 0 10px 0; }
.quiz-actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.quiz-actions-row a, .modal-actions a { text-decoration: none; }
.duel-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-btn); font-size: 14px; }
.duel-score { display: flex; gap: 10px; align-items: baseline; font-size: 16px; }
.duel-verdict { font-weight: 600; color: var(--gold-bright); margin-top: 2px; }
.parchment .duel-verdict { color: var(--oxblood); }
/* Quiz-Liste auf der Buchseite */
.quiz-block { margin-top: 14px; }
.quiz-row {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; background: var(--surface-btn);
}
.quiz-row-info { flex: 1; min-width: 0; }
.quiz-row-title { font-weight: 600; }
.quiz-row-meta { font-size: 13px; }
.quiz-play { height: 36px; padding: 0 16px; font-size: 14px; text-decoration: none; border-radius: 18px; }
/* Löschen: runder, zurückhaltender Knopf, der erst beim Zeigen/Tippen rot wird */
.icon-del {
  width: 36px; height: 36px; flex-shrink: 0; padding: 0; border-radius: 18px;
  border: 1px solid var(--border); background: none; color: var(--faint);
  display: inline-flex; align-items: center; justify-content: center; line-height: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.icon-del svg { width: 16px; height: 16px; display: block; }
.icon-del:hover, .icon-del:focus-visible, .icon-del:active { color: var(--danger); border-color: var(--danger); background: rgba(217, 96, 107, 0.1); }
/* Lesezimmer: Duelle */
.lz-duel {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-btn);
}
.lz-duel .swords { font-size: 22px; flex-shrink: 0; color: var(--gold); }
.lz-duel-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.lz-duel-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lz-duel .btn-gold { height: 34px; padding: 0 14px; font-size: 14px; flex-shrink: 0; }
.lz-duel > svg { color: var(--faint); flex-shrink: 0; }
.quiz-row-title { font-weight: 600; border: none; background: none; padding: 0; color: var(--text); font-size: 16px; text-align: left; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.quiz-row-title .quiz-edit { color: var(--faint); display: inline-flex; }
.quiz-row-title .quiz-edit svg { width: 14px; height: 14px; }

/* ---------- Buchseite: Tabs für Zitate, E-Book, Quiz und Bilder ---------- */
.book-tabs { margin: 22px -16px 4px -16px; padding: 0 16px 2px 16px; scrollbar-width: none; }
.book-tabs::-webkit-scrollbar { display: none; }
.book-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.book-tabs .tab-count {
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; background: rgba(var(--gold-rgb), 0.22); color: inherit;
}
.book-tabs button.active .tab-count { background: rgba(0, 0, 0, 0.18); }
.book-panels { min-height: 220px; }
.book-panel > .section { margin-top: 12px; }
/* Die Überschrift sagt schon der Tab – im Panel bleiben nur die Knöpfe und Infos daneben */
.book-panel > .section > .section-head > .eyebrow, .book-panel .quiz-block > .section-head > .eyebrow { display: none; }
.book-panel > .section > .section-head, .book-panel .quiz-block > .section-head { justify-content: flex-end; }
.book-panel > .section > .section-head:not(:has(> :not(.eyebrow))) { display: none; }
/* Vier Tabs passen in die Handybreite: gleich breit, nicht scrollend */
.book-tabs { overflow-x: visible; margin-left: 0; margin-right: 0; padding: 0; gap: 6px; }
.book-tabs button { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 8px; }
.book-gallery > .section:first-child { margin-top: 12px; }
/* Bons in der Kauf-Karte: kleine Kacheln unter Datum, Laden, Preis */
.kauf-bons { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--parch-border); }
.kauf-bons .k { display: block; color: var(--parch-muted); font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 6px; }
.kauf-bons .gallery { padding-bottom: 2px; }
.kauf-bons .gallery-item .thumb, .kauf-bons .gallery-add { width: 64px; height: 88px; }
.kauf-bons .gallery-add { border-color: var(--parch-border); color: var(--parch-muted); }
/* Lesen-Karte: welcher Status aus dem Zeitraum folgt */
.lese-hint { font-size: 13px; color: var(--parch-muted); margin-top: -4px; }
.lese-hint b { color: var(--parch-ink); }
.lese-hint-error { color: var(--danger); }

/* ---------- Regal: Filter-Knopf mit Pillen der gesetzten Filter, Filter-Menü ---------- */
.filter-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px 0; min-height: 34px; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; flex-shrink: 0;
  border-radius: 17px; border: 1px solid var(--border-soft); background: none; color: var(--chip-fg); font-size: 14px;
}
.filter-btn.active { border-color: var(--gold); color: var(--gold-bright); }
.filter-count {
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px;
  background: var(--gold); color: var(--on-gold); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.filter-pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px 0 12px; flex-shrink: 0;
  border-radius: 15px; border: none; background: var(--chip-active-bg); color: var(--chip-active-fg); font-size: 13px; font-weight: 600;
}
.filter-pill svg { width: 12px; height: 12px; }
.filter-section { margin: 4px 0 14px 0; }
.filter-section .eyebrow { margin-bottom: 8px; }
/* Filter-Knopf rechts, gesetzte Filter links davon */
.filter-btn { order: 2; margin-left: auto; }
.filter-pills { order: 1; flex: 0 1 auto; }

/* ---------- Character Card mit KI malen ---------- */
.ai-paint { width: 100%; height: 44px; font-size: 16px; margin-bottom: 4px; }
.card-ai-chars { max-height: 180px; overflow-y: auto; }
.card-ai-result { display: block; width: 100%; max-width: 280px; margin: 4px auto 10px auto; border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5); }

/* Kauf-Karte: im Look des Regal-Themes statt hellem Pergament */
.buy-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface-btn); margin-bottom: 14px; }
.buy-card .kv-grid .k, .buy-card .kauf-bons .k { color: var(--muted); }
.buy-card .kauf-bons { border-top-color: var(--border); }
.buy-card .kauf-bons .gallery-add { border-color: var(--border-soft); color: var(--muted); }

/* ---------- Buchseite: Reihen-Leiste, Cover nach vorn; fehlende Bände ausgegraut ---------- */
.series-strip { margin: 14px 0 18px 0; }
.series-strip-head { margin-bottom: 2px; }
.series-strip-meta { font-size: 13px; margin-bottom: 8px; }
.vol-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px 2px; scrollbar-width: none; scroll-behavior: smooth; }
.vol-strip::-webkit-scrollbar { display: none; }
.vol-tile {
  position: relative; flex-shrink: 0; width: 62px; height: 92px; padding: 0; border: none; border-radius: 4px; overflow: hidden;
  background: var(--track-bg); box-shadow: 0 3px 8px var(--shadow-book); display: block; text-decoration: none;
}
.vol-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vol-leather { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 4px; box-sizing: border-box;
  font-size: 9px; line-height: 1.15; text-align: center; color: var(--leather-title); overflow: hidden; }
.vol-tile.current { outline: 2px solid var(--gold-bright); outline-offset: 2px; box-shadow: 0 0 14px rgba(var(--gold-rgb), 0.45); }
/* Fehlende Bände: ausgegraut und blass, beim Zeigen etwas deutlicher */
.vol-tile.missing { cursor: pointer; border: 1px dashed var(--border-soft); background: none; box-shadow: none; }
.vol-tile.missing img { filter: grayscale(1) brightness(0.75); opacity: 0.45; transition: opacity 0.15s, filter 0.15s; }
.vol-tile.missing:hover img, .vol-tile.missing:focus-visible img { opacity: 0.7; }
.vol-ghost { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  font-family: var(--font-display); font-size: 22px; color: var(--faint); opacity: 0.6; }
.vol-no {
  position: absolute; left: 3px; bottom: 3px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 8px;
  background: rgba(0, 0, 0, 0.62); color: var(--parch); font-family: var(--font-display); font-size: 10px; line-height: 16px; text-align: center;
}
.vol-tile.missing .vol-no { opacity: 0.7; }
.vol-wish { position: absolute; top: 3px; right: 3px; color: var(--gold-bright); display: flex; }
.vol-wish svg { width: 14px; height: 14px; }

/* ---------- Quizduell ---------- */
.navbar a { position: relative; }
.nav-badge {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
  border-radius: 8px; background: var(--gold); color: var(--on-gold); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.qd-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 4px 0;
  border: 1px solid var(--border); border-radius: 14px; padding: 12px 18px; background: var(--surface-btn); }
.qd-side { display: flex; flex-direction: column; align-items: center; min-width: 80px; }
.qd-name { font-size: 13px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-num { font-family: var(--font-display); font-size: 38px; font-weight: 700; color: var(--gold-bright); line-height: 1.1; }
.qd-vs { font-family: var(--font-display); font-size: 26px; color: var(--muted); text-align: center; }
.qd-result { font-size: 16px; color: var(--gold-bright); }
.qd-score.lost .qd-result { color: var(--muted); }
.qd-status { text-align: center; font-size: 15px; margin: 6px 0 12px 0; color: var(--text); }
.qd-rounds { display: flex; flex-direction: column; gap: 8px; }
.qd-round { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.qd-round.current { border-color: var(--gold); box-shadow: 0 0 12px rgba(var(--gold-rgb), 0.25); }
.qd-round-book { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; justify-content: center; }
.qd-round-book img, .qd-mini-cover { width: 26px; height: 38px; object-fit: cover; border-radius: 2px; flex-shrink: 0; background: var(--track-bg); }
.qd-round-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qd-dots { display: inline-flex; gap: 4px; flex-shrink: 0; }
.qd-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--track-bg); border: 1px solid var(--border); }
.qd-dot.ok { background: #5FA35A; border-color: #5FA35A; }
.qd-dot.bad { background: var(--danger); border-color: var(--danger); }
.qd-dot.hidden { background: repeating-linear-gradient(45deg, var(--track-bg) 0 3px, var(--border) 3px 5px); }
.qd-action { margin-top: 16px; }
.qd-wait { text-align: center; font-size: 14px; padding: 10px 0; }
.qd-giveup { display: block; margin: 14px auto 0 auto; color: var(--muted); font-size: 13px; }
.qd-offer { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.qd-book { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 6px; border: 1px solid var(--border-soft);
  border-radius: 12px; background: var(--surface-btn); color: var(--text); text-align: center; }
.qd-book:hover { border-color: var(--gold); }
.qd-book img, .qd-book-leather { width: 72px; height: 106px; object-fit: cover; border-radius: 3px; box-shadow: 0 4px 10px var(--shadow-book); }
.qd-book-leather { display: flex; align-items: center; justify-content: center; padding: 4px; box-sizing: border-box; font-size: 10px; color: var(--leather-title); }
.qd-book-title { font-weight: 600; font-size: 14px; line-height: 1.2; }
.qd-book-author { font-size: 12px; color: var(--muted); }
.qd-shared { font-size: 11px; font-weight: 700; color: var(--on-gold); background: var(--gold); border-radius: 8px; padding: 1px 7px; }
.qd-owner { font-size: 11px; color: var(--muted); }
.qd-timer { height: 8px; border-radius: 4px; background: var(--track-bg); border: 1px solid var(--track-border, var(--border)); overflow: hidden; }
.qd-timer-fill { height: 100%; background: linear-gradient(90deg, var(--danger), var(--gold), var(--gold-bright)); background-size: 300% 100%; }
.lz-duel.my-turn { border-color: var(--gold); }
.qd-unread { font-size: 11px; font-weight: 600; color: var(--danger); border: 1px solid currentColor; border-radius: 8px; padding: 1px 7px; line-height: 1.3; }
.qd-round-title { display: inline-flex; flex-direction: column; align-items: flex-start; }
.qd-round-unread { font-size: 11px; color: var(--muted); font-weight: 400; }

/* Quizduell-Seite */
.qd-tally { display: flex; justify-content: space-around; gap: 8px; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin: 4px 0 6px 0; font-size: 14px; color: var(--muted); background: var(--surface-btn); }
.qd-tally b { font-family: var(--font-display); font-size: 20px; color: var(--gold-bright); margin-right: 4px; }
.qd-tag { font-size: 11px; font-weight: 700; border-radius: 8px; padding: 1px 7px; margin-left: 4px; border: 1px solid var(--border-soft); color: var(--muted); vertical-align: middle; }
.qd-tag.won { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.qd-tag.lost { color: var(--danger); border-color: var(--danger); }
.lz-duel .swords svg { width: 22px; height: 22px; display: block; }
.empty-shelf .big svg { width: 40px; height: 40px; }

/* Buch-Bibel: Zeile mit den bereitliegenden Quiz-Runden */
.quiz-ready { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-soft); font-size: 14px; }
.quiz-ready > svg { width: 18px; height: 18px; flex: none; color: var(--gold); }
.quiz-ready a { color: var(--gold-bright); }

/* Quizduell: Schwierigkeitsstufen */
.qd-level-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px 0; }
.qd-levels { display: flex; gap: 7px; }
.qd-levels button { flex: 1; height: 38px; border-radius: 19px; border: 1px solid var(--border); background: none; color: var(--faint); font-size: 14px; cursor: pointer; }
.qd-levels button.active { background: var(--chip-active-bg); color: var(--chip-active-fg); border-color: var(--chip-active-bg); font-weight: 700; }
.qd-level-hint { font-size: 13px; margin-top: 6px; min-height: 2.6em; }
.qd-tag.level-leicht, .qd-tag.level-mittel, .qd-tag.level-schwer { margin-left: 2px; margin-right: 2px; }
.qd-tag.level-schwer { color: var(--gold-bright); border-color: var(--gold); }
.quiz-levels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.quiz-level { font-size: 12px; border: 1px solid var(--border-soft); border-radius: 10px; padding: 1px 8px; }
.quiz-level.empty { opacity: .55; }

/* Buch-Bibel im Stil der Kauf-Karte: dunkle Fläche statt Pergament, Akzente in Gold */
.buy-card.bible { margin-bottom: 0; }
.buy-card.bible .bible-meta { color: var(--muted); }
.buy-card.bible .bible-part { border-top-color: var(--border); }
.buy-card.bible .bible-part > summary::before { border-color: var(--gold); }
.buy-card.bible .spoiler-tag { color: var(--muted); border-color: var(--border-soft); }
.buy-card.bible .bible-chips { margin: 4px 0 2px 0; }
.buy-card.bible .bible-chips .chip { color: var(--gold-bright); border-color: var(--border-soft); background: none; height: 30px; font-size: 13px; padding: 0 12px; }
.buy-card.bible .bible-chips .chip.static { cursor: default; color: var(--muted); }
.buy-card.bible .bible-list b, .buy-card.bible .bible-chapter summary { color: var(--text); }
.buy-card.bible .quiz-ready { border-top-color: var(--border); }
/* Wunschregal: Wünsche als Geisterbücher (gestrichelt, durchscheinend) */
.wish-intro { font-size: 15px; font-style: italic; color: var(--muted); margin: 2px 2px 6px 2px; }
.book.wish-ghost, .book.wish-add {
  width: 110px; flex-shrink: 0; position: relative; box-sizing: border-box; cursor: pointer; text-align: left;
  border: 1.5px dashed color-mix(in srgb, var(--gold) 60%, transparent); border-radius: 3px 8px 8px 3px;
  background: linear-gradient(105deg, color-mix(in srgb, var(--gold) 10%, transparent), color-mix(in srgb, var(--gold) 3%, transparent));
  padding: 12px 9px; display: flex; flex-direction: column; justify-content: space-between; font-family: inherit;
  box-shadow: none; transition: border-color .15s, background .15s;
}
.book.wish-ghost:hover, .book.wish-ghost:focus-visible { border-color: var(--gold-bright); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.wish-t { font-size: 16px; font-weight: 600; line-height: 1.25; color: color-mix(in srgb, var(--gold-bright) 85%, transparent); overflow-wrap: break-word; hyphens: auto; }
.wish-a { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.wish-tag { position: absolute; left: 8px; bottom: -12px; background: var(--modal-bg); color: var(--gold-bright); border: 1px solid var(--border);
  border-radius: 10px; font-size: 11px; font-weight: 700; padding: 3px 9px; box-shadow: 0 2px 6px rgba(0,0,0,.4); white-space: nowrap; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.wish-ribbon { position: absolute; top: -1px; right: 5px; width: 10px; height: 18px; background: var(--oxblood, #6E2B26);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }
.book.wish-add { align-items: center; justify-content: center; gap: 6px; border-color: var(--border); background: none; color: var(--faint); font-size: 13px; }
.book.wish-add svg { width: 22px; height: 22px; }
/* Wunsch-Fenster */
.wish-sheet { display: flex; flex-direction: column; gap: 14px; }
.wish-sheet-head { display: flex; gap: 14px; align-items: flex-start; }
.wish-mini { width: 64px; height: 92px; flex-shrink: 0; border: 1.5px dashed color-mix(in srgb, var(--gold) 70%, transparent); border-radius: 2px 6px 6px 2px;
  background: color-mix(in srgb, var(--gold) 10%, transparent); display: flex; align-items: center; justify-content: center; color: var(--gold); }
.wish-mini svg { width: 20px; height: 20px; }
.wish-sheet-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wish-sheet-info h3 { margin: 0; }
.wish-sheet-author { font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.wish-sheet-info .series-pill { align-self: flex-start; margin-top: 4px; }
.wish-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--surface-btn); }
.wish-facts .k { display: block; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.wish-facts .wish-price { color: var(--gold-bright); }
.wish-facts .wish-note { grid-column: 1 / -1; border-top: 1px dashed var(--border); padding-top: 10px; }
.wish-buy { height: 48px; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.wish-buy svg { width: 18px; height: 18px; }
.wish-sheet-actions { display: flex; gap: 10px; }
.wish-sheet-actions > button { flex: 1; }
.wish-t.sm { font-size: 13px; }
.wish-t.ribboned { padding-right: 6px; }
/* Wunsch-Formular: ISBN scannen oder nachschlagen */
.wish-lookup { border: 1.5px dashed var(--border-soft); border-radius: 12px; background: var(--surface-btn); padding: 12px; margin-bottom: 12px;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.wish-lookup > .btn-gold { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.wish-lookup > .btn-gold svg { width: 20px; height: 20px; }
.wish-lookup-row { display: flex; align-items: center; gap: 8px; }
.wish-lookup-row label { flex-shrink: 0; font-size: 14px; }
.wish-lookup-row .input { flex: 1; min-width: 0; }
.wish-lookup-note { font-size: 14px; }
.wish-lookup-note:empty { display: none; }

/* Wunsch mit Cover: blass, damit er als Wunsch erkennbar bleibt */
.book.wish-ghost.has-cover { padding: 0; overflow: hidden; }
.book.wish-ghost.has-cover .wish-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5;
  filter: saturate(.65); border-radius: inherit; transition: opacity .15s; }
.book.wish-ghost.has-cover:hover .wish-cover, .book.wish-ghost.has-cover:focus-visible .wish-cover { opacity: .7; }
.book.wish-ghost.has-cover .wish-t, .book.wish-ghost.has-cover .wish-a { display: none; }
.book.wish-ghost.has-cover .wish-tag, .book.wish-ghost.has-cover .wish-ribbon { z-index: 1; }
.book.wish-ghost.has-cover .wish-tag { bottom: 6px; }
.wish-mini { position: relative; overflow: hidden; }
.wish-mini img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .6; }
.wish-mini img + svg { display: none; }
.modal .cover-picker-wrap { margin-bottom: 12px; }

/* Lesezeichen rechts neben der Blätterleiste: direkt ins Wunschregal (und zurück).
   Die Leiste bleibt mittig; shelf.js setzt --pager-half auf ihre halbe Breite. */
.wish-jump {
  position: fixed; z-index: 19; bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: min(calc(50% + var(--pager-half, 96px) + 10px), calc(100vw - 62px));
  width: 46px; height: 46px; padding: 0; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg2); background: color-mix(in srgb, var(--bg2) 90%, transparent);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35); color: var(--icon);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: color .15s, border-color .15s, box-shadow .15s;
}
.wish-jump svg { width: 20px; height: 20px; }
/* Hover nur mit Maus (auf dem Handy bliebe er nach dem Tippen hängen) und in den Farben des Regal-Themes */
@media (hover: hover) { .wish-jump:not(.active):hover { color: var(--count); border-color: var(--border-soft); } }
.wish-jump:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wish-jump.active { color: var(--gold-bright); border-color: var(--gold); box-shadow: 0 0 12px rgba(var(--gold-rgb), 0.45), 0 8px 22px rgba(0, 0, 0, 0.35); }
.wish-jump.active svg { fill: currentColor; }
/* Im Wunschregal ist kein Regal gewählt; ohne Blätterleiste (nur ein Regal) steht das Lesezeichen allein mittig */
.shelf-pager.off .pager-thumb { opacity: 0; }
.wish-jump.solo { left: calc(50% - 23px); }

/* ---------- Story-Zimmer ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st-intro { font-size: 15px; font-style: italic; color: var(--muted); margin: -2px 2px 4px 2px; }
.st-list { display: flex; flex-direction: column; gap: 10px; }
.st-card { display: flex; gap: 12px; align-items: stretch; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-btn);
  padding: 10px; text-decoration: none; color: var(--text); }
.st-thumb { width: 74px; height: 74px; border-radius: 10px; object-fit: cover; flex-shrink: 0; box-shadow: 0 3px 8px var(--shadow-book); }
.st-thumb.cover { object-fit: cover; }
.st-thumb.placeholder { display: flex; align-items: center; justify-content: center; background: var(--track-bg); color: var(--icon); }
.st-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-card-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--wordmark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-card-meta { font-size: 13px; color: var(--muted); }
.st-card-snippet { font-size: 14.5px; line-height: 1.3; color: var(--text); opacity: .88; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-tag { border: 1px solid var(--border-soft); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.st-book { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-btn); padding: 10px; }
.st-book-cover { flex-shrink: 0; width: 48px; height: 70px; border-radius: 2px 6px 6px 2px; overflow: hidden; box-shadow: 0 3px 8px var(--shadow-book); display: block; }
.st-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-book-cover .placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--oxblood); color: var(--gold-bright); font-family: var(--font-display); }
.st-book-info { flex: 1; min-width: 0; }
.st-book-title { font-size: 16.5px; font-weight: 600; }
.st-book-sub { font-size: 13px; color: var(--muted); }
.st-book .track { display: block; margin-top: 5px; }
.st-begin { height: 36px; padding: 0 14px; font-size: 14.5px; flex-shrink: 0; }
.st-from-book { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; height: 36px; padding: 0 14px; font-size: 14.5px; }
.st-from-book svg { width: 16px; height: 16px; }
.menu-list button.danger { color: var(--danger); }

/* Avatare */
.st-av { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; font-family: var(--font-display); font-size: 13px; font-weight: 700; color: #241A13;
  border: 1.5px solid var(--gold); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.st-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-av.big { width: 52px; height: 52px; font-size: 16px; border-width: 2px; border-color: var(--border-soft); }
.st-av.own { background: none; border-style: dashed; color: var(--icon); }
.st-av.own svg { width: 20px; height: 20px; }

/* Start-Dialog */
.modal.st-start-modal { max-width: 460px; }
.st-start-title { margin: 0 0 10px 0; font-family: var(--font-display); color: var(--wordmark); }
.st-mode { display: flex; width: 100%; margin-bottom: 10px; }
.st-mode button { flex: 1; padding: 0 8px; }
.st-mode button.active, .st-kinds button.active { background: var(--gold); color: var(--on-gold); }
.st-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); border: 1px dashed var(--border-soft);
  border-radius: 10px; padding: 6px 10px; margin-bottom: 8px; }
.st-note svg { flex-shrink: 0; color: var(--icon); width: 16px; height: 16px; }
.st-tps { display: flex; flex-direction: column; gap: 7px; max-height: 38vh; overflow-y: auto; padding: 2px; }
.st-tp { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-btn); padding: 9px 11px; color: var(--text); font-family: inherit; cursor: pointer; box-sizing: border-box; }
.st-tp.on { border: 2px solid var(--gold-bright); background: rgba(var(--gold-rgb), .14); box-shadow: 0 0 16px rgba(var(--gold-rgb), .3); }
.st-tp-no { font-family: var(--font-display); font-size: 11px; font-weight: 700; color: var(--on-gold); background: var(--gold); border-radius: 8px;
  padding: 2px 6px; flex-shrink: 0; margin-top: 2px; }
.st-tp-text { display: flex; flex-direction: column; min-width: 0; }
.st-tp-title { font-size: 15.5px; font-weight: 600; line-height: 1.2; }
.st-tp-desc { font-size: 13.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.st-tp.veiled .st-tp-title { filter: blur(5px); user-select: none; }
.st-who { margin: 14px 0 8px 0; display: block; }
.st-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 10px 6px; }
.st-role { display: flex; flex-direction: column; align-items: center; gap: 4px; border: none; background: none; color: var(--text);
  font-family: inherit; font-size: 12.5px; line-height: 1.15; text-align: center; cursor: pointer; padding: 0; }
.st-role.on .st-av { border-color: var(--gold-bright); box-shadow: 0 0 12px rgba(var(--gold-rgb), .55); }
.st-role.on > span:last-child { color: var(--gold-bright); font-weight: 600; }
.st-own { margin-top: 10px; }
.st-hint { font-size: 13px; margin-top: 6px; }
.st-hint.center { text-align: center; margin-top: 12px; }

/* Chat */
.st-chat { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
/* Kopf steht fest oben wie .topbar (Platzhalter .st-top-slot, siehe „Kopf") */
.st-top { display: flex; align-items: center; gap: 6px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 8px 6px;
  background: var(--bg1); border-bottom: 1px solid var(--border); }
.st-top-slot { height: calc(63px + env(safe-area-inset-top, 0px)); margin-bottom: 8px; }
.st-top-title { flex: 1; min-width: 0; border: none; background: none; text-align: left; padding: 0 4px; color: var(--text); cursor: pointer; font-family: inherit; }
.st-top-name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--wordmark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-top-sub { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-msgs { display: flex; flex-direction: column; gap: 12px; }
.st-start-chip { align-self: center; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 14px; padding: 4px 12px;
  font-size: 13px; color: var(--muted); background: var(--surface-btn); max-width: 100%; }
.st-start-chip svg { width: 14px; height: 14px; color: var(--icon); flex-shrink: 0; }
.st-turn { display: flex; flex-direction: column; gap: 10px; }
.st-narr { font-size: 16.5px; line-height: 1.55; margin: 0; color: var(--text); }
.st-say { display: flex; gap: 10px; align-items: flex-start; }
.st-bubble { background: var(--surface-btn); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 8px 12px; max-width: 78%; }
.st-bubble-name { font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--icon); margin-bottom: 2px; }
.st-bubble-text { font-size: 16px; line-height: 1.4; }
.st-me { align-self: flex-end; max-width: 80%; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.st-me-label { font-family: var(--font-display); font-size: 9.5px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.st-me-bubble { background: var(--oxblood); color: #F6EFD9; border-radius: 14px 4px 14px 14px; padding: 8px 12px; font-size: 16px; line-height: 1.4; }
.st-me-act { border: 1px solid var(--border-soft); border-radius: 14px 4px 14px 14px; padding: 7px 12px; font-size: 16px; font-style: italic; line-height: 1.4; }
.st-me-twist { border: 1px dashed var(--gold); border-radius: 12px; padding: 7px 12px; font-size: 15px; line-height: 1.4; color: var(--text); }
.st-scene { margin: 0; }
.st-scene-btn { display: block; width: 100%; padding: 0; border: none; background: none; cursor: zoom-in; }
.st-scene img { width: 100%; border-radius: 12px; display: block; box-shadow: 0 6px 16px var(--shadow-book); }
.st-turn-tools { display: flex; align-items: center; justify-content: space-between; margin-top: -4px; min-height: 28px; }
.st-tool { border: none; background: none; color: var(--faint); font-size: 16px; padding: 4px 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; }
.st-tool:disabled { opacity: .35; cursor: default; }
.st-tool svg { width: 18px; height: 18px; }
.st-alts { display: inline-flex; align-items: center; font-size: 13px; color: var(--muted); }
.st-typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.st-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--icon); animation: st-dot 1.2s infinite ease-in-out; }
.st-typing span:nth-child(2) { animation-delay: .15s; }
.st-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes st-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .st-typing span { animation: none; opacity: .7; } }
.st-orphan { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.st-orphan .btn-gold { display: inline-flex; align-items: center; gap: 6px; }
.st-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.st-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 6px 12px; border-radius: 19px; border: 1px solid var(--border-soft);
  background: var(--surface-btn); color: var(--count); font-family: inherit; font-size: 14.5px; line-height: 1.25; text-align: left; cursor: pointer; }
.st-chip svg { flex-shrink: 0; width: 15px; height: 15px; color: var(--icon); }
.st-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px)) 12px;
  background: linear-gradient(180deg, var(--nav-hi), var(--nav-lo)); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.st-bar > * { width: 100%; max-width: 700px; margin: 0 auto; box-sizing: border-box; }
.st-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.st-kinds button { height: 30px; padding: 0 11px; font-size: 13.5px; }
.st-bar-acts { display: flex; }
.st-act { display: inline-flex; align-items: center; gap: 5px; border: none; background: none; color: var(--muted); font-family: inherit; font-size: 14px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.st-act:disabled { opacity: .35; cursor: default; }
.st-input { display: flex; align-items: flex-end; gap: 8px; }
.st-input textarea { flex: 1; min-height: 44px; max-height: 140px; box-sizing: border-box; resize: none; border: 1px solid var(--field-border); border-radius: 22px;
  background: var(--field-bg); color: var(--text); font-family: inherit; font-size: 16px; line-height: 1.35; padding: 11px 16px; }
.st-send { width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; border: 1px solid var(--gold-bright); background: linear-gradient(145deg, var(--gold-bright), var(--gold-dark, #A47F35));
  color: var(--on-gold); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.st-send:disabled, .st-input textarea:disabled { opacity: .5; cursor: default; }
@media (max-width: 380px) { .st-act span { display: none; } .st-kinds button { padding: 0 8px; } }.st-tools-right { display: inline-flex; align-items: center; gap: 2px; }
.st-tool-label { gap: 5px; font-size: 13.5px; font-family: inherit; }
.st-tool-label svg { width: 16px; height: 16px; }
.st-scene-wait { font-size: 14px; color: var(--muted); border: 1px dashed var(--border-soft); border-radius: 12px; padding: 18px 12px; text-align: center; }
.st-read { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
.st-read .st-top-title { cursor: default; }

/* Hinweis auf eine neue Version (oben, damit er weder Leiste noch Story-Eingabe verdeckt) */
.update-banner { position: fixed; z-index: 60; left: 12px; right: 12px; margin: 0 auto; width: fit-content; max-width: 520px;
  top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 24px;
  background: var(--modal-bg); border: 1px solid var(--gold); box-shadow: 0 10px 28px rgba(0, 0, 0, .45); color: var(--text); font-size: 15px; }
.update-banner .btn-gold { height: 34px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
.update-banner .btn-plain { font-size: 20px; color: var(--muted); padding: 0 6px; }