/* ============ Design Tokens ============ */
:root {
  --bg: #f4f5fb;
  --bg-2: #eceef8;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --surface-3: #eef0f9;
  --border: #e3e6f2;
  --text: #151833;
  --text-2: #4a5072;
  --text-3: #8389a8;
  --primary: #6d5efc;
  --primary-2: #8b5cf6;
  --primary-soft: #ecebff;
  --on-primary: #ffffff;
  --success: #12b981;
  --success-soft: #dcfaf0;
  --danger: #f0466b;
  --danger-soft: #ffe5ec;
  --warn: #f59e0b;
  --warn-soft: #fff3d6;
  --info: #0ea5e9;
  --shadow: 0 1px 2px rgba(20, 24, 60, .05), 0 8px 24px rgba(20, 24, 60, .06);
  --shadow-lg: 0 20px 50px rgba(30, 30, 90, .16);
  --radius: 18px;
  --radius-sm: 12px;
  --grad: linear-gradient(135deg, #6d5efc 0%, #a855f7 55%, #ec4899 110%);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --tabbar-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d1a; --bg-2: #10132a; --surface: #141832; --surface-2: #191e3c; --surface-3: #20264a;
    --border: #262c55; --text: #eef0ff; --text-2: #b4b9dd; --text-3: #7a80aa;
    --primary: #8b7dff; --primary-2: #a78bfa; --primary-soft: #262457; --on-primary: #fff;
    --success: #2fd6a0; --success-soft: #0f3a30; --danger: #ff6688; --danger-soft: #3d1626;
    --warn: #fbbf24; --warn-soft: #3a2c0b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d1a; --bg-2: #10132a; --surface: #141832; --surface-2: #191e3c; --surface-3: #20264a;
  --border: #262c55; --text: #eef0ff; --text-2: #b4b9dd; --text-3: #7a80aa;
  --primary: #8b7dff; --primary-2: #a78bfa; --primary-soft: #262457; --on-primary: #fff;
  --success: #2fd6a0; --success-soft: #0f3a30; --danger: #ff6688; --danger-soft: #3d1626;
  --warn: #fbbf24; --warn-soft: #3a2c0b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ============ Basis ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
a { color: var(--primary); text-decoration: none; }
svg[aria-hidden] { width: 20px; height: 20px; flex-shrink: 0; vertical-align: -4px; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-3); padding: .1em .35em; border-radius: 6px; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ============ Layout ============ */
.shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 260px; flex-shrink: 0; padding: 22px 16px; position: sticky; top: 0; height: 100dvh;
  border-right: 1px solid var(--border); background: var(--surface); display: none; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; padding: 4px 10px 18px; }
.brand-logo { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: .95rem; box-shadow: 0 6px 16px rgba(109, 94, 252, .4); }
.brand small { display: block; font-size: .72rem; font-weight: 600; color: var(--text-3); }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--text-2);
  font-weight: 600; transition: background .15s, color .15s;
}
.nav-link svg { width: 20px; height: 20px; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.sidebar .spacer { flex: 1; }
.main { flex: 1; min-width: 0; padding: 18px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; width: 100%; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); border-top: 1px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: .7rem; font-weight: 650; border-radius: 14px; }
.tab svg { width: 23px; height: 23px; transition: transform .2s; }
.tab.active { color: var(--primary); }
.tab.active svg { transform: translateY(-1px) scale(1.08); }
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .tabbar { display: none; }
  .main { padding: 28px 36px 48px; }
}
.focus-mode .tabbar, .focus-mode .sidebar { display: none !important; }
.focus-mode .main { padding-bottom: 120px; max-width: 820px; }

/* ============ Kopfbereich ============ */
.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-2); font-size: .92rem; margin-top: 2px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--text-2); flex-shrink: 0; transition: transform .1s, background .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.on { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }

/* ============ Karten ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.pad-lg { padding: 22px; }
.card.flat { box-shadow: none; }
.card.link { cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; display: block; color: inherit; }
.card.link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.card.link:active { transform: scale(.985); }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .grid.c4 { grid-template-columns: repeat(4, 1fr); } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-title h2 { margin: 0; }

/* Hero */
.hero {
  position: relative; overflow: hidden; color: #fff; border: 0; background: var(--grad);
  box-shadow: 0 18px 40px rgba(109, 94, 252, .35);
}
.hero::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -80px; top: -110px; background: rgba(255, 255, 255, .12); }
.hero::before { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; left: -60px; bottom: -100px; background: rgba(255, 255, 255, .08); }
.hero > * { position: relative; z-index: 1; }
.hero .muted { color: rgba(255, 255, 255, .85); }
.hero-grid { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.countdown { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.hero .pill { background: rgba(255, 255, 255, .18); color: #fff; backdrop-filter: blur(6px); }
.pill svg { width: 15px; height: 15px; }

/* Ring */
.ring { position: relative; width: 116px; height: 116px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: rgba(255, 255, 255, .22); }
.ring .bar { transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 1.6rem; line-height: 1; }
.ring .val small { display: block; font-size: .65rem; font-weight: 700; opacity: .85; margin-top: 4px; letter-spacing: .02em; }
.ring.dark .track { stroke: var(--surface-3); }

/* Statistik-Kacheln */
.stat { padding: 14px 16px; }
.stat .k { font-size: .78rem; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 1.55rem; font-weight: 800; margin-top: 2px; }
.stat .v small { font-size: .85rem; color: var(--text-3); font-weight: 650; }

/* Fortschrittsbalken */
.bar-wrap { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--grad); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.bar-wrap.thin { height: 6px; }

/* Bereichszeilen */
.area-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.area-row + .area-row { border-top: 1px solid var(--border); }
.area-dot { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.area-row .meta { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 6px; gap: 8px; }
.area-row .meta b { font-weight: 700; }
.grade-badge { font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.grade-badge.g1, .grade-badge.g2 { background: var(--success-soft); color: var(--success); }
.grade-badge.g3 { background: var(--primary-soft); color: var(--primary); }
.grade-badge.g4 { background: var(--warn-soft); color: var(--warn); }
.grade-badge.g5, .grade-badge.g6 { background: var(--danger-soft); color: var(--danger); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; min-height: 48px;
  border-radius: 14px; border: 1px solid transparent; font-weight: 700; font-size: .98rem; cursor: pointer;
  transition: transform .1s, box-shadow .2s, background .2s, opacity .2s; text-align: center; line-height: 1.2;
}
.btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(109, 94, 252, .35); }
.btn-primary:hover { box-shadow: 0 12px 28px rgba(109, 94, 252, .45); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-white { background: #fff; color: #4c3fe0; box-shadow: 0 8px 20px rgba(0, 0, 0, .15); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: .88rem; border-radius: 11px; }

/* Aktionskacheln */
.action, .card.link.action { display: flex; gap: 14px; align-items: center; }
.action .ico { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; flex-shrink: 0; font-size: 1.4rem; }
.action .ico svg { width: 24px; height: 24px; }
.action h3 { margin: 0 0 2px; font-size: 1rem; }
.action p { margin: 0; font-size: .85rem; color: var(--text-2); }
.action .count { margin-left: auto; font-weight: 800; font-size: 1.1rem; color: var(--text-2); }
.ico.violet { background: var(--primary-soft); color: var(--primary); }
.ico.green { background: var(--success-soft); color: var(--success); }
.ico.red { background: var(--danger-soft); color: var(--danger); }
.ico.amber { background: var(--warn-soft); color: var(--warn); }
.ico.sky { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }

/* Chips / Tabs */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { padding: 9px 15px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 650; font-size: .88rem; white-space: nowrap; cursor: pointer; color: var(--text-2); transition: all .15s; }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.seg { display: flex; background: var(--surface-3); padding: 4px; border-radius: 14px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 10px; font-weight: 700; font-size: .88rem; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Themenkarten */
.topic-card { display: flex; flex-direction: column; gap: 10px; min-height: 150px; }
.topic-card .top { display: flex; gap: 12px; align-items: flex-start; }
.topic-emoji { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.45rem; flex-shrink: 0; background: var(--surface-3); }
.topic-card h3 { margin: 0; font-size: .98rem; }
.topic-card p { margin: 0; font-size: .82rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-card .foot { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--text-3); font-weight: 650; }
.prio { color: var(--warn); letter-spacing: 1px; font-size: .8rem; }
.badge { font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.vio { background: var(--primary-soft); color: var(--primary); }

/* ============ Lerninhalt ============ */
.lesson { font-size: .98rem; }
.lesson h3 { margin: 1.5em 0 .6em; font-size: 1.12rem; display: flex; align-items: center; gap: 8px; }
.lesson h3::before { content: ""; width: 5px; height: 1.05em; border-radius: 3px; background: var(--grad); }
.lesson h3:first-child { margin-top: 0; }
.lesson ul, .lesson ol { padding-left: 1.3em; margin: 0 0 1em; }
.lesson li { margin: .3em 0; }
.table-wrap { overflow-x: auto; margin: 0 0 1.1em; border-radius: 12px; border: 1px solid var(--border); }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 420px; }
table.t th { background: var(--surface-3); text-align: left; font-weight: 700; color: var(--text); }
table.t th, table.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:nth-child(even) td { background: var(--surface-2); }
.box { border-radius: 14px; padding: 13px 15px; margin: 0 0 1.1em; border: 1px solid; font-size: .93rem; }
.box.tip { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.box.merke { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.box.warn { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
pre.code {
  font-family: var(--mono); font-size: .82rem; line-height: 1.55; background: #0f1226; color: #e2e5ff; padding: 14px 16px;
  border-radius: 12px; overflow-x: auto; margin: 0 0 1.1em; white-space: pre; border: 1px solid #252a52;
}
.model pre.code { white-space: pre; }

/* ============ Quiz ============ */
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.quiz-top .bar-wrap { flex: 1; }
.quiz-count { font-weight: 800; font-size: .9rem; color: var(--text-2); min-width: 54px; text-align: right; }
.q-card { padding: 22px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.q-text { font-size: 1.08rem; font-weight: 650; line-height: 1.5; margin-bottom: 18px; overflow-wrap: anywhere; }
.opt-txt, .feedback, .model, .lesson td { overflow-wrap: anywhere; }
.q-intro { font-size: .9rem; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.options { display: grid; gap: 10px; }
.opt {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 13px 14px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface); transition: border-color .15s, background .15s, transform .08s; min-height: 54px;
}
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt-key { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.opt-txt { font-size: .97rem; }
.opt.sel { border-color: var(--primary); background: var(--primary-soft); }
.opt.sel .opt-key { background: var(--primary); color: #fff; }
.opt.right { border-color: var(--success); background: var(--success-soft); }
.opt.right .opt-key { background: var(--success); color: #fff; }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt.wrong .opt-key { background: var(--danger); color: #fff; }
.opt:disabled { cursor: default; }
.hint { font-size: .8rem; color: var(--text-3); margin: 8px 2px 0; }
.field {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 1.02rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
.field.area { resize: vertical; min-height: 130px; line-height: 1.5; }
.num-input { display: flex; align-items: center; gap: 10px; }
.num-input .unit { font-weight: 700; color: var(--text-2); white-space: nowrap; }
.field.ok { border-color: var(--success); background: var(--success-soft); }
.field.bad { border-color: var(--danger); background: var(--danger-soft); }
.feedback { margin-top: 16px; border-radius: 16px; padding: 16px; animation: pop .25s ease; }
.feedback.ok { background: var(--success-soft); }
.feedback.bad { background: var(--danger-soft); }
.feedback.neutral { background: var(--surface-2); border: 1px solid var(--border); }
.feedback .fb-head { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.feedback.ok .fb-head { color: var(--success); }
.feedback.bad .fb-head { color: var(--danger); }
.feedback .fb-head svg { width: 24px; height: 24px; }
.feedback .solution { font-size: .92rem; margin-bottom: 6px; }
.feedback .expl { font-size: .93rem; color: var(--text-2); margin: 0; }
.model { background: var(--surface); border-radius: 12px; padding: 12px 14px; border: 1px solid var(--border); margin-top: 8px; font-size: .93rem; }
.model ul, .model ol { padding-left: 1.2em; margin: .3em 0; }
.model table.t { min-width: 0; }
.self-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.self-grade .btn { padding: 11px 8px; font-size: .86rem; }
.quiz-actions {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 40;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.quiz-actions .inner { max-width: 820px; margin: 0 auto; display: flex; gap: 10px; }
.quiz-actions .btn { flex: 1; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shake { animation: shake .3s ease; }

/* Ergebnis */
.result-hero { text-align: center; padding: 28px 18px; }
.result-hero .big { font-size: 3.2rem; font-weight: 900; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-list .item { padding: 12px 0; border-top: 1px solid var(--border); }
.result-list .item:first-child { border-top: 0; }
details.review summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; gap: 10px; align-items: flex-start; }
details.review summary::-webkit-details-marker { display: none; }
details.review[open] summary { margin-bottom: 8px; }

/* Karteikarten */
.flash-wrap { perspective: 1200px; }
.flash {
  position: relative; min-height: 290px; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, .7, .2, 1); cursor: pointer;
}
.flash.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; padding: 26px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-size: 1.15rem; font-weight: 650;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.flash-face.back { transform: rotateY(180deg); background: var(--grad); color: #fff; border: 0; font-weight: 600; font-size: 1.05rem; }
.flash-face .lbl { position: absolute; top: 16px; left: 18px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }

/* Prüfung */
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1rem; padding: 8px 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); display: inline-flex; gap: 6px; align-items: center; }
.timer svg { width: 17px; height: 17px; }
.timer.warn { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.task-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.exam-item { padding: 16px 0; border-top: 1px solid var(--border); }
.exam-item:first-of-type { border-top: 0; padding-top: 4px; }
.exam-item .pts { font-size: .78rem; font-weight: 800; color: var(--primary); white-space: nowrap; }
.pts-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pts-chip { min-width: 40px; height: 40px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 800; cursor: pointer; }
.pts-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.scenario { font-size: .95rem; }

/* Heatmap */
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.heat span { width: 14px; height: 14px; border-radius: 4px; background: var(--surface-3); }
.heat span.l1 { background: color-mix(in srgb, var(--primary) 30%, var(--surface-3)); }
.heat span.l2 { background: color-mix(in srgb, var(--primary) 55%, var(--surface-3)); }
.heat span.l3 { background: color-mix(in srgb, var(--primary) 80%, var(--surface-3)); }
.heat span.l4 { background: var(--primary); }

/* Formulare */
label.lbl { display: block; font-weight: 700; font-size: .85rem; margin: 0 0 6px; color: var(--text-2); }
.form-row + .form-row { margin-top: 14px; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }

/* Auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 25%, transparent), transparent), radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #ec4899 20%, transparent), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; padding: 30px 24px; }
.auth-logo { width: 64px; height: 64px; border-radius: 20px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 1.3rem; margin: 0 auto 16px; box-shadow: 0 14px 30px rgba(109, 94, 252, .45); }
.error-msg { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 12px; font-size: .9rem; font-weight: 600; }

/* Toast */
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 11px 18px; border-radius: 14px; font-weight: 650; font-size: .9rem; box-shadow: var(--shadow-lg); animation: pop .2s ease; max-width: 90vw; }
@media (min-width: 900px) { .toast-wrap { bottom: 28px; } }

/* Dialog */
.modal-wrap { position: fixed; inset: 0; z-index: 200; background: rgba(8, 10, 25, .55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fadein .15s ease; }
.modal { width: 100%; max-width: 440px; padding: 22px; box-shadow: var(--shadow-lg); animation: pop .2s ease; max-height: 85dvh; overflow: auto; }
.modal h2 { margin-bottom: 8px; }

/* Diverses */
.empty { text-align: center; padding: 34px 18px; color: var(--text-2); }
.empty .em { font-size: 2.6rem; margin-bottom: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.kbd { font-family: var(--mono); font-size: .75rem; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.fade-in { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.offline-banner { background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: .82rem; text-align: center; padding: 6px; border-radius: 10px; margin-bottom: 12px; }
.loader { display: grid; place-items: center; min-height: 60dvh; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
