/* =====================================================================
   BioLab · styles.css
   Natur-Labor-Design · hell & dunkel · responsive
   ===================================================================== */

/* ---------------------------------------------------------------- Tokens */
:root {
  color-scheme: light;
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --bg: #f2f0e6;
  --bg-tint: #e7efe4;
  --surface: rgba(255, 255, 251, 0.78);
  --surface-strong: rgba(255, 255, 251, 0.96);
  --surface-solid: #fffdf7;
  --surface-muted: rgba(238, 240, 230, 0.7);
  --text: #15241d;
  --text-soft: #33473c;
  --muted: #61756a;
  --line: rgba(21, 36, 29, 0.11);
  --line-2: rgba(21, 36, 29, 0.2);
  --shadow: 0 24px 50px -28px rgba(10, 52, 34, 0.42);
  --shadow-sm: 0 10px 24px -16px rgba(10, 52, 34, 0.48);

  --green: #15803d;
  --green-2: #16a34a;
  --teal: #0f766e;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.11);
  --accent-glow: rgba(13, 148, 136, 0.18);
  --lime: #84cc16;
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.1);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --rose: #e11d48;
  --sky: #0284c7;

  --success: #15803d;
  --success-soft: rgba(22, 163, 74, 0.13);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.11);
  --focus: #0ea5e9;

  --grad-primary: linear-gradient(135deg, #16a34a 0%, #0d9488 100%);
  --grad-warm: linear-gradient(135deg, #fbbf24, #f97316);
  --grad-violet: linear-gradient(135deg, #a855f7, #7c3aed);
  --grad-hero: radial-gradient(120% 140% at 0% 0%, rgba(74, 222, 128, 0.35), transparent 55%),
               radial-gradient(120% 140% at 100% 10%, rgba(45, 212, 191, 0.32), transparent 55%),
               linear-gradient(135deg, #f7fbf4 0%, #eef7ee 45%, #e6f4f1 100%);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --topbar-h: 74px;
  --nav-w: 268px;
  --ease: cubic-bezier(.22, .8, .28, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07130f;
  --bg-tint: #0b1c16;
  --surface: rgba(15, 33, 26, 0.74);
  --surface-strong: rgba(17, 38, 30, 0.94);
  --surface-solid: #0e211a;
  --surface-muted: rgba(255, 255, 255, 0.04);
  --text: #e9f4ec;
  --text-soft: #c6d8cd;
  --muted: #97ada1;
  --line: rgba(233, 244, 236, 0.11);
  --line-2: rgba(233, 244, 236, 0.22);
  --shadow: 0 26px 55px -28px rgba(0, 0, 0, 0.78);
  --shadow-sm: 0 12px 26px -18px rgba(0, 0, 0, 0.8);

  --green: #4ade80;
  --green-2: #22c55e;
  --teal: #2dd4bf;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.13);
  --accent-glow: rgba(45, 212, 191, 0.22);
  --lime: #a3e635;
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --rose: #fb7185;

  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --focus: #38bdf8;

  --grad-hero: radial-gradient(120% 140% at 0% 0%, rgba(34, 197, 94, 0.22), transparent 55%),
               radial-gradient(120% 140% at 100% 10%, rgba(45, 212, 191, 0.2), transparent 55%),
               linear-gradient(135deg, #0d241c 0%, #0b211b 45%, #08201f 100%);
}

/* ---------------------------------------------------------------- Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(58vw 58vw at 6% -12%, rgba(74, 222, 128, 0.2), transparent 62%),
    radial-gradient(48vw 48vw at 102% -4%, rgba(45, 212, 191, 0.18), transparent 58%),
    radial-gradient(50vw 50vw at 60% 112%, rgba(250, 204, 21, 0.1), transparent 62%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image: radial-gradient(rgba(15, 80, 50, 0.16) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}
[data-theme="dark"] body::after { background-image: radial-gradient(rgba(140, 230, 190, 0.12) 1px, transparent 1px); }

img, svg { max-width: 100%; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
input[type="range"], input[type="checkbox"], progress { accent-color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; padding: 1px 5px; border-radius: 5px; background: var(--surface-muted); border: 1px solid var(--line); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 750; letter-spacing: -0.025em; line-height: 1.15; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
::selection { background: var(--accent-glow); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 38%, transparent); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 9999;
  padding: 10px 16px; border-radius: 10px; background: var(--surface-solid);
  border: 1px solid var(--line-2); transform: translateY(-160%); transition: transform .2s;
}
.skip-link:focus { transform: translateY(0); }

/* ---------------------------------------------------------------- Shell */
.app-shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "top top" "nav main";
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  position: relative;
  z-index: 30;
}
.topbar::after {
  content: "";
  position: absolute; inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  opacity: .8;
}

.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--grad-primary);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 8px 18px -8px rgba(13, 148, 136, .8);
  position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 20% 0%, rgba(255,255,255,.5), transparent 60%);
}
.brand-mark svg { width: 24px; height: 24px; position: relative; z-index: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-display); font-size: 19px; letter-spacing: -0.03em; }
.brand-text small { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

.topbar-stats { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.level-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s;
}
.level-chip:hover { transform: translateY(-1px); border-color: var(--line-2); }
.level-orb {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-primary);
  color: #fff; font-weight: 800; font-size: 15px;
  display: grid; place-items: center;
  box-shadow: inset 0 -2px 6px rgba(0,0,0,.18), 0 4px 10px -4px rgba(13,148,136,.7);
  flex-shrink: 0;
}
.level-meta { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.level-meta .lv-title { font-size: 12px; font-weight: 700; letter-spacing: .01em; }
.level-meta .lv-sub { font-size: 10.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.xp-mini { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.xp-mini span { display: block; height: 100%; border-radius: 99px; background: var(--grad-primary); transition: width .6s var(--ease); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  transition: transform .16s var(--ease), background .16s, color .16s, border-color .16s;
}
.icon-btn:hover { transform: translateY(-1px); color: var(--text); border-color: var(--line-2); background: var(--surface-strong); }
.icon-btn:active { transform: translateY(0) scale(.96); }
.icon-btn.is-off { color: var(--muted); opacity: .72; }
.icon-btn svg { width: 19px; height: 19px; }

.speak-btn { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; }
.speak-btn svg { width: 16px; height: 16px; }
.lex-card .speak-btn { width: 30px; height: 30px; }
.question-text .speak-btn { margin-top: 1px; }

/* ---------------------------------------------------------------- Sidebar */
.sidenav {
  grid-area: nav;
  border-right: 1px solid var(--line);
  padding: 22px 16px 28px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(8px);
}
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 0 12px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--text-soft); font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
  transition: background .16s, color .16s, transform .16s var(--ease);
}
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: var(--surface-muted); color: var(--text); }
.nav-link.active {
  background: linear-gradient(90deg, var(--accent-soft), transparent 90%);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-link .nav-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 800;
  background: var(--accent-soft); color: var(--accent-strong);
  padding: 2px 7px; border-radius: 99px;
}
.nav-module {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 12px; font-size: 13px; font-weight: 600;
  color: var(--text-soft); border: 1px solid transparent;
}
.nav-module:hover { background: var(--surface-muted); }
.nav-module.active { background: var(--surface-muted); border-color: var(--line); color: var(--text); }
.nav-module .nm-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
.nav-module .nm-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.nav-module .nm-check { color: var(--success); display: inline-flex; }
.nav-module .nm-check svg { width: 15px; height: 15px; }
.nav-foot { margin-top: auto; padding: 12px; border-radius: 14px; border: 1px dashed var(--line-2); font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.nav-foot strong { color: var(--text-soft); font-size: 12.5px; }

/* ---------------------------------------------------------------- Main */
.view {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 30px clamp(20px, 3.4vw, 44px) 72px;
  scroll-behavior: smooth;
}
.view-inner { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.view-enter { animation: fadeUp .45s var(--ease) both; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-strong);
}
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: currentColor; opacity: .6; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; border-radius: 13px;
  border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; letter-spacing: .005em;
  transition: transform .16s var(--ease), box-shadow .18s, background .18s, border-color .18s, color .18s;
  text-align: center;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 14px 26px -14px rgba(13, 148, 136, .75), inset 0 -1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 32px -16px rgba(13, 148, 136, .85); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); border-color: var(--line-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 24%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 15px 26px; font-size: 16px; border-radius: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--accent-strong); font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.1);
}
.card-pad { padding: clamp(18px, 2.6vw, 28px); }
.grid { display: grid; gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- Hero */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--grad-hero);
  box-shadow: var(--shadow);
  padding: clamp(24px, 3.6vw, 42px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
}
.hero::before {
  content: "";
  position: absolute; right: -90px; top: -110px; width: 340px; height: 340px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: 0 0 0 42px color-mix(in srgb, var(--accent) 6%, transparent), 0 0 0 86px color-mix(in srgb, var(--accent) 4%, transparent);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }
.hero-title { font-size: clamp(28px, 3.6vw, 44px); line-height: 1.05; letter-spacing: -0.035em; }
.hero-title em { font-style: normal; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-text { color: var(--text-soft); max-width: 54ch; font-size: 15.5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.hero-stats { position: relative; z-index: 1; display: grid; gap: 12px; }
.stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-strong) 74%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong);
  flex-shrink: 0;
}
.stat-icon svg { width: 21px; height: 21px; }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-body { display: flex; flex-direction: column; line-height: 1.2; }
.stat-body strong { font-size: 21px; font-family: var(--font-display); letter-spacing: -.03em; }
.stat-body span { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .03em; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(21px, 2.4vw, 27px); }
.section-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* ---------------------------------------------------------------- Module cards */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.module-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
  text-align: left;
  padding: 0;
  color: inherit;
}
.module-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--mc) 38%, var(--line)); }
.module-card::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: linear-gradient(90deg, var(--mc), color-mix(in srgb, var(--mc) 30%, transparent));
}
.module-top { display: flex; gap: 14px; padding: 22px 20px 14px; align-items: flex-start; }
.module-art {
  width: 64px; height: 64px; border-radius: 18px;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--mc) 12%, var(--surface-solid));
  border: 1px solid color-mix(in srgb, var(--mc) 24%, transparent);
  color: var(--mc);
  position: relative;
  overflow: hidden;
}
.module-art::after { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 90% at 20% 10%, rgba(255,255,255,.55), transparent 60%); opacity: .6; }
.module-art svg { width: 42px; height: 42px; position: relative; z-index: 1; }
.module-title-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.module-index { font-size: 10.5px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--mc); }
.module-title { font-size: 19px; letter-spacing: -.02em; }
.module-sub { font-size: 12.5px; color: var(--muted); }
.module-body { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.module-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 99px;
  background: var(--surface-muted); border: 1px solid var(--line);
  color: var(--muted);
}
.module-progress-row { display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mc, var(--accent)), color-mix(in srgb, var(--mc, var(--accent)) 55%, #fff 10%)); transition: width .7s var(--ease); }
.module-progress-row .pct { font-size: 12px; font-weight: 800; color: var(--mc); min-width: 34px; text-align: right; }
.module-foot {
  margin-top: auto;
  padding: 12px 20px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted);
}
.module-foot .status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.module-foot .status.done { color: var(--success); }
.module-foot svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- Badges */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.badge-tile {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.badge-tile.locked { opacity: .55; filter: saturate(.2); }
.badge-tile.locked .badge-icon { background: var(--surface-muted); color: var(--muted); }
.badge-tile.unlocked::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--bc) 18%, transparent), transparent 60%);
  pointer-events: none;
}
.badge-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bc, var(--accent)) 14%, transparent);
  color: var(--bc, var(--accent));
  border: 1px solid color-mix(in srgb, var(--bc, var(--accent)) 22%, transparent);
}
.badge-icon svg { width: 20px; height: 20px; }
.badge-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.badge-meta strong { font-size: 12.5px; }
.badge-meta span { font-size: 10.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- Quick actions */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.quick-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  text-align: left; color: inherit;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.quick-card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.quick-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex-shrink: 0; }
.quick-icon svg { width: 22px; height: 22px; }
.quick-card strong { display: block; font-size: 14.5px; }
.quick-card span { display: block; font-size: 11.5px; color: var(--muted); }
.quick-card .arrow { margin-left: auto; color: var(--muted); display: flex; }

/* ---------------------------------------------------------------- Module page */
.module-head {
  display: flex; align-items: flex-start; gap: clamp(14px, 2vw, 22px);
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 160% at 0% 0%, color-mix(in srgb, var(--mc) 16%, transparent), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.module-head-art {
  width: 84px; height: 84px; border-radius: 22px; flex-shrink: 0;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--mc) 12%, var(--surface-solid));
  border: 1px solid color-mix(in srgb, var(--mc) 24%, transparent);
}
.module-head-art svg { width: 56px; height: 56px; }
.module-head-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.module-head h1 { font-size: clamp(24px, 3vw, 34px); }
.module-head .sub { color: var(--muted); font-size: 14px; }
.module-head .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-muted); color: var(--text-soft);
}
.pill svg { width: 13px; height: 13px; }
.module-head-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.ring-mini { position: relative; width: 76px; height: 76px; display: grid; place-items: center; }
.ring-mini .ring-bg, .ring-mini .ring-fg { position: absolute; inset: 0; border-radius: 50%; }
.ring-mini .ring-bg { background: conic-gradient(var(--line) 0 100%); }
.ring-mini .ring-fg { background: conic-gradient(var(--mc) calc(var(--p) * 1%), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px)); mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px)); }
.ring-mini strong { font-size: 19px; font-family: var(--font-display); }

.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.crumbs a:hover { color: var(--text); }

.lernziele { display: flex; flex-wrap: wrap; gap: 8px; }
.lernziel {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 99px;
  background: color-mix(in srgb, var(--mc) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--mc) 20%, transparent);
  font-size: 12px; font-weight: 600; color: var(--text-soft);
}
.lernziel svg { width: 14px; height: 14px; color: var(--mc); }

.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 15px;
  width: fit-content;
  max-width: 100%;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 11px;
  background: transparent; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 700; color: var(--muted);
  transition: background .16s, color .16s, border-color .16s;
}
.tab:hover { color: var(--text); background: color-mix(in srgb, var(--surface-solid) 50%, transparent); }
.tab.active {
  background: var(--surface-solid); color: var(--text);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.tab .tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.tab.done .tab-dot { background: var(--success); }
.tab svg { width: 16px; height: 16px; }

.theory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.merksatz {
  position: relative;
  padding: 20px 20px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.merksatz::before {
  content: attr(data-nr);
  position: absolute; top: 16px; right: 18px;
  font-family: var(--font-display); font-size: 34px; font-weight: 800;
  color: color-mix(in srgb, var(--mc) 16%, transparent);
  line-height: 1;
}
.merksatz h3 { font-size: 15px; padding-right: 34px; color: var(--mc); }
.merksatz p { font-size: 13.5px; color: var(--text-soft); }
.merksatz .ms-actions { margin-top: auto; padding-top: 6px; display: flex; gap: 8px; }

.part-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: left; color: inherit; width: 100%;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.part-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--mc) 40%, var(--line)); box-shadow: var(--shadow-sm); }
.part-icon { width: 48px; height: 48px; border-radius: 14px; background: color-mix(in srgb, var(--mc) 12%, transparent); color: var(--mc); display: grid; place-items: center; flex-shrink: 0; }
.part-icon svg { width: 23px; height: 23px; }
.part-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.part-body strong { font-size: 14.5px; }
.part-body span { font-size: 12px; color: var(--muted); }
.part-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.part-best { font-size: 12px; font-weight: 800; color: var(--mc); }
.part-arrow { color: var(--muted); display: flex; }

.part-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }

.diagram-preview {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.diagram-preview .thumb {
  width: 190px; aspect-ratio: 800/560;
  border-radius: 12px; overflow: hidden;
  background: #fbfaf4; border: 1px solid var(--line);
  flex-shrink: 0;
}
.diagram-preview .thumb svg { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------------- Quiz */
.quiz-wrap { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.quiz-top { display: flex; align-items: center; gap: 14px; }
.quiz-top .progress { height: 10px; }
.quiz-count { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .04em; white-space: nowrap; }
.quiz-card { padding: clamp(20px, 3.2vw, 34px); border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.question-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: var(--accent-strong); margin-bottom: 10px; }
.question-text { font-family: var(--font-display); font-size: clamp(19px, 2.4vw, 25px); font-weight: 700; letter-spacing: -.02em; line-height: 1.3; display: flex; gap: 12px; align-items: flex-start; }
.question-text .speak-btn { flex-shrink: 0; margin-top: 2px; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 17px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface-strong);
  text-align: left; color: var(--text);
  font-size: 14.5px; font-weight: 500;
  transition: border-color .16s, background .16s, transform .16s var(--ease), box-shadow .16s;
  position: relative;
}
.option:not(:disabled):hover { border-color: var(--accent); transform: translateX(2px); box-shadow: var(--shadow-sm); }
.option:disabled { cursor: default; }
.option-letter {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface-muted); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 800; color: var(--muted);
  transition: background .16s, color .16s, border-color .16s;
}
.option-text { padding-top: 3px; }
.option-mark { margin-left: auto; padding-top: 2px; display: flex; align-items: center; color: var(--muted); }
.option-mark svg { width: 21px; height: 21px; }
.option.correct { border-color: var(--success); background: var(--success-soft); }
.option.correct .option-letter { background: var(--success); color: #fff; border-color: transparent; }
.option.correct .option-mark { color: var(--success); }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.option.wrong .option-letter { background: var(--danger); color: #fff; border-color: transparent; }
.option.wrong .option-mark { color: var(--danger); }
.option.dimmed { opacity: .55; }
.option.result-selected { box-shadow: 0 0 0 2px var(--accent) inset; }

.feedback {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  display: flex; gap: 13px;
  animation: fadeUp .3s var(--ease) both;
}
.feedback.good { border-color: color-mix(in srgb, var(--success) 45%, transparent); background: var(--success-soft); }
.feedback.bad { border-color: color-mix(in srgb, var(--danger) 38%, transparent); background: var(--danger-soft); }
.feedback-icon { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: var(--surface-solid); color: var(--success); }
.feedback.bad .feedback-icon { color: var(--danger); }
.feedback-icon svg { width: 19px; height: 19px; }
.feedback h4 { font-size: 13.5px; margin-bottom: 3px; }
.feedback p { font-size: 13.5px; color: var(--text-soft); }
.feedback .why { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); font-size: 12.5px; color: var(--muted); }

.quiz-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; align-items: center; }

/* Quiz-Ergebnis */
.result-hero {
  text-align: center;
  padding: clamp(26px, 4vw, 46px) 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--grad-hero);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  position: relative; overflow: hidden;
}
.score-ring {
  --p: 0;
  width: 128px; height: 128px; border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
  transition: --p 1s;
  box-shadow: inset 0 0 0 1px var(--line);
}
.score-ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface-solid); box-shadow: var(--shadow-sm); }
.score-ring > div { position: relative; z-index: 1; text-align: center; line-height: 1; }
.score-ring strong { font-family: var(--font-display); font-size: 34px; letter-spacing: -.04em; }
.score-ring span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; letter-spacing: .08em; margin-top: 3px; }
.result-hero h2 { font-size: clamp(24px, 3.2vw, 33px); }
.result-hero .quote { color: var(--text-soft); max-width: 52ch; font-size: 14.5px; }
.result-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.result-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 99px;
  background: var(--surface-strong); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 700;
}
.result-pill svg { width: 15px; height: 15px; color: var(--accent-strong); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }

/* ---------------------------------------------------------------- Diagramm */
.diagram-layout { display: flex; flex-direction: column; gap: 18px; }
.diagram-grid { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 18px; align-items: start; }
.diagram-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.diagram-side {
  position: sticky; top: 10px; align-self: start;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-2);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.diagram-side .term-tray { flex-direction: column; flex-wrap: nowrap; padding: 0; border: 0; background: transparent; gap: 8px; }
.diagram-side .term { width: 100%; justify-content: flex-start; padding: 9px 12px; }
.diagram-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.diagram-bar .progress { flex: 1; min-width: 120px; }
.diagram-stage-wrap { position: relative; }
.diagram-stage {
  position: relative;
  aspect-ratio: 800 / 560;
  width: 100%;
  border-radius: var(--radius-lg);
  background: #fbfaf4;
  border: 1px solid rgba(21, 36, 29, 0.14);
  overflow: hidden;
  box-shadow: var(--shadow-sm), inset 0 0 60px rgba(20, 60, 40, 0.05);
  touch-action: manipulation;
}
.diagram-stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(21, 36, 29, .045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(21, 36, 29, .045) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at 50% 50%, #000 30%, transparent 80%);
}
.diagram-stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.diagram-stage.selecting .hotspot:not(.filled) { animation: hotspotPulse 1.6s infinite; }

.hotspot {
  position: absolute;
  left: var(--x); top: var(--y);
  transform: translate(-50%, -50%);
  width: clamp(26px, 3.2vw, 34px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid #7c3aed;
  background: #fff;
  color: #5b21b6;
  font-weight: 800;
  font-size: clamp(11px, 1.4vw, 14px);
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .22);
  z-index: 2;
  transition: transform .15s var(--ease), background .15s, border-color .15s, box-shadow .15s;
  padding: 0;
}
.hotspot:hover { transform: translate(-50%, -50%) scale(1.09); box-shadow: 0 6px 16px rgba(15, 23, 42, .28); }
.hotspot.filled {
  background: #16a34a; border-color: #166534; color: #fff;
  cursor: default;
  box-shadow: 0 4px 12px rgba(22, 163, 74, .4);
}
.hotspot.filled:hover { transform: translate(-50%, -50%); }
.hotspot.filled svg { width: 16px; height: 16px; }
.hotspot.drop-hover { box-shadow: 0 0 0 7px rgba(13, 148, 136, .22); border-color: #0d9488; background: #ecfdf5; }
.hotspot.wrong { animation: shake .45s var(--ease); border-color: #dc2626; background: #fef2f2; color: #b91c1c; }
.hotspot.wrong-flash { box-shadow: 0 0 0 6px rgba(220, 38, 38, .22); }
.hotspot:disabled { cursor: default; }
.hotspot-label {
  position: absolute;
  z-index: 3;
  background: rgba(255, 255, 255, .95);
  border: 1px solid #86efac;
  color: #14532d;
  font-size: clamp(10px, 1.25vw, 12px);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .14);
  animation: pop .3s var(--ease) both;
}
.hotspot-label.side-right { left: calc(var(--x) + 26px); top: var(--y); transform: translateY(-50%); }
.hotspot-label.side-left { left: calc(var(--x) - 26px); top: var(--y); transform: translate(-100%, -50%); }
.hotspot-label.side-top { left: var(--x); top: calc(var(--y) - 26px); transform: translate(-50%, -100%); }
.hotspot-label.side-bottom { left: var(--x); top: calc(var(--y) + 26px); transform: translate(-50%, 0); }

.term-tray {
  display: flex; flex-wrap: wrap; gap: 9px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-2);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.term {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-solid);
  font-size: 13px; font-weight: 700;
  color: var(--text);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform .15s var(--ease), border-color .15s, background .15s, box-shadow .15s, opacity .2s;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .05);
}
.term:hover { border-color: var(--accent); transform: translateY(-1px); }
.term .grip { display: inline-flex; color: var(--muted); }
.term .grip svg { width: 14px; height: 14px; }
.term.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-glow);
  transform: translateY(-2px);
}
.term.used { opacity: .4; text-decoration: line-through; cursor: default; pointer-events: none; }
.term.used .grip { display: none; }
.drag-ghost {
  position: fixed; z-index: 900;
  transform: translate(-50%, -50%) rotate(-3deg) scale(1.04);
  pointer-events: none;
  padding: 9px 15px; border-radius: 999px;
  background: var(--surface-solid);
  border: 2px solid var(--accent);
  box-shadow: 0 16px 30px -12px rgba(15, 23, 42, .5);
  font-size: 13px; font-weight: 800;
}

.hint-box {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; border-radius: 13px;
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  font-size: 13px; color: var(--text-soft);
  animation: fadeUp .3s var(--ease) both;
}
.hint-box svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--amber); margin-top: 1px; }
.hint-box.good { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 32%, transparent); }
.hint-box.good svg { color: var(--success); }
.hint-box.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.hint-box.bad svg { color: var(--danger); }

/* ---------------------------------------------------------------- Freitext */
.freitext-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.task-card { padding: clamp(20px, 3vw, 30px); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 14px; }
.task-card .q { font-size: clamp(18px, 2.2vw, 22px); font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.task-hint { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.task-hint svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--amber); }
.editor-wrap { position: relative; }
textarea.editor {
  width: 100%; min-height: 210px; resize: vertical;
  padding: 16px 17px;
  border-radius: 14px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 14.5px; line-height: 1.6;
  transition: border-color .16s, box-shadow .16s;
}
textarea.editor:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
textarea.editor::placeholder { color: var(--muted); opacity: .8; }
.editor-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.editor-meta .spacer { flex: 1; }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.keyword { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-muted); border: 1px solid var(--line); color: var(--muted); }
.task-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.loading-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.result-card { padding: clamp(20px, 3vw, 30px); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 16px; animation: fadeUp .4s var(--ease) both; }
.result-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.result-head .score-ring { width: 92px; height: 92px; flex-shrink: 0; }
.result-head .score-ring strong { font-size: 26px; }
.result-head h3 { font-size: 20px; }
.result-head p { font-size: 13px; color: var(--muted); }
.result-section { display: flex; flex-direction: column; gap: 8px; }
.result-section h4 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.result-section p, .result-section li { font-size: 14px; color: var(--text-soft); }
.missing-list { display: flex; flex-wrap: wrap; gap: 6px; }
.missing-chip { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent); }
.model-box { padding: 14px 16px; border-radius: 12px; background: var(--surface-muted); border-left: 3px solid var(--accent); font-size: 13.5px; color: var(--text-soft); line-height: 1.6; }
.ai-note { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.ai-note svg { width: 14px; height: 14px; }
.ai-note .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.ai-note.offline .dot { background: var(--amber); }

/* ---------------------------------------------------------------- Prüfung */
.exam-hero { text-align: center; padding: clamp(26px, 4vw, 44px); border-radius: var(--radius-xl); border: 1px solid var(--line); background: var(--grad-hero); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.exam-hero h1 { font-size: clamp(26px, 3.4vw, 40px); }
.exam-hero p { max-width: 60ch; color: var(--text-soft); font-size: 15px; }
.exam-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; width: 100%; max-width: 760px; margin-top: 6px; }
.exam-rule { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-strong); display: flex; gap: 10px; align-items: flex-start; text-align: left; }
.exam-rule svg { width: 18px; height: 18px; color: var(--accent-strong); flex-shrink: 0; margin-top: 2px; }
.exam-rule strong { font-size: 12.5px; display: block; }
.exam-rule span { font-size: 11.5px; color: var(--muted); }
.exam-timer { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 14px; color: var(--text-soft); padding: 7px 13px; border-radius: 99px; background: var(--surface-strong); border: 1px solid var(--line); }
.exam-timer svg { width: 16px; height: 16px; color: var(--accent-strong); }
.review-list { display: flex; flex-direction: column; gap: 10px; }
.review-item { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.review-item summary { padding: 14px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px; font-size: 13.5px; font-weight: 600; list-style: none; }
.review-item summary::-webkit-details-marker { display: none; }
.review-item summary .ri-mark { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; }
.review-item summary .ri-mark.ok { background: var(--success-soft); color: var(--success); }
.review-item summary .ri-mark.no { background: var(--danger-soft); color: var(--danger); }
.review-item summary .ri-mark svg { width: 14px; height: 14px; }
.review-body { padding: 0 16px 16px 52px; font-size: 13px; color: var(--text-soft); display: flex; flex-direction: column; gap: 6px; }
.review-body .your { color: var(--danger); font-weight: 600; }
.review-body .right { color: var(--success); font-weight: 600; }

/* ---------------------------------------------------------------- Lexikon */
.search-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.search-bar svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search-bar input { flex: 1; background: none; border: 0; outline: none; font-size: 14px; }
.lex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.lex-card { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.lex-card .lex-top { display: flex; align-items: center; gap: 8px; }
.lex-card h3 { font-size: 14.5px; }
.lex-card .lex-tag { margin-left: auto; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-strong); opacity: .8; }
.lex-card p { font-size: 12.8px; color: var(--muted); }
.lex-card .speak-btn { opacity: .5; }
.lex-card:hover .speak-btn { opacity: 1; }

/* ---------------------------------------------------------------- Settings */
.settings-grid { display: grid; gap: 16px; }
.settings-card { padding: clamp(18px, 2.6vw, 26px); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 16px; }
.settings-card h2 { font-size: 18px; display: flex; align-items: center; gap: 9px; }
.settings-card h2 svg { width: 19px; height: 19px; color: var(--accent-strong); }
.settings-card > p { font-size: 13px; color: var(--muted); margin-top: -8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 800; letter-spacing: .02em; color: var(--text-soft); }
.field .help { font-size: 11.5px; color: var(--muted); }
.input, .select, textarea.input {
  width: 100%; padding: 10px 13px; border-radius: 11px;
  border: 1.5px solid var(--line-2); background: var(--surface-strong);
  font-size: 13.5px; color: var(--text);
  transition: border-color .16s, box-shadow .16s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.switch-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .sw-text { display: flex; flex-direction: column; }
.switch-row .sw-text strong { font-size: 13.5px; }
.switch-row .sw-text span { font-size: 11.5px; color: var(--muted); }
.switch { margin-left: auto; width: 50px; height: 29px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--line); position: relative; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on::after { transform: translateX(21px); }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent); font-size: 12.5px; color: var(--text-soft); }
.note svg { width: 17px; height: 17px; color: var(--amber); flex-shrink: 0; margin-top: 1px; }
.note.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
.note.info svg { color: var(--accent-strong); }

.server-box {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--success) 32%, transparent);
  background: var(--success-soft);
}
.server-box-icon {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface-solid);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 24%, transparent);
}
.server-box-icon svg { width: 21px; height: 21px; }
.server-box-body { min-width: 0; }
.server-box-body strong { display: block; font-size: 14px; }
.server-box-body p { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; max-width: 62ch; }

/* ---------------------------------------------------------------- Mascot */
.mascot-layer { position: fixed; right: 22px; bottom: 22px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.mascot {
  pointer-events: auto;
  width: min(360px, calc(100vw - 32px));
  border-radius: 20px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow: 0 28px 50px -22px rgba(8, 45, 30, .55);
  backdrop-filter: blur(16px);
  padding: 14px 16px 14px 14px;
  display: flex; gap: 12px; align-items: flex-start;
  animation: mascotIn .4s var(--ease) both;
}
.mascot.hidden { display: none; }
.mascot-figure { width: 62px; height: 62px; flex-shrink: 0; filter: drop-shadow(0 6px 10px rgba(30, 70, 50, .25)); }
.mascot-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mascot-name { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-strong); display: flex; align-items: center; gap: 6px; }
.mascot-name .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.mascot-text { font-size: 13px; line-height: 1.45; color: var(--text-soft); }
.mascot-close { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.mascot-close:hover { background: var(--surface-muted); color: var(--text); }
.mascot-close svg { width: 14px; height: 14px; }
.mascot { position: relative; }
.mascot-fab {
  pointer-events: auto;
  width: 58px; height: 58px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: 0 16px 30px -14px rgba(8, 45, 30, .55);
  display: grid; place-items: center;
  transition: transform .18s var(--ease);
}
.mascot-fab:hover { transform: translateY(-2px) scale(1.03); }
.mascot-fab svg { width: 42px; height: 42px; }
.mascot-fab .mascot-figure { width: 44px; height: 44px; }

/* ---------------------------------------------------------------- Toasts */
.toast-layer { position: fixed; top: calc(var(--topbar-h) + 14px); right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto;
  min-width: 250px; max-width: 360px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: 0 22px 40px -20px rgba(8, 45, 30, .55);
  animation: toastIn .35s var(--ease) both;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
.toast-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex-shrink: 0; }
.toast-icon svg { width: 18px; height: 18px; }
.toast.xp .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-body { display: flex; flex-direction: column; gap: 2px; }
.toast-body strong { font-size: 13px; }
.toast-body span { font-size: 12px; color: var(--muted); }
.toast.badge .toast-icon { background: var(--amber-soft); color: var(--amber); }
.toast.level .toast-icon { background: var(--violet-soft); color: var(--violet); }

/* ---------------------------------------------------------------- Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 20, 14, .55);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .2s both;
}
.modal {
  width: min(660px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6);
  padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
  animation: modalIn .3s var(--ease) both;
}
.modal-head { display: flex; align-items: flex-start; gap: 14px; }
.modal-head h3 { font-size: 19px; }
.modal-head p { font-size: 12.5px; color: var(--muted); }
.modal-close { margin-left: auto; flex-shrink: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-img { border-radius: 12px; border: 1px solid var(--line); max-height: 62vh; object-fit: contain; background: #fff; }
.modal-gallery { display: grid; gap: 14px; }
.modal-gallery figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.modal-gallery figcaption { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------- Confetti */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -12px;
  width: 9px; height: 13px; border-radius: 2px;
  animation: confettiFall linear forwards;
}

/* ---------------------------------------------------------------- Animationen */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } 100% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: translate(-50%, -50%) rotate(0); } 20% { transform: translate(calc(-50% - 6px), -50%) rotate(-3deg); } 40% { transform: translate(calc(-50% + 6px), -50%) rotate(3deg); } 60% { transform: translate(calc(-50% - 4px), -50%) rotate(-2deg); } 80% { transform: translate(calc(-50% + 4px), -50%) rotate(2deg); } }
@keyframes hotspotPulse { 0%, 100% { box-shadow: 0 4px 12px rgba(15, 23, 42, .22), 0 0 0 0 rgba(124, 58, 237, .45); } 50% { box-shadow: 0 4px 12px rgba(15, 23, 42, .22), 0 0 0 9px rgba(124, 58, 237, 0); } }
@keyframes mascotIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(.97); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); opacity: .9; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1120px) {
  .hero { grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr); }
  .diagram-grid { grid-template-columns: minmax(0, 1fr) 250px; }
}
@media (max-width: 980px) {
  .diagram-grid { grid-template-columns: minmax(0, 1fr); }
  .diagram-side { position: static; }
  .diagram-side .term-tray { flex-direction: row; flex-wrap: wrap; }
  .diagram-side .term { width: auto; }
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar-h) minmax(0, 1fr) 66px;
    grid-template-areas: "top" "main" "nav";
  }
  .sidenav {
    border-right: 0; border-top: 1px solid var(--line);
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row; align-items: center; gap: 4px;
    overflow-x: auto; overflow-y: hidden;
    background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
    backdrop-filter: blur(16px);
  }
  .sidenav .nav-group { display: contents; }
  .sidenav .nav-label { display: none; }
  .sidenav .nav-link { flex-direction: column; gap: 3px; padding: 8px 10px; font-size: 10.5px; min-width: 66px; justify-content: center; border-radius: 12px; }
  .sidenav .nav-link svg { width: 20px; height: 20px; }
  .sidenav .nav-link.active { box-shadow: inset 0 3px 0 var(--accent); background: var(--accent-soft); }
  .sidenav .nav-link .nav-badge { display: none; }
  .sidenav .nav-modules { display: none; }
  .sidenav .nav-foot { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }
  .view { padding: 22px 18px 40px; }
  .mascot-layer { bottom: 80px; right: 14px; }
  .hero { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-card { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat-body strong { font-size: 18px; }
  .level-meta { min-width: 104px; }
}
@media (max-width: 720px) {
  :root { --topbar-h: 64px; }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 17px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; }
  .topbar-actions a[href="#/einstellungen"] { display: none; }
  .topbar-stats { gap: 8px; margin-left: auto; }
  .level-meta .lv-title { display: none; }
  .level-meta .lv-sub { display: none; }
  .level-meta { min-width: 62px; gap: 0; }
  .level-chip { padding: 5px 10px 5px 5px; }
  .level-orb { width: 32px; height: 32px; font-size: 13px; }
  .hero-stats { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; align-items: center; }
  .module-head { flex-wrap: wrap; }
  .module-head-side { margin-left: 0; width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .module-head-art { width: 64px; height: 64px; border-radius: 18px; }
  .module-head-art svg { width: 44px; height: 44px; }
  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tab { flex-shrink: 0; padding: 8px 12px; font-size: 12.5px; }
  .quiz-card { border-radius: 20px; }
  .option { font-size: 13.5px; padding: 13px 14px; }
  .mascot { width: calc(100vw - 28px); }
  .mascot-layer { left: 14px; align-items: flex-end; }
  .toast-layer { left: 14px; right: 14px; }
  .toast { max-width: none; width: 100%; }
  .diagram-stage { border-radius: 16px; }
  .modal { padding: 18px; }
}
@media (max-width: 480px) {
  .view { padding: 16px 13px 36px; }
  .hero { padding: 20px; border-radius: 22px; }
  .hero-title { font-size: 27px; }
  .btn { padding: 11px 16px; font-size: 13.5px; }
  .badge-grid { grid-template-columns: 1fr 1fr; }
  .badge-tile { padding: 10px; }
  .badge-meta span { display: none; }
  .quick-grid { grid-template-columns: 1fr; }
  .part-card { flex-wrap: wrap; }
  .part-right { width: 100%; justify-content: flex-end; }
}

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

/* Sanfter Theme-Wechsel */
body, .card, .module-card, .topbar, .sidenav, .diagram-stage, .option { transition: background-color .3s ease, border-color .3s ease, color .3s ease; }

/* Druck */
@media print {
  .topbar, .sidenav, .mascot-layer, .toast-layer { display: none !important; }
  .app-shell { display: block; height: auto; }
  .view { overflow: visible; padding: 0; }
  body { overflow: visible; }
}
