/* Lerncheck — Knoty DNA. Tokens and shared primitives live in assets/knoty-dna.css. */

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/fonts/space-grotesk-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('assets/fonts/plus-jakarta-sans-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --Y: #FFB800;
  --YL: #FFF8DC;
  --YD: #CC8F00;
  --R: #E8321C;
  --RL: #FFEDEB;
  --G: #34C759;
  --GL: #E8FAF0;
  --B: #2563EB;
  --BL: #EBF4FF;
  --K: #1A1710;
  --CR: #FAF5E8;
  --CR2: #F5EFDC;
  --T2: #6B6560;
  --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;
  --shadow-black: #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: rgba(250, 245, 232, .66);
  --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;
  overflow-x: hidden;
  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: .48; }
:focus-visible { outline: 2px solid var(--Y); outline-offset: 2px; }
h1:focus, #app: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; }
.header-inner p { color: var(--T2); font-size: .82rem; font-weight: 600; }
.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)); }
#app { padding-block: 44px 38px; min-height: calc(100vh - 140px); }
.footer {
  border-top: 1.5px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  justify-content: space-between;
  padding-block: 17px 23px;
  color: var(--T2);
  font-size: .82rem;
}
.footer a { color: var(--K); text-underline-offset: 3px; }
.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);
  border: 1.5px solid var(--line);
  border-radius: var(--r-card);
  padding: 27px 29px;
  color: var(--K);
}
:root[data-theme='dark'] .knot-card[data-shadow='black']::before { background: var(--shadow-black); }
:root[data-theme='dark'] .knot-card--solid-k > .knot-card__inner {
  background: #08070A;
  border-color: var(--line);
  color: var(--K);
}
.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-main > h1 { margin-top: 3px; }
.setup-form { margin-top: 25px; }
.setup-form > .knot-card__inner { padding: 24px; }
.setup-form h2 { margin-bottom: 17px; }
.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: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); }
:root[data-theme='dark'] .topic-pick:has(:checked) { border-color: var(--Y); }
.topic-pick small { margin-left: auto; color: var(--T2); font-variant-numeric: tabular-nums; }
.form-end { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 9px; }
.form-end p { color: var(--T2); font-size: .87rem; }

.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; }

/* Preview: the dark "focus" panel of the setup screen. */
.preview {
  position: relative;
  overflow: hidden;
  margin-top: 10px;
  margin-bottom: 10px;
  border-radius: var(--r28);
  background-color: #08070A;
  color: var(--K);
  padding: clamp(22px, 3vw, 34px);
  display: grid;
  gap: 20px;
}
:root[data-theme='dark'] .preview { background-color: #08070A; border: 1.5px solid var(--line); }
.preview::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;
}
.preview > * { position: relative; z-index: 1; }
.preview .eyebrow { color: var(--K); }
.preview h2 { font-size: clamp(1.9rem, 3.6vw, 3.1rem); max-width: 18ch; }
.preview-copy > p:last-child { margin-top: 14px; color: var(--T2); max-width: 42ch; font-size: .92rem; }
.preview-figure {
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-radius: var(--r20);
  padding: 14px 15px 10px;
  color: var(--K);
}
.figure-top { display: flex; align-items: baseline; justify-content: space-between; gap: 5px 9px; flex-wrap: wrap; margin-bottom: 12px; }
.figure-top strong { font-size: .87rem; }
.figure-top span { color: var(--T2); font-size: .72rem; }
.preview .graph { background: transparent; border: 0; margin: 0; padding: 0; }
.preview .plot-frame { height: clamp(95px, 13vw, 150px); }
.illo-cluster { position: relative; min-height: 150px; }
.illo-cluster img {
  position: absolute;
  width: 106px;
  height: 106px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(250, 245, 232, .28));
}
.illo-cluster img:nth-child(1) { width: 138px; height: 138px; top: 0; left: 50%; transform: translateX(-50%) rotate(-8deg); }
.illo-cluster img:nth-child(2) { top: 44px; left: 2%; transform: rotate(-14deg); }
.illo-cluster img:nth-child(3) { top: 52px; right: 2%; transform: rotate(12deg); }
.illo-cluster img:nth-child(4) { bottom: 0; left: 27%; transform: rotate(7deg); }

.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); }
.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); }
.quiz-nav { display: flex; gap: 8px; justify-content: space-between; border-top: 1.5px dashed var(--BD); margin-top: 20px; padding-top: 15px; }
.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 progress { margin-block: 9px 14px; }
.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); }
:root[data-theme='dark'] .question-list button.done { color: var(--K); }
.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);
}
.scene-card b { display: block; margin-bottom: 6px; color: var(--T2); font: 700 11px/1 var(--FD); letter-spacing: 1.6px; text-transform: uppercase; }
.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 .eyebrow { color: var(--K); }
.score-value { font: 800 4.25rem/1 var(--FD); letter-spacing: -.06em; margin-bottom: 8px; }
.score-value span { font-size: .43em; letter-spacing: -.04em; opacity: .7; }
.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; }

/* ── 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(--YD); }
.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(--YD); 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: rgba(250,245,232,.72); font-size: .9rem; }
.hint-foot { padding-top: 10px; border-top: 1.5px dashed rgba(250,245,232,.2); color: rgba(250,245,232,.5); 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(--R); }
.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-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); }
  #app { 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; }
  .preview { margin-top: 0; }
  .preview .plot-frame { height: 122px; }
  .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; }
  .header-inner p { display: none; }
  .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; }
  #app { padding-block: 22px 26px; }
  .flow-main > h1 { font-size: 1.85rem; line-height: 1.12; }
  .question-panel h1 { font-size: 1.7rem; line-height: 1.15; 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; }
  .setup-form { margin-top: 18px; }
  .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%; }
  .question-panel h1 { font-size: 1.85rem; }
  .graph { padding-right: 14px; }
  .plot-frame { height: 132px; margin-left: 29px; }
  .question-panel .eyebrow { font-size: .68rem; }
  .x-name { margin-top: 20px; }
  .choice { 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; }
  .illo-cluster { min-height: 132px; }
  .illo-cluster img { width: 88px; height: 88px; }
  .illo-cluster img:nth-child(1) { width: 112px; height: 112px; }
  .score-value { font-size: 3.5rem; }
  .footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
