:root {
  --bg: #f5f6f8; --karte: #fff; --text: #1d2430; --leise: #5f6b7a; --rand: #d9dee5;
  --akzent: #1f5fbf; --akzent-dunkel: #174a96; --ok: #1d7a46; --fehler: #b3261e; --warn-bg: #fff4d6; --warn-rand: #e0b84f;
  --pruefen: #fff0c2; --falsch: #fdecec; --mono: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
a { color: var(--akzent); }
code, pre, .mono { font-family: var(--mono); }
pre { background: #f0f2f5; border: 1px solid var(--rand); border-radius: 6px; padding: .6rem .8rem; overflow-x: auto; font-size: .92rem; white-space: pre; margin: .5rem 0; }
pre.info { background: none; border: 0; padding: 0; margin: 0; white-space: pre-wrap; font-family: inherit; font-size: .85rem; }
code { background: #eef1f5; padding: .05rem .3rem; border-radius: 4px; font-size: .92em; }
.leise { color: var(--leise); }
.klein { font-size: .85rem; }
.gross { font-size: 1.2rem; }
.zahl { text-align: right; white-space: nowrap; }
.fehler { color: var(--fehler); }
.markiert { color: #8a5a00; font-weight: 600; }

button, .knopf { display: inline-block; font: inherit; padding: .5rem 1rem; border-radius: 6px; border: 1px solid var(--akzent); background: var(--akzent); color: #fff; cursor: pointer; text-decoration: none; line-height: 1.3; }
button:hover, .knopf:hover { background: var(--akzent-dunkel); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.sekundaer, .knopf.sekundaer { background: #fff; color: var(--akzent); }
button.sekundaer:hover, .knopf.sekundaer:hover { background: #eef3fb; }
button.gefahr { background: var(--fehler); border-color: var(--fehler); }
button.gefahr.sekundaer { background: #fff; color: var(--fehler); }
button.klein { padding: .2rem .5rem; font-size: .85rem; }
.knoepfe { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; align-items: center; }

input, select, textarea { font: inherit; padding: .45rem .6rem; border: 1px solid #b8c0cc; border-radius: 6px; background: #fff; color: var(--text); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; transform: scale(1.3); }
textarea.mono { font-family: var(--mono); font-size: .95rem; tab-size: 4; }
textarea.klein { font-size: .9rem; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #8db4f0; outline-offset: 1px; }

.karte { background: var(--karte); border: 1px solid var(--rand); border-radius: 10px; padding: 1.25rem 1.5rem; margin: 0 0 1rem; }
.zentriert-karte { max-width: 460px; margin: 10vh auto; }
.karte.breit { max-width: 960px; margin: 2rem auto; }
.formular { display: grid; gap: .4rem; }
.formular button { margin-top: .5rem; }
.formular.raster { grid-template-columns: minmax(180px, 260px) 1fr; align-items: center; gap: .6rem 1rem; }
.warnung { background: var(--warn-bg); border: 1px solid var(--warn-rand); border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; }
.info { background: #e9f2ff; border: 1px solid #b9d2f5; border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; }
td.info { background: none; border: 0; border-bottom: 1px solid var(--rand); margin: 0; padding: .4rem .5rem; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { font-weight: 600; background: #f7f8fa; }
tr.leise td { color: var(--leise); }
tr.falsch td { background: var(--falsch); }
tr.pruefen td { background: var(--pruefen); }
.status { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .85rem; font-weight: 600; background: #e5e8ec; }
.status.laeuft { background: #d7f2e1; color: var(--ok); }
.status.beendet { background: #ececec; color: #555; }
.statuszeile { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: .5rem 0; }
.toast { position: fixed; right: 1rem; bottom: 1rem; padding: .75rem 1rem; border-radius: 8px; background: #1d2430; color: #fff; z-index: 99; }
.toast.fehler { background: var(--fehler); color: #fff; }

/* Lehrperson */
.kopf { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1.5rem; background: #fff; border-bottom: 1px solid var(--rand); position: sticky; top: 0; z-index: 5; gap: 1rem; flex-wrap: wrap; }
.kopf-rechts { display: flex; gap: .5rem; align-items: center; }
.marke { font-weight: 700; text-decoration: none; color: var(--text); }
.inhalt { max-width: 1250px; margin: 1.25rem auto; padding: 0 1rem; }
.posten td:nth-child(1) { width: 30%; }
.posten td:nth-child(3) { width: 4rem; }
.posten input.punkte { width: 4.5rem; }
pre.antwort { max-height: 420px; overflow: auto; background: #fbfbfc; }

/* Lernende */
.pruefungskopf { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto auto auto; gap: 1rem; align-items: center; padding: .6rem 1.25rem; background: #fff; border-bottom: 1px solid var(--rand); }
.timer { font-family: var(--mono); font-size: 1.4rem; font-weight: 700; }
.timer.klein { font-size: 1rem; }
.timer.knapp { color: var(--fehler); }
#speicherstatus { font-size: .85rem; color: var(--leise); min-width: 12rem; }
#speicherstatus.ok { color: var(--ok); }
#speicherstatus.fehler { color: var(--fehler); }
.pruefung { max-width: 980px; margin: 1rem auto 4rem; padding: 0 1rem; }
.aufgabe { background: #fff; border: 1px solid var(--rand); border-radius: 10px; padding: 1rem 1.25rem; margin: 0 0 1.25rem; }
.hinweis { color: var(--leise); }
table.wf td.auswahl { text-align: center; width: 6rem; }
table.wf th:nth-child(3), table.wf th:nth-child(4) { text-align: center; }
.fehlertabelle input.zeile { width: 4.5rem; }
.fehlertabelle td:first-child { width: 3rem; }
.fehlertabelle td:nth-child(2) { width: 6rem; }
.vorgabe { margin: .5rem 0 1rem; max-width: 640px; }
.teil { margin-bottom: 1rem; }
.ende-knopf { text-align: center; margin: 2rem 0; }
.ende-knopf button { font-size: 1.1rem; padding: .7rem 2rem; }
details.resultat { border: 1px solid var(--rand); border-radius: 8px; padding: .5rem .8rem; margin: .5rem 0; }
details.resultat summary { cursor: pointer; font-weight: 600; }
.dialog { position: fixed; inset: 0; background: rgba(20, 25, 35, .5); display: flex; align-items: center; justify-content: center; z-index: 50; }
.dialog[hidden] { display: none; }
.dialog-box { background: #fff; border-radius: 10px; padding: 1.5rem; max-width: 460px; }
.zentriert { display: flex; min-height: 100vh; align-items: center; justify-content: center; }

/* PIN-Kärtchen */
.pins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 1rem; }
.pin-karte { border: 1px dashed #999; padding: 1rem; min-height: 120px; display: grid; gap: .3rem; page-break-inside: avoid; break-inside: avoid; }
@media print {
  body { background: #fff; }
  .nicht-drucken, .kopf { display: none !important; }
  .pins { padding: 0; }
}
@media (max-width: 760px) {
  .formular.raster { grid-template-columns: 1fr; }
  .pruefungskopf { grid-template-columns: 1fr 1fr; }
  .pins { grid-template-columns: repeat(2, 1fr); }
}

.formular.raster input[type=checkbox] { justify-self: start; }
input.punkte::placeholder { color: #9aa3ae; font-style: italic; }
.aufgabe { scroll-margin-top: 80px; }
