/* Übungsraum design system (SPEC D15: calm & focused).
   One accent colour, paper-like background, serif headings, 44 px touch targets,
   16 px inputs (no iOS zoom). Fonts are self-hosted (no third-party requests). */

@font-face {
  font-family: "Source Serif 4";
  src: url("../vendor/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../vendor/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --paper: #faf8f3;
  --surface: #ffffff;
  --sunken: #f3f0e8;
  --ink: #1d1f23;
  --muted: #5f6672;
  --faint: #8b919b;
  --line: #e4dfd4;
  --accent: #284b9b;
  --accent-ink: #ffffff;
  --accent-soft: #e8edf8;
  --ok: #2e7d4f;
  --ok-soft: #e6f2ea;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --error: #b3261e;
  --error-soft: #fbe9e7;
  --focus: #284b9b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(29, 31, 35, 0.05), 0 4px 16px rgba(29, 31, 35, 0.05);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --tap: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15171a;
    --surface: #1c1f23;
    --sunken: #23272c;
    --ink: #ecebe7;
    --muted: #a8aeb7;
    --faint: #7d848e;
    --line: #30343a;
    --accent: #93acee;
    --accent-ink: #10131a;
    --accent-soft: #232c40;
    --ok: #7cc79a;
    --ok-soft: #1e2d24;
    --warn: #e2b55a;
    --warn-soft: #2f281a;
    --error: #f2948b;
    --error-soft: #34211f;
    --focus: #93acee;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
/* Theme switch (SPEC D53, 2026-10-25): Konto › Darstellung sets data-theme on <html>. */
:root[data-theme="dark"] {
    --paper: #15171a;
    --surface: #1c1f23;
    --sunken: #23272c;
    --ink: #ecebe7;
    --muted: #a8aeb7;
    --faint: #7d848e;
    --line: #30343a;
    --accent: #93acee;
    --accent-ink: #10131a;
    --accent-soft: #232c40;
    --ok: #7cc79a;
    --ok-soft: #1e2d24;
    --warn: #e2b55a;
    --warn-soft: #2f281a;
    --error: #f2948b;
    --error-soft: #34211f;
    --focus: #93acee;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* --- base ------------------------------------------------------------------ */
* { box-sizing: border-box; }
/* Display rules must never un-hide hidden elements. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.65rem, 1.2rem + 2vw, 2.3rem); margin: 0.6rem 0 0.8rem; }
h2 { font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.45rem); margin: 1.4rem 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 1rem 0 0.4rem; }
p { margin: 0.5rem 0; }
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code { font: 0.9em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- layout ----------------------------------------------------------------- */
main { max-width: 46rem; margin: 0 auto; padding: 1rem 16px 3rem; }
main.wide { max-width: 72rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* --- header ----------------------------------------------------------------- */
.site-header {
  display: flex; align-items: center; gap: 0.5rem; padding: 0 16px; min-height: 60px;
  border-bottom: 1px solid var(--line); background: var(--paper);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem; min-height: var(--tap); min-width: var(--tap);
  font-family: var(--serif); font-weight: 650; font-size: 1.2rem; color: var(--ink); text-decoration: none;
}
.brand svg { flex: none; }
.site-header nav { margin-left: auto; display: flex; align-items: center; gap: 0.15rem; }
.nav-link {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 0.7rem;
  border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--sunken); }
.nav-link[aria-current="page"] { color: var(--accent); }
.who { color: var(--muted); font-size: 0.85rem; padding: 0 0.4rem; }
@media (max-width: 640px) { .who { display: none; } .nav-link { padding: 0 0.55rem; } }
/* Narrow phones: logo mark only (the name stays available to screen readers). */
@media (max-width: 420px) {
  .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .site-header { gap: 0.25rem; }
}

/* --- breadcrumb / back ------------------------------------------------------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.3rem; margin: 0.4rem 0 0.2rem; font-size: 0.92rem; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); min-width: var(--tap); color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { color: var(--faint); }

/* --- buttons ------------------------------------------------------------------ */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: var(--tap); padding: 0.55rem 1.05rem; border-radius: var(--radius-sm);
  font: 600 1rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
button:hover, .btn:hover { border-color: var(--faint); }
button:disabled { opacity: 0.45; cursor: default; }
.btn-primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover, button.primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-quiet, button.secondary { background: transparent; color: var(--accent); border-color: transparent; }
.btn-quiet:hover, button.secondary:hover { background: var(--accent-soft); }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0.7rem 1.4rem; }
button.link { background: none; border: 0; color: var(--accent); padding: 0 0.6rem; font-weight: 500; }
form.inline { display: inline; }

/* --- cards, badges --------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.15rem; box-shadow: var(--shadow); margin: 1rem 0;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0.1rem; }
.card-label { font: 600 0.78rem/1 var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; background: var(--sunken); color: var(--muted); white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn, .badge-unsure { background: var(--warn-soft); color: var(--warn); }
.badge-error, .badge-unreadable { background: var(--error-soft); color: var(--error); }
.badge-final { background: var(--accent); color: var(--accent-ink); }
.flash { padding: 0.75rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); margin: 0.8rem 0; }
.flash.error, .error-box { background: var(--error-soft); color: var(--error); }
.error { color: var(--error); }
.ok { color: var(--ok); }

/* --- forms --------------------------------------------------------------------------- */
label { display: block; font-weight: 500; margin-bottom: 0.3rem; }
input[type=email], input[type=text], input[type=password], textarea {
  width: 100%; font: 16px/1.5 var(--font); padding: 0.7rem 0.8rem; margin-bottom: 0.6rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
input:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
textarea, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; }

/* --- math ------------------------------------------------------------------------------- */
.katex { font-size: 1.08em; }
.step-math, .math.block, .statement .katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.statement { white-space: pre-line; font-size: 1.05rem; }
.statement.markdown { white-space: normal; }
.statement.markdown > :first-child { margin-top: 0; }
.statement.markdown > :last-child { margin-bottom: 0; }
.statement.markdown table { border-collapse: collapse; margin: 0.6rem 0; }
.statement.markdown th, .statement.markdown td { border: 1px solid var(--line); padding: 0.25rem 0.7rem; text-align: center; }

/* --- dev / status ---------------------------------------------------------------------------- */
.draft-banner { margin: 0.6rem 0; padding: 0.45rem 0.8rem; border-radius: var(--radius-sm); background: var(--error-soft); color: var(--error); font-size: 0.85rem; font-weight: 600; }
.dev-banner { margin: 0.6rem 0; padding: 0.45rem 0.8rem; border-radius: var(--radius-sm); background: var(--sunken); color: var(--muted); font-size: 0.85rem; }
.dev-meta { color: var(--muted); font-size: 0.9rem; }
.dev-errors code, .dev-meta code { overflow-wrap: anywhere; }
.status { font-size: 0.78rem; padding: 0.1rem 0.45rem; border-radius: 6px; border: 1px solid var(--line); }
.status-draft { color: var(--error); border-color: currentColor; }
.status-verified { color: var(--ok); border-color: currentColor; }

/* --- landing ------------------------------------------------------------------------------------- */
.hero { padding: 1.5rem 0 0.5rem; }
.hero h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3rem); max-width: 18ch; margin-bottom: 0.6rem; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 38ch; }
.hero .row { margin-top: 1.2rem; }
.steps-how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; margin: 2rem 0; padding: 0; list-style: none; counter-reset: how; }
@media (max-width: 760px) { .steps-how { grid-template-columns: 1fr; } }
.steps-how li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.steps-how .icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 0.5rem; }
.steps-how h3 { margin: 0.2rem 0; }
.steps-how p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.demo { border-left: 4px solid var(--error); }
.demo .demo-step { padding: 0.3rem 0.6rem; border-radius: 6px; }
.demo .demo-step.bad { background: var(--error-soft); }
.demo .demo-hint { margin-top: 0.6rem; padding: 0.7rem 0.8rem; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 0.95rem; }
.free-note { display: flex; gap: 0.6rem; align-items: center; color: var(--muted); font-size: 0.95rem; }

/* --- courses -------------------------------------------------------------------------------------- */
.course-card { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: inherit; }
.course-card:hover { border-color: var(--faint); }
.course-card h2 { margin: 0; }
.topic { margin: 1.2rem 0; }
.topic-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0.4rem 0.8rem; margin-bottom: 0.4rem; }
.topic-head h2 { margin: 0; }
/* Bar and percentage stay together; a long title wraps in its own column. */
.topic-meter { display: flex; align-items: center; gap: 0.6rem; white-space: nowrap; }
.progress { position: relative; height: 8px; width: 9rem; background: var(--sunken); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.progress-label { font-size: 0.85rem; color: var(--muted); min-width: 4.5ch; text-align: right; }
.ex-rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ex-rows li + li { border-top: 1px solid var(--line); }
.ex-row { display: flex; align-items: center; gap: 0.8rem; min-height: 60px; padding: 0.6rem 1rem; color: inherit; text-decoration: none; }
.ex-row:hover { background: var(--sunken); }
.ex-row .ex-title { font-weight: 600; }
.ex-row .ex-meta { font-size: 0.85rem; color: var(--muted); }
.ex-row .ex-main { flex: 1; min-width: 0; }
.ex-state { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); color: var(--faint); }
.ex-state.done { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.ex-state.tried { border-color: var(--warn); color: var(--warn); }
.chev { color: var(--faint); flex: none; }

/* --- exercise page ---------------------------------------------------------------------------------- */
.ex-header h1 { margin-bottom: 0.2rem; }
.ex-header .ex-meta { color: var(--muted); font-size: 0.92rem; }
.howto { position: relative; border-color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.howto ol { margin: 0.4rem 0 0.2rem; padding-left: 1.3rem; }
.howto li { margin: 0.2rem 0; }
.howto .close { position: absolute; top: 0.4rem; right: 0.4rem; background: transparent; border: 0; color: var(--muted); }
.quota { color: var(--muted); font-size: 0.92rem; margin: 0.4rem 0; }
.mode-tabs { display: inline-flex; gap: 0; padding: 4px; margin: 0.8rem 0 0.4rem; background: var(--sunken); border-radius: 10px; border: 1px solid var(--line); }
.mode-tabs button { border: 0; background: transparent; color: var(--muted); min-height: var(--tap); padding: 0.4rem 1.1rem; }
.mode-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
/* Both tool rows stay visible while writing (zoom % must always be visible). */
.tool-dock { position: sticky; top: calc(60px + var(--dock-h, 0px)); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); margin-bottom: 0.6rem; }
.toolbar {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0; flex-wrap: nowrap; overflow-x: auto;
}
.tool { min-width: var(--tap); padding: 0.4rem 0.6rem; }
.tool .tool-label { font-weight: 500; }
.tool[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0.3rem 0.15rem; flex: none; }
.toolbar .spacer { flex: 1 0 0.4rem; }
.toolbar .submit { flex: none; }
@media (max-width: 760px) { .tool .tool-label { display: none; } }
.input-hint { color: var(--muted); font-size: 0.9rem; margin: 0.2rem 0 0.6rem; }
/* The paper stays white in dark mode: the exported PNG is black on white. */
.canvas-wrap { border: 1px solid var(--line); border-radius: var(--radius); background-color: #fff; }
#canvas { display: block; width: 100%; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#canvas.eraser { cursor: none; }
.eraser-ring { position: absolute; left: 0; top: 0; z-index: 1; border-radius: 50%; pointer-events: none; box-sizing: border-box;
  border: 1.5px solid rgba(60, 70, 90, 0.75); background: rgba(255, 255, 255, 0.35); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8); }
.eraser-ring.is-active { border-color: #c62828; background: rgba(198, 40, 40, 0.12); }
#canvas.pen { cursor: crosshair; }
#canvas.lasso { cursor: default; }
.result-only { margin: 0.8rem 0; }

/* keyboard */
.kbd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 760px) { .kbd-grid { grid-template-columns: 1fr; } }
textarea { resize: vertical; line-height: 1.6; }
.preview-label { margin: 0 0 0.25rem; font-weight: 500; }
.kbd-preview { min-height: 4rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 0.5rem 0.5rem 0.5rem 2rem; margin: 0; background: var(--surface); }
.kbd-preview .katex-error { color: var(--error); }
.cheatsheet { margin-top: 0.4rem; font-size: 0.9rem; }
.cheatsheet summary { cursor: pointer; color: var(--accent); min-height: var(--tap); display: flex; align-items: center; }
.cheatsheet table { border-collapse: collapse; }
.cheatsheet td { padding: 0.2rem 0.6rem 0.2rem 0; }

/* --- steps (shared) -------------------------------------------------------------------------------------- */
.steps { padding-left: 1.6rem; margin: 0.4rem 0; }
.steps > li { margin-bottom: 0.5rem; min-width: 0; }
.step-note { color: var(--muted); font-size: 0.92rem; }
.submission-image { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }

/* --- reading / confirmation --------------------------------------------------------------------------------- */
.reading { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.spinner { width: 1.1rem; height: 1.1rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.confirm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .confirm-grid { grid-template-columns: minmax(0, 1fr); } }
.confirm-grid > * { min-width: 0; }
.confirm-image { position: sticky; top: 72px; }
@media (max-width: 900px) { .confirm-image { position: static; } }
.confirm-steps > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.9rem 0.6rem; margin-bottom: 0.7rem; }
.confirm-steps > li.legibility-unsure { border-color: var(--warn); }
.confirm-steps > li.legibility-unreadable { border-color: var(--error); }
.step-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.1rem 0; }
.fix summary { cursor: pointer; color: var(--accent); min-height: var(--tap); display: inline-flex; align-items: center; font-weight: 500; }
.fix form, .fix .rewrite { margin: 0.6rem 0; }
.fix input[type=text] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.latex-preview:empty { display: none; }
.rewrite .canvas-wrap { margin: 0.5rem 0; }
.rewrite .rewrite-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.confirm-form { margin: 1rem 0; }

/* --- feedback ---------------------------------------------------------------------------------------------------- */
.verdict { border-radius: var(--radius); padding: 0.9rem 1.15rem; margin: 1rem 0; border: 1px solid var(--line); background: var(--surface); }
.verdict h1 { margin: 0 0 0.2rem; font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2rem); }
.verdict-correct { border-color: var(--ok); background: var(--ok-soft); }
.verdict-partially_correct { border-color: var(--warn); background: var(--warn-soft); }
.verdict-incorrect { border-color: var(--error); background: var(--error-soft); }
.score { margin: 0.1rem 0; font-size: 1.05rem; }
.unsure-note { display: inline-flex; margin-top: 0.4rem; white-space: normal; }
.feedback-steps > li { border-left: 4px solid transparent; padding: 0.2rem 0 0.2rem 0.7rem; margin-bottom: 0.4rem; }
.feedback-steps > li.step-ok { border-left-color: var(--ok); }
.feedback-steps > li.step-error { border-left-color: var(--error); background: var(--error-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.feedback-steps > li.step-later { color: var(--muted); }
.feedback-steps > li.step-later .katex { opacity: 0.6; }
.step-error-note { color: var(--error); font-weight: 600; }
.hint { border-color: var(--accent); }
.correction > summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: var(--tap); display: flex; align-items: center; list-style-position: inside; }
.markdown { overflow-x: auto; }
.markdown p:first-child { margin-top: 0.3rem; }
.actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 1.2rem 0; }
.original summary { cursor: pointer; color: var(--accent); min-height: var(--tap); display: inline-flex; align-items: center; }
.rubric { border-collapse: collapse; width: 100%; }
.rubric td { border-top: 1px solid var(--line); padding: 0.55rem 0.3rem; vertical-align: top; }
.rubric .pts { text-align: right; white-space: nowrap; font-weight: 600; }

/* --- lists (my submissions) --------------------------------------------------------------------------------------- */
.sub-rows { list-style: none; padding: 0; margin: 0; }
.sub-row { display: flex; align-items: center; gap: 0.8rem; min-height: 56px; padding: 0.5rem 0.9rem; text-decoration: none; color: inherit; }
.sub-row:hover { background: var(--sunken); }

/* --- empty / error pages ------------------------------------------------------------------------------------------- */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty h1 { color: var(--ink); }

/* --- dev preview (exercise authoring) ---------------------------------------------------------------------------------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.checks { list-style: none; padding: 0; }
.ex-list li { margin: 0.3rem 0; }
.ex-list .meta { color: var(--muted); font-size: 0.9rem; }
.options .correct { font-weight: 600; }

/* --- narrow phones --------------------------------------------------------------------------------- */
@media (max-width: 520px) {
  /* Toolbar: icons only, tight, so "Einreichen" always fits on the same row. */
  .toolbar { gap: 0.2rem; overflow: visible; }
  .toolbar .sep { display: none; }
  .tool { padding: 0.4rem; min-width: var(--tap); }
  .toolbar .submit { padding: 0.5rem 0.8rem; }
  /* Topic heading on its own line, progress bar and percentage below. */
  .topic-head { grid-template-columns: 1fr; }
  .topic-head .progress { flex: 1 1 auto; width: auto; }
}
@media (max-width: 430px) {
  /* Six tools + "Einreichen" on a 390 px phone: slightly narrower buttons; if it still
     doesn't fit, "Einreichen" wraps to the right of the next row instead of being cut. */
  .toolbar { flex-wrap: wrap; }
  .toolbar { gap: 0.15rem; }
  .toolbar > .tool { min-width: 2.35rem; padding: 0.3rem; }
  .toolbar .spacer { flex: 1 0 0; }
  .toolbar .submit { margin-left: auto; padding: 0.5rem 0.55rem; }
}
@media (max-width: 360px) {
  .toolbar { flex-wrap: wrap; }
  .toolbar .spacer { display: none; }
  .toolbar .submit { flex: 1 1 100%; }
}

/* --- pen options, paper, zoom ---------------------------------------------------------------------- */
.pen-options { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.8rem; padding: 0.1rem 0 0.6rem; }
.opt-group { display: inline-flex; align-items: center; gap: 0.2rem; }
.swatch, .width-btn { min-width: var(--tap); min-height: var(--tap); padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; }
.swatch span { display: block; width: 22px; height: 22px; border-radius: 50%; }
.width-btn span { display: block; border-radius: 50%; background: var(--ink); }
.swatch[aria-pressed="true"], .width-btn[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.paper-select select {
  min-height: var(--tap); font: 500 16px var(--font); padding: 0 0.6rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.zoom-label { min-width: 4.6rem; font-variant-numeric: tabular-nums; }
.zoom-group .tool { font-size: 1.3rem; font-weight: 500; }
.clear-btn { margin-left: auto; }
/* Tablet portrait: pen options in one row, so the writing pad starts closer to the question. */
@media (max-width: 1000px) {
  .pen-options { gap: 0.3rem 0.3rem; }
  .pen-options .opt-group { gap: 0.1rem; }
  .paper-select select { padding: 0 0.3rem; }
  .clear-btn .tool-label { display: none; }
  .zoom-label { min-width: 3.4rem; padding-inline: 0.2rem; }
  .pen-options .swatch, .pen-options .width-btn, .pen-options .tool { min-width: 40px; min-height: 40px; }
}
.canvas-wrap { overflow-x: auto; overflow-y: hidden; background: none; -webkit-overflow-scrolling: touch; }
/* Paper patterns live on the canvas itself, so they scroll and zoom with the writing. */
/* The sheet has the full page size and carries the paper; the canvas covers only the
   visible part of it (canvas.js, SPEC D26). */
.pad-sheet { position: relative; background-color: #fff; background-size: var(--grid, 24px) var(--grid, 24px); }
.pad-sheet > canvas { position: absolute; left: 0; top: 0; display: block; }
.pad-sheet.paper-grid { background-image: linear-gradient(#e6ecf3 1px, transparent 1px), linear-gradient(90deg, #e6ecf3 1px, transparent 1px); }
.pad-sheet.paper-lines { background-image: linear-gradient(transparent calc(var(--grid, 24px) - 1px), #dfe6ef calc(var(--grid, 24px) - 1px)); }
.pad-sheet.paper-dots { background-image: radial-gradient(circle, #c3ccd8 1.1px, transparent 1.3px); background-position: calc(var(--grid, 24px) / -2) calc(var(--grid, 24px) / -2); }
.pad-sheet.paper-blank { background-image: none; }
@media (max-width: 520px) { .pen-options { gap: 0.3rem 0.5rem; } .clear-btn { margin-left: 0; } }

/* --- quizzes (single choice, Kprim) and theory ---------------------------------------------------- */
.choices { border: 0; padding: 0; margin: 0.8rem 0; display: grid; gap: 0.5rem; }
.choice {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.3rem 0.8rem;
  min-height: 56px; padding: 0.6rem 0.9rem; margin: 0; font-weight: 400;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.choice:hover { border-color: var(--faint); }
.choice input { width: 22px; height: 22px; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
/* After answering, right/wrong must win over the "selected" style. */
.choice.is-right, .choice.is-right:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); }
.choice.is-wrong, .choice.is-wrong:has(input:checked) { border-color: var(--error); background: var(--error-soft); }
.choice-text { min-width: 0; overflow-x: auto; overflow-y: hidden; padding-block: 0.15em; }
.choice-expl { grid-column: 2 / -1; color: var(--muted); font-size: 0.92rem; display: block; }
.kprim { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0.8rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kprim th { text-align: left; font-size: 0.85rem; color: var(--muted); font-weight: 600; padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--line); }
.kprim th:not(:first-child) { text-align: center; width: 4.2rem; }
.kprim td { padding: 0.6rem 0.8rem; border-top: 1px solid var(--line); vertical-align: middle; }
.kprim tr:first-child td { border-top: 0; }
.kprim td.tf { text-align: center; }
.kprim td.tf label { display: inline-grid; place-items: center; min-width: var(--tap); min-height: var(--tap); margin: 0; cursor: pointer; }
.kprim input { width: 22px; height: 22px; accent-color: var(--accent); }
.kprim tr.is-right td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.kprim tr.is-wrong td:first-child { box-shadow: inset 4px 0 0 var(--error); }
.kprim-text { display: block; overflow-x: auto; overflow-y: hidden; padding-block: 0.15em; }
.kprim-result { display: block; font-size: 0.92rem; margin-top: 0.3rem; }
.verdict-title { margin: 0 0 0.2rem; font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.8rem); }
.ex-state.theory { border-color: var(--accent); color: var(--accent); }

/* --- figures (SPEC D17) ----------------------------------------------------- */
.ex-figure { margin: 1rem 0 0.2rem; }
.figure { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; font-family: var(--font); }
.fig-grid { stroke: var(--line); stroke-width: 1; }
.fig-axis { stroke: var(--muted); stroke-width: 1.4; }
.fig-arrow { fill: var(--muted); }
.fig-tick { fill: var(--muted); font-size: 12px; }
.fig-axis-label { fill: var(--muted); font-size: 13px; font-style: italic; }
.fig-curve { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.fig-curve-0 { stroke: var(--accent); }
.fig-curve-1 { stroke: var(--error); }
.fig-curve-2 { stroke: var(--ok); }
.fig-dashed { stroke-dasharray: 7 5; }
.fig-label { font-size: 14px; font-style: italic; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.fig-label-0 { fill: var(--accent); }
.fig-label-1 { fill: var(--error); }
.fig-label-2 { fill: var(--ok); }
.fig-point { fill: var(--accent); stroke: var(--accent); stroke-width: 2; }
.fig-point.open { fill: var(--surface); }

/* --- Altklausuren and quiz notes -------------------------------------------- */
.exam-teaser { display: flex; align-items: center; gap: 0.9rem; margin: 1rem 0 1.6rem; padding: 0.9rem 1rem; background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; }
.exam-teaser:hover { filter: brightness(0.98); }
.exam-teaser .ex-title { font-weight: 600; }
.exam-teaser .ex-meta { font-size: 0.85rem; color: var(--muted); }
.exam-teaser-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.exam-score { margin: 1rem 0; }
.notes { margin-top: 1.4rem; }
.notes > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.notes > summary::-webkit-details-marker { display: none; }
.notes > summary::before { content: "▸"; color: var(--muted); }
.notes[open] > summary::before { content: "▾"; }
.notes[open] > summary { margin-bottom: 0.6rem; }
.fig-region { fill: var(--muted); fill-opacity: 0.22; stroke: none; }
.fig-region-label { fill: var(--ink); font-size: 14px; font-style: italic; }

/* --- written answers (type text) -------------------------------------------- */
.text-answer { width: 100%; font: inherit; font-size: 1.02rem; line-height: 1.55; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); resize: vertical; }
.step-text { line-height: 1.5; }
.step-text > :first-child { margin-top: 0; }
.step-text > :last-child { margin-bottom: 0; }
.fix textarea { width: 100%; font: inherit; padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* --- footer, account, error reports ----------------------------------------- */
.site-footer { max-width: 60rem; margin: 2.5rem auto 1.5rem; padding: 0 1rem; color: var(--muted); font-size: 0.85rem; text-align: center; }
.site-footer a { color: var(--muted); }
.prose h2 { font-size: 1.15rem; margin-top: 1.6rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; margin: 1rem 0; }
.danger-zone { border-color: var(--error-soft); }
button.danger { background: var(--error); border-color: var(--error); color: #fff; }
.report { margin-top: 1.5rem; }
.report > summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.report textarea { width: 100%; font: inherit; padding: 0.5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0.5rem 0; }
a.who { color: var(--muted); text-decoration: none; }

/* Admin (SPEC D23) */
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0 0 1.2rem; }
.admin-nav a[aria-current="page"] { font-weight: 600; text-decoration: none; }
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.admin-tile { display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none; color: inherit; }
.admin-num { font-size: 2rem; font-weight: 700; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line, rgba(127,127,127,0.25)); vertical-align: top; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.card:has(> .admin-table) { overflow-x: auto; }
.admin-form label { display: block; margin: 0.6rem 0; }
.admin-form textarea, .admin-form input[type="text"], .admin-form select { display: block; width: 100%; margin-top: 0.25rem; }
.admin-form .pts input { width: 4.5rem; }
.admin-message { white-space: pre-wrap; }
.admin-review-row { display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none; color: inherit; }
.danger-link { color: var(--error); }
.meter { height: 0.6rem; border-radius: 999px; background: var(--line, rgba(127,127,127,0.25)); overflow: hidden; margin: 0.4rem 0 0.6rem; }
.meter span { display: block; height: 100%; background: var(--accent); }
.review-note { margin-top: 0.4rem; }

/* Exercise navigation: exam task bar and prev/next */
.ex-nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.6rem; margin: 0.4rem 0 1rem; }
.ex-nav-step { white-space: nowrap; min-width: 4.5rem; }
.ex-nav-step[rel="next"] { text-align: right; }
.ex-nav-pos { text-align: center; color: var(--muted, inherit); font-size: 0.95rem; }
.ex-nav-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
.ex-nav-task { display: inline-block; min-width: 2.4rem; padding: 0.2rem 0.45rem; border: 1px solid var(--line); border-radius: 0.4rem;
  text-align: center; text-decoration: none; font-variant-numeric: tabular-nums; font-size: 0.9rem; color: inherit; }
.ex-nav-task.is-done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.ex-nav-task.is-partial, .ex-nav-task.is-tried { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.ex-nav-task[aria-current="page"] { outline: 2px solid var(--accent); outline-offset: 1px; font-weight: 700; }
@media (max-width: 560px) { .ex-nav { grid-template-columns: 1fr 1fr; } .ex-nav-tasks, .ex-nav-pos { grid-column: 1 / -1; grid-row: 1; } }

/* Theory graphs, interactive graphs and "Thema auf einen Blick" (SPEC D24) */
.theory-figure, .interactive { margin: 1.4rem 0; }
.theory-figure figcaption, .interactive figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 0.4rem; text-align: center; }
.interactive-title { font-weight: 600; margin: 0 0 0.4rem; }
.interactive-controls { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin: 0.6rem auto 0; max-width: 680px; }
.interactive-controls label { white-space: nowrap; font-variant-numeric: tabular-nums; }
.interactive-value { display: inline-block; min-width: 3.2em; text-align: left; }
.interactive-controls input[type=range] { flex: 1; min-width: 10rem; accent-color: var(--accent); height: 2rem; }
.interactive-readouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.3rem 1.4rem;
  margin: 0.5rem auto 0; max-width: 680px; font-variant-numeric: tabular-nums; }
.interactive-readouts div { display: flex; justify-content: space-between; gap: 0.6rem; }
.interactive-readouts dd { min-width: 4.5em; text-align: right; }
.interactive-readouts dt { color: var(--muted); }
.interactive-readouts dd { margin: 0; font-weight: 600; }
.fig-legend { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1.2rem; margin: 0.4rem 0 0; padding: 0; font-size: 0.92rem; }
.fig-legend li { display: flex; align-items: center; gap: 0.4rem; }
.fig-swatch { display: inline-block; flex: none; width: 1.4rem; height: 0; border-top: 3px solid var(--accent); }
.fig-swatch-1 { border-top-color: var(--error); }
.fig-swatch-2 { border-top-color: var(--ok); }
.fig-swatch.dashed { border-top-style: dashed; }
.badge-share { background: var(--accent-soft); color: var(--accent); font-weight: 600; text-transform: none; letter-spacing: 0; }
.topic-glance { margin: 0.2rem 0 0.7rem; color: var(--muted); font-size: 0.95rem; }
.topic-glance .badge-share { margin-right: 0.4rem; }
.topic-glance-text p { margin: 0.35rem 0 0; }

/* Larger graphs in theory pages, and the full-screen view (SPEC D24) */
.theory-figure .figure, .interactive .figure { max-width: 680px; }
figure.zoomable { position: relative; padding-top: calc(var(--tap) + 0.3rem); }
figure.zoomable > .interactive-title { margin-top: calc(-1 * var(--tap)); min-height: var(--tap); padding-right: 3.2rem;
  display: flex; align-items: center; }
.zoom-btn { position: absolute; top: 0; right: 0; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap); padding: 0; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); }
.zoom-btn:hover { color: var(--ink); }
figure.is-zoomed { position: fixed; inset: 0; z-index: 100; margin: 0; padding: 3.2rem 1rem 1.5rem; overflow: auto;
  background: var(--paper); display: flex; flex-direction: column; align-items: center; }
figure.is-zoomed > .zoom-btn { position: fixed; top: 0.6rem; right: 0.6rem; color: var(--ink); }
figure.is-zoomed .figure { max-width: min(1200px, 100%); width: 100%; max-height: calc(100vh - 12rem); }
figure.is-zoomed .interactive-controls, figure.is-zoomed .interactive-readouts, figure.is-zoomed figcaption { width: 100%; max-width: 900px; }
body.zoom-open { overflow: hidden; }

/* "So funktioniert's" reopens from a small "?" in the exercise card */
.ex-statement-card { position: relative; }
.howto-open { position: absolute; top: 0.5rem; right: 0.5rem; min-width: 2rem; min-height: 2rem; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; }
.howto-open:hover { color: var(--accent); border-color: var(--accent); }

/* Login and password forms (SPEC D26) */
.login-form { max-width: 28rem; }
.login-form label { display: block; margin-top: 0.8rem; }
.login-form input { width: 100%; }
.pad-sheet { touch-action: none; -webkit-user-select: none; user-select: none; }

/* Formelsammlung (SPEC D26) */
.card.formulas { border: 2px solid var(--accent); }
.formula-group { font-size: 1rem; margin: 1rem 0 0.4rem; color: var(--accent); }
.formula-group:first-child { margin-top: 0.2rem; }
.formula-table { width: 100%; border-collapse: collapse; }
.formula-table td { padding: 0.45rem 0.6rem; border-top: 1px solid var(--line); vertical-align: middle; }
.formula-table td p { margin: 0; }
.formula-table .formula { width: 58%; }
.formula-table .meaning { color: var(--muted); font-size: 0.95rem; }
.course-links { margin: 0.4rem 0 1rem; }
@media (max-width: 600px) { .formula-table td { display: block; width: 100%; border-top: 0; padding: 0.2rem 0; }
  /* A formula breaking at "<" or "=" is hard to read: keep it on one line, scroll if needed. */
  .formula-table { table-layout: fixed; }
  .formula-table .formula { width: 100%; overflow-x: auto; overflow-y: hidden; }
  .formula-table .formula .katex { white-space: nowrap; padding-bottom: 0.1em; }
  .formula-table tr { display: block; border-top: 1px solid var(--line); padding: 0.4rem 0; } }
@media print {
  .site-header, .site-footer, .no-print, .report { display: none !important; }
  .card.formulas { break-inside: avoid; border-width: 1px; }
}

/* Celebrations (SPEC D26) */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 200; }
.party:not([hidden]) { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.35); padding: 1rem; }
.party-banner { background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 1.6rem 1.8rem;
  max-width: 28rem; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); animation: party-pop 420ms cubic-bezier(.2,1.4,.4,1); }
.party-title { font-family: var(--font-serif, serif); font-size: 1.7rem; font-weight: 700; margin: 0 0 0.4rem; color: var(--accent); }
@keyframes party-pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .party-banner { animation: none; } }
.pw-nudge { margin: 0; padding: 0.55rem 1rem; text-align: center; background: var(--accent-soft); color: var(--ink); font-size: 0.95rem; }
.pw-nudge a { font-weight: 600; }

/* Symbol explanations and guided mode (SPEC D27) */
/* Explained terms (Victor, 2026-10-17): a soft tint like a gentle highlighter, no underline
   (a dotted line looked like a spelling mistake); stronger on hover, tap and keyboard focus. */
.glossary-term { cursor: help; background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-radius: 4px; padding: 0 0.12em; box-decoration-break: clone; -webkit-box-decoration-break: clone;
  transition: background-color 0.15s; }
.glossary-term:hover, .glossary-term:focus-visible { background: color-mix(in srgb, var(--accent) 24%, transparent); outline: none; }
.glossary-term:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.glossary-pop { position: absolute; z-index: 120; background: var(--surface); color: var(--ink); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28); font-size: 0.95rem; }
.glossary-pop dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.8rem; }
.glossary-pop dt { font-weight: 700; white-space: nowrap; }
.glossary-pop dd { margin: 0; }
.glossary-pop.is-terms dl { display: block; }  /* terms: the label above its explanation */
.glossary-pop.is-terms dt { white-space: normal; margin-bottom: 0.2rem; }
.glossary-pop.is-terms dd + dt { margin-top: 0.6rem; }
.guided-toggle { margin: 0 0 0.6rem; }
.guided-toggle button { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0; color: var(--muted); }
.guided-toggle .switch { width: 2.2rem; height: 1.2rem; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background 0.15s; }
.guided-toggle .switch::after { content: ""; position: absolute; top: 0.15rem; left: 0.15rem; width: 0.9rem; height: 0.9rem; border-radius: 50%; background: #fff; transition: left 0.15s; }
.guided-toggle [aria-pressed="true"] { color: var(--ink); }
.guided-toggle [aria-pressed="true"] .switch { background: var(--accent); }
.guided-toggle [aria-pressed="true"] .switch::after { left: 1.15rem; }
svg text.glossary-term { cursor: help; font-weight: 600; }

/* Formula editor (SPEC D28) */
.formula-steps { list-style: none; margin: 0.4rem 0; padding: 0; display: grid; gap: 0.45rem; }
.formula-step { display: grid; grid-template-columns: 1.8rem minmax(0, 1fr) auto auto; align-items: center; gap: 0.35rem; }
.formula-step .step-no { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.formula-step math-field { display: block; width: 100%; min-height: 3rem; font-size: 1.35rem; padding: 0.35rem 0.6rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  --caret-color: var(--accent); --selection-background-color: var(--accent-soft); --contains-highlight-background-color: transparent; }
.formula-step math-field:focus-within { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.formula-step math-field::part(virtual-keyboard-toggle), .formula-step math-field::part(menu-toggle) { color: var(--muted); }
.formula-step.is-final math-field { border-color: var(--ok); }
.formula-step .step-final[aria-pressed="true"] { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.formula-step .step-final, .formula-step .step-del { min-width: 2.4rem; min-height: 2.4rem; padding: 0; }
.formula-actions { margin: 0.2rem 0 0.6rem 2.15rem; }
.formula-tips table { border-collapse: collapse; font-size: 0.92rem; margin: 0.4rem 0; }
.formula-tips td { padding: 0.25rem 0.5rem; border-top: 1px solid var(--line); }
kbd { font: 0.85em ui-monospace, Menlo, Consolas, monospace; padding: 0.05rem 0.35rem; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; background: var(--surface); }
@media (max-width: 560px) {
  .formula-step { grid-template-columns: minmax(0, 1fr) auto auto; }
  .formula-step .step-no { display: none; }
  .formula-actions { margin-left: 0; }
  .formula-step math-field { font-size: 1.2rem; }
}
.math-glue { white-space: nowrap; }
.admin-table th { white-space: nowrap; }
/* Phones show graphs at about 60 % of their drawn size: larger labels keep them readable. */
@media (max-width: 600px) {
  figure:not(.is-zoomed) .fig-tick { font-size: 17px; }
  figure:not(.is-zoomed) .fig-axis-label { font-size: 19px; }
  figure:not(.is-zoomed) .fig-label, figure:not(.is-zoomed) .fig-region-label { font-size: 20px; }
}
/* This exercise's keys above the formula lines (SPEC D29). */
/* position: KaTeX's hidden MathML is absolutely positioned and must not widen the page. */
.key-row { position: relative; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.2rem 0 0.6rem; }
.key-row .key { min-width: 2.6rem; min-height: 2.6rem; padding: 0.2rem 0.55rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 1rem; line-height: 1; cursor: pointer; }
.key-row .key:hover { border-color: var(--accent); }
.key-row .key:active { background: var(--accent-soft); }
.key-row .key .katex { font-size: 1.25em; }
@media (max-width: 560px) {
  .key-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.2rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .key-row::-webkit-scrollbar { display: none; }
  .key-row .key { flex: 0 0 auto; }
}

/* --- code exercises (SPEC D30) ---------------------------------------------------------------------- */
.code-statement .statement pre, .examples, .code-stdout, .code-error, .statement-recap pre {
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem; overflow-x: auto; font: 0.92rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-statement .statement code, .statement-recap code { background: var(--sunken); padding: 0.05em 0.3em; border-radius: 4px; }
.code-statement .statement pre code, .statement-recap pre code { background: none; padding: 0; }
.examples-label { margin-top: 1rem; }
.code-editor { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.code-editor:focus-within { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.code-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; margin: 0.7rem 0; }
.py-status { margin-left: auto; }
.code-output { margin-top: 0.6rem; }
.code-output pre { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem; white-space: pre-wrap; max-height: 16rem; overflow: auto; font: 0.92rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-output pre.is-error, .code-error { color: var(--error); }
.test-list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.test-list li { display: grid; grid-template-columns: 1.4rem 1fr auto; gap: 0.1rem 0.4rem; align-items: baseline;
  padding: 0.45rem 0; border-top: 1px solid var(--line); }
.test-list li:first-child { border-top: 0; }
.test-mark { font-weight: 700; text-align: center; }
.test-pass .test-mark { color: var(--ok); }
.test-fail .test-mark, .test-fail .test-name { color: var(--error); }
.test-points { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.test-msg { grid-column: 2 / -1; display: block; white-space: pre-wrap; color: var(--ink); background: var(--error-soft);
  padding: 0.25rem 0.5rem; border-radius: 6px; }
.statement-recap summary, .correction summary { cursor: pointer; font-weight: 600; }

/* CodeMirror in the app's colours (light and dark). */
/* codemirror.css loads after this file: .cm-s-default.CodeMirror outranks its .CodeMirror rules. */
.cm-s-default.CodeMirror { height: auto; font: 15px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface); color: var(--ink); }
.code-editor .cm-s-default.CodeMirror { min-height: 14rem; }
.code-editor .CodeMirror-scroll { min-height: 14rem; }
.code-view + .cm-s-default.CodeMirror { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cm-s-default .CodeMirror-gutters { background: var(--sunken); border-right: 1px solid var(--line); }
.CodeMirror-linenumber { color: var(--faint); }
.cm-s-default .CodeMirror-cursor { border-left: 2px solid var(--accent); }
.cm-s-default .CodeMirror-activeline-background { background: var(--accent-soft); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.CodeMirror-matchingbracket { color: var(--ok) !important; font-weight: 700; }
.cm-problem-line { background: var(--error-soft); }
/* Lines the test harness found (error or run only by failing tests), Victor 2026-10-19 */
.cm-error-line { background: var(--error-soft); box-shadow: inset 3px 0 0 var(--error, #c0392b); }
.mark-note { display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0 0; }
.mark-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; background: var(--error-soft); box-shadow: inset 3px 0 0 var(--error, #c0392b); flex: none; }
.cm-s-default .cm-keyword { color: #8a3ab9; }
.cm-s-default .cm-def { color: #1f5fbf; }
.cm-s-default .cm-variable-2, .cm-s-default .cm-property { color: #0f6e74; }
.cm-s-default .cm-string { color: #a5470f; }
.cm-s-default .cm-number { color: #116644; }
.cm-s-default .cm-comment { color: var(--faint); font-style: italic; }
.cm-s-default .cm-builtin { color: #2f5aa8; }
.cm-s-default .cm-operator { color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cm-s-default .cm-keyword { color: #d6a2ff; }
  :root:not([data-theme="light"]) .cm-s-default .cm-def { color: #8ab4ff; }
  :root:not([data-theme="light"]) .cm-s-default .cm-variable-2, :root:not([data-theme="light"]) .cm-s-default .cm-property { color: #7fd3d8; }
  :root:not([data-theme="light"]) .cm-s-default .cm-string { color: #f0a46b; }
  :root:not([data-theme="light"]) .cm-s-default .cm-number { color: #8fdcae; }
  :root:not([data-theme="light"]) .cm-s-default .cm-builtin { color: #9ec1ff; }
}
:root[data-theme="dark"] .cm-s-default .cm-keyword { color: #d6a2ff; }
  :root[data-theme="dark"] .cm-s-default .cm-def { color: #8ab4ff; }
  :root[data-theme="dark"] .cm-s-default .cm-variable-2, :root[data-theme="dark"] .cm-s-default .cm-property { color: #7fd3d8; }
  :root[data-theme="dark"] .cm-s-default .cm-string { color: #f0a46b; }
  :root[data-theme="dark"] .cm-s-default .cm-number { color: #8fdcae; }
  :root[data-theme="dark"] .cm-s-default .cm-builtin { color: #9ec1ff; }


/* Code blocks in quiz questions and theory pages (SPEC D30). */
.statement pre, .choice-expl pre, .th-main pre { background: var(--sunken); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; overflow-x: auto;
  font: 0.92rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.statement pre code, .th-main pre code { background: none; padding: 0; font: inherit; }
.th-main :not(pre) > code, .formula-table code { background: var(--sunken); padding: 0.05em 0.3em; border-radius: 4px; }

/* --- theory side panel (Victor, 2026-10-17) ---------------------------------------------------------- */
.ex-header { position: relative; }
.theory-btn { float: right; display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.4rem 0 0.4rem 0.8rem;
  padding: 0.45rem 0.8rem; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-weight: 600; cursor: pointer; }
.theory-btn[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
.theory-panel { position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; width: min(46vw, 680px);
  display: flex; flex-direction: column; background: var(--paper); border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12); }
.theory-panel-bar { display: flex; align-items: center; gap: 0.8rem; padding: 0.4rem 0.6rem 0.4rem 1rem;
  border-bottom: 1px solid var(--line); background: var(--surface); }
.theory-panel-bar strong { font-family: var(--serif); }
.theory-panel-bar a { margin-left: auto; }
.theory-panel iframe { flex: 1; width: 100%; border: 0; background: var(--paper); }
@media (min-width: 901px) { body.theory-open { padding-right: min(46vw, 680px); } }
@media (max-width: 900px) { .theory-panel { width: 100%; border-left: 0; } }
body.embedded main { padding-top: 1rem; }
@media print { .theory-btn, .theory-panel { display: none !important; } }
.theory-panel[hidden] { display: none; }
/* Last attempt above the exercise (Victor, 2026-10-17). */
.last-attempt > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.8rem; cursor: pointer; list-style: none; }
.last-attempt > summary::-webkit-details-marker { display: none; }
.last-attempt > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.last-attempt:not([open]) > summary::after { content: "▸"; }
.last-attempt .card-label { margin: 0; }
.last-attempt-sum { font-weight: 600; }
.verdict-border-partially_correct { border-left: 4px solid var(--warn); }
.verdict-border-incorrect { border-left: 4px solid var(--error); }
.verdict-border-correct { border-left: 4px solid var(--ok); }
.last-correction > summary { cursor: pointer; color: var(--accent); font-weight: 600; margin: 0.4rem 0; }

/* --- worked examples (Victor, 2026-10-17) ------------------------------------------------------------ */
.worked-example { margin: 1.2rem 0; border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: var(--radius-sm); background: var(--surface); padding: 0 1rem; }
.worked-example > summary { cursor: pointer; padding: 0.75rem 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; align-items: baseline; }
.worked-example > summary::-webkit-details-marker { display: none; }
.worked-example > summary::before { content: "▸"; color: var(--ok); }
.worked-example[open] > summary::before { content: "▾"; }
.example-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ok); }
.example-title { font-weight: 600; }
.example-problem { padding: 0.2rem 0 0.4rem; border-bottom: 1px dashed var(--line); }
.example-steps { margin: 0.6rem 0; padding-left: 1.4rem; }
.example-step { margin: 0.5rem 0; }
.example-step > :first-child { margin-top: 0; }
.example-result { padding: 0.5rem 0.7rem; margin-bottom: 0.6rem; border-radius: 6px; background: var(--ok-soft); }
.example-result p { display: inline; }
.example-actions { display: flex; gap: 0.8rem; align-items: center; margin: 0.4rem 0 0.9rem; }
@media print { .worked-example .example-step, .worked-example .example-result { display: block !important; } .example-actions { display: none; } }

/* --- gamification (Victor, 2026-10-17) --------------------------------------------------------------- */
.course-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; margin: 0.2rem 0 1rem; }
.stat-link { margin-left: auto; font-weight: 600; }
.topic-stats { margin: -0.2rem 0 0.5rem; font-size: 0.9rem; color: var(--muted); }
.level { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  border: 1px solid currentColor; }
.level-einsteiger { color: var(--muted); }
.level-grundlagen { color: #b7791f; }
.level-fortgeschritten { color: #2b7bb9; }
.level-sicher { color: #6b46c1; }
.level-pruefungsreif { color: var(--ok); background: var(--ok-soft); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .level-grundlagen { color: #f0b85a; }
  :root:not([data-theme="light"]) .level-fortgeschritten { color: #7cc0f5; }
  :root:not([data-theme="light"]) .level-sicher { color: #b79cf5; }
}
:root[data-theme="dark"] .level-grundlagen { color: #f0b85a; }
  :root[data-theme="dark"] .level-fortgeschritten { color: #7cc0f5; }
  :root[data-theme="dark"] .level-sicher { color: #b79cf5; }

.avatar-tile { display: inline-grid; place-items: center; width: var(--size); height: var(--size); flex: none;
  border-radius: 8px; background: hsl(var(--hue) 55% 45%); color: #fff; font-weight: 700;
  font-size: calc(var(--size) * 0.45); image-rendering: pixelated; }
.profile-head { display: flex; align-items: center; gap: 1rem; }
.profile-name { font-family: var(--serif); font-size: 1.3rem; margin: 0; }
.profile-points { margin-left: auto; text-align: center; }
.points-value { display: block; font-size: 1.8rem; font-weight: 800; color: var(--accent); line-height: 1; }
.points-label { font-size: 0.8rem; color: var(--muted); }
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.5rem; height: 120px; align-items: end; margin-top: 0.6rem; }
.week-day { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 0.3rem; }
.week-bar { width: 100%; max-width: 34px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); }
.week-label { font-size: 0.78rem; color: var(--muted); }
.profile-table { width: 100%; border-collapse: collapse; }
.profile-table th, .profile-table td { text-align: left; padding: 0.45rem 0.4rem; border-top: 1px solid var(--line); }
.profile-form { display: grid; gap: 0.5rem; max-width: 26rem; }
.profile-form .check { display: flex; gap: 0.5rem; align-items: center; font-weight: 500; }
.board-tabs { display: flex; gap: 0.3rem; margin: 0.5rem 0 1rem; border-bottom: 1px solid var(--line); }
.board-tabs a { padding: 0.5rem 0.9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.board-tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.board-filter { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.board-filter select { flex: 1; min-width: 0; min-height: var(--tap); font: 500 16px var(--font); padding: 0 0.6rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.board { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.board-row { display: grid; grid-template-columns: 2.6rem auto 1fr auto auto auto; gap: 0.8rem; align-items: center; padding: 0.55rem 0.9rem; border-top: 1px solid var(--line); }
.board-row:first-child { border-top: 0; }
.board-row.is-me { background: var(--accent-soft); }
.board-rank { font-weight: 700; color: var(--muted); text-align: right; }
.board-name { font-weight: 600; overflow-wrap: anywhere; }
.board-time { color: var(--muted); font-size: 0.9rem; min-width: 5.5rem; text-align: right; }
.board-points { min-width: 5.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.board-solved { color: var(--muted); font-size: 0.9rem; }
.board .empty { padding: 1rem; color: var(--muted); }
@media (max-width: 560px) { .board-row { grid-template-columns: 2rem auto 1fr auto auto; } .board-time { display: none; } }
/* Pixel avatars and the editor (Victor, 2026-10-17). */
canvas.avatar { image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 8px; flex: none; vertical-align: middle; }
.nav-profile { display: inline-flex; align-items: center; gap: 0.4rem; }
.nav-profile canvas.avatar { width: 26px; height: 26px; border-radius: 6px; }
.avatar-editor { display: grid; grid-template-columns: 280px 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 760px) { .avatar-editor { grid-template-columns: 1fr; } .avatar-stage { position: static !important; } }
.avatar-stage { position: sticky; top: 76px; text-align: center; }
.avatar-stage canvas { border-radius: 14px; }
.avatar-balance { margin: 0.6rem 0 0.2rem; }
.avatar-locked { font-size: 0.9rem; color: var(--muted); }
.avatar-locked button { margin: 0.2rem; }
.avatar-options { display: grid; gap: 0.8rem; }
.avatar-cat h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 0.5rem; font-family: var(--font); }
.avatar-cat .opts { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.avatar-cat .opts button { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 8px; padding: 0.3rem 0.6rem; font-size: 0.88rem; cursor: pointer; }
.avatar-cat .opts button[aria-pressed="true"] { outline: 2px solid var(--accent); border-color: var(--accent); }
.avatar-cat .opts button.fantasy { border-style: dashed; }
.avatar-cat .opts button.is-locked { opacity: 0.75; }
.avatar-cat .price { font-size: 0.75rem; color: var(--muted); }
/* Avatar v4 (SPEC D39): tabs, swatches, stars, showcase, rank widget, celebration. */
.avatar-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.avatar-tab { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 0.35rem 0.9rem; cursor: pointer; font: inherit; font-size: 0.92rem; }
.avatar-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.avatar-panel { display: grid; gap: 0.8rem; }
.avatar-panel[hidden], .swatches[hidden] { display: none; }
.avatar-cat .opts button.earned { border-color: #c9a24a; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-top: 0.6rem; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-with-stars { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; vertical-align: middle; }
.avatar-stars { color: #d9a520; font-size: 0.7rem; letter-spacing: 1px; line-height: 1; white-space: nowrap; }
.profile-head .avatar-stars { font-size: 1rem; }
.avatar-stars .star-p1 { color: #b87a3e; }
.avatar-stars .star-p2 { color: #a9b3c4; text-shadow: 0 0 3px rgba(169, 179, 196, 0.8); }
.avatar-stars .star-p3 { color: #ffcf33; text-shadow: 0 0 4px rgba(255, 207, 51, 0.9); }
.showcase-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.8rem; }
.showcase-set { border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; }
.showcase-course { font-weight: 600; margin: 0 0 0.3rem; }
.showcase-set ul { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.showcase-set li { padding: 0.12rem 0; }
.showcase-set li.is-open { color: var(--muted); }
.badge-chip { display: inline-block; border: 1px solid #c9a24a; border-radius: 999px; padding: 0.1rem 0.6rem; margin: 0.15rem; font-size: 0.85rem; }
.course-rank { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.course-rank-top { display: flex; gap: 0.5rem; align-items: flex-start; }
.course-rank-top figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 70px; text-align: center; font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.celebrate { display: flex; align-items: center; gap: 0.8rem; }
.celebrate canvas { border-radius: 10px; }
.profile-head .btn { margin-left: auto; }
.profile-head .profile-points { margin-left: 1rem; }

/* Phones: the header must never widen the page (D32 added the profile link). */
.site-header nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.site-header nav::-webkit-scrollbar { display: none; }
.nav-link { white-space: nowrap; }
@media (max-width: 640px) {
  .nav-profile .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 420px) { .site-header { padding: 0 8px; gap: 0.1rem; } .site-header nav { gap: 0; } .nav-link { padding: 0 0.38rem; font-size: 0.94rem; } .nav-profile canvas.avatar { width: 24px; height: 24px; } }
.profile-head { flex-wrap: wrap; }
@media (max-width: 560px) {
  .profile-head > div:not(.profile-points) { flex: 1 1 8rem; min-width: 0; }
  .profile-head .btn { margin-left: 0; }
  .profile-head .profile-points { margin-left: auto; }
  .profile-table th, .profile-table td { padding: 0.4rem 0.2rem; font-size: 0.88rem; }
  .profile-table .level { font-size: 0.72rem; padding: 0.05rem 0.35rem; }
}
.table-scroll, .table-wrap { overflow-x: auto; max-width: 100%; }

/* Financial Accounting (SPEC D33): Buchungssätze, tables, Fallstudien */
.case-box summary { cursor: pointer; display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.case-box[open] summary { margin-bottom: 0.5rem; }
.journal { list-style: none; padding: 0; margin: 0.8rem 0; display: grid; gap: 0.8rem; }
.journal-case { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; }
.journal-case.is-right { box-shadow: inset 4px 0 0 var(--ok); }
.journal-case.is-wrong { box-shadow: inset 4px 0 0 var(--error); }
.journal-label { margin: 0 0 0.5rem; font-weight: 500; }
.journal-label p { margin: 0; }
.journal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 9rem; gap: 0.5rem; align-items: end; margin-top: 0.5rem; }
.journal-row .journal-mark { grid-column: 1 / -1; }
.journal-field { display: grid; gap: 0.15rem; margin: 0; min-width: 0; }
.journal-hint { font-size: 0.78rem; color: var(--muted); }
.journal-field select, .journal-field input { width: 100%; min-height: var(--tap); font-size: 16px; }
.journal-amount input { text-align: right; font-variant-numeric: tabular-nums; }
.journal-an { color: var(--muted); padding-bottom: 0.7rem; font-size: 1.2rem; }
.journal-row.mark-right select, .journal-row.mark-right input { border-color: var(--ok); }
.journal-row.mark-wrong select, .journal-row.mark-wrong input { border-color: var(--error); }
.journal-row.mark-amount input { border-color: var(--error); }
.journal-solution { margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px dashed var(--line); }
.journal-entry { margin: 0.2rem 0; }
.journal-entry .fin-amount { margin-left: 0.4rem; }
@media (max-width: 560px) {
  .journal-row { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
  .journal-an { display: none; }
}
.fin-tables { display: grid; gap: 1rem; margin: 0.8rem 0; }
.fin-tables-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fin-tables-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .fin-tables-2, .fin-tables-3 { grid-template-columns: minmax(0, 1fr); } }
.fin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fin-table caption { text-align: left; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; padding: 0 0 0.35rem; }
.fin-table th, .fin-table td { padding: 0.35rem 0.6rem; border-top: 1px solid var(--line); vertical-align: middle; }
.fin-table th { text-align: left; font-weight: 400; }
.fin-table .fin-heading th { font-weight: 600; font-size: 0.85rem; color: var(--muted); background: var(--sunken); }
.fin-table .fin-total th, .fin-table .fin-total td { font-weight: 650; border-top: 2px solid var(--ink); }
.fin-amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-table td.fin-amount { width: 9.5rem; }
.fin-table input { width: 100%; min-height: 38px; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.fin-table tr.is-right input { border-color: var(--ok); background: var(--ok-soft); }
.fin-table tr.is-wrong input { border-color: var(--error); background: var(--error-soft); }
.fin-correct { display: block; font-size: 0.8rem; color: var(--ok); white-space: nowrap; }
.case-rows .ex-meta { white-space: normal; }
.journal-field select { font: 400 16px var(--font); padding: 0 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.fin-table input[type=text] { padding: 0.3rem 0.5rem; }
.journal-field input[type=text], .fin-table input[type=text] { margin-bottom: 0; }
.journal-field { font-weight: 400; }
.fin-table td.fin-amount:has(.fin-unit) { white-space: nowrap; }
.fin-table td.fin-amount:has(.fin-unit) input { width: calc(100% - 1.4rem); }
.fin-unit { display: inline-block; width: 1.2rem; margin-left: 0.2rem; color: var(--muted); text-align: left; }
.case-box .markdown table { border-collapse: collapse; margin: 0.6rem 0; font-variant-numeric: tabular-nums; }
.case-box .markdown th, .case-box .markdown td { border: 1px solid var(--line); padding: 0.3rem 0.6rem; }
.case-box .markdown { overflow-x: auto; }

/* Bilanz / Erfolgsrechnung builder (SPEC D34) */
.builder { margin: 0.8rem 0; }
.build-sides { display: grid; gap: 1rem; }
.build-sides-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .build-sides-2 { grid-template-columns: minmax(0, 1fr); } }
.build-side-title { font-family: var(--serif); margin: 0 0 0.4rem; font-size: 1.15rem; }
.build-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.6rem 0.7rem; margin-bottom: 0.7rem; }
.build-section h4 { margin: 0 0 0.4rem; font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.build-unclear { border-color: var(--warn); background: var(--warn-soft); }
.build-unclear h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.build-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.build-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem auto; gap: 0.35rem; align-items: center; }
.build-row:has(.build-move:not([hidden])) { grid-template-columns: 100%; }
.build-row input[type=text] { margin: 0; min-height: 40px; padding: 0.35rem 0.55rem; }
.build-row .build-amount { text-align: right; font-variant-numeric: tabular-nums; }
.build-move { min-height: 40px; font: 400 16px var(--font); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.build-remove { min-width: 36px; min-height: 36px; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 0.95rem; }
.build-remove:hover { color: var(--error); }
.build-add { margin-top: 0.35rem; min-height: 36px; }
.build-row.legibility-unsure input, .build-row.legibility-unreadable input { border-color: var(--warn); background: var(--warn-soft); }
.build-total { margin: 0.2rem 0 0; text-align: right; font-variant-numeric: tabular-nums; }
.build-balance { text-align: right; color: var(--warn); margin: 0.3rem 0 0; }
.build-balance.ok { color: var(--ok); }
.build-result h4 { margin: 0.8rem 0 0.3rem; font-size: 0.9rem; color: var(--muted); }
.build-result-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.build-result-rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.2rem 0.7rem; align-items: baseline; padding: 0.35rem 0.6rem; border-radius: var(--radius-sm); background: var(--sunken); }
.build-result-rows li.mark-right { box-shadow: inset 4px 0 0 var(--ok); }
.build-result-rows li[class*="mark-"]:not(.mark-right) { box-shadow: inset 4px 0 0 var(--error); }
.build-result-rows .choice-expl { grid-column: 1 / -1; }
@media (max-width: 520px) { .build-result-rows li { grid-template-columns: minmax(0, 1fr) auto; } .build-result-badge { grid-column: 1 / -1; } }
.confirm-grid .build-sides-2 { grid-template-columns: minmax(0, 1fr); }
.build-row input[data-build-account] { min-width: 6rem; }

/* Exam variants (SPEC D35) */
.exams-section { margin-top: 1.6rem; }
.variant-links { margin: -0.2rem 0 0.4rem 3.1rem; font-size: 0.85rem; color: var(--muted); display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.variant-chip { display: inline-grid; place-items: center; min-width: 2.2rem; min-height: 2rem; padding: 0 0.4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: var(--surface); }
.variant-chip.is-done { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.variant-chip.is-tried { border-color: var(--warn); }
/* Typed results (SPEC D36) */
.num-table { max-width: 34rem; }
.num-table td.fin-amount { width: 11rem; }
/* Bonus topics (SPEC D36) */
.bonus-intro { margin-top: 2.5rem; padding-top: 1rem; border-top: 2px dashed var(--line); }
.bonus-intro h2 { margin-bottom: 0.25rem; }
.badge-bonus { background: var(--sunken); color: var(--muted); font-weight: 600; vertical-align: middle; margin-right: 0.3rem; }
/* Game trees (SPEC D36) */
.tree-edge { stroke: var(--ink); stroke-width: 1.6; }
.tree-node { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; }
.tree-player { fill: var(--ink); font-size: 14px; font-weight: 650; }
.tree-leaf { fill: var(--ink); }
.tree-move { fill: var(--accent); font-size: 14px; font-style: italic; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.tree-payoff { fill: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
/* Admin: members (Victor, 2026-10-18) */
.members-table .member-avatar { width: 48px; }
.members-table .member-avatar canvas { image-rendering: pixelated; }
.member-courses { margin-top: 0.3rem; }
.member-courses .admin-table { margin-top: 0.3rem; font-size: 0.88rem; }
.members-table .nowrap { white-space: nowrap; }
.members-table tr:has(+ .member-detail) td { border-bottom: none; }
.members-table .member-detail td { padding-top: 0; }
.member-courses .admin-table { max-width: 44rem; }

/* Statistics (Victor, 2026-10-18): one measure per chart, accent bars, hover/focus tooltip */
.stat-filters { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: center; margin: 0.4rem 0 1rem; }
.stat-filters .board-tabs, .stat-filters .board-filter { margin: 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-name { font-size: 0.82rem; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.4rem 2rem; }
.stat-chart { margin: 0; min-width: 0; }
.stat-chart figcaption { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.5rem; }
.stat-bars { display: flex; align-items: flex-end; gap: 2px; height: 130px; border-bottom: 1px solid var(--line); }
.stat-col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; }
.stat-bar { display: block; width: 100%; max-width: 28px; min-height: 0; border-radius: 4px 4px 0 0; background: var(--accent); }
.stat-col:hover .stat-bar, .stat-col:focus .stat-bar { background: var(--ink); }
.stat-label { position: absolute; top: calc(100% + 4px); font-size: 0.68rem; color: var(--muted); white-space: nowrap; transform: rotate(-35deg); transform-origin: top center; }
.stat-col:not(:nth-child(2n+1)) .stat-label { visibility: hidden; }
.stat-chart .stat-bars { margin-bottom: 2.6rem; }
.stat-col[data-tip]:hover::after, .stat-col[data-tip]:focus::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 2;
  background: var(--ink); color: var(--paper); font-size: 0.78rem; padding: 0.25rem 0.5rem; border-radius: 6px; white-space: nowrap; pointer-events: none;
}
.weak-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.weak-list li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) auto auto; gap: 0.4rem 0.8rem; align-items: center; }
.weak-meter { display: block; height: 8px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.weak-meter span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
@media (max-width: 640px) {
  .weak-list li { grid-template-columns: 1fr auto; }
  .weak-meter { grid-column: 1 / -1; order: 3; }
}

/* "Nur Fehler korrigieren" (Victor, 2026-10-19): right boxes stay, locked; wrong ones editable. */
.is-locked input:disabled, .is-locked select:disabled, input:disabled.is-locked, tr.is-locked input:disabled { background: var(--ok-soft); color: var(--ink); opacity: 1; border-color: var(--ok); }
.journal-row.fix-wrong select, .journal-row.fix-wrong input, .journal-row.fix-amount .journal-amount input { border-color: var(--error); box-shadow: 0 0 0 1px var(--error) inset; }
tr.is-wrong:not(.is-locked) input:not(:disabled) { border-color: var(--error); }

/* Solution hidden behind «Lösung anzeigen» on results and in correction mode (Victor, 2026-10-19) */
.sol-toggle:not(:checked) ~ .quiz-form .sol { display: none !important; }
.sol-toggle:checked + .sol-toggle-btn .sol-show, .sol-toggle:not(:checked) + .sol-toggle-btn .sol-hide { display: none; }
.sol-toggle-btn { margin: 0.4rem 0 0.8rem; }
.sol-toggle:focus-visible + .sol-toggle-btn { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Chat (SPEC D41) */
.chat-fab { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.65rem 1rem; border-radius: 999px; border: 0; background: var(--accent); color: #fff; font: inherit; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); cursor: pointer; }
.chat.is-open .chat-fab { display: none; }
.chat-panel { position: fixed; right: 18px; bottom: 18px; z-index: 61; width: min(420px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 100px)); display: flex; flex-direction: column; padding: 0.8rem 0.9rem; margin: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.chat-close { border: 0; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.chat-note { margin: 0.3rem 0 0.5rem; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.2rem 0; min-height: 120px; }
.chat-msg { flex-shrink: 0; padding: 0.5rem 0.7rem; border-radius: 12px; max-width: 92%; overflow-wrap: anywhere; font-size: 0.95rem; }
.chat-msg p { margin: 0.2rem 0; }
.chat-msg pre { overflow-x: auto; font-size: 0.85rem; }
.chat-user { align-self: flex-end; background: var(--accent); color: #fff; white-space: pre-wrap; }
.chat-assistant { align-self: flex-start; background: var(--surface-2, rgba(127, 127, 127, 0.1)); }
.chat-pending { color: var(--muted); font-style: italic; }
.chat-tag { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-right: 0.4rem; }
.chat-form textarea { width: 100%; resize: vertical; min-height: 2.6rem; font: inherit; }
.chat-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem; }
.chat-left { margin-left: auto; }
.chat-error { color: var(--error); font-size: 0.9rem; margin: 0.3rem 0; }
@media (max-width: 560px) { .chat-fab span { display: none; } .chat-fab { padding: 0.75rem; } .chat-panel { right: 8px; left: 8px; bottom: 8px; width: auto; } }

/* Profile (Victor, Day 4): leaderboard settings and the closable Sammlung */
.board-settings-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.board-settings-head h2 { margin: 0; }
.status-chip { font-size: 0.85rem; padding: 0.2rem 0.65rem; border-radius: 999px; background: var(--line); color: var(--muted); }
.status-chip.is-on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.board-settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.4rem; margin-top: 0.9rem; }
@media (max-width: 720px) { .board-settings-grid { grid-template-columns: 1fr; } }
.small-head { font-family: inherit; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 0.5rem; }
.rank-list { list-style: none; margin: 0 0 0.6rem; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rank-list li + li { border-top: 1px solid var(--line); }
.rank-list a { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 0.55rem 0.8rem; color: inherit; text-decoration: none; }
.rank-list a:hover { background: var(--accent-soft); }
.rank-chip { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.rank-chip.has-rank { color: var(--accent); font-weight: 600; }
.board-form { display: flex; flex-direction: column; gap: 0.55rem; }
.board-form .small-head { margin-bottom: 0; }
.switch { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { flex: none; width: 2.4rem; height: 1.35rem; border-radius: 999px; background: var(--line); position: relative; transition: background 0.15s; }
.switch-track::after { content: ""; position: absolute; top: 0.15rem; left: 0.15rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(1.05rem); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
details.showcase > summary { display: flex; align-items: baseline; gap: 0.8rem; cursor: pointer; list-style: none; }
details.showcase > summary::-webkit-details-marker { display: none; }
details.showcase > summary h2 { margin: 0; }
details.showcase > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform 0.15s; }
details.showcase:not([open]) > summary::after { transform: rotate(-90deg); }
details.showcase[open] > summary { margin-bottom: 0.6rem; }

/* Heute / daily goal (Victor, Day 4) */
.today-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.today-head h2 { margin: 0; }
.today-goal { margin: 0.7rem 0 0.2rem; }
.today-bar { width: 100%; height: 10px; }
.today-bar.is-done span { background: var(--ok, #2f8a4c); }
.today-goal-text { margin: 0.45rem 0 0; }
.today-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin: 0.9rem 0 0.6rem; }
@media (max-width: 560px) { .today-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.today-stat { background: var(--accent-soft); border-radius: 10px; padding: 0.6rem 0.75rem; display: flex; flex-direction: column; }
.today-num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.today-label { font-size: 0.82rem; color: var(--muted); }
.today-moved, .today-list { list-style: none; margin: 0.4rem 0; padding: 0; }
.today-moved li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.2rem 0; flex-wrap: wrap; }
.today-gain { color: var(--ok, #2f8a4c); font-weight: 700; }
.today-list li + li { border-top: 1px solid var(--line); }
.today-list a { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.45rem 0.1rem; color: inherit; text-decoration: none; flex-wrap: wrap; }
.today-list a:hover .today-title { text-decoration: underline; }
.today-mark { width: 1.4rem; text-align: center; font-weight: 700; }
.today-mark.is-right { color: var(--ok, #2f8a4c); } .today-mark.is-part { color: var(--warn, #b7791f); } .today-mark.is-wrong { color: var(--error); }
.today-title { font-weight: 600; }
.today-form { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.today-hint { margin-top: -0.4rem; }
.nav-goal { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; color: var(--muted); font-size: 0.85rem; padding: 0 0.3rem; }
.nav-goal-bar { width: 56px; height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.nav-goal-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.nav-goal-text { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 560px) { .nav-goal { display: none; } } /* phones: too cramped (Victor, 2026-10-20) */
.nav-board { display: inline-flex; align-items: center; gap: 0.3rem; }
.nav-board .nav-icon { display: none; }
@media (max-width: 720px) { .nav-board .nav-icon { display: inline; } .nav-board .nav-label { display: none; } }
.today-sub { margin: 0.6rem 0 0.2rem; }

/* Statement always in view (Victor, Day 4): side by side on wide screens, a bar on top otherwise */
@media (min-width: 1000px) {
  main:has(.solve.is-split) { max-width: 84rem; }
  body:not(.theory-open) .solve.is-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.2rem; align-items: start; }
  body:not(.theory-open) .solve.is-split .solve-task { position: sticky; top: calc(var(--header-h, 60px) + 0.8rem); max-height: calc(100vh - var(--header-h, 60px) - 1.6rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  body:not(.theory-open) .solve.is-split .solve-task > :last-child { margin-bottom: 0; }
}
.solve-toggle { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.6rem; padding: 0.25rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.85rem; }
.solve-toggle:hover { color: var(--accent); border-color: var(--accent); }
.task-dock { position: fixed; top: var(--header-h, 60px); left: 0; right: 0; z-index: 9; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); }
.task-dock[hidden] { display: none; }
.task-dock-bar { display: flex; align-items: center; gap: 0.6rem; width: 100%; max-width: 72rem; margin: 0 auto; padding: 0.5rem 16px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.task-dock-label { flex: none; font-weight: 700; color: var(--accent); font-size: 0.9rem; }
.task-dock-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 0.92rem; }
.task-dock-caret { flex: none; color: var(--muted); transition: transform 0.15s; }
.task-dock.is-open .task-dock-caret { transform: rotate(180deg); }
.task-dock-body { max-width: 72rem; margin: 0 auto; padding: 0 16px 0.8rem; max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.task-dock-body .solve-toggle, .task-dock-body .howto-open, .task-dock-body .card-label { display: none; }
.task-dock-body .card { margin: 0 0 0.6rem; box-shadow: none; }
.task-dock.is-open .task-dock-text { visibility: hidden; }
.task-dock-body { max-height: 40vh; }
.task-dock-body .dock-options { margin: 0 0 0.4rem; font-size: 0.95rem; }
.task-dock-body .dock-options .choice { padding: 0.35rem 0.6rem; min-height: 0; }
.task-dock-body table.dock-options thead { display: none; }
.task-dock-body table.dock-options td { padding: 0.3rem 0.5rem; }
.task-dock-text p { display: inline; margin: 0; }
@media print { .task-dock { display: none !important; } }

/* Reference card and step-through viewer (Victor, 2026-10-20) */
details.ref-card > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 0.5rem; }
details.ref-card > summary::-webkit-details-marker { display: none; }
details.ref-card > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
details.ref-card:not([open]) > summary::after { transform: rotate(-90deg); }
.ref-card-body { font-size: 0.9rem; margin-top: 0.5rem; }
.ref-card-body pre { font-size: 0.8rem; max-height: 22rem; overflow: auto; }
.ref-card-body table { font-size: 0.85rem; }
.stepper { margin-top: 0.8rem; outline: none; }
.stepper:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 10px; }
.stepper-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.stepper-bar input[type=range] { flex: 1 1 10rem; min-width: 8rem; }
.stepper-count { min-width: 8rem; text-align: right; font-variant-numeric: tabular-nums; }
.stepper-close { margin-left: auto; }
.stepper-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0.8rem; align-items: start; }
@media (max-width: 720px) { .stepper-grid { grid-template-columns: 1fr; } }
.stepper-code { margin: 0; padding: 0.4rem 0 0.4rem 2.6rem; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; max-height: 26rem; overflow: auto; font-family: var(--mono, ui-monospace, monospace); font-size: 0.82rem; line-height: 1.45; }
.stepper-code li { padding: 0 0.5rem; white-space: pre; color: var(--muted); }
.stepper-code li::marker { color: var(--muted); font-size: 0.75rem; }
.stepper-code li code { background: none; padding: 0; color: var(--ink, inherit); font-size: inherit; }
.stepper-code li.is-current { background: #fff3c4; box-shadow: inset 3px 0 0 #d4a10a; }
.stepper-code li.was-current { background: rgba(127, 127, 127, 0.1); }
.stepper-note { margin: 0 0 0.5rem; font-weight: 600; }
.stepper-note.is-error { color: var(--error); }
.stepper-frame { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.6rem; margin-bottom: 0.4rem; opacity: 0.75; }
.stepper-frame.is-top { opacity: 1; border-color: var(--accent); }
.stepper-frame-name { margin: 0 0 0.2rem; font-weight: 700; font-size: 0.85rem; }
.stepper-frame table { width: 100%; font-family: var(--mono, ui-monospace, monospace); font-size: 0.8rem; border-collapse: collapse; }
.stepper-frame th { text-align: left; font-weight: 600; padding: 0.1rem 0.6rem 0.1rem 0; width: 35%; vertical-align: top; }
.stepper-frame td { overflow-wrap: anywhere; padding: 0.1rem 0; }
.stepper-frame tr.is-changed td, .stepper-frame tr.is-changed th { background: #fff3c4; }
.stepper-out { margin: 0; min-height: 2rem; max-height: 10rem; overflow: auto; font-size: 0.8rem; }
.stepper-out.is-empty { color: var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.stepper-code li.is-current, .stepper-frame tr.is-changed td, .stepper-frame tr.is-changed th) { background: #4a3d10; } }
:root[data-theme="dark"] :is(.stepper-code li.is-current, .stepper-frame tr.is-changed td, .stepper-frame tr.is-changed th) { background: #4a3d10; }
.staged-hint { border-left: 3px solid var(--accent); padding: 0.2rem 0 0.2rem 0.7rem; margin: 0.5rem 0; }
.staged-hint-title { margin: 0; font-weight: 700; font-size: 0.85rem; color: var(--accent); }
.staged-hints form { margin: 0.5rem 0; }
.hint-tag { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-right: 0.35rem; }
.hint-tag-do { color: var(--ok); }
.hint-attempt { color: var(--muted); }
.tutor-reply { margin: 0.6rem 0; padding: 0.6rem 0.8rem; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.tutor-reply p { margin: 0.2rem 0; }
.tutor-verdict { font-weight: 700; }
.tutor-reply.is-ok { border-color: var(--ok); background: var(--ok-soft); } .tutor-reply.is-ok .tutor-verdict { color: var(--ok); }
.tutor-reply.is-part { border-color: var(--warn); background: var(--warn-soft); } .tutor-reply.is-part .tutor-verdict { color: var(--warn); }
.tutor-reply.is-off, .tutor-reply.is-error { border-color: var(--error); background: var(--error-soft); } .tutor-reply.is-off .tutor-verdict { color: var(--error); }

/* Admin: usage dashboard (Victor, 2026-10-21) */
.funnel { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.45rem; }
.funnel li { display: grid; grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr) minmax(9rem, auto); gap: 0.8rem; align-items: center; }
@media (max-width: 720px) { .funnel li { grid-template-columns: 1fr; gap: 0.2rem; } }
.funnel-bar { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.funnel-n { font-variant-numeric: tabular-nums; }
.cohort-table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cohort-table th, .cohort-table td { padding: 0.35rem 0.6rem; text-align: right; }
.cohort-table thead th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.cohort-cell { background: color-mix(in srgb, var(--accent) calc(var(--a) * 85%), transparent); color: var(--ink, inherit); }
.usage-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.2rem; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 0.3rem 0; border-top: 1px solid var(--line); }
.cohort-cell.is-dark { color: #fff; }

/* Theory pages (SPEC D49; reference docs/theorie-vorlage.html) */
.th-layout { display: grid; grid-template-columns: minmax(0, 46rem); justify-content: center; }
@media (min-width: 1100px) {
  .th-layout:not(.is-embedded) { grid-template-columns: 12rem minmax(0, 46rem); gap: 3rem; justify-content: center; }
}
.th-map { display: none; }
@media (min-width: 1100px) {
  .th-map { display: block; position: sticky; top: 1.5rem; align-self: start; font-size: 0.88rem; padding-top: 0.4rem; }
}
.th-map p { margin: 0 0 0.6rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; font-weight: 600; }
.th-map ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.th-map a { display: block; padding: 0.45rem 0 0.45rem 0.9rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.th-map a.on, .th-map a:hover { border-left-color: var(--accent); color: var(--ink); }
.th-map a.on { font-weight: 600; }
.th-main h1 { margin-bottom: 0.3rem; }
.th-lead { font-family: var(--serif); font-size: 1.4rem; line-height: 1.4; margin: 1rem 0 1.3rem; }
.th-lead strong { color: var(--accent); font-weight: 600; }
.th-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem; margin: 0 0 0.9rem; }
.th-tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; }
.th-tiles b { display: block; font-size: 0.95rem; margin-bottom: 0.15rem; }
.th-tiles span { color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.th-links { font-size: 0.9rem; margin: 0.4rem 0 0.6rem; color: var(--faint); }
.th-links a, .th-links .link { color: var(--accent); }
.th-links .link { font: inherit; padding: 0; min-height: 0; border: 0; background: none; text-decoration: underline; cursor: pointer; }
.th-section { padding-top: 2.1rem; scroll-margin-top: 1rem; }
.th-section .kicker { color: var(--faint); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; margin: 0 0 0.35rem; }
.th-section h2 { font-size: 1.45rem; margin: 0 0 0.75rem; line-height: 1.3; }
.th-text p { line-height: 1.65; margin: 0 0 0.75rem; }
.th-figure { margin: 1rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.th-figure .interactive { margin: 0; }
.th-diagram svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.th-diagram svg text { fill: var(--ink); }
.th-diagram svg .muted { fill: var(--muted); }
.th-diagram svg .faint { fill: var(--faint); }
.th-diagram svg .accent { fill: var(--accent); }
.th-figure figcaption { margin: 0.75rem 0.1rem 0; font-size: 0.92rem; color: var(--muted); line-height: 1.6; text-align: left; }
.th-figure figcaption strong { color: var(--ink); font-weight: 600; }
.th-more { border-top: 1px solid var(--line); margin-top: 0.9rem; }
.th-more summary { cursor: pointer; padding: 0.6rem 0; color: var(--accent); font-size: 0.92rem; font-weight: 500; }
.th-more .markdown { padding-bottom: 0.4rem; }
.th-pitfall { margin: 0.6rem 0 0; font-size: 0.9rem; color: var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; }
.th-end { margin-top: 2.6rem; }
.th-end h2 { font-size: 1.15rem; margin-top: 0; }
.th-end li { line-height: 1.6; }
.th-card { max-width: min(46rem, calc(100vw - 32px)); width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; background: var(--surface); color: var(--ink); }
.th-card::backdrop { background: rgba(0, 0, 0, 0.35); }
.th-card-head { display: flex; justify-content: space-between; align-items: center; }
@media (max-width: 640px) { .th-lead { font-size: 1.2rem; } }
.th-text table, .th-more table { border-collapse: collapse; margin: 0.8rem 0; width: 100%; display: block; overflow-x: auto; }
.th-text th, .th-text td, .th-more th, .th-more td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.th-text th, .th-more th { background: var(--sunken); }
.th-diagram svg .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* Phones (Victor, 2026-10-23): figures stay in the column; a tap on the button opens them full screen at a
   readable size (turned sideways or scrolled). Wider screens need no button. */
@media (min-width: 701px) {
  figure.th-figure.zoomable { padding-top: 1rem; }
  figure.th-figure.zoomable > .zoom-btn { display: none; }
}
figure.th-figure.is-zoomed { border: 0; border-radius: 0; }
figure.th-figure.is-zoomed .th-diagram { width: 100%; overflow: auto; }
figure.th-figure.is-zoomed .th-diagram svg { min-width: 640px; max-width: 1000px; margin: 0 auto; }
/* ```abbildung plots inside «Mehr dazu» look like the section figures */
.th-more .theory-figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.th-more .theory-figure figcaption { text-align: left; margin: 0.75rem 0.1rem 0; line-height: 1.6; }
/* long German compounds in titles and headings ("Warteschlangenmanagement") must not widen the page on phones */
.th-main h1, .th-main h2 { hyphens: auto; overflow-wrap: break-word; }

/* --- toasts and power-up forms (SPEC D50) ----------------------------------------------------------------- */
.toasts { position: fixed; right: 16px; bottom: 84px; z-index: 30; display: flex; flex-direction: column; gap: 0.6rem; max-width: min(360px, calc(100vw - 32px)); }
.toast { position: relative; display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 2.2rem 0.7rem 0.8rem; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.45s cubic-bezier(.2, .9, .3, 1.3) both, toast-glow 2.4s ease-in-out 0.45s 2; }
.toast.is-leaving { animation: toast-out 0.3s ease-in forwards; }
.toast-title { margin: 0; font-weight: 700; }
.toast-text { margin: 0.1rem 0 0; font-size: 0.9rem; color: var(--muted); }
.toast-link { font-size: 0.9rem; }
.toast-icon { font-size: 1.6rem; color: #e0b23a; width: 36px; text-align: center; }
.toast-avatar { flex: none; image-rendering: pixelated; border-radius: 6px; }
.toast-close { position: absolute; top: 0.3rem; right: 0.3rem; border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; min-height: 0; padding: 0.2rem 0.5rem; }
.toast-power { border-color: #f2c94c; }
.toast-prestige { border-color: #b9c0cc; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes toast-glow { 0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); } 50% { box-shadow: 0 0 0 3px rgba(242, 201, 76, 0.55), 0 0 28px rgba(242, 201, 76, 0.75); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.is-leaving { animation: none; } }

.power { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.power-head { display: flex; align-items: center; gap: 0.8rem; }
.power-main { flex: 1; min-width: 0; }
.power-title { margin: 0 0 0.3rem; }
.power-avatar { flex: none; border-radius: 50%; line-height: 0; }
.power-bar span { background: linear-gradient(90deg, #f2c94c, #ff9f43); }
.power-forms { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; padding: 0; margin: 0.6rem 0 0.4rem; }
.power-forms li { font-size: 0.78rem; padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.power-forms li.is-reached { border-color: #e0b23a; color: var(--ink); background: rgba(242, 201, 76, 0.18); }
/* the glow around the avatar and on the daily bar grows with the form; static, no animation cost */
.power-1 .power-avatar { box-shadow: 0 0 6px 1px rgba(255, 242, 176, 0.8); }
.power-2 .power-avatar { box-shadow: 0 0 8px 2px rgba(255, 224, 102, 0.85); }
.power-3 .power-avatar { box-shadow: 0 0 10px 3px rgba(255, 176, 32, 0.85); }
.power-4 .power-avatar { box-shadow: 0 0 10px 3px rgba(255, 216, 74, 0.9), 0 0 3px 1px rgba(143, 216, 255, 0.9); }
.power-5 .power-avatar { box-shadow: 0 0 14px 4px rgba(255, 215, 0, 0.95); }
.power-6 .power-avatar { box-shadow: 0 0 14px 4px rgba(207, 232, 255, 0.95), 0 0 4px 1px rgba(190, 150, 255, 0.9); }
.nav-goal.power-1 .nav-goal-bar span, .nav-goal.power-2 .nav-goal-bar span { box-shadow: 0 0 6px rgba(255, 224, 102, 0.9); }
.nav-goal.power-3 .nav-goal-bar span, .nav-goal.power-4 .nav-goal-bar span { box-shadow: 0 0 7px rgba(255, 176, 32, 0.95); background: linear-gradient(90deg, #f2c94c, #ff9f43); }
.nav-goal.power-5 .nav-goal-bar span { box-shadow: 0 0 8px rgba(255, 215, 0, 1); background: linear-gradient(90deg, #ffe680, #ffc400); }
.nav-goal.power-6 .nav-goal-bar span { box-shadow: 0 0 8px rgba(207, 232, 255, 1); background: linear-gradient(90deg, #cfe8ff, #b99cff); }

/* universities (SPEC D51/D52) */
.uni-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.uni-grid form { margin: 0; }
.uni-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; width: 100%; height: 100%; margin: 0;
  padding: 1.4rem 1.3rem; text-align: left; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); }
.uni-card:hover, .uni-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.uni-card.is-last { border-color: var(--accent); }
.uni-short { font-family: var(--font-display, inherit); font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }
.uni-name { font-weight: 600; }
.org-tag { font-size: 0.55em; vertical-align: middle; padding: 0.15em 0.5em; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.org-sub { margin-top: -0.6rem; }

/* --- design audit 2026-10-25 ------------------------------------------------------------------------------- */
/* iPad portrait: the header must fit; the address is in Konto anyway */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 0.5rem 0.8rem; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: 8px; }
main:focus { outline: none; }
/* the chat button never covers the last content */
main { padding-bottom: 5rem; }
/* drafts: neutral, not an error colour */
.status-draft { color: var(--muted); border-color: var(--line); background: var(--sunken); white-space: nowrap; }
/* dismissible notice */
.pw-nudge { position: relative; padding-right: 2.6rem; }
.dismiss { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0.3rem 0.6rem; min-height: 0; cursor: pointer; }
/* phones: no sideways scroll on Statistik, bigger tap targets */
.board-filter select { min-width: 0; max-width: 100%; }
@media (max-width: 640px) {
  .ex-nav-step { display: inline-flex; align-items: center; min-height: 44px; }
  .site-footer a { display: inline-block; padding: 0.6rem 0.2rem; }
  details.report > summary { min-height: 44px; display: flex; align-items: center; }
}

/* --- dark mode as a choice (SPEC D53, 2026-10-25) ------------------------------------------------------ */
/* E: theme switch (Konto) and dark paper for the writing pad (screen only) */
.segmented { display: inline-flex; padding: 3px; gap: 3px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); margin: 0.2rem 0 0.6rem; }
.segmented label { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 1.1rem; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--muted); margin: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.pad-sheet.sheet-dark { background-color: #1a1d21; }
.pad-sheet.sheet-dark.paper-grid { background-image: linear-gradient(#2a2f36 1px, transparent 1px), linear-gradient(90deg, #2a2f36 1px, transparent 1px); }
.pad-sheet.sheet-dark.paper-lines { background-image: linear-gradient(transparent calc(var(--grid, 24px) - 1px), #2e343c calc(var(--grid, 24px) - 1px)); }
.pad-sheet.sheet-dark.paper-dots { background-image: radial-gradient(circle, #434a54 1.1px, transparent 1.3px); }

/* Compact header below 1024 px (SPEC D54): Profil, Konto, Universitäten, Admin and Abmelden move into the avatar menu */
.nav-menu { display: none; position: relative; flex: none; }
.nav-menu > summary { list-style: none; cursor: pointer; gap: 0.15rem; padding: 0 0.4rem; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu canvas.avatar { width: 26px; height: 26px; border-radius: 6px; }
.nav-caret { color: var(--muted); transition: transform 0.15s; }
.nav-menu[open] .nav-caret { transform: rotate(180deg); }
.nav-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 14rem; max-width: calc(100vw - 16px); z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14); padding: 0.35rem; }
.nav-menu-panel a, .nav-menu-panel button { display: flex; align-items: center; width: 100%; min-height: var(--tap); padding: 0 0.75rem; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font: 500 1rem/1.2 var(--font); background: none; border: 0; text-align: left; }
.nav-menu-panel a:hover, .nav-menu-panel button:hover { background: var(--sunken); }
.nav-menu-panel form { margin: 0; border-top: 1px solid var(--line); padding-top: 0.3rem; margin-top: 0.3rem; }
.nav-menu-who { margin: 0.2rem 0.75rem 0.4rem; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* every width (Victor, 2026-10-25): Profil, Konto, Universitäten, Admin and Abmelden live in the avatar menu */
.nav-extra, .nav-profile { display: none !important; }
.nav-menu { display: block; }
@media (max-width: 1023.98px) { .site-header nav { gap: 0.1rem; } }
@media (max-width: 560px) {
  .nav-goal { display: inline-flex; gap: 0.3rem; padding: 0 0.2rem; font-size: 0.78rem; }
  .nav-goal-bar { width: 30px; height: 6px; }
}
@media (max-width: 420px) { .nav-menu > summary { padding: 0 0.25rem; } .nav-menu canvas.avatar { width: 24px; height: 24px; } }

.nav-menu-panel button { justify-content: flex-start; }
/* «Geführter Modus» as a small switch inside the statement card (SPEC D54) */
.card .guided-toggle { margin: 0.6rem 0 0; padding-top: 0.5rem; border-top: 1px solid var(--line); }
.card .guided-toggle button { font-size: 0.85rem; min-height: 32px; }
.card .guided-toggle .switch { width: 1.9rem; height: 1.05rem; }
.card .guided-toggle .switch::after { width: 0.75rem; height: 0.75rem; }
.card .guided-toggle [aria-pressed="true"] .switch::after { left: 1rem; }
/* clutter reduction (Victor, 2026-10-25) */
.ex-statement-card, .solve-task > .card { position: relative; }
.solve-toggle { position: absolute; right: 0.5rem; bottom: 0.5rem; margin: 0; width: 2rem; height: 2rem; justify-content: center; padding: 0; border-radius: 50%; font-size: 1rem; }
.power-more { margin-top: 0.4rem; }
.power-more > summary { color: var(--accent); cursor: pointer; display: inline-block; }
.profile-goal { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.more-hint { margin: 0.2rem 0 0.6rem; }
.more-hint > summary { color: var(--accent); cursor: pointer; display: inline-block; }
.profile-goal select { min-height: var(--tap); font: 500 16px var(--font); padding: 0 0.6rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }

/* skeleton screens (Victor, 2026-10-26): placeholders in the shape of what is loading */
.skel-wrap { display: flex; flex-direction: column; gap: 0.55rem; margin: 0.8rem 0 1rem; }
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--sunken) 0%, var(--line) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: skel-shine 1.4s ease-in-out infinite; }
.skel-line { height: 0.8rem; }
.skel-box { padding: 1rem; border-radius: var(--radius); display: flex; flex-direction: column; gap: 0.6rem; background: var(--surface); border: 1px solid var(--line); animation: none; }
.skel-box .skel-line { height: 1rem; }
.skel-row { display: flex; align-items: center; gap: 0.6rem; }
.skel-row .skel-line { flex: none; }
.skel-dot { width: 1rem; height: 1rem; border-radius: 50%; flex: none; }
.skel-num { width: 1.2rem; height: 0.8rem; flex: none; }
.chat-pending .skel-line { margin: 0.25rem 0; min-width: 9rem; }
@keyframes skel-shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* avatar big view (Victor, 2026-10-26) */
/* responsive feel instead of a magnifier (Victor, 2026-10-26): lift and glow on hover, dip on press */
main canvas[data-avatar], .toasts canvas[data-avatar] { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease; }
main canvas[data-avatar]:hover, .toasts canvas[data-avatar]:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.06); box-shadow: 0 6px 16px rgba(40, 75, 155, 0.28); }
main canvas[data-avatar]:active, .toasts canvas[data-avatar]:active { transform: scale(0.95); box-shadow: 0 2px 6px rgba(40, 75, 155, 0.2); transition-duration: 0.06s; }
.avatar-editor canvas[data-avatar], .avatar-editor canvas[data-avatar]:hover, .avatar-editor canvas[data-avatar]:active { cursor: inherit; transform: none; filter: none; box-shadow: none; }
.avatar-view[open] { animation: avatar-pop 0.18s cubic-bezier(.2, .9, .3, 1.25); }
.avatar-view[open]::backdrop { animation: avatar-fade 0.18s ease; }
@keyframes avatar-pop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes avatar-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  main canvas[data-avatar], .toasts canvas[data-avatar] { transition: none; }
  main canvas[data-avatar]:hover, main canvas[data-avatar]:active { transform: none; }
  .avatar-view[open], .avatar-view[open]::backdrop { animation: none; }
}
.avatar-view { border: 0; padding: 1rem 1rem 0.8rem; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); text-align: center; }
.avatar-view::backdrop { background: rgba(10, 12, 16, 0.6); }
.avatar-view canvas { display: block; width: min(288px, 70vw); height: auto; aspect-ratio: 1 / 2; image-rendering: pixelated; border-radius: 10px; margin: 0 auto; }
.avatar-view-name { margin: 0.6rem 0 0; font-weight: 600; }
.avatar-view-close { position: absolute; top: 0.3rem; right: 0.4rem; border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; min-height: 0; padding: 0.2rem 0.5rem; cursor: pointer; }
