/* ==========================================================================
   latex.giit.ch - styles for the editor and the text pages
   (the typeset pages themselves are in page.css)
   Light theme, dark theme by system setting or by choice.
   ========================================================================== */

:root {
    --bg: #f3f4f7;
    --flaeche: #ffffff;
    --flaeche-2: #f7f8fa;
    --text: #1a1d26;
    --leise: #5d6475;
    --linie: #e1e3ea;
    --linie-stark: #c9ccd6;
    --marke: #2b59c3;
    --marke-hell: #e6edfb;
    --marke-text: #ffffff;
    --gefahr: #c62f2f;
    --fehler-bg: #fdecec;
    --auswahl: #1a73e8;
    --buehne: #e8eaef;
    --karo-a: #ffffff;
    --karo-b: #e6e8ee;
    --raster: rgba(26, 115, 232, 0.16);
    --raster-stark: rgba(26, 115, 232, 0.34);
    --schatten: 0 1px 2px rgba(20, 22, 40, 0.06), 0 10px 30px -16px rgba(20, 22, 40, 0.28);
    --code-bg: #fbfbfd;
    --c-tag: #7a3dd8;
    --c-attr: #b25b00;
    --c-wert: #0b7a4b;
    --c-punkt: #8a8fa0;
    --c-komm: #8a8fa0;
    --c-ent: #c2185b;
    --c-sonder: #2b6cb0;
    --mark-sel: rgba(26, 115, 232, 0.14);
    --mark-err: rgba(198, 47, 47, 0.16);
    --r: 10px;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
    color-scheme: light dark;
}
/* Dark theme: by system setting while no choice has been made
   (no data-theme), or fixed with data-theme="dark". */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1116;
        --flaeche: #171a21;
        --flaeche-2: #1c2029;
        --text: #e9ebf1;
        --leise: #9ba2b4;
        --linie: #282c37;
        --linie-stark: #3a3f4d;
        --marke: #7aa2ff;
        --marke-hell: #1c2a4a;
        --marke-text: #0a1020;
        --gefahr: #ff6b6b;
        --fehler-bg: #3a1c1f;
        --auswahl: #5aa2ff;
        --buehne: #0b0d11;
        --karo-a: #2a2e38;
        --karo-b: #22262f;
        --raster: rgba(90, 162, 255, 0.18);
        --raster-stark: rgba(90, 162, 255, 0.36);
        --schatten: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 36px -18px rgba(0, 0, 0, 0.8);
        --code-bg: #12151b;
        --c-tag: #c39bff;
        --c-attr: #ffb86b;
        --c-wert: #6fdca5;
        --c-punkt: #7d8394;
        --c-komm: #6d7385;
        --c-ent: #ff7fb0;
        --c-sonder: #7cb7ff;
        --mark-sel: rgba(90, 162, 255, 0.2);
        --mark-err: rgba(255, 107, 107, 0.22);
    }
}
:root[data-theme="dark"] {
    --bg: #0f1116;
    --flaeche: #171a21;
    --flaeche-2: #1c2029;
    --text: #e9ebf1;
    --leise: #9ba2b4;
    --linie: #282c37;
    --linie-stark: #3a3f4d;
    --marke: #7aa2ff;
    --marke-hell: #1c2a4a;
    --marke-text: #0a1020;
    --gefahr: #ff6b6b;
    --fehler-bg: #3a1c1f;
    --auswahl: #5aa2ff;
    --buehne: #0b0d11;
    --karo-a: #2a2e38;
    --karo-b: #22262f;
    --raster: rgba(90, 162, 255, 0.18);
    --raster-stark: rgba(90, 162, 255, 0.36);
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 36px -18px rgba(0, 0, 0, 0.8);
    --code-bg: #12151b;
    --c-tag: #c39bff;
    --c-attr: #ffb86b;
    --c-wert: #6fdca5;
    --c-punkt: #7d8394;
    --c-komm: #6d7385;
    --c-ent: #ff7fb0;
    --c-sonder: #7cb7ff;
    --mark-sel: rgba(90, 162, 255, 0.2);
    --mark-err: rgba(255, 107, 107, 0.22);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--marke); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.leise { color: var(--leise); }
:focus-visible { outline: 2px solid var(--auswahl); outline-offset: 1px; }

/* ---------- Buttons and fields ---------- */

.knopf {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 12px;
    background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: 8px;
    cursor: pointer; white-space: nowrap; font-weight: 500;
    transition: background .12s, border-color .12s;
}
.knopf:hover { background: var(--flaeche-2); border-color: var(--leise); }
.knopf.haupt { background: var(--marke); border-color: var(--marke); color: var(--marke-text); font-weight: 600; }
.knopf.haupt:hover { filter: brightness(1.08); }
.knopf.klein { height: 28px; padding: 0 9px; font-size: 13px; border-radius: 7px; }
.knopf.an { background: var(--marke-hell); border-color: var(--marke); color: var(--marke); }
.knopf.gefahr { color: var(--gefahr); }
.knopf.symbol { width: 34px; padding: 0; font-weight: 700; }
.knopf.mit-symbol { padding: 0 11px 0 9px; }
.knopf:disabled, .wz:disabled { opacity: .4; cursor: not-allowed; }
.knopf:disabled:hover { background: var(--flaeche); border-color: var(--linie-stark); }
.knopf svg, .wz svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
select.knopf { padding-right: 6px; }

input:not([type=checkbox]):not([type=color]):not([type=range]), select:not(.knopf), textarea {
    width: 100%; min-width: 0; height: 30px; padding: 4px 8px;
    background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: 7px;
}
textarea { height: auto; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--auswahl); box-shadow: 0 0 0 3px var(--mark-sel); }
input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--linie-stark); border-radius: 7px; background: var(--flaeche); cursor: pointer; }

/* ---------- Header ---------- */

.kopf {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 9px 16px; background: var(--flaeche); border-bottom: 1px solid var(--linie);
    position: relative; z-index: 3;
}
.marke { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); margin-right: auto; }
.marke h1 { font-size: 17px; margin: 0; font-weight: 750; letter-spacing: -0.01em; }
.marke h1 span { color: var(--leise); font-weight: 500; }
.leiste { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.schema { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--linie-stark); border-radius: 8px; background: var(--flaeche); }
.schema button {
    width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0;
    border: 0; border-radius: 6px; background: transparent; color: var(--leise); cursor: pointer;
}
.schema button:hover { color: var(--text); background: var(--flaeche-2); }
.schema button[aria-checked="true"] { background: var(--marke-hell); color: var(--marke); }
.schema svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.trenn { width: 1px; height: 22px; background: var(--linie); margin: 0 4px; }

/* The open drawing (opens "My drawings") and the "New" menu */
.datei-knopf { max-width: 240px; min-width: 0; padding-right: 7px; }
.datei-titel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.datei-knopf svg { flex: none; }
.knopf svg.pfeil { width: 14px; height: 14px; flex: none; opacity: .6; }
.menue-anker { position: relative; display: inline-flex; }
.menue {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: grid; gap: 2px;
    width: min(310px, calc(100vw - 24px)); padding: 6px;
    background: var(--flaeche); border: 1px solid var(--linie-stark); border-radius: 12px; box-shadow: var(--schatten);
}
.menue[hidden] { display: none; }
.menue button {
    display: grid; gap: 1px; padding: 8px 10px; text-align: left;
    border: 0; border-radius: 8px; background: none; cursor: pointer;
}
.menue button:hover, .menue button:focus-visible { background: var(--flaeche-2); outline: none; }
.menue b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menue button span { font-size: 12.5px; color: var(--leise); }
#new-restart { margin-top: 4px; border-top: 1px solid var(--linie); border-radius: 0 0 8px 8px; padding-top: 10px; }

/* ---------- Work area ---------- */

.ansichten { display: none; }
.arbeit {
    --code-fr: 1fr;
    --view-fr: 1fr;
    display: grid;
    grid-template-columns: minmax(0, var(--code-fr)) 6px minmax(0, var(--view-fr)) 290px;
    height: calc(100vh - 53px);
    height: calc(100dvh - 53px);
    min-height: 520px;
}
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--flaeche); }
.pane-kopf {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    min-height: 44px; padding: 6px 10px; border-bottom: 1px solid var(--linie);
}
.pane-kopf .rechts { margin-left: auto; display: flex; gap: 6px; }

.splitter { background: var(--linie); cursor: col-resize; position: relative; touch-action: none; }
.splitter::after { content: ""; position: absolute; inset: 50% 1px auto; height: 36px; transform: translateY(-50%); border-left: 2px dotted var(--leise); left: 2px; opacity: .6; }
.splitter:hover, .splitter:focus-visible { background: var(--linie-stark); }

/* ---------- Code ---------- */

.fehler { padding: 8px 12px; background: var(--fehler-bg); color: var(--text); border-bottom: 1px solid var(--linie); font-size: 13px; }
.fehler b { color: var(--gefahr); }
.editor { position: relative; flex: 1; display: flex; min-height: 0; background: var(--code-bg); overflow: hidden; }
.gutter {
    flex: none; width: 46px; overflow: hidden; padding: 10px 8px 10px 0; text-align: right;
    font: 13px/20px var(--mono); color: var(--c-punkt); border-right: 1px solid var(--linie); user-select: none;
}
#gutter { white-space: pre; will-change: transform; }
.code-feld { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.schicht, #code {
    margin: 0; padding: 10px 14px; border: 0;
    font: 13px/20px var(--mono); tab-size: 2; white-space: pre; letter-spacing: 0;
    font-variant-ligatures: none;
}
.schicht { position: absolute; inset: 0 auto auto 0; min-width: 100%; pointer-events: none; will-change: transform; overflow: visible; }
.marks { color: transparent; }
.marks mark { color: transparent; border-radius: 3px; }
.marks mark.sel { background: var(--mark-sel); box-shadow: 0 0 0 1px var(--mark-sel); }
.marks mark.err { background: var(--mark-err); }
#code {
    position: absolute; inset: 0; width: 100%; height: 100%; resize: none; outline: none;
    background: transparent; color: transparent; caret-color: var(--text);
    overflow: auto; border-radius: 0; box-shadow: none !important;
}
#code::selection { background: rgba(26, 115, 232, 0.28); color: transparent; }
.hl { color: var(--text); }
.hl .k { color: var(--c-tag); }
.hl .a { color: var(--c-attr); }
.hl .s { color: var(--c-wert); }
.hl .p { color: var(--c-punkt); }
.hl .c { color: var(--c-komm); font-style: italic; }
.hl .e { color: var(--c-ent); }
.hl .d { color: var(--c-sonder); }

/* ---------- Tools ---------- */

.werkzeuge { justify-content: space-between; gap: 6px 8px; padding: 6px 8px; }
.gruppe { display: flex; align-items: center; gap: 2px; }
.werkzeuge .trenn { margin: 0 3px; }
.wz {
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border: 1px solid transparent; border-radius: 7px; background: transparent; cursor: pointer; color: var(--text);
}
.wz:hover { background: var(--flaeche-2); border-color: var(--linie); }
.wz[aria-pressed="true"] { background: var(--marke-hell); border-color: var(--marke); color: var(--marke); }
.rasterweite input { width: 58px !important; height: 30px; text-align: center; }
.zoomwert { min-width: 52px; padding: 0 4px !important; font-variant-numeric: tabular-nums; }
.rasterweite { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--leise); }
.rasterweite input { width: 50px !important; padding: 4px !important; text-align: center; }
.wz.mit-text { width: auto; display: inline-flex; gap: 5px; padding: 0 8px; font-size: 13px; font-weight: 600; }
.snap {
    display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 8px;
    border: 1px solid var(--linie-stark); border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
}
.snap input { width: 16px; height: 16px; margin: 0; accent-color: var(--marke); cursor: pointer; }
.snap.aus { opacity: .45; cursor: not-allowed; }
.snap.aus input { cursor: not-allowed; }
.raster-gruppe { gap: 6px; }
.hinweiszeile {
    position: absolute; left: 12px; bottom: 12px; right: 390px; z-index: 1; pointer-events: none;
    font-size: 12.5px; line-height: 1.4; color: var(--leise);
}
.hinweiszeile { text-shadow: 0 0 6px var(--buehne), 0 0 2px var(--buehne); }
/* A narrow canvas has no room beside the zoom bar: the hint goes above it. */
.buehne { container-type: inline-size; }
@container (max-width: 820px) { .hinweiszeile { right: 12px; bottom: 62px; } }
.zoom #bg { width: auto; }
.werkzeuge { padding: 6px; }

/* ---------- Stage ---------- */

.buehne {
    position: relative; flex: 1; overflow: hidden; background: var(--buehne);
    touch-action: none; outline: none; cursor: default; user-select: none;
}
.buehne[data-tool="hand"], .buehne.hand { cursor: grab; }
.buehne.ziehen { cursor: grabbing; }
.buehne[data-tool="rect"], .buehne[data-tool="ellipse"], .buehne[data-tool="line"], .buehne[data-tool="pen"] { cursor: crosshair; }
.buehne[data-tool="text"] { cursor: text; }
.papier { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: var(--schatten); }
.papier[data-bg="karo"] {
    background-color: var(--karo-a);
    background-image: linear-gradient(45deg, var(--karo-b) 25%, transparent 25%, transparent 75%, var(--karo-b) 75%),
                      linear-gradient(45deg, var(--karo-b) 25%, transparent 25%, transparent 75%, var(--karo-b) 75%);
    background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.papier[data-bg="hell"] { background: #ffffff; }
.papier[data-bg="dunkel"] { background: #1b1e25; }
.papier[data-bg="keiner"] { background: transparent; box-shadow: 0 0 0 1px var(--linie-stark); }
#host { width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.overlay .hover { fill: none; stroke: var(--auswahl); stroke-width: 1; stroke-dasharray: 4 3; }
.overlay .rahmen { fill: none; stroke: var(--auswahl); stroke-width: 1.5; }
.overlay .griff { fill: #ffffff; stroke: var(--auswahl); stroke-width: 1.5; pointer-events: all; }
.overlay .griff[data-h="nw"], .overlay .griff[data-h="se"] { cursor: nwse-resize; }
.overlay .griff[data-h="ne"], .overlay .griff[data-h="sw"] { cursor: nesw-resize; }
.overlay .griff[data-h="n"], .overlay .griff[data-h="s"] { cursor: ns-resize; }
.overlay .griff[data-h="e"], .overlay .griff[data-h="w"] { cursor: ew-resize; }
.overlay .griff[data-h^="p"] { cursor: move; }
.overlay .marquee { display: none; }
/* Touch: swiping the canvas scrolls the page in the select tool; the grip
   over the selected shape and the handles take the finger instead. */
.greif { position: absolute; touch-action: none; }
.greif[hidden] { display: none; }
@media (pointer: coarse) {
    .buehne[data-tool="select"] { touch-action: pan-x pan-y; }
    .overlay { touch-action: none; }
}
.buehne .zoom {
    position: absolute; right: 12px; bottom: 12px; z-index: 2; padding: 3px;
    background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; box-shadow: var(--schatten);
}
.veraltet-hinweis {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: none;
    padding: 4px 12px; border-radius: 99px; background: var(--fehler-bg); color: var(--gefahr); font-size: 12px; font-weight: 600;
    box-shadow: var(--schatten);
}
.buehne.veraltet .veraltet-hinweis { display: block; }
.buehne.veraltet .papier { opacity: .55; }

/* ---------- Properties ---------- */

.inspector { border-left: 1px solid var(--linie); }
.reiter { gap: 4px; padding: 6px; }
.reiter button, .ansichten button {
    flex: 1; height: 30px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-weight: 600; color: var(--leise);
}
.reiter button[aria-selected="true"], .ansichten button[aria-selected="true"] { background: var(--flaeche-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--linie); }
.inspector-body { flex: 1; overflow: auto; padding: 4px 14px 18px; }
.inspector-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 18px 0 8px; font-weight: 700; }
.inspector-body h3 code { text-transform: none; letter-spacing: 0; font: 12px var(--mono); color: var(--c-tag); margin-left: 4px; }
.pfad { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding-top: 10px; font: 12px var(--mono); color: var(--leise); }
.pfad button { border: 0; background: none; padding: 1px 3px; border-radius: 4px; color: var(--marke); cursor: pointer; font: inherit; }
.pfad button:hover { background: var(--marke-hell); }
.pfad b { color: var(--text); }
.hinweis { font-size: 12.5px; color: var(--leise); margin: 8px 0; }
.feld { display: grid; grid-template-rows: subgrid; grid-row: span 2; gap: 3px; font-size: 12.5px; min-width: 0; }
.feld > span:first-child { align-self: end; color: var(--leise); font-weight: 500; }
.feld small { font-weight: 400; opacity: .8; }
label.feld + label.feld { margin-top: 0; }
.inspector-body > .feld { margin-top: 10px; grid-template-rows: auto auto; }
.zeile3 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 3px 10px; margin-top: 10px; }
.geo { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: auto auto; gap: 3px 6px; }
.geo input { padding: 4px 5px !important; font-variant-numeric: tabular-nums; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.knopfreihe .knopf { flex: 1 1 auto; }
.knopfreihe.zwei { display: grid; grid-template-columns: 1fr 1fr; }
.vorgaben { display: grid; grid-template-columns: auto 34px 1fr; align-items: center; gap: 8px 10px; font-size: 12.5px; color: var(--leise); }
.vorgaben input[type=number] { grid-column: 2 / -1; max-width: 120px; }
.mit-keine { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.kasten { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }

.farbe {
    display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 6px; align-items: center;
    margin-top: 12px; padding: 10px; border: 1px solid var(--linie); border-radius: var(--r); background: var(--flaeche-2);
}
.farbe .feld-titel { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; }
.farbfeld { position: relative; width: 34px; height: 30px; border-radius: 7px; overflow: hidden; cursor: pointer; box-shadow: inset 0 0 0 1px var(--linie-stark); }
.farbfeld input { position: absolute; inset: -6px; width: 46px !important; height: 42px !important; border: 0; padding: 0; cursor: pointer; }
.farbfeld.keine::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: var(--flaeche) linear-gradient(to top right, transparent calc(50% - 1.5px), var(--gefahr) calc(50% - 1px), var(--gefahr) calc(50% + 1px), transparent calc(50% + 1.5px));
}
.hexwert { font: 12.5px var(--mono) !important; }
.farbe .hinweis, .farbe .regler { grid-column: 1 / -1; margin: 0; }
.regler { display: grid; grid-template-columns: auto 1fr 44px; align-items: center; gap: 8px; font-size: 12.5px; color: var(--leise); }
.regler input { width: 100%; accent-color: var(--marke); }
.regler output { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.regler.gesamt { margin-top: 12px; }
#f-text { min-height: 52px; }

.attribute { margin-top: 18px; border-top: 1px solid var(--linie); padding-top: 8px; }
.attribute summary { cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); font-weight: 700; padding: 6px 0; }
.attr-liste { display: grid; gap: 4px; }
.attr { display: grid; grid-template-columns: minmax(70px, 38%) minmax(0, 1fr) 26px; gap: 4px; align-items: center; }
.attr > span { font: 12px var(--mono); color: var(--c-attr); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attr input { font: 12px var(--mono) !important; height: 28px !important; }
.attr.neu { grid-template-columns: minmax(70px, 38%) minmax(0, 1fr) 26px; margin-top: 4px; }
.weg { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--leise); }
.weg:hover { background: var(--flaeche-2); color: var(--text); }

.baum { list-style: none; margin: 8px 0 0; padding: 0; font: 12.5px var(--mono); }
.baum li { position: relative; display: flex; align-items: center; border-radius: 6px; }
.baum .wahl {
    display: flex; gap: 6px; flex: 1; min-width: 0; padding: 4px 8px 4px calc(8px + var(--t) * 14px);
    border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; color: var(--text); font: inherit;
}
.baum .wahl b { color: var(--text); font: 600 13px system-ui, sans-serif; white-space: nowrap; }
.tupfer { flex: none; width: 12px; height: 12px; margin-top: 3px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.tupfer.leer { box-shadow: none; }
.baum .wahl span { color: var(--leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.baum li:hover, .baum li.hover { background: var(--flaeche-2); }
.baum li.aktiv { background: var(--mark-sel); box-shadow: inset 2px 0 0 var(--auswahl); }
.baum li.versteckt .wahl > * { opacity: .45; }
.baum li.gezogen { opacity: .5; }
.baum li.drop-front { box-shadow: inset 0 2px 0 var(--auswahl); }
.baum li.drop-back { box-shadow: inset 0 -2px 0 var(--auswahl); }
.baum li.drop-into { box-shadow: inset 0 0 0 2px var(--auswahl); }
.baum li[draggable="true"] .wahl { cursor: grab; }
.umbenennen { flex: 1; min-width: 0; font: inherit; padding: 1px 4px; border: 1px solid var(--auswahl); border-radius: 4px; background: var(--flaeche); color: var(--text); }

/* Row buttons: shown on hover and on the selected row; the eye stays
   visible while an element is hidden. */
.ebene-knoepfe { display: flex; flex: none; gap: 1px; padding-right: 2px; }
.ek {
    display: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px;
    background: none; color: var(--leise); cursor: pointer; font: 13px system-ui, sans-serif; line-height: 22px;
}
.ek svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ek:hover, .ek:focus-visible { background: var(--flaeche); color: var(--text); }
.ek.gefahr:hover { color: var(--gefahr); }
.baum li:hover .ek, .baum li.aktiv .ek, .baum li:focus-within .ek, .baum li.versteckt .ek.sicht { display: inline-block; }
@media (hover: none) { .baum .ek.sicht { display: inline-block; } }
@media (pointer: coarse) {
    .ek { width: 32px; height: 32px; line-height: 32px; }
    .baum .wahl { padding-top: 8px; padding-bottom: 8px; }
}

/* ---------- Dialogs, messages ---------- */

.dialog {
    width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
    border: 1px solid var(--linie); border-radius: 14px; background: var(--flaeche); color: var(--text); box-shadow: var(--schatten);
}
.dialog { overflow: auto; }
.dialog::backdrop { background: rgba(10, 12, 18, 0.45); }
.dialog-kopf { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--linie); margin: 0; }
.dialog-kopf h2 { margin: 0; font-size: 17px; }
.schliessen { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 16px; }
.schliessen:hover { background: var(--flaeche-2); }
.dialog-inhalt { padding: 16px 18px 18px; }
.ex-zeile { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 3px 12px; margin-bottom: 14px; }
.ex-zeile.vier { grid-template-columns: repeat(4, 1fr); }
.ex-text { width: 100%; height: 240px !important; font: 12px/1.5 var(--mono) !important; white-space: pre; background: var(--code-bg) !important; }
.dialog[data-raster="true"] .nur-text { display: none; }
.dialog[data-raster="false"] .nur-bild { display: none; }
.dialog-fuss { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.dialog-fuss .leise { margin-right: auto; }
.dialog.frage { width: min(440px, calc(100vw - 32px)); }

/* My drawings */
.dialog.dateien { width: min(900px, calc(100vw - 32px)); }
.dateien-leiste { display: flex; gap: 8px; margin-bottom: 14px; }
.dateien-leiste input { flex: 1; height: 34px !important; }
.datei-raster {
    list-style: none; margin: 0 0 12px; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px;
}
.datei-karte {
    display: flex; flex-direction: column; min-width: 0; overflow: hidden; cursor: pointer;
    border: 1px solid var(--linie); border-radius: 12px; background: var(--flaeche);
    transition: border-color .12s, box-shadow .12s;
}
.datei-karte:hover { border-color: var(--linie-stark); box-shadow: var(--schatten); }
.datei-karte.aktuell { border-color: var(--marke); box-shadow: 0 0 0 1px var(--marke); }
.datei-oeffnen { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.datei-oeffnen:focus-visible { outline-offset: -2px; }
.datei-bild {
    display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 12px;
    background-color: var(--karo-a);
    background-image: linear-gradient(45deg, var(--karo-b) 25%, transparent 25%, transparent 75%, var(--karo-b) 75%),
                      linear-gradient(45deg, var(--karo-b) 25%, transparent 25%, transparent 75%, var(--karo-b) 75%);
    background-size: 12px 12px; background-position: 0 0, 6px 6px;
    border-bottom: 1px solid var(--linie);
}
.datei-bild img { width: 100%; height: 100%; object-fit: contain; }
.datei-bild.kaputt img { display: none; }
.datei-bild.kaputt::after { content: "The code has an error"; font-size: 12px; color: var(--gefahr); }
.datei-text { display: grid; padding: 8px 10px 0; min-width: 0; }
.datei-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datei-info { font-size: 12px; }
.datei-karte.aktuell .datei-info { color: var(--marke); font-weight: 600; }
input.datei-umbenennen { height: 26px !important; font-weight: 600; }
.datei-knoepfe { display: flex; gap: 2px; padding: 4px 6px 6px; }
.datei-knoepfe .ek { display: inline-block; width: 28px; height: 28px; line-height: 28px; border-radius: 7px; }
.datei-knoepfe .ek:hover { background: var(--flaeche-2); }
.datei-knoepfe .ek.gefahr { margin-left: auto; }
.datei-leer { grid-column: 1 / -1; text-align: center; padding: 24px 0; }

/* AI Assistant: change the open drawing or make a new one */
.ai-ziel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; padding: 0; border: 0; }
.ai-ziel legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.ai-ziel label {
    display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; cursor: pointer;
    border: 1px solid var(--linie-stark); border-radius: 10px;
}
.ai-ziel label:has(:checked) { border-color: var(--marke); background: var(--marke-hell); }
.ai-ziel input { flex: none; width: auto !important; height: auto !important; margin: 3px 0 0; accent-color: var(--marke); }
.ai-ziel b { display: block; overflow-wrap: anywhere; }
.ai-ziel small { display: block; color: var(--leise); font-size: 12.5px; }
.frage #ask-text { margin: 0; }

/* Color picker (instead of the browser's color dialog) */
.farbwahl {
    position: fixed; z-index: 40; width: 264px; padding: 0 12px 12px;
    background: var(--flaeche); color: var(--text); border: 1px solid var(--linie-stark); border-radius: 12px; box-shadow: var(--schatten);
}
.farbwahl[hidden] { display: none; }
.fw-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -4px 0 0; padding: 8px 0; }
.fw-kopf b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-feld {
    position: relative; height: 150px; border-radius: 8px; cursor: crosshair; touch-action: none; outline-offset: 2px;
    background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--ton, red));
}
.fw-punkt {
    position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
    border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), 0 1px 4px rgba(0, 0, 0, .4); pointer-events: none;
}
.fw-ton {
    width: 100%; height: 14px; margin: 12px 0 10px; border-radius: 7px; -webkit-appearance: none; appearance: none; cursor: pointer;
    background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.fw-ton::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.fw-ton::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.fw-zeile { display: flex; align-items: center; gap: 6px; }
.fw-vorher, .fw-jetzt { flex: none; width: 24px; height: 28px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.fw-vorher { border-radius: 7px 0 0 7px; cursor: pointer; }
.fw-jetzt { border-radius: 0 7px 7px 0; margin-left: -6px; }
.farbwahl input.fw-hex { flex: 1; height: 28px; font: 13px var(--mono); }
.fw-farben { margin-top: 10px; }
.fw-farben[hidden] { display: none; }
.fw-farben > span { display: block; margin-bottom: 4px; font-size: 12px; color: var(--leise); }
.fw-farben > div { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.fw-farben button { aspect-ratio: 1; border: 0; border-radius: 5px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.fw-farben button:hover { transform: scale(1.12); }
/* On phones the picker is a sheet at the bottom of the screen. */
.farbwahl.blatt { left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 14px 14px 0 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.farbwahl.blatt .fw-feld { height: 170px; }

.ai-einfuegen { display: grid; gap: 4px; margin: 4px 0 12px; }
.ai-einfuegen textarea { font: 12px var(--mono); min-height: 44px; }

/* Notice in a tab that was opened by an AI link */
.empfang { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(10, 12, 18, 0.5); }
.empfang[hidden] { display: none; }
.empfang-box { max-width: 420px; padding: 24px; text-align: center; background: var(--flaeche); border-radius: 14px; box-shadow: var(--schatten); }
.empfang-box h2 { margin: 12px 0 6px; font-size: 19px; }
.empfang-box p { margin: 0 0 16px; color: var(--leise); }
.empfang-knoepfe { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.empfang-knoepfe [hidden] { display: none; }

.kuerzel dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; }
.kuerzel dt { white-space: nowrap; }
.kuerzel dd { margin: 0; color: var(--leise); }
kbd {
    display: inline-block; min-width: 22px; padding: 1px 6px; text-align: center;
    border: 1px solid var(--linie-stark); border-bottom-width: 2px; border-radius: 5px; background: var(--flaeche-2); font: 12px var(--mono);
}

.toast {
    position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 9px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 500; box-shadow: var(--schatten);
    transition: opacity .18s, transform .18s; z-index: 20; max-width: calc(100vw - 32px);
}
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }
.ablage-hinweis {
    position: fixed; inset: 0; display: none; place-items: center; z-index: 30; pointer-events: none;
    background: rgba(43, 89, 195, 0.12); border: 3px dashed var(--marke);
}
.ablage-hinweis span { padding: 14px 22px; border-radius: 12px; background: var(--flaeche); font-size: 18px; font-weight: 700; box-shadow: var(--schatten); }
body.ablegen .ablage-hinweis { display: grid; }

/* ---------- Text section below the editor ---------- */

.seite { max-width: 980px; margin: 0 auto; padding: 48px 16px 24px; font-size: 16px; line-height: 1.65; }
.text-abschnitt { margin-bottom: 44px; }
.text-abschnitt h2 { font-size: 26px; line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 14px; }
.text-abschnitt h3 { font-size: 17px; margin: 0 0 6px; }
.text-abschnitt p { margin: 0 0 12px; }
.einstieg p { font-size: 17px; color: var(--leise); max-width: 760px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.kachel { padding: 18px 20px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; }
.kachel p { color: var(--leise); margin: 0; font-size: 15px; }
.schritte { padding-left: 22px; margin: 0; }
.schritte li { margin-bottom: 8px; }
.fragen details { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 0 18px; margin-bottom: 8px; }
.fragen summary { cursor: pointer; font-weight: 600; padding: 13px 0; }
.fragen details p { color: var(--leise); margin: 0 0 14px; }
.fuss {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px;
    max-width: 980px; margin: 0 auto; padding: 22px 16px 34px; border-top: 1px solid var(--linie); color: var(--leise); font-size: 14px;
}
.fuss nav { display: flex; gap: 18px; }
.fuss a { color: var(--leise); }
.fuss a:hover { color: var(--marke); }

/* Legal pages */
.recht { max-width: 760px; margin: 0 auto; padding: 36px 16px 20px; font-size: 16px; line-height: 1.65; }
.recht h1 { font-size: 30px; margin: 0 0 4px; letter-spacing: -0.02em; }
.recht h2 { font-size: 19px; margin: 30px 0 8px; }
.recht .stand { color: var(--leise); margin: 0 0 22px; }
.recht address { font-style: normal; margin-bottom: 10px; }
.recht ul { padding-left: 20px; }
.zurueck { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; text-decoration: none; font-weight: 600; }

/* ---------- Medium width: narrower properties ---------- */

@media (max-width: 1180px) {
    .arbeit { grid-template-columns: minmax(0, var(--code-fr)) 6px minmax(0, var(--view-fr)) 250px; }
}

/* ---------- Narrow: one view at a time ---------- */

@media (max-width: 860px) {
    .kopf { padding: 8px 12px; gap: 8px; }
    .marke h1 span { display: none; }
    .leiste.datei .trenn, #btn-download { display: none; }
    .marke h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .leiste { gap: 4px; }
    .leiste.datei { order: 1; flex-wrap: nowrap; }
    .leiste.aus { order: 2; width: 100%; flex-wrap: nowrap; }
    .leiste.aus #btn-export { margin-left: auto; }
    #btn-undo, #btn-redo, #btn-new { width: 34px; padding: 0; }
    #btn-undo .txt, #btn-redo .txt, #btn-new .txt { display: none; }
    .datei-knopf { max-width: 42vw; }
    .menue { position: fixed; top: 52px; left: 12px; right: 12px; width: auto; }
    .leiste.datei { flex: 1; min-width: 0; }
    .dateien-leiste { flex-wrap: wrap; }
    .dateien-leiste input { flex-basis: 100%; }
    .dateien-leiste .knopf { flex: 1; }
    .datei-raster { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .ai-ziel { grid-template-columns: 1fr; }
    .ansichten { display: flex; gap: 4px; padding: 6px 12px; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
    .arbeit { display: block; height: calc(100dvh - 148px); min-height: 440px; }
    .hinweiszeile {
        top: 8px; right: 8px; bottom: auto; left: 8px; padding: 4px 9px; border-radius: 8px;
        background: var(--flaeche); border: 1px solid var(--linie); text-shadow: none; font-size: 12px;
    }
    .veraltet-hinweis { top: 46px; }
    .buehne .zoom { left: 8px; right: 8px; bottom: 8px; justify-content: center; }
    .ex-text { height: 140px !important; }
    .dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .dialog-inhalt { padding: 14px 14px 0; }
    .dialog-fuss { position: sticky; bottom: 0; padding: 10px 0 14px; background: var(--flaeche); display: grid; grid-template-columns: 1fr 1fr; }
    .dialog-fuss .leise:empty { display: none; }
    .dialog-fuss .leise, .dialog-fuss .haupt:last-child { grid-column: 1 / -1; }
    .arbeit > .pane, .splitter { display: none; height: 100%; }
    .arbeit[data-show="code"] .code-pane,
    .arbeit[data-show="zeichnen"] .zeichen-pane,
    .arbeit[data-show="eigenschaften"] .inspector { display: flex; }
    .inspector { border-left: 0; }
    .werkzeuge { justify-content: flex-start; }
    .seite { padding-top: 32px; }
    .text-abschnitt h2 { font-size: 22px; }
    .ex-zeile.vier { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; }
}
@media (max-width: 480px) {
    #btn-open { display: none; }
    .ex-zeile { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
    .kuerzel dl { grid-template-columns: 1fr; gap: 2px; }
    .kuerzel dd { margin-bottom: 8px; }
}

/* ==========================================================================
   LaTeX editor
   ========================================================================== */

.hl .k.h { font-weight: 700; }
.wz-b, .wz-i, .wz-u, .wz-tt { font: 700 15px/1 Georgia, "Times New Roman", serif; }
.wz-i { font-weight: 400; font-style: italic; }
.wz-u { font-weight: 400; }
.wz-tt { font: 600 14px/1 var(--mono); }
.wz-mathe { font: 16px/1 Georgia, serif; }
.wz.mit-text span { font-size: 15px; }
.werkzeuge { flex-wrap: wrap; }
.seiten-gruppe { gap: 4px; }
.seitenwert { min-width: 54px; text-align: center; font-size: 13px; color: var(--leise); font-variant-numeric: tabular-nums; }

/* Preview: the pages one below the other, scrolled */
.buehne.vorschau { touch-action: auto; user-select: text; cursor: default; }
.scroller { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; }
.seiten { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 22px 22px 80px; width: max-content; min-width: 100%; }
.seiten .blatt { box-shadow: var(--schatten), 0 0 0 1px rgba(0, 0, 0, .06); cursor: text; }
.messen { position: fixed; left: -100000px; top: 0; visibility: hidden; pointer-events: none; }
.buehne.vorschau .hinweiszeile { right: 330px; }
.buehne.rechnet .veraltet-hinweis { display: block; background: var(--flaeche); color: var(--leise); }
.leer-hinweis { padding: 40px 20px; text-align: center; color: var(--leise); }

/* Problems above the code */
.probleme { display: grid; gap: 2px; max-height: 30%; overflow: auto; padding: 6px 10px; }
.probleme .pr-kopf { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.probleme .pr-kopf button { margin-left: auto; }
.probleme ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 1px; }
.probleme li button {
    display: flex; gap: 8px; width: 100%; padding: 3px 6px; border: 0; border-radius: 6px; background: none;
    text-align: left; cursor: pointer; font-size: 12.5px; color: var(--text);
}
.probleme li button:hover { background: rgba(127, 127, 127, .14); }
.probleme .zeile-nr { flex: none; min-width: 52px; color: var(--leise); font-variant-numeric: tabular-nums; }
.probleme .err .art { color: var(--gefahr); }
.probleme .art { flex: none; font-weight: 700; width: 14px; text-align: center; color: #b7791f; }
.fehler.nur-warnungen { background: var(--flaeche-2); }
.marks mark.warn { background: rgba(214, 158, 46, .2); }

/* Document settings */
.doc-form { display: grid; gap: 10px; padding-top: 10px; }
.doc-form .zeile2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.doc-form select, .doc-form input:not([type=checkbox]), .doc-form textarea { min-width: 0; width: 100%; }
.doc-form .kasten input { flex: none; width: 16px; height: 16px; }
.doc-form .feld { grid-row: auto; grid-template-rows: auto auto; }
.doc-form textarea { min-height: 30px; font: 12.5px var(--mono); }
.doc-form .kasten { font-size: 13px; white-space: normal; align-items: flex-start; }
.doc-form .kasten input { margin-top: 3px; accent-color: var(--marke); }
.doc-form .unter { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); font-weight: 700; margin: 10px 0 0; }
.doc-info { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: var(--r); background: var(--flaeche-2); font-size: 12.5px; color: var(--leise); }
.doc-info b { color: var(--text); }

/* Insert */
.einfuege-gruppe h3 { margin-top: 16px !important; }
.einfuege-gitter { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.einfuege-gitter .knopf { height: 30px; padding: 0 8px; justify-content: flex-start; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.zeichen-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 4px; }
.zeichen-gitter button {
    height: 32px; border: 1px solid var(--linie); border-radius: 7px; background: var(--flaeche); cursor: pointer;
    font: 16px/1 "LM Roman", Georgia, "Times New Roman", serif; color: var(--text);
}
.zeichen-gitter button:hover { border-color: var(--marke); background: var(--marke-hell); }
.bilder { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.bilder li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px; border: 1px solid var(--linie); border-radius: 9px; }
.bilder img { width: 44px; height: 36px; object-fit: contain; border-radius: 5px; background: #fff; }
.bilder .bild-name { font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bilder .bild-name small { display: block; font: 11px system-ui, sans-serif; color: var(--leise); }
.bilder .ek { display: inline-block; }

/* Outline */
.gliederung .wahl { font: 13px system-ui, sans-serif; }
.gliederung .wahl .nr { color: var(--leise); min-width: 2.2em; font-variant-numeric: tabular-nums; }
.gliederung .wahl span:last-child { color: var(--text); }
.gliederung li.lv1 .wahl { font-weight: 600; }

/* My documents: a little page as the picture */
.datei-bild.dok { background: var(--buehne); padding: 10px 18% 0; place-items: stretch; overflow: hidden; }
.mini-seite {
    display: block; height: 100%; padding: 10px 10px 0; overflow: hidden; background: #ffffff; color: #222222;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2); font: 6.5px/1.35 "LM Roman", Georgia, serif; text-align: justify;
}
.mini-seite b { display: block; text-align: center; font-size: 9px; line-height: 1.2; margin-bottom: 5px; font-weight: 400; }
.mini-seite i { font-style: normal; }

/* Save to server */
.sync-felder { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 3px 12px; margin: 14px 0 10px; }
.sync-wahl { display: flex; align-items: flex-start; gap: 8px; white-space: normal; margin: 6px 0; font-size: 13.5px; }
.sync-wahl input { margin-top: 3px; accent-color: var(--marke); }
.sync-hilfe { margin-top: 10px; border: 1px solid var(--linie); border-radius: 10px; padding: 0 12px; }
.sync-hilfe summary { cursor: pointer; padding: 9px 0; font-weight: 600; }
.code-beispiel { margin: 0 0 10px; padding: 10px; overflow: auto; background: var(--code-bg); border: 1px solid var(--linie); border-radius: 8px; font: 11.5px/1.5 var(--mono); }
#btn-sync.an { color: var(--marke); border-color: var(--marke); background: var(--marke-hell); }
.dialog[data-raster="pdf"] .nur-text, .dialog[data-raster="pdf"] .nur-bild { display: none; }
.dialog:not([data-raster="pdf"]) .nur-pdf { display: none; }
.dialog[data-raster="true"] .nur-pdf { display: none; }

/* Embedded in another website: only the editor */
.eingebettet .seite, .eingebettet .fuss, .eingebettet .marke h1 span { display: none; }
.eingebettet .arbeit { height: calc(100vh - 53px); height: calc(100dvh - 53px); min-height: 320px; }
.eingebettet body { overflow: hidden; }

/* Printing: only the pages */
#druck { display: none; }
@media print {
    body > *:not(#druck) { display: none !important; }
    body { background: #ffffff; margin: 0; }
    #druck { display: block; }
    #druck .blatt { box-shadow: none; margin: 0; break-after: page; page-break-after: always; }
    #druck .blatt:last-child { break-after: auto; page-break-after: auto; }
}

@media (max-width: 860px) {
    .seiten { padding: 12px 8px 70px; gap: 10px; }
    .buehne.vorschau .hinweiszeile { display: none; }
    .sync-felder { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
    .seiten-gruppe { display: none; }
    .eingebettet .arbeit { height: calc(100dvh - 148px); }
}
@media (max-width: 480px) {
    #btn-ai { width: 34px; padding: 0; }
    #btn-ai .txt { display: none; }
}
