/* Orqenio – Darstellung von Markdown, gemeinsam für Chat und Studio.
 *
 * Diese Regeln standen in app.css und hingen an `.assistantMsg`, einer
 * Chat-Klasse. Das Studio lädt app.css nicht – eine Kopie hätte funktioniert
 * und wäre nach zwei Änderungen auseinandergelaufen. Wurzelklasse ist
 * jetzt `.mdBody`; der Chat trägt sie zusätzlich zu `.assistantMsg`, damit
 * sich dort nichts ändert.
 *
 * Die Spezifität bleibt gleich (`.assistantMsg pre` und `.mdBody pre` sind
 * beide 0,1,1) – sonst hätte der Umzug still das Layout verschoben. */
.mdBody { overflow-wrap: break-word; }
.mdBody img { max-width: 100%; height: auto; border-radius: var(--radius-control); }

.mdBody { overflow-wrap: break-word; line-height: 1.62; }
/* AM HANDY ZU BREIT (Befund 03.09.2026, Kapitelleser der Wissensbasis):
 * Der Text lief rechts aus dem Bild. Ursache war NICHT das Umbrechen – das
 * stand schon da – sondern die Grundregel von Grid und Flex: Ein Element
 * darin bekommt `min-width: auto` und schrumpft deshalb NIE unter die Breite
 * seines breitesten Inhalts. Ein einziges langes Wort in einem <code> zieht
 * damit den ganzen Kasten über den Bildschirmrand hinaus, und das Umbrechen
 * kommt gar nicht erst zum Zug. `min-width: 0` hebt genau das auf. */
.mdBody { min-width: 0; }
.mdBody code { overflow-wrap: anywhere; }
.mdBody pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius-control); overflow-x: auto; font-size: 0.88em; }
.mdBody code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
/* Code-/Textblöcke mit Kopf (Sprach-Label + Kopieren + Ausklappen) */
.codeWrap { border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; margin: 8px 0; background: var(--surface); }
.codeHead {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border);
    font-size: 0.78em;
}
.codeHead .codeLang { color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; flex: 1; }
.codeBtn { border: none; background: transparent; color: var(--muted); padding: 2px 6px; border-radius: var(--radius-control); font-size: 0.95em; }
.codeBtn:hover { background: var(--border); color: var(--text); }
.codeWrap pre.codeBlock { margin: 0; border-radius: 0; background: var(--surface); max-height: 340px; }
.codeWrap.expanded pre.codeBlock { max-height: none; }
/* Syntax-Farben (nur bei echtem Code) */
.tok-kw { color: #b45f9e; }
.tok-str { color: #4c9a52; }
.tok-com { color: var(--muted); font-style: italic; }
.tok-num { color: #c07a3e; }
@media (prefers-color-scheme: dark) {
    .tok-kw { color: #d78fc4; }
    .tok-str { color: #8fce93; }
    .tok-num { color: #e0a56a; }
}

.mdBody h2, .mdBody h3, .mdBody h4 { margin: 10px 0 4px; }
/* .li ist der ALTE, flache Listenweg. Er bleibt für gespeicherte Nachrichten
   stehen, die noch so gerendert wurden – neue Listen sind echte ul/ol. */
.mdBody .li { padding-left: 8px; }
.mdBody .gap { height: 8px; }
.mdBody hr { border: none; border-top: 1px solid var(--border); }

/* ---------------------------- Listen ----------------------------
 * Echte Listen statt flacher Zeilen (07.08.2026). Der Einzug ist das
 * eigentliche Werkzeug: Bei einer Anleitung muss man auf einen Blick sehen,
 * was ein Schritt ist und was ein Unterpunkt davon. */
.mdBody ul.mdList, .mdBody ol.mdList { margin: 4px 0; padding-left: 22px; }
.mdBody ul.mdList { list-style: disc; }
.mdBody ol.mdList { list-style: decimal; }
/* Zweite Ebene sichtbar anders – zwei Reihen gleicher Punkte lesen sich
   wie eine Liste, nicht wie zwei Ebenen. */
.mdBody ul.mdList ul.mdList { list-style: circle; }
.mdBody ul.mdList ul.mdList ul.mdList { list-style: square; }
.mdBody .mdList li { margin: 2px 0; }
/* Verschachtelte Listen rücken ein, brauchen aber keinen Extra-Abstand nach
   oben – sonst reisst der Zusammenhang zum übergeordneten Punkt ab. */
.mdBody .mdList .mdList { margin-top: 2px; }

/* Aufgabenliste: Kästchen statt Punkt. Bewusst nicht anklickbar – der
   Zustand würde nirgends gespeichert (siehe Kommentar in markdown.js). */
.mdBody ul.mdTaskList { list-style: none; padding-left: 4px; }
.mdBody li.mdTaskItem { display: flex; align-items: baseline; gap: 8px; }
.mdBody .mdTask {
    flex: 0 0 auto; width: 13px; height: 13px; margin-top: 2px;
    border: 1.5px solid var(--muted); border-radius: 3px; position: relative;
}
.mdBody .mdTask.done { border-color: var(--accent-ink); background: var(--accent-ink); }
.mdBody .mdTask.done::after {
    content: ""; position: absolute; left: 3.5px; top: 0.5px;
    width: 3px; height: 7px; border: solid var(--surface);
    border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Leitzeile: fetter Absatzanfang bekommt eine eigene Zeile.
 * Belegt am Chat-Export vom 07.08.2026 – eine Antwort mit fünf Phasen hatte
 * NULL Überschriften und NULL Listenzeilen, nur „**Phase 1 – …** Fließtext".
 * Optisch eine Trennung, bewusst kein <h*>: Die Ebene wäre geraten, und eine
 * falsche Ebene verwirrt Vorleseprogramme mehr als eine fehlende. */
.mdBody .mdLead { font-weight: 650; margin-top: 10px; }
/* Direkt nach einer Überschrift wäre der Abstand doppelt. */
.mdBody h2 + .mdLead, .mdBody h3 + .mdLead, .mdBody h4 + .mdLead,
.mdBody h5 + .mdLead, .mdBody .gap + .mdLead { margin-top: 0; }

/* Weitere Auszeichnungen (07.08.2026) */
.mdBody del { opacity: 0.6; }
.mdBody mark { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }
.mdBody blockquote {
    margin: 8px 0; padding: 6px 12px;
    border-left: 3px solid var(--border); color: var(--muted);
}

.mdBody a { color: var(--accent-ink); word-break: break-word; overflow-wrap: anywhere; }
.mdTableWrap { overflow-x: auto; margin: 8px 0; }
.mdTable { border-collapse: collapse; font-size: 0.9em; min-width: 50%; }
.mdTable th, .mdTable td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
.mdTable th { background: var(--surface-2); font-weight: 650; }
.mdTable tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 40%, transparent); }

/* --- Mathematische Formeln (07.08.2026) ----------------------------------
 *
 * Nutzerwunsch: „Mathematische formeln einmal vereinfacht und einmal 'schoen'
 * formatiert". Der Satz kommt aus web/mathe.js - hier steht nur das Aussehen.
 *
 * Alles ueber Rollen aus base.css. Ein Bruchstrich, der im Dunkelmodus
 * unsichtbar wird, waere schlimmer als kein Bruchstrich: Man liest die Formel
 * dann falsch, ohne es zu merken. */
.mFormel { font-family: "Cambria Math", "Latin Modern Math", Georgia, "Times New Roman", serif; }
.mInline { display: inline-flex; align-items: center; gap: 4px; vertical-align: baseline; }
.mBlock
{
    display: flex; align-items: center; justify-content: center; gap: 12px;
    margin: 12px 0; padding: 12px 14px; font-size: 1.1em;
    border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface-2);
    overflow-x: auto;
}
.mSatz { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; }

/* Variablen kursiv, Zahlen und Funktionsnamen aufrecht - so wie im Satz
   ueblich. Ohne den Unterschied liest sich `sin` wie s*i*n. */
.mVar { font-style: italic; }
.mZahl, .mFunktion { font-style: normal; }
.mFunktion { margin-right: 1px; }
.mText { font-family: inherit; font-style: normal; font-size: .92em; }
.mFett { font-weight: 700; }
.mOp { margin: 0 .18em; }
.mGross { font-size: 1.5em; line-height: 1; margin: 0 .12em; }
/* Ein unbekannter Befehl bleibt SICHTBAR stehen. Ihn zu verschlucken hiesse,
   eine unvollstaendige Formel als vollstaendig auszugeben. */
.mUnbekannt { color: var(--danger); font-family: monospace; font-size: .85em; font-style: normal; }

/* Bruch: zwei Zeilen mit Strich dazwischen. inline-block statt einer Tabelle,
   damit er sich in eine Zeile Fliesstext einfuegt. */
.mBruch
{
    display: inline-flex; flex-direction: column; align-items: center;
    vertical-align: middle; margin: 0 .18em; line-height: 1.15;
}
.mZaehler { padding: 0 .3em; }
.mNenner { padding: 0 .3em; border-top: 1px solid currentColor; }

/* Wurzel: Zeichen plus Ueberstrich ueber dem Inhalt. Der Ueberstrich ist der
   Teil, den man weglassen koennte - und dann sieht `√a+b` aus wie `√a + b`,
   was etwas anderes ist. */
.mWurzel { display: inline-flex; align-items: flex-start; vertical-align: middle; }
.mWurzelGrad { font-size: .6em; margin-right: -.35em; margin-top: -.1em; }
.mWurzelZeichen { font-size: 1.15em; line-height: 1; }
.mWurzelInhalt { border-top: 1px solid currentColor; padding: 0 .18em; margin-top: .12em; }

.mFormel sup, .mFormel sub { font-size: .72em; line-height: 0; }

/* Der Umschalter „schoen" / „einfach". Klein und unaufdringlich - er gehoert
   zur Formel, nicht in den Vordergrund. */
.mUmschalter
{
    border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface);
    color: var(--muted); font-family: system-ui, sans-serif; font-size: .72rem;
    padding: 2px 8px; cursor: pointer; flex: 0 0 auto; align-self: center;
}
.mUmschalter:hover { color: var(--text); border-color: var(--border-strong); }
/* Was nicht gesetzt werden kann, sagt es - der Knopf ist dann nur Beschriftung. */
.mNurEinfach .mUmschalter { cursor: default; }
.mNurEinfach .mSatz code { font-size: .92em; }
