/* haudiobook — Oberflaeche nach dem Design-System des jellyfin_downloader
   (Design-System "Modernist": Archivo, Rot #ec3013 auf hellem Grund, 2px-Linien, keine Rundungen,
   Beschriftungen in Versalien mit Sperrung, alles linksbuendig). Kein Framework, nur diese Datei. */

/* ------------------------------------------------------------------ Tokens (Modernist) */
:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);

  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #fff2ef;
  --color-accent-200: #ffe0d9;
  --color-accent-300: #ffc4b8;
  --color-accent-400: #ff9783;
  --color-accent-500: #ff563c;
  --color-accent-600: #dd2b0f;
  --color-accent-700: #ae1800;
  --color-accent-800: #7c1405;
  --color-accent-900: #4d170e;

  --font-heading: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading-weight: 800;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);

  --page-x: 40px;
  --header-h: 58px;
  color-scheme: light;
}

/* ------------------------------------------------------------------ Grundlagen */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--color-bg); color: var(--color-text);
  font: 400 15px/1.55 var(--font-body);
}
h1, h2, h3, h4 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-600); }
img { display: block; max-width: 100%; }
figure { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
code {
  font-family: var(--font-mono); font-size: 10.5px; text-transform: none; letter-spacing: 0;
  background: var(--color-surface); border: 1px solid var(--color-divider); padding: 1px 6px;
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
[hidden] { display: none !important; }

/* Beschriftungen */
.kicker { font-size: 11px; letter-spacing: 0.14em; color: var(--color-accent-700); font-weight: 600; text-transform: uppercase; margin-bottom: 10px; }
.label { font-size: 12px; letter-spacing: 0.1em; font-weight: 600; text-transform: uppercase; }
.label-muted { font-size: 11px; letter-spacing: 0.08em; color: var(--color-neutral-600); text-transform: uppercase; font-weight: 400; }
.muted { color: var(--color-neutral-600); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: 10.5px; color: var(--color-neutral-600); overflow-wrap: anywhere; }
.hr { height: 2px; border: 0; background: var(--color-divider); margin: 22px 0; }
.display { font-size: 64px; letter-spacing: -0.02em; margin: 0 0 26px; text-transform: uppercase; line-height: 1; }
.display-sm { font-size: 54px; margin-bottom: 8px; }

/* htmx-Ladeanzeige: schmaler Balken mit laufender Marke */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }
.loading { height: 2px; background: var(--color-neutral-300); position: relative; overflow: hidden; margin: 14px 0; }
.loading::after { content: ""; position: absolute; top: 0; left: -30%; width: 30%; height: 100%; background: var(--color-accent); animation: slide 1.2s linear infinite; }
@keyframes slide { from { left: -30%; } to { left: 100%; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ Bausteine (Modernist) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-text); background: transparent; border: 1px solid transparent;
  padding: var(--space-2) 14px;
}
.btn svg { display: block; flex: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); border-color: var(--color-accent); }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-600); border-color: var(--color-accent-600); color: var(--color-bg); }
.btn-primary:active:not(:disabled) { background: var(--color-accent-700); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active:not(:disabled) { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-sm { font-size: 11px; letter-spacing: 0.05em; padding: 5px 12px; font-weight: 600; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 14px; }
.btn-block { width: 100%; justify-content: flex-start; }
.btn-chip { font-size: 12px; padding: 3px 10px; text-transform: none; letter-spacing: 0; font-weight: 600; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; line-height: 1.4;
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; padding: 3px 8px;
}
.tag-neutral { background: var(--color-neutral-200); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent-700); padding: 2px 7px; }
.tag-ink { background: var(--color-neutral-900); color: var(--color-neutral-100); }
.tag-accent { background: var(--color-accent); color: var(--color-bg); }
.tag.is-off { opacity: 0.55; }

.field > label { display: block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; margin-bottom: 5px; color: var(--color-neutral-800); }
.field > label .note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--color-neutral-500); }
.input {
  width: 100%; min-height: 36px; padding: 6px 12px; font: inherit; font-size: 14px;
  color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: 0;
  appearance: none; -webkit-appearance: none;
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.input::placeholder { color: var(--color-neutral-500); }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
select.input {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23201e1d' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* Fortschrittsbalken */
.bar { height: 6px; background: var(--color-neutral-300); width: 100%; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--color-accent); transition: width 0.4s linear; }
.bar.indeterminate > i { width: 30%; animation: slide 1.4s ease-in-out infinite; position: relative; }
.bar-text { font-size: 11px; color: var(--color-neutral-600); margin-top: 5px; letter-spacing: 0.04em; }

/* ------------------------------------------------------------------ Kopfzeile, Seite, Fusszeile */
.nav {
  display: flex; align-items: center; gap: 26px; padding: 14px var(--page-x);
  position: sticky; top: 0; z-index: 20; background: var(--color-bg);
  border-bottom: 2px solid var(--color-divider);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; color: inherit; }
.brand:hover { color: inherit; }
.brand-mark { width: 26px; height: 26px; background: var(--color-accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { display: block; }
.brand-text { font-family: var(--font-heading); font-weight: 800; font-size: 15px; letter-spacing: 0.01em; text-transform: uppercase; }
.nav-link {
  display: flex; align-items: center; gap: 7px; padding: 6px 0; text-decoration: none;
  font-family: var(--font-heading); font-weight: 600; font-size: 12.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--color-text); white-space: nowrap;
}
.nav-link::before { content: ""; width: 7px; height: 7px; background: var(--color-accent); display: none; }
.nav-link.is-active::before { display: inline-block; }
.nav-link:hover { color: var(--color-accent-700); }
.nav-link.is-muted { color: var(--color-neutral-600); }
.nav-link.is-muted:hover { color: var(--color-accent-700); }
.badge { background: var(--color-accent); color: var(--color-bg); font-size: 10px; font-weight: 800; padding: 1px 6px; line-height: 1.5; }

.page { flex: 1; padding: 36px var(--page-x) 72px; }
.section { scroll-margin-top: calc(var(--header-h) + 12px); }
.section + .section { margin-top: 56px; }

.foot {
  border-top: 2px solid var(--color-divider); padding: 14px var(--page-x);
  display: flex; flex-wrap: wrap; gap: 8px 26px; align-items: center;
  font-size: 11px; letter-spacing: 0.08em; color: var(--color-neutral-700); text-transform: uppercase;
}
.foot span { display: flex; gap: 7px; align-items: center; }

/* ------------------------------------------------------------------ Suche */
.search-form { display: flex; gap: 8px; max-width: 980px; }
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--color-neutral-600); pointer-events: none; }
.search-box .input { height: 54px; font-size: 17px; padding: 0 16px 0 46px; }
.search-form .btn-primary { height: 54px; padding: 0 34px; font-size: 15px; letter-spacing: 0.05em; }
.recent { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: 11px; letter-spacing: 0.08em; color: var(--color-neutral-600); text-transform: uppercase; }

.section-rule {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 2px solid var(--color-divider); padding-top: 12px; margin: 44px 0 14px;
}
.rposter { aspect-ratio: 5 / 7; background: var(--color-neutral-300); overflow: hidden; }
.rposter-empty {
  height: 100%; display: flex; align-items: flex-end; padding: 14px;
  font-family: var(--font-heading); font-weight: 800; font-size: 18px; line-height: 1.15;
  color: var(--color-neutral-700); text-transform: uppercase; letter-spacing: -0.01em;
  background: linear-gradient(180deg, var(--color-neutral-300), var(--color-neutral-200));
}
.rtitle .year, .dtitle .year { color: var(--color-neutral-600); font-weight: 600; }
.empty-state { padding: 40px 0 24px; }
.empty-title { font-family: var(--font-heading); font-weight: 800; font-size: 32px; text-transform: uppercase; }
.empty-state p { font-size: 14px; color: var(--color-neutral-700); margin-top: 8px; max-width: 60ch; }
.error { border-left: 4px solid var(--color-accent); padding: 10px 14px; background: var(--color-accent-100); color: var(--color-accent-800); font-size: 13px; margin: 14px 0; }

/* ------------------------------------------------------------------ Detail */
.detail-panel { scroll-margin-top: calc(var(--header-h) + 16px); }
.detail-panel:not(:empty) { margin-top: 44px; animation: rise 0.2s ease-out; }
.backlink {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; text-decoration: none;
  font-family: var(--font-heading); font-weight: 600; font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--color-accent-700);
}
.backlink:hover { color: var(--color-accent); }
.rdetail {
  border-top: 2px solid var(--color-divider); margin-top: 12px; padding-top: 30px;
  display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 44px; align-items: start;
}
.rdetail figure img, .rdetail .rposter-empty { aspect-ratio: 5 / 7; width: 100%; object-fit: cover; border: 1px solid var(--color-divider); background: var(--color-neutral-300); }
.rdetail figcaption { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 8px; color: var(--color-neutral-600); }
.rdetail figcaption a { color: var(--color-accent-700); }
.dinfo { min-width: 0; }
.dtags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.dtags .genre { font-size: 12.5px; color: var(--color-neutral-600); }
.dtitle { font-size: 44px; letter-spacing: -0.02em; margin: 0 0 14px; line-height: 1.05; }
.ddesc { font-size: 15px; line-height: 1.6; color: var(--color-neutral-800); max-width: 76ch; margin: 0 0 18px; }
.dhosters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dhosters .lbl { font-size: 10.5px; letter-spacing: 0.1em; font-weight: 600; color: var(--color-neutral-600); text-transform: uppercase; }
.link-inline { font-size: 12.5px; color: var(--color-accent-700); text-decoration: underline; text-underline-offset: 3px; }
.link-inline:hover { color: var(--color-accent); }
.actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 24px 0 10px; }
.empty { font-size: 13.5px; color: var(--color-neutral-600); padding: 10px 0 22px; }
.error-text { color: var(--color-accent-700); }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; font-size: 11px; letter-spacing: 0.08em; color: var(--color-neutral-600); text-transform: uppercase; }

/* ------------------------------------------------------------------ Anmeldung / Offline */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 400px; border-top: 2px solid var(--color-divider); padding-top: 24px; }
.login-card .brand { margin: 0 0 22px; }
.login-card h1 { font-size: 34px; text-transform: uppercase; letter-spacing: -0.02em; line-height: 1; margin-bottom: 10px; }
.login-card p { color: var(--color-neutral-700); font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 8px; margin: 18px 0 14px; }
.login-card .input { height: 48px; font-size: 16px; }
.login-card .btn { height: 48px; }

/* ------------------------------------------------------------------ Entdecken: Reihen und Karten */
/* Reihen der Startseite: Desktop als Raster mit vollen Zeilen (4 bzw. 6 Karten), mobil als Snap-Scroller. */
.rows { margin-top: 44px; }
.row + .row, .row[hidden] + .row, #d-rows-personal:not(:empty) + .row, .row + #d-rows-personal > .row:first-child { margin-top: 40px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-top: 2px solid var(--color-divider); padding-top: 10px; margin-bottom: 14px; }
.row-title { font-family: var(--font-heading); font-weight: 800; font-size: 20px; line-height: 1.15; text-transform: uppercase; letter-spacing: -0.01em; margin: 0; }
.row-sub, .row-empty { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-neutral-600); }
.row-empty { padding: 6px 0 12px; margin: 0; }
.row-error { display: none; font-size: 13px; color: var(--color-accent-800); gap: 12px; align-items: center; margin: 0; }
.row.is-error .row-error { display: flex; }
.row.is-error .row-scroll, .row.is-error .row-sub { display: none; }
/* Slider: die Reihe laeuft rechts aus dem Bild, weitere Karten kommen beim Scrollen nach */
.row-scroll {
  list-style: none; margin: 0 calc(-1 * var(--page-x)) 0 0; padding: 0 var(--page-x) 4px 0;
  display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline-start: 0; scrollbar-width: none;
}
.row-scroll::-webkit-scrollbar { display: none; }
.row-scroll > li { flex: 0 0 176px; scroll-snap-align: start; }
@media (min-width: 1400px) { .row-scroll > li { flex-basis: 190px; } }
.row-nav { display: flex; gap: 6px; margin-left: auto; }
.row-nav[hidden] { display: none; }
.row-arrow {
  width: 30px; height: 30px; display: grid; place-items: center; cursor: pointer;
  background: var(--color-bg); color: var(--color-text); border: 2px solid var(--color-divider);
}
.row-arrow:hover:not([disabled]) { border-color: var(--color-accent); color: var(--color-accent); }
.row-arrow[disabled] { opacity: 0.3; cursor: default; }
.row-feeler { flex: 0 0 176px; }

.pcard { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; min-width: 0; }
.pcard:hover { color: inherit; }
.pcard:hover .pcard-title { color: var(--color-accent-700); }
.pcard-poster { position: relative; display: block; aspect-ratio: 2 / 3; background: var(--color-neutral-300); border: 1px solid var(--color-divider); overflow: hidden; }
.pcard-poster img { width: 100%; height: 100%; object-fit: cover; }
.pcard-empty {
  height: 100%; display: flex; align-items: flex-end; padding: 10px;
  font-family: var(--font-heading); font-weight: 800; font-size: 13px; line-height: 1.15; text-transform: uppercase;
  color: var(--color-neutral-700); background: linear-gradient(180deg, var(--color-neutral-300), var(--color-neutral-200));
}
.pcard-flag { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--color-neutral-900); color: var(--color-neutral-100); font-size: 11px; font-weight: 800; }
.pcard-title { font-family: var(--font-heading); font-weight: 800; font-size: 13px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.pcard-meta, .pcard-hint { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-neutral-600); font-weight: 600; }
.pcard-hint { color: var(--color-accent-700); }
.pcard.htmx-request .pcard-poster { opacity: 0.5; }
.pcard.is-skeleton .pcard-poster { animation: pulse 1.2s ease-in-out infinite alternate; }
.sk-line { display: block; height: 10px; width: 85%; background: var(--color-neutral-300); }
.sk-short { width: 50%; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.55; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Suchtreffer und Genre-Raster */
.pgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 12px; }
.pgrid-more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 12px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.dsub { font-size: 13px; color: var(--color-neutral-600); margin: -8px 0 14px; }
.dcast { font-size: 13px; color: var(--color-neutral-700); margin: 0 0 14px; }
.dcast .lbl { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; color: var(--color-neutral-600); margin-right: 6px; }

/* ------------------------------------------------------------------ Mobil (<= 760px, wie im Entwurf) */
@media (max-width: 760px) {
  :root { --page-x: 16px; --header-h: 50px; }
  .nav { padding: 10px var(--page-x); gap: 14px; }
  .brand-text { font-size: 13px; }
  .page { padding: 24px var(--page-x) 56px; }
  .display { font-size: 40px; }
  .search-box .input { height: 50px; font-size: 16px; }
  .search-form .btn-primary { height: 50px; padding: 0 18px; }
  .rdetail { grid-template-columns: 1fr; gap: 24px; }
  .rdetail figure { max-width: 210px; }
  .dtitle { font-size: 32px; }
  .foot { padding: 12px var(--page-x); }
  /* Entdecken: randlose Snap-Scroller ohne Scrollbalken, kompaktere Raster */
  .rows { margin-top: 32px; }
  .row + .row, .row[hidden] + .row, #d-rows-personal:not(:empty) + .row, .row + #d-rows-personal > .row:first-child { margin-top: 30px; }
  .row-title { font-size: 17px; }
  .row-scroll {
    gap: 10px; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory;
    margin-inline: calc(-1 * var(--page-x)); padding: 0 var(--page-x) 4px; scroll-padding-inline: var(--page-x);
  }
  .row-scroll > li, .row-feeler { flex: 0 0 clamp(132px, 38vw, 170px); }
  .row-nav { display: none; }
  .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; }
  .chips .btn-chip { min-height: 40px; padding: 6px 14px; }
}
@media (max-width: 480px) {
  /* Kopfzeile: Marke ohne Schriftzug, damit Suche, Downloads und Abmelden nebeneinander passen */
  .brand-text { display: none; }
  .nav { gap: 12px; }
  .nav-link { font-size: 11.5px; letter-spacing: 0.06em; }
  .search-form .btn-primary { padding: 0 14px; }
  .row-sub { display: none; }  /* Entdecken: auf schmalen Schirmen zaehlt der Reihentitel */
}

/* ------------------------------------------------------------------ Installierte App (Home-Bildschirm) */
/* viewport-fit=cover: Inhalt darf bis an die Raender laufen, Abstaende kommen aus den Safe-Area-Werten. */
body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
@media (display-mode: standalone), (display-mode: fullscreen) {
  body { padding-top: env(safe-area-inset-top, 0px); }
  .nav { top: env(safe-area-inset-top, 0px); }
  .section { scroll-margin-top: calc(var(--header-h) + 12px + env(safe-area-inset-top, 0px)); }
  .detail-panel, .dsources { scroll-margin-top: calc(var(--header-h) + 16px + env(safe-area-inset-top, 0px)); }
  .login-wrap { min-height: calc(100vh - env(safe-area-inset-top, 0px)); }
  html { overscroll-behavior-y: none; }
  a, button, [role="button"] { -webkit-tap-highlight-color: transparent; }
}

/* ------------------------------------------------------------------ Bereiche: Tabs in der Kopfzeile (Desktop), Leiste unten (mobil) */
/* Steht nach dem PWA-Block, damit die .foot-Regel fuer die Leiste unten gewinnt. Der rote Quadrat-Marker bleibt
   den Abschnittslinks (Suche/Downloads/Verlauf) vorbehalten; die Tabs markieren mit einer 2px-Akzentlinie. */
:root { --tabbar-h: 0px; }
.nav .brand { margin-right: 22px; }
.tabs { display: flex; align-self: stretch; margin: -14px auto -14px 0; }
.tab { text-decoration: none; -webkit-tap-highlight-color: transparent; }
.tabs .tab {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-left: 1px solid var(--color-divider);
  font-family: var(--font-heading); font-weight: 800; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-neutral-600);
}
.tabs .tab:last-child { border-right: 1px solid var(--color-divider); }
.tabs .tab:hover { color: var(--color-accent-700); }
.tabs .tab[aria-current="page"] { color: var(--color-text); }
.tabs .tab[aria-current="page"]::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -2px; height: 2px; background: var(--color-accent); }
.tab-ico { width: 18px; height: 18px; flex: none; }
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--color-bg); border-top: 2px solid var(--color-divider);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.tabbar .tab {
  position: relative; flex: 1 1 0; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--color-neutral-700); font-family: var(--font-heading); font-weight: 600; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
}
.tabbar .tab + .tab { border-left: 1px solid var(--color-divider); }
.tabbar .tab[aria-current="page"] { color: var(--color-accent-700); }
.tabbar .tab[aria-current="page"]::before { content: ""; position: absolute; top: -2px; left: 0; right: 0; height: 2px; background: var(--color-accent); }
.tabbar .tab-ico { width: 22px; height: 22px; }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 8px); }
@media (max-width: 1024px) {
  /* 761-1024px: Marke, zwei Tabs, drei Abschnittslinks und Abmelden muessen nebeneinander passen */
  .brand-text { display: none; }
  .nav { gap: 18px; }
  .tabs .tab { padding: 0 12px; }
}
@media (max-width: 760px) {
  :root { --tabbar-h: 56px; }
  .tabs { display: none; }
  .nav .brand { margin-right: auto; }
  .tabbar { display: flex; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .foot { padding-bottom: 12px; }
}

/* ------------------------------------------------------------------ Weniger Bewegung */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .loading::after, .bar.indeterminate > i, .pcard.is-skeleton .pcard-poster, .detail-panel:not(:empty), .notice { animation: none; }
}

/* ------------------------------------------------------------------ Status (haudiobook) */
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--color-text); margin: 8px 0 22px; }
.status-card { padding: 16px 18px 18px 0; border-bottom: 1px solid var(--color-divider); }
.status-card + .status-card { padding-left: 18px; border-left: 1px solid var(--color-divider); }
.status-big { font-family: var(--font-heading); font-weight: 800; font-size: 30px; line-height: 1.1; margin: 6px 0 4px; text-transform: uppercase; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0 0; font-size: 13px; }
.facts dt { color: var(--color-neutral-600); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.status-actions form { margin: 0; }
.section-label { margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--color-text); }
.table-wrap { overflow-x: auto; }
.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
.runs th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-neutral-600); font-weight: 600; padding: 6px 10px 6px 0; }
.runs td { padding: 7px 10px 7px 0; border-top: 1px solid var(--color-divider); vertical-align: top; }
.runs tr.run-aborted td, .runs tr.run-error td, .runs tr.run-paused td { color: var(--color-accent-700); }
.newest { list-style: none; margin: 0; padding: 0; }
.newest li { padding: 8px 0; border-bottom: 1px solid var(--color-divider); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.newest a { color: inherit; font-weight: 600; text-decoration: none; }
.newest a:hover { color: var(--color-accent-700); }
@media (max-width: 1024px) { .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .status-card:nth-child(3) { border-left: 0; padding-left: 0; } }
@media (max-width: 480px) { .status-grid { grid-template-columns: 1fr; } .status-card + .status-card { border-left: 0; padding-left: 0; } }

/* ------------------------------------------------------------------ Hörbücher (haudiobook) */
/* Hörbuch-Cover sind quadratisch */
.pcard-poster { aspect-ratio: 1 / 1; }
.rdetail figure img, .rdetail .rposter-empty { aspect-ratio: 1 / 1; }
.search { max-width: 980px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 12px; }
.filters select.input { width: auto; min-width: 170px; height: 38px; font-size: 13px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--color-accent); }
.dsub { margin-top: -6px; font-size: 15px; color: var(--color-neutral-700); }
/* Platzhalter ohne Cover: lange Titel umbrechen und nach sechs Zeilen kappen */
.pcard-empty, .rposter-empty { overflow: hidden; overflow-wrap: anywhere; hyphens: auto; }
.pcard-empty > span, .rposter-empty > span { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.excerpt { max-width: 76ch; margin: 18px 0 6px; border-left: 2px solid var(--color-divider); padding-left: 14px; }
.excerpt p { margin: 0 0 8px; font-size: 14px; line-height: 1.55; color: var(--color-neutral-800); }
.excerpt .label-muted { margin-bottom: 8px; }
.detail-panel .row { margin-top: 40px; }
@media (max-width: 760px) {
  .pcard-empty { font-size: 11px; padding: 8px; }
  .filters { gap: 8px 12px; }
  .filters select.input { min-width: 0; flex: 1 1 140px; }
}

/* Audible: Klappentext, Kategorien, Zuordnung */
.summary { max-width: 76ch; margin: 18px 0 14px; font-size: 14.5px; line-height: 1.6; color: var(--color-neutral-800); }
.summary p { margin: 0 0 10px; }
.summary ul, .summary ol { margin: 0 0 10px; padding-left: 20px; }
.cat-chips { margin: 4px 0 12px; }
.match-box { border-top: 1px solid var(--color-divider); margin-top: 26px; padding-top: 14px; max-width: 76ch; }
.match-box .label { margin: 0 0 10px; }
.match-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.match-actions form { margin: 0; }
.proposal { display: flex; gap: 14px; align-items: flex-start; }
.proposal img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--color-divider); flex: none; }
.proposal p { margin: 0 0 4px; }
.proposal-title { font-family: var(--font-heading); font-weight: 800; font-size: 15px; line-height: 1.25; }
.asin-form { margin-top: 10px; font-size: 13px; }
.asin-form summary { cursor: pointer; color: var(--color-accent-700); font-size: 12px; letter-spacing: 0.04em; }
.asin-form form { display: flex; gap: 8px; margin: 10px 0 6px; max-width: 420px; }
.asin-form .input { height: 38px; font-size: 13px; }
.notice-line { border-left: 4px solid var(--color-neutral-900); padding: 8px 12px; background: var(--color-neutral-200); font-size: 13px; margin: 14px 0; }
.status-grid-audible { margin-top: -10px; }
