/* ── Reset & Basis ──────────────────────────────────────────────────────────── */
.mathdoc-root *, .mathdoc-root *::before, .mathdoc-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
:root {
  --bg:        #ffffff;
  --bg2:       #f7f7f5;
  --bg3:       #eeeee9;
  --text:      #1a1a18;
  --text2:     #555550;
  --text3:     #888880;
  --accent:    #4a6cf7;
  --accent2:   #e8eeff;
  --border:    #ddddd8;
  --border2:   #c8c8c2;

  --card-theorem:    #eef2ff;
  --card-proof:      #f5f5f3;
  --card-axiom:      #fff8ee;
  --card-definition: #eefaf4;
  --card-algorithm:  #f3eeff;
  --card-taxonomy:   #fef9ec;
  --card-remark:     #f5f8ff;
  --card-intuition:  #fffbea;
  --card-example:    #f3fdf6;
  --card-code:       #f6f6f4;
  --card-exercise:   #fef4f0;

  --card-theorem-border:    #b8c8ff;
  --card-proof-border:      #ccccca;
  --card-axiom-border:      #f0c870;
  --card-definition-border: #6ed8a8;
  --card-algorithm-border:  #b890f8;
  --card-taxonomy-border:   #f0c840;
  --card-remark-border:     #9ab4f8;
  --card-intuition-border:  #f8d840;
  --card-example-border:    #70d890;
  --card-code-border:       #c0c0bc;
  --card-exercise-border:   #f8a880;

  --radius:  10px;
  --sidebar: 240px;
  --font:    system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #18181a;
    --bg2:       #222226;
    --bg3:       #2e2e34;
    --text:      #e8e8e2;
    --text2:     #aaaaaa;
    --text3:     #777770;
    --accent:    #7a9cff;
    --accent2:   #1e2550;
    --border:    #333338;
    --border2:   #444448;

    --card-theorem:    #1c2040;
    --card-proof:      #1e1e22;
    --card-axiom:      #2a2010;
    --card-definition: #102018;
    --card-algorithm:  #1e1030;
    --card-taxonomy:   #28220c;
    --card-remark:     #141828;
    --card-intuition:  #26200a;
    --card-example:    #0e2016;
    --card-code:       #1a1a1e;
    --card-exercise:   #28100a;

    --card-theorem-border:    #3a4888;
    --card-proof-border:      #444448;
    --card-axiom-border:      #8a6020;
    --card-definition-border: #28785a;
    --card-algorithm-border:  #6040a0;
    --card-taxonomy-border:   #807010;
    --card-remark-border:     #3050a0;
    --card-intuition-border:  #806820;
    --card-example-border:    #2a7040;
    --card-code-border:       #383840;
    --card-exercise-border:   #903820;
  }
}

.mathdoc-root {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  background: var(--bg);
  color: var(--text);
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

#sidebar {
  width: var(--sidebar);
  min-width: var(--sidebar);
  border-right: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 0;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .mathdoc-root #sidebar { display: none; }
  .mathdoc-root #app { flex-direction: column; }
}

#sidebar-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 16px 16px 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}

#history-list {
  list-style: none;
  padding: 8px 0;
}

#history-list li {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
  line-height: 1.4;
}

#history-list li:hover {
  background: var(--bg3);
  color: var(--text);
}

#history-list li.active {
  border-left-color: var(--accent);
  color: var(--text);
  background: var(--accent2);
  font-weight: 500;
}

#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mathdoc-root header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

#btn-back {
  padding: 5px 14px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

#btn-back:hover:not(:disabled) { background: var(--bg3); }
#btn-back:disabled { opacity: .35; cursor: default; }

#breadcrumb {
  font-size: 13px;
  color: var(--text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#content-area {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  width: 100%;
}

/* ── Dokumenttitel ─────────────────────────────────────────────────────────── */
.doc-title {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
  color: var(--text);
}

.doc-summary {
  font-size: 1rem;
  color: var(--text2);
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* ── Überschriften ─────────────────────────────────────────────────────────── */
.mathdoc-root h2 { font-size: 1.45rem; font-weight: 600; margin: 32px 0 12px; }
.mathdoc-root h3 { font-size: 1.2rem;  font-weight: 600; margin: 24px 0 8px; }
.mathdoc-root h4 { font-size: 1rem;    font-weight: 600; margin: 20px 0 6px; }

/* ── Fließtext ─────────────────────────────────────────────────────────────── */
.mathdoc-root p { margin-bottom: 1rem; color: var(--text); }

/* ── Karten / Blöcke ───────────────────────────────────────────────────────── */
.md-block {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 18px 0;
  overflow: visible;
  transition: box-shadow .2s;
}

.md-block:hover { box-shadow: 0 2px 12px rgba(0,0,0,.08); }

.card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  background: rgba(0,0,0,.02);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-body {
  padding: 14px 16px;
}

/* Karten-Farben per Typ */
.md-theorem    { background: var(--card-theorem);    border-color: var(--card-theorem-border); }
.md-proof      { background: var(--card-proof);      border-color: var(--card-proof-border); }
.md-axiom      { background: var(--card-axiom);      border-color: var(--card-axiom-border); }
.md-definition { background: var(--card-definition); border-color: var(--card-definition-border); }
.md-algorithm  { background: var(--card-algorithm);  border-color: var(--card-algorithm-border); }
.md-taxonomy   { background: var(--card-taxonomy);   border-color: var(--card-taxonomy-border); }
.md-remark     { background: var(--card-remark);     border-color: var(--card-remark-border); }
.md-intuition  { background: var(--card-intuition);  border-color: var(--card-intuition-border); }
.md-example    { background: var(--card-example);    border-color: var(--card-example-border); }
.md-code       { background: var(--card-code);       border-color: var(--card-code-border); }
.md-exercise   { background: var(--card-exercise);   border-color: var(--card-exercise-border); }

/* Remark-Typen (Randfarbe links) */
.md-remark-warning     { border-left: 4px solid #f59e0b; }
.md-remark-advantage   { border-left: 4px solid #22c55e; }
.md-remark-disadvantage{ border-left: 4px solid #ef4444; }
.md-remark-tradeoff    { border-left: 4px solid #a855f7; }
.md-remark-rule_of_thumb { border-left: 4px solid #3b82f6; }
.md-remark-open_question { border-left: 4px solid #f97316; }

/* ── Verstanden-Steuerung ──────────────────────────────────────────────────── */
.understanding-ctrl {
  position: absolute;
  top: 6px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 5;
}

.ctrl-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .55;
  transition: opacity .15s, background .15s, transform .1s;
  line-height: 1;
  padding: 0;
}

.ctrl-btn:hover { opacity: 1; transform: scale(1.15); }
.ctrl-btn.active { opacity: 1; }

.ctrl-yes.active  { background: #dcfce7; border-color: #22c55e; color: #15803d; }
.ctrl-no.active   { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }
.ctrl-question.active { background: #fef9c3; border-color: #eab308; color: #854d0e; }

/* Hintergrund-Highlight je nach Status */
.state-yes     { outline: 2px solid #22c55e44; }
.state-no      { outline: 2px solid #ef444444; }
.state-question{ outline: 2px solid #eab30844; }

/* ── Simpler-Button ────────────────────────────────────────────────────────── */
.btn-simpler {
  display: inline-block;
  margin: 8px 16px 12px;
  padding: 5px 12px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  background: var(--bg);
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.btn-simpler:hover {
  background: var(--accent2);
  border-color: var(--accent);
}

/* ── Simpler-Overlay ───────────────────────────────────────────────────────── */
#simpler-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0;
}

#simpler-overlay.hidden { display: none; }

#simpler-panel {
  width: min(480px, 100vw);
  height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.2);
  overflow: hidden;
}

#simpler-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

#simpler-back {
  padding: 4px 12px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#simpler-back:hover { background: var(--bg3); }

#simpler-title {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#simpler-level-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--accent2);
  color: var(--accent);
  border: 1px solid var(--accent);
  white-space: nowrap;
}

#simpler-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px;
}

#simpler-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

#btn-deeper {
  padding: 6px 16px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}

#btn-deeper:hover { background: var(--bg3); }

/* ── Mathematik ────────────────────────────────────────────────────────────── */
.md-math-display {
  margin: 14px 0;
  overflow-x: auto;
  padding: 10px 0;
  text-align: center;
}

.md-math-inline { white-space: nowrap; }

.md-hyperparam {
  cursor: help;
  border-bottom: 1px dashed var(--accent);
  white-space: nowrap;
}

.notation {
  padding: 6px 16px;
  font-size: 1.05rem;
  color: var(--text2);
}

/* ── Code ──────────────────────────────────────────────────────────────────── */
.md-code pre {
  margin: 0;
  border-radius: 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  background: transparent !important;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.md-code code {
  font-family: var(--mono);
  background: transparent !important;
}

.code-purpose {
  padding: 8px 16px 2px;
  font-size: 13px;
  color: var(--text2);
  font-style: italic;
}

.code-explanation {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-line-exp {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13.5px;
  line-height: 1.5;
}

.line-ref {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text3);
  white-space: nowrap;
}

.line-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text2);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg2);
  white-space: nowrap;
}

/* ── Inline-Spans ──────────────────────────────────────────────────────────── */
.md-span.has-simpler {
  border-bottom: 1px dashed var(--accent);
  cursor: pointer;
  color: var(--accent);
  transition: background .15s;
}

.md-span.has-simpler:hover {
  background: var(--accent2);
  border-radius: 3px;
}

/* Logische Rollen */
.role-universal     { border-bottom: 1px dotted #6366f1; }
.role-existential   { border-bottom: 1px dotted #059669; }
.role-hypothesis    { border-bottom: 1px dotted #d97706; }
.role-conclusion    { border-bottom: 1px dotted #e11d48; }
.role-negation      { border-bottom: 1px dotted #dc2626; }

.md-ref {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}

/* ── Beweis-Schritte ───────────────────────────────────────────────────────── */
.proof-step {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--card-proof-border);
  background: var(--bg2);
  border-radius: 0 6px 6px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.step-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
}

.step-num {
  font-weight: 700;
  color: var(--text3);
  min-width: 20px;
}

.qed {
  text-align: right;
  font-size: 1.4rem;
  color: var(--text3);
  padding: 8px 0 0;
}

.justification {
  font-size: 13px;
  color: var(--text2);
  font-style: italic;
  margin-top: 8px;
}

/* ── Conditions ────────────────────────────────────────────────────────────── */
.conditions-list {
  margin-top: 12px;
  padding-left: 20px;
  list-style: disc;
  font-size: 14px;
  color: var(--text2);
}

.conditions-list li { margin: 4px 0; }

/* ── Algorithmus ───────────────────────────────────────────────────────────── */
.complexity {
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text2);
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.algo-step {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--card-algorithm-border);
  background: var(--bg2);
  border-radius: 0 6px 6px 0;
}

/* ── Taxonomie ─────────────────────────────────────────────────────────────── */
.taxonomy-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.tax-category {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.tax-cat-label {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}

.tax-cat-desc {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 8px;
}

.tax-variants {
  padding-left: 18px;
  font-size: 14px;
  color: var(--text2);
  list-style: circle;
}

.tax-variants li { margin: 4px 0; }

/* ── Tabelle ───────────────────────────────────────────────────────────────── */
.md-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

.table-caption {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
  font-style: italic;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.md-table th, .md-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.md-table th {
  background: var(--bg2);
  font-weight: 600;
}

.md-table tr:nth-child(even) td { background: var(--bg2); }

/* ── Liste ─────────────────────────────────────────────────────────────────── */
.md-list {
  padding-left: 24px;
  margin: 10px 0;
  font-size: 15px;
  color: var(--text);
}

.md-list li { margin: 5px 0; }

/* ── Abbildung ─────────────────────────────────────────────────────────────── */
.md-figure {
  margin: 18px 0;
  text-align: center;
}

.md-figure img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.md-figure figcaption {
  font-size: 13px;
  color: var(--text2);
  margin-top: 6px;
  font-style: italic;
}

.visual-labels {
  list-style: none;
  font-size: 13px;
  color: var(--text3);
  margin-top: 6px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.visual-labels li {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
}

/* ── Aufgaben: Hint/Lösung ─────────────────────────────────────────────────── */
.btn-toggle-hint {
  display: inline-block;
  margin: 10px 16px 4px;
  padding: 5px 14px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}

.btn-toggle-hint:hover { background: var(--bg3); }

.hint-body {
  margin: 4px 16px 12px;
  padding: 12px 14px;
  border-left: 3px solid var(--border2);
  background: var(--bg2);
  border-radius: 0 8px 8px 0;
  font-size: 14.5px;
}

.solution-body {
  border-left-color: #22c55e;
}

/* ── Quote (Blockzitat) ─────────────────────────────────────────────────────── */
.md-quote {
  margin: 20px 0;
  padding: 16px 20px 14px;
  border-left: 4px solid var(--accent);
  background: var(--bg2);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.quote-text {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.65;
}

.quote-text::before { content: '\201C'; }
.quote-text::after  { content: '\201D'; }

.quote-attribution {
  font-size: 13px;
  color: var(--text3);
}

.quote-attribution a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* ── CTA (Call to Action) ───────────────────────────────────────────────────── */
.md-cta {
  margin: 24px 0;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cta-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.cta-text {
  font-size: 14.5px;
  color: var(--text2);
  margin: 0;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.cta-btn {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  cursor: pointer;
}

.cta-btn:hover { opacity: .85; }

.cta-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.cta-btn-secondary {
  background: var(--bg);
  color: var(--accent);
  border-color: var(--accent);
}

.cta-btn-ghost {
  background: transparent;
  color: var(--text2);
  border-color: var(--border2);
}

.cta-btn-ghost:hover { background: var(--bg3); }
.mathdoc-root ::-webkit-scrollbar { width: 6px; height: 6px; }
.mathdoc-root ::-webkit-scrollbar-track { background: transparent; }
.mathdoc-root ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.mathdoc-root ::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .mathdoc-root #content-area { padding: 16px 14px 60px; }
  .mathdoc-root .doc-title { font-size: 1.5rem; }
  .mathdoc-root .understanding-ctrl { top: 4px; right: 4px; }
} 


#sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.sidebar-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.sidebar-tab:hover { color: var(--text); }
.sidebar-tab.active { color: var(--text); border-bottom-color: var(--accent); }

#toc-list {
  list-style: none;
  padding: 8px 0;
}
.toc-item a {
  display: block;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  line-height: 1.4;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.toc-item a:hover { background: var(--bg3); color: var(--text); }
.toc-level-2 a { padding-left: 16px; }
.toc-level-3 a { padding-left: 28px; font-size: 12px; }

#settings-panel {
  padding: 14px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: center;
}
#settings-panel label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
  white-space: nowrap;
}
#settings-panel input[type=range] {
  width: 120px;
  accent-color: var(--accent);
}
#settings-panel span { min-width: 2.5em; text-align: right; color: var(--text); font-weight: 600; }

#presentation-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
}
#presentation-overlay.hidden { display: none; }

#presentation-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
#presentation-title {
  font-weight: 700;
  font-size: 15px;
  flex: 1;
}
#presentation-counter {
  font-size: 13px;
  color: var(--text3);
}
#btn-exit-presentation {
  padding: 5px 14px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
#btn-exit-presentation:hover { background: var(--bg3); }

#presentation-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
#presentation-content .pres-block {
  width: 100%;
  max-width: 760px;
}

#presentation-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
#presentation-footer button {
  padding: 7px 20px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
#presentation-footer button:hover:not(:disabled) { background: var(--bg3); }
#presentation-footer button:disabled { opacity: .35; cursor: default; }

#presentation-progress {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
#presentation-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .25s ease;
}

/* Slide-Animationen */
@keyframes slide-in-right  { from { opacity:0; transform: translateX( 40px); } to { opacity:1; transform: translateX(0); } }
@keyframes slide-in-left   { from { opacity:0; transform: translateX(-40px); } to { opacity:1; transform: translateX(0); } }
@keyframes slide-out-left  { from { opacity:1; transform: translateX(0); } to { opacity:0; transform: translateX(-40px); } }
@keyframes slide-out-right { from { opacity:1; transform: translateX(0); } to { opacity:0; transform: translateX( 40px); } }

#presentation-content.pres-slide-in          { animation: slide-in-right  .25s ease; }
#presentation-content.pres-slide-out-left    { animation: slide-out-left  .2s ease forwards; }
#presentation-content.pres-slide-out-right   { animation: slide-out-right .2s ease forwards; }

.hidden { display: none !important; }

.md-abbr {
  border-bottom: 1px dotted var(--text3);
  cursor: help;
  text-decoration: none;
}
.md-kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-bottom-width: 2px;
  border-radius: 4px;
  line-height: 1.5;
  white-space: nowrap;
}
.md-mark              { background: #fef08a; color: #1a1a18; border-radius: 2px; padding: 0 2px; }
.md-mark-important    { background: #fef08a; }
.md-mark-changed      { background: #bfdbfe; }
.md-mark-deprecated   { text-decoration: line-through; opacity: 0.6; background: transparent; }
@media (prefers-color-scheme: dark) {
  .md-mark            { background: #713f12; color: #fef9c3; }
  .md-mark-changed    { background: #1e3a5f; color: #bfdbfe; }
}

.md-video {
  margin: 18px 0;
  text-align: center;
}
.md-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: 8px;
}
.md-video figcaption {
  font-size: 13px;
  color: var(--text2);
  margin-top: 6px;
  font-style: italic;
}

.md-comparison {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 18px 0;
  overflow: hidden;
}
.comparison-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.comparison-sides-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) {
  .comparison-sides,
  .comparison-sides-3 { grid-template-columns: 1fr; }
}
.comparison-side {
  padding: 0;
  border-right: 1px solid var(--border);
}
.comparison-side:last-child { border-right: none; }
.comparison-side-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text2);
  padding: 8px 14px 6px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.comparison-side-body {
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
}

.md-steps {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 18px 0;
  overflow: hidden;
}
.steps-list {
  list-style: none;
  counter-reset: steps-counter;
  padding: 0;
  margin: 0;
}
.steps-item {
  counter-increment: steps-counter;
  padding: 14px 16px 14px 52px;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.steps-item:last-child { border-bottom: none; }
.steps-item::before {
  content: counter(steps-counter);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps-item-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}
.steps-item-body {
  font-size: 14.5px;
  color: var(--text2);
}

.md-section {
  margin: 18px 0;
}
.md-section-collapsible > .section-header {
  cursor: pointer;
  user-select: none;
}
.md-section-collapsible > .section-header:hover { color: var(--accent); }
.section-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.section-toggle {
  font-size: 11px;
  color: var(--text3);
  width: 16px;
}
.section-body { padding-left: 4px; }

.md-related {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.related-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}
.related-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related-link {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.related-link:hover {
  background: var(--accent2);
  border-color: var(--accent);
}
.related-note {
  font-size: 12px;
  color: var(--text3);
}

#glossary-search-wrap {
  padding: 10px 12px 6px;
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
  border-bottom: 1px solid var(--border);
}

#glossary-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}

#glossary-search:focus { border-color: var(--accent); }

#glossary-list {
  list-style: none;
  padding: 8px 0;
}

.glossary-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.glossary-item:last-child { border-bottom: none; }

.glossary-term {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 3px;
}

.glossary-def {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.5;
}

.glossary-ref {
  display: inline-block;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.glossary-ref:hover { text-decoration: underline; }

#glossary-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--text3);
}

.md-help-section {
  margin: 0 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
}
.md-help-summary {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.md-help-summary::-webkit-details-marker { display: none; }
.md-help-summary::after {
  content: '▶';
  margin-left: auto;
  font-size: 10px;
  color: var(--text3);
  transition: transform .2s;
}
.md-help-section[open] .md-help-summary::after { transform: rotate(90deg); }
.md-help-body {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text2);
  line-height: 1.65;
}
.md-help-body ul { padding-left: 20px; }
.md-help-body li { margin: 6px 0; }
.md-help-body kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-bottom-width: 2px;
  border-radius: 4px;
}

.pres-heading-slide {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  padding: 40px 24px;
  line-height: 1.3;
}

#presentation-progress {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
#presentation-progress:hover { background: var(--border2); }

header button {
  padding: 5px 12px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

header button:hover { background: var(--bg3); }
header button:disabled { opacity: .35; cursor: default; }

#btn-presentation { color: var(--accent); border-color: var(--accent); }
#btn-presentation:hover { background: var(--accent2); }

#btn-settings { font-size: 14px; padding: 4px 10px; }

#btn-export,
#btn-export-wp {
  font-size: 11px;
  opacity: .75;
}
#btn-export:hover,
#btn-export-wp:hover { opacity: 1; background: var(--bg3); }

.bib-entry {
  display: flex;
  gap: 0.75em;
  margin-bottom: 0.55em;
  font-size: 0.9em;
  line-height: 1.45;
}
.bib-key {
  flex-shrink: 0;
  font-weight: 600;
  min-width: 3.5em;
  color: var(--accent);
}
.bib-body { flex: 1; color: var(--text2); }
.bib-note { font-style: italic; opacity: 0.7; margin-top: 3px; }