/* Lerncheck — Knoty DNA. Tokens and shared primitives live in assets/knoty-dna.css. */

:root {
  color-scheme: light;
  --Y: #FFB800;
  --YL: #FFF8DC;
  --YD: #CC8F00;
  --RL: #FFEDEB;
  --G: #34C759;
  --GL: #E8FAF0;
  --B: #2563EB;
  --BL: #EBF4FF;
  --K: #1A1710;
  --CR: #FAF5E8;
  --CR2: #F5EFDC;
  --T2: #514B40;
  --T3: #9E9B97;
  --BD: #E8E2D0;
  --line: #1A1710;
  --line-soft: #E8E2D0;
  --grid-line: rgba(26, 23, 16, .045);
  --surface-card: #FFFFFF;
  --surface-elev: #FFFFFF;
  --on-y: #1A1710;
  --FD: 'Space Grotesk', system-ui, sans-serif;
  --FB: 'Plus Jakarta Sans', system-ui, sans-serif;
  --r8: 8px;
  --r12: 12px;
  --r16: 16px;
  --r20: 20px;
  --r28: 28px;
  --r100: 100px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --K: #FAF5E8;
  --CR: #0E0C07;
  --CR2: #15120B;
  --T2: #C9C3B4;
  --T3: rgba(250, 245, 232, .40);
  --BD: rgba(250, 245, 232, .12);
  --line: rgba(250, 245, 232, .22);
  --line-soft: rgba(250, 245, 232, .12);
  --grid-line: rgba(250, 245, 232, .04);
  --surface-card: #1B1710;
  --surface-elev: #221D14;
  --YD: #FFC83A;
  --YL: rgba(255, 184, 0, .14);
  --RL: rgba(232, 50, 28, .16);
  --B: #4D8DFF;
  --G: #5DD480;
  --GL: rgba(52, 199, 89, .18);
}

html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--CR);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: -1px -1px;
  color: var(--K);
  font: 16px/1.55 var(--FB);
}
p, h1, h2, h3, figure, fieldset, legend, ul, ol { margin: 0; }
fieldset { padding: 0; border: 0; min-inline-size: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 1; color: var(--T2); background: var(--CR2); box-shadow: none; }
:focus-visible { outline: 2px solid #1F4FBE; outline-offset: 2px; }
:root[data-theme="dark"] :focus-visible, .dark-panel :focus-visible { outline-color: var(--Y); }
h1:focus, h3[tabindex]:focus, #app:focus, #home:focus { outline: none; }
/* knoty-dna sets .fill-* to white-space:nowrap; on narrow phones that clips
   long German words ("Unterlagen", "Zuordnungen"). Allow wrapping inside fills. */
.fill-y, .fill-r, .fill-k { white-space: normal; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

h1, h2, h3 {
  font-family: var(--FD);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.06;
  overflow-wrap: break-word;
}
h1 { font-size: clamp(2.1rem, 6.2vw, 4.6rem); overflow-wrap: anywhere; hyphens: auto; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -.025em; }
h3 { font-size: 1.05rem; line-height: 1.25; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--T2);
  font: 700 12px/1.2 var(--FD);
  letter-spacing: 2.2px;
  text-transform: uppercase;
}
.eyebrow::before { content: ''; width: 26px; height: 3px; background: var(--Y); border-radius: var(--r100); }
.intro { color: var(--T2); margin-top: 14px; max-width: 56ch; font-size: 1rem; }
.muted { color: var(--T2); }

.shell { width: min(1280px, calc(100% - 80px)); margin-inline: auto; }
.topbar {
  position: relative;
  z-index: 10;
  border-bottom: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--CR) 88%, transparent);
}
.header-inner { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--K);
  text-decoration: none;
  font: 800 1.2rem/1 var(--FD);
  letter-spacing: -.045em;
}
.wordmark .tri-circle { --tri-size: 25px; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r100);
  background: var(--surface-card);
  color: var(--K);
  font: 700 .78rem/1 var(--FD);
}
.theme-toggle .tri-circle { --tri-size: 15px; }
.theme-toggle[aria-pressed='true'] { background: var(--Y); color: var(--on-y); border-color: var(--on-y); }
.theme-toggle[aria-pressed='true'] .tri-circle { filter: drop-shadow(0 0 5px rgba(26, 23, 16, .28)); }
.flow-page { padding-block: 44px 38px; min-height: calc(100vh - 68px); }
.skip, .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip:focus { clip-path: none; z-index: 20; width: auto; height: auto; margin: 12px; padding: 10px; background: var(--surface-card); }

/* Knoty cards: sharp colour block beneath the card, no blur. */
.knot-card { --r-card: var(--r28); --shadow-offset: 10px; margin: 0 10px 10px 0; }
.knot-card > .knot-card__inner {
  background: var(--surface-card);
  padding: 27px 29px;
  color: var(--K);
}
:root[data-theme='dark'] .knot-card[data-shadow='black']::before { background: var(--R); }
:root[data-theme='dark'] .knot-card--solid-k > .knot-card__inner {
  border-color: var(--line);
}
.centered { max-width: 790px; margin-inline: 10px auto; }

.setup-layout { display: grid; grid-template-columns: minmax(0, 1.33fr) minmax(0, 1fr); align-items: start; gap: 32px; }
.setup-form > .knot-card__inner { padding: 24px; }
.setup-form h3, .selection-panel h3 { margin-bottom: 14px; font-size: clamp(1.25rem, 2.5vw, 1.65rem); }
.setup-form fieldset { margin-top: 16px; }
.fields { display: grid; grid-template-columns: 1fr 1fr 1.23fr; gap: 12px; }
.fields label, .answer-label { display: grid; gap: 6px; min-width: 0; color: var(--T2); font-size: .84rem; font-weight: 700; }
input:not([type=checkbox], [type=radio]), select, textarea {
  min-width: 0;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--line-soft);
  border-radius: var(--r12);
  background: var(--surface-elev);
  color: var(--K);
  font-size: .95rem;
  font-weight: 500;
}
select { appearance: none; padding-right: 36px; background-image:
  linear-gradient(45deg, transparent 47%, var(--K) 48% 60%, transparent 61%),
  linear-gradient(135deg, transparent 47%, var(--K) 48% 60%, transparent 61%);
  background-position: right 17px center, right 11px center;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
input[type=date] { appearance: none; }
input::placeholder, textarea::placeholder { color: var(--T2); opacity: 1; }
input:is([type=checkbox], [type=radio]) { accent-color: var(--K); width: 18px; height: 18px; margin: 0; flex: 0 0 auto; }
legend { margin-bottom: 8px; font-family: var(--FD); font-weight: 700; }
.topics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.topic-pick {
  display: flex; align-items: center; gap: 8px; min-height: 46px; min-width: 0; padding: 8px 10px;
  border: 1.5px solid var(--line-soft); border-radius: var(--r12); cursor: pointer;
  background: var(--surface-elev); font-size: .86rem;
}
.topic-pick:has(:checked) { border-color: var(--line); background: var(--YL); }
.topic-pick > span { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
:root[data-theme='dark'] .topic-pick:has(:checked) { border-color: var(--Y); }
.topic-pick small { flex: 0 0 auto; margin-left: auto; color: var(--T2); font-variant-numeric: tabular-nums; }
.scope-note { grid-column: 1 / -1; color: var(--T2); font: 700 .84rem/1.4 var(--FD); }
.form-end { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 9px; }
#app:has(.mobile-prepare:not([hidden])) { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
.mobile-prepare { display: none; }

.primary, .secondary, .text-button, .switch button, .question-list button {
  min-height: 44px;
  padding: 11px 20px;
  border-radius: var(--r100);
  font-family: var(--FD);
  font-weight: 700;
}
.primary {
  border: 1.5px solid var(--on-y);
  background: var(--Y);
  color: var(--on-y);
  box-shadow: 0 6px 0 -1px var(--on-y);
}
.primary:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 0 8px 0 -1px var(--on-y); }
.secondary { border: 1.5px solid var(--line); background: var(--surface-elev); color: var(--K); }
.secondary:hover:not(:disabled) { background: var(--YL); }
.text-button { border: 0; background: transparent; color: var(--K); padding-inline: 0; text-decoration: underline; text-underline-offset: 4px; }

.ready h1, .review h1, .results h1 { font-size: clamp(2rem, 4.4vw, 3.4rem); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 21px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 19px 0; }
.tags li { padding: 6px 14px; border: 1.5px solid var(--line); border-radius: var(--r100); background: var(--YL); color: var(--K); font: 700 .8rem/1.3 var(--FD); }

.quiz-layout { display: grid; grid-template-columns: minmax(0, 2.45fr) minmax(230px, 1fr); gap: 24px; align-items: start; }
.question-panel > .knot-card__inner { padding: clamp(20px, 3vw, 32px); }
/* The fixed keypad lives inside this card's isolating stacking context.
   Raise the card so the progress card's inner (z-index: 2) cannot cover keys. */
.question-panel:has(.calc-panel) { position: relative; z-index: 3; }
.question-panel h1 { font-size: clamp(1.75rem, 3.6vw, 3rem); max-width: 26ch; }
.question-note { margin: 10px 0 17px; color: var(--T2); font-size: .86rem; }
.dot { margin: 0 3px; }
.choices { display: grid; gap: 8px; margin-block: 15px 0; }
.choice {
  display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 8px 12px;
  border: 1.5px solid var(--line-soft); border-radius: var(--r12);
  cursor: pointer; color: var(--K); background: var(--surface-elev);
}
.choice:hover, .topic-pick:hover { border-color: var(--K); }
.choice:has(:checked) { border-color: var(--line); background: var(--YL); }
:root[data-theme='dark'] .choice:has(:checked) { border-color: var(--Y); }
.choice .letter {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: var(--r8);
  display: grid; place-items: center; background: var(--CR2); color: var(--K);
  font: 800 .72rem/1 var(--FD);
}
.choice small { color: var(--T2); }

.progress-panel > .knot-card__inner { padding: clamp(20px, 3vw, 28px); }
.progress-panel h2 { margin-bottom: 8px; }
.progress-panel p:not(.eyebrow) { color: var(--T2); font-size: .88rem; }
progress { appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: var(--r100); color: var(--K); background: var(--CR2); }
progress::-webkit-progress-bar { background: var(--CR2); border-radius: var(--r100); }
progress::-webkit-progress-value { background: var(--K); border-radius: var(--r100); }
progress::-moz-progress-bar { background: var(--K); border-radius: var(--r100); }
.progress-panel #answered { margin-bottom: 12px; }
.question-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.question-list button { min-height: 42px; padding: 6px; border: 1.5px solid var(--line-soft); background: var(--surface-elev); color: var(--K); }
.question-list button.done { background: var(--GL); border-color: var(--G); }
.question-list button[aria-current] { background: var(--K); border-color: var(--K); color: var(--CR); }
.progress-panel .text-button { margin-top: 6px; }
.answer-label { gap: 8px; }
textarea { resize: vertical; }
.numeric { display: flex; align-items: center; gap: 10px; }
.numeric input { max-width: 150px; }
.scene-card {
  margin-block: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--line-soft);
  border-radius: var(--r16);
  background: var(--surface-elev);
}
.visual-canvas { display: block; max-width: 100%; height: auto; margin-inline: auto; }
.scene-card figcaption { font-size: .9rem; line-height: 1.5; }

.graph { min-width: 0; background: var(--surface-elev); border: 1.5px solid var(--line-soft); border-radius: var(--r16); padding: 12px 17px 9px 12px; margin-block: 9px 12px; color: var(--K); }
.y-name, .x-name { font-size: .76rem; font-weight: 700; }
.y-name { margin-bottom: 10px; }
.x-name { text-align: right; margin-top: 22px; }
.plot-frame { position: relative; height: 156px; margin-left: 38px; }
.plot-frame svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot-frame .grid-lines { stroke: var(--line-soft); }
.plot-frame .grid-lines line { vector-effect: non-scaling-stroke; stroke-width: 1; }
.curve { stroke: var(--K); stroke-width: 2.8; fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.graph-dot { position: absolute; pointer-events: none; width: 8px; height: 8px; border: 1px solid var(--surface-elev); background: var(--K); border-radius: 50%; }
.y-tick, .x-tick { position: absolute; font-size: .72rem; font-variant-numeric: tabular-nums; }
.y-tick { top: var(--at); right: calc(100% + 8px); transform: translateY(-50%); }
.x-tick { left: var(--at); top: calc(100% + 5px); transform: translateX(-50%); }
.graph-dot, .grid-point { top: var(--y); left: var(--x); transform: translate(-50%, -50%); }
.grid-point { position: absolute; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.grid-point:hover, .grid-point:focus-visible { background: var(--YL); }
.grid-point[aria-pressed=true] { border: 2px solid var(--K); width: 19px; height: 19px; }
.plot-instruction { font-size: .86rem; color: var(--T2); }
.table-scroll { margin-block: 9px 13px; overflow-x: auto; }
table { width: 100%; max-width: 550px; border-collapse: collapse; color: var(--K); font-size: .84rem; }
caption { text-align: left; color: var(--T2); font-size: .75rem; font-weight: 700; }
th, td { text-align: left; padding: 4px 9px; border-bottom: 1px solid var(--line-soft); }
thead th { background: var(--CR2); }
tbody th { font-weight: 500; }

.review-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.review-answers > div { border: 1.5px solid var(--line-soft); border-radius: var(--r16); padding: 12px; background: var(--surface-elev); }
.review-answers h2 { font-size: .98rem; margin-bottom: 6px; }
.review-answers p { white-space: pre-wrap; overflow-wrap: anywhere; }
.results-top { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 16px; margin-bottom: 21px; }
.results-top .intro { margin-top: 11px; }
.switch { display: inline-flex; padding: 3px; border: 1.5px solid var(--line-soft); background: var(--CR2); border-radius: var(--r100); }
.switch button { border: 1.5px solid transparent; background: transparent; color: var(--K); }
.switch button[aria-pressed=true] { border-color: var(--line); background: var(--surface-card); }
.results-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: start; gap: 20px; }
.topic-panel > .knot-card__inner > p { margin-top: 8px; font-size: .86rem; }
.topic-results { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 16px 0 0; }
.topic-results li { border: 1.5px solid var(--line-soft); border-radius: var(--r12); padding: 11px 12px; background: var(--surface-elev); }
.topic-result-title, .topic-result-score { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.topic-result-score { margin-top: 9px; color: var(--T2); font-size: .76rem; }
.topic-result-score progress { flex: 1; min-width: 26px; }
.topic-result-score span { flex: 0 0 auto; }
.status { flex: 0 0 auto; font-size: .7rem; font-weight: 800; border-radius: var(--r100); padding: 5px 9px; }
.status.known { color: var(--K); background: var(--GL); }
.status.repeat { color: var(--K); background: var(--YL); }
.score-card { --r-card: var(--r28); }
.score-card > .knot-card__inner { padding: clamp(18px, 3vw, 28px); }
.score-card > .knot-card__inner { background: #1A1710; color: #FAF5E8; }
.score-card .eyebrow, .score-value span, .score-card .self-note { color: #C9C3B4; }
.score-value { font: 800 4.25rem/1 var(--FD); letter-spacing: -.06em; margin-bottom: 8px; }
.score-value span { font-size: .43em; letter-spacing: -.04em; }
.self-note, .priority { margin-top: 13px; padding-top: 12px; border-top: 1.5px dashed var(--line); }
.self-note { font-size: .82rem; }
.priority h2 { font-size: 1.05rem; margin-bottom: 5px; }
.solutions { margin-top: 18px; }
.solutions > .knot-card__inner > h2 { margin-bottom: 8px; }
details { border-bottom: 1.5px solid var(--line-soft); }
details:last-child { border-bottom: 0; }
summary { cursor: pointer; color: var(--K); font-weight: 700; padding: 12px 0; font-family: var(--FD); font-size: .92rem; }
summary span:last-child { display: inline-block; margin-left: 9px; color: var(--T2); font-size: .78rem; }
details p { margin: 7px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
details p strong { margin-right: 5px; }

/* REVIEW_flow №1/№5: reference after submission, explicit task states. */
.solution-detail { margin-top: 11px; border: 1.5px solid var(--line-soft); border-radius: var(--r12); background: var(--surface-elev); padding: 0 12px 10px; }
.solution-detail > summary { color: var(--K); }
.solution-block p { margin: 6px 0; font-size: .84rem; color: var(--T2); }
.solution-block strong { color: var(--K); }
.coverage-line { font: 800 .82rem/1.35 var(--FD); color: var(--K); margin-bottom: 7px; }
.score-card .coverage-line { color: #FAF5E8; }
.topic-tasks { margin-top: 10px; border-top: 1.5px dashed var(--line-soft); }
.topic-tasks > summary { padding: 9px 0 4px; font-size: .75rem; color: var(--T2); }
.topic-tasks ul { display: grid; gap: 6px; padding-bottom: 4px; }
.topic-tasks li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; font-size: .76rem; color: var(--K); }
.topic-tasks li > span:first-child { overflow-wrap: anywhere; }
.topic-tasks li small { grid-column: 1; color: var(--T2); }
.task-status { grid-column: 2; grid-row: 1 / span 2; align-self: center; white-space: nowrap; border-radius: var(--r100); padding: 4px 8px; font: 800 .68rem/1 var(--FD); color: var(--K); background: var(--YL); }
.task-status--wrong { background: var(--RL); }
.task-status--self { background: var(--BL); }
.task-status--right { background: var(--GL); }

/* REVIEW_flow №2: AI terms before input, self-check after submission. */
.ai-terms { margin: 10px 0 0; padding: 9px 11px; border: 1.5px solid var(--YD); border-radius: var(--r12); background: var(--YP); color: var(--K); font-size: .78rem; line-height: 1.4; }
.written-gate .gate-note .text-button { color: #FAF5E8; }
.self-check .review-criteria .answer-label select { margin-top: 6px; }
.criterion-fixed { display: grid; gap: 2px; padding: 8px 10px; border: 1.5px solid var(--line-soft); border-radius: var(--r12); background: var(--surface-elev); font-size: .82rem; }
.criterion-fixed small { color: var(--T2); }
.self-badge { margin-top: 10px; padding: 8px 11px; border-radius: var(--r100); background: var(--BL); color: var(--K); font: 800 .78rem/1.3 var(--FD); }

/* ── Flow: Unterlagen → Themen → Test → Ergebnis ───────────────────── */

.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; font: 700 .72rem/1 var(--FD); color: var(--T2); }
.steps li { padding: 6px 10px; border: 1.5px solid var(--line-soft); border-radius: var(--r100); background: var(--surface-elev); }
.steps li.current { border-color: var(--on-y); background: var(--Y); color: var(--on-y); }
.flow-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .8fr); gap: 26px; align-items: start; }
.flow-layout--single { grid-template-columns: minmax(0, 780px); }
.flow-main, .flow-main > * { min-width: 0; max-width: 100%; }
.flow-main > h1 { margin-top: 4px; overflow-wrap: break-word; hyphens: auto; }
.upload-card > .knot-card__inner, .topics-card > .knot-card__inner, .auth-card > .knot-card__inner { padding: clamp(20px, 3vw, 30px); overflow: hidden; }
.upload-card h2, .topics-card h2, .auth-card h2 { margin-bottom: 6px; }
.upload-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 16px; }
.upload-zone, .camera-zone {
  display: flex; align-items: center; gap: 11px; min-height: 64px; padding: 10px 16px;
  border: 1.5px dashed var(--line); border-radius: var(--r16); background: var(--surface-elev);
  cursor: pointer; font-family: var(--FD); font-weight: 700;
}
.upload-zone:hover, .camera-zone:hover { background: var(--YL); }
.upload-zone small { display: block; margin-top: 3px; color: var(--T2); font: 500 .75rem/1.2 var(--FB); }
.upload-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r12); background: var(--Y); color: var(--on-y); font-size: 1.4rem; }
.camera-zone > span { font-size: 1.25rem; color: var(--K); }
.file-list { display: grid; gap: 8px; margin-top: 10px; }
.file-empty { padding: 12px; border: 1.5px dashed var(--line-soft); border-radius: var(--r12); color: var(--T2); font-size: .85rem; }
.file-item { display: flex; align-items: center; gap: 11px; padding: 8px; border: 1.5px solid var(--line-soft); border-radius: var(--r12); background: var(--surface-elev); }
.file-thumb { flex: 0 0 46px; width: 46px; height: 46px; display: grid; place-items: center; overflow: hidden; border: 1.5px solid var(--line-soft); border-radius: 10px; background: var(--CR2); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb b { color: var(--K); font: 800 .7rem/1 var(--FD); }
.file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .86rem; font-weight: 600; }
.file-name small { display: block; margin-top: 2px; color: var(--T2); font-size: .72rem; font-weight: 500; }
.icon-button { min-height: 36px; padding: 5px 10px; border: 1.5px solid var(--line-soft); border-radius: var(--r100); background: var(--surface-card); color: var(--K); font: 700 .72rem/1 var(--FD); }
.icon-button:hover { background: var(--RL); }
.error { margin-top: 12px; padding: 10px 12px; border: 1.5px solid var(--R); border-radius: var(--r12); background: var(--RL); color: var(--K); font-size: .84rem; }
.error[hidden] { display: none; }
.hint-panel {
  position: relative; overflow: hidden; display: grid; gap: 12px;
  padding: clamp(22px, 3vw, 32px); border: 1.5px solid var(--line); border-radius: var(--r28);
  background: #08070A; color: #FAF5E8;
}
.hint-panel::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(250,245,232,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(250,245,232,.05) 1px, transparent 1px);
  background-size: 56px 56px;
}
.hint-panel > * { position: relative; z-index: 1; }
.hint-panel img { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 0 16px rgba(250,245,232,.28)); }
.hint-panel .eyebrow { color: #FAF5E8; }
.hint-panel h2 { font-size: clamp(1.5rem, 3vw, 2.4rem); }
.hint-panel p:not(.eyebrow):not(.hint-foot) { color: #C9C3B4; font-size: .9rem; }
.hint-foot { padding-top: 10px; border-top: 1.5px dashed rgba(250,245,232,.2); color: #C9C3B4; font-size: .78rem; }
.topics-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.coverage { padding: 6px 12px; border-radius: var(--r100); background: var(--YL); color: var(--K); font: 700 .76rem/1 var(--FD); }
.topic-list { display: grid; gap: 8px; margin-top: 16px; }
.topic-row { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1.5px solid var(--line-soft); border-radius: var(--r12); background: var(--surface-elev); }
.topic-row > div { flex: 1; min-width: 0; }
.topic-row strong { display: block; overflow-wrap: anywhere; font-size: .92rem; }
.topic-row small { display: block; margin-top: 2px; color: var(--T2); font-size: .74rem; }
.topic-state { flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--GL); color: var(--K); font-weight: 800; }
.topic-state.missing { background: var(--RL); color: var(--K); }
.topic-add { display: flex; align-items: end; gap: 9px; margin-top: 14px; }
.topic-add label { flex: 1; display: grid; gap: 5px; color: var(--T2); font: 700 .78rem/1 var(--FD); }
.topic-add button { white-space: nowrap; }
.quota h1 { max-width: 22ch; }
.quota-line { margin-top: 12px; color: var(--T2); font: 700 .82rem/1.5 var(--FD); overflow-wrap: anywhere; }
.results-actions + .quota-line { margin-top: 10px; }
.repeat-note {
  margin-top: 12px; padding: 7px 12px; border: 1.5px solid var(--YD); border-radius: var(--r8);
  background: var(--YL); color: var(--K); font: 700 .8rem/1.4 var(--FD);
}
.quota-back { margin-top: 14px; }
.dev-code { margin-top: 10px; padding: 8px 11px; border-radius: var(--r12); background: var(--CR2); color: var(--T2); font: 700 .8rem/1 var(--FD); }
.auth-card .answer-label { margin-top: 14px; }
.auth-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 12px; border: 1.5px solid var(--line); border-radius: var(--r100); background: var(--YL); color: var(--K); font: 700 .72rem/1 var(--FD); }
.auth-chip[hidden] { display: none; }

@media (max-width: 1020px) {
  .topic-result-title { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 40px); }
  .flow-page { padding-top: 28px; }
  .setup-layout, .quiz-layout, .results-grid, .flow-layout, .flow-layout--single { grid-template-columns: 1fr; gap: 16px; }
  .hint-panel { order: 2; }
  .topic-add { flex-wrap: wrap; }
  .wide-only { display: none; }
  .question-list { grid-template-columns: repeat(6, 1fr); }
  .topic-result-title { flex-wrap: nowrap; }
  .results-grid .score-card { grid-row: 1; }
}
@media (max-width: 460px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 60px; gap: 8px; }
  .wordmark { font-size: 1.08rem; gap: 7px; }
  .wordmark .tri-circle { --tri-size: 22px; }
  .theme-toggle { padding-inline: 10px; font-size: .72rem; gap: 6px; }
  .theme-toggle .tri-circle { --tri-size: 13px; }
  .flow-page { padding-block: 22px 26px; }
  .flow-main > h1 { font-size: 1.85rem; line-height: 1.12; }
  .question-panel h1 { font-size: 1.625rem; line-height: 1.1; max-width: none; }
  .knot-card { --shadow-offset: 6px; margin: 0 6px 6px 0; }
  .knot-card > .knot-card__inner { padding: 19px 18px; }
  .centered { margin-inline: 6px auto; }
  .fields { grid-template-columns: 1fr 1fr; gap: 9px; }
  .fields label:last-child { grid-column: 1 / -1; }
  .topics, .topic-results, .review-answers { grid-template-columns: 1fr; }
  .topic-pick { min-height: 44px; }
  .form-end { align-items: stretch; }
  .form-end button { flex: 1 0 100%; }
  .mobile-prepare:not([hidden]) {
    position: fixed; inset: auto 0 0; z-index: 9; display: flex; justify-content: center;
    width: 100%; min-height: 56px; padding: 9px 16px calc(9px + env(safe-area-inset-bottom));
    border: 0; border-top: 1.5px solid var(--line); border-radius: 0;
    background: var(--Y); color: var(--on-y);
  }
  .mobile-prepare:not([hidden]) span { font: 700 .82rem/1 var(--FD); }
  .question-note { margin-block: 7px 10px; }
  .graph { padding-right: 14px; }
  .plot-frame { height: 132px; margin-left: 29px; }
  .question-panel .plot-frame { height: 110px; }
  .question-panel .eyebrow { font-size: .68rem; }
  .x-name { margin-top: 20px; }
  .choice { min-height: 44px; padding-inline: 10px; }
  .question-list { grid-template-columns: repeat(5, 1fr); }
  .question-list button { min-height: 44px; }
  .steps { gap: 4px; font-size: .66rem; }
  .steps li { padding: 5px 8px; }
  .upload-actions { flex-direction: column; }
  .upload-zone, .camera-zone { min-height: 56px; }
  .file-name { font-size: .8rem; }
  .icon-button { padding: 5px 8px; font-size: .68rem; }
  .topic-add { flex-direction: column; align-items: stretch; }
  .topic-add button { width: 100%; }
  .hint-panel img { width: 76px; height: 76px; }
  .auth-chip { padding-inline: 8px; font-size: .66rem; }
  .score-value { font-size: 3.5rem; }
}

/* Home */
[hidden] { display: none !important; }
section[id], #probe, #app { scroll-margin-top: 84px; }
.topbar {
  position: sticky;
  top: 0;
  background: var(--CR);
}
.header-actions, .main-nav { display: flex; align-items: center; gap: clamp(12px, 2vw, 28px); }
.main-nav a { padding-block: 10px; font: 700 .9rem/1.2 var(--FD); }
.main-nav a:hover, .site-footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.header-cta, .hero-actions .btn, .final-section .btn { justify-content: center; text-align: center; }
.header-cta { margin-bottom: 5px; }
.wordmark .brand-dot { margin-inline-start: -6px; }
.theme { min-height: 44px; padding-inline: 6px; font: 700 .85rem/1 var(--FD); white-space: nowrap; }
.theme-icon { margin-inline-end: 5px; font-size: 1.15rem; }
.btn-ghost, .btn-ghost:hover { background: var(--surface-elev); color: var(--K); }
.btn-ghost:hover { text-decoration: underline; text-underline-offset: 3px; }
[data-theme="dark"] .auth-chip { color: var(--K); border-color: var(--line); }
[data-theme="dark"] .wordmark .tri-circle { background-color: #FAF5E8; border-radius: 50%; }
.in-flow .main-nav, .in-flow .header-cta { display: none; }
.exit { white-space: nowrap; }

.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 72px); padding-block: clamp(52px, 7vw, 102px); }
.hero h1 { margin-top: 3px; font-size: clamp(3rem, 6.12vw, 5.45rem); letter-spacing: -.072em; line-height: 1; overflow-wrap: normal; }
.hero .intro { max-width: 42ch; font-size: clamp(1rem, 1.4vw, 1.2rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin-top: 24px; }
.text-link { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.hero-numbers {
  display: flex; flex-wrap: wrap; gap: 5px 9px;
  margin-top: 28px; padding-top: 13px; border-top: 1.5px solid var(--line);
  width: fit-content; color: var(--T2); font: 700 .84rem/1.4 var(--FD);
}
.dark-panel { color: #FAF5E8; }
.dark-panel > .knot-card__inner,
.final-section, .site-footer { background: #1A1710; color: #FAF5E8; }
.dark-panel > .knot-card__inner { border-color: #595245; }
.dark-panel .meta, .dark-panel .demo-feedback, .dark-panel .knot-card__inner > p, .site-footer nav { color: #C9C3B4; }
.demo h2 { font-size: clamp(1.5rem, 3vw, 2.4rem); max-width: 22ch; }
.demo-top, .sample-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; margin-bottom: 14px; }
.label-stamp { padding: 5px 9px; border-radius: 5px; background: var(--Y); color: var(--on-y); font: 700 .86rem/1.2 var(--FD); }
.meta { color: var(--T2); font-size: .8rem; font-weight: 700; }
.demo .graph {
  --K: #1A1710; --surface-elev: #FAF5E8; --line-soft: #BFB49E;
  margin-block: 15px; color-scheme: light;
}
.demo .curve { stroke: var(--R); }
.demo .graph-dot { background: var(--R); }
.demo .plot-frame { height: clamp(112px, 13vw, 150px); }
.demo-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.demo-choices legend { color: #C9C3B4; font-size: .9rem; }
.demo-choices button { flex: 1 0 auto; min-height: 44px; padding: 6px 11px; border: 1.5px solid #928979; border-radius: var(--r-pill); color: #FAF5E8; font-weight: 700; }
.demo-choices button:hover, .demo-choices button[aria-pressed="true"] { background: var(--Y); color: var(--on-y); border-color: var(--Y); }
.demo-choices button[data-state="correct"] { background: #E8FAF0; color: #14522E; border-color: #E8FAF0; }
.demo-choices button[data-state="wrong"] { background: #FFEDEB; color: #941B10; border-color: #FFEDEB; }
.demo-feedback { min-height: 1.5em; margin-top: 9px; font-size: .84rem; }
.demo-next { margin-top: 11px; }
.demo-next[hidden] { display: none; }

.section { padding-block: clamp(40px, 5.1vw, 75px); }
.section h2 { font-size: clamp(2rem, 4.5vw, 4.25rem); line-height: 1.03; letter-spacing: -.055em; }
.section .setup-form h3, .section .selection-panel h3 { line-height: 1.2; }
.section-head { margin-bottom: 20px; }
.section-copy { color: var(--T2); max-width: 53ch; margin-top: 12px; }
.steps-section, .setup-section, .faq-section { background: var(--CR2); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 5vw, 66px); align-items: start; }
.home-steps, .tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.home-steps .knot-card__inner, .tiers .knot-card__inner { height: 100%; }
.home-steps h3, .tiers h3 { font-size: clamp(1.3rem, 2.25vw, 1.8rem); margin-bottom: 6px; }
.step-visual { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.step-visual .tri-circle { --tri-size: 38px; display: grid; place-items: center; color: var(--on-y); font: 700 1rem/1 var(--FD); }
.step-visual .tri-circle span { padding: 3px; background: var(--Y); border-radius: 50%; }
.step-visual img { width: auto; max-height: 48px; object-fit: contain; }
.home-steps p, .tiers p, .tiers li, .study-tip { color: var(--T2); }
.parent-list { display: grid; gap: 13px; margin-top: 17px; }
.parent-list li { display: flex; align-items: baseline; gap: 10px; }
.parent-list li > span { color: var(--on-y); background: var(--Y); border-radius: 50%; padding: 0 5px; }
.parent-list p { color: var(--T2); }
.sample-score { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score-number { font: 700 clamp(2.5rem, 5vw, 4.2rem)/1 var(--FD); letter-spacing: -.06em; }
.score-number span { font-size: .29em; letter-spacing: 0; }
.score-detail { margin: 8px 0 12px; color: var(--T2); font-size: .88rem; }
.score-topics { display: grid; gap: 9px; }
.score-topics li > div { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 3px; font-size: .85rem; }
.score-topics b { flex-shrink: 0; }
.study-tip { margin-top: 12px; padding-top: 9px; border-top: 1.5px dashed var(--line); font-size: .85rem; }
.selection-panel p { color: var(--T2); font-size: .9rem; }
.selection-panel .tags { margin-block: 10px; }
.selection-date { padding-top: 10px; border-top: 1.5px solid var(--line-soft); }
.setup-status { margin-top: 16px; color: var(--T2); }
.tiers .knot-card__inner { display: flex; flex-direction: column; align-items: start; }
.tiers ul { display: grid; gap: 4px; margin: 12px 0 18px; padding-inline-start: 1.15em; list-style: disc; font-size: .88rem; }
.tiers .btn { margin-top: auto; text-align: center; }
.faq-list summary { font-size: 1rem; }
.faq-list p { color: var(--T2); margin-block: 0 14px; }
.final-section .shell { display: grid; justify-items: start; gap: 20px; }
.final-section h2 { max-width: 22ch; }
.site-footer { border-top: 1px solid #595245; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 22px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.site-footer a { font-size: .9rem; }
.site-footer .brand { display: inline-flex; align-items: center; gap: 8px; font: 700 1.25rem/1 var(--FD); }
.site-footer .brand-mark { --tri-size: 25px; }

.quiz-strip {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 10px 15px;
  border: 1.5px solid var(--line); border-radius: var(--r16); background: var(--surface-card);
}
.quiz-position { flex-shrink: 0; font: 700 1rem/1 var(--FD); font-variant-numeric: tabular-nums; }
.quiz-segments { display: flex; flex: 1; max-width: 20rem; gap: 4px; }
.quiz-segments span { flex: 1; height: 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--CR2); }
.quiz-segments .done { border-color: var(--K); background: var(--K); }
.quiz-segments .current { border-color: var(--on-y); background: var(--Y); }
.quiz-nav {
  position: fixed; inset: auto 0 0; z-index: 5;
  padding-block: 9px calc(14px + env(safe-area-inset-bottom)); background: var(--CR);
  border-top: 1.5px solid var(--line);
}
.quiz-nav .shell { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#app:has(.quiz-nav) { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
html:has(.quiz-nav) { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
.switch button[aria-pressed=true] { background: var(--Y); color: var(--on-y); border-color: var(--on-y); }

@media (max-width: 940px) {
  .main-nav { display: none; }
  .section .home-steps .knot-card__inner, .section .tiers .knot-card__inner { padding: 19px 16px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .setup-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
  .setup-form > .knot-card__inner { padding-inline: 19px; }
  .topic-pick { gap: 6px; padding-inline: 8px; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields label:last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .hero, .split { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-block: 36px 44px; }
  .hero h1 { font-size: clamp(2.65rem, 9vw, 4.2rem); }
  .home-steps, .tiers { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .home-steps .knot-card__inner, .tiers .knot-card__inner { padding-block: 15px; }
  .step-visual { float: right; margin: 0 0 5px 10px; gap: 7px; }
  .step-visual img { display: none; }
}
@media (max-width: 460px) {
  .header-cta { display: none; }
  .header-actions { gap: 6px; }
  .header-actions .auth-chip { display: none; }
  .header-actions .exit { font-size: .75rem; min-height: 40px; padding-inline: 11px; }
  .hero h1 { font-size: clamp(2rem, 11.5vw, 2.75rem); }
  .site-footer nav { flex-basis: 100%; order: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  [data-revealed] { animation: appear .34s ease-out both; }
  @keyframes appear {
    from { transform: translateY(10px); }
    to { transform: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .primary:hover:not(:disabled), .btn-y:hover, .btn-y:active { transform: none; }
}

/* ── Written answers, calculator and KI-Auswertung (wave 5) ───────────── */

.written-fields { display: grid; gap: 13px; margin-top: 16px; }
.written-fields textarea { min-height: 96px; line-height: 1.45; }
.written-fields .answer-label { color: var(--T2); font-size: .84rem; font-weight: 700; }
.calc-row { display: flex; align-items: end; gap: 9px; }
.calc-row .answer-label { flex: 1; min-width: 0; }
.calc-toggle {
  flex: 0 0 auto; min-height: 46px; padding: 0 13px; white-space: nowrap;
  border: 1.5px solid var(--on-y); border-radius: var(--r100);
  background: var(--Y); color: var(--on-y);
  font: 700 .8rem/1 var(--FD);
}
.calc-toggle[aria-expanded="true"] { background: var(--K); color: var(--CR); border-color: var(--K); }
.skip-button { justify-self: start; font-size: .82rem; }

.calc-panel {
  padding: 11px; border: 1.5px solid #595245; border-radius: var(--r16);
  background: #1A1710; color: #FAF5E8;
}
.calc-area { display: grid; gap: 9px; min-width: 0; }
.calc-display {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 46px; padding: 6px 8px; margin-bottom: 8px;
  border: 1.5px solid #595245; border-radius: var(--r12); background: #0E0C07;
}
.calc-display input {
  flex: 1 1 88px; width: auto; min-height: 38px; padding: 2px 4px;
  border: 0; background: transparent; color: #FAF5E8;
  font: 700 1.15rem/1 var(--FD); font-variant-numeric: tabular-nums;
}
/* #C9C3B4 on #0E0C07 is ~9:1 — the example must not be dark-on-dark. */
.calc-display input::placeholder { color: #C9C3B4; opacity: 1; }
.calc-display input:focus { outline: none; }
.calc-display:focus-within { outline: 2px solid var(--Y); outline-offset: 2px; }
.calc-result { flex: 0 0 auto; color: #FAF5E8; font: 800 1.15rem/1 var(--FD); font-variant-numeric: tabular-nums; }
/* Four rows of five keys: digits left, operations in the two right columns.
   The lower row must stay above the fixed quiz navigation on every viewport. */
.calc-keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.calc-keys button {
  min-height: 40px; padding: 5px 3px;
  border: 1.5px solid #595245; border-radius: var(--r12);
  background: #221D14; color: #FAF5E8;
  font: 700 1rem/1 var(--FD);
}
.calc-keys button:hover { background: #3B2E0E; border-color: var(--Y); }
.calc-keys button[data-calc="/"], .calc-keys button[data-calc="*"],
.calc-keys button[data-calc="-"], .calc-keys button[data-calc="+"],
.calc-keys button[data-calc="^"], .calc-keys button[data-calc="√("] {
  background: #FFB800; color: #1A1710; border-color: #1A1710;
}
/* The insert action lives in the display row, next to the number — never
   below the keypad where it can fall under the bottom edge of the screen. */
.calc-insert {
  flex: 0 0 auto; min-height: 38px; margin: 0; padding: 0 12px;
  border: 1.5px solid var(--on-y); border-radius: var(--r100);
  background: var(--Y); color: var(--on-y); font: 800 .8rem/1 var(--FD);
  white-space: nowrap;
}
.calc-note { margin-top: 6px; color: #C9C3B4; font-size: .74rem; line-height: 1.35; }
.read-row, .written-grid-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.written-grid-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.written-grid-fields select { min-height: 46px; }

/* Wide screens: the calculator sits beside the fields it fills. */
@media (min-width: 761px) {
  .calc-area:has(.calc-panel) { grid-template-columns: minmax(0, 1fr) minmax(270px, 330px); align-items: start; }
}
/* 360 px: a compact panel above the fixed quiz navigation, not past the fold.
   80 px nav reserve + 8 px gap; the safe-area padding is added to both. */
@media (max-width: 480px) {
  .calc-panel {
    position: fixed; inset: auto 8px calc(88px + env(safe-area-inset-bottom)); z-index: 8;
    max-height: min(62vh, 420px); overflow: auto;
  }
  .calc-display { min-height: 44px; gap: 5px; padding: 6px 8px; }
  .calc-display input { font-size: 1rem; }
  .calc-insert { min-height: 36px; padding-inline: 9px; font-size: .74rem; }
  .calc-note { display: none; }
}

.written-gate > .knot-card__inner { border-color: #595245; }
.written-gate h1 { max-width: 24ch; }
.written-gate .intro, .gate-note { color: #C9C3B4; }
.written-gate .intro strong { color: #FAF5E8; }
.gate-list { display: grid; gap: 7px; margin-top: 16px; padding-left: 1.1em; list-style: disc; color: #FAF5E8; font-size: .88rem; }
.gate-note { margin-top: 15px; font-size: .78rem; }
.wait-rows { display: grid; gap: 8px; margin-top: 21px; }
.wait-rows span { height: 12px; border-radius: var(--r100); background: #221D14; }
.wait-rows span:nth-child(2) { width: 82%; }
.wait-rows span:nth-child(3) { width: 64%; }

.written-results { display: grid; gap: 18px; }
.written-result-hero {
  padding: clamp(22px, 3vw, 36px); border: 1.5px solid #595245; border-radius: var(--r28);
  background: #1A1710; color: #FAF5E8;
}
.written-score-line { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; }
.written-score { font: 800 clamp(3rem, 6vw, 5rem)/1 var(--FD); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.written-score span { color: #C9C3B4; font-size: .42em; letter-spacing: -.03em; }
.grade-box {
  display: grid; justify-items: center; gap: 2px; min-width: 96px; padding: 11px 16px;
  border-radius: var(--r16); background: var(--Y); color: var(--on-y);
}
.grade-box strong { font: 800 2.6rem/1 var(--FD); }
.grade-box span { font: 700 .76rem/1 var(--FD); }
.written-percent { margin-top: 8px; color: #C9C3B4; font-size: .92rem; }
.written-next { margin-top: 15px; padding-top: 12px; border-top: 1.5px dashed #595245; font: 700 .95rem/1.45 var(--FD); }
.grade-source { margin-top: 8px; color: #C9C3B4; font-size: .78rem; }
.written-items-card > .knot-card__inner > p { margin-top: 6px; font-size: .86rem; }
.written-items { display: grid; gap: 10px; margin-top: 16px; }
.written-item { padding: 13px 14px; border: 1.5px solid var(--line-soft); border-radius: var(--r16); background: var(--surface-elev); }
.written-item.is-disputed { border-color: var(--YD); background: var(--YL); }
.written-item-head { display: flex; align-items: center; gap: 10px; }
.written-no {
  flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: var(--r8); background: var(--K); color: var(--CR); font: 800 .85rem/1 var(--FD);
}
.item-type { font: 700 .94rem/1.2 var(--FD); }
.item-points { margin-top: 3px; color: var(--T2); font-size: .8rem; font-variant-numeric: tabular-nums; }
.correction { margin-top: 10px; font-size: .9rem; font-weight: 600; overflow-wrap: anywhere; }
.criteria-list { display: grid; gap: 5px; margin-top: 9px; padding-top: 9px; border-top: 1.5px dashed var(--line-soft); }
.criteria-list li { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--T2); }
.criteria-list strong { flex: 0 0 auto; color: var(--K); font-variant-numeric: tabular-nums; }
.status-chip {
  display: inline-block; margin-top: 10px; padding: 5px 10px; border-radius: var(--r100);
  background: var(--YL); color: var(--K); font: 700 .74rem/1 var(--FD);
}
.written-status { color: var(--T2); font: 700 .78rem/1.35 var(--FD); }
[name=written-ergebnis].is-updated { border-color: var(--YD); background: var(--YL); }
.quiz-segments .skipped { border-color: var(--YD); background: repeating-linear-gradient(45deg, var(--Y) 0 3px, var(--YL) 3px 6px); }
.question-list button.skipped { border-color: var(--YD); color: var(--K); }
.submit-status { display: grid; gap: 6px; margin-top: 16px; text-align: left; }
.submit-status li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 8px;
  padding: 8px 10px; border: 1.5px solid var(--line-soft); border-radius: var(--r12);
  font-size: .82rem; color: var(--T2);
}
.submit-status strong { color: var(--K); font: 700 .78rem/1.3 var(--FD); }
.task-details { margin-top: 10px; }
.task-details summary { min-height: 32px; color: var(--T2); font: 700 .78rem/1.35 var(--FD); cursor: pointer; }
.task-detail-grid { display: grid; gap: 9px; margin-top: 8px; }
.task-detail-grid h3 { font-size: .78rem; }
.task-detail-grid p { font-size: .82rem; line-height: 1.5; }
.task-detail-grid .verbatim { white-space: pre-wrap; overflow-wrap: anywhere; }
.review-start { margin-top: 16px; }
.review-card .review-criteria { display: grid; gap: 10px; margin-top: 17px; }
.review-card .review-criteria legend { margin-bottom: 8px; }

@media (max-width: 460px) {
  .calc-row { flex-direction: column; align-items: stretch; gap: 9px; }
  .calc-toggle { width: 100%; }
  .calc-keys { gap: 6px; }
  .calc-keys button { min-height: 46px; font-size: .98rem; }
  .read-row, .written-grid-fields { grid-template-columns: 1fr; }
  .written-score { font-size: 3.2rem; }
  .grade-box { min-width: 78px; padding: 9px 12px; }
  .criteria-list li { font-size: .76rem; }
  .submit-status li { grid-template-columns: auto minmax(0, 1fr); }
  .submit-status strong { grid-column: 2; }
}
