/* BIO3 Klausur-Trainer · Botanisches & Zellbiologisches Lernstudio */

:root {
  --bg: #FAF8F3;
  --bg-2: #F3EFE6;
  --bg-3: #ECE6D9;
  --card: #FFFFFF;
  --ink: #18241E;
  --ink-2: #34443B;
  --muted: #66746C;
  --line: #E6DFD1;
  --line-2: #D5CBB7;

  --em: #1D6F4E;
  --em-2: #2E8B57;
  --em-soft: #E4F2E9;
  --amber: #C25E28;
  --amber-2: #D97706;
  --amber-soft: #FBEBDF;
  --gold: #B7791F;
  --gold-2: #EAB308;
  --gold-soft: #FBF2D5;
  --red: #B4372B;
  --red-soft: #FBE6E2;
  --blue: #2F6690;
  --blue-soft: #E3EEF6;

  --paper: #FFFDF7;
  --paper-line: #DCE6EE;
  --paper-margin: #E9A9A0;

  /* diagram palette */
  --d-outer: #1D6F4E;
  --d-inner: #2E8B57;
  --d-stroma: #DDEFD6;
  --d-ims: #F1F6E4;
  --d-thy-fill: #8CC79B;
  --d-thy-stroke: #155C3F;
  --d-starch: #FFFDF2;
  --d-dna: #7B4FA0;
  --d-ribo: #3C4A42;
  --d-mito-outer: #A4481A;
  --d-mito-inner: #C25E28;
  --d-mito-ims: #FCEBD9;
  --d-mito-matrix: #F6D2B3;
  --d-cuticle: #E6C66A;
  --d-epi: #F5F1E3;
  --d-epi-stroke: #8B8470;
  --d-palisade: #CDE6C0;
  --d-spongy: #D9EDCE;
  --d-air: #F7FBF3;
  --d-chl: #3E9A5C;
  --d-xylem: #9DB4CF;
  --d-phloem: #E3C9A0;
  --d-hl: #EAB308;

  --shadow-sm: 0 1px 2px rgba(24, 36, 30, .06), 0 1px 1px rgba(24, 36, 30, .04);
  --shadow: 0 1px 2px rgba(24, 36, 30, .05), 0 6px 20px -8px rgba(24, 36, 30, .14);
  --shadow-lg: 0 24px 60px -24px rgba(24, 36, 30, .35);
  --radius: 14px;
  --radius-sm: 9px;

  --f-serif: "Fraunces", "Newsreader", Georgia, "Times New Roman", serif;
  --f-sans: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 268px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0E1411;
  --bg-2: #131B17;
  --bg-3: #1A241F;
  --card: #172019;
  --ink: #E7EFE9;
  --ink-2: #C5D2CA;
  --muted: #8E9F95;
  --line: #24312A;
  --line-2: #33443A;

  --em: #4FBF88;
  --em-2: #6FD3A0;
  --em-soft: #173226;
  --amber: #F0915A;
  --amber-2: #F5A524;
  --amber-soft: #3A2316;
  --gold: #F2C14E;
  --gold-2: #FACC15;
  --gold-soft: #342A12;
  --red: #F08C7E;
  --red-soft: #3B1C18;
  --blue: #7DB3DB;
  --blue-soft: #16283A;

  --paper: #1B2420;
  --paper-line: #25333B;
  --paper-margin: #6E3A35;

  --d-outer: #5CC795;
  --d-inner: #45A876;
  --d-stroma: #1E3A2B;
  --d-ims: #172A20;
  --d-thy-fill: #2F7A4C;
  --d-thy-stroke: #8EE0B0;
  --d-starch: #E9E3C9;
  --d-dna: #C39BE6;
  --d-ribo: #DCE7E0;
  --d-mito-outer: #F0915A;
  --d-mito-inner: #E0793F;
  --d-mito-ims: #2F2117;
  --d-mito-matrix: #4A2C1A;
  --d-cuticle: #B8952E;
  --d-epi: #26302B;
  --d-epi-stroke: #8A9A90;
  --d-palisade: #24412F;
  --d-spongy: #1F3828;
  --d-air: #121A16;
  --d-chl: #5CC08A;
  --d-xylem: #42617F;
  --d-phloem: #6B5532;
  --d-hl: #FACC15;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--em); }
h1, h2, h3, h4 { font-family: var(--f-serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 2.6vw, 2.35rem); }
h2 { font-size: clamp(1.35rem, 2vw, 1.7rem); }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
code, .mono { font-family: var(--f-mono); font-size: .92em; }
strong { font-weight: 700; color: var(--ink); }
:focus-visible { outline: 2.5px solid var(--gold-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .25s ease; }
.app.collapsed { grid-template-columns: 76px 1fr; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 10px; z-index: 40;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 4px 6px 14px; border-bottom: 1px solid var(--line); }
.brand-mark { flex: 0 0 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(140deg, var(--em) 0%, var(--em-2) 55%, var(--gold-2) 140%); color: #fff; box-shadow: var(--shadow-sm); }
.brand-text { min-width: 0; }
.brand-title { font-family: var(--f-serif); font-weight: 700; font-size: 1.05rem; line-height: 1.15; }
.brand-sub { font-size: .74rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav-item {
  display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 11px; border: 0; background: transparent;
  text-align: left; color: var(--ink-2); transition: background .15s, color .15s; position: relative;
}
.nav-item:hover { background: var(--bg-3); color: var(--ink); }
.nav-item.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--em); }
.nav-icon { flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-3); color: var(--em); }
.nav-item.active .nav-icon { background: var(--em-soft); }
.nav-text { display: flex; flex-direction: column; min-width: 0; }
.nav-label { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.nav-sub { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-key { margin-left: auto; font-family: var(--f-mono); font-size: .68rem; color: var(--muted); opacity: .7; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-foot .small { line-height: 1.4; }
.app.collapsed .brand-text, .app.collapsed .nav-text, .app.collapsed .nav-key, .app.collapsed .sidebar-foot .hide-collapsed { display: none; }
.app.collapsed .nav-item { justify-content: center; }
.app.collapsed .brand { justify-content: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px clamp(16px, 3vw, 36px);
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; }
.crumb { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.topbar-h { font-family: var(--f-serif); font-size: 1.15rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--ink-2); transition: all .15s; }
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); transform: translateY(-1px); }
.menu-btn { display: none; }
.timer-chip { display: none; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: .85rem; padding: 6px 10px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); border: 0; }
.timer-chip.on { display: inline-flex; }

.view { padding: clamp(18px, 3vw, 36px); max-width: 1320px; width: 100%; margin: 0 auto; animation: viewIn .35s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.view-head p { margin: 0; color: var(--muted); max-width: 70ch; }
.eyebrow { font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; color: var(--em); font-weight: 700; margin-bottom: 6px; }

.scrim { display: none; }

/* ---------- Primitives ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: clamp(16px, 2.2vw, 24px); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.auto-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.sep { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font-weight: 600; font-size: .9rem;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; line-height: 1.3;
}
.btn:hover { border-color: var(--ink-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--em); border-color: var(--em); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #0b1a12; }
.btn-primary:hover { background: var(--em-2); border-color: var(--em-2); }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #fff; }
:root[data-theme="dark"] .btn-amber { color: #2a1206; }
.btn-gold { background: var(--gold-2); border-color: var(--gold-2); color: #2b1d02; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-3); border-color: transparent; box-shadow: none; }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }
.btn-danger { color: var(--red); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: .86rem; color: var(--muted); transition: all .15s; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg.big button { padding: 9px 18px; font-size: .92rem; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-2); line-height: 1.5; }
button.chip:hover { border-color: var(--line-2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.b-auf { background: var(--em-soft); color: var(--em); }
.b-ab { background: var(--amber-soft); color: var(--amber); }
.b-both { background: var(--gold-soft); color: var(--gold); }
.b-trap { background: var(--red-soft); color: var(--red); }
.b-neutral { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.b-afb1 { background: var(--blue-soft); color: var(--blue); }
.b-afb2 { background: var(--gold-soft); color: var(--gold); }
.b-afb3 { background: var(--amber-soft); color: var(--amber); }
.kbd { font-family: var(--f-mono); font-size: .74rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--card); color: var(--ink-2); }

.progress { height: 8px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--em), var(--em-2)); border-radius: inherit; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.progress.amber > span { background: linear-gradient(90deg, var(--amber), var(--amber-2)); }
.progress.gold > span { background: linear-gradient(90deg, var(--gold), var(--gold-2)); }

.callout { border-radius: 12px; padding: 13px 16px; border: 1px solid; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; margin: 12px 0; }
.callout-ic { grid-row: span 2; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.callout-t { font-weight: 700; font-size: .9rem; }
.callout-b { font-size: .92rem; color: var(--ink-2); }
.callout-b p:last-child { margin: 0; }
.callout.merksatz { background: var(--em-soft); border-color: color-mix(in srgb, var(--em) 30%, transparent); }
.callout.merksatz .callout-ic { background: var(--em); color: #fff; }
.callout.falle { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.callout.falle .callout-ic { background: var(--red); color: #fff; }
.callout.vergleich { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.callout.vergleich .callout-ic { background: var(--blue); color: #fff; }
.callout.tip { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.callout.tip .callout-ic { background: var(--gold-2); color: #2b1d02; }
:root[data-theme="dark"] .callout-ic { color: #0e1411 !important; }

.formula { font-family: var(--f-mono); background: var(--bg-2); border: 1px solid var(--line); border-left: 4px solid var(--gold-2); border-radius: 10px; padding: 12px 16px; margin: 12px 0; font-size: .95rem; overflow-x: auto; }
.formula-label { display: block; font-family: var(--f-sans); font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--gold); font-weight: 700; margin-bottom: 4px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg-2); padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td:first-child { font-weight: 600; }
table.t tbody tr:hover td { background: color-mix(in srgb, var(--bg-2) 60%, transparent); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: var(--radius); }
.loading-screen { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 30px; }
.loading-screen .spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--em); animation: spin 1s linear infinite; margin: 0 auto 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .9rem; font-weight: 500; animation: toastIn .25s ease both; max-width: min(92vw, 520px); }
.toast.ok { background: var(--em); color: #fff; }
.toast.warn { background: var(--amber); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.modal-back { position: fixed; inset: 0; background: rgba(10, 16, 13, .45); z-index: 90; display: grid; place-items: center; padding: 18px; animation: viewIn .2s ease both; }
.modal { max-width: 560px; width: 100%; max-height: 88vh; overflow: auto; }

.feedback { border-radius: 12px; padding: 12px 16px; margin-top: 14px; animation: viewIn .25s ease both; font-size: .93rem; }
.feedback.ok { background: var(--em-soft); border: 1px solid color-mix(in srgb, var(--em) 30%, transparent); }
.feedback.bad { background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
.feedback.info { background: var(--bg-2); border: 1px solid var(--line); }
.feedback h4 { font-family: var(--f-sans); font-size: .95rem; margin-bottom: 4px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.pop { animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 50% { transform: scale(1.06); } }

/* ---------- Dashboard ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(20px, 3vw, 34px); display: grid; grid-template-columns: auto 1fr; gap: clamp(18px, 3vw, 40px); align-items: center; }
.hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--em-2) 16%, transparent), transparent 70%); pointer-events: none; }
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-num { font-family: var(--f-serif); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.ring-lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-top: 4px; }
.hero h1 { margin-bottom: 6px; }
.hero-sub { color: var(--muted); margin-bottom: 16px; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.stat-v { font-family: var(--f-serif); font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat-l { font-size: .74rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat .progress { margin-top: 8px; height: 5px; }
.leitner-mini { display: flex; gap: 3px; align-items: flex-end; height: 26px; margin-top: 6px; }
.leitner-mini span { flex: 1; background: var(--em-2); border-radius: 3px 3px 0 0; min-height: 3px; opacity: .85; }

.k-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.k-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; transition: transform .2s, box-shadow .2s; border-top: 4px solid var(--line-2); }
.k-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.k-card.g-aufbauend { border-top-color: var(--em); }
.k-card.g-abbauend { border-top-color: var(--amber); }
.k-card.g-beide { border-top-color: var(--gold-2); }
.k-id { font-family: var(--f-mono); font-weight: 700; font-size: .85rem; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line); }
.k-card.g-aufbauend .k-id { background: var(--em-soft); color: var(--em); border-color: transparent; }
.k-card.g-abbauend .k-id { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.k-card.g-beide .k-id { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.k-title { font-family: var(--f-serif); font-weight: 600; font-size: 1.08rem; line-height: 1.25; }
.k-statement { font-size: .88rem; color: var(--ink-2); font-style: italic; }
.conf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; background: var(--bg-2); border-radius: 10px; border: 1px solid var(--line); }
.conf button { border: 0; background: transparent; border-radius: 7px; padding: 6px 4px; font-size: .76rem; font-weight: 700; color: var(--muted); }
.conf button[data-v="unsicher"].active { background: var(--red-soft); color: var(--red); }
.conf button[data-v="teilweise"].active { background: var(--gold-soft); color: var(--gold); }
.conf button[data-v="sicher"].active { background: var(--em-soft); color: var(--em); }
.k-detail { border-top: 1px dashed var(--line-2); padding-top: 12px; display: none; font-size: .9rem; }
.k-card.open .k-detail { display: block; animation: viewIn .25s ease both; }
.k-detail ul { padding-left: 1.1em; margin: 6px 0 10px; }
.k-jumps { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Learn ---------- */
.learn-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 26px; align-items: start; }
.toc { position: sticky; top: 84px; padding: 10px; max-height: calc(100vh - 110px); overflow-y: auto; }
.toc-item { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; border: 0; background: transparent; text-align: left; border-radius: 10px; color: var(--ink-2); }
.toc-item:hover { background: var(--bg-2); }
.toc-item.active { background: var(--bg-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--em); }
.toc-item .t { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.article { padding: clamp(20px, 3.4vw, 44px); }
.article .lead { font-size: 1.1rem; color: var(--ink-2); font-family: var(--f-serif); line-height: 1.55; border-left: 3px solid var(--gold-2); padding-left: 16px; margin: 14px 0 26px; }
.article section { margin-bottom: 30px; }
.article section h3 { display: flex; align-items: baseline; gap: 10px; }
.article section h3 .num { font-family: var(--f-mono); font-size: .8rem; color: var(--em); }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 .8em; }
.prose li { margin-bottom: .25em; }
.prose { max-width: 75ch; }
.balance-tables.side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.balance-tables table.t { font-size: .84rem; }

/* ---------- Diagram studio ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.dia-stage { padding: 12px; position: relative; }
.dia-svg { width: 100%; height: auto; display: block; user-select: none; -webkit-user-select: none; }
.dia-svg text { font-family: var(--f-sans); }
.dia-svg [data-sid] { cursor: pointer; }
.dia-svg .hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; }
.dia-svg .hitfill { fill: transparent; }
.dia-svg .f, .dia-svg .s, .dia-svg .g { transition: fill .2s, stroke .2s, filter .2s, opacity .2s; }
.dia-svg .f.hl { fill: var(--d-hl) !important; }
.dia-svg .s.hl { stroke: var(--d-hl) !important; }
.dia-svg .g.hl { filter: drop-shadow(0 0 5px var(--d-hl)) drop-shadow(0 0 2px var(--d-hl)); }
.dia-svg.dim .f:not(.hl), .dia-svg.dim .s:not(.hl), .dia-svg.dim .g:not(.hl) { opacity: .55; }
.dia-svg.dim .g.hl .f, .dia-svg.dim .g.hl .s { opacity: 1; }
.pin { cursor: pointer; }
.pin .pin-c { fill: var(--card); stroke: var(--ink); stroke-width: 2; transition: all .15s; }
.pin .pin-n { font-family: var(--f-mono); font-size: 14px; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pin .lbl { font-size: 16px; font-weight: 600; fill: var(--ink-2); }
.pin .lead { stroke: var(--ink-2); stroke-width: 1.3; fill: none; opacity: .75; }
.pin .dot { fill: var(--ink); stroke: var(--card); stroke-width: 1.5; }
.pin:hover .pin-c { stroke: var(--em); stroke-width: 3; }
.pin.active .pin-c { fill: var(--d-hl); stroke: var(--ink); }
.pin.active .lbl { fill: var(--ink); }
.pin.ok .pin-c { fill: var(--em); stroke: var(--em); }
.pin.ok .pin-n { fill: #fff; }
.pin.bad .pin-c { fill: var(--red); stroke: var(--red); }
.pin.bad .pin-n { fill: #fff; }
.dia-svg.test .pin:not(.ok) .lbl { display: none; }
.info-panel { padding: 20px; position: sticky; top: 84px; }
.info-panel h3 { margin-bottom: 4px; }
.info-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); margin: 14px 0 4px; }
.info-panel ul { padding-left: 1.1em; margin: 0; }
.energy-note { background: var(--gold-soft); border-radius: 10px; padding: 10px 12px; font-size: .9rem; border-left: 3px solid var(--gold-2); }
.struct-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.struct-list button { text-align: left; border: 1px solid transparent; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: .86rem; display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.struct-list button:hover { background: var(--bg-2); }
.struct-list button.active { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 30%, transparent); color: var(--ink); }
.struct-list .n { font-family: var(--f-mono); font-size: .72rem; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-3); flex: 0 0 22px; }
.test-target { font-family: var(--f-serif); font-size: 1.3rem; font-weight: 600; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px dashed var(--line-2); text-align: center; margin: 10px 0; }

.draw-wrap { position: relative; border-radius: 12px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); touch-action: none; }
.draw-wrap .ghost { position: absolute; inset: 0; opacity: .15; pointer-events: none; transition: opacity .2s; }
.draw-wrap .ghost svg { width: 100%; height: 100%; }
.draw-wrap canvas { position: relative; display: block; width: 100%; cursor: crosshair; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.tool { border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 6px 10px; font-size: .8rem; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.tool.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line-2); padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--ink); }
.check-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; align-items: start; }
.check-item:hover { background: var(--bg-2); }
.check-item input { margin-top: 4px; accent-color: var(--em); width: 17px; height: 17px; }
.check-item .lbl-t { font-weight: 600; font-size: .9rem; }
.check-item .lbl-d { font-size: .82rem; color: var(--muted); }
.check-item.done .lbl-t { color: var(--em); }

.comp-game { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.comp-q { font-family: var(--f-serif); font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 600; margin: 8px 0 18px; line-height: 1.25; }
.comp-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.opt-btn { border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 13px 14px; text-align: left; font-weight: 600; font-size: .92rem; transition: all .15s; display: flex; gap: 10px; align-items: center; }
.opt-btn:hover:not(:disabled) { border-color: var(--em-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.opt-btn .k { font-family: var(--f-mono); font-size: .72rem; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--bg-2); flex: 0 0 22px; color: var(--muted); }
.opt-btn.correct { border-color: var(--em); background: var(--em-soft); }
.opt-btn.wrong { border-color: var(--red); background: var(--red-soft); }
.opt-btn:disabled { cursor: default; }
.opt-btn.dimmed { opacity: .55; }
.streak { font-family: var(--f-serif); font-size: 2rem; font-weight: 700; color: var(--gold); line-height: 1; }
.mini-org { width: 100%; height: auto; }

/* ---------- Photosynthesis lab ---------- */
.zs-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.zs-svg { width: 100%; height: auto; display: block; }
.zs-svg text { font-family: var(--f-sans); }
.zs-svg .cx { cursor: pointer; }
.zs-svg .cx:hover > :first-child { filter: brightness(1.08); stroke-width: 3; }
.zs-svg .cx.sel > :first-child { stroke: var(--d-hl); stroke-width: 4; }
.zs-svg .lightray { transition: opacity .6s; }
.gauge { margin: 10px 0; }
.gauge-h { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.mode-text { font-size: .9rem; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

.calvin-wrap { display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 1fr); gap: 22px; align-items: start; }
.calvin-svg { width: 100%; height: auto; }
.calvin-svg .ph { cursor: pointer; transition: opacity .2s, stroke-width .2s; }
.calvin-svg .ph:hover { stroke-width: 26; }
.calvin-svg.has-sel .ph:not(.sel) { opacity: .35; }
.counter-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.counter { text-align: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; }
.counter b { display: block; font-family: var(--f-serif); font-size: 1.35rem; line-height: 1.1; }
.counter span { font-size: .68rem; color: var(--muted); font-weight: 600; }
.cloze { line-height: 2.3; font-size: 1rem; }
.cloze-in { display: inline-flex; align-items: center; gap: 2px; vertical-align: baseline; }
.cloze input { border: 0; border-bottom: 2px solid var(--line-2); background: var(--bg-2); border-radius: 6px 6px 0 0; padding: 2px 8px; min-width: 90px; font-family: var(--f-mono); font-size: .9rem; transition: all .15s; }
.cloze input:focus { outline: none; border-bottom-color: var(--em); background: var(--em-soft); }
.cloze input.ok { border-bottom-color: var(--em); background: var(--em-soft); color: var(--em); font-weight: 600; }
.cloze input.bad { border-bottom-color: var(--red); background: var(--red-soft); }
.cloze .hint-btn { border: 0; background: transparent; color: var(--gold); font-weight: 800; padding: 0 4px; font-size: .85rem; }
.cloze-hint { display: block; font-size: .8rem; color: var(--gold); line-height: 1.4; margin: -4px 0 6px; }

.eq-zone { min-height: 64px; border: 2px dashed var(--line-2); border-radius: 12px; padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; align-content: center; transition: all .15s; background: var(--bg-2); }
.eq-zone.target { border-color: var(--em); background: var(--em-soft); }
.eq-zone.ok { border-style: solid; border-color: var(--em); }
.eq-zone.bad { border-style: solid; border-color: var(--red); }
.eq-board { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center; }
.eq-arrow { text-align: center; font-family: var(--f-mono); color: var(--ink-2); }
.eq-arrow .a { font-size: 1.8rem; line-height: 1; }
.eq-arrow .l { font-size: .72rem; color: var(--gold); font-weight: 700; max-width: 130px; }
.eq-chip { font-family: var(--f-mono); font-size: .95rem; font-weight: 600; border: 1.5px solid var(--line-2); background: var(--card); border-radius: 9px; padding: 7px 12px; transition: transform .12s, border-color .12s; box-shadow: var(--shadow-sm); }
.eq-chip:hover { transform: translateY(-2px); border-color: var(--em); }
.eq-zone .eq-chip { border-color: var(--em-2); }
.eq-pool { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); min-height: 60px; }
.zone-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); margin-bottom: 6px; }

/* ---------- Abiotic ---------- */
.ab-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.graph-svg { width: 100%; height: auto; display: block; }
.graph-svg text { font-family: var(--f-sans); fill: var(--muted); font-size: 12px; }
.graph-svg .axis { stroke: var(--ink-2); stroke-width: 1.5; }
.graph-svg .gridl { stroke: var(--line); stroke-width: 1; }
.graph-svg .zero { stroke: var(--ink-2); stroke-dasharray: 5 4; opacity: .6; }
.graph-svg .curve { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.graph-svg .curve.primary { stroke: var(--em); }
.graph-svg .curve.secondary { stroke: var(--amber); stroke-dasharray: 8 6; }
.graph-svg .ann { cursor: pointer; }
.graph-svg .ann circle { fill: var(--gold-2); stroke: var(--card); stroke-width: 2.5; transition: r .15s; }
.graph-svg .ann text { fill: #2b1d02; font-weight: 800; font-size: 11px; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.graph-svg .ann:hover circle, .graph-svg .ann.active circle { r: 13; }
.graph-svg .ann.active circle { fill: var(--amber); }
.sim { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.slider { margin-bottom: 16px; }
.slider-h { display: flex; justify-content: space-between; align-items: baseline; font-size: .88rem; font-weight: 600; }
.slider-h output { font-family: var(--f-mono); color: var(--em); font-size: .9rem; }
.slider input[type="range"] { width: 100%; accent-color: var(--em); margin: 6px 0 0; }
.slider.limiting .slider-h span::after { content: " · limitierend"; color: var(--red); font-size: .74rem; font-weight: 700; }
.rate-big { font-family: var(--f-serif); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.rate-big.neg { color: var(--red); }
.stoma-svg { width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto; }
.stoma-svg .gc { transition: transform .6s cubic-bezier(.3, .8, .3, 1); }
.warn-box { background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-size: .88rem; margin-top: 10px; animation: viewIn .3s ease both; }
.lim-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-weight: 700; font-size: .85rem; }

/* ---------- Practice ---------- */
.fc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.flip { perspective: 1400px; }
.flip-inner { position: relative; min-height: 340px; transition: transform .6s cubic-bezier(.3, .8, .25, 1); transform-style: preserve-3d; cursor: pointer; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: clamp(20px, 3vw, 34px); display: flex; flex-direction: column; overflow-y: auto; }
.face.back { transform: rotateY(180deg); background: var(--paper); }
.face .q { font-family: var(--f-serif); font-size: clamp(1.25rem, 2.3vw, 1.6rem); font-weight: 600; line-height: 1.3; margin: auto 0; text-align: center; padding: 10px 0; }
.face-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.face-foot { margin-top: auto; text-align: center; font-size: .8rem; color: var(--muted); }
.rate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.rate-row .btn { flex-direction: column; gap: 0; padding: 9px 6px; }
.rate-row .btn small { font-weight: 500; font-size: .7rem; color: var(--muted); }
.box-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: end; height: 90px; margin: 10px 0 4px; }
.box-bars div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: .72rem; color: var(--muted); font-weight: 600; }
.box-bars span { width: 100%; border-radius: 6px 6px 0 0; background: var(--em-2); min-height: 4px; transition: height .4s; }

.quiz-opt { width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 13px 15px; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; transition: all .15s; margin-bottom: 9px; font-size: .95rem; }
.quiz-opt:hover:not(:disabled) { border-color: var(--em-2); box-shadow: var(--shadow-sm); }
.quiz-opt .k { font-family: var(--f-mono); font-weight: 700; font-size: .78rem; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-2); }
.quiz-opt.correct { border-color: var(--em); background: var(--em-soft); }
.quiz-opt.correct .k { background: var(--em); color: #fff; }
.quiz-opt.wrong { border-color: var(--red); background: var(--red-soft); }
.quiz-opt.wrong .k { background: var(--red); color: #fff; }
.quiz-opt:disabled { cursor: default; }
.quiz-q { font-family: var(--f-serif); font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 600; line-height: 1.35; margin: 12px 0 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select { border: 1px solid var(--line-2); background: var(--card); border-radius: 9px; padding: 7px 10px; font-size: .86rem; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-size: .86rem; font-weight: 600; cursor: pointer; }
.switch input { accent-color: var(--red); width: 16px; height: 16px; }

.worksheet {
  position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
  padding: 34px clamp(18px, 4vw, 48px) 34px clamp(46px, 7vw, 86px);
  font-family: var(--f-serif); font-size: 1.08rem;
}
.ws-body { line-height: 34px; background-image: linear-gradient(to bottom, transparent 32px, var(--paper-line) 32px, var(--paper-line) 33px, transparent 33px); background-size: 100% 34px; }
.worksheet::before { content: ""; position: absolute; top: 0; bottom: 0; left: clamp(32px, 5vw, 64px); width: 2px; background: var(--paper-margin); opacity: .7; }
.ws-head { font-family: var(--f-sans); line-height: 1.4; margin-bottom: 20px; }
.ws-head h3 { font-family: var(--f-serif); margin-bottom: 2px; }
.w { cursor: pointer; border-radius: 4px; transition: background .12s; padding: 1px 0; }
.w:hover { background: color-mix(in srgb, var(--gold-2) 28%, transparent); }
.w.miss { background: color-mix(in srgb, var(--gold-2) 18%, transparent); }
.err-found { background: color-mix(in srgb, var(--em-2) 20%, transparent); border-radius: 4px; padding: 1px 3px; text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; cursor: pointer; }
.err-found + .corr { font-family: var(--f-sans); font-size: .82rem; font-weight: 700; color: var(--em); background: var(--em-soft); border-radius: 5px; padding: 2px 6px; margin-left: 4px; }
.err-reveal { background: color-mix(in srgb, var(--red) 16%, transparent); border-radius: 4px; padding: 1px 3px; box-shadow: inset 0 -2px 0 var(--red); }
.err-hint { box-shadow: inset 0 -3px 0 var(--gold-2); animation: pulse 1.2s ease 3; }
@keyframes pulse { 50% { background: color-mix(in srgb, var(--gold-2) 30%, transparent); } }
.drawer { position: sticky; top: 84px; }
.drawer-card { padding: 18px; animation: viewIn .25s ease both; }
.strike { text-decoration: line-through; color: var(--red); }

/* ---------- Exam ---------- */
.op-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.op-name { font-family: var(--f-serif); font-size: 1.15rem; font-weight: 600; }
.starter { font-size: .84rem; font-family: var(--f-serif); font-style: italic; border: 1px dashed var(--line-2); background: var(--bg-2); border-radius: 8px; padding: 5px 10px; text-align: left; }
.starter:hover { border-color: var(--em); background: var(--em-soft); }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vs > div { border-radius: 10px; padding: 10px 12px; font-size: .86rem; }
.vs .good { background: var(--em-soft); border-left: 3px solid var(--em); }
.vs .bad { background: var(--red-soft); border-left: 3px solid var(--red); }
.vs h5 { margin: 0 0 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.vs .good h5 { color: var(--em); }
.vs .bad h5 { color: var(--red); }
.exam-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; position: sticky; top: 72px; z-index: 10; margin-bottom: 18px; }
.clock { font-family: var(--f-mono); font-size: 1.8rem; font-weight: 700; letter-spacing: .02em; }
.clock.low { color: var(--red); }
.material { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 10px; padding: 16px 18px; margin: 14px 0 20px; }
.material-t { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--blue); margin-bottom: 6px; }
.subtask { border-top: 1px solid var(--line); padding: 18px 0; }
.subtask-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.subtask-h .lab { font-family: var(--f-mono); font-weight: 700; }
.subtask-h .pts { margin-left: auto; font-family: var(--f-mono); font-size: .85rem; color: var(--muted); white-space: nowrap; }
.op-tag { font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; color: var(--em); border-bottom: 2px dotted var(--em); cursor: help; }
textarea.answer { width: 100%; min-height: 140px; resize: vertical; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; background: var(--paper); line-height: 1.65; font-size: .95rem; margin-top: 10px; }
textarea.answer:focus { outline: none; border-color: var(--em); box-shadow: 0 0 0 3px var(--em-soft); }
textarea.answer[readonly] { opacity: .85; }
.model { background: var(--em-soft); border-radius: 10px; padding: 12px 14px; margin-top: 12px; font-size: .92rem; }
.rubric { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rubric label { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .88rem; align-items: start; }
.rubric label:last-child { border-bottom: 0; }
.rubric label:hover { background: var(--bg-2); }
.rubric input { accent-color: var(--em); width: 16px; height: 16px; margin-top: 3px; }
.rubric .p { font-family: var(--f-mono); font-weight: 700; color: var(--em); }
.task-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.task-tab { border: 1px solid var(--line); background: var(--card); border-radius: 11px; padding: 8px 14px; text-align: left; font-size: .84rem; }
.task-tab b { display: block; font-size: .9rem; }
.task-tab.active { border-color: var(--em); box-shadow: 0 0 0 2px var(--em-soft); }
.task-tab .done-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--em); margin-left: 6px; vertical-align: 1px; }
.grade-card { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.np { font-family: var(--f-serif); font-size: 3.4rem; font-weight: 700; line-height: 1; color: var(--em); }
.np small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.comp-bars { display: grid; gap: 7px; }
.comp-bar { display: grid; grid-template-columns: 40px 1fr 64px; gap: 10px; align-items: center; font-size: .82rem; }
.comp-bar b { font-family: var(--f-mono); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .studio, .zs-wrap, .comp-game, .fc-layout { grid-template-columns: minmax(0, 1fr); }
  .info-panel, .drawer { position: static; }
  .calvin-wrap { grid-template-columns: minmax(0, 1fr); }
  .calvin-svg { max-width: 520px; margin: 0 auto; display: block; }
  .ab-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 920px) {
  .app, .app.collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 284px; transform: translateX(-105%); transition: transform .28s ease; box-shadow: var(--shadow-lg); }
  .app.mobile-open .sidebar { transform: none; }
  .app.mobile-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 16, 13, .4); z-index: 35; }
  .app.collapsed .brand-text, .app.collapsed .nav-text, .app.collapsed .nav-key, .app.collapsed .sidebar-foot .hide-collapsed { display: revert; }
  .app.collapsed .nav-item { justify-content: flex-start; }
  .collapse-btn { display: none !important; }
  .menu-btn { display: grid; }
  .learn-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; display: flex; overflow-x: auto; gap: 4px; }
  .toc-item { flex: 0 0 auto; width: auto; max-width: 240px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; justify-items: start; }
  .balance-tables.side, .g2, .g3, .sim { grid-template-columns: minmax(0, 1fr); }
  .exam-bar { top: 64px; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  .vs { grid-template-columns: 1fr; }
  .eq-board { grid-template-columns: 1fr; }
  .eq-arrow .a { transform: rotate(90deg); display: inline-block; }
  .counter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rate-row { grid-template-columns: repeat(2, 1fr); }
  .grade-card { grid-template-columns: 1fr; }
  .ring { width: 140px; height: 140px; }
  .topbar-h { font-size: 1rem; }
  .worksheet { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .exam-bar .row { display: none !important; }
  .app { grid-template-columns: 1fr; }
}
