/* Anki-Reiter (anki.js, app/anki/): Stapelliste, Lernen, Editor, Optionen. Alles unter #anki, #anki-lernen, .ak-… und .anki-karte;
   die Karten selbst (.anki-karte) bekommen das CSS ihres Notiztyps zusätzlich, auf .anki-karte begrenzt (app/anki/bereinigen.py). */

/* ---------- Stapelliste */
.ak-aktionen { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.ak-aktionen > button { flex: 1 1 auto; min-width: 0; }
.ak-kopfzeile { display: flex; align-items: center; padding: 0 4px 4px 44px; font-size: calc(12px * var(--schrift)); color: var(--leise); }
.ak-kopfzeile > span:first-child { flex: 1; }
.ak-zahl-titel { width: 44px; text-align: center; font-weight: 600; }
.ak-kopfzeile > span:last-child { width: 40px; }
.ak-liste { padding: 4px 0; }
.ak-stapel { display: flex; align-items: center; min-height: 48px; padding: 0 4px 0 calc(8px + var(--tiefe, 0) * 20px); border-bottom: .5px solid var(--rand); }
.ak-stapel:last-child { border-bottom: none; }
.ak-auf { flex: none; width: 28px; height: 40px; display: grid; place-items: center; background: none; border: none; color: var(--leise); padding: 0; }
.ak-auf svg { width: 8px; height: 14px; transition: transform .2s ease; }
.ak-auf.offen svg { transform: rotate(90deg); }
.ak-auf.leer { pointer-events: none; }
.ak-name { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 12px 6px; color: var(--text); font-size: calc(17px * var(--schrift)); overflow-wrap: break-word; hyphens: auto; }
.ak-name:active { opacity: .55; }
.ak-zahl { flex: none; width: 44px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: calc(16px * var(--schrift)); }
.ak-zahl.neu, .ak-zahl-titel.neu { color: var(--haupt); }
.ak-zahl.lernen, .ak-zahl-titel.lernen { color: var(--schlecht); }
.ak-zahl.wdh, .ak-zahl-titel.wdh { color: var(--gut); }
.ak-zahl.null { opacity: .3; }
.ak-mehr { flex: none; width: 40px; height: 40px; display: grid; place-items: center; background: none; border: none; color: var(--leise); padding: 0; }
.ak-mehr svg { width: 22px; height: 22px; }
.ak-fuss { text-align: center; margin: 14px 0 0; }
.ak-leer { margin-top: 24px; }
.ak-menue { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ak-menue-zeile { width: 100%; text-align: left; min-height: 46px; padding: 11px 16px; border-radius: 12px; border: none; background: var(--blatt-feld); color: var(--text); font-size: calc(17px * var(--schrift)); }
.ak-menue-zeile.ak-gefahr { color: var(--schlecht); }
.ak-menue-titel { margin: 10px 4px 0; text-transform: uppercase; font-size: calc(12px * var(--schrift)); }
.ak-flaggen { display: flex; gap: 8px; }
.ak-flaggenknopf { flex: 1; min-height: 44px; border-radius: 12px; border: 2px solid transparent; background: var(--blatt-feld); color: var(--f); font-size: 22px; padding: 0; }
.ak-flaggenknopf.an { border-color: var(--f); background: color-mix(in srgb, var(--f) 18%, var(--blatt-feld)); }

/* ---------- Lernen */
.ak-leiste { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.ak-leiste > .zurueck-glas { justify-self: start; max-width: 100%; overflow: hidden; }
.ak-leiste > .zurueck-glas span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ak-leiste-rechts { justify-self: end; display: flex; align-items: center; }
.ak-leiste-rechts .symbol svg { width: 24px; height: 24px; display: block; }
.ak-leiste-rechts .symbol:disabled { opacity: .3; }
.ak-zaehler { display: flex; gap: 14px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: calc(17px * var(--schrift)); }
.ak-kz.neu { color: var(--haupt); } .ak-kz.lernen { color: var(--schlecht); } .ak-kz.wdh { color: var(--gut); }
.ak-kz.jetzt { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.ak-lern { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
.ak-lade { text-align: center; margin-top: 60px; }
.ak-marken { display: flex; gap: 8px; justify-content: flex-end; min-height: 22px; margin-bottom: 6px; font-size: calc(14px * var(--schrift)); }
.ak-flagge { color: var(--f); font-size: 18px; line-height: 1; }
.ak-stern { color: var(--teil); font-size: 18px; line-height: 1; }
.ak-aus { color: var(--leise); }
.ak-knoepfe { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: flex; gap: 8px; padding: 10px max(14px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: var(--leiste); -webkit-backdrop-filter: var(--glas-blur); backdrop-filter: var(--glas-blur); border-top: .5px solid var(--glas-linie); }
.ak-knoepfe > * { flex: 1; max-width: 220px; }
.ak-knoepfe > .ak-zeigen { max-width: 680px; margin: 0 auto; min-height: 56px; font-size: calc(18px * var(--schrift)); }
.ak-knoepfe { justify-content: center; }
.ak-bewertung { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; padding: 6px 4px; border-radius: 16px; border: none; font-weight: 700;
  background: color-mix(in srgb, var(--c) 16%, var(--karte)); color: var(--c); }
.ak-bewertung:active { transform: scale(.97); }
.ak-bw-zeit { font-size: calc(12px * var(--schrift)); font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.ak-bw-name { font-size: calc(16px * var(--schrift)); }
.ak-bewertung.ak-b1 { --c: var(--schlecht); } .ak-bewertung.ak-b2 { --c: var(--orange-schrift); } .ak-bewertung.ak-b3 { --c: var(--gut); } .ak-bewertung.ak-b4 { --c: var(--haupt); }
.ak-fertig { text-align: center; padding: 48px 8px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ak-fertig-ic { font-size: 56px; }
.ak-fertig > button { min-width: 220px; }

/* ---------- Die Karte */
.anki-karte { max-width: 100%; padding: 20px 18px; border-radius: 18px; background: var(--karte); color: var(--text); box-shadow: var(--schatten-karte);
  font-size: calc(20px * var(--schrift)); line-height: 1.45; overflow-wrap: anywhere; min-height: 140px; }
.anki-karte img, .anki-karte video { max-width: 100%; height: auto; }
.anki-karte table { max-width: 100%; border-collapse: collapse; }
.anki-karte td, .anki-karte th { padding: 3px 8px; }
.anki-karte hr { border: none; border-top: 1px solid var(--rand); margin: 16px 0; }
.anki-karte .cloze { font-weight: 700; color: var(--haupt); }
.anki-karte .math.block { display: block; margin: 8px 0; overflow-x: auto; }
.anki-karte audio { width: 100%; max-width: 320px; height: 36px; vertical-align: middle; }
.anki-hint-knopf { color: var(--haupt); cursor: pointer; text-decoration: underline; }
.anki-hint-text { display: none; }
.anki-hint.offen .anki-hint-text { display: inline; }
.anki-hint.offen .anki-hint-knopf { display: none; }
.anki-fehler { color: var(--schlecht); font-size: .8em; }
.anki-tippen { width: 100%; margin-top: 14px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--rand); background: var(--karte-2); color: inherit; font: inherit; text-align: center; }
.anki-tipp { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; font-size: .9em; margin-top: 8px; }
.typeGood { background: rgba(48, 209, 88, .32); }
.typeBad { background: rgba(255, 69, 58, .38); }
.typeMissed { background: rgba(142, 142, 147, .35); }
.typeArrow { opacity: .6; }
/* Bildverdeckung */
.anki-io-kopf, .anki-io-extra { margin: 8px 0; }
.anki-io { text-align: center; }
.anki-io-bild { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.anki-io-bild img { display: block; max-width: 100%; height: auto; }
.anki-io-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.anki-io-form { vector-effect: non-scaling-stroke; stroke-width: 2px; }
.anki-io-form.aktiv { fill: #ff9f0a; stroke: #7a4a00; }
.anki-io-form.inaktiv { fill: #ffd60a; stroke: #7a6200; }
.anki-io-form.geloest { fill: rgba(48, 209, 88, .22); stroke: #30d158; stroke-dasharray: 6 4; }

/* ---------- Editor, Schlagwörter, Optionen */
.ak-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ak-zwei select { width: 100%; }
.ak-feldname { display: block; margin: 14px 0 4px; font-size: calc(12px * var(--schrift)); color: var(--leise); text-transform: uppercase; letter-spacing: .02em; }
.ak-werkzeuge { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.ak-werkzeug { min-width: 40px; min-height: 36px; padding: 0 10px; border-radius: 10px; border: none; background: var(--fuellung); color: var(--text); font-size: 16px; }
.ak-werkzeug.fett { font-weight: 800; } .ak-werkzeug.kursiv { font-style: italic; } .ak-werkzeug.unter { text-decoration: underline; }
.ak-feld { min-height: 66px; padding: 10px 12px; border-radius: 12px; background: var(--blatt-feld); border: 1px solid var(--rand); font-size: 17px; line-height: 1.4; outline: none; overflow-wrap: anywhere; }
.ak-feld:focus { border-color: var(--haupt); box-shadow: 0 0 0 3px var(--haupt-zart); }
.ak-feld img { max-width: 100%; height: auto; }
.ak-tags input { width: 100%; }
.ak-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ak-chip { padding: 4px 10px; border-radius: 999px; border: none; background: var(--haupt-zart); color: var(--haupt); font-size: calc(14px * var(--schrift)); }
.ak-warnung { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--teil) 24%, transparent); font-size: calc(14px * var(--schrift)); }
.ak-haken { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; }
.ak-ergebnis { margin-top: 12px; }
.ak-opt-titel { margin: 18px 0 2px; }
.ak-opt-zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: .5px solid var(--rand); }
.ak-opt-zeile > span { flex: 1; min-width: 0; }
.ak-opt-zeile input:not([type=checkbox]), .ak-opt-zeile select { flex: 0 0 auto; width: 46%; max-width: 230px; }
.ak-opt-zeile.haken { cursor: pointer; }
.ak-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0; }
.ak-info dt { color: var(--leise); } .ak-info dd { margin: 0; overflow-wrap: anywhere; }
.ak-h3 { font-size: calc(15px * var(--schrift)); margin: 18px 0 6px; }
.ak-verlauf { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--schrift)); }
.ak-verlauf th, .ak-verlauf td { text-align: left; padding: 4px 6px; border-bottom: .5px solid var(--rand); }

/* ---------- Verwalten: Kartenbrowser, Notiztypen, Bildverdeckung (anki-verwalten.js) */
.akb-seite { max-width: min(1200px, 100%); }
.akb-kopf { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.akb-kopf input { flex: 1; min-width: 0; }
.akb-knopf { min-height: 38px; padding: 0 12px; border-radius: 10px; border: none; background: var(--fuellung); color: var(--haupt); font-size: calc(15px * var(--schrift)); }
.akb-knopf:disabled { opacity: .35; }
.akb-werkzeug { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.akb-werkzeug .chips { margin: 0; }
.akb-sort { display: inline-flex; gap: 6px; align-items: center; }
.akb-sort select { min-height: 38px; }
.akb-zahl-zeile { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 6px; }
.akb-link { background: none; border: none; color: var(--haupt); padding: 0; font-size: inherit; }
.akb-tabelle { overflow-x: auto; background: var(--karte); border-radius: 12px; box-shadow: var(--schatten-karte); }
.akb-tabelle table { border-collapse: collapse; width: 100%; font-size: calc(14px * var(--schrift)); }
.akb-tabelle th, .akb-tabelle td { padding: 9px 10px; text-align: left; border-bottom: .5px solid var(--rand); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.akb-tabelle th { position: sticky; top: 0; background: var(--karte); color: var(--leise); font-weight: 600; font-size: calc(12px * var(--schrift)); }
.akb-sortierbar { cursor: pointer; }
.akb-wahl { width: 34px; padding-right: 0; }
.akb-wahl input { width: 20px; height: 20px; }
.akb-sortfeld { min-width: 170px; white-space: normal !important; }
.akb-klick { cursor: pointer; }
.akb-zeile.an { background: var(--haupt-zart); }
.akb-zeile.aus .akb-sortfeld { opacity: .55; }
.akb-zeile.begraben .akb-sortfeld { opacity: .75; font-style: italic; }
.akb-zahl { text-align: right !important; font-variant-numeric: tabular-nums; }
.akb-neu { color: var(--haupt); } .akb-lernen { color: var(--schlecht); } .akb-wdh { color: var(--gut); }
.akb-flagge { color: var(--f); } .akb-stern { color: var(--teil); } .akb-aus { color: var(--leise); }
.akb-seiten { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 12px 0; }
.akb-leer { text-align: center; margin-top: 30px; }
.akb-auswahl { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 6; display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-top: 12px;
  border-radius: 16px; background: var(--glas-stark); -webkit-backdrop-filter: var(--glas-blur); backdrop-filter: var(--glas-blur); box-shadow: var(--glas-schatten); }
.akb-auswahl > span { white-space: nowrap; }
.akb-hilfe code { font-size: .9em; background: var(--fuellung); padding: 1px 5px; border-radius: 6px; }
.akn-zeile { display: flex; gap: 8px; align-items: stretch; }
.akn-zeile .ak-menue-zeile { flex: 1; }
.akn-feld { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.akn-feld input[type=text] { flex: 1; min-width: 0; }
.akn-code { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; padding: 10px; border-radius: 10px; border: 1px solid var(--rand); background: var(--blatt-feld); color: var(--text); }
.akn-editor > input[type=text], .akn-editor > select { width: 100%; }
.akn-vorschau { margin-top: 8px; }
.akio-flaeche { margin: 10px 0 6px; text-align: center; }
.akio-bild { position: relative; display: inline-block; max-width: 100%; line-height: 0; touch-action: none; -webkit-user-select: none; user-select: none; }
.akio-bild img { display: block; max-width: 100%; max-height: 60vh; height: auto; pointer-events: none; }
.akio-svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.akio-form { fill: rgba(255, 159, 10, .65); stroke: #7a4a00; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.akio-form.gewaehlt { stroke: var(--haupt); stroke-width: 3px; fill: rgba(10, 132, 255, .45); }
.akt-spalte { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: .5px solid var(--rand); }
.akt-spalte > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.akt-spalte select { flex: 0 0 46%; }
.akt-bereich { margin-top: 12px; }
.ak-haken input[type=checkbox], .ak-opt-zeile input[type=checkbox], .akt-bereich input[type=checkbox] { width: 22px; height: 22px; min-width: 22px; flex: none; margin: 0; }
.ak-haken { align-items: center; }

/* ---------- Extras: Statistik, eigene Lernsitzung, KI, Offline (anki-extras.js) */
.ak-stapel.gefiltert .ak-name { color: var(--haupt); font-style: italic; }
.ake-seite { max-width: 760px; }
.ake-kopf { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.ake-kopf select { flex: 1; min-width: 140px; }
.ake-kopf .chips { margin: 0; }
.ake-karte { margin-bottom: 12px; }
.ake-karte h3 { font-size: calc(15px * var(--schrift)); margin: 0 0 8px; color: var(--leise); text-transform: uppercase; letter-spacing: .02em; font-weight: 600; }
.ake-gross { font-size: calc(22px * var(--schrift)); font-weight: 700; margin: 0 0 4px; }
.ake-balken { display: flex; align-items: flex-end; gap: 3px; height: 130px; margin: 6px 0 4px; }
.ake-balken.eng { gap: 1px; }
.ake-spalte { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.ake-saeule { display: flex; flex-direction: column-reverse; border-radius: 3px 3px 0 0; overflow: hidden; background: transparent; min-height: 0; }
.ake-saeule > i { display: block; }
.ake-spalte > .ake-saeule:only-child { background: var(--haupt); }
.ake-saeule:has(i) { background: transparent; }
.ake-name { font-size: 10px; color: var(--leise); text-align: center; height: 14px; white-space: nowrap; overflow: visible; }
.ake-leiste { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--fuellung); margin: 4px 0 8px; }
.ake-leiste > i { display: block; height: 100%; }
.ake-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0; padding: 0; list-style: none; font-size: calc(13px * var(--schrift)); color: var(--leise); }
.ake-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ake-zeile { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; font-size: calc(14px * var(--schrift)); }
.ake-kal-huelle { overflow-x: auto; padding-bottom: 4px; }
.ake-kalender { display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column; grid-auto-columns: 11px; gap: 3px; width: max-content; }
.ake-kalender > i { width: 11px; height: 11px; border-radius: 3px; background: var(--fuellung); }
.ake-kalender > i.leer { background: transparent; }
.ake-kalender > i.s1 { background: color-mix(in srgb, var(--gut) 30%, var(--fuellung)); }
.ake-kalender > i.s2 { background: color-mix(in srgb, var(--gut) 55%, var(--fuellung)); }
.ake-kalender > i.s3 { background: color-mix(in srgb, var(--gut) 80%, var(--fuellung)); }
.ake-kalender > i.s4 { background: var(--gut); }
.ake-kennzahlen { display: flex; gap: 10px; }
.ake-kennzahlen > div { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 12px; background: var(--fuellung); }
.ake-kennzahlen b { font-size: calc(20px * var(--schrift)); }
.ake-vorschlaege { margin-top: 14px; }
.ake-vorschlag { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: .5px solid var(--rand); }
.ake-vorschlag input { width: 22px; height: 22px; min-width: 22px; margin-top: 2px; }
.ake-erklaeren-zeile { text-align: center; margin-top: 10px; }
.ake-erklaeren { border-radius: 999px; padding: 8px 16px; border: none; background: var(--haupt-zart); color: var(--haupt); font-weight: 600; }
.ake-erklaerung { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--karte); box-shadow: var(--schatten-karte); text-align: left; }
.ake-erklaerung p { margin: 0 0 8px; }

/* Cards im Fach-Blatt: Umschalter Multiple Choice | Cards */
.fm-umschalter { margin: 4px 0 10px; }
.fm-huelle { touch-action: pan-y; }
.fm-huelle[hidden], .fm-mc[hidden], .fm-cards[hidden] { display: none; }
.fm-cards { display: flex; flex-direction: column; gap: 10px; }
