/* ============================================================================
 * app.css  –  das Aussehen des Editors (nicht des Kurses)
 * ============================================================================
 *
 * WOZU DIENT DIESE DATEI?
 * Sie bestimmt Farben, Abstände und Schriften der Werkstatt selbst
 * (Kopfleiste, Seitenliste, Editor, Export-Fenster, Anleitung ...).
 * Das Aussehen des fertigen KURSES steht in css/player.css.
 *
 * AUFBAU DER DATEI (in dieser Reihenfolge):
 *   1. Schriften und Farben (Variablen)
 *   2. Grundlagen
 *   3. Knöpfe und Formularelemente
 *   4. Kopfleiste
 *   5. Editor (Seitenliste, Seiteninhalt, Eigenschaften)
 *   6. Export-Fenster
 *   7. Vorschau mit Simulator
 *   8. Anleitung und Über-Seite
 *   9. Kleine Bildschirme und Drucken
 *
 * FARBEN ÄNDERN: Die wichtigsten Farben stehen im Block ":root" direkt unten.
 * Ändere dort z. B. --accent, und die ganze App übernimmt die neue Hauptfarbe.
 * ========================================================================== */

/* ---- 1. Schriften und Farben ---------------------------------------------- */

/* Die Schriften liegen im Ordner "fonts". Es wird nichts von fremden Servern geladen. */
@font-face { font-family: "Roboto"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/roboto-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/roboto-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-style: italic; font-display: swap; src: url("../fonts/roboto-latin-700-italic.woff2") format("woff2"); }
@font-face { font-family: "Raleway"; font-weight: 300; font-style: normal; font-display: swap; src: url("../fonts/raleway-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/roboto-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  --ground: #FFFFFF;        /* Hintergrund der ganzen App */
  --panel: #FFFFFF;         /* Hintergrund von Karten und Leisten */
  --surface: #FFFFFF;       /* Eingabefelder, Blöcke, Menüs */
  --surface-2: #F5F5F2;     /* leicht abgesetzte Flächen */
  --surface-3: #EBEBE7;     /* Code, Hover-Flächen */
  --line: #CFCFCB;          /* feine Linien */
  --line-soft: #E4E4E0;     /* noch feinere Linien */
  --field: #8B9096;         /* Rahmen von Eingabefeldern */
  --ink: #16181A;           /* Textfarbe */
  --muted: #5A5F64;         /* zurückhaltender Text */
  --muted-2: #3A3E42;       /* etwas dunklerer zurückhaltender Text */
  --strong-bg: #16181A;     /* dunkle Flächen (Werkzeugleiste, Hinweis-Meldung) */
  --strong-fg: #FFFFFF;     /* Schrift auf dunklen Flächen */
  --strong-hover: #33383C;
  --accent: #0B6B5F;        /* Hauptfarbe (Knöpfe) */
  --accent-dark: #07524A;   /* Hauptfarbe, dunkel (Darüberfahren) */
  --accent-soft: #E1EFEC;   /* Hauptfarbe, sehr hell */
  --accent-wash: #F1F7F6;   /* Hauptfarbe, fast weiß */
  --accent-line: #A9CFC8;   /* Rahmen in Hauptfarbe */
  --link: #07524A;          /* Links */
  --link-hover: #0B6B5F;
  --warn-bg: #FBF0E6;       /* Hinweis-Hintergrund (orange) */
  --warn-fg: #8F3508;       /* Hinweis-Text (orange) */
  --warn-line: #E6C4A6;
  --warn-ink: #5E2606;
  --bad-bg: #FBE6E6;        /* Fehler-Hintergrund */
  --bad-fg: #8A1C1C;        /* Fehler-Text */
  --video-bg: #E3E9FB;      /* Chip "Video" */
  --video-fg: #2B4AA0;
  --code-ink: #124F46;
  --shadow: rgba(22, 24, 26, 0.14);
  --backdrop: rgba(22, 24, 26, 0.5);
  --radius: 2px;
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

/* ---- Dunkles Design ----------------------------------------------------------
 * Wird aktiv, wenn (a) der Nutzer den Schalter oben rechts auf "dunkel" stellt oder
 * (b) nichts gewählt wurde und das Gerät selbst auf "dunkel" eingestellt ist.
 * Es ändern sich nur die Farbwerte, kein anderer Code. (siehe js/theme.js) */
:root[data-theme="dark"] {
  --ground: #111314;
  --panel: #111314;
  --surface: #181B1D;
  --surface-2: #1A1D1F;
  --surface-3: #26292C;
  --line: #34383C;
  --line-soft: #272A2D;
  --field: #5A6066;
  --ink: #E8EAEC;
  --muted: #9EA4A9;
  --muted-2: #BDC2C6;
  --strong-bg: #2A2E31;
  --strong-fg: #FFFFFF;
  --strong-hover: #3A3F43;
  --accent: #0F8272;
  --accent-dark: #0B6A5D;
  --accent-soft: #14403A;
  --accent-wash: #112E2A;
  --accent-line: #1E5A51;
  --link: #5FD8C4;
  --link-hover: #8FE8D9;
  --warn-bg: #3A2416;
  --warn-fg: #F2B48A;
  --warn-line: #6B4128;
  --warn-ink: #F6D6C0;
  --bad-bg: #3C1B1B;
  --bad-fg: #F3A3A3;
  --video-bg: #1C2B55;
  --video-fg: #AFC2F7;
  --code-ink: #7FE0CF;
  --shadow: rgba(0, 0, 0, 0.5);
  --backdrop: rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --ground: #111314;
  --panel: #111314;
  --surface: #181B1D;
  --surface-2: #1A1D1F;
  --surface-3: #26292C;
  --line: #34383C;
  --line-soft: #272A2D;
  --field: #5A6066;
  --ink: #E8EAEC;
  --muted: #9EA4A9;
  --muted-2: #BDC2C6;
  --strong-bg: #2A2E31;
  --strong-fg: #FFFFFF;
  --strong-hover: #3A3F43;
  --accent: #0F8272;
  --accent-dark: #0B6A5D;
  --accent-soft: #14403A;
  --accent-wash: #112E2A;
  --accent-line: #1E5A51;
  --link: #5FD8C4;
  --link-hover: #8FE8D9;
  --warn-bg: #3A2416;
  --warn-fg: #F2B48A;
  --warn-line: #6B4128;
  --warn-ink: #F6D6C0;
  --bad-bg: #3C1B1B;
  --bad-fg: #F3A3A3;
  --video-bg: #1C2B55;
  --video-fg: #AFC2F7;
  --code-ink: #7FE0CF;
  --shadow: rgba(0, 0, 0, 0.5);
  --backdrop: rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* ---- 2. Grundlagen ---------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}
body.is-locked { overflow: hidden; }

main { flex: 1 1 auto; display: flex; flex-direction: column; }

h1, h2, h3 { line-height: 1.25; }

a { color: var(--link); }
a:hover { color: var(--link-hover); }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 2px; }
kbd { background: var(--surface); border: 1px solid var(--field); border-bottom-width: 2px; border-radius: 2px; padding: 0 5px; }

.muted { color: var(--muted); }

/* Für Screenreader sichtbar, für Augen unsichtbar */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 300;
  background: var(--strong-bg); color: var(--strong-fg); padding: 10px 16px; border-radius: 2px;
}
.skip-link:focus { top: 8px; }

.fatal { margin: 0; padding: 16px 20px; background: var(--bad-bg); color: var(--bad-fg); font-weight: 600; }

/* Sichtbarer Fokusrahmen für die Tastaturbedienung */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.rte:focus-visible { outline-offset: 0; }

/* ---- 3. Knöpfe und Formularelemente ------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }   /* für Dateiauswahl-Knöpfe */

.btn-primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-weight: 500; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-small { min-height: 40px; padding: 0 12px; font-size: 13px; }
.btn-danger { color: var(--bad-fg); }
.btn-danger:hover:not(:disabled) { border-color: var(--bad-fg); }
.btn-dashed { border-style: dashed; border-color: #8C99A5; width: 100%; }
.btn-light { background: var(--surface); border-color: var(--surface); color: var(--ink); font-weight: 600; }
.btn-ghost-light { background: transparent; border-color: #6B7B88; color: #FFFFFF; }
.btn-ghost-light:hover:not(:disabled) { border-color: #FFFFFF; }

.file-btn { position: relative; }

.icon { display: inline-flex; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  color: var(--ink); background: transparent;
  border: 1px solid transparent; border-radius: 2px;
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-3); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.link-btn {
  align-self: flex-start; min-height: 40px; padding: 0;
  font: inherit; font-weight: 500; color: var(--link);
  background: none; border: 0; text-decoration: underline; cursor: pointer;
}

.chip {
  align-self: flex-start;
  font-size: 11px; font-weight: 500;
  padding: 1px 8px; border-radius: 2px;
  background: var(--surface-3); color: var(--muted-2);
}
.chip-quiz { background: var(--warn-bg); color: var(--warn-fg); }
.chip-video { background: var(--video-bg); color: var(--video-fg); }
.chip-empty { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--field); }

.tag { flex: 0 0 auto; margin-top: 1px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 2px; }
.tag-ok { background: var(--accent-soft); color: var(--link); }
.tag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.tag-error { background: var(--bad-bg); color: var(--bad-fg); }

/* Eingabefelder */
input[type="text"], input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--field);
  border-radius: 2px;
}
textarea { resize: vertical; line-height: 1.45; }
input[readonly] { background: var(--surface-2); color: var(--muted-2); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 500; color: var(--muted); }
.hint { margin: 2px 0 0 0; font-size: 12px; color: var(--muted); }
.hint-warn { color: var(--warn-fg); }

.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 0; }
.row > .muted { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.row-fields { align-items: flex-start; }
.row-fields .field { flex: 1 1 200px; }
.or { margin: 8px 0; color: var(--muted); text-align: center; }

/* ---- 4. Kopfleiste ------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 28px;
  min-height: 52px;
  padding: 6px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

/* Wortmarke: "MYEDU" fett in Großbuchstaben, "Werkstatt" in leichter Schrift. Darunter rechts die Version. */
.brand { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1; }
.brand-home { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; color: var(--ink); text-decoration: none; }
/* Wortmarke: kleines [MYEDU] über dem großen, hellen "Werkstatt" (Klammern kommen aus dem CSS, der Text bleibt "MYEDU") */
.brand-myedu { font-weight: 400; font-size: 11px; line-height: 1; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink); }
.brand-myedu::before { content: "["; }
.brand-myedu::after { content: "]"; }
.brand-name { font-family: "Raleway", "Roboto", system-ui, sans-serif; font-weight: 300; font-size: 26px; line-height: 0.95; letter-spacing: -0.01em; color: var(--ink); margin-top: -1px; }
.brand-version { font-size: 10px; font-weight: 400; letter-spacing: 0.04em; color: var(--muted); text-decoration: none; }
.brand-version:hover { color: var(--link); text-decoration: underline; }

/* Hauptmenü: schlank, nur Text mit feiner Linie unter dem aktiven Punkt */
.mainnav { display: flex; align-items: stretch; gap: 2px; align-self: stretch; }
.mainnav a {
  display: inline-flex; align-items: center;
  padding: 0 12px;
  font-size: 15px; font-weight: 400; color: var(--muted-2); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.mainnav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.mainnav a[aria-current="page"] { color: var(--ink); font-weight: 500; border-bottom-color: var(--ink); }

.project-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex: 1 1 420px; justify-content: flex-end; position: relative; }
.course-title-box { margin-bottom: 14px; }
.course-title-box label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
input.project-title {
  width: 100%; padding: 8px 12px;
  font-size: 17px; font-weight: 600;
  background: var(--panel); border: 1px solid var(--field);
}
.save-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-status[data-kind="warn"] { color: var(--warn-fg); font-weight: 600; }
.save-status[data-kind="error"] { color: var(--bad-fg); font-weight: 600; }

/* Das Menü "Projekt" */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--accent-soft); border-color: var(--accent); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 2px;
  box-shadow: 0 8px 24px var(--shadow);
}
.menu-panel button {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px;
  text-align: left; font: inherit; color: var(--ink);
  background: transparent; border: 0; border-radius: 2px; cursor: pointer;
}
.menu-panel button:hover { background: var(--surface-3); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }

/* Außerhalb des Editors zeigen wir die Projekt-Bedienelemente nicht */
body:not(.view-editor) .project-controls,
body:not(.view-editor) .statusbar { display: none; }

/* ---- 5. Editor ------------------------------------------------------------------ */

.editor { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: stretch; }

/* Linke Spalte: Seitenliste (flach, nur eine feine Trennlinie) */
.pages {
  flex: 0 0 264px; max-width: 100%;
  padding: 24px 16px 24px 24px;
  background: transparent; border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 12px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.panel-head h2, .props-section h2 {
  margin: 0; font-size: 12px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.page-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.page-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 8px 8px;
  text-align: left; font: inherit; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; cursor: pointer;
}
.page-item:hover { background: var(--surface-2); }
.page-item.is-selected { background: var(--accent-wash); box-shadow: inset 0 -2px 0 var(--accent); }
.page-num { flex: 0 0 auto; min-width: 22px; font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.page-item.is-selected .page-num { color: var(--link); }
.page-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.page-name { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-item.is-selected .page-name { font-weight: 500; }

/* Mitte: Seiteninhalt. Volle Breite, der Inhalt steht zentriert in einer lesbaren Spalte, ohne Rahmen. */
.canvas { flex: 999 1 480px; min-width: 0; padding: 36px 40px 56px 40px; display: flex; flex-direction: column; align-items: center; }
.canvas > * { width: 100%; max-width: 760px; }
.canvas-meta { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.page-card { display: flex; flex-direction: column; gap: 20px; padding: 0; background: transparent; border: 0; }
input.page-title-input {
  padding: 4px 6px; margin-left: -6px; width: calc(100% + 6px);
  font-family: var(--font-display); font-size: 32px; font-weight: 500; letter-spacing: -0.01em;
  border-color: transparent; background: transparent;
}
input.page-title-input:hover { border-color: var(--line); }

/* Ein Block: keine Box, nur eine feine Linie darüber */
.block { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
.block:focus-within { background: var(--surface-2); border-top-color: var(--ink); box-shadow: none; }
.block:focus { outline: none; }
.block-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 0 2px 0;
  background: transparent; border-bottom: 0; border-radius: 0;
}
.block-type { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.block-actions { display: flex; gap: 2px; }
.block-body { padding: 4px 0 14px 0; }
.block-body > * + * { margin-top: 12px; }

/* Textfeld mit Werkzeugleiste */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--field); border-bottom: 0; border-radius: 2px 2px 0 0;
}
.tool {
  min-width: 40px; min-height: 36px; padding: 0 10px;
  font: inherit; font-size: 13px; color: var(--ink);
  background: transparent; border: 0; border-radius: 2px; cursor: pointer;
}
.tool:hover { background: var(--surface-3); }
.tool-bold { font-weight: 700; }
.tool-italic { font-style: italic; }

.rte {
  min-height: 90px; padding: 12px 14px;
  font-size: 16px; line-height: 1.6;
  border: 1px solid var(--field); border-radius: 0 0 2px 2px;
  background: var(--surface);
}
.rte:focus-within { border-color: var(--accent); }
.rte p { margin: 0 0 10px 0; }
.rte > :last-child { margin-bottom: 0; }
.rte h2 { font-size: 22px; margin: 0 0 8px 0; }
.rte ul, .rte ol { margin: 0 0 10px 0; padding-left: 24px; }
.rte a { color: var(--link); }

/* Bild und Video */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 24px; text-align: center;
  border: 2px dashed var(--field); border-radius: 2px; background: var(--surface-2);
}
.dropzone .hint { margin: 0; }
.image-preview, .video-preview {
  display: block; width: 100%; max-height: 320px; object-fit: contain;
  border: 1px solid var(--line); border-radius: 2px; background: var(--surface-2);
}
.video-preview { background: #000; }

/* Quiz */
.answers-set { margin: 0; padding: 10px 12px 12px 12px; border: 1px solid var(--line); border-radius: 2px; }
.answers-set legend { padding: 0 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.answers { display: flex; flex-direction: column; gap: 8px; }
.answer-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.correct-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; background: var(--accent-wash); border: 1px solid var(--accent-line); border-radius: 2px; font-size: 13px; cursor: pointer; }
.correct-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

.add-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.pill {
  min-height: 40px; padding: 0 14px;
  font: inherit; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--field); border-radius: 2px; cursor: pointer;
}
.pill:hover { border-color: var(--accent); background: var(--accent-wash); }
.empty-hint { margin: 0; padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--field); border-radius: 2px; }

/* Rechte Spalte: Eigenschaften */
.props {
  flex: 1 1 300px; max-width: 340px;
  padding: 24px 24px 24px 18px;
  background: transparent; border-left: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 22px;
}
.props-section { display: flex; flex-direction: column; gap: 10px; }
.props-section + .props-section { padding-top: 18px; border-top: 1px solid var(--line-soft); }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-grid .btn { white-space: normal; }
.plain-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.mono-box {
  padding: 10px 12px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 2px;
  overflow-x: auto;
}

/* Statusleiste unten */
.statusbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px;
  padding: 10px 20px;
  background: var(--panel); border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}

/* Kurzer Hinweis (Toast) */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 400;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  background: var(--strong-bg); color: var(--strong-fg); border-radius: 2px;
  box-shadow: 0 8px 24px var(--shadow);
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---- 6. Export-Fenster ----------------------------------------------------------- */

.dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0; border: 0; border-radius: 2px;
  color: var(--ink); background: var(--ground);
  box-shadow: 0 24px 64px var(--shadow);
}
.dialog::backdrop { background: var(--backdrop); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  border-radius: 2px 2px 0 0;
}
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-body { flex: 1 1 auto; overflow-y: auto; padding: 20px; display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.dialog-col { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.box { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.box h3 { margin: 0 0 12px 0; font-size: 16px; }
.dialog-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px;
  padding: 14px 20px; background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 0 0 2px 2px;
}
.dialog-foot > .muted { flex: 1 1 240px; margin: 0; font-size: 13px; }
.blocked { flex: 1 1 100%; order: -1; margin: 0; font-weight: 600; color: var(--bad-fg); }

.radio-set { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; }
.radio-set legend { padding: 0; margin-bottom: 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.radio-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-2); }
.radio-card.is-checked { border: 2px solid var(--accent); background: var(--accent-wash); padding: 11px 13px; }
.radio-card input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }
.radio-card span { display: flex; flex-direction: column; gap: 2px; }
.radio-card .muted { font-size: 13px; }
.radio-card.is-disabled strong { color: var(--muted); }

.inline-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.percent { display: inline-flex; align-items: center; gap: 8px; }
.percent input { width: 80px; text-align: right; }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; align-items: flex-start; gap: 10px; }

.tree {
  margin: 0 0 8px 0; padding: 12px 14px;
  font-size: 12.5px; line-height: 1.7;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 2px;
  overflow-x: auto;
}

/* ---- 7. Vorschau mit Simulator -------------------------------------------------------- */

.preview { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--ground); }
.preview-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.preview-head h2 { margin: 0; font-size: 18px; outline: none; }
.preview-head .muted { margin: 0; }
.preview-body {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px;
  padding: 20px; overflow: auto;
}
.preview-course { min-height: 0; }
.preview-frame { display: block; width: 100%; height: 100%; min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

.sim { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.sim-card { padding: 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.sim-card h3 { margin: 0 0 10px 0; font-size: 16px; }
.sim-dark { background: var(--strong-bg); color: #E8EDF1; border-color: var(--strong-bg); }
.sim-dark h3 { margin: 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: #C9D2DA; }
.sim-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sim-badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 2px; background: #33414D; color: #FFFFFF; }
.sim-badge[data-state="running"] { background: var(--accent); }
.sim-values {
  margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5;
}
.sim-values dt, .sim-values dd { margin: 0; padding: 8px 0; border-top: 1px solid #33414D; overflow-wrap: anywhere; }
.sim-values dt { color: #C9D2DA; padding-right: 8px; }
.sim-values dd { color: #FFFFFF; }
.sim-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sim-actions .btn { white-space: normal; }
.sim-note { margin: 12px 0 0 0; font-size: 12px; color: #C9D2DA; }

.sim-log {
  list-style: none; margin: 0; padding: 0;
  max-height: 300px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: 12px;
}
.sim-log li { display: flex; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.sim-log .log-time { flex: 0 0 auto; color: var(--muted); }
.sim-log .log-text { overflow-wrap: anywhere; }
.sim-log li.is-error .log-text { color: var(--bad-fg); }

/* ---- 8. Anleitung und Über-Seite ------------------------------------------------------- */

.doc { flex: 1 1 auto; padding: 36px 24px 64px 24px; }
.doc-inner { width: 100%; max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.doc-inner-narrow { max-width: 860px; }
.doc h1 { margin: 0; font-family: var(--font-display); font-size: 40px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; outline: none; }
.doc h2 { margin: 12px 0 0 0; font-size: 24px; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.005em; }
.doc h3 { margin: 18px 0 0 0; font-size: 18px; }
.doc h4 { margin: 18px 0 0 0; font-size: 15px; }
.doc .steps ul { margin-top: 8px; }
.doc p, .doc li { font-size: 16px; line-height: 1.65; }
.doc p { margin: 0; }
.doc ul, .doc ol { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 8px; }
.doc-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.lead { font-size: 18px !important; color: var(--muted-2); max-width: 760px; }

.doc section[id^="a-"] { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; border-top: 1px solid var(--line); }

.doc-toc { padding: 16px 0; background: transparent; border: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); border-radius: 0; }
.doc-toc h2 { margin: 0 0 8px 0; font-size: 18px; }
.doc-toc ol { columns: 2 320px; column-gap: 32px; gap: 4px; display: block; }
.doc-toc li { break-inside: avoid; margin-bottom: 4px; font-size: 15px; }

.steps { counter-reset: step; list-style: none; padding-left: 0 !important; }
.steps > li { counter-increment: step; position: relative; padding-left: 40px; }
.steps > li::before {
  content: counter(step) ".";
  position: absolute; left: 0; top: 0;
  min-width: 26px;
  color: var(--link); font-size: 16px; font-weight: 700;
}
.steps ul { margin-top: 8px; }

.callout { padding: 14px 0; background: transparent; border: 0; border-top: 1px solid var(--accent); border-bottom: 1px solid var(--line); border-radius: 0; }
.callout p, .callout li { font-size: 15px; }
.callout ul { margin-top: 8px; }
.callout-warn { background: transparent; border-top-color: var(--warn-fg); color: var(--ink); }
.callout-ai { border-top: 2px solid var(--accent); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.callout-ai h2 { margin: 0; font-size: 22px; }
.badge { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; border-radius: 0; background: var(--accent); color: #FFFFFF; }

.doc-table { width: 100%; border-collapse: collapse; background: transparent; border: 0; border-top: 1px solid var(--ink); font-size: 15px; }
.doc-table th, .doc-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.doc-table thead th { background: transparent; border-bottom: 1px solid var(--line); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); }
.doc-table tbody th { font-weight: 600; width: 32%; }
.doc-table tr:last-child th, .doc-table tr:last-child td { border-bottom: 0; }

.step-cards { display: flex; flex-wrap: wrap; gap: 16px; }
.step-cards .card { flex: 1 1 240px; }
.card { padding: 18px 0 0 0; background: transparent; border: 0; border-top: 1px solid var(--ink); border-radius: 0; display: flex; flex-direction: column; gap: 10px; }
.card h2 { margin: 0; font-size: 20px; }
.step-num { font-weight: 700; color: var(--link); font-size: 18px; }

/* ---- 9. Kleine Bildschirme und Drucken --------------------------------------------------- */

@media (max-width: 1000px) {
  .preview-body { grid-template-columns: minmax(0, 1fr); }
  .preview-frame { min-height: 70vh; }
  .props { max-width: none; flex-basis: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .pages { flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .topbar { padding: 8px 14px; }
  .canvas { padding: 16px 12px; }
  .page-card { padding: 16px; }
  input.page-title-input { font-size: 24px; }
  .doc h1 { font-size: 30px; }
  .doc { padding: 24px 16px 48px 16px; }
  .answer-row { grid-template-columns: minmax(0, 1fr) auto; }
  .answer-row .correct-toggle { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

@media print {
  /* Gedruckt wird immer im hellen Design */
  :root:root:root {
  --ground: #FFFFFF;        /* Hintergrund der ganzen App */
  --panel: #FFFFFF;         /* Hintergrund von Karten und Leisten */
  --surface: #FFFFFF;       /* Eingabefelder, Blöcke, Menüs */
  --surface-2: #F5F5F2;     /* leicht abgesetzte Flächen */
  --surface-3: #EBEBE7;     /* Code, Hover-Flächen */
  --line: #CFCFCB;          /* feine Linien */
  --line-soft: #E4E4E0;     /* noch feinere Linien */
  --field: #8B9096;         /* Rahmen von Eingabefeldern */
  --ink: #16181A;           /* Textfarbe */
  --muted: #5A5F64;         /* zurückhaltender Text */
  --muted-2: #3A3E42;       /* etwas dunklerer zurückhaltender Text */
  --strong-bg: #16181A;     /* dunkle Flächen (Werkzeugleiste, Hinweis-Meldung) */
  --strong-fg: #FFFFFF;     /* Schrift auf dunklen Flächen */
  --strong-hover: #33383C;
  --accent: #0B6B5F;        /* Hauptfarbe (Knöpfe) */
  --accent-dark: #07524A;   /* Hauptfarbe, dunkel (Darüberfahren) */
  --accent-soft: #E1EFEC;   /* Hauptfarbe, sehr hell */
  --accent-wash: #F1F7F6;   /* Hauptfarbe, fast weiß */
  --accent-line: #A9CFC8;   /* Rahmen in Hauptfarbe */
  --link: #07524A;          /* Links */
  --link-hover: #0B6B5F;
  --warn-bg: #FBF0E6;       /* Hinweis-Hintergrund (orange) */
  --warn-fg: #8F3508;       /* Hinweis-Text (orange) */
  --warn-line: #E6C4A6;
  --warn-ink: #5E2606;
  --bad-bg: #FBE6E6;        /* Fehler-Hintergrund */
  --bad-fg: #8A1C1C;        /* Fehler-Text */
  --video-bg: #E3E9FB;      /* Chip "Video" */
  --video-fg: #2B4AA0;
  --code-ink: #124F46;
  --shadow: rgba(22, 24, 26, 0.14);
  --backdrop: rgba(22, 24, 26, 0.5);
  }
  .topbar, .statusbar, .skip-link, .toast, .doc-top .btn, .doc-toc { display: none !important; }
  body { background: var(--surface); font-size: 12pt; }
  .doc { padding: 0; }
  .doc-inner { max-width: none; }
  .doc section[id^="a-"] { break-inside: avoid-page; }
  .doc-table, .callout { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}


/* ==========================================================================
 * Akademische Textseiten ("Über" und "SCORM im Detail")
 * Ruhiges Schriftbild: Serifenschrift, schmale Spalte, nummerierte Abschnitte,
 * Tabellen nur mit Linien, keine Kästen.
 * ========================================================================== */
.doc.paper { background: var(--panel); padding: 40px 24px 80px 24px; }
.paper-inner {
  width: 100%; max-width: 42rem; margin: 0 auto;
  font-family: var(--font);
  color: var(--ink); font-size: 17px; line-height: 1.7;
  hyphens: auto; -webkit-hyphens: auto;
}
.paper-inner a { color: var(--link); text-underline-offset: 3px; }
.paper-inner p, .paper-inner li, .paper-inner dd { font-size: 17px; line-height: 1.7; }
.paper-inner p { margin: 0 0 1em 0; }

/* Unterseiten-Navigation */
.subnav { display: flex; gap: 22px; padding-bottom: 10px; margin-bottom: 36px; border-bottom: 1px solid var(--line); font-family: var(--font); font-size: 14px; }
.subnav a { color: var(--muted); text-decoration: none; padding-bottom: 8px; margin-bottom: -11px; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }

/* Kopf */
.paper-head { margin-bottom: 28px; }
.kicker { margin: 0 0 10px 0 !important; font-family: var(--font); font-size: 12px !important; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.paper .paper-head h1 { font-family: var(--font); font-size: 40px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; margin: 0 0 22px 0; }
.abstract { margin: 0 !important; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 16px !important; line-height: 1.65 !important; color: var(--muted-2); }
.abstract p, .abstract { font-size: 16px; }
.abstract-label { font-weight: 600; font-style: italic; }

/* Überschriften */
.paper .sec { display: block; margin: 40px 0 0 0; padding: 0; border: 0; }
.paper h2 { margin: 0 0 12px 0; font-family: var(--font); font-size: 24px; font-weight: 600; letter-spacing: 0; line-height: 1.3; }
.paper h3 { margin: 26px 0 8px 0; font-family: var(--font); font-size: 19px; font-weight: 600; font-style: italic; }
.secnum { display: inline-block; min-width: 1.6em; color: var(--muted); font-weight: 400; font-variant-numeric: lining-nums; }

/* Inhaltsverzeichnis */
.paper .toc { margin: 30px 0 0 0; padding: 0; background: none; border: 0; }
.paper .toc h2 { font-size: 16px; font-family: var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.paper .toc ol { margin: 0; padding-left: 1.6em; display: block; list-style: decimal; columns: 2 16rem; column-gap: 2rem; }
.paper .toc li { margin: 0 0 2px 0; font-size: 16px; break-inside: avoid; }

/* Listen */
.paper-inner ol.plain, .paper-inner ul.plain { margin: 0 0 1em 0; padding-left: 1.5em; display: block; }
.paper-inner ol.plain li, .paper-inner ul.plain li { margin-bottom: 0.6em; }
.paper-inner ul.refs { margin: 0; padding-left: 0; list-style: none; }
.paper-inner ul.refs li { padding-left: 1.5em; text-indent: -1.5em; margin-bottom: 0.6em; font-size: 16px; }

/* Begriffsliste */
.terms { margin: 0 0 1em 0; }
.terms dt { margin-top: 14px; font-weight: 600; }
.terms dd { margin: 2px 0 0 0; padding-left: 1.5em; }

/* Tabellen im Stil wissenschaftlicher Arbeiten: nur drei Linien */
.booktab { width: 100%; margin: 24px 0 28px 0; border-collapse: collapse; background: none; border: 0; border-radius: 0; font-size: 15px; line-height: 1.5; overflow: visible; }
.booktab caption { caption-side: top; text-align: left; padding: 0 0 8px 0; font-size: 14px; font-style: italic; color: var(--muted-2); }
.booktab th, .booktab td { padding: 7px 14px 7px 0; text-align: left; vertical-align: top; border: 0; border-bottom: 1px solid var(--line-soft); background: none; font-size: 15px; line-height: 1.5; }
.booktab thead th { border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); font-family: var(--font); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; color: var(--ink); }
.booktab tbody tr:last-child th, .booktab tbody tr:last-child td { border-bottom: 1.5px solid var(--ink); }
.booktab tbody th { width: 30%; font-weight: 600; }
.paper code { font-family: var(--font-mono); font-size: 0.84em; background: none; padding: 0; color: var(--code-ink); overflow-wrap: anywhere; }

/* Codebeispiel */
.paper pre.code { margin: 18px 0 24px 0; padding: 4px 0 4px 18px; border-left: 2px solid var(--line); background: none; overflow-x: auto; font-size: 13.5px; line-height: 1.55; }
.paper pre.code code { font-size: 13.5px; color: var(--ink); overflow-wrap: normal; white-space: pre; }

/* Anmerkungen */
.paper .notes { margin-top: 56px; padding-top: 14px; border-top: 1px solid var(--ink); width: 40%; min-width: 14rem; }
.paper .notes h2 { font-family: var(--font); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 0; }
.paper .notes ol { margin: 0; padding-left: 1.4em; display: block; }
.paper .notes li { font-size: 14px; line-height: 1.55; }
.paper sup { font-size: 0.7em; line-height: 0; }
.paper sup a { text-decoration: none; padding: 0 1px; }

@media (max-width: 640px) {
  .doc.paper { padding: 24px 16px 56px 16px; }
  .paper-inner, .paper-inner p, .paper-inner li, .paper-inner dd { font-size: 17px; }
  .paper .paper-head h1 { font-size: 30px; }
  .booktab { font-size: 14px; display: block; overflow-x: auto; }
  .paper .notes { width: 100%; }
}
@media print {
  .subnav { display: none; }
  .doc.paper { padding: 0; background: #fff; }
  .paper-inner { max-width: none; font-size: 11.5pt; }
  .booktab { break-inside: avoid; }
}
.paper [id] { scroll-margin-top: 80px; }

/* Umschalter Hell/Dunkel */
.theme-toggle { margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; background: transparent; border: 1px solid var(--field); border-radius: 2px; color: var(--ink); cursor: pointer; }
.theme-toggle:hover { background: var(--surface-3); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Sprungziele nicht unter der festen Kopfleiste verstecken */
.doc [id] { scroll-margin-top: 80px; }
.doc [id]:focus { outline: none; }


/* ---- 11. Paket bearbeiten (Dateimodus, js/paket.js) ------------------------------- */

.paket { flex: 1 1 auto; }
.paket-wrap { max-width: 1040px; margin: 0 auto; padding: 32px 24px 72px 24px; }
.paket-narrow { max-width: 820px; padding-top: 48px; }
.paket h1 { margin: 0 0 10px 0; font-size: 30px; line-height: 1.2; }
.paket h1:focus { outline: none; }
.paket h2 { margin: 0 0 12px 0; font-size: 17px; }
.paket .lead { margin: 0 0 24px 0; font-size: 17px; line-height: 1.6; color: var(--muted); }
.paket-error { padding: 12px 14px; margin: 0 0 16px 0; background: var(--bad-bg); color: var(--bad-fg); border-radius: 2px; font-weight: 500; }

.paket-drop {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding: 44px 24px; background: var(--panel); border: 2px dashed var(--field); border-radius: 2px;
}
.paket-drop.is-over { border-color: var(--accent); background: var(--accent-wash); }
.paket-drop p { margin: 0; }
.paket-drop-icon { width: 56px; height: 56px; border-radius: 2px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
:root[data-theme="dark"] .paket-drop-icon { color: var(--link); }
.paket-drop-title { font-size: 18px; font-weight: 500; }
.paket-two { display: flex; flex-wrap: wrap; gap: 28px; margin: 36px 0 24px 0; }
.paket-two > section { flex: 1 1 300px; min-width: 0; }

.paket-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.paket-head-text { min-width: 0; }
.paket-file { margin: 0 0 6px 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.paket-head h1 { margin: 0; overflow-wrap: anywhere; }
.paket-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.paket-count { font-size: 14px; color: var(--link); font-weight: 500; }

.paket-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.paket-tab {
  min-height: 44px; padding: 0 16px; margin-bottom: -1px; font: inherit; font-size: 14px; color: var(--muted);
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
}
.paket-tab:hover { color: var(--ink); }
.paket-tab[aria-current="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.paket-tab-n { color: var(--muted); font-weight: 400; font-size: 12px; }

.paket-panel { display: flex; flex-direction: column; gap: 18px; }
.paket-box h2 { margin-top: 0; }
.paket-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 28px; }
.paket-facts dt { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.paket-facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.paket-facts-small { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

.paket-checks { list-style: none; margin: 0; padding: 0; }
.paket-check { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.paket-check:first-child { border-top: 0; }
.paket-check p { margin: 0; }
.paket-check .muted { font-size: 14px; line-height: 1.5; margin-top: 2px; }
.paket-check-title { font-weight: 500; }
.paket-tag { flex: 0 0 auto; min-width: 64px; text-align: center; padding: 3px 10px; margin-top: 0; }

.paket-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

.paket-find { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 12px; }
.paket-find .field { flex: 1 1 200px; margin-bottom: 0; }
.paket-find .paket-grow { flex: 2 1 320px; }
.paket-only { white-space: nowrap; }

.paket-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.paket-item { padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 2px; }
.paket-item.is-changed { background: var(--accent-wash); border-color: var(--accent); }
.paket-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.paket-item-head .tag { margin-top: 0; }
.paket-item-head .link-btn { margin-left: auto; align-self: center; min-height: 32px; }
.paket-where { margin: 0; font-family: var(--font-mono); font-size: 12px; padding: 2px 10px; border-radius: 2px; background: var(--surface-3); color: var(--muted-2); overflow-wrap: anywhere; }
.paket-label { font-size: 12px; }
.paket-before { margin: 8px 0 0 0; font-size: 13px; color: var(--muted); text-decoration: line-through; overflow-wrap: anywhere; }
.paket-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }

.paket-images { list-style: none; margin: 16px 0 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.paket-image { display: flex; flex-wrap: wrap; gap: 16px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 2px; }
.paket-image.is-changed { border-color: var(--accent); background: var(--accent-wash); }
.paket-thumb-box { width: 140px; height: 100px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(var(--surface-3) 0% 25%, var(--surface-2) 0% 50%) 50% / 16px 16px; border-radius: 2px; overflow: hidden; }
.paket-thumb { max-width: 100%; max-height: 100%; }
.paket-image-info { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.paket-image-info p { margin: 0; }
.paket-inline-tag { margin: 0; }
.paket-image-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.paket-files-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.paket-files-head h2 { margin: 0; }
.paket-table-wrap { overflow-x: auto; }
.paket-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.paket-table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 8px 10px 8px 0; }
.paket-table td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.paket-table .num { text-align: right; white-space: nowrap; }
.paket-table .mono { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.paket-row-actions { white-space: nowrap; text-align: right; display: table-cell; }
.paket-row-actions .btn { margin-left: 6px; }

.paket-changes { list-style: none; margin: 0; padding: 0; }
.paket-changes li { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.paket-changes li:first-child { border-top: 0; }
.paket-changes p { margin: 0; }
.paket-changes .paket-where { display: inline-block; margin-bottom: 6px; }
.paket-old, .paket-new { margin-top: 4px !important; padding: 6px 10px; border-radius: 2px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.paket-old { background: var(--bad-bg); color: var(--bad-fg); text-decoration: line-through; }
.paket-new { background: var(--accent-soft); color: var(--code-ink); }

@media (max-width: 640px) {
  .paket-wrap { padding: 20px 16px 56px 16px; }
  .paket h1 { font-size: 24px; }
}


/* ---- 12. Kleine Bildschirme: Kopfleiste mit aufklappbarem Menü ---------------------
 * Unter 800 px Breite würde die Kopfleiste in vier Zeilen umbrechen. Stattdessen:
 *   Zeile 1: Logo, Hell/Dunkel, Knopf "Menü"
 *   Zeile 2: das Hauptmenü (nur sichtbar, wenn man "Menü" antippt)
 *   Zeile 3: die Editor-Knöpfe (Projekt, Vorschau, Exportieren), nur im Editor
 * Die Reihenfolge der Zeilen wird mit "order" festgelegt. */

.nav-toggle { display: none; }

@media (max-width: 800px) {
  .topbar { gap: 8px; padding: 8px 12px 8px 16px; }
  .brand { order: 1; }
  .theme-toggle { order: 2; width: 44px; height: 44px; }
  .nav-toggle {
    order: 3; display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 14px;
    font: inherit; font-weight: 500; color: var(--ink);
    background: var(--surface); border: 1px solid var(--field); border-radius: 2px; cursor: pointer;
  }
  .nav-toggle svg { width: 18px; height: 18px; }
  .nav-toggle[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }

  /* Hauptmenü: eigene Zeile, standardmäßig zu */
  .mainnav { order: 4; flex: 1 1 100%; display: none; flex-direction: column; gap: 4px; padding: 4px 0 8px 0; border-top: 1px solid var(--line); }
  .topbar.nav-open .mainnav { display: flex; }
  .mainnav a {
    min-height: 52px; padding: 0 14px; font-size: 16px; border-bottom: 0; border-radius: 2px;
    justify-content: space-between;
  }
  .mainnav a[aria-current="page"] { background: var(--accent-soft); }
  .mainnav a[aria-current="page"]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--link); }

  /* Editor-Knöpfe: eigene Zeile unter dem Menü, die ganze Breite */
  .project-controls {
    order: 5; flex: 1 1 100%; justify-content: flex-start; flex-wrap: nowrap; gap: 8px;
    margin: 0 -12px 0 -16px; padding: 8px 12px 8px 16px;
    background: var(--surface-2); border-top: 1px solid var(--line);
  }
  .project-controls .save-status { display: none; }          /* steht schon unten in der Statusleiste */
  .project-controls .btn { padding: 0 12px; }
  .project-controls #btn-export { flex: 1 1 auto; }
  .menu { position: static; }
  .menu-panel { left: 16px; right: 12px; min-width: 0; }
}

/* ---- 13. Startseite, Fußbereich (akademischer Stil) ------------------
 * Zurückhaltend: weißer Grund, Text in einer lesbaren Breite, feine Linien als Gliederung,
 * kleine Großbuchstaben-Beschriftungen, keine Kästen. */

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; box-sizing: border-box; }
.eyebrow { margin: 0 0 16px 0; font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--link); }

.home { flex: 1 1 auto; }
.home h1 {
  margin: 0; max-width: 20ch;
  font-family: var(--font-display); font-weight: 500; font-size: clamp(32px, 5.2vw, 54px); line-height: 1.1; letter-spacing: -0.015em;
  outline: none;
}
.home-hero { padding: 80px 0 56px 0; border-bottom: 1px solid var(--ink); }
.home-lead { margin: 24px 0 0 0; max-width: 640px; font-size: 19px; line-height: 1.6; color: var(--muted-2); }
.home-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0 0; }
.home .btn { text-decoration: none; }

.home-section { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px 32px; padding: 48px 0; border-top: 1px solid var(--line); }
.home-section:first-of-type { border-top: 0; }
.home-section > h2 { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.home-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 32px; }
.home-features li { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--ink); }
.home-num { font-size: 13px; font-weight: 500; color: var(--link); font-variant-numeric: tabular-nums; }
.home-features h3 { margin: 0; font-size: 21px; font-weight: 500; }
.home-features p { margin: 0; line-height: 1.6; color: var(--muted-2); }
.home-features a { margin-top: auto; padding-top: 6px; font-weight: 500; }

.home-facts { margin: 0; }
.home-facts > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 8px 24px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.home-facts > div:first-child { border-top: 0; padding-top: 0; }
.home-facts dt { font-weight: 500; }
.home-facts dd { margin: 0; line-height: 1.6; color: var(--muted-2); }

.home-links { list-style: none; margin: 0; padding: 0; }
.home-links li { border-top: 1px solid var(--line-soft); }
.home-links li:first-child { border-top: 1px solid var(--ink); }
.home-links li:last-child { border-bottom: 1px solid var(--line-soft); }
.home-links a { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 8px 24px; align-items: baseline; padding: 16px 4px; color: var(--ink); text-decoration: none; font-weight: 500; }
.home-links a:hover { background: var(--surface-2); color: var(--link); }
.home-links-text { font-weight: 400; color: var(--muted-2); }

/* Fußbereich (nur außerhalb des Editors) */
.sitefooter { margin-top: auto; border-top: 1px solid var(--line); background: var(--panel); font-size: 14px; color: var(--muted); }
.sitefooter-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 32px; padding-top: 20px; padding-bottom: 20px; }
.sitefooter p { margin: 0; }
.sitefooter nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.sitefooter a { color: var(--muted-2); }
.sitefooter a:hover { color: var(--link); }
body.view-editor .sitefooter { display: none; }

@media (max-width: 700px) {
  .home-hero { padding: 48px 0 36px 0; }
  .home-section { grid-template-columns: minmax(0, 1fr); padding: 36px 0; }
  .home-facts > div { grid-template-columns: minmax(0, 1fr); }
  .home-links a { grid-template-columns: minmax(0, 1fr) auto; }
  .home-links-text { grid-column: 1 / -1; grid-row: 2; }
  .wrap { padding: 0 16px; }
}
@media print { .sitefooter { display: none !important; } }
