/* Layout: answer-sheet app — sticky header, single reading column, numbered item boxes like the telc Antwortbogen */
:root {
  --bg: #f3f5f8;
  --paper: #ffffff;
  --ink: #16213a;
  --muted: #5d6779;
  --line: #d9dee7;
  --soft: #e9edf4;
  --accent: #2443c9;
  --accent-ink: #ffffff;
  --accent-soft: #e4e9fb;
  --marker: #ffe066;
  --ok: #17803d;
  --ok-soft: #dcf3e3;
  --bad: #c2362b;
  --bad-soft: #fbe3e0;
  --warn: #a86400;
  --warn-soft: #fbefd7;
  --f-display: "Unbounded", "Onest", system-ui, sans-serif;
  --f-ui: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-read: "Literata", Georgia, "Times New Roman", serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141f; --paper: #171e2c; --ink: #e6eaf2; --muted: #9aa4b6; --line: #2b3446; --soft: #1f2738;
    --accent: #8ea2ff; --accent-ink: #0f141f; --accent-soft: #232d4d; --marker: #6b5a12;
    --ok: #5fd08a; --ok-soft: #173326; --bad: #ff8a7d; --bad-soft: #3a1d1b; --warn: #f0b85a; --warn-soft: #3a2c13;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141f; --paper: #171e2c; --ink: #e6eaf2; --muted: #9aa4b6; --line: #2b3446; --soft: #1f2738;
  --accent: #8ea2ff; --accent-ink: #0f141f; --accent-soft: #232d4d; --marker: #6b5a12;
  --ok: #5fd08a; --ok-soft: #173326; --bad: #ff8a7d; --bad-soft: #3a1d1b; --warn: #f0b85a; --warn-soft: #3a2c13;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 15px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
/* logo in two tight lines: "DTB B2 Beruf" over a smaller "Prüfungstrainer"; fits the one-line header height */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-decoration: none; color: var(--ink); margin-right: auto; white-space: nowrap; }
.brand b { font-family: var(--f-display); font-weight: 600; font-size: 15px; line-height: 1.1; letter-spacing: .01em; }
.brand span { font-size: 11px; line-height: 1.15; letter-spacing: .03em; color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.nav a.on, .nav a:hover { background: var(--soft); color: var(--ink); }
.nav .cnt { font-family: var(--f-mono); font-size: 11px; background: var(--bad); color: var(--paper); border-radius: 9px; padding: 0 6px; margin-left: 4px; }

main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 22px 60px; }
.wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.narrow { max-width: 780px; }
h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(22px, 3.2vw, 30px); line-height: 1.2; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h2 { font-family: var(--f-display); font-weight: 500; font-size: 18px; margin: 0; text-wrap: balance; }
h3 { font-size: 15px; margin: 0; font-weight: 650; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lead { color: var(--muted); margin: 6px 0 0; max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.btn { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; line-height: 1.2; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding-inline: 6px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.ai { font-family: var(--f-mono); font-size: 10px; font-weight: 700; border-radius: 4px; padding: 1px 4px; background: var(--accent-soft); color: var(--accent); }
.btn.primary .ai { background: var(--accent-ink); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.note { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 10px 12px; border-radius: 6px; font-size: 13.5px; }
.note.info { border-color: var(--accent); background: var(--accent-soft); }

/* home */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }
.sheetgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 4px; margin-top: 10px; }
.cell { aspect-ratio: 1; max-width: 100%; border: 1px solid var(--line); border-radius: 4px; display: grid; place-items: center; font-family: var(--f-mono); font-size: 11px; color: var(--muted); text-decoration: none; }
.cell.l1 { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.cell.l2 { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.cell.l3 { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.group h2 { margin-bottom: 8px; }
.part { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.part:first-of-type { border-top: 0; }
.part:hover .pt { color: var(--accent); }
.num { font-family: var(--f-mono); font-size: 11.5px; min-width: 48px; text-align: center; padding: 3px 4px; border: 1.5px solid var(--ink); border-radius: 4px; font-weight: 600; }
.part .pt { font-weight: 600; }
.part .ps { font-size: 12.5px; color: var(--muted); }
.bar { height: 4px; background: var(--soft); border-radius: 2px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.stats { display: flex; gap: 22px; flex-wrap: wrap; }
.stat .v { font-family: var(--f-display); font-size: 24px; font-weight: 600; }
.stat .l { font-size: 12px; color: var(--muted); }

/* item header + variant picker */
.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.variants { display: flex; gap: 6px; flex-wrap: wrap; }
.variants a { text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; background: var(--paper); display: inline-flex; gap: 6px; align-items: center; }
.variants a.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.variants a .d { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.variants a .d.ok { background: var(--ok); } .variants a .d.warn { background: var(--warn); } .variants a .d.bad { background: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; background: var(--paper); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--ink); color: var(--paper); }
.modehint { font-size: 13px; color: var(--muted); }

/* reading texts */
.doc { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; font-family: var(--f-read); font-size: 16px; line-height: 1.65; }
.doc p { margin: 0 0 .7em; max-width: 72ch; }
.doc .dt { font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.doc h3 { font-family: var(--f-read); font-size: 18px; margin-bottom: 10px; }
.mail { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); font-family: var(--f-read); font-size: 15.5px; line-height: 1.6; overflow: hidden; }
.mail .mh { font-family: var(--f-ui); font-size: 12.5px; color: var(--muted); padding: 8px 16px; background: var(--soft); border-bottom: 1px solid var(--line); }
.mail .mb { padding: 14px 18px; }
.mail p { margin: 0 0 .55em; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 70px); max-height: calc(100vh - 90px); overflow: auto; }
@media (max-width: 900px) { .sticky { position: static; max-height: none; } }
.ads { display: flex; flex-direction: column; gap: 10px; }
.ad { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-family: var(--f-read); font-size: 15px; line-height: 1.55; }
.ad b { font-family: var(--f-ui); }
.ad .lt { font-family: var(--f-mono); font-weight: 700; margin-right: 6px; color: var(--accent); }
.ad.hl { box-shadow: 0 0 0 2px var(--ok); }
mark { background: var(--marker); color: inherit; border-radius: 2px; padding: 0 1px; }

/* questions */
.qs { display: flex; flex-direction: column; gap: 12px; }
.q { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.q.right { border-color: var(--ok); }
.q.wrong { border-color: var(--bad); }
.qh { display: flex; gap: 10px; align-items: flex-start; }
.qn { font-family: var(--f-mono); font-weight: 700; font-size: 13px; min-width: 30px; height: 26px; border: 1.5px solid var(--ink); border-radius: 4px; display: grid; place-items: center; flex: none; }
.qt { font-family: var(--f-read); font-size: 16px; line-height: 1.5; padding-top: 1px; min-width: 0; }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 9px 12px; cursor: pointer; display: flex; gap: 10px; font-family: var(--f-read); font-size: 15.5px; line-height: 1.4; }
.opt .l { font-family: var(--f-mono); font-weight: 700; color: var(--muted); flex: none; }
.opt:hover:not(:disabled) { border-color: var(--muted); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.good { border-color: var(--ok); background: var(--ok-soft); }
.opt.badc { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; }
.opts.rf { flex-direction: row; }
.opts.rf .opt { flex: 1; justify-content: center; font-family: var(--f-ui); font-weight: 600; }
.letters { display: flex; gap: 5px; flex-wrap: wrap; }
.lb { width: 36px; height: 34px; border: 1px solid var(--line); background: var(--paper); border-radius: 7px; cursor: pointer; font-family: var(--f-mono); font-weight: 700; }
.lb.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lb.good { background: var(--ok); color: var(--paper); border-color: var(--ok); }
.lb.badc { background: var(--bad); color: var(--paper); border-color: var(--bad); }
.lb:disabled { cursor: default; }
.qfoot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.explain { font-size: 14px; background: var(--soft); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; line-height: 1.55; }
.result { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.result .big { font-family: var(--f-display); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.footer-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* gap texts */
.gaptext { white-space: pre-wrap; }
.gap { display: inline-flex; align-items: center; gap: 3px; vertical-align: baseline; }
.gap .gn { font-family: var(--f-mono); font-size: 11px; font-weight: 700; border: 1.5px solid var(--ink); border-radius: 3px; padding: 0 3px; }
.gap select { font-family: var(--f-read); font-size: 15px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent-soft); padding: 1px 4px; max-width: 100%; }
.gap.good select { border-color: var(--ok); background: var(--ok-soft); }
.gap.badc select { border-color: var(--bad); background: var(--bad-soft); }
.gap .fix { font-family: var(--f-read); color: var(--ok); font-weight: 600; }
.bank { display: flex; flex-wrap: wrap; gap: 6px; }
.bank span { border: 1px dashed var(--line); border-radius: 6px; padding: 3px 8px; font-family: var(--f-read); }
.bank b { font-family: var(--f-mono); margin-right: 4px; color: var(--accent); }

/* audio */
.player { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.wave { display: inline-flex; gap: 3px; align-items: center; height: 22px; }
.wave i { width: 3px; height: 6px; background: var(--muted); border-radius: 2px; }
.player.playing .wave i { background: var(--accent); animation: w 1s ease-in-out infinite; }
.player.playing .wave i:nth-child(2) { animation-delay: .15s } .player.playing .wave i:nth-child(3) { animation-delay: .3s } .player.playing .wave i:nth-child(4) { animation-delay: .45s }
@keyframes w { 0%,100% { height: 5px } 50% { height: 20px } }
@media (prefers-reduced-motion: reduce) { .player.playing .wave i { animation: none; height: 14px; } }
.ptitle { font-weight: 600; font-size: 14px; }
.cast { font-size: 12px; color: var(--muted); }
.transcript { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; font-family: var(--f-read); font-size: 15px; line-height: 1.55; }
.transcript .spk { font-family: var(--f-ui); font-size: 12px; font-weight: 700; color: var(--accent); }
.transcript .now { background: var(--marker); border-radius: 3px; }
.block { display: flex; flex-direction: column; gap: 10px; }
.blockh { display: flex; gap: 8px; align-items: center; }

/* writing */
textarea.letter { width: 100%; min-height: 300px; border: 1px solid var(--line); border-radius: 8px; padding: 14px; font-family: var(--f-read); font-size: 16px; line-height: 1.6; background: var(--paper); resize: vertical; }
.in { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--paper); min-width: 0; }
input.in, textarea.in { width: 100%; }
.timer { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.rm summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.rm ul { margin: 6px 0 0; padding-left: 18px; font-family: var(--f-read); font-size: 14.5px; }
.rm li { cursor: pointer; padding: 2px 0; }
.rm li:hover { color: var(--accent); }
.letterview { white-space: pre-wrap; font-family: var(--f-read); font-size: 15.5px; line-height: 1.6; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.letterview mark { cursor: pointer; background: var(--bad-soft); border-bottom: 2px solid var(--bad); }
.letterview mark.on { background: var(--marker); }
.crit { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.crit > div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.errlist { display: flex; flex-direction: column; gap: 8px; }
.err { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; }
.err s { color: var(--bad); } .err ins { color: var(--ok); text-decoration: none; font-weight: 600; }
.thinking { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.dots { display: inline-flex; gap: 4px; } .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: d 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s } .dots i:nth-child(3) { animation-delay: .4s }
@keyframes d { 0%,80%,100% { opacity: .25 } 40% { opacity: 1 } }

/* notiz form */
.notiz { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.notiz label { font-weight: 600; font-size: 14px; }
.notiz .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .notiz { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check .m { font-weight: 700; width: 18px; flex: none; }
.check.ok .m { color: var(--ok); } .check.no .m { color: var(--bad); }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; font-family: var(--f-read); font-size: 15.5px; line-height: 1.5; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--accent-soft); }
.msg.cl { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); }
.msg .who { font-family: var(--f-ui); font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 2px; }

/* lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.li:first-child { border-top: 0; }
.li .grow { flex: 1; min-width: 0; }
.voice { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; }
@media (max-width: 560px) { .voice { grid-template-columns: 1fr; } }
.examsteps { display: flex; gap: 4px; flex-wrap: wrap; }
.examsteps span { font-family: var(--f-mono); font-size: 11px; padding: 3px 7px; border-radius: 4px; background: var(--soft); color: var(--muted); }
.examsteps span.on { background: var(--ink); color: var(--paper); }
.examsteps span.done { background: var(--ok-soft); color: var(--ok); }
table.score { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.score td, table.score th { border-top: 1px solid var(--line); padding: 8px 6px; text-align: left; }
table.score th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tw { overflow-x: auto; }

/* learn page */
.learnacc > summary { cursor: pointer; display: flex; gap: 10px; align-items: center; font-weight: 600; list-style: none; }
.learnacc > summary::-webkit-details-marker { display: none; }
.learnacc > summary::before { content: "▸"; color: var(--muted); }
.learnacc[open] > summary::before { content: "▾"; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.learnbox .letterview { max-height: 460px; overflow: auto; }

/* exam-paper skin (telc Prüfungsbogen look): white sheet, black rules, Arial, square boxes */
.sheet {
  --paper: #fff; --ink: #111; --line: #222; --muted: #444; --soft: #f1f1f1; --accent: #111; --accent-soft: #e6e6e6; --accent-ink: #fff;
  --ok: #111; --ok-soft: #e9f5ec; --bad: #b00020; --bad-soft: #fde8ea; --marker: #fff2a8; --r: 0px;
  --f-read: Arial, "Helvetica Neue", Helvetica, sans-serif; --f-ui: Arial, "Helvetica Neue", Helvetica, sans-serif;
  color: #111; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; color-scheme: light;
  display: grid; gap: 18px; align-items: start;
}
.sheet.desk { grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); }
@media (max-width: 900px) { .sheet.desk { grid-template-columns: 1fr; } }
.bk .card, .bk .doc, .bk .mail, .sheet .ad, .sheet .q, .sheet .transcript, .sheet .player, .sheet .result, .sheet .notiz, .sheet .letterview, .sheet .err { border-radius: 0; border-color: #000; box-shadow: none; }
.sheet .doc, .sheet .mail, .sheet .ad { font-size: 14.5px; }
.sheet .q { border-width: 1px; padding: 10px 12px; }
.sheet .qn, .sheet .gap .gn { border-radius: 0; border-width: 1.5px; }
.sheet .qt { font-size: 14.5px; }
.sheet .opt { border: 0; border-radius: 0; background: transparent; padding: 4px 4px; align-items: flex-start; font-size: 14.5px; }
.sheet .opt::before { content: ""; flex: none; width: 15px; height: 15px; border: 1.5px solid #000; margin-top: 2px; background: #fff; color: #000; font: 700 15px/12px Arial, sans-serif; text-align: center; }
.sheet .opt.sel::before { content: "✕"; }
.sheet .opt.sel { background: transparent; }
.sheet .opt.good::before { content: "✕"; color: #137333; border-color: #137333; }
.sheet .opt.badc::before { content: "✕"; color: #b00020; border-color: #b00020; }
.sheet .opt.good { background: var(--ok-soft); } .sheet .opt.badc { background: var(--bad-soft); }
.sheet .opts.rf .opt { justify-content: flex-start; font-weight: 400; flex: none; padding-right: 22px; }
.sheet .lb { border-radius: 0; width: 34px; height: 30px; border: 1.5px solid #000; background: #fff; color: #111; font-family: Arial, sans-serif; font-weight: 700; }
.sheet .lb.sel { background: #fff; color: #000; box-shadow: inset 0 0 0 2px #000; }
.sheet .lb.sel::after { content: "✕"; margin-left: 2px; }
.sheet .lb.good { background: #137333; color: #fff; border-color: #137333; }
.sheet .lb.badc { background: #b00020; color: #fff; border-color: #b00020; }
.sheet .gap select { border-radius: 0; border: 1.5px solid #000; background: #fff; font-family: Arial, sans-serif; }
.sheet .bank span { border-radius: 0; border: 1px solid #000; }
.sheet .btn { border-radius: 0; border-color: #000; background: #fff; color: #111; }
.sheet .btn.primary { background: #111; color: #fff; }
.sheet .chip { border-radius: 0; }
.sheet .eyebrow { color: #333; }
.sheet .notiz input, .sheet .notiz textarea { border-radius: 0; border: 0; border-bottom: 1px solid #000; background: #fff; }

.langsw { margin-left: 8px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 4px 0 9px; background: var(--paper); }
.langsw-ico { font-size: 14px; line-height: 1; }
.langsel { border: 0; background: transparent; color: var(--ink); font: 500 13px var(--f-mono); padding: 7px 4px; cursor: pointer; max-width: 150px; }
.langsel:focus-visible { outline: 2px solid var(--accent, #8b9cff); outline-offset: 2px; border-radius: 6px; }
.langsel option { color: #111; background: #fff; }

/* Arabic interface: UI mirrors, German exam content stays left-to-right */
[dir="rtl"] .langsw { margin-left: 0; margin-right: 8px; }
[dir="rtl"] textarea, [dir="rtl"] input[type="text"], [dir="rtl"] .letterview, [dir="rtl"] .brand, [dir="rtl"] .sheet .de, [dir="rtl"] .ltr { direction: ltr; text-align: left; }
[dir="rtl"] .eyebrow, [dir="rtl"] .lead, [dir="rtl"] .note { text-align: right; }
[dir="rtl"] .num, [dir="rtl"] .langsw { direction: ltr; unicode-bidi: isolate; }

/* task booklet (Aufgabenheft S10): grey side tab with the subtest, minutes in the header, italic instructions */
.bk { background: #fff; border: 1px solid #cfcfcf; box-shadow: 0 2px 10px rgba(0,0,0,.16); display: grid; grid-template-columns: 46px minmax(0, 1fr); min-width: 0; }
.bk-side { background: #ececec; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 0; }
.bk-side .ico { width: 26px; height: 26px; color: #7a7a7a; }
.bk-vert { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 700; letter-spacing: .18em; font-size: 14px; color: #222; white-space: nowrap; }
.bk-main { padding: 14px clamp(14px, 3vw, 34px) 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bk-head { text-align: right; border-bottom: 1.5px solid #aaa; padding-bottom: 5px; font-size: 13px; letter-spacing: .06em; }
.bk-head span { color: #888; font-weight: 700; } .bk-head b { color: #111; }
.bk-big { font-size: clamp(26px, 4vw, 40px); color: #a3a3a3; letter-spacing: .06em; font-weight: 400; }
.bk-title { margin: 0; font: 700 21px/1.2 Arial, sans-serif; } .bk-title span { color: #8c8c8c; }
.bk-inst { font-style: italic; font-size: 15px; line-height: 1.5; }
.bk-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; border-top: 1px solid #ddd; padding-top: 8px; font-size: 11.5px; color: #666; }
.bk-foot b { letter-spacing: .14em; font-weight: 400; color: #222; font-size: 13px; }
.bk .mail { background: #d9ecf6; border: 0; } .bk .mail .mh { background: transparent; border: 0; color: #333; }
.ico { display: inline-flex; } .ico svg { width: 100%; height: 100%; }

/* Antwortbogen S30: pink panels with red frames, oval bubbles, number on both sides of a row */
.bogen, .tn, .ws, .cover { --bg-red: #d7192d; --bg-pink: #f9d9d1; --bg-pink2: #f4c3b6; color: #111; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; color-scheme: light; }
.bogen { background: #fff; border: 1px solid #cfcfcf; box-shadow: 0 2px 10px rgba(0,0,0,.16); padding: 12px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; }
@media (max-width: 900px) { .bogen { position: static; } }
.bg-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; border-left: 3px solid #111; border-top: 3px solid #111; padding: 4px 0 0 6px; }
.bg-top b { font-size: 15px; } .bg-pg { font-size: 11px; color: #555; }
.bg-data { background: var(--bg-pink); border: 1.5px solid var(--bg-red); padding: 6px; display: grid; gap: 4px; }
.bg-data small { display: block; font-size: 8.5px; color: #333; margin-top: 1px; }
.bx { display: flex; } .bx i { flex: 1; height: 15px; border: 1px solid var(--bg-red); margin-left: -1px; background: #fff; font: 700 10px/14px Arial, sans-serif; text-align: center; font-style: normal; overflow: hidden; }
.bg-sub { font-weight: 700; font-size: 16px; }
.bg-panel { background: var(--bg-pink); border: 1.5px solid var(--bg-red); padding: 10px 10px 12px; position: relative; }
.bg-ico { position: absolute; left: -1.5px; top: -1.5px; transform: translateX(-100%); width: 30px; height: 30px; border: 1.5px solid var(--bg-red); border-right: 0; border-radius: 0 0 0 8px; background: var(--bg-pink); display: grid; place-items: center; }
@media (max-width: 1180px) { .bg-ico { position: static; transform: none; float: right; border-right: 1.5px solid var(--bg-red); } }
.bg-ico .ico { width: 20px; height: 20px; color: #7a7a7a; }
.bg-ttl { font-weight: 700; font-size: 15px; margin-bottom: 6px; } .bg-teil { font-size: 15px; margin-bottom: 2px; }
.bg-row { display: grid; grid-template-columns: 22px 1fr 22px; align-items: center; gap: 4px; padding: 2px 3px; }
.bg-row.alt { background: var(--bg-pink2); }
.bg-row > b { font: 900 16px/1 Arial, sans-serif; text-align: center; }
.bubs { display: flex; flex-wrap: wrap; gap: 2px 3px; justify-content: center; }
.bub { border: 0; background: none; padding: 1px; display: flex; flex-direction: column; align-items: center; cursor: pointer; color: #111; font: 11px/1.1 Arial, sans-serif; min-width: 18px; }
.bub i { width: 17px; height: 9px; border: 1.2px solid #111; border-radius: 50%; background: #fff; display: block; }
.bub.wide { min-width: 44px; }
.bub:hover:not(:disabled) i { background: #ffe9e4; }
.bub.on i { background: #111; }
.bub.good i { border-color: #137333; box-shadow: 0 0 0 2px #137333; } .bub.good.on i { background: #137333; }
.bub.badc i { background: #b00020; border-color: #b00020; }
.bub:disabled { cursor: default; }
.bub:focus-visible { outline: 2px solid var(--bg-red); outline-offset: 1px; }

/* mock-exam cover (Antwortbogen S30 data fields) and block timer */
.cover { background: var(--bg-pink); border: 1.5px solid var(--bg-red); padding: 12px 14px; display: grid; gap: 8px; }
.cv-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; } .cv-head b { font-size: 20px; } .cv-head span { font-weight: 700; }
.cv-f { display: grid; gap: 2px; } .cv-f .in { border: 1.5px solid var(--bg-red); border-radius: 0; background: #fff; color: #111; font: 700 15px Arial, sans-serif; letter-spacing: .2em; text-transform: uppercase; }
.cv-f small { font-size: 11px; color: #333; }
.examtimer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; background: var(--paper); font-size: 14px; }
.examtimer .mono { font-size: 18px; font-weight: 700; }
.examtimer.soon .mono { color: var(--warn, #b26a00); } .examtimer.over .mono { color: var(--bad); }

/* Telefonnotiz (Antwortbogen page 6) */
.tn { background: var(--bg-pink); border: 1.5px solid var(--bg-red); padding: 12px 14px; display: flex; flex-direction: column; }
.tn-hd { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; border-bottom: 1.5px solid #111; padding-bottom: 8px; }
.tn-ico .ico, .ws-ico .ico { width: 22px; height: 22px; color: #7a7a7a; }
.tn-t { font-size: 22px; font-weight: 700; margin-top: 4px; }
.tn-nur, .ws-nur { font-size: 10px; text-align: center; width: 64px; line-height: 1.2; color: #333; }
.tn-row { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) 64px; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1.5px solid #111; }
.tn-row:last-child { border-bottom: 0; }
@media (max-width: 620px) { .tn-row { grid-template-columns: 1fr 52px; } .tn-row .tn-f { grid-column: 1 / -1; grid-row: 2; } }
.tn-l { display: flex; gap: 8px; font-weight: 700; font-size: 15.5px; } .tn-l small { display: block; font-weight: 400; font-size: 12px; }
.tn-opts { display: grid; gap: 4px; }
.tn-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15.5px; }
.tn-opt small { width: 10px; font-weight: 700; font-size: 11px; }
.tn-opt input { appearance: none; width: 19px; height: 11px; border: 1.2px solid #111; border-radius: 50%; background: #fff; margin: 0; cursor: pointer; }
.tn-opt input:checked { background: #111; }
.tn-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; font-size: 15px; }
.tn-in { width: 100%; border: 1.5px solid var(--bg-red); background: #fff; color: #111; padding: 7px 9px; font: 15px Arial, sans-serif; border-radius: 0; }
.tn-lines { background: #fff; border: 1.5px solid var(--bg-red); }
.tn-li { display: flex; align-items: center; gap: 6px; padding-left: 10px; border-bottom: 1px solid #ddd; }
.tn-li:last-child { border-bottom: 0; }
.tn-li::before { content: ""; width: 5px; height: 5px; background: #111; flex: none; } .tn-li.nob::before { visibility: hidden; }
.tn-li .tn-in { border: 0; padding: 8px 6px; }
.tn-mark { display: flex; gap: 6px; justify-content: center; padding-top: 4px; }
.tn-mark i { font-style: normal; font-size: 11px; display: flex; flex-direction: column; align-items: center; color: #333; }
.tn-mark i::after { content: ""; width: 15px; height: 8px; border: 1.2px solid #111; border-radius: 50%; background: #fff; margin-top: 1px; }
.tn-mark i.on::after { background: #111; }
.tn-mark i:first-child.on::after { background: #137333; border-color: #137333; } .tn-mark i:last-child.on::after { background: #b00020; border-color: #b00020; }

/* writing sheets: 21 (e-mail form) and 58 (lined paper) */
.ws { background: var(--bg-pink); border: 1.5px solid var(--bg-red); }
.ws-hd { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-bottom: 2px solid #fff; }
.ws-hd b { font-size: 16px; white-space: pre; }
.ws-body { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 6px; padding: 8px; }
.ws-side { background: #fff; }
.ws-paper { background: #fff; display: flex; flex-direction: column; min-width: 0; }
.ws-mail { display: grid; grid-template-columns: auto 1fr; gap: 8px; background: #ececec; padding: 6px 8px; }
.ws-send { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #bbb; background: #f8f8f8; padding: 4px 8px; font-size: 16px; color: #555; }
.ws-send small { font-size: 9px; }
.ws-fields { display: grid; gap: 3px; } .ws-fields label { display: grid; grid-template-columns: 52px 1fr; gap: 6px; align-items: center; font-size: 10.5px; }
.ws-fields label span { border: 1px solid #bbb; background: #f8f8f8; padding: 1px 4px; text-align: center; }
.ws-in { border: 1px solid #bbb; background: #fff; color: #111; padding: 3px 6px; font: 13px Arial, sans-serif; border-radius: 0; }
.ws textarea.letter { border: 0; border-radius: 0; background: #fff repeating-linear-gradient(#fff 0 31px, #f2c6bb 31px 32px); line-height: 32px; padding: 0 10px; font: 16px/32px Arial, sans-serif; color: #111; min-height: 520px; box-shadow: none; }
@media (max-width: 620px) { .ws-body { grid-template-columns: 1fr; } .ws-side { display: none; } }

/* oral exam strip (Aufgabenblätter) */
.sp-head { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; background: var(--soft); border-left: 4px solid #8c8c8c; padding: 10px 14px; }
.sp-ico .ico { width: 28px; height: 28px; color: #7a7a7a; }
.sp-k { font-size: 12.5px; color: var(--muted); letter-spacing: .02em; margin-bottom: 4px; }
.sp-p { font-size: 15px; } .sp-p span { color: var(--muted); }

/* signed-in participant chip in the header */
.cover .row { margin-top: 6px; }
/* candidate form: cover page of the Antwortbogen S30 */
.s30 { --bg-red: #d7192d; --bg-pink: #f9d9d1; background: #fff linear-gradient(160deg, #fff 40%, #f3f3f3); color: #111; color-scheme: light; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  border: 1px solid #cfcfcf; box-shadow: 0 2px 10px rgba(0,0,0,.16); padding: clamp(14px, 4vw, 34px); display: flex; flex-direction: column; gap: 16px; }
.s30-top { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.s30-code { border: 1.5px solid var(--bg-red); padding: 2px 8px; font-weight: 700; letter-spacing: .2em; }
.s30-bar { width: 120px; height: 34px; background: repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 5px, #fff 5px 8px, #111 8px 11px, #fff 11px 12px); }
.s30-title { font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif; font-stretch: condensed; font-size: clamp(30px, 7vw, 58px); font-weight: 300; letter-spacing: -.01em; line-height: 1.05; }
.s30-ver { background: var(--bg-pink); border: 1.5px solid var(--bg-red); padding: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.s30-ver b { font-size: 20px; } .s30-ver small { flex-basis: 100%; font-size: 11px; }
.boxes4, .boxes6 { height: 30px; border: 1.5px solid var(--bg-red); background: #fff repeating-linear-gradient(90deg, #fff 0 22px, var(--bg-red) 22px 23.5px); }
.boxes4 { width: 92px; } .boxes6 { width: 139px; }
.s30-data { background: var(--bg-pink); border: 1.5px solid var(--bg-red); padding: 12px; display: grid; gap: 12px; }
.cv-row { display: grid; gap: 3px; min-width: 0; }
.cv-row small { font-size: 11px; color: #333; line-height: 1.3; }
.boxin { width: min(100%, calc(var(--n) * 23.5px + 2px)); height: 32px; border: 1.5px solid var(--bg-red); border-radius: 0; padding: 0 0 0 7px; color: #111;
  background: #fff repeating-linear-gradient(90deg, #fff 0 22px, var(--bg-red) 22px 23.5px); font: 700 15px/32px "Courier New", monospace; letter-spacing: 14.5px; text-transform: uppercase; }
.boxin:focus, .datein:focus { outline: 2px solid #111; outline-offset: 1px; }
.datein { width: max-content; max-width: 100%; height: 34px; border: 1.5px solid var(--bg-red); border-radius: 0; background: #fff; color: #111; font: 15px Arial, sans-serif; padding: 0 8px; }
.cv-sexes { display: grid; gap: 4px; background: #fbe9e5; border: 1px solid var(--bg-red); padding: 6px 8px; }
.cv-sex { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.cv-sex input { appearance: none; width: 14px; height: 14px; border: 1.5px solid var(--bg-red); background: #fff; margin: 0; flex: none; }
.cv-sex input:checked { background: #111; box-shadow: inset 0 0 0 2px #fff; }
.cv-err { margin: 0; color: #b00020; font-weight: 700; }
.s30-foot { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid #111; padding-top: 8px; } .s30-foot b { font-size: 22px; } .s30-foot span { color: #888; font-weight: 700; }
.who { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; color: var(--ink); text-decoration: none; max-width: 220px; }
.who .who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.who .who-ico { flex: none; }
.who:hover { background: var(--soft); }

/* ================= theme toggle ================= */
.theme-toggle { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--muted); cursor: pointer; padding: 0; }
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); background: var(--soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 17px; height: 17px; }
[dir="rtl"] .theme-toggle { margin-left: 0; }

/* ================= student progress ================= */
.pg-wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.pg-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pg-hero h1 { font-family: var(--f-display); font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -.02em; margin: 0 0 5px; }
.pg-hero p { margin: 0; color: var(--muted); font-size: 14px; max-width: 65ch; line-height: 1.5; }
.pg-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pg-kpi { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.pg-kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone, var(--accent)); opacity: .9; }
.pg-kpi .k { font-size: 11px; color: var(--muted); font-weight: 650; letter-spacing: .02em; min-height: 14px; }
.pg-kpi .v { font-family: var(--f-display); font-size: 25px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.pg-kpi .n { font-size: 11px; color: var(--muted); margin-top: 2px; min-height: 13px; }
.pg-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pg-grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pg-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); min-width: 0; }
.pg-card h2 { font-family: var(--f-ui); font-size: 15px; font-weight: 650; margin: 0 0 2px; }
.pg-card .sub { font-size: 11.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.4; }
.pg-chart { width: 100%; display: block; overflow: visible; }
.pg-chart text { font-family: var(--f-mono); font-size: 9px; fill: var(--muted); }
.pg-chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; opacity: .75; }
.pg-chart .pgbar { fill: var(--accent); opacity: .88; transition: opacity .15s; }
.pg-chart .pgbar:hover { opacity: 1; }
.pg-chart .line { fill: none; stroke: var(--c-hoeren, #0e8a70); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pg-chart .dot { fill: var(--paper); stroke: var(--accent); stroke-width: 2; }
.pg-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.pg-bars { display: grid; gap: 11px; }
.pg-barrow { display: grid; gap: 4px; }
.pg-barrow .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.pg-barrow .top b { font-weight: 600; }
.pg-barrow .top span { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.pg-track { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.pg-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--bar, var(--accent)); transition: width .7s cubic-bezier(.2,.7,.3,1); }
.pg-barrow.lesen { --bar: var(--c-lesen, #2f5bea); }
.pg-barrow.hoeren { --bar: var(--c-hoeren, #0e8a70); }
.pg-barrow.schreiben { --bar: var(--c-schreiben, #c47a00); }
.pg-barrow.sprechen { --bar: var(--c-sprechen, #7c4dff); }
.pg-badge-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.pg-badge { background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 9px 5px 7px; text-align: center; opacity: .45; filter: grayscale(1); transition: opacity .2s, filter .2s, transform .2s; }
.pg-badge.on { opacity: 1; filter: none; background: linear-gradient(180deg, var(--ok-soft), var(--paper)); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.pg-badge:hover { transform: translateY(-2px); }
.pg-badge b { display: block; font-size: 17px; line-height: 1.2; }
.pg-badge span { display: block; font-size: 9px; line-height: 1.2; margin-top: 3px; color: var(--muted); }
.pg-badge.on span { color: var(--ink); font-weight: 600; }
.pg-split { display: grid; gap: 6px; }
.pg-split-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--soft); }
.pg-split-bar i { display: block; height: 100%; }
.pg-split-bar .ok { background: var(--ok); } .pg-split-bar .mid { background: var(--warn); } .pg-split-bar .bad { background: var(--bad); }
.pg-split-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.pg-split-legend span { display: inline-flex; align-items: center; gap: 4px; }
.pg-split-legend i { width: 7px; height: 7px; border-radius: 2px; }
.pg-list { display: grid; gap: 6px; }
.pg-list-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); font-size: 12px; }
.pg-list-row b { font-weight: 600; }
.pg-list-row > span:last-child { margin-left: auto; font-family: var(--f-mono); font-size: 10.5px; color: var(--muted); }
.pg-list-row .dot { margin-left: 0; }
.pg-list-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); flex: none; }
.pg-donut-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pg-donut { position: relative; width: 124px; height: 124px; flex: none; }
.pg-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pg-donut circle { fill: none; stroke-width: 12; stroke-linecap: butt; }
.pg-donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.pg-donut-center b { font-family: var(--f-display); font-size: 23px; letter-spacing: -.03em; }
.pg-donut-center span { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* home progress / leaders */
.home-strip { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.home-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.home-card h2 { font-family: var(--f-ui); font-size: 15px; font-weight: 650; margin: 0 0 2px; }
.home-card .sub { color: var(--muted); font-size: 11.5px; margin: 0 0 10px; }
.home-card .row { justify-content: space-between; }
.home-mini-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0; }
.home-mini-stats .v { font-family: var(--f-display); font-size: 21px; letter-spacing: -.02em; }
.home-mini-stats .l { font-size: 10.5px; color: var(--muted); }

/* ================= leaderboard ================= */
.lb-wrap { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.lb-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.lb-hero h1 { font-family: var(--f-display); font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -.02em; margin: 0 0 5px; }
.lb-hero p { margin: 0; color: var(--muted); font-size: 14px; max-width: 65ch; line-height: 1.5; }
.lb-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.lb-tabs button { border: 0; background: transparent; color: var(--muted); font: 600 12.5px var(--f-ui); padding: 7px 13px; border-radius: 7px; cursor: pointer; }
.lb-tabs button.on { background: var(--ink); color: var(--paper); }
.lb-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; }
.lb-pod { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px; text-align: center; overflow: hidden; }
.lb-pod.first { border-color: color-mix(in srgb, #e0a400 55%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, #e0a400 10%, var(--paper)), var(--paper)); }
.lb-pod.second { border-color: color-mix(in srgb, #8f9bb3 55%, var(--line)); }
.lb-pod.third { border-color: color-mix(in srgb, #b1703a 50%, var(--line)); }
.lb-pod .medal { font-size: 26px; line-height: 1; }
.lb-pod .av { width: 42px; height: 42px; margin: 8px auto 6px; border-radius: 13px; display: grid; place-items: center; color: #fff; font: 700 13px var(--f-mono); }
.lb-pod .nm { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pod .pts { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.lb-pod .me { position: absolute; top: 7px; right: 8px; font: 600 9px var(--f-mono); background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 2px 6px; }
.lb-table { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.lb-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 64px 58px 52px 76px; gap: 8px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.lb-row:last-child { border-bottom: 0; }
.lb-row.head { background: var(--bg); color: var(--muted); font: 600 9.5px var(--f-mono); letter-spacing: .04em; text-transform: uppercase; padding-block: 9px; }
.lb-row.head > div { white-space: nowrap; }
.lb-row.me { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.lb-row.top1 { background: linear-gradient(90deg, color-mix(in srgb, #e0a400 8%, transparent), transparent 60%); }
.lb-row .rank { font: 600 12px var(--f-mono); color: var(--muted); text-align: center; }
.lb-row .rank .md { display: block; font-size: 15px; line-height: 1; margin-bottom: 1px; }
.lb-row .lb-who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.lb-row .lb-who .av { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; font: 700 10px var(--f-mono); flex: none; }
.lb-row .lb-who b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-who .you { font: 600 9px var(--f-mono); background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 2px 6px; flex: none; }
.lb-row .pts { font: 650 13px var(--f-mono); text-align: right; }
.lb-row .lb-num { font: 500 12px var(--f-mono); text-align: right; color: var(--muted); }
.lb-row .medal-cell { text-align: center; font-size: 15px; }
.lb-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; text-align: center; }
.lb-me-card { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.lb-me-card .rank { font: 600 22px var(--f-display); color: var(--accent); min-width: 44px; }
.lb-me-card .txt { flex: 1; min-width: 0; }
.lb-me-card b { display: block; font-size: 14px; }
.lb-me-card span { font-size: 11.5px; color: var(--muted); }
.lb-me-card .pts { font: 650 16px var(--f-mono); }
.lb-loading { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

/* leaderboard home mini */
.home-lb-list { display: grid; gap: 4px; margin-top: 8px; }
.home-lb-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 2px; }
.home-lb-row .md { width: 18px; text-align: center; font-size: 14px; }
.home-lb-row .av { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; font: 700 9px var(--f-mono); flex: none; }
.home-lb-row b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.home-lb-row span { font: 600 11px var(--f-mono); color: var(--muted); }

/* ================= responsive ================= */
@media (max-width: 1000px) {
  .pg-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pg-grid, .pg-grid.two { grid-template-columns: 1fr; }
  .home-strip { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .pg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-badge-grid { grid-template-columns: repeat(5, 1fr); }
  .lb-podium { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .lb-pod { padding: 10px 5px; }
  .lb-pod .medal { font-size: 20px; }
  .lb-pod .av { width: 32px; height: 32px; border-radius: 10px; font-size: 10px; margin: 5px auto 4px; }
  .lb-pod .nm { font-size: 11px; }
  .lb-pod .pts { font-size: 9px; line-height: 1.35; white-space: normal; }
  .lb-pod .me { font-size: 8px; padding: 1px 5px; }
  .lb-row { grid-template-columns: 40px minmax(0, 1fr) 62px; }
  .lb-row .lb-num, .lb-row .medal-cell { display: none; }
  .lb-row.head .lb-num, .lb-row.head .medal-cell { display: none; }
  .lb-row .pts { text-align: right; }
}
@media (max-width: 520px) {
  .pg-badge-grid { grid-template-columns: repeat(3, 1fr); }
  .pg-kpi .v { font-size: 22px; }
}

/* waiting-for-approval screen: the teacher's number, large and selectable */

/* ---------- sign-up / sign-in card and waiting screen ---------- */
.reg { position: relative; display: grid; place-items: start center; padding: 28px 16px 48px; min-height: calc(100vh - 60px);
  background: radial-gradient(520px 360px at 15% 0%, var(--accent-soft), transparent 70%), radial-gradient(480px 360px at 90% 100%, rgba(14, 138, 112, .14), transparent 70%); }
.reg-card { position: relative; z-index: 1; width: min(560px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 22px;
  padding: 30px 30px 24px; box-shadow: 0 30px 80px -40px rgba(16, 24, 40, .55); }
.reg-card.wide { width: min(640px, 100%); }
.reg-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.reg-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(145deg, var(--accent), #5b74ff);
  color: #fff; font: 700 12.5px/1 var(--f-mono); letter-spacing: .06em; box-shadow: 0 8px 20px -8px var(--accent); flex: none; }
.reg-brand { display: grid; line-height: 1.25; }
.reg-brand b { font-family: var(--f-display); font-weight: 600; font-size: 15px; }
.reg-brand span { font-size: 12px; color: var(--muted); }
.reg-card h1 { font-family: var(--f-display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
.reg-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; line-height: 1.55; }
.reg-seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); margin-bottom: 18px; }
.reg-seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: 600 13.5px var(--f-ui); padding: 9px 10px; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
.reg-seg button:hover { color: var(--ink); }
.reg-seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .15); }
.reg-who .reg-seg { margin: 6px 0 16px; }
.reg-label { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.reg-field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.reg-field.wide { grid-column: 1 / -1; }
.reg-field > span { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.reg-input { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 11px; padding: 11px 13px; font: 500 15px var(--f-ui); color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s; }
.reg-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--paper); }
.reg-input[readonly], .reg-input:disabled { opacity: .75; }
.reg-more { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; margin: 2px 0 16px; }
.reg-more summary { cursor: pointer; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.reg-more[open] summary { margin-bottom: 12px; }
.reg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 11px; padding: 12px 16px; font: 650 15px var(--f-ui); cursor: pointer; text-decoration: none; box-shadow: 0 8px 18px -12px var(--accent); }
.reg-btn:hover { filter: brightness(1.06); }
.reg-btn:disabled { opacity: .55; cursor: default; }
.reg-btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; box-shadow: 0 8px 18px -12px #1fa855; margin-top: 12px; }
.reg-links, .reg-actions { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-top: 14px; }
.reg-actions .reg-btn { width: auto; min-width: 200px; }
.reg-link { border: 0; background: none; color: var(--muted); font: 500 13.5px var(--f-ui); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.reg-link:hover { color: var(--ink); }
.reg-note { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 12px 0; }
.reg-error { margin: 0 0 14px; padding: 10px 12px; border-radius: 9px; border-left: 3px solid var(--bad); background: var(--bad-soft); color: var(--bad); font-size: 13px; line-height: 1.45; }
.reg-steps { margin: 4px 0 14px; padding-inline-start: 22px; display: grid; gap: 8px; line-height: 1.5; }
.price { margin: 6px 0 14px; }
.price-head { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.price-card { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--bg); }
.price-card.best { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 10px 24px -18px var(--accent); }
.price-card p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.price-name { font-weight: 650; font-size: 14px; }
.price-sum { margin-top: 4px; color: var(--muted); font-size: 13px; }
.price-sum b { font-family: var(--f-display); font-size: 24px; color: var(--ink); font-weight: 600; }
.price-tag { position: absolute; top: -10px; inset-inline-end: 12px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 2px 9px; }
.contact-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0 14px; background: var(--bg); }
.contact-label { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.contact-num { font-family: var(--f-mono); font-size: 20px; font-weight: 700; margin-top: 4px; word-break: break-all; }
.contact-warn { margin-top: 8px; font-size: 13px; color: var(--bad); font-weight: 600; }
@media (max-width: 560px) {
  .reg { padding: 16px 16px 32px; }
  .reg-card { padding: 22px 16px 18px; border-radius: 18px; }
  .reg-grid, .price-grid { grid-template-columns: 1fr; }
  .price-card.best { margin-top: 6px; }
}

.price-pay { margin-top: 10px; min-height: 0; }
.price-pay .pay-link { display: block; text-align: center; text-decoration: none; }
.price-pay .pay-wa { display: block; text-align: center; margin-top: 8px; }
.reg-note.ok { color: #0f9d58; font-weight: 600; }
.reg-note.err { color: #d93025; }

.choice { margin: 18px 0; display: grid; gap: 12px; }
.choice-card { border: 1px solid var(--line, rgba(255,255,255,.12)); border-radius: 14px; padding: 14px; background: rgba(255,255,255,.03); }
.choice-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.choice-num { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--accent, #8b9cff); color: #111; flex: none; }
.choice-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.choice .reg-btn { display: block; text-align: center; text-decoration: none; margin-top: 8px; }
.choice-pay .reg-btn { margin-top: 0; }
@media (max-width: 420px) { .choice-pay { grid-template-columns: 1fr; } }

/* before sign-in: brand, theme and language on one line, no section menu */
body.pre .nav { display: none; }
body.pre .top-in { flex-wrap: nowrap; }
body.pre .top-in .theme-toggle { margin-left: auto; }
body.pre .top-in .who { max-width: 140px; }
@media (max-width: 400px) { .langsel { max-width: 120px; } }

/* ---------- compact header (signed in): brand, tabs, "More", theme, account and language on ONE line from ~1000 px ---------- */
.top-in { max-width: 1080px; gap: 10px; padding-block: 8px; }
body:not(.pre) .top-in { flex-wrap: nowrap; }
body:not(.pre) .brand { margin-right: 6px; flex: none; }
body:not(.pre) .nav { flex: 1 1 auto; flex-wrap: nowrap; gap: 2px; min-width: 0; }
.nav a, .nav summary { white-space: nowrap; padding: 6px 9px; font-size: 13.5px; }
.nav .more { position: relative; }
.nav summary { list-style: none; cursor: pointer; color: var(--muted); border-radius: 8px; display: inline-flex; align-items: center; gap: 4px; user-select: none; }
.nav summary::-webkit-details-marker { display: none; }
.nav summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.nav .more[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.nav summary:hover, .nav .more[open] summary, .nav .more.on summary { background: var(--soft); color: var(--ink); }
.more-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; min-width: 200px; display: grid; gap: 2px; padding: 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .28); }
.more-menu a { display: block; color: var(--ink); }
[dir="rtl"] .more-menu { right: auto; left: 0; }
body:not(.pre) .theme-toggle { margin-left: auto; }
[dir="rtl"] body:not(.pre) .theme-toggle { margin-left: 0; margin-right: auto; }
body:not(.pre) .top-in .who { flex: 0 1 auto; max-width: 150px; min-width: 0; padding: 5px 9px; font-size: 13px; }
/* language: signed in, the closed control shows only the code; before sign-in it keeps the full language name */
.langsw { position: relative; flex: none; }
.langsw-code { display: none; font: 600 12.5px var(--f-mono); color: var(--ink); padding: 8px 2px 8px 0; }
body:not(.pre) .langsw { margin-left: 0; padding: 0 8px; gap: 5px; }
body:not(.pre) .langsw-code { display: inline; }
body:not(.pre) .langsel { position: absolute; inset: 0; width: 100%; max-width: none; opacity: 0; padding: 0; }
body:not(.pre) .langsw:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
body:not(.pre) .langsw:hover { background: var(--soft); }
/* "Learn by heart" sits in the tab row on wide screens and moves into "More" when space runs out */
.more-menu .nav-narrow { display: none; }
@media (max-width: 1090px) { .nav .nav-wide { display: none; } .more-menu .nav-narrow { display: block; } }
@media (max-width: 1000px) { .nav a, .nav summary { padding: 6px 7px; font-size: 13px; } body:not(.pre) .top-in .who { max-width: 120px; } }
/* tablet and phone: tabs move to their own scrollable row under the brand, account shrinks to the icon */
@media (max-width: 900px) {
  body:not(.pre) .top-in { flex-wrap: wrap; row-gap: 6px; }
  body:not(.pre) .nav { order: 10; flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
  body:not(.pre) .nav::-webkit-scrollbar { display: none; }
  .nav .more { position: static; }
  .more-menu { right: 16px; top: auto; margin-top: 6px; }
  body:not(.pre) .top-in .who .who-name { display: none; }
  body:not(.pre) .top-in .who { padding: 5px 8px; }
}

/* Sprechen: microphone dictation (d4_speak.js) and the free rule-based report */
.mic-box { gap: 8px; }
.mic-row { gap: 12px; }
.btn.mic { min-height: 44px; padding-inline: 18px; }
.mic-ico { width: 14px; height: 14px; border-radius: 50%; background: currentColor; display: inline-block; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.btn.mic.on { background: var(--bad); border-color: var(--bad); }
.btn.mic.on .mic-ico { border-radius: 3px; animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.mic-time { color: var(--muted); font-size: 14px; }
.btn.mic.on ~ .mic-time { color: var(--bad); font-weight: 700; }
.mic-live { flex: 1 1 160px; min-width: 0; color: var(--muted); font-style: italic; font-family: var(--f-read); overflow-wrap: anywhere; }
textarea.letter.spoken { min-height: 200px; }
.sp-line { display: flex; gap: 10px; align-items: flex-start; }
.sp-line > .chip { flex: none; min-width: 30px; text-align: center; justify-content: center; }
.sp-line > .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sp-words { gap: 6px; }
@media (prefers-reduced-motion: reduce) { .btn.mic.on .mic-ico { animation: none; } }
