/* FDL Ausbildung: Oberfläche für Website, Desktop-App und Android-App.
   Übernommen aus ModCord (D:\Supply-Generator-Tool\SupplyGenerator\web\app.css, Thema "Winter").
   Angepasst für Browser und Tablet: Web-Schriften als Ersatz, SVG-Symbole statt "Segoe Fluent Icons",
   fester Hintergrund statt Windows-Acryl, Navigation unten auf schmalen Bildschirmen, Tippflächen 44 px.
   Aufbau: Leiste oben (44 px), Navigation links (84 px), Inhaltsfläche aus Kacheln im Raster mit 14 px Abstand. */
:root {
  color-scheme: dark;
  --accent: #f0892a;
  --accent-rgb: 240, 137, 42;
  --on-accent: #17120c;
  --ice: #5ec8ff;
  --ok: #6ccb5f;
  --bad: #ff8c96;
  --violet: #b49cff;
  --gold: #ffc83d;

  --text: #f4f5f7;
  --dim: #b9bdc4;
  --faint: #7d828b;

  --base: radial-gradient(1200px 700px at 30% 0%, #23242b, #101115 70%);
  --base-flat: #101115;
  --layer: rgba(255, 255, 255, .035);
  --tile-a: rgba(255, 255, 255, .075);
  --tile-b: rgba(255, 255, 255, .03);
  --glass: rgba(255, 255, 255, .055);
  --glass-hi: rgba(255, 255, 255, .085);
  --edge: rgba(255, 255, 255, .09);
  --edge-top: rgba(255, 255, 255, .2);
  --shade: rgba(8, 9, 12, .45);
  --solid-dialog: rgba(36, 37, 43, .97);
  --solid-toast: rgba(40, 41, 47, .97);
  --solid-menu: #1d1e25;

  --r-tile: 16px;
  --r-inner: 11px;
  --rail: 84px;
  --bar: 44px;

  --display: "Bahnschrift", "Barlow", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Roboto Mono", monospace;
  --ease: cubic-bezier(.22, .9, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  display: grid; grid-template-rows: var(--bar) minmax(0, 1fr);
  font: 14px/1.45 var(--body);
  color: var(--text);
  background: var(--base-flat);
  background-image: var(--base);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(var(--accent-rgb), .45); }
:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .9); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sprite { position: absolute; }

/* Symbole: <svg class="ic"><use href="#i-name"/></svg>, Größe über font-size */
.ic { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ Leiste oben */
.titlebar { display: flex; align-items: center; gap: 12px; padding: 0 16px; min-width: 0; }
.titlebar .brand { display: flex; align-items: center; gap: 10px; font-size: 12.5px; min-width: 0; }
.titlebar .brand b { font-family: var(--display); font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.titlebar .brand span { color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar .grow { flex: 1; }
.userbtn { height: 30px; max-width: 55vw; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; transition: background .2s, color .2s; }
.userbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbtn .ic { font-size: 15px; }
.mark { width: 18px; height: 18px; flex: none; border-radius: 5px; background: conic-gradient(from 200deg, var(--accent), #ffd29a, var(--accent)); box-shadow: 0 0 12px rgba(var(--accent-rgb), .6); }

/* ------------------------------------------------------------ Navigation + Inhaltsfläche */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 0; }
.rail { position: relative; display: flex; flex-direction: column; align-items: center; padding: 8px 0 12px; padding-left: env(safe-area-inset-left, 0px); min-height: 0; overflow: hidden auto; }
.rail .grow { flex: 1; }
.nav {
  position: relative; width: 68px; height: 62px; flex: none; margin: 2px 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--dim); display: grid; place-items: center; align-content: center; gap: 4px;
  transition: background .2s, color .2s;
}
.nav .ic { font-size: 21px; transition: transform .35s var(--ease); }
.nav span { font-size: 11px; }
.nav.on { background: rgba(255, 255, 255, .075); color: var(--text); }
.nav.on .ic { color: var(--accent); }
.rail .pill { position: absolute; left: calc(4px + env(safe-area-inset-left, 0px)); top: 0; width: 3px; height: 20px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: transform .45s var(--ease); }

.layer {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--layer);
  border-top: 1px solid var(--edge); border-left: 1px solid var(--edge);
  border-top-left-radius: 14px;
}
.page {
  position: absolute; inset: 0; display: none; overflow: hidden auto;
  padding-block: 30px 34px;
  padding-left: max(40px, env(safe-area-inset-left, 0px)); padding-right: max(40px, env(safe-area-inset-right, 0px));
}
.page.on { display: block; animation: pageIn .5s var(--ease); }
.page > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), .34); background-clip: padding-box; border: 2px solid transparent; border-radius: 5px; }

h1 { font: 600 30px/1.15 var(--display); margin: 0; letter-spacing: .005em; text-wrap: balance; }
h2 { font: 600 21px/1.2 var(--display); margin: 34px 0 6px; }
.sub { color: var(--dim); margin: 6px 0 0; font-size: 13.5px; max-width: 68ch; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 20px; margin-bottom: 22px; }
.head > div { min-width: 0; }

/* ------------------------------------------------------------ Kacheln */
.tile {
  position: relative; min-width: 0; border-radius: var(--r-tile); padding: 20px 22px;
  background: linear-gradient(180deg, var(--tile-a), var(--tile-b));
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 var(--edge-top), 0 12px 30px -18px rgba(0, 0, 0, .6);
  transition: border-color .25s, transform .35s var(--ease), box-shadow .35s;
}
.tile h3 { margin: 0; font: 600 14.5px var(--body); }
.tile .label, .label { color: var(--faint); font-size: 12.5px; }
.grid { display: grid; gap: 14px; }
/* Abstand zwischen Kacheln und Rastern, auch wenn sie in einem Behälter wie #setView stecken.
   Innerhalb eines Rasters sorgt gap für den Abstand, darum nicht dort. */
:is(.page, .page :not(.grid, .run, .kpis)) > :is(.grid, .tile) + :is(.grid, .tile) { margin-top: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid.top { align-items: start; }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid.c3.fill { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.big { font: 600 44px/1 var(--display); font-variant-numeric: tabular-nums; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 600; }
.badge { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 18px; background: rgba(var(--accent-rgb), .16); color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(var(--accent-rgb), .16); color: var(--accent); white-space: nowrap; }
.chip.ok { background: rgba(108, 203, 95, .16); color: var(--ok); }
.chip.bad { background: rgba(255, 140, 150, .16); color: var(--bad); }
.chip.ice { background: rgba(94, 200, 255, .16); color: var(--ice); }
.chip.plain { background: rgba(255, 255, 255, .08); color: var(--dim); }
.bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--accent); color: var(--accent); transition: width 1s var(--ease); box-shadow: 0 0 10px currentColor; }
.stat { display: flex; gap: 14px; align-items: flex-start; }
.stat .v { font: 600 26px/1.1 var(--display); font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .s { color: var(--dim); font-size: 12.5px; }
.mini { padding: 12px 14px; border-radius: var(--r-inner); background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .06); }

/* Listen in Kacheln */
.rows { list-style: none; padding: 0; margin: 10px 0 0; }
.rows li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 4px; border-top: 1px solid rgba(255, 255, 255, .05); }
.rows li:first-child { border-top: 0; }
.rows .ic-box { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: rgba(255, 255, 255, .06); color: var(--dim); }
.rows .t { color: var(--faint); font-size: 12px; }

/* ------------------------------------------------------------ Buttons */
.btn {
  height: 38px; padding: 0 18px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .07); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13.5px; white-space: nowrap;
  transition: background .2s, transform .15s, box-shadow .25s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: rgba(255, 255, 255, .25); font-weight: 600; box-shadow: 0 8px 24px -10px rgba(var(--accent-rgb), .9); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn .ic { font-size: 15px; }
.linkbtn { background: none; border: 0; color: var(--faint); padding: 0; font-size: 12.5px; }

/* ------------------------------------------------------------ Tabs, Schalter, Felder */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; }
.tab { position: relative; padding: 8px 16px; border-radius: 9px; border: 0; background: transparent; color: var(--dim); }
.tab.on { background: rgba(255, 255, 255, .09); color: var(--text); }
.tab.on::after { content: ""; position: absolute; left: 50%; bottom: -1px; width: 18px; height: 3px; margin-left: -9px; border-radius: 2px; background: var(--accent); }

.switch { width: 40px; height: 22px; flex: none; border-radius: 11px; background: rgba(255, 255, 255, .15); position: relative; transition: .25s; border: 0; padding: 0; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #d6d8dc; transition: .25s var(--ease); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); background: var(--on-accent); }

.field { position: relative; display: grid; gap: 6px; }
.field > span { color: var(--faint); font-size: 12.5px; }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-inner); outline: none;
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(0, 0, 0, .25);
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: var(--faint); }
.field input:focus, .field select:focus { border-color: rgba(var(--accent-rgb), .8); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
.search { position: relative; width: min(340px, 100%); }
.search input { width: 100%; height: 40px; border-radius: var(--r-inner); border: 1px solid rgba(255, 255, 255, .1); background: rgba(0, 0, 0, .22); padding: 0 14px 0 40px; outline: none; }
.search input:focus { border-color: rgba(var(--accent-rgb), .7); }
.search .ic { position: absolute; left: 13px; top: 12px; font-size: 16px; color: var(--faint); }

.check { display: flex; align-items: center; gap: 10px; color: var(--dim); cursor: pointer; font-size: 13px; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check b { width: 18px; height: 18px; flex: none; border-radius: 5px; border: 1px solid #8c9099; display: grid; place-items: center; transition: .2s; }
.check input:checked + b { background: var(--accent); border-color: var(--accent); }
.check input:checked + b::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check input:focus-visible + b { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .22); }
.err { color: var(--bad); font-size: 13px; }
.hint { color: var(--faint); font-size: 12.5px; }

/* ------------------------------------------------------------ Formulare und Anmeldung */
.note { color: var(--dim); font-size: 13.5px; margin: 8px 0 0; max-width: 68ch; }
.form { display: grid; gap: 16px; margin-top: 20px; }
.field > label { color: var(--faint); font-size: 12.5px; }
.field .hint, .field .err, .form > .err { margin: 0; }
/* Steht ein Fehler am Feld, weicht der Hinweis: sonst stünde dort zweimal fast dasselbe. */
.field:has(.err:not([hidden])) .hint { display: none; }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(255, 140, 150, .16); }
.btn.wide { width: 100%; }
.pw { position: relative; }
.pw input { padding-right: 50px; }
.pw .eye { position: absolute; right: 0; top: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-inner); background: none; color: var(--faint); display: grid; place-items: center; font-size: 18px; transition: color .2s; }
.pw .eye[aria-pressed="true"] { color: var(--text); }
.stat-text { min-width: 0; flex: 1; }
.stat-text .v { overflow-wrap: anywhere; }

/* Vor der Anmeldung: eine Kachel in der Mitte, die Navigation gibt es erst danach */
.gate { display: flex; min-width: 0; min-height: 0; overflow: hidden auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.gate-box { margin: auto; width: min(400px, 100%); display: grid; justify-items: center; }
.gate-box > .tile { width: 100%; padding: 28px 28px 24px; animation: pageIn .5s var(--ease); }
.gate h1 { font-size: 26px; }
.gate .alt { margin: 18px 0 0; text-align: center; color: var(--dim); font-size: 13px; }
.gate .alt .linkbtn { color: var(--text); font-size: 13px; padding: 8px 4px; text-decoration: underline; text-decoration-color: rgba(var(--accent-rgb), .8); text-underline-offset: 4px; }

/* ------------------------------------------------------------ Dialog, Hinweis, Laden */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .45); display: none; place-items: center; padding: 16px; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.scrim.on { display: grid; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(420px, 100%); border-radius: 16px; background: var(--solid-dialog); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 30px 80px -20px #000; overflow: hidden; animation: dlg .45s cubic-bezier(.2, 1.4, .3, 1); }
@keyframes dlg { from { opacity: 0; transform: scale(.9) translateY(10px); } }
.dialog .body { padding: 24px 26px 6px; }
.dialog h2 { margin: 0 0 12px; font: 600 21px var(--display); }
.dialog p { color: var(--dim); margin: 0 0 12px; }
.dialog .foot { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; padding: 18px 26px; background: rgba(0, 0, 0, .2); margin-top: 18px; }

.toasts { position: fixed; right: max(26px, env(safe-area-inset-right, 0px)); bottom: calc(26px + env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100% - 32px)); }
.toast { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 13px; background: var(--solid-toast); border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 18px 40px -16px #000; animation: toastIn .5s var(--ease); }
.toast .ic { font-size: 17px; color: var(--accent); }
.toast.ok .ic { color: var(--ok); }
.toast.bad .ic { color: var(--bad); }
.toast.out { animation: toastOut .35s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.skel { border-radius: 8px; background: linear-gradient(90deg, rgba(255, 255, 255, .05) 25%, rgba(255, 255, 255, .12) 50%, rgba(255, 255, 255, .05) 75%); background-size: 300% 100%; animation: skel 1.4s infinite; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.loader { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ Bausteine für Lernsets und Formulare in Fenstern */
.field textarea {
  width: 100%; min-height: 76px; padding: 11px 14px; border-radius: var(--r-inner); outline: none; resize: vertical; line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, .12); background: rgba(0, 0, 0, .25);
  transition: border-color .2s, box-shadow .2s;
}
.field textarea::placeholder { color: var(--faint); }
.field textarea:focus { border-color: rgba(var(--accent-rgb), .8); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
.field textarea[aria-invalid="true"] { border-color: var(--bad); }
.field .flabel { color: var(--faint); font-size: 12.5px; }
.field input.short { width: 110px; }
.inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.grow { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tile > .actions { margin-top: 16px; }
.tile-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.btn.small { height: 34px; padding: 0 13px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.iconbtn { width: 38px; height: 38px; flex: none; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--dim); display: grid; place-items: center; font-size: 18px; transition: background .2s, color .2s; }
.iconbtn:disabled { opacity: .35; pointer-events: none; }
.crumb { display: inline-flex; align-items: center; gap: 4px; margin: -6px 0 12px -6px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; color: var(--faint); font-size: 13px; max-width: 100%; }
.crumb .ic { font-size: 16px; }

/* Auswahl einer von mehreren Möglichkeiten */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.segbtn { min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .045); color: var(--dim); font-size: 13.5px; transition: background .2s, border-color .2s, color .2s; }
.segbtn.on { background: rgba(var(--accent-rgb), .16); border-color: rgba(var(--accent-rgb), .7); color: var(--text); }
.segbtn:disabled { opacity: .4; pointer-events: none; }
.form > .seg .segbtn { flex: 1 1 0; }

/* Kennzahlen nebeneinander */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpis .v { font: 600 28px/1.1 var(--display); margin-top: 4px; }
.kpis .v.accent { color: var(--accent); }
.kpis.inner + .bar { margin-top: 16px; }
.tile .kpis + .hint, .tile .bar + .hint { margin: 12px 0 0; }

/* Lernsets als Kacheln */
.settile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; color: inherit; font: inherit; min-height: 132px; }
.settile h3 { font: 600 17px/1.25 var(--display); overflow-wrap: anywhere; }
.settile .t { color: var(--faint); font-size: 12.5px; }
.settile .bar { width: 100%; margin-top: auto; }
.chip.topic { margin-bottom: 8px; }

/* Ordner auf der Lernen-Seite */
h2.sect { margin: 28px 0 12px; font: 600 13px var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
:is(#setList, #folderView) > h2.sect:first-child { margin-top: 4px; }
.foldertile .fic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 20px; background: rgba(var(--accent-rgb), .16); color: var(--accent); }
.foldertile .fic + h3 { margin-top: 2px; }
.tile.addtile { flex-direction: row; align-items: center; justify-content: center; gap: 10px; border-style: dashed; border-color: rgba(255, 255, 255, .16); background: transparent; box-shadow: none; color: var(--dim); font-size: 13.5px; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.tile.addtile .ic { font-size: 18px; color: var(--accent); }
#folderView > .grid + .note { margin-top: 14px; }
.tile.addtile:hover, .tile.addtile:focus-visible { border-color: rgba(var(--accent-rgb), .6); color: var(--text); background: rgba(var(--accent-rgb), .05); }

/* Gemischt üben: Auswahl der Lernsets */
.mix { display: flex; flex-direction: column; gap: 16px; }
.pickpanel > .hint { margin: 6px 0 14px; }
.pickbar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px 12px 18px; border-radius: var(--r-tile); border: 1px solid rgba(var(--accent-rgb), .35); background: rgba(24, 25, 29, .97); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .8); }
.pickbar + .tile { margin-top: 14px; }
/* Suche und Filter über der Auswahl */
.mixtools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.mixsearch { flex: 1 1 260px; width: auto; }
.mixsearch input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); cursor: pointer; }
.mixfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 auto; }
.mixfilters .seg { flex-wrap: nowrap; }
.mixfilters .segbtn { min-height: 36px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
.mixfold { padding: 8px 2px; white-space: nowrap; }
/* Schnellwahl: zuletzt geübt und Vorschläge */
.mixquick { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px 16px; padding: 12px; border-radius: var(--r-inner); background: rgba(var(--accent-rgb), .04); border: 1px solid rgba(var(--accent-rgb), .14); }
.mixquick-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mixsub { margin: 0 2px 2px; font: 600 11.5px var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
/* Ordner: zugeklappt nur eine Zeile mit Zahlen, aufgeklappt die Decks darunter */
.mixgroups { display: flex; flex-direction: column; gap: 8px; }
.mixgroup { border-radius: var(--r-inner); background: rgba(255, 255, 255, .025); border: 1px solid rgba(255, 255, 255, .07); transition: border-color .2s, background .2s; }
.mixgroup.open { background: rgba(255, 255, 255, .035); border-color: rgba(255, 255, 255, .12); }
.mixhead { display: flex; align-items: stretch; color: var(--text); }
.mixall { padding: 0 4px 0 14px; flex: none; }
.mixtoggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 11px 12px 11px 8px; border: 0; background: none; color: inherit; font: inherit; text-align: left; border-radius: 0 var(--r-inner) var(--r-inner) 0; cursor: pointer; }
.mixtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mixlabel { display: flex; align-items: flex-start; gap: 8px; min-width: 0; font-size: 14px; }
.mixlabel b { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.mixlabel .ic { flex: none; margin-top: 2px; color: var(--accent); font-size: 16px; }
.mixofficial { font-size: 11px; padding: 2px 8px; }
.mixtitle .t { color: var(--faint); font-size: 12px; padding-left: 24px; }
.mixtoggle > .chip { flex: none; }
.mixbar { flex: none; width: 64px; }
.mixchev { flex: none; display: grid; place-items: center; width: 28px; height: 28px; color: var(--faint); }
.mixchev .ic { font-size: 18px; transition: transform .25s var(--ease); }
.mixgroup.open .mixchev .ic { transform: rotate(180deg); }
.mixbody { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 10px; }
.mixrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .05); transition: background .2s, border-color .2s; }
.mixrow.on { background: rgba(var(--accent-rgb), .07); border-color: rgba(var(--accent-rgb), .35); }
.mixrow > .check { flex: 1 1 200px; min-width: 0; }
.mixname { display: flex; flex-direction: column; min-width: 0; color: var(--text); font-size: 13.5px; overflow-wrap: anywhere; }
.mixname .t { color: var(--faint); font-size: 12px; }
.mixcount { flex: none; margin: 0; }
.mixcount .segbtn { min-height: 32px; padding: 0 11px; }
.mixempty { margin: 4px 2px; }
@media (hover: hover) {
  .mixtoggle:hover .mixchev { color: var(--text); }
  .mixgroup:not(.open):hover { background: rgba(255, 255, 255, .045); }
}
@media (pointer: coarse) {
  .mixfilters .segbtn { min-height: 40px; }
  .mixcount .segbtn { min-height: 40px; }
  .mixtoggle { padding-top: 13px; padding-bottom: 13px; }
}
@media (max-width: 640px) {
  .mixofficial, .mixbar { display: none; }
  .mixquick { padding: 10px; }
  .mixquick-list > .mixrow:nth-of-type(n+3):not(.on) { display: none; }
  .mixtoggle { gap: 8px; padding-right: 8px; }
  .mixtoggle > .chip { padding: 3px 8px; }
  .mixbody { padding: 0 6px 8px; }
  .mixfilters .seg { flex: 1 1 auto; }
  .mixfilters .seg .segbtn { flex: 1 1 0; padding: 0 8px; }
}
.mixsum { color: var(--dim); font-size: 13px; }

/* Zeilen, die man antippen kann */
.rows .rowbtn { grid-column: 1 / -1; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 6px 4px; margin: -6px -4px; border: 0; border-radius: 10px; background: none; color: inherit; text-align: left; font: inherit; box-sizing: content-box; }
.rows li:has(> .rowbtn) { display: block; padding: 9px 4px; }
.rowtext { display: grid; gap: 2px; min-width: 0; }
.rowtext b { font-weight: 500; overflow-wrap: anywhere; }
.rowtext .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rows .t { overflow: hidden; text-overflow: ellipsis; }
.rows .ic-box.num { font-size: 12.5px; color: var(--faint); }
.chev { color: var(--faint); transform: rotate(180deg); display: grid; }
.boxes { display: inline-flex; gap: 3px; padding: 0 4px; }
.boxes i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.boxes i.on { background: var(--accent); }

/* Fenster für Formulare (Aufgabe anlegen, Üben einstellen) */
.sheet { width: min(560px, 100%); max-height: min(860px, calc(100dvh - 32px)); display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 14px 4px 24px; }
.sheet-head h2 { flex: 1; min-width: 0; margin: 0; font: 600 20px/1.2 var(--display); overflow-wrap: anywhere; outline: none; }
.sheet .body { padding: 4px 24px 22px; overflow: auto; overscroll-behavior: contain; }
.sheet .body > .form { margin-top: 12px; }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px)); background: rgba(0, 0, 0, .2); }
.options { display: grid; gap: 8px; }
.optrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.optrow .check { padding: 10px 4px; }
.optrow input[name=option] { width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-inner); outline: none; border: 1px solid rgba(255, 255, 255, .12); background: rgba(0, 0, 0, .25); }
.optrow input[name=option]:focus { border-color: rgba(var(--accent-rgb), .8); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
.pane { display: grid; gap: 16px; }

/* ------------------------------------------------------------ Üben */
body.running .rail { display: none; }
body.running .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
body.running .layer { border-left: 0; border-top-left-radius: 0; }
body.running .userbtn { visibility: hidden; }
.run { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.run-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.run-progress { flex: 1; min-width: 0; display: grid; gap: 7px; }
.run-title { display: flex; gap: 12px; justify-content: space-between; font-size: 13px; color: var(--dim); min-width: 0; }
.run-title b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-title .num { font-weight: 600; color: var(--text); }
.flash { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; white-space: nowrap; }
.flash.on { opacity: 1; transform: none; }
.flash.ok { background: rgba(108, 203, 95, .16); color: var(--ok); }
.flash.bad { background: rgba(255, 140, 150, .16); color: var(--bad); }
.flash.plain { background: rgba(255, 255, 255, .08); color: var(--dim); }
.run-timer { display: grid; grid-template-columns: auto minmax(0, 1fr) 46px; gap: 10px; align-items: center; color: var(--dim); }
.run-timer .bar { height: 6px; }
.run-timer .bar > i { transition: none; background: var(--ice); color: var(--ice); }
.run-timer.low .bar > i { background: var(--bad); color: var(--bad); }
.run-timer.low { color: var(--bad); }
.timetext { text-align: right; font-size: 14px; }

.qcard { display: grid; gap: 16px; padding: 26px 26px 24px; }
.qcard.is-right { border-color: rgba(108, 203, 95, .55); }
.qcard.is-wrong { border-color: rgba(255, 140, 150, .55); }
.qcard .prompt { font: 600 24px/1.3 var(--display); }
.qcard .back { font-size: 17px; line-height: 1.5; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .1); animation: pageIn .35s var(--ease); }
.answers { display: grid; gap: 10px; }
.rate { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.big-btn { height: 52px; font-size: 15px; }
.btn.yes { background: rgba(108, 203, 95, .16); border-color: rgba(108, 203, 95, .5); color: var(--ok); font-weight: 600; }
.btn.no { background: rgba(255, 140, 150, .12); border-color: rgba(255, 140, 150, .4); color: var(--bad); font-weight: 600; }
.opts { display: grid; gap: 10px; }
.opt {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 54px; padding: 10px 14px; text-align: left;
  border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05); font-size: 15px; color: var(--text);
  transition: background .2s, border-color .2s, opacity .2s;
}
.opt .key { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font: 600 13px var(--display); background: rgba(255, 255, 255, .08); color: var(--dim); }
.opt .otext { overflow-wrap: anywhere; }
.opt.sel { border-color: rgba(var(--accent-rgb), .8); background: rgba(var(--accent-rgb), .12); }
.opt.sel .key { background: var(--accent); color: var(--on-accent); }
.opt.right { border-color: rgba(108, 203, 95, .7); background: rgba(108, 203, 95, .14); }
.opt.right .key { background: var(--ok); color: #0d1a0b; }
.opt.wrong { border-color: rgba(255, 140, 150, .7); background: rgba(255, 140, 150, .12); }
.opt.wrong .key { background: var(--bad); color: #22090c; }
.opt.dim { opacity: .5; }
.opt:disabled { cursor: default; }
.textanswer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.answer-input { width: 100%; height: 52px; padding: 0 16px; border-radius: 12px; outline: none; border: 1px solid rgba(255, 255, 255, .14); background: rgba(0, 0, 0, .28); font-size: 17px; }
.answer-input:focus { border-color: rgba(var(--accent-rgb), .8); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
.feedback { display: grid; gap: 12px; animation: pageIn .35s var(--ease); }
.feedback p { margin: 0; color: var(--dim); }
.feedback p b { color: var(--text); }
.fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.fb-head .chip { font-size: 13px; padding: 5px 12px; }
.fb-head .t { color: var(--dim); font-size: 13px; }
.explain { padding: 12px 14px; border-radius: var(--r-inner); background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .06); }
.btn.next { position: relative; overflow: hidden; }
.btn.next > span { position: relative; }
.btn.next .fill { position: absolute; inset: 0 100% 0 0; background: rgba(255, 255, 255, .25); }
.btn.next.auto .fill { animation: fillUp 3s linear forwards; }
@keyframes fillUp { to { right: 0; } }

/* ------------------------------------------------------------ Karteikarte beim Üben: Stapel, Umdrehen, Wischen */
.qcard.deckmode { display: grid; gap: 14px; padding: 0; }
.deck { position: relative; display: grid; perspective: 1600px; padding-bottom: 20px; }
.deck > * { grid-area: 1 / 1; }
.fc-ghost {
  border-radius: 22px; border: 1px solid rgba(255, 255, 255, .09);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)), #1a1b21;
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, .9);
  transform-origin: 50% 100%; transition: transform .5s var(--ease), opacity .5s;
}
/* Die Karten darunter schauen nur unten gerade hervor, schmaler als die Karte, damit keine Ecke seitlich doppelt wirkt. */
.fc-ghost.g1 { transform: translateY(9px) scaleX(.95); opacity: .85; border-color: rgba(255, 255, 255, .12); }
.fc-ghost.g2 { transform: translateY(18px) scaleX(.9); opacity: .5; }
.deck[data-left="1"] .g2, .deck[data-left="0"] .fc-ghost { opacity: 0; }
.fc-drag { position: relative; z-index: 1; display: grid; transform-style: preserve-3d; touch-action: pan-y; will-change: transform; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.fc-drag.dragging { cursor: grabbing; }
.fc {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 0%;
  position: relative; display: grid; outline: none; cursor: pointer; border-radius: 22px;
  transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .6s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.fc.deal { animation: fcDeal .55s var(--ease) both; }
@keyframes fcDeal { from { opacity: 0; transform: translateY(16px) scale(.95); } }
.fc-inner { display: grid; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.3, .5, 1); border-radius: inherit; }
.fc.flipped .fc-inner { transform: rotateY(180deg); }
/* Eine Seite: Kopfzeile, Inhalt in der Mitte, Fußzeile. Format wie eine Karteikarte, wächst bei langem Text mit. */
.fc-face {
  --tint: var(--accent-rgb);
  grid-area: 1 / 1; position: relative; overflow: hidden; border-radius: 22px;
  display: grid; grid-template-rows: auto 1fr auto; aspect-ratio: 16 / 10; min-height: 260px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border: 1px solid rgba(255, 255, 255, .11);
  background: linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .025)), #1a1b21;
  box-shadow: inset 0 1px 0 var(--edge-top), 0 30px 60px -30px rgba(0, 0, 0, .85), 0 10px 22px -14px rgba(0, 0, 0, .6);
}
.fc-back { --tint: 94, 200, 255; transform: rotateY(180deg); }
.fc-head {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 13px 22px;
  background: rgba(var(--tint), .1); border-bottom: 1px solid rgba(var(--tint), .22);
}
.fc-tag { display: inline-flex; align-items: center; gap: 8px; flex: none; font: 600 12.5px var(--body); letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--tint)); }
.fc-tag .ic { font-size: 15px; }
.fc-q { min-width: 0; margin-left: auto; color: var(--faint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-body { display: grid; place-items: center; padding: 22px 30px; min-height: 0; background: radial-gradient(55% 65% at 50% 50%, rgba(var(--tint), .07), transparent 72%); }
.fc-text { text-align: center; font: 600 clamp(28px, 4vw, 44px)/1.2 var(--display); overflow-wrap: anywhere; max-width: 30ch; }
.fc-text.answer { font: 600 clamp(22px, 3vw, 34px)/1.3 var(--display); color: #eaf6ff; }
.fc-foot { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 22px 16px; color: var(--faint); font-size: 12.5px; }
.fc-foot .ic { font-size: 14px; }
.fc.flipped .fc-front .fc-foot { visibility: hidden; }
.fc-explain { display: grid; gap: 4px; margin: 0 18px 18px; padding: 12px 14px; border-radius: var(--r-inner); background: rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .06); }
.fc-explain p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.5; }
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
  font: 600 11.5px var(--body); color: var(--dim); background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14); border-bottom-width: 2px;
}
.btn kbd { margin-left: 4px; color: inherit; background: rgba(0, 0, 0, .18); border-color: rgba(255, 255, 255, .12); }
/* Lichtfleck, der dem Mauszeiger folgt */
.fc-face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--gx) var(--gy), rgba(255, 255, 255, .08), transparent 65%);
}
.fc:focus-visible .fc-face { border-color: rgba(var(--accent-rgb), .7); }
/* Stempel beim Wischen und Einschätzen */
.fc-stamp {
  position: absolute; z-index: 5; top: 22px; left: 50%; padding: 6px 16px; border-radius: 10px; pointer-events: none;
  font: 700 17px var(--display); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
  border: 2px solid currentColor; background: rgba(12, 14, 18, .72); opacity: 0;
  transform: translate(-50%, 0) translateZ(40px) rotate(-6deg) scale(.9); transition: opacity .15s, transform .25s var(--ease);
}
.fc-stamp.ok { color: var(--ok); }
.fc-stamp.bad { color: var(--bad); transform: translate(-50%, 0) translateZ(40px) rotate(6deg) scale(.9); }
.fc-stamp.late { color: var(--ice); }
.fc-stamp.on { opacity: 1; transform: translate(-50%, 0) translateZ(40px) rotate(-6deg) scale(1); }
.fc-stamp.on.bad { transform: translate(-50%, 0) translateZ(40px) rotate(6deg) scale(1); }
.fc-stamp.drag { transition: none; transform: translate(-50%, 0) translateZ(40px) rotate(-6deg) scale(1); }
.fc-stamp.drag.bad { transform: translate(-50%, 0) translateZ(40px) rotate(6deg) scale(1); }
.swipe-hint { margin: -4px 0 0; text-align: center; color: var(--faint); font-size: 12.5px; }
.rate.rise { animation: pageIn .35s var(--ease); }

/* Rückmeldung für alle Aufgaben */
.qcard.deal { animation: fcDeal .45s var(--ease) both; }
.qcard.shake { animation: qShake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes qShake { 15%, 85% { translate: -2px 0; } 30%, 70% { translate: 5px 0; } 45% { translate: -7px 0; } 58% { translate: 6px 0; } }
.qcard.glow { animation: qGlow 1s var(--ease); }
@keyframes qGlow { 0% { box-shadow: 0 0 0 0 rgba(108, 203, 95, .55), inset 0 1px 0 var(--edge-top); } 100% { box-shadow: 0 0 0 16px rgba(108, 203, 95, 0), inset 0 1px 0 var(--edge-top); } }
.chip.bump { animation: chipBump .5s cubic-bezier(.34, 1.6, .64, 1); }
@keyframes chipBump { 40% { transform: scale(1.25); background: rgba(var(--accent-rgb), .35); } }
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
.fx-float {
  position: fixed; z-index: 61; pointer-events: none; transform: translate(-50%, 0);
  font: 700 26px var(--display); font-variant-numeric: tabular-nums; color: var(--accent);
  text-shadow: 0 0 18px rgba(var(--accent-rgb), .7), 0 2px 6px rgba(0, 0, 0, .6);
  animation: fxFloat 1.2s var(--ease) forwards;
}
@keyframes fxFloat { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 18% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -70px) scale(1); } }

@media (hover: hover) {
  .fc:hover .fc-face::after { opacity: 1; }
  .fc:hover .fc-face { border-color: rgba(255, 255, 255, .18); }
}
@media (max-width: 640px) {
  .fc-face { aspect-ratio: auto; min-height: clamp(260px, 50dvh, 420px); }
  .fc-head { padding: 12px 18px; }
  .fc-body { padding: 18px 20px; }
  .fc-text { font-size: 30px; }
  .fc-text.answer { font-size: 24px; }
  .fc-explain { margin: 0 14px 14px; }
}
/* Bewegung reduzieren: Karte wechselt die Seite ohne Drehung */
/* ------------------------------------------------------------ Seitenleiste mit allen Bereichen (nur Handy, fdl.js)
   Unten in der Leiste stehen sieben Bereiche, hier alle. Fährt von links herein, schließt beim Wischen nach links. */
.menubtn { width: 40px; padding: 0; justify-content: center; margin-left: -10px; }
.menubtn .ic { font-size: 20px; }
.drawer-scrim { position: fixed; inset: 0; z-index: 74; background: rgba(0, 0, 0, .5); opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.drawer-scrim.open { opacity: 1; visibility: visible; transition: opacity .3s; }
.drawer {
  position: fixed; z-index: 75; top: 0; bottom: 0; left: 0; width: min(300px, 84vw);
  display: flex; flex-direction: column; min-height: 0;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: var(--solid-menu); border-right: 1px solid var(--edge); border-radius: 0 18px 18px 0;
  box-shadow: 24px 0 60px -20px rgba(0, 0, 0, .8);
  transform: translateX(-105%); visibility: hidden;
  transition: transform .34s var(--ease), visibility 0s .34s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .34s var(--ease); }
.drawer.drag { transition: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; height: 56px; flex: none; padding: 0 8px 0 18px; border-bottom: 1px solid var(--edge); }
.drawer-head b { font-family: var(--display); font-weight: 600; letter-spacing: .02em; font-size: 15px; }
.drawer-head .grow { flex: 1; }
.drawer-close { width: 44px; height: 44px; padding: 0; justify-content: center; }
.drawer-close .ic { font-size: 18px; }
.drawer-list { flex: 1; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; padding: 6px 10px 16px; }
.drawer-sect { margin: 14px 10px 6px; color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.dnav {
  position: relative; width: 100%; height: 48px; margin: 1px 0; padding: 0 14px; border: 0; border-radius: 12px;
  background: transparent; color: var(--dim); display: flex; align-items: center; gap: 14px; font-size: 15px; text-align: left;
  transition: background .2s, color .2s;
}
.dnav .ic { font-size: 20px; }
.dnav span { flex: 1; min-width: 0; }
.dnav.on { background: rgba(255, 255, 255, .075); color: var(--text); }
.dnav.on .ic { color: var(--accent); }
.dnav.on::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dnav:active { background: rgba(255, 255, 255, .1); }
.dnav .nav-badge { position: static; box-shadow: none; }
@media (hover: hover) {
  .dnav:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
}
/* Sehr schmale Handys (ab 320 px): oben nur das Zeichen statt des Namens, unten passen alle sieben Bereiche. */
@media (max-width: 400px) {
  .titlebar { gap: 6px; }
  .titlebar .brand b { display: none; }
  .rail { padding-inline: 2px; }
  .rail .nav { min-width: 0; }
  .rail .nav span { font-size: 10px; letter-spacing: -.01em; }
}
/* Tablet quer: alle elf Bereiche links passen ohne Scrollen. */
@media (min-width: 641px) and (max-height: 820px) {
  .nav { height: 54px; margin: 1px 0; gap: 3px; }
}
/* Ab Tablet-Breite steht links die volle Navigation: kein Menü, keine Seitenleiste. */
@media (min-width: 641px) {
  .menubtn, .drawer, .drawer-scrim { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .fc, .fc.flipped .fc-inner, .fc-back { transform: none; }
  .fc-back { visibility: hidden; }
  .fc.flipped .fc-back { visibility: visible; }
  .fc.flipped .fc-front { visibility: hidden; }
}

/* Ergebnis */
.results li.res .ic-box { color: var(--ok); background: rgba(108, 203, 95, .12); }
.results li.res.bad .ic-box { color: var(--bad); background: rgba(255, 140, 150, .12); }
.results li { align-items: start; }
.results .rowtext { gap: 4px; }
.results .t { white-space: normal; overflow: visible; color: var(--dim); font-size: 13px; }
.results .t.sol { color: var(--ok); }

@media (hover: hover) {
  .iconbtn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
  .crumb:hover { color: var(--text); }
  .segbtn:hover { background: rgba(255, 255, 255, .08); }
  .segbtn.on:hover { background: rgba(var(--accent-rgb), .2); }
  .rows .rowbtn:hover { background: rgba(255, 255, 255, .045); }
  .opt:not(:disabled):hover { background: rgba(255, 255, 255, .09); }
  .btn.yes:hover { background: rgba(108, 203, 95, .24); }
  .btn.no:hover { background: rgba(255, 140, 150, .2); }
}

@media (pointer: coarse) {
  .segbtn { min-height: 44px; }
  .btn.small { height: 40px; }
  .iconbtn { width: 44px; height: 44px; }
  .field textarea, .optrow input[name=option], .answer-input { font-size: 16px; }
  .crumb { padding: 10px 8px; }
}

@media (max-width: 640px) {
  .kpis { gap: 10px; }
  .kpis .v { font-size: 22px; }
  .kpis .label { font-size: 11.5px; }
  .head .actions { width: 100%; }
  .head .actions .btn { flex: 1; }
  /* Fenster kommen von unten und nutzen die ganze Breite */
  .sheet-scrim { padding: 0; place-items: end stretch; }
  .sheet { width: 100%; max-height: calc(100dvh - 24px); border-radius: 18px 18px 0 0; border-bottom: 0; }
  .sheet-head { padding: 14px 10px 2px 20px; }
  .sheet .body { padding: 4px 20px 20px; }
  .sheet-foot { padding-left: 20px; padding-right: 20px; }
  .sheet-foot .btn.primary { flex: 1 1 auto; }
  .qcard { padding: 20px 18px; }
  .qcard .prompt { font-size: 21px; }
  .page.run-page { padding-top: 14px; }
  .textanswer { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------ nur mit Maus: Reaktionen auf den Zeiger */
@media (hover: hover) {
  .nav:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
  .nav:hover .ic { transform: translateY(-2px); }
  .tile:hover { border-color: rgba(255, 255, 255, .16); }
  .tile.lift:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 var(--edge-top), 0 20px 40px -20px rgba(0, 0, 0, .7); }
  .btn:hover { background: rgba(255, 255, 255, .12); }
  .btn.primary:hover { background: var(--accent); filter: brightness(1.08); box-shadow: 0 10px 30px -8px rgba(var(--accent-rgb), 1); }
  .btn.ghost:hover { background: rgba(255, 255, 255, .07); }
  .tab:hover { background: rgba(255, 255, 255, .05); }
  .linkbtn:hover { color: var(--text); }
  .userbtn:hover { background: rgba(255, 255, 255, .07); color: var(--text); }
  .pw .eye:hover { color: var(--text); }
  .gate .alt .linkbtn:hover { text-decoration-color: var(--accent); }
  ::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--accent-rgb), .6); }
}

/* ------------------------------------------------------------ Finger statt Maus: größere Tippflächen */
@media (pointer: coarse) {
  .btn { height: 44px; }
  .tab { padding: 11px 16px; }
  .search input { height: 44px; }
  .search .ic { top: 14px; }
  .switch { width: 48px; height: 28px; border-radius: 14px; }
  .switch::after { width: 22px; height: 22px; }
  .switch.on::after { transform: translateX(20px); }
  .check b { width: 22px; height: 22px; border-radius: 6px; }
  .field input, .field select, .search input { font-size: 16px; }
  .userbtn { height: 36px; }
  .gate .alt .linkbtn { padding: 13px 6px; }
}

/* ------------------------------------------------------------ Rangliste */
.rows.ranks li { padding: 9px 8px; border-radius: 10px; }
.rows.ranks li.me { background: rgba(var(--accent-rgb), .1); border-top-color: transparent; }
.rows.ranks li.me + li { border-top-color: transparent; }
.rows .place { font-size: 14px; color: var(--dim); }
.rows .place.p1 { background: rgba(255, 200, 61, .16); color: var(--gold); }
.rows .place.p2 { background: rgba(214, 220, 230, .14); color: #dfe3ea; }
.rows .place.p3 { background: rgba(214, 140, 80, .16); color: #e2a06a; }
.rank-pts { color: var(--text); white-space: nowrap; }
.rank-me { margin-top: 4px; }
.rank-me b { color: var(--accent); font-size: 15px; }
.rank-gap { text-align: center; color: var(--faint); line-height: 1; padding: 2px 0; }
#rankView + .note { margin-top: 16px; }

/* ------------------------------------------------------------ schmal (Handy, Tablet geteilt): Navigation nach unten */
@media (max-width: 640px) {
  body { grid-template-rows: var(--bar) minmax(0, 1fr); }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; align-items: stretch; padding: 6px 8px; overflow: visible; }
  .rail .grow, .rail .pill { display: none; }
  .nav { width: auto; flex: 1 1 0; max-width: 96px; height: 54px; margin: 0; }
  /* Unten ist nur Platz für sieben Bereiche. Alle anderen stehen in der Seitenleiste (Menü oben links),
     das Profil zusätzlich hinter dem Namen oben rechts. */
  .rail .nav:is([data-page="noten"], [data-page="entdecken"], [data-page="rangliste"], [data-page="profil"]) { display: none; }
  .layer { border-left: 0; border-radius: 14px 14px 0 0; }
  .page { padding-block: 22px 26px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  h1 { font-size: 26px; }
  .big { font-size: 38px; }
  .tile { padding: 18px; }
  .toasts { right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .dialog .body { padding: 22px 20px 4px; }
  .dialog .foot { padding: 16px 20px; }
  .gate-box > .tile { padding: 22px 20px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- Themenordner und Bilder zu Aufgaben */
.sect-head { display: grid; gap: 4px; margin: 28px 0 12px; }
.sect-head h2.sect { margin: 0; }
#deckList > .sect-head:first-child { margin-top: 4px; }
.topictile .fic { background: rgba(94, 200, 255, .16); color: #5ec8ff; }
.topictile .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Bild in einer Aufgabe: weißer Grund, weil Signalbilder und Pläne oft transparent oder hell sind. */
.qimg { margin: 0; display: grid; place-items: center; }
.qimg img { display: block; max-width: 100%; max-height: min(42vh, 360px); height: auto; border-radius: 10px; background: #fff; -webkit-user-drag: none; user-select: none; }
.qimg.small img { max-height: min(22vh, 160px); }
.fc.has-img .fc-face { aspect-ratio: auto; }
.fc-body.has-img { gap: 14px; align-content: center; }
.fc-body.has-img .fc-text { font-size: clamp(20px, 2.6vw, 28px); }
.fc-body.has-img .fc-text.answer { font-size: clamp(18px, 2.2vw, 24px); }
.rows .rowimg { width: 40px; height: 40px; flex: none; object-fit: contain; border-radius: 8px; background: #fff; }
@media (max-width: 640px) {
  .qimg img { max-height: 32vh; }
  .fc-body.has-img .fc-text { font-size: 20px; }
}
