/* =====================================================================
   Bibliothek – Gestaltung: Lesesaal
   Nussbaum, flaschengrünes Leder, Messing; Inhalte auf gealtertem Papier,
   Bücher als Karteikarten und als Rücken im Regal.
   ===================================================================== */

/* ---------- Schriften (liegen lokal, nichts wird von fremden Servern geladen) ---------- */
@font-face { font-family: "UnifrakturMaguntia"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/unifrakturmaguntia-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/im-fell-english-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/im-fell-english-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English SC"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/im-fell-english-sc-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/eb-garamond-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/eb-garamond-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/eb-garamond-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/eb-garamond-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/eb-garamond-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Special Elite"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/special-elite-latin-400-normal.woff2") format("woff2"); }

/* ---------- Farben, Maße, Texturen ---------- */
:root {
  --wood-900: #1b100a;
  --wood-800: #26170d;
  --wood-700: #3a2414;
  --wood-500: #5e3c22;
  --wood-400: #7a5230;
  --leather: #1d3a2e;
  --leather-dark: #12261e;
  --leather-light: #2a5141;
  --oxblood: #6f1f27;
  --oxblood-dark: #4d1319;
  --brass: #c8a24a;
  --brass-light: #edd591;
  --brass-dark: #86661f;
  --paper: #eadfc4;
  --paper-2: #dfd1ad;
  --paper-edge: #c9b687;
  --card: #f5efdd;
  --ink: #2a2017;
  --ink-soft: #5f4f3b;
  --ink-faint: #8d7b60;
  --rule-red: #b4483c;
  --rule-blue: #a9bccb;
  --ok: #2f5d3a;

  --f-body: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-display: "IM Fell English", "EB Garamond", Georgia, serif;
  --f-sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --f-fraktur: "UnifrakturMaguntia", "IM Fell English", Georgia, serif;
  --f-type: "Special Elite", "Courier New", Courier, monospace;

  --shell: 880px;
  --tabbar-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --tex-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .30 0 0 0 0 .20 0 0 0 0 .08 .55 0 0 0 -.17'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  --tex-wood: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='240'%3E%3Cfilter id='w' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006 .22' numOctaves='4' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.5 0 0 0 -.62'/%3E%3C/filter%3E%3Crect width='600' height='240' filter='url(%23w)'/%3E%3C/svg%3E");
  --tex-leather: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='l' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='turbulence' baseFrequency='.55' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0 0 0 -.12'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23l)'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--f-body); font-size: 18px; line-height: 1.45; color: var(--ink);
  background-color: var(--wood-900);
  background-image: var(--tex-wood), linear-gradient(180deg, #24150c, #170d07);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; border-radius: 2px; }
.on-dark :focus-visible, .tabbar :focus-visible, .topbar :focus-visible, .scanner :focus-visible { outline-color: var(--brass-light); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }

/* ---------- Startbild ---------- */
.splash { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; text-align: center; gap: 10px; color: var(--brass); padding: 24px; }
.splash-mark { font-family: var(--f-fraktur); font-size: 54px; line-height: 1; color: var(--brass-light); text-shadow: 0 2px 0 #000; }
.splash-sub { font-family: var(--f-display); font-style: italic; color: #b89b62; }

/* ---------- Gerüst ---------- */
.shell { max-width: var(--shell); margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; box-shadow: 0 0 60px rgba(0,0,0,.7); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  padding: calc(var(--safe-t) + 9px) 16px 11px;
  display: flex; align-items: center; gap: 12px;
  color: var(--brass-light);
  background-color: var(--leather);
  background-image: var(--tex-leather), linear-gradient(180deg, var(--leather-light), var(--leather) 40%, var(--leather-dark));
  box-shadow: 0 3px 10px rgba(0,0,0,.45);
}
/* Goldprägung: doppelte Linie am unteren Rand des Lederbands */
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 3px; height: 4px; border-top: 1px solid rgba(232,204,130,.85); border-bottom: 1px solid rgba(232,204,130,.4); pointer-events: none; }
.wordmark { font-family: var(--f-fraktur); font-size: 27px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; text-shadow: 0 1px 0 rgba(0,0,0,.6); flex: 1; min-width: 0; padding-bottom: 3px; }
.netstate { font-family: var(--f-sc); font-size: 13px; letter-spacing: .08em; display: inline-flex; align-items: center; gap: 6px; color: #d9c48e; white-space: nowrap; padding-bottom: 3px; }
.netstate::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #7fbf7f; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.netstate[data-state="offline"]::before { background: #d9694f; }
.netstate[data-state="sync"]::before { background: var(--brass-light); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.page {
  flex: 1; position: relative;
  padding: 22px 16px calc(var(--tabbar-h) + var(--safe-b) + 46px);
  background-color: var(--paper);
  background-image: var(--tex-grain),
    radial-gradient(120% 60% at 50% 0%, rgba(255,250,230,.55), transparent 60%),
    linear-gradient(90deg, rgba(120,90,40,.16), transparent 5%, transparent 95%, rgba(120,90,40,.16));
}
.page > * + * { margin-top: 18px; }

/* Seitenkopf */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pagehead h1 { font-size: 34px; line-height: 1.05; }
.pagehead .sub { font-family: var(--f-display); font-style: italic; color: var(--ink-soft); font-size: 17px; margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-sc); font-size: 15px; letter-spacing: .06em; color: var(--ink-soft); text-decoration: none; background: none; border: 0; padding: 6px 8px 6px 0; margin: -6px 0 -8px; }

/* Zierlinie mit Raute */
.rule { display: flex; align-items: center; gap: 10px; color: var(--ink-faint); margin-block: 22px 14px; }
.rule::before, .rule::after { content: ""; flex: 1; height: 3px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; opacity: .55; }
.rule span { font-family: var(--f-display); font-style: italic; font-size: 21px; color: var(--ink); white-space: nowrap; }
.rule.plain::before { display: none; }

/* ---------- Registerleiste unten ---------- */
.tabbar {
  position: fixed; z-index: 40; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--shell);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: 1fr 1fr 84px 1fr 1fr; align-items: stretch;
  background-color: var(--wood-700);
  background-image: var(--tex-wood), linear-gradient(180deg, #4a2f1a, #2c1b0f);
  border-top: 2px solid var(--brass-dark);
  box-shadow: 0 -1px 0 #120a05, inset 0 1px 0 rgba(237,213,145,.35), 0 -8px 22px rgba(0,0,0,.45);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: #bfa571; font-family: var(--f-sc); font-size: 13px; letter-spacing: .07em; background: none; border: 0; padding: 4px 2px 2px; min-width: 0; }
.tab svg.i { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--brass-light); text-shadow: 0 0 12px rgba(237,213,145,.35); }
.tab[aria-current="page"]::after { content: ""; width: 6px; height: 6px; background: var(--brass-light); transform: rotate(45deg); margin-top: 1px; }
.tab:not([aria-current="page"])::after { content: ""; width: 6px; height: 6px; margin-top: 1px; }
.tab-scan { position: relative; }
.medal {
  position: absolute; left: 50%; top: -28px; transform: translateX(-50%);
  width: 68px; height: 68px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; color: #33240b; text-decoration: none;
  background: radial-gradient(circle at 35% 28%, #fff1bf, #e1c06a 38%, #b08a35 72%, #7d5e1e);
  box-shadow: 0 0 0 2px #5b4314, 0 0 0 5px var(--wood-700), 0 0 0 6px rgba(237,213,145,.4), 0 8px 16px rgba(0,0,0,.55), inset 0 -3px 6px rgba(80,55,10,.5), inset 0 2px 3px rgba(255,255,255,.6);
}
.medal::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 1px solid rgba(70,48,8,.55); box-shadow: inset 0 0 0 2px rgba(255,240,190,.35); }
.medal svg.i { width: 30px; height: 30px; stroke-width: 1.7; }
.medal:active { transform: translateX(-50%) translateY(2px); }
.tab-scan .tab-label { margin-top: 45px; color: var(--brass-light); font-family: var(--f-sc); font-size: 13px; letter-spacing: .07em; text-align: center; display: block; }

/* ---------- Schaltflächen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--f-sc); font-size: 17px; letter-spacing: .06em; line-height: 1.1;
  padding: 12px 18px; min-height: 48px; border-radius: 3px; text-decoration: none;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-brass {
  border: 1px solid #6e531a; color: #2c1e07; text-shadow: 0 1px 0 rgba(255,245,200,.5);
  background: linear-gradient(180deg, #f2dc97, #d6b35c 45%, #b9933f);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -1px 0 rgba(90,60,10,.4), 0 2px 0 #59400f, 0 4px 8px rgba(40,25,5,.35);
}
.btn-brass:active { box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 1px 0 #59400f; }
.btn-oxblood { border-color: var(--oxblood-dark); background: linear-gradient(180deg, #84262f, var(--oxblood)); color: #f6e7cf; box-shadow: 0 2px 0 var(--oxblood-dark), 0 4px 8px rgba(40,10,10,.3); }
.btn-leather { border-color: var(--leather-dark); background-color: var(--leather); background-image: var(--tex-leather); color: var(--brass-light); box-shadow: inset 0 0 0 3px var(--leather), inset 0 0 0 4px rgba(237,213,145,.55), 0 2px 0 #0a1712, 0 4px 8px rgba(0,0,0,.3); }
.btn-small { min-height: 40px; padding: 8px 12px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-text { border: 0; background: none; padding: 8px 4px; min-height: 40px; font-family: var(--f-body); font-style: italic; letter-spacing: 0; font-size: 17px; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 4px; color: var(--ink-soft); }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; }
.btnrow.stretch > * { flex: 1 1 150px; }
.btnrow.stretch > .wide { flex-basis: 100%; }
.iconbtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: none; color: inherit; padding: 0; }
.iconbtn svg.i { width: 24px; height: 24px; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > label, .flabel { font-family: var(--f-sc); font-size: 14px; letter-spacing: .09em; color: var(--ink-soft); }
.input, .field input, .field select, .field textarea {
  width: 100%; min-width: 0; font-family: var(--f-body); font-size: 19px; line-height: 1.3; color: var(--ink);
  padding: 9px 8px 7px; border: 0; border-bottom: 1.5px solid var(--ink-soft); border-radius: 2px 2px 0 0;
  background: rgba(255,252,240,.5); appearance: none; -webkit-appearance: none;
}
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%235f4f3b' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-bottom-color: var(--oxblood); background: rgba(255,253,245,.9); box-shadow: 0 2px 0 -1px var(--oxblood); }
.field .hint, .hint { font-size: 15.5px; font-style: italic; color: var(--ink-soft); line-height: 1.35; }
.formgrid { display: grid; gap: 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.formgrid > * { grid-column: span 6; }
.formgrid > .half { grid-column: span 3; }
.formgrid > .third { grid-column: span 2; }
.formgrid > .twothird { grid-column: span 4; }
.error-note { border-left: 3px solid var(--oxblood); padding: 8px 12px; background: rgba(111,31,39,.08); color: var(--oxblood-dark); font-size: 17px; }
.ok-note { border-left: 3px solid var(--ok); padding: 8px 12px; background: rgba(47,93,58,.1); color: #21422a; font-size: 17px; }

/* Suchfeld im Messingrahmen – wie der Schildhalter am Katalogkasten */
.searchbox { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 4px;
  background: linear-gradient(180deg, #ecd48b, #b9923d 55%, #d2ae57); box-shadow: 0 2px 0 #59400f, 0 4px 10px rgba(40,25,5,.3), inset 0 1px 0 rgba(255,255,255,.6); }
.searchbox-inner { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; background: var(--card); border-radius: 2px; padding: 0 6px 0 12px; box-shadow: inset 0 2px 5px rgba(60,40,10,.35); }
.searchbox input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 19px; padding: 11px 0; font-family: var(--f-body); }
.searchbox input:focus { outline: none; }
.searchbox input::placeholder { color: var(--ink-faint); font-style: italic; }
.searchbox svg.i { color: var(--ink-soft); }
.searchbox .iconbtn { width: 38px; height: 38px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { font-family: var(--f-sc); font-size: 14.5px; letter-spacing: .06em; padding: 6px 12px; border: 1px solid var(--ink-soft); border-radius: 2px; background: transparent; color: var(--ink-soft); min-height: 36px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chips .spacer { flex: 1; }
.listbar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 14px; }
.listbar .hint { margin: 0; }
.sortsel { border: 0; background: transparent; font-family: var(--f-body); font-style: italic; font-size: 17px; color: var(--ink-soft); padding: 6px 2px; text-decoration: underline dotted; text-underline-offset: 4px; }

/* ---------- Katalogliste ---------- */
.lettertab { display: flex; align-items: flex-end; gap: 0; margin-top: 22px; border-bottom: 1.5px solid var(--ink-soft); }
.lettertab span { font-family: var(--f-display); font-size: 22px; line-height: 1; min-width: 40px; text-align: center; padding: 6px 10px 3px; background: var(--card); border: 1.5px solid var(--ink-soft); border-bottom: 0; border-radius: 6px 6px 0 0; margin-left: 6px; box-shadow: inset 0 1px 0 #fff; }
.booklist { list-style: none; margin: 0; padding: 0; }
.bookrow { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 2px; text-decoration: none; border-bottom: 1px dotted rgba(95,79,59,.55); }
.bookrow-title { font-weight: 600; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.bookrow-author { font-style: italic; color: var(--ink-soft); font-size: 17px; line-height: 1.25; }
.bookrow-loc { font-family: var(--f-sc); font-size: 13.5px; letter-spacing: .07em; color: var(--ink-soft); margin-top: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.bookrow-loc svg.i { width: 14px; height: 14px; }
.bookrow-loc.none { color: var(--oxblood); }
.bookrow .chev { color: var(--ink-faint); }
.lenttag { font-family: var(--f-sc); font-size: 12px; letter-spacing: .1em; color: var(--oxblood); border: 1px solid currentColor; padding: 0 5px; border-radius: 1px; transform: rotate(-2deg); display: inline-block; }

/* Titelbild bzw. gezeichneter Leineneinband */
.cover { position: relative; width: 50px; aspect-ratio: 2 / 3; flex: none; border-radius: 1px 3px 3px 1px; overflow: hidden; background: var(--c, #3d4a3f); box-shadow: 1px 2px 5px rgba(30,18,8,.45), inset 3px 0 4px -2px rgba(0,0,0,.5); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-cloth { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10%; text-align: center; color: var(--t, #e6cf8d); background-image: var(--tex-leather); }
.cover-cloth::before { content: ""; position: absolute; inset: 7%; border: 1px solid currentColor; opacity: .7; }
.cover-cloth span { font-family: var(--f-display); font-size: 9px; line-height: 1.1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.cover.big { width: 116px; }
.cover.big .cover-cloth span { font-size: 15px; -webkit-line-clamp: 6; line-clamp: 6; }
.cover.mid { width: 76px; }
.cover.mid .cover-cloth span { font-size: 11px; }

.empty { text-align: center; padding: 28px 12px; color: var(--ink-soft); }
.empty h2 { font-size: 26px; color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 34em; margin-inline: auto; }
.empty .btnrow { justify-content: center; margin-top: 16px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 18px auto 0; max-width: 30em; text-align: left; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: start; }
.steps li::before { content: counter(s); font-family: var(--f-display); font-size: 22px; width: 36px; height: 36px; display: grid; place-items: center; border: 1.5px solid var(--ink-soft); border-radius: 50%; color: var(--ink); }

/* ---------- Regale ---------- */
.bookcase { border-radius: 4px; padding: 10px 10px 0; background-color: var(--wood-700); background-image: var(--tex-wood), linear-gradient(180deg, #4b301b, #2e1c10); box-shadow: 0 6px 16px rgba(30,18,8,.45), inset 0 1px 0 rgba(255,220,160,.18); }
.bookcase + .bookcase { margin-top: 18px; }
.shelfcard { display: block; text-decoration: none; color: inherit; }
.shelfcard + .shelfcard { margin-top: 0; }
.niche { display: flex; align-items: flex-end; gap: 2px; padding: 12px 10px 0; overflow: hidden; background: linear-gradient(180deg, #0e0704, #1c110a 70%, #241609); box-shadow: inset 0 10px 18px rgba(0,0,0,.75), inset 8px 0 12px -6px rgba(0,0,0,.7), inset -8px 0 12px -6px rgba(0,0,0,.7); }
.niche.mini { height: 104px; }
.board { position: relative; height: 40px; margin: 0 -10px; display: flex; align-items: center; justify-content: center;
  background-color: var(--wood-500); background-image: var(--tex-wood), linear-gradient(180deg, #8a5f38, #5e3c22 30%, #4a2e19);
  box-shadow: inset 0 2px 0 rgba(255,225,170,.28), 0 4px 8px rgba(0,0,0,.5); }
.bookcase > .shelfcard:last-child .board, .bookcase > .board:last-child { border-radius: 0 0 4px 4px; }
.plate { display: inline-flex; align-items: baseline; gap: 8px; max-width: calc(100% - 28px); padding: 4px 12px 3px; border-radius: 2px; color: #2c1e07; font-family: var(--f-sc); font-size: 15px; letter-spacing: .06em; line-height: 1.2;
  background: linear-gradient(180deg, #f0d88f, #c9a552 55%, #b08a35); box-shadow: 0 0 0 1px #5b4314, 0 2px 3px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.6); text-shadow: 0 1px 0 rgba(255,245,200,.45); }
.plate b { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate i { font-style: normal; font-size: 12.5px; opacity: .8; white-space: nowrap; }

.spine-slot { height: 214px; display: flex; align-items: flex-end; flex: none; }
.niche.mini .spine-slot { height: 92px; }
.spine { position: relative; flex: none; width: var(--w, 30px); height: var(--h, 140px); background-color: var(--c, #5a2a2a); color: var(--t, #e6cf8d); border-radius: 2px 2px 0 0; text-decoration: none; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background-image: linear-gradient(90deg, rgba(255,255,255,.16), rgba(255,255,255,0) 22%, rgba(0,0,0,0) 70%, rgba(0,0,0,.38)); transition: transform .15s ease; }
.spine::before, .spine::after { content: ""; position: absolute; left: 0; right: 0; height: 6px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; opacity: .65; }
.spine::before { top: 9px; } .spine::after { bottom: 9px; }
.spine-title { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--f-body); font-weight: 500; font-size: 13px; line-height: 1.05; letter-spacing: .02em; max-height: calc(var(--h, 140px) - 42px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Breite Rücken: Titel in zwei Zeilen; die Breite ist genau zwei Zeilen, damit nichts halb abgeschnitten wird */
.spine-title.two { white-space: normal; text-overflow: clip; line-height: var(--lh, 15px); max-width: calc(var(--lh, 15px) * 2); text-align: center; }
a.spine:focus-visible { transform: translateY(-8px); }
.spine.mini { --w: 11px; border-radius: 1px 1px 0 0; }
.spine.mini::before { top: 5px; height: 3px; } .spine.mini::after { bottom: 5px; height: 3px; }
/* Stellvertreter: Holzbrettchen anstelle eines verliehenen Buches */
.spine.proxy { background-color: #b39163; background-image: var(--tex-wood); color: #3a2414; box-shadow: inset 0 0 0 1px rgba(60,36,20,.5); }
.spine.proxy::before, .spine.proxy::after { display: none; }
.spine.proxy .spine-title { font-family: var(--f-sc); font-size: 11px; letter-spacing: .1em; }

.bookcase.full { padding-bottom: 12px; }
.bookcase.full .niche { flex-wrap: wrap; padding-top: 0; padding-bottom: 0; min-height: 232px; align-content: flex-start;
  background-image: repeating-linear-gradient(180deg, rgba(0,0,0,.85) 0, rgba(0,0,0,0) 16px, rgba(0,0,0,0) 214px, #b58452 214px, #8a5f38 216px, #5e3c22 222px, #4a2e19 232px), linear-gradient(180deg, #160c06, #22150b); }
.bookcase.full .spine-slot { margin-bottom: 18px; }
.shelfhead { display: flex; justify-content: center; padding: 2px 0 10px; }
.shelfhead .plate { font-size: 17px; padding: 6px 16px 5px; }
.niche-empty { width: 100%; text-align: center; align-self: center; color: #a88f66; font-style: italic; padding: 40px 10px 60px; }

.roomhead { font-family: var(--f-display); font-style: italic; font-size: 24px; margin-top: 26px; display: flex; align-items: center; gap: 10px; }
.roomhead::after { content: ""; flex: 1; height: 3px; border-top: 1px solid var(--ink-faint); border-bottom: 1px solid var(--ink-faint); opacity: .6; }

/* ---------- Buchseite: Karteikarte ---------- */
.bookhead { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; }
.bookhead h1 { font-size: 30px; line-height: 1.08; overflow-wrap: anywhere; }
.bookhead .subtitle { font-family: var(--f-display); font-style: italic; font-size: 19px; color: var(--ink-soft); margin-top: 4px; }
.bookhead .by { font-size: 20px; margin-top: 8px; }
.locplate { margin-top: 14px; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 7px 14px 6px; text-decoration: none; border-radius: 2px; color: #2c1e07; max-width: 100%;
  background: linear-gradient(180deg, #f0d88f, #c9a552 55%, #b08a35); box-shadow: 0 0 0 1px #5b4314, 0 2px 4px rgba(40,25,5,.4), inset 0 1px 0 rgba(255,255,255,.6); }
.locplate small { font-family: var(--f-sc); font-size: 12.5px; letter-spacing: .12em; opacity: .85; }
.locplate strong { font-family: var(--f-display); font-weight: 400; font-size: 19px; line-height: 1.15; overflow-wrap: anywhere; }
.locplate.none { background: none; box-shadow: none; border: 1.5px dashed var(--oxblood); color: var(--oxblood); }

.kartei { position: relative; padding: 14px 18px 40px 22px; font-family: var(--f-type); font-size: 16px; line-height: 28px; color: #2b2622; border-radius: 3px;
  background-color: var(--card);
  background-image: linear-gradient(180deg, transparent 0, transparent 47px, var(--rule-red) 47px, var(--rule-red) 48.5px, transparent 48.5px), repeating-linear-gradient(180deg, transparent 0, transparent 27px, rgba(130,160,185,.55) 27px, rgba(130,160,185,.55) 28px);
  background-position: 0 0, 0 20px;
  box-shadow: 0 1px 0 #fff inset, 0 0 0 1px #d9cca6, 0 10px 22px rgba(40,25,10,.28), 0 2px 3px rgba(40,25,10,.2); }
.kartei::after { content: ""; position: absolute; left: 50%; bottom: 11px; width: 15px; height: 15px; margin-left: -7px; border-radius: 50%; background: var(--paper-2); box-shadow: inset 0 2px 3px rgba(40,25,10,.55); }
.kartei-head { display: flex; justify-content: space-between; gap: 12px; height: 34px; align-items: flex-end; margin-bottom: 8px; white-space: nowrap; }
.kartei-head .who { text-transform: uppercase; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; }
.kartei-head .sig { color: var(--oxblood); flex: none; }
.kartei p { padding-left: 1.6em; text-indent: -1.6em; overflow-wrap: anywhere; }
.kartei .k-title { padding-left: 3.2em; text-indent: -1.6em; }
.kartei.lent { padding-bottom: 96px; }
.stamp { position: absolute; right: 18px; bottom: 26px; font-family: var(--f-sc); font-size: 20px; letter-spacing: .14em; line-height: 1.15; text-align: center; color: var(--oxblood); border: 3px double currentColor; padding: 4px 12px 2px; transform: rotate(-7deg); opacity: .82; mix-blend-mode: multiply; border-radius: 3px; }
.stamp small { display: block; font-size: 12.5px; letter-spacing: .08em; }

.prose { max-width: 38em; }
.prose p + p { margin-top: .7em; }
.prose.clamp { display: -webkit-box; -webkit-line-clamp: 6; line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.note-paper { font-family: var(--f-display); font-style: italic; font-size: 19px; padding: 10px 14px; border-left: 3px double var(--ink-faint); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Listen in "Mehr" ---------- */
.menu { list-style: none; margin: 0; padding: 0; border-top: 1px dotted rgba(95,79,59,.55); }
.menu li { border-bottom: 1px dotted rgba(95,79,59,.55); }
.menu a, .menu button { width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 2px; text-decoration: none; background: none; border: 0; text-align: left; }
.menu b { font-weight: 600; display: block; line-height: 1.2; }
.menu small { display: block; color: var(--ink-soft); font-style: italic; font-size: 16px; line-height: 1.3; }
.menu svg.i { width: 24px; height: 24px; color: var(--ink-soft); }
.statline { display: flex; gap: 10px 26px; flex-wrap: wrap; font-family: var(--f-display); font-size: 19px; }
.statline b { font-weight: 400; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; display: block; }
.statline span { color: var(--ink-soft); font-style: italic; }

/* ---------- Exlibris (Anmeldung, Einrichtung) ---------- */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-t) + 20px) 16px calc(var(--safe-b) + 20px); }
.exlibris { position: relative; width: 100%; max-width: 430px; padding: 44px 30px 60px; text-align: center; color: var(--ink);
  background-color: var(--paper); background-image: var(--tex-grain), radial-gradient(90% 70% at 50% 30%, rgba(255,250,230,.7), transparent 70%);
  box-shadow: 0 0 0 1px #b9a677, 0 18px 50px rgba(0,0,0,.65); }
.exlibris.wide { max-width: 560px; text-align: left; }
.exlibris::before { content: ""; position: absolute; inset: 10px; border: 2px solid var(--ink); pointer-events: none; }
.exlibris::after { content: ""; position: absolute; inset: 16px; border: 1px solid var(--ink); pointer-events: none; }
.exlibris > * { position: relative; }
.exlibris .corner { position: absolute; width: 34px; height: 34px; color: var(--ink); z-index: 1; }
.exlibris .corner.tl { left: 20px; top: 20px; } .exlibris .corner.tr { right: 20px; top: 20px; transform: scaleX(-1); }
.exlibris .corner.bl { left: 20px; bottom: 20px; transform: scaleY(-1); } .exlibris .corner.br { right: 20px; bottom: 20px; transform: scale(-1); }
.ex-over { font-family: var(--f-sc); letter-spacing: .42em; font-size: 17px; padding-left: .42em; color: var(--ink-soft); text-align: center; }
.ex-emblem { width: 120px; height: auto; margin: 12px auto 4px; color: var(--ink); display: block; }
.ex-name { font-family: var(--f-fraktur); font-size: clamp(34px, 10vw, 46px); line-height: 1.05; margin: 6px 0 4px; overflow-wrap: anywhere; text-align: center; }
.ex-line { width: 60%; margin: 14px auto 20px; height: 3px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.exlibris form { display: grid; gap: 16px; text-align: left; padding-inline: 8px; }
.exlibris .fine { margin-top: 18px; font-style: italic; font-size: 15.5px; color: var(--ink-soft); text-align: center; }
.exlibris h2 { font-size: 24px; margin-top: 8px; }
.exlibris fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }
.exlibris legend { font-family: var(--f-display); font-style: italic; font-size: 22px; padding: 0; margin-bottom: 2px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 16.5px; }
.checks li { display: flex; gap: 8px; align-items: baseline; }
.checks li::before { content: "✓"; color: var(--ok); font-weight: 600; }
.checks li.bad::before { content: "✗"; color: var(--oxblood); }
pre.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.4; background: #fbf7ea; border: 1px solid var(--paper-edge); padding: 10px; overflow-x: auto; white-space: pre; max-width: 100%; user-select: all; -webkit-user-select: all; }

/* ---------- Ebenen: Blatt von unten, Dialog ---------- */
#layer:empty { display: none; }
.backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(12,7,3,.62); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { width: 100%; max-width: 620px; max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; padding: 22px 18px calc(var(--safe-b) + 22px); border-radius: 10px 10px 0 0; color: var(--ink);
  background-color: var(--paper); background-image: var(--tex-grain), linear-gradient(180deg, rgba(255,250,230,.7), transparent 120px);
  box-shadow: 0 -10px 40px rgba(0,0,0,.6), inset 0 1px 0 #fff8df; animation: rise .22s cubic-bezier(.2,.8,.2,1); }
.sheet > * + * { margin-top: 14px; }
.sheet h2 { font-size: 27px; line-height: 1.1; }
.sheet-grip { width: 44px; height: 4px; border-radius: 2px; background: var(--ink-faint); opacity: .6; margin: -8px auto 12px; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 4px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.picklist { list-style: none; margin: 0; padding: 0; }
.picklist h3 { font-family: var(--f-sc); font-size: 14px; letter-spacing: .1em; color: var(--ink-soft); margin: 14px 0 2px; }
.picklist button { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px dotted rgba(95,79,59,.55); padding: 12px 4px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 19px; }
.picklist button small { font-family: var(--f-sc); font-size: 13px; letter-spacing: .06em; color: var(--ink-soft); white-space: nowrap; }
.picklist button[aria-current="true"] { font-weight: 600; }
.cand { display: grid; grid-template-columns: 50px minmax(0,1fr); gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px dotted rgba(95,79,59,.55); padding: 10px 2px; }

.scanning #toasts { top: calc(var(--safe-t) + 124px); }
#toasts { position: fixed; z-index: 120; left: 0; right: 0; top: calc(var(--safe-t) + 62px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 520px; padding: 10px 18px; border-radius: 3px; font-size: 17.5px; line-height: 1.3; text-align: center; color: var(--brass-light);
  background-color: var(--leather); background-image: var(--tex-leather); box-shadow: inset 0 0 0 3px var(--leather), inset 0 0 0 4px rgba(237,213,145,.5), 0 8px 22px rgba(0,0,0,.5); animation: rise .2s ease; }
.toast.bad { background-color: var(--oxblood); box-shadow: inset 0 0 0 3px var(--oxblood), inset 0 0 0 4px rgba(246,231,207,.5), 0 8px 22px rgba(0,0,0,.5); color: #f6e7cf; }
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; font-family: var(--f-sc); letter-spacing: .06em; margin-left: 10px; padding: 4px; }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(95,79,59,.25); border-top-color: var(--oxblood); animation: spin .8s linear infinite; margin: 8px auto; }
.on-dark .spinner, .scanner .spinner { border-color: rgba(237,213,145,.25); border-top-color: var(--brass-light); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Scanner ---------- */
.scanner { position: fixed; inset: 0; z-index: 70; background: #000; color: #f3e6c4; display: flex; flex-direction: column; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-top { position: relative; z-index: 2; padding: calc(var(--safe-t) + 10px) 12px 26px; display: flex; align-items: flex-start; gap: 10px; background: linear-gradient(180deg, rgba(10,6,3,.88), rgba(10,6,3,0)); }
.scan-shelf { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: left; border: 0; padding: 7px 14px 6px; border-radius: 2px; color: #2c1e07;
  background: linear-gradient(180deg, #f0d88f, #c9a552 55%, #b08a35); box-shadow: 0 0 0 1px #5b4314, 0 3px 8px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.6); }
.scan-shelf small { font-family: var(--f-sc); font-size: 12.5px; letter-spacing: .12em; opacity: .85; }
.scan-shelf strong { font-family: var(--f-display); font-weight: 400; font-size: 19px; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-shelf.none { background: rgba(20,12,6,.72); color: var(--brass-light); box-shadow: inset 0 0 0 1px rgba(237,213,145,.6); }
.scanner .iconbtn { color: #f3e6c4; background: rgba(20,12,6,.6); box-shadow: inset 0 0 0 1px rgba(237,213,145,.45); }
.scanner .iconbtn[aria-pressed="true"] { background: var(--brass); color: #2c1e07; }
.scanner .scan-sheet .iconbtn { background: none; box-shadow: none; color: var(--ink-soft); }
.scan-stage { position: relative; z-index: 1; flex: 1; display: grid; place-items: center; padding: 0 28px; pointer-events: none; }
.finder { position: relative; width: min(100%, 420px); aspect-ratio: 5 / 3; box-shadow: 0 0 0 100vmax rgba(8,5,2,.5); border-radius: 6px; }
.finder i { position: absolute; width: 34px; height: 34px; border: 3px solid var(--brass-light); filter: drop-shadow(0 1px 2px rgba(0,0,0,.8)); }
.finder i:nth-child(1) { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.finder i:nth-child(2) { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.finder i:nth-child(3) { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.finder i:nth-child(4) { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.finder::after { content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 1.5px; background: rgba(237,213,145,.85); box-shadow: 0 0 8px rgba(237,213,145,.9); animation: sweep 2.4s ease-in-out infinite; }
@keyframes sweep { 0%, 100% { transform: translateY(-46px); opacity: .4; } 50% { transform: translateY(46px); opacity: 1; } }
.finder.hit { box-shadow: 0 0 0 100vmax rgba(8,5,2,.5), 0 0 0 3px #9fd39f; }
.scan-hint { position: absolute; left: 0; right: 0; top: calc(50% + min(28vw, 140px) + 14px); text-align: center; font-style: italic; font-size: 17px; text-shadow: 0 1px 3px #000; padding: 0 24px; }
.scan-msg { position: relative; z-index: 2; margin: auto; max-width: 420px; padding: 24px; text-align: center; pointer-events: auto; }
.scan-msg h2 { font-size: 26px; color: var(--brass-light); margin-bottom: 8px; }
.scan-msg .btnrow { justify-content: center; margin-top: 16px; }
.scan-bottom { position: relative; z-index: 2; padding: 30px 14px calc(var(--safe-b) + 16px); display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; background: linear-gradient(0deg, rgba(10,6,3,.9), rgba(10,6,3,0)); }
.scan-tool { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 68px; background: none; border: 0; color: #f3e6c4; font-family: var(--f-sc); font-size: 12.5px; letter-spacing: .07em; padding: 4px; }
.scan-tool span.ring { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: rgba(20,12,6,.66); box-shadow: inset 0 0 0 1px rgba(237,213,145,.5); }
.scan-tool[aria-pressed="true"] span.ring { background: var(--brass); color: #2c1e07; }
.scan-tool svg.i { width: 24px; height: 24px; }
.scan-count { position: absolute; z-index: 2; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 92px); font-family: var(--f-sc); letter-spacing: .08em; font-size: 14px; background: rgba(20,12,6,.7); padding: 3px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(237,213,145,.4); white-space: nowrap; }
.scan-sheet { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; pointer-events: none; }
.scan-sheet .sheet { pointer-events: auto; max-height: 76vh; max-height: 76dvh; }
.result { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 14px; align-items: start; }
.result h2 { font-size: 23px; overflow-wrap: anywhere; }
.result.compact { grid-template-columns: auto minmax(0,1fr) auto; align-items: center; }
.result.compact h2 { font-size: 20px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result.compact .iconbtn { align-self: start; margin: -8px -8px 0 0; }
.result .by { font-style: italic; color: var(--ink-soft); }
.result .meta { font-family: var(--f-type); font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
.shelved { display: flex; align-items: center; gap: 8px; color: #21422a; font-size: 17.5px; line-height: 1.3; }
.shelved svg.i { width: 26px; height: 26px; color: var(--ok); stroke-width: 2.2; }

/* ---------- Etiketten ---------- */
.labelsheet { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(var(--lw, 250px), 1fr)); }
.label { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 11px 10px 10px 13px; background: #fff; color: #111; border: 1px solid #111; break-inside: avoid; page-break-inside: avoid; min-width: 0; }
.label::before { content: ""; position: absolute; inset: 3px; border: 1px solid #111; pointer-events: none; }
.label > div:first-child { min-width: 0; }
.label .l-lib { font-family: var(--f-sc); font-size: 9.5px; letter-spacing: .1em; white-space: nowrap; overflow: hidden; }
.label .l-name { font-family: var(--f-display); font-size: 18px; line-height: 1.08; margin-top: 3px; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.label .l-name.blank { height: 2.3em; border-bottom: 1px dotted #555; }
.label .l-room { font-family: var(--f-display); font-style: italic; font-size: 14px; margin-top: 2px; }
.label .l-code { font-family: var(--f-type); font-size: 10.5px; margin-top: 5px; letter-spacing: .08em; }
.label .l-qr { width: 84px; height: 84px; }
.label .l-qr svg { width: 100%; height: 100%; display: block; }
.label.small { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 8px 8px 9px; gap: 2px; }
.label.small .l-name { font-size: 14.5px; }
.label.small .l-room { font-size: 12.5px; }
.label.small .l-qr { width: 88px; height: 88px; order: -1; }
.label.large { padding: 16px 14px 14px 18px; }
.label.large .l-lib { font-size: 12px; }
.label.large .l-name { font-size: 25px; }
.label.large .l-room { font-size: 18px; }
.label.large .l-code { font-size: 12.5px; }
.label.large .l-qr { width: 118px; height: 118px; }
.labelpick { display: grid; gap: 0; }
.labelpick label { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px dotted rgba(95,79,59,.55); }
input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; flex: none; border: 1.5px solid var(--ink-soft); border-radius: 2px; background: rgba(255,252,240,.6); display: inline-grid; place-items: center; margin: 0; }
input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:checked::after { content: ""; width: 12px; height: 6px; border-left: 2.5px solid var(--paper); border-bottom: 2.5px solid var(--paper); transform: rotate(-45deg) translate(1px,-1px); }
.qrbig { width: min(100%, 260px); margin: 0 auto; background: #fff; padding: 14px; border: 1px solid #111; }
.qrbig svg { width: 100%; height: auto; display: block; }
.linkbox { font-family: var(--f-type); font-size: 14px; word-break: break-all; background: rgba(255,252,240,.6); border: 1px dashed var(--ink-faint); padding: 8px 10px; user-select: all; -webkit-user-select: all; }

/* ---------- Nur Geräte mit Mauszeiger: Schwebe-Effekte (auf dem Handy blieben sie sonst „kleben“) ---------- */
@media (hover: hover) {
  .back:hover { color: var(--oxblood); }
  .btn:hover { background: rgba(42,32,23,.06); }
  .btn-brass:hover { background: linear-gradient(180deg, #f8e6ab, #dfbd69 45%, #c29c48); }
  .btn-oxblood:hover { background: linear-gradient(180deg, #8f2b35, #7a232c); }
  .btn-leather:hover { background-color: var(--leather-light); }
  .btn-text:hover { background: none; color: var(--oxblood); }
  .iconbtn:hover { background: rgba(42,32,23,.08); }
  .bookrow:hover .bookrow-title { color: var(--oxblood); }
  a.spine:hover { transform: translateY(-8px); }
  .menu a:hover b, .menu button:hover b { color: var(--oxblood); }
  .picklist button:hover { color: var(--oxblood); }
  .cand:hover .bookrow-title { color: var(--oxblood); }
}

/* ---------- Breitere Bildschirme ---------- */
@media (min-width: 700px) {
  .page { padding-inline: 34px; }
  .topbar { padding-inline: 34px; }
  .pagehead h1 { font-size: 40px; }
  .formgrid { gap: 18px 22px; }
  .cover.big { width: 150px; }
  .bookhead h1 { font-size: 38px; }
  .booklist.cols { columns: 2; column-gap: 34px; }
  .booklist.cols li { break-inside: avoid; }
}
@media (max-width: 380px) {
  body { font-size: 17px; }
  .tab { font-size: 12px; letter-spacing: .04em; }
  .pagehead h1 { font-size: 30px; }
  .formgrid > .third { grid-column: span 3; }
  .exlibris { padding-inline: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Druck: nur die Etiketten ---------- */
@media print {
  body { background: #fff !important; }
  .topbar, .tabbar, #toasts, #layer, .noprint { display: none !important; }
  html, body { height: auto; min-height: 0; }
  .shell { max-width: none; min-height: 0; box-shadow: none; display: block; }
  .page { background: #fff !important; padding: 0 !important; min-height: 0; }
  .page > * + * { margin-top: 0; }
  .labelsheet { gap: 4mm; grid-template-columns: repeat(auto-fill, minmax(var(--lwp, 58mm), 1fr)); }
  @page { margin: 10mm; }
}
