/* pizza v3.1 Playground – Stil. Farben als Custom Properties; hell = Mozzarella, dunkel = Anthrazit. */

:root {
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f7f2e9;
  --flaeche: #fffdf9;
  --flaeche-2: #f3ede3;
  --flaeche-3: #ebe3d6;
  --rand: #e3dacb;
  --rand-stark: #d3c7b4;
  --text: #2b2520;
  --text-2: #675d53;
  --text-3: #8f8477;
  --akzent: #c8382a;
  --akzent-hover: #ad2d20;
  --akzent-weich: #f9e3dd;
  --akzent-text: #ffffff;
  --erfolg: #2f7a3b;
  --erfolg-weich: #e2f0df;
  --warn: #9a6200;
  --warn-weich: #fbefd6;
  --fehler: #b42318;
  --fehler-weich: #fde5e1;
  --info: #2c5f8a;
  --info-weich: #e3eef7;
  --hawaii: #d9a400;
  --fokus: #c8382a;
  --schatten: 0 1px 2px rgb(60 40 20 / .06), 0 4px 16px rgb(60 40 20 / .06);
  --schatten-gross: 0 10px 40px rgb(40 25 10 / .18);
  --radius: 10px;
  --radius-klein: 6px;
  --kopf-hoehe: 56px;

  /* Syntax */
  --tk-keyword: #a8321f;
  --tk-typ: #7a4fb0;
  --tk-belag: #2f7a3b;
  --tk-ananas: #b26a00;
  --tk-annotation: #8a6d00;
  --tk-dauer: #0a7d86;
  --tk-zahl: #1d6fb8;
  --tk-text: #6b7d1d;
  --tk-kommentar: #8f8477;
  --tk-pizza: #c8382a;
  --tk-pizza-bg: #fbe1d9;
  --tk-builtin: #0f6d8f;
  --tk-klasse: #8b4513;
  --tk-funktion: #2c4f8a;
  --tk-wahrheit: #a8321f;
  --tk-operator: #675d53;

  --editor-bg: var(--flaeche);
  --editor-zeile: rgb(200 56 42 / .045);
  --editor-auswahl: rgb(200 56 42 / .16);
  --editor-sprung: rgb(217 164 0 / .22);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #131417;
  --flaeche: #1a1c20;
  --flaeche-2: #212429;
  --flaeche-3: #2a2d33;
  --rand: #2c2f35;
  --rand-stark: #3a3e46;
  --text: #ebe7e1;
  --text-2: #aaa39a;
  --text-3: #7d776f;
  --akzent: #f0604a;
  --akzent-hover: #ff7660;
  --akzent-weich: #3a2420;
  --akzent-text: #1a0f0c;
  --erfolg: #78c46b;
  --erfolg-weich: #1f2e1f;
  --warn: #e8b04f;
  --warn-weich: #33291a;
  --fehler: #ff7b6b;
  --fehler-weich: #3a201d;
  --info: #7fb6e6;
  --info-weich: #1d2a36;
  --hawaii: #ffd23f;
  --fokus: #ff8a73;
  --schatten: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
  --schatten-gross: 0 16px 48px rgb(0 0 0 / .5);

  --tk-keyword: #ff7a64;
  --tk-typ: #c9a2ff;
  --tk-belag: #8fd47f;
  --tk-ananas: #ffbf4d;
  --tk-annotation: #e6c75c;
  --tk-dauer: #5fd0d8;
  --tk-zahl: #7fb6ff;
  --tk-text: #c3d97a;
  --tk-kommentar: #7d776f;
  --tk-pizza: #ff8a73;
  --tk-pizza-bg: #3c2420;
  --tk-builtin: #67c8e6;
  --tk-klasse: #e6b183;
  --tk-funktion: #9cc2ff;
  --tk-wahrheit: #ff9b82;
  --tk-operator: #aaa39a;

  --editor-zeile: rgb(255 255 255 / .035);
  --editor-auswahl: rgb(240 96 74 / .28);
  --editor-sprung: rgb(255 210 63 / .16);
  color-scheme: dark;
}

/* Ohne JS: System-Thema übernehmen */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; --bg: #131417; --flaeche: #1a1c20; --text: #ebe7e1; }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: grid;
  grid-template-rows: var(--kopf-hoehe) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
kbd {
  font: 600 11px/1 var(--mono);
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid var(--rand-stark);
  border-bottom-width: 2px;
  background: var(--flaeche);
  color: var(--text-2);
}
:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
[hidden] { display: none !important; }
.flex-luecke { flex: 1 1 auto; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--akzent); color: var(--akzent-text); padding: 8px 12px; border-radius: var(--radius-klein);
  text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 8px; }

/* ---------------- Knöpfe ---------------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid transparent;
  background: var(--flaeche-2); color: var(--text);
  font-weight: 550; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .08s;
}
.knopf:active { transform: translateY(1px); }
.knopf svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.knopf-primaer {
  background: var(--akzent); color: var(--akzent-text);
  box-shadow: 0 1px 0 rgb(255 255 255 / .2) inset, 0 1px 2px rgb(120 20 10 / .25);
}
.knopf-primaer:hover { background: var(--akzent-hover); }
.knopf-primaer .knopf-icon { font-size: 11px; transform: translateY(.5px); }
.knopf-geist { background: transparent; color: var(--text-2); }
.knopf-geist:hover { background: var(--flaeche-2); color: var(--text); }
.knopf-icon-only { width: 34px; padding: 0; }
a.knopf { text-decoration: none; }
.knopf-abbrechen { background: var(--flaeche-2); border-color: var(--rand-stark); }
.knopf-abbrechen:hover { border-color: var(--akzent); color: var(--akzent); }
.knopf-mini {
  height: 26px; padding: 0 9px; font-size: 12px; font-weight: 550; border-radius: 6px;
  background: transparent; border-color: var(--rand); color: var(--text-2);
}
.knopf-mini:hover { background: var(--flaeche-2); color: var(--text); border-color: var(--rand-stark); }
.knopf-mini-primaer { color: var(--akzent); border-color: color-mix(in srgb, var(--akzent) 40%, transparent); }
.knopf-mini-primaer:hover { background: var(--akzent-weich); color: var(--akzent); border-color: var(--akzent); }

.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: var(--akzent);
  animation: drehen .8s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }

/* ---------------- Kopfzeile ---------------- */
.kopf {
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
  min-width: 0;
  position: relative; z-index: 5;
}
.marke { display: flex; align-items: center; gap: 9px; flex: none; }
.logo { width: 28px; height: 28px; filter: drop-shadow(0 1px 1px rgb(80 30 10 / .2)); }
.marke-name { font-weight: 750; font-size: 18px; letter-spacing: -.02em; }
.version {
  font: 600 11px/1 var(--mono); color: var(--text-2);
  padding: 4px 6px; border-radius: 5px; background: var(--flaeche-2); border: 1px solid var(--rand);
}
.kopf-mitte { display: flex; align-items: center; gap: 10px; margin-left: 18px; flex: 1 1 auto; min-width: 0; }
.kopf-mitte .knopf { min-width: 112px; }
.kbd-hinweis { display: inline-flex; gap: 3px; opacity: .85; }
.kopf-aktionen { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-sonne { display: none; }
:root[data-theme="dark"] .icon-sonne { display: block; }
:root[data-theme="dark"] .icon-mond { display: none; }
#knopf-panel[aria-expanded="true"] { color: var(--akzent); background: var(--akzent-weich); }

/* ---------------- Arbeitsbereich ---------------- */
.arbeitsbereich {
  --panel-breite: 440px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6px var(--panel-breite);
  min-height: 0; min-width: 0;
  transition: grid-template-columns .22s cubic-bezier(.2, .7, .2, 1);
}
.arbeitsbereich.panel-zu { grid-template-columns: minmax(0, 1fr) 0 0; }
.arbeitsbereich.panel-zu .trenner-v { visibility: hidden; }
body.zieht .arbeitsbereich, body.zieht .werkbank { transition: none; }
body.zieht { user-select: none; }
body.zieht-x { cursor: col-resize; }
body.zieht-y { cursor: row-resize; }

.werkbank {
  --konsole-hoehe: 220px;
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr) 6px var(--konsole-hoehe);
  min-width: 0; min-height: 0;
  background: var(--editor-bg);
}
.werkbank.konsole-zu { grid-template-rows: 36px minmax(0, 1fr) 6px 38px; }
.werkbank.konsole-zu .trenner-h { cursor: default; }

.editor-kopf {
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  border-bottom: 1px solid var(--rand);
  background: var(--flaeche);
  font-size: 12.5px; color: var(--text-2); min-width: 0;
}
.datei-name { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datei-name::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #f3c58a, #c98a3c);
}
.datei-punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--akzent); order: 2; flex: none; }
.editor-status { margin-left: auto; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-status.warnung { color: var(--warn); }

.editor { min-height: 0; min-width: 0; overflow: hidden; position: relative; }

/* Trenner */
.trenner { background: var(--flaeche-2); position: relative; outline-offset: -2px; touch-action: none; }
.trenner::after { content: ""; position: absolute; background: var(--rand-stark); border-radius: 2px; transition: background-color .15s; }
.trenner:hover::after, .trenner:focus-visible::after, body.zieht .trenner::after { background: var(--akzent); }
.trenner-h { cursor: row-resize; border-top: 1px solid var(--rand); }
.trenner-h::after { left: 50%; top: 1.5px; width: 36px; height: 2px; transform: translateX(-50%); }
.trenner-v { cursor: col-resize; border-left: 1px solid var(--rand); border-right: 1px solid var(--rand); background: var(--bg); }
.trenner-v::after { top: 50%; left: 1.5px; height: 36px; width: 2px; transform: translateY(-50%); }
.trenner::before { content: ""; position: absolute; } /* größere Trefferfläche, ohne seitlich überzustehen */
.trenner-h::before { inset: -5px 0; }
.trenner-v::before { inset: 0 -5px; }

/* ---------------- CodeMirror ---------------- */
.editor .cm-editor { height: 100%; background: var(--editor-bg); color: var(--text); }
.editor .cm-editor.cm-focused { outline: none; }
.cm-gutters { background: var(--editor-bg) !important; border-right: 1px solid var(--rand) !important; color: var(--text-3) !important; }
.cm-lineNumbers .cm-gutterElement { padding: 0 10px 0 14px !important; min-width: 40px; font-size: 12.5px; }
.cm-activeLineGutter { background: transparent !important; color: var(--text) !important; }
.cm-activeLine { background: var(--editor-zeile) !important; }
.cm-cursor, .cm-dropCursor { border-left: 2px solid var(--akzent) !important; }
.cm-selectionBackground, .cm-content ::selection { background: var(--editor-auswahl) !important; }
.cm-focused .cm-selectionBackground { background: var(--editor-auswahl) !important; }
.cm-selectionMatch { background: color-mix(in srgb, var(--hawaii) 22%, transparent) !important; }
.cm-matchingBracket { background: color-mix(in srgb, var(--erfolg) 22%, transparent) !important; outline: 1px solid color-mix(in srgb, var(--erfolg) 50%, transparent); color: inherit !important; }
.cm-nonmatchingBracket { background: var(--fehler-weich) !important; color: var(--fehler) !important; }
.cm-faltmarke { color: var(--text-3); padding: 0 3px; cursor: pointer; font-size: 11px; }
.cm-foldGutter .cm-gutterElement { opacity: 0; transition: opacity .15s; }
.cm-gutters:hover .cm-foldGutter .cm-gutterElement { opacity: 1; }
.cm-pizza-sprungzeile { background: var(--editor-sprung) !important; animation: sprung 1.6s ease-out; }
@keyframes sprung { from { background: color-mix(in srgb, var(--hawaii) 45%, transparent); } }
.cm-placeholder { color: var(--text-3) !important; font-style: italic; }
.cm-panels { background: var(--flaeche) !important; color: var(--text) !important; }
.cm-panels-bottom { border-top: 1px solid var(--rand) !important; }
.cm-panels-top { border-bottom: 1px solid var(--rand) !important; }
.cm-panel.cm-search { padding: 8px 10px !important; font-family: var(--sans); font-size: 13px; }
.cm-panel.cm-search input, .cm-panel.cm-search button {
  border-radius: 6px; border: 1px solid var(--rand-stark); background: var(--flaeche-2) !important; color: var(--text); padding: 3px 8px; font-size: 12.5px;
  background-image: none !important;
}
.cm-panel.cm-search input:focus { outline: 2px solid var(--fokus); outline-offset: 0; }
.cm-panel.cm-search label { font-size: 12.5px; color: var(--text-2); }
.cm-searchMatch { background: color-mix(in srgb, var(--hawaii) 30%, transparent) !important; outline: 1px solid color-mix(in srgb, var(--hawaii) 60%, transparent); }
.cm-searchMatch-selected { background: color-mix(in srgb, var(--akzent) 30%, transparent) !important; }
.cm-tooltip {
  background: var(--flaeche) !important; color: var(--text) !important;
  border: 1px solid var(--rand-stark) !important; border-radius: 8px; box-shadow: var(--schatten-gross);
  overflow: hidden; font-family: var(--sans);
}
.cm-tooltip-autocomplete > ul { font-family: var(--mono) !important; font-size: 13px; max-height: 18em !important; }
.cm-tooltip-autocomplete > ul > li { padding: 3px 10px 3px 6px !important; line-height: 1.5; }
.cm-tooltip-autocomplete > ul > li[aria-selected] { background: var(--akzent) !important; color: var(--akzent-text) !important; }
.cm-tooltip-autocomplete > ul > li[aria-selected] .cm-completionDetail { color: inherit; opacity: .85; }
.cm-completionDetail { color: var(--text-3); font-family: var(--sans); font-size: 12px; font-style: normal !important; margin-left: 1.2em !important; }
.cm-completionMatchedText { text-decoration: none !important; font-weight: 700; }
.cm-completionInfo { padding: 6px 10px !important; font-size: 12.5px; }
.cm-diagnostic { font-family: var(--sans); font-size: 13px; padding: 6px 10px !important; }
.cm-diagnostic-error { border-left: 3px solid var(--fehler) !important; }
.cm-diagnosticSource { color: var(--text-3); font-size: 11.5px; }
.cm-lintRange-error {
  background-image: none !important;
  text-decoration: underline wavy var(--fehler); text-decoration-skip-ink: none; text-underline-offset: 3px;
}
.cm-lint-marker-error { content: none; }
.cm-gutter-lint { width: 12px; }
.cm-lint-marker { width: 9px !important; height: 9px !important; border-radius: 50%; background: var(--fehler) !important; margin: 5px 0 0 2px; content: none !important; }
.cm-lint-marker::before { content: none !important; }
.cm-snippetField { background: color-mix(in srgb, var(--akzent) 12%, transparent); border-radius: 3px; }

/* Syntax-Token (Editor + statische Codeblöcke) */
.tk-keyword { color: var(--tk-keyword); font-weight: 600; }
.tk-typ { color: var(--tk-typ); }
.tk-belag { color: var(--tk-belag); font-weight: 550; }
.tk-unbekannt { text-decoration: underline dotted; }
.tk-ananas { color: var(--tk-ananas); font-weight: 550; }
.tk-annotation { color: var(--tk-annotation); font-style: italic; }
.tk-dauer { color: var(--tk-dauer); font-weight: 550; }
.tk-zahl { color: var(--tk-zahl); }
.tk-text { color: var(--tk-text); }
.tk-kommentar { color: var(--tk-kommentar); font-style: italic; }
.tk-pizza { color: var(--tk-pizza); background: var(--tk-pizza-bg); font-weight: 750; border-radius: 4px; padding: 0 1px; }
.tk-builtin { color: var(--tk-builtin); }
.tk-klasse { color: var(--tk-klasse); }
.tk-funktion, .tk-methode { color: var(--tk-funktion); }
.tk-wahrheit { color: var(--tk-wahrheit); }
.tk-operator { color: var(--tk-operator); }

/* ---------------- Konsole ---------------- */
.konsole { display: grid; grid-template-rows: 38px minmax(0, 1fr); min-height: 0; min-width: 0; background: var(--flaeche); }
.konsole.zu .konsole-inhalt { display: none; }
.konsole-kopf {
  display: flex; align-items: center; gap: 10px; padding: 0 10px 0 6px;
  border-bottom: 1px solid var(--rand); min-width: 0;
}
.konsole.zu .konsole-kopf { border-bottom: 0; }
.konsole-toggle {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  font-weight: 650; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
  padding: 6px 8px; border-radius: 6px;
}
.konsole-toggle:hover { color: var(--text); background: var(--flaeche-2); }
.chevron { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s; }
.konsole.zu .chevron { transform: rotate(-90deg); }
.lauf-info { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-variant-numeric: tabular-nums; }

.exit-badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
  border: 1px solid transparent;
}
.exit-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.exit-badge.ok { color: var(--erfolg); background: var(--erfolg-weich); }
.exit-badge.ananas { color: var(--warn); background: var(--warn-weich); }
.exit-badge.fehler { color: var(--fehler); background: var(--fehler-weich); }
.exit-badge.ofen { color: var(--info); background: var(--info-weich); }
.exit-badge.hawaii { color: #3a2a00; background: var(--hawaii); }
.exit-badge.hawaii::before { display: none; }
.exit-badge.abgebrochen { color: var(--text-2); background: var(--flaeche-2); border-color: var(--rand); }
.exit-badge.laeuft { color: var(--akzent); background: var(--akzent-weich); }
.exit-badge.laeuft::before { animation: pulsieren 1s ease-in-out infinite; }
@keyframes pulsieren { 50% { opacity: .25; } }

.konsole-inhalt {
  overflow: auto; padding: 8px 0 14px;
  font: 13px/1.6 var(--mono);
  overscroll-behavior: contain;
}
.konsole-inhalt:focus-visible { outline-offset: -2px; }
.konsole-leer { margin: 10px 16px; color: var(--text-3); font-family: var(--sans); font-size: 13px; }
.k-zeile { padding: 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.k-ausgabe { color: var(--text); }
.k-fehlerausgabe { color: var(--fehler); border-left: 2px solid color-mix(in srgb, var(--fehler) 45%, transparent); padding-left: 14px; }
.k-meldung {
  display: flex; align-items: baseline; gap: 9px; width: calc(100% - 16px); margin: 5px 8px; padding: 7px 10px;
  border-radius: 7px; border: 1px solid transparent; text-align: left;
  font: inherit; white-space: pre-wrap; overflow-wrap: anywhere;
}
button.k-meldung { cursor: pointer; transition: border-color .15s, background-color .15s; }
button.k-meldung:hover { border-color: currentColor; }
.k-icon { flex: none; width: 16px; text-align: center; font-family: var(--sans); font-weight: 700; }
.k-text { flex: 1 1 auto; min-width: 0; }
.k-code { font-weight: 700; }
.k-ort {
  flex: none; font-size: 11.5px; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent); font-family: var(--sans); font-weight: 600;
}
.k-warnung { color: var(--warn); background: var(--warn-weich); }
.k-fehler { color: var(--fehler); background: var(--fehler-weich); }
.k-fehler.k-art-ananas { color: var(--warn); background: var(--warn-weich); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.k-fehler.k-art-limit { color: var(--info); background: var(--info-weich); }
.k-panik { color: #3a2a00; background: color-mix(in srgb, var(--hawaii) 70%, var(--flaeche)); }
.k-system { color: var(--text-2); background: var(--flaeche-2); font-family: var(--sans); font-size: 12.5px; }

/* ---------------- Seitenpanel ---------------- */
.panel {
  display: grid; grid-template-rows: 44px minmax(0, 1fr);
  min-width: 0; min-height: 0; overflow: hidden;
  background: var(--flaeche);
}
.panel-kopf { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 12px; border-bottom: 1px solid var(--rand); gap: 8px; }
.tabs { display: flex; gap: 2px; height: 100%; }
.tabs [role="tab"] {
  position: relative; border: 0; background: none; cursor: pointer;
  padding: 0 12px; font-weight: 600; font-size: 13.5px; color: var(--text-2);
  transition: color .15s;
}
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); }
.tabs [role="tab"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--akzent); transform: scaleX(0); transition: transform .2s;
}
.tabs [role="tab"][aria-selected="true"]::after { transform: scaleX(1); }
.tabs [role="tab"]:focus-visible { outline-offset: -4px; border-radius: 8px; }

.tabpanel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabpanel:focus { outline: none; }
.suche { position: relative; padding: 10px 12px; flex: none; }
.suche svg { position: absolute; left: 23px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.suche input {
  width: 100%; height: 34px; padding: 0 12px 0 34px; border-radius: 8px;
  border: 1px solid var(--rand); background: var(--flaeche-2); font-size: 13.5px;
  transition: border-color .15s, background-color .15s;
}
.suche input::placeholder { color: var(--text-3); }
.suche input:focus { outline: none; border-color: var(--akzent); background: var(--flaeche); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }

/* ---------------- Doku: durchgehender Artikel + Inhaltsverzeichnis ---------------- */
#doku-panel, #doku-modal { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; container: doku / inline-size; }
.doku-ansicht {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

/* Inhaltsverzeichnis – schmal: eine Zeile (Suche + horizontal scrollbare Abschnittsliste) */
.doku-toc {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 6px 8px; border-bottom: 1px solid var(--rand); background: var(--flaeche);
}
.doku-suche { position: relative; flex: 0 0 116px; transition: flex-basis .2s; }
.doku-suche:focus-within, .doku-suche:has(input:not(:placeholder-shown)) { flex-basis: 46%; }
.doku-suche svg { position: absolute; left: 9px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.doku-suche input {
  width: 100%; height: 30px; padding: 0 8px 0 29px; border-radius: 8px;
  border: 1px solid var(--rand); background: var(--flaeche-2); font-size: 13px;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.doku-suche input::placeholder { color: var(--text-3); }
.doku-suche input:focus { outline: none; border-color: var(--akzent); background: var(--flaeche); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }

.toc-liste {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 4px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
  padding: 0 10px;
}
.toc-liste::-webkit-scrollbar { display: none; }
.toc-gruppe, .toc-gruppe ul { display: contents; }
.toc-gruppe ul { list-style: none; margin: 0; padding: 0; }
.toc-gruppe li { flex: none; }
.toc-gruppe-titel {
  flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3);
  padding: 0 2px 0 8px; border-left: 1px solid var(--rand-stark); margin-left: 4px; white-space: nowrap;
}
.toc-gruppe:first-child .toc-gruppe-titel { border-left: 0; margin-left: 0; padding-left: 0; }
.toc-eintrag {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  height: 28px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-2); text-decoration: none;
  transition: background-color .15s, color .15s;
}
.toc-eintrag:hover { background: var(--flaeche-2); color: var(--text); }
.toc-eintrag[aria-current] { background: var(--akzent-weich); color: var(--akzent); font-weight: 600; }
.toc-punkt { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--text-3); }
.toc-leer { margin: 0; font-size: 12.5px; color: var(--text-3); }
.toc-liste mark, .doku-artikel mark.such-treffer { background: color-mix(in srgb, var(--hawaii) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* breit (Lesemodus oder breites Panel): Spalte links, alles sichtbar */
@container doku (min-width: 720px) {
  .doku-ansicht { grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .doku-toc {
    flex-direction: column; align-items: stretch; gap: 0; padding: 0;
    border-bottom: 0; border-right: 1px solid var(--rand); background: var(--flaeche-2); min-height: 0;
  }
  .doku-suche, .doku-suche:focus-within, .doku-suche:has(input:not(:placeholder-shown)) { flex: none; padding: 12px 12px 8px; }
  .doku-suche svg { left: 21px; }
  .doku-suche input { height: 32px; background: var(--flaeche); }
  .toc-liste {
    display: block; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; -webkit-mask-image: none; mask-image: none; padding: 0 8px 24px;
    overscroll-behavior: contain;
  }
  .toc-gruppe { display: block; margin-top: 12px; }
  .toc-gruppe ul { display: block; }
  .toc-gruppe-titel, .toc-gruppe:first-child .toc-gruppe-titel { border: 0; margin: 0 0 3px; padding: 0 8px; white-space: normal; }
  .toc-eintrag { height: auto; min-height: 28px; padding: 4px 8px; border-radius: 6px; white-space: normal; line-height: 1.3; font-size: 13px; }
  .toc-eintrag[aria-current] { box-shadow: inset 2px 0 0 var(--akzent); border-radius: 0 6px 6px 0; }
  .toc-titel { flex: 1 1 auto; }
}

/* Artikel */
.doku-artikel {
  position: relative; overflow-y: auto; overflow-x: hidden; min-width: 0;
  padding: 4px 16px 48px; font-size: 14px; line-height: 1.62;
  overscroll-behavior: contain;
}
.doku-artikel:focus { outline: none; }
@container doku (min-width: 720px) {
  .doku-artikel { padding: 8px clamp(20px, 5cqw, 56px) 80px; font-size: 15px; }
  .doku-artikel > * { max-width: 760px; margin-left: auto; margin-right: auto; }
  .doku-titel { font-size: 22px; }
}
.such-info { font-size: 12.5px; color: var(--text-3); margin: 10px 0 0; }
.nav-leer { color: var(--text-3); font-size: 13px; padding: 12px 0; margin: 0; }
.doku-gruppen-titel {
  font-size: 11.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--akzent);
  margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--rand);
}
.doku-artikel > .doku-gruppen-titel:first-child, .such-info + .doku-gruppen-titel { border-top: 0; margin-top: 4px; padding-top: 10px; }
.doku-abschnitt { padding-top: 6px; }
.doku-abschnitt + .doku-abschnitt { margin-top: 18px; }
.doku-abschnitt-kopf { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 8px; }
.doku-titel { font-size: 19px; line-height: 1.3; letter-spacing: -.015em; margin: 0; font-weight: 720; }
.doku-titel:focus { outline: none; }

.doku-text p, .doku-kurz p { margin: 0 0 10px; }
.doku-text ul, .doku-text ol, .hinweis-text ul, .hinweis-text ol { margin: 0 0 10px; padding-left: 20px; }
.doku-text li { margin: 2px 0; }
.doku-artikel code, .bsp-beschreibung code {
  font: 0.87em var(--mono); background: var(--flaeche-2); border: 1px solid var(--rand);
  padding: 0 4px; border-radius: 4px; overflow-wrap: anywhere;
}
.doku-artikel a { color: var(--akzent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.doku-artikel a:hover { text-decoration-thickness: 2px; }
.doku-artikel strong { font-weight: 680; }

.doku-kurz {
  margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--akzent-weich), color-mix(in srgb, var(--akzent-weich) 40%, var(--flaeche)));
  border-left: 3px solid var(--akzent);
  font-size: 1.04em; line-height: 1.55; color: var(--text);
}
.doku-kurz p:last-child { margin-bottom: 0; }

.tier-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 650; white-space: nowrap; font-family: var(--sans); line-height: 1;
}
.tier-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tier-1, .tier-2 { color: var(--erfolg); background: var(--erfolg-weich); }
.tier-3 { color: var(--text-2); background: var(--flaeche-3); }

/* Bilder: immer auf heller Karte (auch im Dunkelmodus) */
.doku-bild { margin: 0 0 14px; }
.bild-knopf {
  display: block; width: 100%; padding: 10px; border: 1px solid #eadfcb; border-radius: var(--radius);
  background: #fffaf1; cursor: zoom-in; transition: box-shadow .15s, border-color .15s;
}
.bild-knopf:hover { border-color: #d9c6a3; box-shadow: var(--schatten); }
.bild-knopf img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
:root[data-theme="dark"] .bild-knopf { border-color: transparent; }
.doku-bild figcaption { font-size: 12.5px; color: var(--text-2); text-align: center; margin-top: 6px; line-height: 1.45; }

/* Code-Blöcke: kompakt, Aktionen als Icon-Knöpfe oben rechts */
.doku-code { position: relative; margin: 0 0 12px; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--editor-bg); }
.code-statisch { margin: 0; padding: 10px 12px; overflow: auto; font: 12.6px/1.58 var(--mono); tab-size: 4; border-radius: inherit; }
.code-statisch code { background: none !important; border: 0 !important; padding: 0 !important; font-size: inherit !important; overflow-wrap: normal !important; }
.code-aktionen {
  position: absolute; top: 5px; right: 5px; display: flex; align-items: center; gap: 2px;
  padding: 2px; border-radius: 8px; background: color-mix(in srgb, var(--flaeche) 90%, transparent);
  box-shadow: 0 0 0 1px var(--rand);
  opacity: 0; transition: opacity .15s;
}
.doku-code:hover .code-aktionen, .doku-code:focus-within .code-aktionen { opacity: 1; }
/* ausführbare Blöcke: nur der Backen-Knopf ist dauerhaft sichtbar */
.code-aktionen:has(.primaer) { opacity: 1; }
.code-aktionen:has(.primaer) > :not(.primaer) { display: none; }
.doku-code:hover .code-aktionen > *, .doku-code:focus-within .code-aktionen > * { display: inline-grid; }
.doku-code:hover .code-aktionen > .tier-badge, .doku-code:focus-within .code-aktionen > .tier-badge { display: inline-flex; }
@media (hover: none) {
  .code-aktionen { opacity: 1; }
  .code-aktionen:has(.primaer) > :not(.primaer) { display: inline-grid; }
}
.icon-knopf {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .15s, color .15s;
}
.icon-knopf svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-knopf:hover { background: var(--flaeche-2); color: var(--text); }
.icon-knopf.primaer { color: var(--akzent); }
.icon-knopf.primaer:hover { background: var(--akzent); color: var(--akzent-text); }
.icon-knopf.ok { color: var(--erfolg); }
.code-aktionen .tier-badge { height: 18px; font-size: 10.5px; margin-right: 2px; }
.code-sprache { font: 600 10.5px var(--mono); color: var(--text-3); text-transform: uppercase; padding: 0 6px; }

/* Ausgabe hängt direkt am Code-Block */
.doku-ausgabe { margin: 0 0 12px; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche-2); padding-top: 6px; }
.doku-code:has(+ .doku-ausgabe) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
.doku-code + .doku-ausgabe { border-top: 1px dashed var(--rand); border-top-left-radius: 0; border-top-right-radius: 0; }
.doku-ausgabe figcaption { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 0 12px; }
.doku-ausgabe pre { margin: 0; padding: 2px 12px 9px; font: 12.6px/1.5 var(--mono); overflow: auto; white-space: pre; }

.tabelle-scroll { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--rand); border-radius: var(--radius); }
.doku-tabelle { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.45; }
.doku-tabelle th, .doku-tabelle td { padding: 6px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rand); }
.doku-tabelle th { background: var(--flaeche-2); font-weight: 650; font-size: 12px; color: var(--text-2); }
.doku-tabelle tr:last-child td { border-bottom: 0; }

.doku-hinweis { display: flex; gap: 10px; margin: 0 0 12px; padding: 9px 12px; border-radius: var(--radius); border: 1px solid; font-size: .94em; }
.doku-hinweis p { margin: 0 0 6px; }
.doku-hinweis p:last-child { margin-bottom: 0; }
.hinweis-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--sans); margin-top: 1px; }
.ton-info { background: var(--info-weich); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.ton-info .hinweis-icon { background: var(--info); color: var(--flaeche); font-style: italic; font-family: Georgia, serif; }
.ton-warnung { background: var(--warn-weich); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.ton-warnung .hinweis-icon { background: var(--warn); color: var(--flaeche); }
.ton-pizza { background: var(--akzent-weich); border-color: color-mix(in srgb, var(--akzent) 25%, transparent); }
.hinweis-text { min-width: 0; }

/* Details (standardmäßig zu) */
.doku-details { margin: 0 0 12px; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); }
.doku-details > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 8px 12px; font-weight: 600; font-size: .95em; color: var(--text-2); border-radius: var(--radius);
}
.doku-details > summary::-webkit-details-marker { display: none; }
.doku-details > summary::before {
  content: ""; width: 6px; height: 6px; flex: none; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; margin: 0 2px;
}
.doku-details[open] > summary::before { transform: rotate(45deg); }
.doku-details > summary:hover { color: var(--text); background: var(--flaeche-2); }
.doku-details[open] > summary { border-bottom: 1px solid var(--rand); border-radius: var(--radius) var(--radius) 0 0; color: var(--text); }
.details-inhalt { padding: 12px 12px 2px; }

.leer-zustand { text-align: center; padding: 40px 20px; color: var(--text-2); }
.leer-zustand h2 { font-size: 16px; color: var(--text); margin: 10px 0 6px; }
.leer-zustand p { margin: 0 auto 14px; max-width: 34ch; font-size: 13.5px; }
.leer-icon { font-size: 32px; }
.lade-hinweis { color: var(--text-3); padding: 16px; margin: 0; }

/* Lesemodus (Popup) */
.lesemodus {
  width: min(1100px, 94vw); height: min(90vh, 900px); height: min(90dvh, 900px); max-width: none; max-height: none;
  padding: 0; border: 1px solid var(--rand-stark); border-radius: 16px; overflow: hidden;
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-gross);
}
.lesemodus[open] { display: flex; flex-direction: column; }
.lesemodus::backdrop { background: rgb(20 12 6 / .45); }
.lesemodus-kopf { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--rand); flex: none; }
.lesemodus-kopf .logo { width: 24px; height: 24px; }
.lesemodus-kopf h2 { margin: 0; font-size: 15px; font-weight: 700; }
@media (max-width: 640px) { .lesemodus { width: 100vw; height: 100dvh; border-radius: 0; border: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .lesemodus[open] { animation: aufpoppen .2s cubic-bezier(.2, .7, .2, 1); }
  .lightbox[open] { animation: aufpoppen .18s ease-out; }
}
@keyframes aufpoppen { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* Lightbox */
.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 94vh; overflow: visible; }
.lightbox::backdrop { background: rgb(15 10 5 / .8); }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox-karte { background: #fffaf1; border-radius: 14px; padding: 16px; box-shadow: var(--schatten-gross); }
.lightbox img { display: block; width: min(1100px, 88vw); max-height: 78vh; height: auto; object-fit: contain; }
.lightbox figcaption { color: #f3ead9; font-size: 14px; text-align: center; max-width: 70ch; }
.lightbox-zu { position: fixed; top: 14px; right: 14px; color: #fff; background: rgb(0 0 0 / .35); }
.lightbox-zu:hover { background: rgb(0 0 0 / .55); color: #fff; }

/* ---------------- Editor-Tabs ---------------- */
.editor-kopf { padding: 0 10px 0 0; gap: 8px; }
.editor-tabs { display: flex; align-items: stretch; min-width: 0; flex: 1 1 auto; height: 100%; }
.etabs-liste { display: flex; align-items: stretch; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.etabs-liste::-webkit-scrollbar { height: 3px; }
.etabs-liste::-webkit-scrollbar-thumb { background: var(--rand-stark); }
.etab {
  position: relative; display: flex; align-items: center; flex: none; max-width: 220px;
  border-right: 1px solid var(--rand); background: var(--flaeche-2); color: var(--text-2);
  transition: background-color .15s, color .15s;
}
.etab:hover { color: var(--text); background: var(--flaeche-3); }
.etab.aktiv { background: var(--editor-bg); color: var(--text); }
.etab.aktiv::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--akzent); }
.etab.aktiv::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--editor-bg); }
.etab-knopf {
  display: flex; align-items: center; gap: 7px; height: 100%; padding: 0 4px 0 12px; min-width: 0;
  border: 0; background: none; cursor: pointer; font: 12px var(--mono); color: inherit;
}
.etab-knopf::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #f3c58a, #c98a3c);
}
.etab-knopf:focus-visible { outline-offset: -3px; border-radius: 6px; }
.etab-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etab-eingabe {
  height: 24px; margin: 0 4px 0 8px; padding: 0 6px; font: 12px var(--mono);
  border: 1px solid var(--akzent); border-radius: 5px; background: var(--flaeche); color: var(--text); outline: none;
}
.etab-zu {
  display: grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; flex: none;
  border: 0; border-radius: 5px; background: none; color: var(--text-3); cursor: pointer;
}
.etab-zu svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; display: block; }
.etab-zu:hover { background: var(--flaeche-3); color: var(--text); }
.etab:not(.aktiv):not(:hover) .etab-zu svg { opacity: 0; }
.etab-punkt { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--akzent); }
.etab.schmutzig:not(:hover) .etab-zu svg { display: none; }
.etab.schmutzig:not(:hover) .etab-punkt { display: block; }
.etab.schmutzig:not(:hover) .etab-zu:focus-visible svg { display: block; }
.etab-neu {
  display: grid; place-items: center; flex: none; width: 34px; border: 0; background: none; color: var(--text-3); cursor: pointer;
}
.etab-neu svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.etab-neu:hover { color: var(--akzent); background: var(--flaeche-2); }
.etab-neu:focus-visible { outline-offset: -3px; border-radius: 6px; }

/* Logo-Bild in der Kopfzeile */
.logo-bild { display: block; height: 30px; width: auto; max-width: 160px; }
.marke.mit-bild .logo, .marke.mit-bild .marke-name { display: none; }
.marke:not(.mit-bild) .logo-bild { display: none; }

/* Beispiele */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; flex: none; }
.chips:empty { display: none; }
.chip {
  height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--rand); background: var(--flaeche);
  font-size: 12.5px; font-weight: 550; cursor: pointer; color: var(--text-2); transition: all .15s;
}
.chip:hover { border-color: var(--rand-stark); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--flaeche); border-color: var(--text); }
.beispiele-liste { overflow: auto; padding: 4px 12px 24px; flex: 1 1 auto; overscroll-behavior: contain; border-top: 1px solid var(--rand); }
.bsp-kategorie { margin-top: 12px; }
.bsp-kategorie-titel {
  display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); margin: 0 2px 8px;
}
.anzahl { font-size: 11px; background: var(--flaeche-2); border-radius: 999px; padding: 1px 7px; letter-spacing: 0; }
.bsp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.bsp-karte {
  display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer;
  padding: 11px 12px; border-radius: var(--radius); border: 1px solid var(--rand); background: var(--flaeche);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  min-width: 0;
}
.bsp-karte:hover { border-color: color-mix(in srgb, var(--akzent) 55%, var(--rand)); box-shadow: var(--schatten); transform: translateY(-1px); }
.bsp-karte.laedt { opacity: .6; cursor: progress; }
.bsp-kopf { display: flex; align-items: flex-start; gap: 8px; }
.bsp-titel { font-weight: 650; font-size: 13.5px; flex: 1 1 auto; min-width: 0; }
.bsp-exit { flex: none; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--flaeche-3); color: var(--text-2); }
.bsp-exit.exit-1 { background: var(--warn-weich); color: var(--warn); }
.bsp-exit.exit-2 { background: var(--fehler-weich); color: var(--fehler); }
.bsp-exit.exit-3 { background: var(--info-weich); color: var(--info); }
.bsp-exit.exit-39 { background: var(--hawaii); color: #3a2a00; }
.bsp-beschreibung { margin: 0; font-size: 12.8px; color: var(--text-2); line-height: 1.45; }
.bsp-fuss { display: flex; flex-wrap: wrap; gap: 5px; }
.bsp-fuss:empty { display: none; }
.schlagwort { font-size: 11px; color: var(--text-2); background: var(--flaeche-2); border-radius: 5px; padding: 1px 6px; }

/* ---------------- Schmale Bildschirme: Panel als Sheet ---------------- */
.panel-schleier { display: none; }
@media (max-width: 899.98px) {
  :root { --kopf-hoehe: 52px; }
  .kopf { gap: 6px; padding: 0 8px; }
  .kopf-mitte { margin-left: 6px; }
  .kopf-mitte .knopf { min-width: 0; }
  .kbd-hinweis, .version { display: none; }
  .kopf-aktionen .knopf-text { display: none; }
  .kopf-aktionen .knopf { width: 34px; padding: 0; }

  .arbeitsbereich, .arbeitsbereich.panel-zu { grid-template-columns: minmax(0, 1fr); transition: none; }
  .trenner-v { display: none; }
  .panel {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    height: min(86dvh, 760px);
    border-radius: 16px 16px 0 0; border-top: 1px solid var(--rand-stark);
    box-shadow: var(--schatten-gross);
    transform: translateY(0); transition: transform .26s cubic-bezier(.2, .7, .2, 1), visibility .26s;
  }
  .panel-kopf { position: relative; }
  .panel-kopf::before {
    content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; border-radius: 2px;
    background: var(--rand-stark); transform: translateX(-50%);
  }
  .arbeitsbereich.panel-zu .panel { transform: translateY(105%); visibility: hidden; }
  .panel-schleier {
    display: block; position: fixed; inset: 0; z-index: 39; background: rgb(20 12 6 / .38);
    animation: einblenden .2s ease-out;
  }
  .bsp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .marke-name { display: none; }
  .knopf-primaer { padding: 0 12px; }
  .editor-status { display: none; }
}
@keyframes einblenden { from { opacity: 0; } }

/* ---------------- Dialog & Toast ---------------- */
.dialog {
  border: 1px solid var(--rand-stark); border-radius: 14px; padding: 0; width: min(420px, calc(100vw - 32px));
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-gross);
}
.dialog::backdrop { background: rgb(20 12 6 / .4); }
.dialog form { padding: 20px 20px 16px; }
.dialog h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -.01em; }
.dialog p { margin: 0 0 18px; color: var(--text-2); }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 90; transform: translate(-50%, 12px); opacity: 0;
  max-width: calc(100vw - 32px);
  background: var(--text); color: var(--flaeche); padding: 9px 16px; border-radius: 10px;
  box-shadow: var(--schatten-gross); font-size: 13.5px; font-weight: 550;
  transition: opacity .2s, transform .2s;
  /* reine Meldung (role=status): darf nichts darunter verdecken – sonst schluckt sie ~3 s lang Klicks auf
     Knöpfe der Theke-Vorschau oder des Editors, die zufällig unten mittig liegen (E2E 05 Pizza-Imperium). */
  pointer-events: none;
}
.toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }
.toast[data-art="fehler"] { background: var(--fehler); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; }
  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}

/* ---------------- Motor, .pkarton, Teilen ---------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.knopf:disabled { opacity: .55; cursor: progress; }
.motor-wahl {
  position: relative; display: inline-flex; align-items: center; height: 30px; margin-left: 4px;
  border: 1px solid var(--rand); border-radius: 8px; background: var(--flaeche); color: var(--text-2);
  transition: border-color .15s;
}
.motor-wahl:hover { border-color: var(--rand-stark); }
.motor-wahl:focus-within { border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }
.motor-wahl svg { position: absolute; left: 8px; width: 14px; height: 14px; fill: var(--hawaii); stroke: color-mix(in srgb, var(--hawaii) 60%, var(--text)); stroke-width: 1.2; stroke-linejoin: round; pointer-events: none; }
.motor-wahl select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; height: 100%;
  padding: 0 26px 0 27px; font-size: 12.5px; font-weight: 550; color: var(--text); cursor: pointer; outline: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat;
}
.motor-wahl select option { color: #222; background: #fff; }
.motor-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; flex: 0 1 auto; min-width: 0;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px;
  border: 1px solid var(--rand); color: var(--text-2); background: var(--flaeche-2);
}
.motor-badge.wasm { color: color-mix(in srgb, var(--hawaii) 55%, var(--text)); border-color: color-mix(in srgb, var(--hawaii) 45%, transparent); background: color-mix(in srgb, var(--hawaii) 12%, var(--flaeche)); }
.motor-badge.fallback { border-style: dashed; }
.dialog-klein { font-size: 13px; line-height: 1.7; }
.dialog code { font: 12px var(--mono); background: var(--flaeche-2); border: 1px solid var(--rand); padding: 1px 5px; border-radius: 4px; color: var(--text); }
.knopf-link { background: none; color: var(--akzent); padding: 0 4px; font-weight: 550; text-decoration: underline; text-underline-offset: 3px; }
.knopf-link:hover { text-decoration-thickness: 2px; }

.dialog-teilen { width: min(540px, calc(100vw - 32px)); padding: 20px 20px 16px; }
.dialog-teilen h2 { margin: 0 0 12px; font-size: 17px; }
.dialog-teilen .dialog-knoepfe { flex-wrap: wrap; align-items: center; }
.teilen-warnung {
  display: flex; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--radius);
  background: var(--warn-weich); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text);
}
.teilen-warnung svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--warn); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 2px; }
.teilen-warnung p { margin: 0 0 6px; color: var(--text); font-size: 13.5px; line-height: 1.5; }
.teilen-warnung p:last-child { margin-bottom: 0; }
.teilen-status { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.teilen-link { display: flex; gap: 8px; margin-bottom: 16px; }
.teilen-link input {
  flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--rand-stark); background: var(--flaeche-2); font: 12.5px var(--mono); color: var(--text);
}
.teilen-link input:focus { outline: none; border-color: var(--akzent); }
.teilen-fehlertext { color: var(--fehler); }
.dialog-teilen p { margin: 0 0 14px; }

@media (max-width: 899.98px) {
  .motor-wahl select { padding: 0 20px 0 26px; max-width: 108px; }
  .motor-badge { max-width: 150px; }
}
@media (max-width: 520px) {
  .motor-wahl select { width: 32px; padding: 0; color: transparent; background-image: none; }
  .motor-wahl svg { left: 8px; }
  .lauf-info { display: none; }
}
.motor-badge.wasm-fehler { color: var(--fehler); border-color: color-mix(in srgb, var(--fehler) 40%, transparent); background: var(--fehler-weich); }
#dialog-text { white-space: pre-line; }

/* ---------------- Tab-Verwaltung ---------------- */
.etabs-knoepfe { display: flex; align-items: stretch; flex: none; border-left: 1px solid var(--rand); }
.etab-aktion {
  position: relative; display: grid; place-items: center; width: 32px; border: 0; background: none; color: var(--text-3); cursor: pointer;
}
.etab-aktion svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.etab-aktion svg circle { fill: currentColor; stroke: none; }
.etab-aktion:hover { color: var(--akzent); background: var(--flaeche-2); }
.etab-aktion:focus-visible { outline-offset: -3px; border-radius: 6px; }
.etab-anzahl {
  position: absolute; top: 4px; right: 2px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px;
  background: var(--flaeche-3); color: var(--text-2); font: 700 9.5px/14px var(--sans); text-align: center;
}
.etab.angeheftet { max-width: 120px; }
.etab.angeheftet .etab-knopf { padding-right: 8px; }
.etab.angeheftet .etab-knopf::before { display: none; }
.etab.angeheftet .etab-name { max-width: 80px; }
.etab-pin svg { width: 12px; height: 12px; fill: none; stroke: var(--akzent); stroke-width: 2; display: block; }
.etab-punkt-pin { display: none; margin-right: 8px; }
.etab.angeheftet.schmutzig .etab-punkt-pin { display: block; }
.etab.zieht { opacity: .45; }
.etab.drop-links { box-shadow: inset 2px 0 0 var(--akzent); }
.etab.drop-rechts { box-shadow: inset -2px 0 0 var(--akzent); }
.werkbank { position: relative; }
.werkbank.datei-ziel::after {
  content: "Datei loslassen – öffnet in neuem Tab"; position: absolute; inset: 8px; z-index: 20;
  display: grid; place-items: center; border: 2px dashed var(--akzent); border-radius: 14px;
  background: color-mix(in srgb, var(--akzent-weich) 85%, transparent); color: var(--akzent); font-weight: 700; font-size: 15px;
  pointer-events: none;
}

/* Popup-Menü */
.menue {
  position: fixed; z-index: 80; min-width: 230px; max-width: min(360px, calc(100vw - 16px)); max-height: min(70vh, 520px);
  display: flex; flex-direction: column; padding: 5px; overflow: hidden;
  background: var(--flaeche); color: var(--text); border: 1px solid var(--rand-stark); border-radius: 10px; box-shadow: var(--schatten-gross);
  font-size: 13px;
}
.menue-breit { min-width: 300px; }
.menue-liste { overflow-y: auto; overscroll-behavior: contain; }
.menue-eintrag {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 30px; padding: 4px 8px; border: 0; border-radius: 6px;
  background: none; text-align: left; cursor: pointer; color: var(--text);
}
.menue-eintrag:hover, .menue-eintrag:focus { background: var(--flaeche-2); outline: none; }
.menue-eintrag:focus-visible { box-shadow: inset 0 0 0 2px var(--fokus); }
.menue-eintrag:disabled { color: var(--text-3); cursor: default; background: none; }
.menue-eintrag.gefahr { color: var(--fehler); }
.menue-eintrag.aktiv { font-weight: 650; }
.menue-eintrag.aktiv .menue-icon { color: var(--akzent); }
.menue-icon { width: 16px; height: 16px; flex: none; display: inline-grid; place-items: center; color: var(--text-2); }
.menue-eintrag.gefahr .menue-icon { color: currentColor; }
.menue-eintrag:disabled .menue-icon { color: var(--text-3); opacity: .7; }
.menue-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menue-zusatz { color: var(--text-3); font-size: 11.5px; }
.menue-kuerzel { flex: none; font-size: 10.5px; padding: 2px 5px; }
.menue-trenner { height: 1px; margin: 4px 6px; background: var(--rand); }
.menue-ueberschrift { padding: 6px 8px 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.menue-leer { padding: 4px 8px 6px 32px; color: var(--text-3); font-size: 12.5px; }
.menue-suche { padding: 2px 2px 6px; }
.menue-suche input {
  width: 100%; height: 30px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--rand); background: var(--flaeche-2); font-size: 13px;
}
.menue-suche input:focus { outline: none; border-color: var(--akzent); background: var(--flaeche); }

/* Befehlspalette */
.palette {
  width: min(640px, calc(100vw - 24px)); max-height: min(70vh, 560px); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--rand-stark); border-radius: 14px; overflow: hidden;
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-gross);
}
.palette[open] { display: flex; flex-direction: column; }
.palette::backdrop { background: rgb(20 12 6 / .35); }
.palette-kopf { padding: 10px; border-bottom: 1px solid var(--rand); }
.palette-eingabe {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--rand); background: var(--flaeche-2);
  font-size: 15px; color: var(--text);
}
.palette-eingabe:focus { outline: none; border-color: var(--akzent); background: var(--flaeche); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }
.palette-liste { overflow-y: auto; padding: 6px; flex: 1 1 auto; overscroll-behavior: contain; }
.palette-eintrag { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.palette-eintrag.gewaehlt { background: var(--akzent-weich); }
.palette-gruppe { flex: none; font-size: 11.5px; color: var(--text-3); min-width: 88px; }
.palette-eintrag.gewaehlt .palette-gruppe { color: var(--akzent); }
.palette-titel { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-kuerzel { flex: none; font-size: 10.5px; }
.palette-leer { padding: 18px; text-align: center; color: var(--text-3); }
.palette-fuss { display: flex; gap: 16px; padding: 7px 12px; border-top: 1px solid var(--rand); font-size: 11.5px; color: var(--text-3); background: var(--flaeche-2); }
.palette-fuss kbd { font-size: 10px; margin-right: 2px; }
@media (max-width: 520px) { .palette-gruppe { display: none; } .palette { margin-top: 8vh; } }

/* ---------------- Interaktive Eingabe ---------------- */
.konsole { grid-template-rows: 38px minmax(0, 1fr) auto; }
.konsole.zu .k-eingabe { display: none; }
.k-eingabe {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px;
  border-top: 1px solid var(--rand); background: var(--flaeche-2);
}
.k-eingabe-marke { font: 700 15px var(--mono); color: var(--akzent); }
.k-eingabe input {
  flex: 1 1 auto; min-width: 0; height: 30px; padding: 0 8px; border-radius: 7px;
  border: 1px solid var(--akzent); background: var(--flaeche); font: 13px var(--mono); color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 15%, transparent);
}
.k-eingabe input:focus { outline: none; }
.k-eingabe input::placeholder { color: var(--text-3); font-family: var(--sans); }
@media (prefers-reduced-motion: no-preference) { .k-eingabe:not([hidden]) { animation: einblenden .15s ease-out; } }
.k-echo { color: var(--akzent); font-weight: 650; }
.k-echo::before { content: ""; }
.k-echo-eof { color: var(--text-3); font-weight: 500; font-style: italic; }
.exit-badge.wartet { color: var(--info); background: var(--info-weich); }
.exit-badge.wartet::before { animation: pulsieren 1.2s ease-in-out infinite; }
.bsp-interaktiv { font-size: 11px; font-weight: 650; color: var(--akzent); background: var(--akzent-weich); border-radius: 5px; padding: 1px 6px; }

.teilen-roh { margin: -6px 0 14px; font-size: 13px; }
.teilen-roh a { color: var(--akzent); }

/* ---------------- Als Programm herunterladen ---------------- */
#knopf-exe.deaktiviert { opacity: .5; cursor: not-allowed; }
#knopf-exe.deaktiviert:hover { background: transparent; color: var(--text-2); }
.dialog-exe { width: min(560px, calc(100vw - 32px)); padding: 20px 20px 16px; }
.dialog-exe h2 { margin: 0 0 8px; font-size: 17px; }
.exe-intro { font-size: 13.5px; color: var(--text-2); margin: 0 0 14px; }
.exe-ziele { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.exe-ziele legend { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; padding: 0; }
.exe-ziel {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--rand); background: var(--flaeche); font-size: 13.5px; font-weight: 550;
  transition: border-color .15s, background-color .15s;
}
.exe-ziel:hover { border-color: var(--rand-stark); }
.exe-ziel:has(input:checked) { border-color: var(--akzent); background: var(--akzent-weich); }
.exe-ziel input { accent-color: var(--akzent); margin: 0; }
.exe-ziel code { font-size: 11px; }
.exe-ziele:has(+ .exe-voraussetzung:not([hidden])) { margin-bottom: 8px; }
.exe-voraussetzung { margin: 0 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.exe-voraussetzung strong { color: var(--text); font-weight: 650; }
.exe-voraussetzung code { font-size: 11.5px; white-space: nowrap; }
.exe-status { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; font-size: 13px; color: var(--text-2); }
.exe-status progress { width: 100%; height: 6px; accent-color: var(--akzent); }
.exe-fehler { color: var(--fehler); background: var(--fehler-weich); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 0 0 12px; }
.exe-hinweise { margin: 0 0 14px; border: 1px solid var(--rand); border-radius: 9px; padding: 0 12px; font-size: 13px; }
.exe-hinweise summary { cursor: pointer; padding: 8px 0; font-weight: 600; color: var(--text-2); }
.exe-hinweise ul { margin: 0 0 10px; padding-left: 18px; line-height: 1.55; }
.exe-hinweise li { margin: 4px 0; }
.dialog-exe .dialog-knoepfe { flex-wrap: wrap; align-items: center; }

/* ---------------- Einheitliches Iconset ---------------- */
.icon { width: 16px; height: 16px; flex: none; display: block; }
.icon-box { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.knopf svg, .etab-aktion svg, .icon-knopf svg { stroke-width: 1.75; }
.knopf-primaer .icon-play { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.k-icon { display: inline-grid; place-items: center; width: 16px; height: 1.6em; }
.k-icon svg { width: 15px; height: 15px; }
.hinweis-icon svg { width: 13px; height: 13px; }
.ton-info .hinweis-icon, .ton-warnung .hinweis-icon { font-style: normal; }
.ton-pizza .hinweis-icon { color: var(--akzent); }
.cm-faltmarke { display: inline-grid; place-items: center; padding: 0 2px; color: var(--text-3); cursor: pointer; height: 100%; }
.cm-faltmarke svg { width: 12px; height: 12px; }
.motor-wahl .motor-icon { fill: var(--hawaii); stroke: color-mix(in srgb, var(--hawaii) 60%, var(--text)); }
.motor-wahl .motor-icon.interpreter { fill: none; stroke: var(--text-2); stroke-width: 1.75; }
.k-eingabe-marke { width: 16px; height: 16px; fill: none; stroke: var(--akzent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.bsp-interaktiv { display: inline-flex; align-items: center; gap: 4px; }
.bsp-interaktiv svg { width: 13px; height: 13px; }
.palette-icon { color: var(--text-3); }
.palette-eintrag.gewaehlt .palette-icon { color: var(--akzent); }
.etab-pin svg { width: 12px; height: 12px; stroke: var(--akzent); stroke-width: 2; }
.etab-zu svg { width: 13px; height: 13px; stroke-width: 2; }
/* Autovervollständigung: Typ-Icons */
.cm-tooltip-autocomplete .cm-pizza-icon { width: 18px; margin-right: 6px; color: var(--text-3); vertical-align: middle; display: inline-grid; }
.cm-tooltip-autocomplete .cm-pizza-icon svg { width: 14px; height: 14px; }
.cm-pizza-icon-keyword { color: var(--tk-keyword) !important; }
.cm-pizza-icon-function, .cm-pizza-icon-method { color: var(--tk-funktion) !important; }
.cm-pizza-icon-type, .cm-pizza-icon-annotation { color: var(--tk-typ) !important; }
.cm-pizza-icon-class { color: var(--tk-ananas) !important; }
.cm-pizza-icon-constant { color: var(--tk-belag) !important; }
.cm-pizza-icon-namespace { color: var(--tk-builtin) !important; }
.cm-tooltip-autocomplete > ul > li[aria-selected] .cm-pizza-icon { color: inherit !important; }
.cm-tooltip-autocomplete > ul > li { display: flex; align-items: center; }

.k-panik-text { font-family: var(--mono); }

.teilen-hinweis { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  background: var(--info-weich); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); color: var(--text); font-size: 13.5px; line-height: 1.5; }
.teilen-hinweis svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--info); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.teilen-aus { color: var(--fehler); font-size: 13px; }
.teilen-dauer-fertig { font-size: 13px; color: var(--text-2); margin: -6px 0 14px !important; }

@media (max-width: 520px) {
  .marke.mit-bild .logo-bild { display: none; }
  .marke.mit-bild .logo { display: block; }
  #knopf-palette { display: none; }
  .kopf-mitte .knopf, .kopf-mitte .motor-wahl { flex: none; }
  .kopf-mitte { gap: 6px; }
}
.k-panik-text { white-space: pre; overflow-x: auto; overflow-wrap: normal; }
.beta-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; border-radius: 999px; vertical-align: middle;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--info); background: var(--info-weich); }

/* ---------------- Theke-Vorschaufenster (schwebend über allem) ---------------- */
.vorschau {
  position: fixed; z-index: 60; left: 50%; top: 50%;
  display: flex; flex-direction: column;
  width: 482px; height: 400px; min-width: 240px; min-height: 140px;
  max-width: calc(100vw - 16px); max-height: calc(100vh - 16px);
  background: var(--flaeche); color: var(--text);
  border: 1px solid var(--rand-stark); border-radius: 12px;
  box-shadow: 0 2px 6px rgb(0 0 0 / .08), 0 18px 48px rgb(30 18 8 / .22);
  overflow: hidden; resize: both;
}
:root[data-theme="dark"] .vorschau { box-shadow: 0 2px 6px rgb(0 0 0 / .3), 0 18px 48px rgb(0 0 0 / .55); }
.vorschau:focus { outline: none; }
.vorschau:focus-visible { outline: 2px solid var(--fokus); outline-offset: 2px; }
.vorschau.zieht { user-select: none; }
.vorschau-kopf {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px; flex: none;
  background: var(--flaeche-2); border-bottom: 1px solid var(--rand); cursor: grab; touch-action: none; user-select: none;
}
.vorschau.zieht .vorschau-kopf { cursor: grabbing; }
.vorschau-icon { display: inline-grid; color: var(--akzent); }
.vorschau-icon svg, .vorschau-zu svg { width: 15px; height: 15px; }
.vorschau-titel { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vorschau-zu { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--text-2); cursor: pointer; }
.vorschau-zu:hover { background: var(--fehler-weich); color: var(--fehler); }
.vorschau-inhalt { flex: 1 1 auto; min-height: 0; overflow: auto; }
.vorschau-hinweis { margin: 0; padding: 16px; color: var(--text-2); font-size: 13px; }
/* Herd (H6): Canvas füllt den Inhalt; die Glut passt das Spielfeld seitentreu ein (Ränder = Hintergrundfarbe der Welt) */
.vorschau.herd .vorschau-inhalt { position: relative; overflow: hidden; background: #000; }
.herd-canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; cursor: default; }
.herd-canvas:focus-visible { outline: 2px solid var(--fokus); outline-offset: -2px; }
.herd-status {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 6px; pointer-events: none;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #fff; background: rgb(0 0 0 / .35); opacity: .75;
}
.herd-status:empty { display: none; }
.vorschau.herd .vorschau-hinweis { color: #ddd; }
@media (max-width: 599.98px) {
  .vorschau { inset: 0 !important; width: auto !important; height: auto !important; max-width: none; max-height: none; border-radius: 0; border: 0; resize: none; }
  .vorschau-kopf { cursor: default; height: 48px; }
}

/* U-45: Ort gehört zum Text („ (Zeile Z, Spalte S)“) – nur dezent abgesetzt, kein Chip */
.k-ort { padding: 0; border-radius: 0; background: none; font: inherit; font-weight: inherit; opacity: .8; white-space: nowrap; }

/* Saat (K-077) */
.k-saat { color: var(--text-3); }
.k-info { color: var(--text-2); }


/* ---------------- Konsolenleiste: kompakt ---------------- */
.konsole-kopf { gap: 8px; }
.lauf-info { flex: 1 1 auto; }
.konsole-kopf .flex-luecke { flex: 0 0 0; }
.motor-badge { display: inline-flex; align-items: center; gap: 5px; flex: none; max-width: none; }
.motor-badge svg { width: 12px; height: 12px; }
.lauf-optionen { position: relative; flex: none; }
.knopf-lauf { gap: 5px; position: relative; }
.knopf-lauf svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.knopf-lauf[aria-expanded="true"] { background: var(--flaeche-2); color: var(--text); border-color: var(--rand-stark); }
.lauf-punkt { width: 6px; height: 6px; border-radius: 50%; background: var(--akzent); }
.lauf-popover {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 50; width: min(360px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--flaeche); color: var(--text); border: 1px solid var(--rand-stark); border-radius: 12px; box-shadow: var(--schatten-gross);
}
.konsole.zu .lauf-popover { bottom: calc(100% + 8px); }
.lp-feld { display: flex; flex-direction: column; gap: 6px; }
.lp-label { font-size: 12px; font-weight: 650; color: var(--text-2); }
.lp-label code { font: 11.5px var(--mono); background: var(--flaeche-2); border: 1px solid var(--rand); padding: 0 4px; border-radius: 4px; }
.lp-eingabe { position: relative; display: flex; }
.lp-eingabe svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.lp-eingabe input {
  width: 100%; height: 32px; padding: 0 10px 0 30px; border-radius: 8px; border: 1px solid var(--rand-stark);
  background: var(--flaeche-2); color: var(--text); font: 13px var(--mono);
}
.lp-eingabe input::placeholder { color: var(--text-3); }
.lp-eingabe input:focus { outline: none; border-color: var(--akzent); background: var(--flaeche); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }
.lp-hilfe { margin: -2px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--text-3); }
.saat-option { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; padding-top: 8px; border-top: 1px solid var(--rand); }
.saat-option input { accent-color: var(--akzent); margin: 2px 0 0; }
.saat-option small { color: var(--text-3); font-size: 11.5px; }
.koeche-option { padding-top: 8px; border-top: 1px solid var(--rand); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.koeche-titel { flex: none; font-size: 13px; color: var(--text); }
.koeche-titel small { display: block; color: var(--text-3); font-size: 11.5px; }
.koeche-titel code { font: 11px var(--mono); }
.koeche-knoepfe { flex: 1 1 180px; display: flex; border: 1px solid var(--rand-stark); border-radius: 8px; overflow: hidden; background: var(--flaeche-2); }
.koeche-knoepfe label { flex: 1 1 0; position: relative; cursor: pointer; }
.koeche-knoepfe label + label { border-left: 1px solid var(--rand); }
.koeche-knoepfe input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.koeche-knoepfe span { display: block; text-align: center; padding: 4px 0; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.koeche-knoepfe label:hover span { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.koeche-knoepfe input:checked + span { background: var(--akzent-weich); color: var(--akzent); font-weight: 650; box-shadow: inset 0 0 0 1px var(--akzent); }
.koeche-knoepfe input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: -3px; }
.koeche-option .lp-hilfe { flex: 1 0 100%; margin: 0; }
.k-saat { color: var(--text-3); }
@media (max-width: 899.98px) {
  .lauf-info { display: none; }
}
@media (max-width: 520px) {
  .lauf-popover { position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; }
  .knopf-lauf .knopf-text { display: none; }
  .konsole-toggle span { display: none; }
}

/* ---------------- Teilen: zwei Links (Code öffnen / App starten) ---------------- */
.dialog-teilen p.teilen-link-titel { margin: 0 0 6px; font-size: 13px; }
.teilen-link-titel span { color: var(--text-2); }
.teilen-link + .teilen-link-titel { margin-top: -4px; }

/* ---------------- App-Link (#app=<key>): Vollbild ohne Editor ----------------
   js/thema.js setzt data-app vor dem ersten Zeichnen → bis zum Start ist nur der Ladebalken zu sehen.
   Danach: Theke füllt das Fenster (wie das native Fenster) bzw. die Konsole füllt das Fenster. */
.app-lade, .app-ende { display: none; }
:root[data-app] body { display: flex; flex-direction: column; }
:root[data-app] .skip-link, :root[data-app] .kopf, :root[data-app] .arbeitsbereich { display: none; }
:root[data-app]:not(.app-gestartet) .app-lade {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 90; background: var(--bg);
}
.app-lade-balken { width: min(280px, 64vw); height: 4px; border-radius: 2px; overflow: hidden; background: var(--flaeche-3); }
.app-lade-fuellung {
  display: block; width: 100%; height: 100%; background: var(--akzent);
  transform-origin: left center; transform: scaleX(var(--anteil, .06));
}
@media (prefers-reduced-motion: no-preference) { .app-lade-fuellung { transition: transform .25s ease-out; } }

:root[data-app] .konsole { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; border: 0; }
:root[data-app] .konsole[hidden] { display: none; }
:root[data-app] .konsole-kopf { display: none; }
:root[data-app] .konsole-inhalt { padding: 12px 0 18px; }

:root[data-app] .vorschau {
  inset: 0 !important; width: auto !important; height: auto !important; min-width: 0; min-height: 0;
  max-width: none; max-height: none; border: 0; border-radius: 0; box-shadow: none; resize: none;
}
:root[data-app] .vorschau:focus-visible { outline: none; }
:root[data-app] .vorschau-kopf { display: none; }
/* Theke-App: statt Titelleiste nur ein dezentes X oben rechts in einem schmalen, randlosen Streifen in der
   Grundfarbe – der Theke-Inhalt beginnt darunter, nichts wird verdeckt. Wirkt wie das Schließen des EXE-Fensters. */
:root[data-app] .vorschau-kopf.app-zu {
  display: flex; justify-content: flex-end; gap: 0; cursor: default; touch-action: auto;
  height: calc(34px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) calc(3px + env(safe-area-inset-right)) 0 0;
  background: #fbf7f0; border-bottom: 0; /* = --theke-grund (theke.css) */
}
:root[data-app][data-theme="dark"] .vorschau-kopf.app-zu { background: #16171a; }
:root[data-app] .vorschau-kopf.app-zu { align-items: center; }
:root[data-app] .vorschau-kopf.app-zu > :not(.vorschau-zu):not(.app-bearbeiten) { display: none; }
:root[data-app] .vorschau-zu { width: 30px; height: 30px; border-radius: 50%; color: var(--text-3); opacity: .8; }
:root[data-app] .vorschau-zu svg { width: 14px; height: 14px; }
/* Herd-App: Spielfeld bildschirmfüllend, das X schwebt dezent darüber */
:root[data-app] .vorschau.herd .vorschau-kopf.app-zu { position: absolute; top: 0; right: 0; z-index: 2; background: transparent; }
:root[data-app] .vorschau.herd .vorschau-zu { color: #fff; background: rgb(0 0 0 / .3); }
:root[data-app] .herd-canvas:focus-visible { outline: none; }
:root[data-app] .vorschau-zu:hover { opacity: 1; background: var(--flaeche-3); color: var(--text); }
:root[data-app] .vorschau-zu:focus-visible { opacity: 1; outline: 2px solid var(--fokus); outline-offset: -2px; }

/* „App bearbeiten“: dezenter Link oben rechts (Theke: links neben dem X im Streifen; Konsole: eigener schmaler
   Streifen über der Ausgabe). Nur im App-Modus, nur nach dem Ladebalken. */
.app-kopf, .app-bearbeiten { display: none; }
:root[data-app] .app-bearbeiten {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 30px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 550; color: var(--text-2); text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
:root[data-app] .app-bearbeiten svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-app] .app-bearbeiten:hover { background: var(--flaeche-3); color: var(--text); }
:root[data-app] .app-bearbeiten:focus-visible { outline: 2px solid var(--fokus); outline-offset: -2px; }
:root[data-app] .app-kopf {
  display: flex; justify-content: flex-end; align-items: center; flex: none;
  height: calc(34px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) calc(3px + env(safe-area-inset-right)) 0 0;
}
:root[data-app] .konsole:has(> .app-kopf) { grid-template-rows: auto minmax(0, 1fr) auto; }
:root[data-app] .app-kopf + .konsole-kopf + .konsole-inhalt { padding-top: 2px; }
@media (pointer: coarse) {
  :root[data-app] .vorschau-kopf.app-zu { height: calc(44px + env(safe-area-inset-top)); padding-right: calc(2px + env(safe-area-inset-right)); }
  :root[data-app] .vorschau-zu { width: 40px; height: 40px; }
  :root[data-app] .app-kopf { height: calc(44px + env(safe-area-inset-top)); padding-right: calc(2px + env(safe-area-inset-right)); }
  :root[data-app] .app-bearbeiten { height: 40px; padding: 0 12px; }
}

:root[data-app] .app-ende:not([hidden]) {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; flex: none;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rand); background: var(--flaeche-2);
}
.app-ende-text { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 12.5px; color: var(--text-2); }
.app-ende-text.fehler { color: var(--fehler); }
.app-ende-knoepfe { display: flex; gap: 6px; flex: none; margin-left: auto; }
.app-ende-knoepfe a.knopf { text-decoration: none; }
/* ohne Konsoleninhalt (z. B. reine Theke-App oder Link ungültig): mittig */
:root[data-app] .app-ende.allein:not([hidden]) {
  flex: 1 1 auto; flex-direction: column; justify-content: center; gap: 14px;
  border: 0; background: none; padding: 24px 16px; text-align: center;
}
.app-ende.allein .app-ende-text { flex: none; font-size: 14px; max-width: 46ch; }
.app-ende.allein .app-ende-knoepfe { margin-left: 0; }
