:root {
  color-scheme: light;
  --bg: #f6f0e5;
  --surface: #fffdf8;
  --surface-2: #eee5d6;
  --text: #1f2c26;
  --muted: #66716b;
  --border: #ded4c5;
  --primary: #214f3b;
  --primary-2: #2f6d52;
  --primary-soft: #e2eee8;
  --accent: #b77a3b;
  --danger: #a63d40;
  --warning: #b56b16;
  --success: #2c7a50;
  --shadow: 0 18px 50px rgba(49, 42, 31, .10);
  --radius: 20px;
  --radius-sm: 13px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111814;
  --surface: #18221d;
  --surface-2: #243129;
  --text: #edf4ef;
  --muted: #aab8b0;
  --border: #33433a;
  --primary: #8bc3a7;
  --primary-2: #a8d7bf;
  --primary-soft: #253d31;
  --accent: #d5a467;
  --danger: #ef8d91;
  --warning: #f0b462;
  --success: #88d3a8;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 85% -10%, rgba(183,122,59,.12), transparent 35%), var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: var(--primary); }
.hidden { display: none !important; }

#app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 24px 18px; display: flex; flex-direction: column; z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 26px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--primary); color: var(--surface); font-weight: 800; letter-spacing: -.04em;
}
.brand strong { display: block; font-size: 1.13rem; }
.brand span { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.desktop-nav { display: grid; gap: 7px; }
.nav-item {
  border: 0; background: transparent; color: var(--muted); display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 12px; text-align: left; font-weight: 650;
}
.nav-item span { width: 20px; text-align: center; font-size: 1.15rem; }
.nav-item:hover, .nav-item.active { color: var(--primary); background: var(--primary-soft); }
.sidebar-footer { margin-top: auto; }
.connection-card {
  display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 12px;
}
.connection-card strong, .connection-card span { display: block; }
.connection-card strong { font-size: .82rem; }
.connection-card span { color: var(--muted); font-size: .72rem; margin-top: 2px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(44,122,80,.12); }
.status-dot.offline { background: var(--warning); box-shadow: 0 0 0 4px rgba(181,107,22,.12); }

.main-content { min-width: 0; padding: 0 36px 70px; }
.topbar {
  min-height: 104px; display: flex; justify-content: space-between; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 8; background: color-mix(in srgb, var(--bg) 87%, transparent); backdrop-filter: blur(16px);
}
.topbar h1 { margin: 2px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3vw, 2.55rem); letter-spacing: -.035em; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .68rem; font-weight: 800; color: var(--accent); margin: 0; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.view-root { max-width: 1480px; margin: 0 auto; }

.button, .icon-button, .mini-button {
  border: 1px solid transparent; border-radius: 12px; font-weight: 750; transition: transform .15s ease, background .15s ease;
}
.button:hover, .icon-button:hover, .mini-button:hover { transform: translateY(-1px); }
.button { padding: 11px 16px; }
.button.primary { background: var(--primary); color: var(--surface); }
.button.ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.button.danger { background: var(--danger); color: #fff; }
.button.small { padding: 8px 11px; font-size: .84rem; }
.icon-button { width: 42px; height: 42px; background: var(--surface); border-color: var(--border); color: var(--text); font-size: 1.2rem; }
.mini-button { padding: 7px 9px; background: var(--primary-soft); color: var(--primary); }

.hero {
  background: linear-gradient(125deg, var(--primary), #12372a); color: #f8fbf9; border-radius: 28px; padding: clamp(24px, 5vw, 48px);
  display: grid; grid-template-columns: 1.5fr .9fr; gap: 28px; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; width: 330px; height: 330px; border-radius: 50%; right: -120px; top: -170px; background: rgba(255,255,255,.08); }
.hero h2 { font-family: Georgia, serif; font-size: clamp(2rem, 4.5vw, 3.6rem); line-height: 1.02; margin: 8px 0 15px; letter-spacing: -.04em; }
.hero p { color: rgba(255,255,255,.78); max-width: 62ch; line-height: 1.65; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero .button.primary { background: #f7f1e6; color: #183e2f; }
.hero .button.ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.2); }
.hero-visual { display: grid; place-items: center; z-index: 1; }
.book-stack { position: relative; width: 220px; height: 220px; }
.book-spine { position: absolute; width: 145px; height: 38px; border-radius: 7px 3px 3px 7px; box-shadow: 0 10px 20px rgba(0,0,0,.18); }
.book-spine:nth-child(1){ background:#d9b47a; top:40px; left:20px; transform:rotate(-7deg); }
.book-spine:nth-child(2){ background:#f2e7cf; top:92px; left:48px; transform:rotate(5deg); }
.book-spine:nth-child(3){ background:#9ab6a6; top:145px; left:22px; transform:rotate(-2deg); }

.section { margin-top: 28px; }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.section-header h2 { font-family: Georgia, serif; font-size: 1.55rem; margin: 0; }
.section-header p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 14px; margin-top: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card span { color: var(--muted); font-size: .8rem; }
.stat-card strong { display: block; font-family: Georgia, serif; font-size: 2rem; margin-top: 8px; }
.stat-icon { float: right; background: var(--primary-soft); color: var(--primary); border-radius: 10px; width: 34px; height: 34px; display: grid; place-items: center; }

.toolbar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 17px;
}
.search-box { flex: 1 1 280px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 0 12px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); padding: 11px 0; }
.toolbar select { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 10px 11px; border-radius: 11px; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.book-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 30px rgba(48,42,33,.04);
  display: flex; flex-direction: column; min-width: 0;
}
.book-cover-wrap { aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--surface-2), var(--primary-soft)); display: grid; place-items: center; overflow: hidden; position: relative; }
.book-cover { height: 88%; max-width: 70%; object-fit: cover; border-radius: 4px 9px 9px 4px; box-shadow: 0 12px 25px rgba(0,0,0,.22); }
.cover-placeholder { width: 62%; height: 82%; background: var(--primary); border-radius: 4px 9px 9px 4px; color: var(--surface); display: grid; place-items: center; padding: 12px; text-align: center; font-family: Georgia, serif; box-shadow: 0 12px 25px rgba(0,0,0,.2); }
.sync-badge { position: absolute; top: 10px; right: 10px; background: rgba(25,31,27,.75); color: white; border-radius: 999px; padding: 4px 8px; font-size: .68rem; }
.book-body { padding: 15px; display: flex; flex-direction: column; flex: 1; }
.book-body h3 { margin: 0; font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.25; }
.book-author { color: var(--muted); font-size: .83rem; margin: 6px 0 13px; min-height: 2em; }
.book-meta { display: flex; gap: 7px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; background: var(--surface-2); color: var(--muted); font-size: .7rem; font-weight: 700; }
.pill.primary { color: var(--primary); background: var(--primary-soft); }
.stars { color: #c98b2d; font-size: .8rem; letter-spacing: .02em; }
.book-actions { display: flex; gap: 7px; margin-top: auto; padding-top: 15px; }
.book-actions .button { flex: 1; }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 17px; }
.library-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: relative; }
.library-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.library-icon { width: 52px; height: 52px; display: grid; place-items: center; background: var(--primary-soft); border-radius: 15px; font-size: 1.6rem; }
.library-card h3 { font-family: Georgia, serif; margin: 14px 0 5px; font-size: 1.25rem; }
.library-card p { color: var(--muted); font-size: .86rem; min-height: 2.7em; }
.library-card footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.library-card .menu { display: flex; gap: 7px; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .65fr); gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 21px; }
.panel + .panel { margin-top: 16px; }
.panel h2, .panel h3 { margin-top: 0; font-family: Georgia, serif; }
.panel p { color: var(--muted); line-height: 1.55; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 13px 0; border-top: 1px solid var(--border); }
.setting-row:first-of-type { border-top: 0; }
.setting-row strong { display: block; }
.setting-row span { display: block; color: var(--muted); font-size: .8rem; margin-top: 3px; }
.theme-switch { display: flex; gap: 5px; background: var(--surface-2); padding: 4px; border-radius: 11px; }
.theme-switch button { border: 0; background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 8px; }
.theme-switch button.active { background: var(--surface); color: var(--text); box-shadow: 0 3px 9px rgba(0,0,0,.08); }
.code-box { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; background: var(--surface-2); border-radius: 10px; padding: 12px; word-break: break-all; }

.empty-state { text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 46px 20px; }
.empty-icon { font-size: 2.7rem; }
.empty-state h3 { font-family: Georgia, serif; font-size: 1.35rem; margin: 12px 0 7px; }
.empty-state p { color: var(--muted); max-width: 52ch; margin: 0 auto 18px; }

.modal { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(95vw, 760px); width: 100%; }
.modal::backdrop { background: rgba(18,25,21,.62); backdrop-filter: blur(4px); }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); padding: 22px; max-height: 90vh; overflow: auto; }
.modal-card.large { width: min(94vw, 780px); }
.modal-card.compact { width: min(92vw, 450px); }
.modal-header { display: flex; justify-content: space-between; gap: 14px; align-items: start; margin-bottom: 20px; }
.modal-header h2 { font-family: Georgia, serif; margin: 5px 0 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; }
.field > span { font-size: .77rem; font-weight: 750; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 11px; padding: 11px 12px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.span-2 { grid-column: span 2; }
.checkbox-field { display: flex; align-items: center; gap: 9px; align-self: end; padding-bottom: 10px; }
.checkbox-field input { width: auto; }
.input-action { display: flex; gap: 7px; }
.form-message { background: var(--primary-soft); color: var(--primary); border-radius: 11px; padding: 12px; margin-top: 14px; font-size: .85rem; }
.form-message.error { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); }
.helper-text { color: var(--muted); font-size: .85rem; line-height: 1.45; }
.inline-form { display: flex; gap: 9px; }
.inline-form input { flex: 1; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 11px; padding: 11px 12px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .75rem; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.scanner-modal { max-width: min(96vw, 680px); }
.scanner-card { overflow: hidden; }
.scanner-region {
  height: clamp(310px, 58vh, 520px);
  background: #090d0b;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}
#reader { position: absolute; inset: 0; width: 100%; height: 100%; }
#reader > div, #reader video, #native-scanner-video { width: 100% !important; height: 100% !important; max-height: none !important; object-fit: cover; }
#native-scanner-video { position: absolute; inset: 0; }
#reader canvas { max-width: 100% !important; }
#reader button { border: 0; border-radius: 10px; padding: 9px 12px; }
#reader select { padding: 8px; border-radius: 9px; }
.scan-guide {
  position: absolute;
  z-index: 4;
  width: min(90%, 570px);
  height: clamp(108px, 25%, 155px);
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 16px;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0,0,0,.28), 0 0 24px rgba(255,255,255,.13);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.scan-guide::before, .scan-guide::after { content: ""; position: absolute; inset: -3px; border-radius: 18px; border-inline: 5px solid rgba(255,255,255,.96); }
.scan-line {
  position: absolute; left: 4%; right: 4%; top: 50%; height: 2px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 10px rgba(255,255,255,.75);
  animation: barcode-scan-line 1.8s ease-in-out infinite;
}
@keyframes barcode-scan-line { 0%,100% { transform: translateY(-42px); opacity: .45; } 50% { transform: translateY(42px); opacity: 1; } }
.scanner-region.scan-success .scan-guide { border-color: #65e39a; box-shadow: 0 0 0 999px rgba(0,0,0,.24), 0 0 30px rgba(101,227,154,.55); }
.scanner-region.scan-success .scan-line { background: #65e39a; animation: none; transform: none; }
.scanner-region.scan-error .scan-guide { border-color: #ff8d8d; }
.scanner-status { min-height: 2.6em; margin: 11px 1px 0; }
.scanner-status.success { color: #22784b; font-weight: 650; }
.scanner-status.warning { color: #99671a; }
.scanner-status.error { color: var(--danger); }
.scanner-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.button.compact { padding: 8px 11px; font-size: .82rem; }

.toast-region { position: fixed; right: 20px; bottom: 24px; display: grid; gap: 9px; z-index: 100; }
.toast { background: var(--text); color: var(--surface); border-radius: 12px; padding: 12px 15px; box-shadow: var(--shadow); max-width: min(360px, calc(100vw - 40px)); animation: toast-in .22s ease; }
.toast.error { background: var(--danger); color: white; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.mobile-nav { display: none; }

@media (max-width: 1050px) {
  #app-shell { grid-template-columns: 84px 1fr; }
  .brand > div:last-child, .nav-item:not(.active) { }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > div:last-child { display: none; }
  .nav-item { justify-content: center; padding: 12px 6px; font-size: 0; }
  .nav-item span { font-size: 1.25rem; }
  .connection-card > div { display: none; }
  .connection-card { justify-content: center; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  #app-shell { display: block; }
  .sidebar { display: none; }
  .main-content { padding: 0 15px 28px; }
  .topbar { min-height: 86px; }
  .topbar-actions .button { display: none; }
  .topbar h1 { font-size: 1.8rem; }
  .mobile-nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
    background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--border); backdrop-filter: blur(18px);
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  }
  .mobile-nav-item { border: 0; background: transparent; color: var(--muted); display: grid; justify-items: center; gap: 2px; padding: 5px 2px; }
  .mobile-nav-item span { font-size: 1.15rem; }
  .mobile-nav-item small { font-size: .64rem; }
  .mobile-nav-item.active { color: var(--primary); }
  .scan-nav span { width: 42px; height: 42px; margin-top: -22px; border-radius: 50%; background: var(--primary); color: var(--surface); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(33,79,59,.3); }
  .hero { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .stats-grid { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .book-cover-wrap { aspect-ratio: 1 / 1; }
  .book-body { padding: 11px; }
  .book-author { font-size: .74rem; }
  .book-actions { display: grid; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .inline-form { flex-direction: column; }
  .modal { max-width: 96vw; }
  .modal-card { padding: 18px; border-radius: 20px; }
}

@media (max-width: 420px) {
  .book-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
  .stat-card strong { font-size: 1.65rem; }
}

@media (max-width: 640px) {
  .scanner-modal { width: 100vw; max-width: 100vw; margin: 0; max-height: 100dvh; }
  .scanner-modal .scanner-card { min-height: 100dvh; border-radius: 0; }
  .scanner-region { height: min(56dvh, 500px); border-radius: 14px; }
  .scan-guide { width: 92%; height: 120px; }
}

/* HomeLib 1.2 – kompakte Buchkarten und reine Detailansicht */
.book-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 14px; }
.book-card { cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.book-card:hover, .book-card:focus-visible { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: 0 12px 32px rgba(48,42,33,.1); outline: none; }
.book-cover-wrap { aspect-ratio: 4 / 3.4; }
.book-body { padding: 12px; }
.book-body h3 {
  font-size: .98rem; line-height: 1.25; overflow: hidden; display: -webkit-box;
  -webkit-box-orient: vertical; -webkit-line-clamp: 4;
}
.book-author { font-size: .76rem; margin: 5px 0 7px; min-height: 0; }
.book-series { color: var(--primary); font-size: .72rem; font-weight: 700; line-height: 1.3; margin: 0 0 8px; }
.book-meta { margin-top: auto; }
.book-card .stars { margin-top: 7px; }

.book-details-layout { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 24px; align-items: start; }
.details-cover-wrap { min-height: 240px; border-radius: 18px; background: linear-gradient(135deg, var(--surface-2), var(--primary-soft)); display: grid; place-items: center; padding: 16px; }
.details-cover { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 5px 11px 11px 5px; box-shadow: 0 14px 30px rgba(0,0,0,.2); }
.details-cover.cover-placeholder { min-height: 250px; color: var(--surface); }
.details-full-title { font-family: Georgia, serif; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.18; margin: 0; overflow-wrap: anywhere; }
.details-authors { color: var(--muted); font-size: 1rem; margin: 10px 0; }
.details-series { color: var(--primary); font-weight: 750; margin: 0 0 14px; }
.details-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 17px; }
.details-list { margin: 0; display: grid; gap: 0; }
.details-list > div { display: grid; grid-template-columns: minmax(110px, .4fr) 1fr; gap: 15px; padding: 9px 0; border-top: 1px solid var(--border); }
.details-list dt { color: var(--muted); font-size: .78rem; font-weight: 700; }
.details-list dd { margin: 0; overflow-wrap: anywhere; }
.details-section { margin-top: 21px; padding-top: 18px; border-top: 1px solid var(--border); }
.details-section h3 { font-family: Georgia, serif; margin: 0 0 8px; }
.details-section p { white-space: pre-wrap; line-height: 1.6; margin: 0; }

.scanner-region { cursor: crosshair; }
#reader > div, #reader video, #native-scanner-video { object-fit: contain; background: #090d0b; }
.scanner-zoom { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 9px; color: var(--muted); font-size: .8rem; }
.scanner-zoom input { width: 100%; accent-color: var(--primary); }
.scanner-photo-button { cursor: pointer; }

@media (max-width: 760px) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .book-cover-wrap { aspect-ratio: 1 / 1; }
  .book-cover { height: 84%; max-width: 76%; }
  .book-body { padding: 9px; }
  .book-body h3 { font-size: .84rem; line-height: 1.22; -webkit-line-clamp: 4; }
  .book-author { font-size: .68rem; }
  .book-series { font-size: .65rem; }
  .book-card .pill { font-size: .58rem; padding: 4px 6px; }
  .book-card .stars { font-size: .67rem; }
  .book-details-layout { grid-template-columns: 105px minmax(0, 1fr); gap: 14px; }
  .details-cover-wrap { min-height: 150px; padding: 9px; border-radius: 13px; }
  .details-cover { max-height: 210px; }
  .details-cover.cover-placeholder { min-height: 150px; font-size: .72rem; padding: 8px; }
  .details-full-title { font-size: 1.18rem; }
  .details-authors { font-size: .84rem; }
  .details-list > div { grid-template-columns: 1fr; gap: 3px; }
  .book-details-card .modal-footer { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .book-body { padding: 8px; }
  .book-body h3 { font-size: .8rem; }
  .book-details-layout { grid-template-columns: 90px minmax(0, 1fr); gap: 11px; }
}

/* HomeLib 1.2.2 – verständliche Synchronisationseinrichtung */
.panel-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.panel-title-row h2 { margin-bottom: 6px; }
.panel-title-row p { margin-top: 0; }
.setup-status { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.setup-status.warning { background: #fff1d6; color: #7a4b00; border: 1px solid #e7c980; }
.setup-status.success { background: #e4f4e9; color: #175b35; border: 1px solid #a9d5b8; }
.setup-notice { margin: 14px 0; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); }
.setup-notice p { margin: 6px 0 0; }
.success-notice { background: #e9f7ed; border-color: #b7ddc2; color: #174d2d; }
.setup-guide { margin: 14px 0 18px; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--surface-soft); }
.setup-guide summary { cursor: pointer; font-weight: 800; }
.setup-guide ol { margin: 14px 0 8px; padding-left: 22px; }
.setup-guide li { margin: 9px 0; line-height: 1.45; }
.setup-guide a { color: var(--accent); font-weight: 700; }
.account-locked { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0 16px; padding: 14px; border: 1px dashed var(--border); border-radius: 14px; background: var(--surface-soft); }
.account-locked p { margin: 5px 0 0; }
.lock-icon { font-size: 1.35rem; }
.sync-setup-panel.needs-setup { box-shadow: 0 0 0 2px color-mix(in srgb, #d79a22 30%, transparent); }
@media (max-width: 520px) {
  .panel-title-row { flex-direction: column; }
  .setup-status { align-self: flex-start; }
}

.details-original-title { margin: 0; color: var(--text); line-height: 1.45; }
.details-original-title span { display: block; margin-bottom: 3px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
