/* =========================================================================
   ArchiLern – Design-System
   Mobile first · Light/Dark · Tokens auf :root
   ========================================================================= */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --surface-3: #e7eaf3;
  --text: #151826;
  --muted: #5c6378;
  --faint: #8a91a5;
  --border: #e2e5ee;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-ink: #ffffff;
  --primary-soft: #eceefe;
  --success: #15803d;
  --success-strong: #22c55e;
  --success-soft: #e7f7ec;
  --danger: #c62828;
  --danger-strong: #ef4444;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff4e2;
  --info-soft: #e9f2ff;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 8px 24px rgba(17, 24, 39, 0.07);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sidebar: 248px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0c0e14;
    --surface: #151823;
    --surface-2: #1b1f2c;
    --surface-3: #252a3a;
    --text: #e9ebf3;
    --muted: #a1a8bb;
    --faint: #737b91;
    --border: #2a3042;
    --primary: #8b8df8;
    --primary-hover: #a3a5fa;
    --primary-ink: #0c0e14;
    --primary-soft: #23264a;
    --success: #4ade80;
    --success-strong: #22c55e;
    --success-soft: #12301f;
    --danger: #f87171;
    --danger-strong: #ef4444;
    --danger-soft: #3a1717;
    --warn: #fbbf24;
    --warn-soft: #33270f;
    --info-soft: #172337;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0c0e14;
  --surface: #151823;
  --surface-2: #1b1f2c;
  --surface-3: #252a3a;
  --text: #e9ebf3;
  --muted: #a1a8bb;
  --faint: #737b91;
  --border: #2a3042;
  --primary: #8b8df8;
  --primary-hover: #a3a5fa;
  --primary-ink: #0c0e14;
  --primary-soft: #23264a;
  --success: #4ade80;
  --success-strong: #22c55e;
  --success-soft: #12301f;
  --danger: #f87171;
  --danger-strong: #ef4444;
  --danger-soft: #3a1717;
  --warn: #fbbf24;
  --warn-soft: #33270f;
  --info-soft: #172337;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 750; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 0.8em; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
h1 > svg, h2 > svg, h3 > svg { color: var(--primary); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  display: none;
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #22c55e));
  color: #fff;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 0.75rem; }
.main { padding: 20px 16px 104px; max-width: 980px; margin: 0 auto; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav-link {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600;
}
.nav-link svg { width: 22px; height: 22px; }
.nav-link.active { color: var(--primary); background: var(--primary-soft); }

@media (min-width: 900px) {
  .app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh;
    padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--border);
  }
  .sidebar .brand { padding: 4px 8px 18px; }
  .sidebar .nav-link { flex-direction: row; gap: 12px; font-size: 0.95rem; padding: 10px 12px; }
  .sidebar .nav-spacer { flex: 1; }
  .topbar .brand, .bottom-nav { display: none; }
  .topbar { justify-content: flex-end; }
  .main { padding: 28px 32px 48px; }
}

/* ---------- Karten ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card.pad-lg { padding: 24px; }
.card.interactive { cursor: pointer; transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s; text-decoration: none; color: inherit; display: block; }
.card.interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title h2, .card-title h3 { margin: 0; }
.hero {
  background: linear-gradient(135deg, #4f46e5, #2563eb 55%, #0891b2);
  color: #fff; border: none;
}
.hero .muted { color: rgba(255, 255, 255, 0.82); }
.hero .btn-primary { background: #fff; color: #1e1b4b; }
.hero .btn-primary:hover { background: #eef; }
.hero .progress { background: rgba(255, 255, 255, 0.25); }
.hero .progress > span { background: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-weight: 650; cursor: pointer; text-decoration: none;
  transition: background 0.15s, transform 0.08s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: transparent; color: var(--primary-ink); box-shadow: 0 3px 0 color-mix(in srgb, var(--primary) 60%, #000); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success-strong); border-color: transparent; color: #04210f; box-shadow: 0 3px 0 #15803d; }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 1.05rem; border-radius: 14px; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 0.875rem; border-radius: 10px; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 12px; }

/* ---------- Formulare ---------- */
.input, .select, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
label.field span.hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 0.875rem; font-weight: 600; cursor: pointer; user-select: none;
}
.chip[aria-pressed='true'] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-2); gap: 4px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 0.875rem; cursor: pointer; color: var(--muted); }
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Badges & Fortschritt ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.progress { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.5s var(--ease); }
.progress.success > span { background: var(--success-strong); }
.progress.thin { height: 6px; }
.meter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.meter-row .progress { grid-column: 1 / -1; }

/* ---------- Statistik-Kacheln ---------- */
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

/* ---------- Listen & Tabellen ---------- */
.list { display: grid; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
a.list-item:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 650; }
.num-bubble {
  flex: none; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800;
  background: var(--primary-soft); color: var(--primary);
}
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }

/* ---------- Lernmodus ---------- */
.section-block { border-left: 3px solid var(--primary); padding-left: 14px; }
.section-block ul, .bullets { margin: 0; padding-left: 1.1em; }
.section-block li, .bullets li { margin: 4px 0; }
.term { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.term dt { font-weight: 700; }
.term dd { margin: 4px 0 0; color: var(--muted); }
.work { padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.work .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.callout.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.source { font-size: 0.8rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.source svg { width: 14px; height: 14px; }

/* ---------- Quiz ---------- */
.quiz-head { display: grid; gap: 10px; margin-bottom: 16px; }
.question-card { padding: 22px 18px; }
.question-text { font-size: 1.15rem; font-weight: 650; margin-bottom: 18px; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 12px 14px; text-align: left;
  border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer;
  box-shadow: 0 2px 0 var(--border);
  transition: border-color 0.12s, background 0.12s, transform 0.08s;
}
.option:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.option:active:not(:disabled) { transform: translateY(1px); }
.option .key {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1.5px solid var(--border); font-weight: 750; font-size: 0.85rem; color: var(--muted);
}
.option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 2px 0 var(--primary); }
.option.selected .key { border-color: var(--primary); color: var(--primary); }
.option.correct { border-color: var(--success-strong); background: var(--success-soft); box-shadow: 0 2px 0 var(--success-strong); }
.option.correct .key { background: var(--success-strong); color: #fff; border-color: transparent; }
.option.wrong { border-color: var(--danger-strong); background: var(--danger-soft); box-shadow: 0 2px 0 var(--danger-strong); }
.option.wrong .key { background: var(--danger-strong); color: #fff; border-color: transparent; }
.option:disabled { cursor: default; }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tf-row .option { justify-content: center; font-weight: 700; }
.match-row { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
@media (min-width: 640px) { .match-row { grid-template-columns: 1fr 1fr; align-items: center; } }
.match-row.correct { background: var(--success-soft); }
.match-row.wrong { background: var(--danger-soft); }
.cloze { font-size: 1.1rem; line-height: 2.3; }
.cloze input {
  display: inline-block; width: auto; min-width: 9ch; max-width: 100%;
  padding: 4px 10px; margin: 0 2px;
  border: 0; border-bottom: 2.5px solid var(--primary); border-radius: 8px 8px 0 0;
  background: var(--primary-soft); font-weight: 650; text-align: center;
}
.cloze input:focus { outline: none; background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface)); }
.cloze input.correct { border-color: var(--success-strong); background: var(--success-soft); }
.cloze input.wrong { border-color: var(--danger-strong); background: var(--danger-soft); }
.feedback {
  margin-top: 16px; padding: 16px; border-radius: 14px;
  animation: slideUp 0.25s var(--ease);
}
.feedback.ok { background: var(--success-soft); }
.feedback.bad { background: var(--danger-soft); }
.feedback h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feedback.ok h3 { color: var(--success); }
.feedback.bad h3 { color: var(--danger); }
.sticky-actions {
  position: sticky; bottom: 76px; z-index: 5;
  margin-top: 16px; padding: 10px 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
@media (min-width: 900px) { .sticky-actions { bottom: 0; } }
.level-dots { display: inline-flex; gap: 3px; }
.level-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.level-dots i.on { background: var(--primary); }

/* ---------- Prüfungsmodus ---------- */
.exam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; padding: 6px 12px; border-radius: 10px; background: var(--surface-2); }
.timer.low { background: var(--danger-soft); color: var(--danger); }
.qnav { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.qnav button {
  aspect-ratio: 1; border-radius: 9px; border: 1.5px solid var(--border);
  background: var(--surface); font-weight: 700; font-size: 0.8rem; cursor: pointer; padding: 0;
}
.qnav button.answered { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.qnav button.current { outline: 2.5px solid var(--primary); outline-offset: 1px; }
.qnav button.flagged { border-color: var(--warn); box-shadow: inset 0 -3px 0 var(--warn); }
.qnav button.correct { background: var(--success-soft); border-color: var(--success-strong); color: var(--success); }
.qnav button.wrong { background: var(--danger-soft); border-color: var(--danger-strong); color: var(--danger); }
.score-ring {
  --p: 0;
  width: 150px; height: 150px; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto;
  background: conic-gradient(var(--ring, var(--primary)) calc(var(--p) * 1%), var(--surface-3) 0);
}
.score-ring > div {
  width: 118px; height: 118px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; text-align: center;
}
.score-ring strong { font-size: 2rem; font-weight: 850; line-height: 1; }

/* ---------- Karteikarten ---------- */
.flash-stage { perspective: 1400px; }
.flashcard {
  position: relative; width: 100%; min-height: 300px;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease);
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
  padding: 28px 24px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow-y: auto;
}
.flash-face.back { transform: rotateY(180deg); background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); }
.flash-face .front-text { font-size: 1.35rem; font-weight: 750; text-align: center; }
.flash-face .hint { text-align: center; color: var(--muted); font-size: 0.85rem; }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

/* ---------- Sperrbildschirm ---------- */
.lock {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #22c55e 14%, transparent), transparent),
    var(--bg);
}
.lock-card { width: 100%; max-width: 440px; padding: 30px 24px; border-radius: var(--radius-lg); }
.lock-card .brand { justify-content: center; margin-bottom: 18px; font-size: 1.15rem; }
.key-input { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 750; text-align: center; font-size: 1.15rem; }
.feature-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.feature-list li { display: flex; gap: 8px; align-items: flex-start; }
.feature-list svg { width: 18px; height: 18px; color: var(--success); flex: none; margin-top: 2px; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 0.9rem; font-weight: 550; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.success { background: var(--success-soft); color: var(--success); }
.alert.info { background: var(--info-soft); color: var(--text); }
.keybox {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.4rem; font-weight: 800; letter-spacing: 0.08em; text-align: center;
  padding: 16px; border-radius: 14px; background: var(--surface-2); border: 2px dashed var(--border);
  user-select: all; word-break: break-all;
}

/* ---------- Toast & Dialog ---------- */
.toast-host { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast {
  padding: 12px 16px; border-radius: 12px; font-weight: 600;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow);
  animation: slideUp 0.25s var(--ease);
}
.toast.error { background: var(--danger-strong); color: #fff; }
.toast.success { background: var(--success-strong); color: #04210f; }
.dialog-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(8, 10, 16, 0.55); display: grid; place-items: center; padding: 16px; animation: fadeIn 0.15s; }
.dialog { width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(8, 10, 16, 0.45); animation: fadeIn 0.15s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 81;
  width: min(100vw, 640px); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--border);
  padding: 20px 16px 40px; animation: slideIn 0.25s var(--ease);
}

/* ---------- Leerzustände & Diverses ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: var(--faint); margin-bottom: 8px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin 0.8s linear infinite; margin: 40px auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; margin-bottom: 10px; }
.back-link svg { width: 16px; height: 16px; }
.divider { height: 1px; background: var(--border); margin: 8px 0; border: 0; }
.kbd { font-family: ui-monospace, monospace; font-size: 0.75rem; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }

@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0.2; } }
@keyframes pop { 0% { transform: scale(0.96); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
.pop { animation: pop 0.3s var(--ease); }
.fade-in { animation: slideUp 0.3s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
