/* ==========================================================================
   json.giit.ch - styles for the editor and the text pages
   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;
    --ai-an: #1f9d55;
    --ai-warte: #f2b632;
    --fehler-bg: #fdecec;
    --auswahl: #1a73e8;
    --buehne: #e8eaef;
    --karo-a: #ffffff;
    --karo-b: #e6e8ee;
    --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;
        --ai-an: #3ccf7e;
        --ai-warte: #f2b632;
        --fehler-bg: #3a1c1f;
        --auswahl: #5aa2ff;
        --buehne: #0b0d11;
        --karo-a: #2a2e38;
        --karo-b: #22262f;
        --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;
    --ai-an: #3ccf7e;
    --ai-warte: #f2b632;
    --fehler-bg: #3a1c1f;
    --auswahl: #5aa2ff;
    --buehne: #0b0d11;
    --karo-a: #2a2e38;
    --karo-b: #22262f;
    --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 document (opens "My documents") 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(--marke);
    overflow: auto; border-radius: 0; box-shadow: none !important;
}
.zeilen-band { position: absolute; left: 0; right: 0; top: 0; height: 20px; background: var(--mark-sel); opacity: 0.45; pointer-events: none; will-change: transform; }
.code-feld:focus-within .zeilen-band { opacity: 1; }
#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); }
.werkzeuge { padding: 6px; }

/* ---------- 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);
}
.inspector .reiter { flex-wrap: nowrap; gap: 2px; padding: 6px 4px; }
.inspector .reiter button { flex: 1 1 auto; min-width: 0; padding: 0 6px; font-size: 12.5px; white-space: nowrap; }
.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; }
.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; }
.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; }
.kasten { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }

/* Buttons on a card (My documents) */
.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); }
@media (pointer: coarse) { .ek { width: 32px; height: 32px; line-height: 32px; } }

/* ---------- 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-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 documents */
.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-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 document 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; }

.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; }
.empfang.laedt .empfang-box p:empty { display: none; }
.empfang.laedt .empfang-box img { animation: empfang-laedt 0.9s ease-in-out infinite alternate; }
@keyframes empfang-laedt { to { opacity: 0.35; transform: scale(0.88); } }
@media (prefers-reduced-motion: reduce) { .empfang.laedt .empfang-box img { animation: 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; }
/* German interface: hidden for the moment until its texts are there (i18n.js). */
html.uebersetzen :is(.kopf, .ansichten, #work, dialog) { visibility: hidden; }
.ai-knopf { position: relative; }
/* An AI is connected: the button lights up green with a check mark; waiting for the key: a yellow dot. */
.knopf.ai-knopf[data-ai="an"], .knopf.ai-knopf[data-ai="an"]:hover { color: var(--ai-an); border-color: var(--ai-an); background: color-mix(in srgb, var(--ai-an) 14%, var(--flaeche)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ai-an) 22%, transparent); }
.ai-knopf[data-ai="an"]::after { content: "✓"; position: absolute; top: -7px; right: -7px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ai-an); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; box-shadow: 0 0 0 2px var(--flaeche); }
.ai-knopf[data-ai="warte"]::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ai-warte); box-shadow: 0 0 0 2px var(--flaeche); }
.ai-status { list-style: none; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 12px; font-size: 14px; color: var(--leise); }
.ai-status li { display: flex; gap: 8px; align-items: baseline; }
.ai-status li + li { margin-top: 4px; }
.ai-status li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--linie-stark); transform: translateY(-1px); }
.ai-status li[data-ai] { color: var(--text); }
.ai-status li[data-ai="an"]::before { background: var(--ai-an); }
.ai-status li[data-ai="warte"]::before { background: var(--ai-warte); }
.ai-remote { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--marke); border-radius: 12px; background: var(--mark-sel); }
.ai-remote p { margin: 0; }
.ai-remote details { margin-top: 8px; font-size: 14px; }
.ai-remote summary { cursor: pointer; }
.ai-remote-prompt { margin: 6px 0 0; padding: 8px 10px; max-height: 160px; overflow: auto; white-space: pre-wrap; font: 12px/1.45 var(--mono); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; }
.ai-prompt-text { width: 100%; margin: 4px 0 10px; font: 12px/1.45 var(--mono); resize: vertical; }
.beispiel { margin: 0 0 14px; padding: 14px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; overflow-x: auto; font-size: 13px; line-height: 1.5; }
.beispiel code { background: none; padding: 0; white-space: pre; }
.text-abschnitt h3 + p { margin-top: 0; }
.text-abschnitt p + h3, .beispiel + h3 { margin-top: 22px; }
.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; }
.recht h3 { font-size: 17px; margin: 22px 0 6px; }
.recht table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14px; margin: 10px 0 16px; }
.recht th, .recht td { text-align: left; vertical-align: top; padding: 6px 10px; border-bottom: 1px solid var(--linie); }
.recht code { overflow-wrap: anywhere; }
.zurueck { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; text-decoration: none; font-weight: 600; }

/* ---------- Medium width: a narrower side panel ---------- */

@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; }
        .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; }
}


/* ==========================================================================
   Data editor: code, tree, side panel
   ========================================================================== */

.werkzeuge { flex-wrap: wrap; }

/* 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 .pr-zeile {
    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 .pr-zeile:hover { background: rgba(127, 127, 127, .14); }
.probleme .zeile-nr { flex: none; min-width: 96px; color: var(--leise); font-variant-numeric: tabular-nums; }
.probleme .err .art { color: var(--gefahr); }
.probleme .schema .art { color: var(--c-tag); }
.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); }
.marks mark.schema { background: rgba(122, 61, 216, .14); }

/* Tree */
.baum-leiste { gap: 4px 6px; }
.baum-leiste .gruppe { flex-wrap: wrap; gap: 3px; }
.baum-leiste select { width: auto !important; height: 30px; font-size: 13px; }
.baum-suche { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.baum-suche input { width: 150px !important; height: 30px; }
.baum-suche .leise { min-width: 46px; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.baum-flaeche { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--code-bg); }
.daten-baum { flex: 1; min-height: 0; overflow: auto; padding: 6px 0 40px; font: 13px/22px var(--mono); outline: none; }
.daten-baum:focus-visible { box-shadow: inset 0 0 0 2px var(--mark-sel); }
.tz {
    display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 calc(8px + var(--t) * 18px);
    white-space: nowrap; cursor: pointer; border-radius: 0;
}
.tz:hover { background: var(--flaeche-2); }
.tz.aktiv { background: var(--mark-sel); box-shadow: inset 3px 0 0 var(--auswahl); }
.tz.treffer { background: rgba(214, 158, 46, .14); }
.tz.treffer.jetzt { background: rgba(214, 158, 46, .32); }
.tz mark { background: rgba(242, 182, 50, .55); color: inherit; border-radius: 2px; }
.tz.leer { color: var(--leise); cursor: default; padding-left: 14px; }
.tz-auf { flex: none; width: 14px; height: 14px; display: inline-grid; place-items: center; color: var(--leise); }
.tz-auf::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .12s; }
.tz[aria-expanded="true"] > .tz-auf::before { transform: rotate(45deg) translate(-1px, -1px); }
.tz-auf.leer::before { display: none; }
.tz-auf:hover { color: var(--text); }
.tz-k { flex: none; color: var(--c-tag); overflow: hidden; text-overflow: ellipsis; max-width: 40ch; cursor: text; }
.tz-i { color: var(--leise); }
.tz-p { color: var(--c-punkt); margin-left: -5px; }
.tz-wurzel, .tz-dok-name { color: var(--leise); font-weight: 700; }
.tz-v { overflow: hidden; text-overflow: ellipsis; min-width: 0; cursor: text; }
.tz-k:hover, .tz-v[data-edit]:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.t-string { color: var(--c-wert); }
.t-number { color: var(--c-sonder); }
.t-boolean, .t-null { color: var(--c-ent); }
.t-alias { color: var(--c-attr); }
.tz-sum { color: var(--leise); }
.tz-vor { color: var(--leise); opacity: .75; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tz-anker, .tz-tag { flex: none; padding: 0 5px; border-radius: 5px; font-size: 11.5px; line-height: 18px; color: var(--c-attr); background: var(--flaeche-2); box-shadow: inset 0 0 0 1px var(--linie); }
.tz-ziel { color: var(--leise); font-size: 12px; }
.tz-typ { margin-left: auto; padding-left: 12px; flex: none; font: 11px system-ui, sans-serif; color: var(--leise); opacity: .8; }
.tz-mehr { cursor: default; }
.tz:has(textarea.tz-edit) { height: auto; }
.tz-platz { pointer-events: none; }
.tz-edit { min-width: 6ch; height: 24px !important; padding: 0 6px !important; font: 13px var(--mono) !important; border-radius: 5px !important; }
textarea.tz-edit { height: auto !important; width: min(60ch, 100%) !important; white-space: pre; }
.tz-edit.falsch { border-color: var(--gefahr) !important; box-shadow: 0 0 0 3px var(--mark-err) !important; }
.pfad-zeile {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0; min-height: 34px; padding: 5px 10px;
    border-top: 1px solid var(--linie); background: var(--flaeche); font: 12.5px var(--mono);
}
.pfad-teil { padding: 2px 3px; border: 0; border-radius: 4px; background: none; color: var(--marke); cursor: pointer; font: inherit; }
.pfad-teil:hover { background: var(--marke-hell); }
.pfad-teil.jetzt { color: var(--text); font-weight: 700; }
.pfad-dok { color: var(--leise); margin-right: 8px; font-family: system-ui, sans-serif; }
.pfad-fuss { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--linie); background: var(--flaeche); }
.pfad-fuss .pfad-zeile { flex: 1; border-top: 0; min-width: 0; }
.pfad-fuss .knopf { margin-right: 8px; }

/* Side panel */
.knoten-form { display: grid; gap: 10px; padding-top: 10px; }
.knoten-form .feld { grid-row: auto; grid-template-rows: auto auto; }
.knoten-form textarea { min-height: 60px; font: 12.5px var(--mono); }
.knoten-form code { font: 12px var(--mono); overflow-wrap: anywhere; }
.knoten-info { padding: 10px 12px; border: 1px solid var(--linie); border-radius: var(--r); background: var(--flaeche-2); font-size: 12.5px; color: var(--leise); }
.knoten-info b { color: var(--text); }
.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; }
.umwandeln textarea { width: 100%; height: 220px !important; font: 12px/1.5 var(--mono) !important; white-space: pre; background: var(--code-bg) !important; }
.umwandeln .feld { grid-row: auto; grid-template-rows: auto auto; margin-top: 8px; }
.umwandeln .zeile2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.schema-form .feld { grid-row: auto; grid-template-rows: auto auto; margin-top: 10px; }
.schema-stand { margin-top: 12px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--linie); font-size: 12.5px; }
.schema-stand.gut { border-color: var(--ai-an); color: var(--ai-an); }
.schema-stand.schlecht { border-color: var(--gefahr); color: var(--gefahr); background: var(--fehler-bg); }

/* My documents: the start of the code as the picture */
.datei-bild.dok { background: var(--code-bg); padding: 10px 12px; place-items: stretch; overflow: hidden; }
.mini-code { margin: 0; overflow: hidden; font: 8.5px/1.4 var(--mono); color: var(--leise); white-space: pre; text-align: left; }

/* 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); }

/* 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; }

@media (max-width: 860px) {
    .sync-felder { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; }
    .eingebettet .arbeit { height: calc(100dvh - 148px); }
    .baum-suche { margin-left: 0; width: 100%; }
    .baum-suche input { flex: 1; width: auto !important; }
    .tz-typ { display: none; }
}
@media (max-width: 480px) {
    #btn-ai { width: 34px; padding: 0; }
    #btn-ai .txt { display: none; }
}

/* Footer: the links wrap on narrow screens. */
.fuss { flex-wrap: wrap; }
.fuss nav { flex-wrap: wrap; gap: 6px 14px; }

/* Language menu in the top bar (i18n.js fills [data-sprachen]). */
.sprachen:empty { display: none; }
.sprachwahl { height: 34px; padding: 0 8px; border: 1px solid var(--linie); border-radius: 10px; background: var(--flaeche); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.sprachwahl:hover { border-color: var(--marke); }

/* The side panel never scrolls sideways: everything wraps inside its width -
   buttons with long labels, paths, code and the text of every language. */
.inspector-body { overflow-x: hidden; }
.inspector-body .knopf { height: auto; min-height: 34px; max-width: 100%; padding-block: 4px; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.inspector-body .knopf.klein { min-height: 28px; padding-block: 3px; }
.inspector-body :is(.feld, label, p, li, h3, span, code, small) { min-width: 0; overflow-wrap: anywhere; }
.inspector-body :is(select, input, textarea) { max-width: 100%; min-width: 0; }
.inspector-body textarea { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: hidden; }

/* The viewer (?viewer=1): only the document and a small bar. */
.betrachter .seite, .betrachter .fuss, .betrachter .code-pane, .betrachter #splitter, .betrachter .inspector,
.betrachter .marke, .betrachter .kopf .leiste.datei, .betrachter .zeichen-pane > .pane-kopf, .betrachter .tabellen-pane > .pane-kopf,
.betrachter .ansicht-reiter, .betrachter .leiste.aus > *:not(#btn-download):not(#btn-export) { display: none !important; }
.betrachter .pfad-fuss, .betrachter .baum-pfad, .betrachter #hint, .betrachter .hinweiszeile,
.betrachter .tabelle .neu, .betrachter .tabelle .leer, .betrachter .tabelle .sortieren { display: none !important; }
.betrachter .kopf { justify-content: flex-end; flex-wrap: nowrap; }
.betrachter .leiste.aus { flex: none; flex-wrap: nowrap; }
.betrachter-hinweis { flex: 1 1 0; min-width: 0; font-size: 12px; line-height: 1.25; color: var(--leise); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.betrachter-leer .betrachter-hinweis { display: none; }
.betrachter .arbeit { display: block !important; height: calc(100vh - 53px); height: calc(100dvh - 53px); }
.betrachter .zeichen-pane, .betrachter .tabellen-pane { display: flex !important; flex-direction: column; width: 100%; height: 100%; }
.betrachter .zoom > *:not(#zoom-out):not(#zoom-100):not(#zoom-in):not(#zoom-fit):not(#zoom-page):not(#size-down):not(#size-100):not(#size-up) { display: none !important; }
.betrachter-leer .zeichen-pane, .betrachter-leer .tabellen-pane { visibility: hidden; }

/* Export: open the document in another editor. All buttons are the same size. */
.ex-umwandeln { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.ex-umwandeln > span { grid-column: 1 / -1; font-size: 12px; }
.ex-umwandeln > button { justify-content: center; white-space: nowrap; }
@media (max-width: 480px) {
    .ex-umwandeln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.ex-umwandeln { display: none; }
#export.ex-umwandeln-an .ex-umwandeln { display: grid; margin-top: 0; }
#export.ex-umwandeln-an .dialog-inhalt > *:not(.ex-zeile):not(.ex-umwandeln):not(.ex-formate-box) { display: none !important; }
#export.ex-umwandeln-an .ex-zeile > *:not(:has(#ex-name)):not(:has(#ex-format)) { display: none !important; }
.probleme li .pr-zeile { user-select: text; cursor: text; }
.probleme li .pr-zeile span { user-select: text; }

/* Export: narrow and as tall as its content. The top edge stays where it is when the format changes;
   only a screen too small for it scrolls, the buttons stay in view. */
#export.dialog { width: min(440px, calc(100vw - 16px)); height: fit-content; max-height: calc(100dvh - 24px); margin: 12px auto auto; overflow: hidden; }
#export[open] { display: flex; flex-direction: column; }
#export .dialog-kopf { flex: none; }
#export .dialog-inhalt { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 14px 18px 0; overflow: auto; }
#export .dialog-inhalt > * { flex: none; margin-top: 0; margin-bottom: 0; }
#export .dialog-inhalt > .ex-zeile:first-child { grid-template-columns: 1fr; grid-template-rows: auto auto; }
#export label.feld:has(#ex-format) { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0.01; pointer-events: none; }
#export .ex-zeile.vier { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; }
#export .nur-pdf .hinweis { margin: 0; }
.ex-formate-titel { font-size: 12.5px; color: var(--leise); font-weight: 500; margin-bottom: 3px; }
.ex-formate { display: grid; gap: 3px; }
.ex-formate.viele { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ex-formate.viele .ex-gruppe { grid-column: 1 / -1; }
.ex-gruppe { font-size: 11px; font-weight: 600; color: var(--leise); margin: 6px 0 0; }
.ex-gruppe:first-child { margin-top: 0; }
.ex-format { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; min-width: 0; border: 1px solid var(--linie); border-radius: 8px; cursor: pointer; font-size: 13px; }
.ex-format:hover { background: var(--flaeche-2); }
.ex-format:has(input:checked) { border-color: var(--marke); background: var(--flaeche-2); font-weight: 600; }
.ex-format input[type=radio] { flex: none; width: 16px !important; height: 16px !important; min-width: 0; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; accent-color: var(--marke); }
.ex-format span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#export .ex-text { flex: 0 1 200px; min-height: 90px; height: auto !important; resize: none; }
#export .ex-umwandeln { grid-template-columns: 1fr; }
#export .ex-umwandeln > button { height: 34px; }
#export.ex-umwandeln-an .dialog-inhalt { padding-bottom: 18px; }
#export .ex-umbruch { display: flex; white-space: normal; margin: 0; }
#export .ex-umbruch[hidden] { display: none; }
#export .dialog-fuss { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 4px 0 16px; background: var(--flaeche); z-index: 1; }
#export .dialog-fuss > #ex-info { flex: 1 0 100%; display: block; font-size: 12px; }
#export .dialog-fuss > #ex-info:empty { display: none; }
#export .dialog-fuss > button { flex: 1 1 0; justify-content: center; white-space: nowrap; }
#export .dialog-fuss > .haupt { flex: 1 0 100%; grid-column: auto; }
#export .dialog-fuss > button[hidden] { display: none; }
@media (min-height: 900px) {
    #export.dialog { margin-top: 3vh; max-height: 94dvh; }
}
@media (max-height: 760px), (max-width: 480px) {
    #export .ex-text { flex-basis: 96px; min-height: 70px; }
    #export .dialog-inhalt { gap: 8px; padding-top: 10px; }
    #export .dialog-kopf { padding: 8px 18px; }
    .ex-format { height: 28px; font-size: 12.5px; }
    .ex-gruppe { margin-top: 3px; }
}
.ex-formate.viele .ex-format { height: 40px; }
.ex-formate.viele .ex-format span { white-space: normal; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#export:has(.ex-formate.viele) .ex-text { flex-basis: 110px; }
@media (max-width: 480px) {
    .ex-formate.viele { grid-template-columns: 1fr; }
    .ex-formate.viele .ex-format { height: 28px; }
    .ex-formate.viele .ex-format span { display: block; white-space: nowrap; }
}

/* ---------- Alike and inside the screen in every language (EDT-GUI-10) ---------- */

/* Buttons of one grid are one size in every language, width and state: each has room for exactly two
   lines of its label (a short label stands in the middle), words wrap only at spaces. Where the narrow
   panel of a small desktop leaves too little room, the grid has one column (two-button rows stay
   one column on every desktop, their labels are long). The QR choices have their fixed label area. */
.inspector-body :is(.einfuege-gitter, .knopfreihe.zwei, .knopfreihe.stapel) { grid-auto-rows: auto; }
.inspector-body :is(.einfuege-gitter, .knopfreihe.zwei, .knopfreihe.stapel) > .knopf {
    height: calc(2.5em + 10px); min-height: 0; padding-block: 0; line-height: 1.25;
    white-space: normal; overflow-wrap: break-word; word-break: normal; hyphens: manual;
}
.inspector-body .einfuege-gitter > .knopf { text-align: left; }
@media (min-width: 861px) {
    .inspector-body .knopfreihe.zwei { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 861px) and (max-width: 1180px) {
    .inspector-body .einfuege-gitter { grid-template-columns: minmax(0, 1fr); }
}
/* Two long buttons (Schema tab) one below the other, each the full width. */
.knopfreihe.stapel { display: grid; grid-template-columns: minmax(0, 1fr); }
/* Panel tabs: a little less padding and type, so the longest languages fit beside each other; four
   tabs in the narrow panel of a small desktop stand in two rows of two. */
.inspector .reiter button { padding: 0 4px; font-size: 12px; }
@media (min-width: 861px) and (max-width: 1180px) {
    .inspector .reiter:has(> :nth-child(4)) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
}
/* The view tabs share the bar in equal parts, whatever their labels. */
.ansichten button { flex: 1 1 0; min-width: 0; padding: 0 4px; white-space: nowrap; }

/* The code of the page language, shown by the language menu on phones. */
html:lang(en) { --sprache-kurz: "EN"; }
html:lang(de) { --sprache-kurz: "DE"; }
html:lang(fr) { --sprache-kurz: "FR"; }
html:lang(it) { --sprache-kurz: "IT"; }
html:lang(es) { --sprache-kurz: "ES"; }
html:lang(pt) { --sprache-kurz: "PT"; }
html:lang(nl) { --sprache-kurz: "NL"; }
html:lang(pl) { --sprache-kurz: "PL"; }
html:lang(tr) { --sprache-kurz: "TR"; }
html:lang(ru) { --sprache-kurz: "RU"; }
html:lang(uk) { --sprache-kurz: "UA"; }   /* the country code: "UK" reads as United Kingdom */
html:lang(zh) { --sprache-kurz: "ZH"; }
html:lang(ja) { --sprache-kurz: "JA"; }
html:lang(ko) { --sprache-kurz: "KO"; }
@media (max-width: 480px) {
    /* Bar on phones: row 1 the document, row 2 language, theme, AI, server and help, row 3 Save and
       Export side by side. The rows are the same in every language and whether Save is shown or not;
       no button is squeezed or pushed off the screen. */
    html:not(.betrachter) .leiste.aus { flex-wrap: wrap; row-gap: 3px; }
    html:not(.betrachter) .leiste.aus > * { flex: none; }
    /* The language menu shows the code of the page language ("DE"); the native menu over it, invisible,
       still lists the full names. Same width in every language. */
    html:not(.betrachter) .leiste.aus > .sprachen { position: relative; flex: none; width: 42px; height: 34px; }
    html:not(.betrachter) .leiste.aus > .sprachen::before {
        content: var(--sprache-kurz, "EN") "\00a0\25BE"; display: flex; align-items: center; justify-content: center;
        box-sizing: border-box; height: 100%; border: 1px solid var(--linie); border-radius: 10px;
        background: var(--flaeche); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap;
    }
    html:not(.betrachter) .leiste.aus > .sprachen:hover::before { border-color: var(--marke); }
    html:not(.betrachter) .leiste.aus > .sprachen:focus-within::before { outline: 2px solid var(--marke); outline-offset: 1px; }
    html:not(.betrachter) .leiste.aus .sprachwahl { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
    html:not(.betrachter) .leiste.aus .schema button { width: 26px; }
    html:not(.betrachter) .leiste.aus > #btn-help { padding: 0 8px; }
    html:not(.betrachter) .leiste.aus::after { content: ""; order: 1; flex-basis: 100%; }
    html:not(.betrachter) .leiste.aus > :is(#btn-save, #btn-export) { order: 2; flex: 1 1 0; min-width: 0; margin-left: 0; justify-content: center; }
    html:not(.betrachter) .arbeit, html:not(.betrachter).eingebettet .arbeit { height: calc(100dvh - 188px); }
    /* Head of the code: the buttons on a row of their own, Copy as its symbol (as Undo and AI). */
    .code-pane > .pane-kopf .rechts { flex: 1 0 100%; justify-content: flex-end; gap: 4px; }
    .code-pane > .pane-kopf .rechts .knopf.klein { padding: 0 6px; }
    .code-pane > .pane-kopf .rechts #btn-copy { width: 28px; padding: 0; justify-content: center; }
    .code-pane > .pane-kopf .rechts #btn-copy .txt { display: none; }
    /* Tool bars above the preview wrap instead of running off the screen. */
    .werkzeuge > .gruppe { flex-wrap: wrap; }
    /* SVG and preview zoom bar: the background choice gives way. */
    .buehne .zoom > * { flex: none; }
    .buehne .zoom > select { flex: 1 1 auto; min-width: 0; }
}
