:root {
  --grund: #ffffff;
  --text: #1a1a1a;
  --leise: #4a4a4a;
  --akzent: #1f4e79;
  --akzent-text: #ffffff;
  --flaeche: #f1f4f8;
  --rand: #b8c2cc;
  --warnung: #8a1c1c;
  --warnung-grund: #fbeaea;
  --test: #6b4e00;
  --test-grund: #fff4d6;
  font-size: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #121417;
    --text: #f2f2f2;
    --leise: #c4c8cc;
    --akzent: #8cc4ff;
    --akzent-text: #0b1a2a;
    --flaeche: #1e2329;
    --rand: #4a525c;
    --warnung: #ffb4b4;
    --warnung-grund: #3a1b1b;
    --test: #ffd98a;
    --test-grund: #3a3014;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--grund); color: var(--text); }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

main { max-width: 760px; margin: 0 auto; padding: 12px 16px 32px; }

h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 6px; }
h2 { font-size: 1.2rem; margin: 28px 0 8px; }
p { margin: 0 0 6px; }
.leise { color: var(--leise); }

a { color: var(--akzent); text-underline-offset: 3px; }

button, select, input { font: inherit; color: inherit; }

button {
  min-height: 48px;
  min-width: 48px;
  border-radius: 10px;
  border: 2px solid var(--akzent);
  background: var(--grund);
  color: var(--akzent);
  padding: 8px 16px;
  cursor: pointer;
}
button.haupt { background: var(--akzent); color: var(--akzent-text); font-weight: 600; }
button.klein { min-height: 48px; padding: 6px 12px; }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 3px; }

select {
  min-height: 48px;
  border-radius: 10px;
  border: 2px solid var(--rand);
  background: var(--grund);
  padding: 6px 10px;
}

.kopfleiste { display: flex; justify-content: flex-end; }

.hinweis { padding: 24px 0; }
.hinweis h1 { margin-bottom: 12px; }
.hinweis button { margin-top: 16px; }
.hinweis-zeile { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--flaeche); }
.hinweis-zeile:empty { display: none; }
#meldung.warnung { color: var(--warnung); }

.buch { display: flex; gap: 16px; align-items: flex-start; margin: 8px 0 12px; }
#cover { width: 132px; height: 132px; object-fit: cover; border-radius: 10px; flex: none; background: var(--flaeche); }
.buch-text { min-width: 0; }
.test { display: inline-block; background: var(--test-grund); color: var(--test); font-weight: 600; padding: 2px 10px; border-radius: 8px; }

.kapitel-aktuell { margin-top: 18px; }
#kapitel-name { font-weight: 600; min-height: 1.5em; }

input[type=range] { width: 100%; height: 48px; accent-color: var(--akzent); margin: 0; }
.zeiten { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

.steuerung { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 18px 0; flex-wrap: nowrap; }
button.rund { border-radius: 50%; width: 60px; height: 60px; padding: 0; font-weight: 600; font-size: 1rem; font-variant-numeric: tabular-nums; }
button.rund.gross { width: 84px; height: 84px; font-size: 1.9rem; background: var(--akzent); color: var(--akzent-text); }

.einstellungen { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.einstellungen label { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
#lautstaerke-feld { flex: 1 1 180px; }

#kapitelliste { list-style: none; padding: 0; margin: 0; }
#kapitelliste li { border-bottom: 1px solid var(--rand); }
#kapitelliste button {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 4px;
}
#kapitelliste .nr { color: var(--leise); min-width: 2em; font-variant-numeric: tabular-nums; }
#kapitelliste .name { flex: 1; }
#kapitelliste .dauer { color: var(--leise); font-variant-numeric: tabular-nums; }
#kapitelliste li.aktuell button { font-weight: 700; background: var(--flaeche); }

footer { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--rand); color: var(--leise); }
footer .verweise { display: flex; gap: 20px; flex-wrap: wrap; }
footer a { display: inline-block; min-height: 48px; line-height: 48px; }

@media (max-width: 420px) {
  #cover { width: 96px; height: 96px; }
  .steuerung { gap: 6px; }
  button.rund { width: 54px; height: 54px; }
  button.rund.gross { width: 76px; height: 76px; }
}

/* Verwaltung */
.verwaltung main { max-width: 1100px; }
.reiter { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.reiter button[aria-selected=true] { background: var(--akzent); color: var(--akzent-text); }
.feld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.feld input[type=text], .feld input[type=email], .feld input[type=number], .feld textarea {
  min-height: 48px; border: 2px solid var(--rand); border-radius: 10px; padding: 8px 10px; background: var(--grund);
}
.feld textarea { min-height: 120px; }
.reihe { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.karte { border: 1px solid var(--rand); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.karte.auffaellig { border: 2px solid var(--warnung); background: var(--warnung-grund); }
.tabelle-huelle { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--rand); vertical-align: top; }
tr.auffaellig td { background: var(--warnung-grund); }
.marke { display: inline-block; padding: 1px 8px; border-radius: 8px; background: var(--flaeche); font-size: 0.9rem; }
.marke.rot { background: var(--warnung-grund); color: var(--warnung); font-weight: 600; }
.einmalig { word-break: break-all; padding: 10px; background: var(--flaeche); border-radius: 8px; font-family: ui-monospace, Consolas, monospace; }
.fehler { color: var(--warnung); }
