/* Douplexer – Gestaltung (hell/dunkel). Urheber: Jakobus Claudius Digitalensis (+KI-Claude) */
:root {
  --bg: #f6f4ef; --karte: #ffffff; --text: #1f2328; --leise: #5d636b; --linie: #dcd8cf;
  --akzent: #2f5d62; --akzent-text: #ffffff; --akzent-weich: #e3ecea; --gefahr: #a33a2b;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191c; --karte: #20252a; --text: #e8e6e1; --leise: #9aa1a8; --linie: #343b42;
    --akzent: #7fb7b0; --akzent-text: #10201f; --akzent-weich: #24343a; --gefahr: #e0816f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 0; }
.marke { font-weight: 700; letter-spacing: .02em; color: var(--leise); font-size: 15px; }
.zahnrad {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent; color: var(--leise);
  display: grid; place-items: center; cursor: pointer;
}
.zahnrad:hover, .zahnrad:focus-visible { background: var(--akzent-weich); color: var(--text); }
main { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 8px 16px 24px; display: flex; flex-direction: column; justify-content: center; }
h1 { font-size: 40px; line-height: 1.1; margin: 0 0 6px; letter-spacing: -.01em; }
.unter { color: var(--leise); margin: 0 0 32px; }
.knopf {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  min-height: 64px; padding: 14px 20px; margin: 0 0 14px; border-radius: 16px; cursor: pointer;
  font: inherit; font-size: 19px; font-weight: 600; border: 2px solid var(--akzent);
  background: var(--karte); color: var(--text);
}
.knopf.haupt { background: var(--akzent); color: var(--akzent-text); }
.knopf:active { transform: translateY(1px); }
.knopf:focus-visible, .zahnrad:focus-visible, .dev-knopf:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
.knopf svg { flex: none; }
.klein { color: var(--leise); font-size: 14px; }
.balken { height: 12px; background: var(--akzent-weich); border-radius: 6px; overflow: hidden; margin: 18px 0 10px; }
.balken > div { height: 100%; width: 0; background: var(--akzent); transition: width .25s; }
.fertig-haken { width: 64px; height: 64px; border-radius: 50%; background: var(--akzent); color: var(--akzent-text); display: grid; place-items: center; margin-bottom: 16px; }
.zahlen { font-size: 18px; margin: 0 0 6px; }
.dateiname { font-family: ui-monospace, Consolas, monospace; font-size: 14px; word-break: break-all; color: var(--leise); margin: 0 0 28px; }
.linkknopf { display: block; margin: 0 auto; background: none; border: 0; color: var(--akzent); font: inherit; font-weight: 600; padding: 12px 20px; cursor: pointer; min-height: 48px; }
#fertig-groesse { white-space: nowrap; }
footer { text-align: center; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); color: var(--leise); font-size: 12px; }
#version { cursor: default; user-select: none; -webkit-user-select: none; }

/* Einstellungen */
.schleier { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: end center; z-index: 10; }
@media (min-width: 600px) { .schleier { place-items: center; } }
.dialog { background: var(--karte); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .dialog { border-radius: 20px; } }
.dialog h2 { margin: 0 0 4px; font-size: 22px; }
.feld { display: block; margin: 16px 0; }
.feld span { display: block; font-weight: 600; margin-bottom: 6px; }
.feld input { width: 100%; min-height: 52px; font: inherit; font-size: 19px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--linie); background: var(--bg); color: var(--text); }
.feld input:focus { border-color: var(--akzent); outline: none; }
.dialog-knoepfe { display: flex; gap: 10px; margin-top: 8px; }
.dialog-knoepfe .knopf { margin: 0; min-height: 54px; font-size: 17px; }
.hinweis { color: var(--gefahr); min-height: 1.4em; font-size: 15px; }
.schalter { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; font-size: 15px; line-height: 1.4; cursor: pointer; }
.schalter input { width: 26px; height: 26px; flex: none; margin: 2px 0 0; accent-color: var(--akzent); }
.modus { background: var(--akzent-weich); border-radius: 12px; padding: 10px 12px; margin: 4px 0 10px; color: var(--text); }
.dialog { max-height: 100dvh; overflow: auto; }

/* Entwicklerbereich (Farbwelt der App) */
#dev { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 12px; }
.dev-panel { background: var(--karte); color: var(--text); width: 100%; max-width: 720px; max-height: 100%; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.dev-kopf { font-size: 12px; font-weight: 800; letter-spacing: .12em; padding: 16px 16px 0; color: var(--akzent); }
.dev-unter { font-style: italic; color: var(--leise); padding: 2px 16px 8px; font-size: 14px; }
.dev-scroll { overflow: auto; padding: 0 16px 12px; }
.dev-scroll h3 { font-size: 15px; margin: 14px 0 8px; }
.dev-notiz { display: flex; gap: 8px; align-items: flex-start; }
.dev-notiz textarea, .dev-bearbeiten { flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--linie); background: var(--bg); color: var(--text); }
.dev-knoepfe { display: flex; flex-direction: column; gap: 6px; }
.dev-mikro { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--linie); background: var(--bg); font-size: 20px; cursor: pointer; flex: none; }
.dev-mikro.aufnahme { background: var(--gefahr); border-color: var(--gefahr); }
.dev-knopf { font: inherit; font-size: 14px; min-height: 40px; padding: 6px 12px; border-radius: 10px; border: 2px solid var(--linie); background: var(--bg); color: var(--text); cursor: pointer; }
.dev-knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.dev-knopf.gefahr { color: var(--gefahr); }
.dev-zeile { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linie); font-size: 15px; }
.dev-zeile .ts { color: var(--leise); font-variant-numeric: tabular-nums; }
.dev-zeile .tx { flex: 1; min-width: 50%; word-break: break-word; }
.dev-zknoepfe { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.dev-hinweis { color: var(--leise); font-size: 14px; padding: 6px 0; }
.dev-klein { font-size: 14px; color: var(--leise); padding: 6px 0; }
.dev-scroll > .dev-knopf { margin-top: 10px; }
.dev-scroll details { margin-top: 12px; border-top: 1px solid var(--linie); padding-top: 8px; }
.dev-scroll summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.dev-scroll table { border-collapse: collapse; font-size: 13px; width: 100%; }
.dev-scroll th, .dev-scroll td { text-align: left; vertical-align: top; padding: 4px 6px; border-bottom: 1px solid var(--linie); }
.dev-schliessen { border: 0; border-top: 1px solid var(--linie); background: var(--akzent-weich); color: var(--text); font: inherit; font-weight: 600; min-height: 52px; cursor: pointer; width: 100%; }

/* Schritte */
.schritt { color: var(--akzent); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 6px; }
h2 { font-size: 26px; line-height: 1.15; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
body.breit main { max-width: 1320px; justify-content: flex-start; }
.leiste { display: flex; gap: 10px; position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--bg); margin-top: 12px; }
.leiste .knopf { margin: 0; min-height: 56px; font-size: 17px; }
.leiste .knopf.haupt { flex: 2; }
.leiste .knopf:not(.haupt) { flex: 1; }

/* Assistent: Felder 1–5 */
.felder-band { padding: 6px 0 4px; }
.felder { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 2px 2px 12px; scroll-margin-top: 12px; scrollbar-width: thin; }
.felder .seitenfeld { flex: 0 0 160px; scroll-snap-align: start; }
.felder.zieht { scroll-snap-type: none; }
@media (min-width: 900px) { .felder { gap: 14px; } .felder .seitenfeld { flex-basis: 250px; } }
.seitenfeld { min-width: 0; border: 2px dashed var(--linie); border-radius: 12px; padding: 6px; background: var(--karte); display: flex; flex-direction: column; align-items: center; gap: 4px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.seitenfeld.belegt { border-style: solid; border-color: var(--akzent); }
.seitenfeld.ziel { border-color: var(--akzent); border-style: dashed; }
.seitenfeld.drueber { outline: 3px solid var(--akzent); outline-offset: 2px; }
.seitenfeld canvas { display: block; border-radius: 3px; box-shadow: 0 0 0 1px var(--linie); background: #fff; }
.feld-kopf { font-weight: 700; font-size: 16px; white-space: nowrap; }
.feld-leiste { display: flex; gap: 6px; width: 100%; }
.feld-nr { font-size: 14px; color: var(--leise); font-variant-numeric: tabular-nums; white-space: nowrap; }
.feld-leiste .mini-knopf { flex: 1; min-width: 0; }
.mini-knopf { min-width: 44px; min-height: 44px; font-size: 20px !important; border-radius: 8px; border: 1px solid var(--linie); background: var(--bg); color: var(--text); font-size: 16px; cursor: pointer; padding: 0; }
.mini-knopf:disabled { opacity: .35; cursor: default; }
.a-hinweis { min-height: 1.3em; margin: 4px 0 8px; scroll-margin-top: 12px; font-size: 14px; color: var(--akzent); font-weight: 600; }

/* Assistent: alle Scans */
.scans { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (min-width: 900px) { .scans { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.scan { position: relative; border: 2px solid transparent; border-radius: 12px; background: var(--karte); padding: 6px 6px 24px; cursor: grab; display: grid; place-items: center; min-height: 200px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.scan canvas { display: block; box-shadow: 0 0 0 1px var(--linie); }
.scan-nr { position: absolute; left: 8px; bottom: 4px; font-size: 14px; color: var(--leise); }
.scan-ziel { position: absolute; right: 8px; bottom: 4px; font-size: 13px; font-weight: 700; color: var(--akzent); }
.scan.vergeben { opacity: .55; }
.scan.gewaehlt { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-weich); opacity: 1; }
.wird-gezogen { opacity: .35; }
.geist { position: fixed; z-index: 30; pointer-events: none; box-shadow: 0 8px 20px rgba(0,0,0,.35); border-radius: 4px; }

/* Prüfansicht */
.seitenliste { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (min-width: 900px) { .seitenliste { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.seite { border: 1px solid var(--linie); border-radius: 10px; background: var(--karte); padding: 4px 4px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--text); font: inherit; }
.seite canvas { display: block; box-shadow: 0 0 0 1px var(--linie); background: #fff; }
.seite-nr { font-size: 15px; font-weight: 700; }
.seite-scan { font-size: 13px; color: var(--leise); }

/* Dateiname */
.feld .name-zeile { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.feld .name-zeile input { flex: 1; min-width: 0; }
.feld .endung { display: inline; margin: 0; font-weight: 400; color: var(--leise); font-size: 17px; }

/* Heft durchblättern */
.b-buehne { display: flex; justify-content: center; margin: 12px 0 6px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.b-buch { display: flex; gap: 0; align-items: flex-start; }
.b-buch.gedreht { flex-direction: column; }
.b-seite { margin: 0; display: flex; flex-direction: column; align-items: center; }
.b-seite canvas { display: block; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.b-seite canvas.b-frei { background: transparent; box-shadow: none; }
.b-buch:not(.gedreht) .b-seite:first-child canvas:not(.b-frei) { box-shadow: inset -14px 0 14px -12px rgba(0,0,0,.35), 0 2px 10px rgba(0,0,0,.25); }
.b-buch:not(.gedreht) .b-seite:last-child canvas:not(.b-frei) { box-shadow: inset 14px 0 14px -12px rgba(0,0,0,.35), 0 2px 10px rgba(0,0,0,.25); }
.b-seite figcaption { font-size: 13px; font-weight: 600; color: var(--leise); min-height: 1.4em; margin-top: 4px; }
.b-steuer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.b-pfeil { width: 64px; height: 56px; border-radius: 14px; border: 2px solid var(--akzent); background: var(--karte); color: var(--text); font-size: 22px; cursor: pointer; }
.b-pfeil:disabled { opacity: .35; cursor: default; }
.b-stand { font-weight: 700; text-align: center; }
.b-regler { width: 100%; margin: 12px 0 0; accent-color: var(--akzent); min-height: 32px; }
#fertig .knopf { margin-bottom: 10px; }

/* Druckereinstellungen (Schritt 5) */
.drucker { background: var(--akzent-weich); border: 2px solid var(--akzent); border-radius: 14px; padding: 12px 14px; margin: 4px 0 14px; }
.drucker h3 { margin: 0 0 8px; font-size: 16px; color: var(--akzent); }
.drucker dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 6px; font-size: 15px; }
.drucker dt { font-weight: 700; }
.drucker dd { margin: 0; }
.drucker .klein { margin: 4px 0 0; }

/* Startseite: Erklär-Karte */
.info-karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 18px; padding: 18px 20px 8px; margin: 10px 0 8px; box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 10px 26px rgba(0,0,0,.09); }
.info-karte h2 { font-size: 19px; margin: 0 0 8px; color: var(--akzent); }
.info-karte h2 + p { margin-top: 0; }
.info-karte p, .info-karte li { font-size: 15.5px; line-height: 1.5; }
.info-karte ol, .info-karte ul { padding-left: 22px; margin: 0 0 16px; }
.info-karte li { margin: 0 0 5px; }
@media (prefers-color-scheme: dark) { .info-karte { box-shadow: 0 2px 4px rgba(0,0,0,.3), 0 10px 26px rgba(0,0,0,.35); } }

/* Startseite: installiert als App? */
.installation { border-radius: 14px; padding: 12px 14px; margin: 4px 0 12px; border: 2px solid var(--linie); background: var(--karte); }
.installation p { margin: 0; font-size: 15px; line-height: 1.45; }
.installation.ok { border-color: var(--akzent); background: var(--akzent-weich); }
.installation.offen { border-color: #c98a1b; background: rgba(201, 138, 27, .10); }
.installation .knopf { margin: 10px 0 0; min-height: 56px; }
