/* ═══ bastix1-Baukasten ═══════════════════════════════════════════
   Gemeinsame Grundlage aller bastix1-Unterseiten.
   Farben nach den Adernpaaren eines Netzwerkkabels (T568B),
   AP-Trainer nach der LWL-Mantelfarbe OM4.
   ════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-condensed-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-500.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Flächen und Text – helles Thema */
  --bx-bg:       #f3f4f1;
  --bx-surface:  #ffffff;
  --bx-sunken:   #e9ebe7;
  --bx-line:     #d5d9d3;
  --bx-line-2:   #b9c0b9;
  --bx-text:     #18212b;
  --bx-muted:    #55626f;

  /* Adernpaare */
  --bx-blau:     #1f66c9;
  --bx-orange:   #c9630a;
  --bx-gruen:    #1f8a52;
  --bx-braun:    #8a5a36;
  --bx-violett:  #7446b8;

  /* Zustände */
  --bx-ok:       #1f8a52;
  --bx-warn:     #a86a00;
  --bx-bad:      #c2372e;

  /* Akzent der jeweiligen Seite – pro Seite überschreiben */
  --bx-accent:      var(--bx-blau);
  --bx-accent-ink:  #ffffff;
  --bx-accent-soft: color-mix(in srgb, var(--bx-accent) 12%, var(--bx-surface));

  --bx-sans:  "IBM Plex Sans", system-ui, "Segoe UI", Roboto, sans-serif;
  --bx-head:  "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, "Segoe UI", sans-serif;
  --bx-mono:  "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bx-r-s:   4px;   /* Knöpfe, Felder, Chips */
  --bx-r-m:   8px;   /* Kästen */
  --bx-bar-h: 56px;
  --bx-shadow: 0 1px 2px rgba(24, 33, 43, 0.06), 0 6px 20px rgba(24, 33, 43, 0.06);
}

/* Dunkles Thema: Systemvorgabe … */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bx-bg:       #12171d;
    --bx-surface:  #1a2129;
    --bx-sunken:   #0d1116;
    --bx-line:     #2b3540;
    --bx-line-2:   #3d4a58;
    --bx-text:     #e7ecf0;
    --bx-muted:    #9daab7;
    --bx-blau:     #5b9cf0;
    --bx-orange:   #f0953f;
    --bx-gruen:    #4cc088;
    --bx-braun:    #c79468;
    --bx-violett:  #a986e6;
    --bx-ok:       #4cc088;
    --bx-warn:     #e2b04a;
    --bx-bad:      #f07068;
    --bx-accent-ink: #0d1116;
    --bx-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}
/* … oder per Schalter erzwungen */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bx-bg:       #12171d;
  --bx-surface:  #1a2129;
  --bx-sunken:   #0d1116;
  --bx-line:     #2b3540;
  --bx-line-2:   #3d4a58;
  --bx-text:     #e7ecf0;
  --bx-muted:    #9daab7;
  --bx-blau:     #5b9cf0;
  --bx-orange:   #f0953f;
  --bx-gruen:    #4cc088;
  --bx-braun:    #c79468;
  --bx-violett:  #a986e6;
  --bx-ok:       #4cc088;
  --bx-warn:     #e2b04a;
  --bx-bad:      #f07068;
  --bx-accent-ink: #0d1116;
  --bx-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bx-bar-h) + 16px);
}

body {
  margin: 0;
  background: var(--bx-bg);
  color: var(--bx-text);
  font-family: var(--bx-sans);
  font-size: 1rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  font-family: var(--bx-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0;
  text-wrap: balance;
}

code,
kbd,
pre,
samp {
  font-family: var(--bx-mono);
  font-size: 0.92em;
}

a {
  color: var(--bx-accent);
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 2px solid var(--bx-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Kopfleiste mit Patchfeld ─────────────────────────────────── */
.bx-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--bx-bar-h);
  padding: 0 20px;
  background: var(--bx-surface);
  border-bottom: 1px solid var(--bx-line);
}

.bx-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: none;
  color: var(--bx-text);
  font-family: var(--bx-head);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.bx-brand small {
  color: var(--bx-muted);
  font-family: var(--bx-sans);
  font-size: 0.8125rem;
  font-weight: 400;
}

/* Das Patchfeld: jede Buchse ist eine bastix1-Seite,
   die Link-LED der aktuellen Seite leuchtet. */
.bx-panel {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin: 0;
  padding: 3px;
  overflow-x: auto;
  background: var(--bx-sunken);
  border: 1px solid var(--bx-line);
  border-radius: 6px;
  scrollbar-width: none;
}
.bx-panel::-webkit-scrollbar {
  display: none;
}

.bx-port {
  --pair: var(--bx-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 7px;
  border-radius: var(--bx-r-s);
  color: var(--bx-muted);
  font-size: 0.8125rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.bx-port[data-pair="blau"]    { --pair: var(--bx-blau); }
.bx-port[data-pair="orange"]  { --pair: var(--bx-orange); }
.bx-port[data-pair="gruen"]   { --pair: var(--bx-gruen); }
.bx-port[data-pair="braun"]   { --pair: var(--bx-braun); }
.bx-port[data-pair="violett"] { --pair: var(--bx-violett); }

/* Buchse: RJ45-Umriss mit Rastnase unten, LED oben links */
.bx-jack {
  position: relative;
  flex: none;
  width: 18px;
  height: 14px;
  background: var(--bx-surface);
  border: 1.5px solid var(--bx-line-2);
  border-radius: 2px;
}
.bx-jack::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1.5px;
  width: 7px;
  height: 4px;
  transform: translateX(-50%);
  background: var(--bx-sunken);
  border: 1.5px solid var(--bx-line-2);
  border-bottom: 0;
  border-radius: 1px 1px 0 0;
}
.bx-jack::after {
  content: "";
  position: absolute;
  top: 1.5px;
  left: 1.5px;
  width: 4px;
  height: 3px;
  background: var(--bx-line-2);
  border-radius: 1px;
}

.bx-port:hover {
  background: var(--bx-surface);
  color: var(--bx-text);
}
.bx-port:hover .bx-jack::after {
  background: var(--pair);
}
.bx-port[aria-current="page"] {
  background: var(--bx-surface);
  color: var(--bx-text);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--pair);
}
.bx-port[aria-current="page"] .bx-jack {
  border-color: var(--pair);
}
.bx-port[aria-current="page"] .bx-jack::after {
  background: var(--pair);
  box-shadow: 0 0 5px var(--pair);
}

.bx-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: none;
}

/* „3 online": grüner Punkt, pulsiert leise */
.bx-online {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: var(--bx-sunken);
  border: 1px solid var(--bx-line);
  border-radius: 999px;
  color: var(--bx-muted);
  font-size: 0.8125rem;
  white-space: nowrap;
  cursor: default;
}
.bx-online[hidden] {
  display: none;
}
.bx-online b {
  color: var(--bx-text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.bx-online-punkt {
  position: relative;
  width: 8px;
  height: 8px;
  background: var(--bx-gruen);
  border-radius: 50%;
}
.bx-online-punkt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--bx-gruen);
  animation: bx-online-puls 2.4s ease-out infinite;
}
@keyframes bx-online-puls {
  from {
    opacity: 0.6;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(2.6);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bx-online-punkt::after {
    animation: none;
  }
}

/* ─── Bausteine ────────────────────────────────────────────────── */
.bx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  background: var(--bx-surface);
  border: 1px solid var(--bx-line-2);
  border-radius: var(--bx-r-s);
  color: var(--bx-text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.bx-btn:hover {
  border-color: var(--bx-accent);
  color: var(--bx-accent);
}
.bx-btn.is-primary {
  background: var(--bx-accent);
  border-color: var(--bx-accent);
  color: var(--bx-accent-ink);
}
.bx-btn.is-primary:hover {
  background: color-mix(in srgb, var(--bx-accent) 86%, var(--bx-text));
  color: var(--bx-accent-ink);
}
.bx-btn.is-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--bx-muted);
}
.bx-btn.is-icon {
  width: 36px;
  padding: 0;
}

.bx-card {
  background: var(--bx-surface);
  border: 1px solid var(--bx-line);
  border-radius: var(--bx-r-m);
}

.bx-field {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--bx-surface);
  border: 1px solid var(--bx-line-2);
  border-radius: var(--bx-r-s);
  color: var(--bx-text);
  font: inherit;
}
.bx-field:focus {
  border-color: var(--bx-accent);
  outline: 2px solid color-mix(in srgb, var(--bx-accent) 35%, transparent);
  outline-offset: 0;
}

/* Etikett wie am Beschriftungsstreifen: nur für echte Kennungen
   (Port, VLAN, Schicht), nicht als Schmuck über Überschriften. */
.bx-tag {
  display: inline-block;
  padding: 1px 7px;
  background: var(--bx-accent-soft);
  border-radius: 3px;
  color: var(--bx-accent);
  font-family: var(--bx-mono);
  font-size: 0.8125rem;
  font-weight: 500;
}

@media (max-width: 860px) {
  .bx-bar {
    gap: 12px;
    padding: 0 12px;
  }
  .bx-brand small {
    display: none;
  }
  .bx-port {
    padding: 5px 8px 5px 6px;
  }
}
@media (max-width: 560px) {
  /* nur die Buchsen, Name der aktuellen Seite bleibt lesbar */
  .bx-port:not([aria-current="page"]) .bx-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .bx-port:not([aria-current="page"]) {
    padding: 8px;
  }
  /* schmal: nur Punkt und Zahl */
  .bx-online {
    padding: 4px 8px;
  }
  .bx-online-text {
    font-size: 0;
  }
  .bx-online-text b {
    font-size: 0.8125rem;
  }
}

/* ═══ AP-Trainer: Oberfläche zum Üben ═════════════════════════════
   Oben steht der Baukasten, ab hier die Regeln des Trainers.
   ════════════════════════════════════════════════════════════════ */

:root {
  --bx-accent: var(--bx-violett);
  --ok-soft:   color-mix(in srgb, var(--bx-ok) 13%, var(--bx-surface));
  --warn-soft: color-mix(in srgb, var(--bx-warn) 14%, var(--bx-surface));
  --bad-soft:  color-mix(in srgb, var(--bx-bad) 11%, var(--bx-surface));
  /* Zeichnungen und Seitenbilder sind für weißes Papier gemacht – in beiden Themen */
  --papier: #ffffff;
  /* Abdunklung hinter Dialog und Seitenbildern */
  --schleier:      rgba(13, 17, 22, 0.82);
  --schleier-text: #f3f4f1;
  --lesebreite:    72ch;
}

[hidden] {
  display: none !important;
}

body {
  display:        flex;
  flex-direction: column;
  min-height:     100vh;
}

h1 {
  margin:    4px 0 12px;
  font-size: 1.75rem;
}

h2 {
  margin:    36px 0 12px;
  font-size: 1.375rem;
}

h3 {
  margin:    0;
  font-size: 1.125rem;
}

.leise {
  color: var(--bx-muted);
}

.klein {
  font-size: 0.875rem;
}

input[type="checkbox"] {
  accent-color: var(--bx-accent);
}

/* ─── Leiste des Trainers: Stufe, Reiter, Konto ────────────────── */
.kopf {
  display:       flex;
  flex-wrap:     wrap;
  align-items:   center;
  gap:           6px 20px;
  padding:       6px 20px;
  background:    var(--bx-surface);
  border-bottom: 1px solid var(--bx-line);
}

.marke {
  color:           var(--bx-text);
  font-family:     var(--bx-head);
  font-size:       1.25rem;
  font-weight:     600;
  text-decoration: none;
  white-space:     nowrap;
}

.stufen {
  display:       inline-flex;
  overflow:      hidden;
  border:        1px solid var(--bx-line-2);
  border-radius: var(--bx-r-s);
}

.stufen button {
  padding:     5px 14px;
  background:  transparent;
  border:      0;
  color:       var(--bx-muted);
  font:        inherit;
  font-size:   0.875rem;
  font-weight: 600;
  cursor:      pointer;
}

.stufen button.aktiv {
  background: var(--bx-accent);
  color:      var(--bx-accent-ink);
}

.reiter {
  display:         flex;
  gap:             2px;
  margin-right:    auto;
  overflow-x:      auto;
  scrollbar-width: none;
}

.reiter::-webkit-scrollbar {
  display: none;
}

.reiter a {
  padding:         9px 12px;
  border-radius:   var(--bx-r-s);
  color:           var(--bx-muted);
  font-size:       0.9375rem;
  line-height:     1.3;
  text-decoration: none;
  white-space:     nowrap;
}

.reiter a:hover {
  background: var(--bx-sunken);
  color:      var(--bx-text);
}

.reiter a.aktiv {
  color:       var(--bx-text);
  font-weight: 600;
  box-shadow:  inset 0 -2px 0 var(--bx-accent);
}

.reiter a:focus-visible {
  outline-offset: -2px;
}

.konto {
  display:     flex;
  align-items: center;
  gap:         8px;
}

.wer {
  max-width:     14rem;
  overflow:      hidden;
  color:         var(--bx-muted);
  font-size:     0.875rem;
  text-overflow: ellipsis;
  white-space:   nowrap;
}

/* Hinweis unter der Leiste, z. B. „nur Selbstbewertung" */
.statuszeile {
  margin:    0;
  padding:   8px 20px 0;
  color:     var(--bx-muted);
  font-size: 0.8125rem;
}

.statuszeile.fehler {
  color:       var(--bx-bad);
  font-weight: 600;
}

.inhalt {
  flex:      1;
  width:     100%;
  max-width: 920px;
  margin:    0 auto;
  padding:   24px 20px 56px;
}

/* die Übersicht der Prüfungen darf breiter sein als eine Aufgabe */
.inhalt:has(> section > .raster) {
  max-width: 1160px;
}

.inhalt > p.leise {
  max-width: var(--lesebreite);
}

.fuss {
  width:      100%;
  padding:    16px 16px 24px;
  border-top: 1px solid var(--bx-line);
  color:      var(--bx-muted);
  font-size:  0.8125rem;
  text-align: center;
}

.fuss a {
  color: inherit;
}

/* Discord „Trainer IT": Karte statt nacktem Einladungslink */
.dc-karte {
  display:         inline-flex;
  align-items:     center;
  gap:             12px;
  max-width:       100%;
  padding:         10px 12px 10px 10px;
  background:      var(--bx-surface);
  border:          1px solid var(--bx-line);
  border-radius:   var(--bx-r-m);
  box-shadow:      var(--bx-shadow);
  color:           var(--bx-text);
  text-align:      left;
  text-decoration: none;
  transition:      border-color .15s, transform .15s;
}
.fuss .dc-karte {
  color: var(--bx-text);
}
.dc-karte:hover,
.dc-karte:focus-visible {
  border-color: #5865f2;
  transform:    translateY(-1px);
}
.dc-logo {
  width:  44px;
  height: 44px;
  flex:   none;
}
.dc-text {
  display:        flex;
  flex-direction: column;
  gap:            2px;
  min-width:      0;
}
.dc-name {
  font-weight: 600;
  font-size:   1rem;
  line-height: 1.2;
}
.dc-marke {
  margin-left:    4px;
  padding:        1px 6px;
  border-radius:  3px;
  background:     color-mix(in srgb, #5865f2 15%, var(--bx-surface));
  color:          #5865f2;
  font-size:      0.6875rem;
  font-weight:    600;
  vertical-align: 2px;
}
.dc-zeile {
  color:     var(--bx-muted);
  font-size: 0.8125rem;
}
.dc-knopf {
  flex:          none;
  margin-left:   6px;
  padding:       7px 14px;
  border-radius: var(--bx-r-s);
  background:    #5865f2;
  color:         #fff;
  font-size:     0.875rem;
  font-weight:   600;
}
.dc-karte:hover .dc-knopf {
  background: #4752c4;
}
.fuss-zeile {
  margin-top: 10px;
}
@media (max-width: 480px) {
  .dc-zeile {
    display: none;
  }
}

/* ─── Bausteine ────────────────────────────────────────────────── */
.bx-btn:disabled {
  opacity: 0.5;
  cursor:  default;
}

.bx-btn.klein {
  min-height: 30px;
  padding:    3px 10px;
  font-size:  0.8125rem;
}

.bx-btn.gefahr {
  border-color: var(--bx-bad);
  color:        var(--bx-bad);
}

.bx-btn.gefahr:hover {
  background:   var(--bad-soft);
  border-color: var(--bx-bad);
  color:        var(--bx-bad);
}

.chip {
  display:       inline-block;
  padding:       1px 8px;
  background:    var(--bx-sunken);
  border-radius: 3px;
  color:         var(--bx-muted);
  font-size:     0.8125rem;
  white-space:   nowrap;
}

.chip.gut {
  background: var(--ok-soft);
  color:      var(--bx-ok);
}

.chip.mittel {
  background: var(--warn-soft);
  color:      var(--bx-warn);
}

.chip.schlecht {
  background: var(--bad-soft);
  color:      var(--bx-bad);
}

.chip.akzent {
  background: var(--bx-accent-soft);
  color:      var(--bx-accent);
}

.karte {
  margin:        12px 0;
  padding:       18px 20px;
  background:    var(--bx-surface);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-m);
}

.raster {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
  gap:                   16px;
}

.raster .karte {
  margin: 0;
}

.auswahl {
  display:   flex;
  flex-wrap: wrap;
  gap:       6px 16px;
  margin:    10px 0;
}

.auswahl label {
  font-size: 0.875rem;
  cursor:    pointer;
}

.zeile {
  display:     flex;
  flex-wrap:   wrap;
  align-items: center;
  gap:         8px 12px;
}

.zeile.zwischen {
  justify-content: space-between;
}

table.liste {
  width:           100%;
  border-collapse: collapse;
  font-size:       0.9375rem;
}

table.liste th,
table.liste td {
  padding:        9px 10px;
  border-bottom:  1px solid var(--bx-line);
  text-align:     left;
  vertical-align: middle;
}

table.liste th {
  color:       var(--bx-muted);
  font-size:   0.8125rem;
  font-weight: 600;
}

table.liste tr:last-child td {
  border-bottom: 0;
}

table.liste tr.klickbar {
  cursor: pointer;
}

table.liste tr.klickbar:hover td {
  background: var(--bx-sunken);
}

.tabelle-huelle {
  overflow-x: auto;
}

/* ─── Felder ───────────────────────────────────────────────────── */
textarea.antwort,
textarea.wahlfeld,
input.feld,
select.feld,
.punkte-eingabe input {
  background:    var(--bx-surface);
  border:        1px solid var(--bx-line-2);
  border-radius: var(--bx-r-s);
  color:         var(--bx-text);
  font:          inherit;
}

textarea.antwort:focus,
textarea.wahlfeld:focus,
input.feld:focus,
select.feld:focus,
.punkte-eingabe input:focus {
  border-color:   var(--bx-accent);
  outline:        2px solid color-mix(in srgb, var(--bx-accent) 35%, transparent);
  outline-offset: 0;
}

input.feld,
select.feld {
  width:      100%;
  min-height: 40px;
  padding:    8px 12px;
}

input.suche {
  max-width: 280px;
}

select.klein-feld {
  width:       auto;
  min-height:  34px;
  margin-left: 6px;
  padding:     4px 8px;
  font-size:   0.875rem;
}

/* Antwortfeld: groß genug zum Schreiben, wächst mit dem Text */
textarea.antwort {
  display:     block;
  width:       100%;
  min-height:  150px;
  margin-top:  14px;
  padding:     12px 14px;
  line-height: 1.6;
  resize:      vertical;
}

textarea.antwort::placeholder,
textarea.wahlfeld::placeholder {
  color:   var(--bx-muted);
  opacity: 0.8;
}

.wahl-felder {
  display:    flex;
  flex-wrap:  wrap;
  gap:        12px 20px;
  margin-top: 14px;
}

.wahl-feld {
  display:     inline-flex;
  align-items: center;
  gap:         8px;
}

textarea.wahlfeld {
  width:       160px;
  height:      42px;
  padding:     8px 10px;
  overflow:    hidden;
  font-family: var(--bx-mono);
  white-space: nowrap;
  resize:      none;
}

textarea.wahlfeld.schmal {
  width: 110px;
}

table.eingabe {
  width:           100%;
  margin-top:      14px;
  border-collapse: collapse;
}

table.eingabe th,
table.eingabe td {
  padding:        0;
  border:         1px solid var(--bx-line-2);
  font-size:      0.9375rem;
  vertical-align: top;
}

table.eingabe th {
  padding:     8px 10px;
  background:  var(--bx-sunken);
  font-weight: 600;
  text-align:  left;
}

table.eingabe th.zeilenkopf {
  width:       34%;
  font-weight: 400;
}

table.eingabe textarea {
  display:    block;
  width:      100%;
  min-width:  7rem;
  min-height: 48px;
  padding:    10px;
  background: var(--bx-surface);
  border:     0;
  color:      var(--bx-text);
  font:       inherit;
  resize:     vertical;
}

table.eingabe textarea:focus {
  outline:        2px solid var(--bx-accent);
  outline-offset: -2px;
}

table.eingabe .vorgabe {
  padding:    8px 10px;
  color:      var(--bx-muted);
  font-style: italic;
}

td.zellwert {
  padding:     8px 10px;
  white-space: pre-wrap;
}

/* ─── Bearbeitung ──────────────────────────────────────────────── */
.leiste {
  position:        sticky;
  top:             var(--bx-bar-h);
  z-index:         5;
  display:         flex;
  flex-wrap:       wrap;
  align-items:     center;
  justify-content: space-between;
  gap:             6px 16px;
  margin:          -24px 0 20px;
  padding:         10px 16px;
  background:      var(--bx-surface);
  border:          1px solid var(--bx-line);
  border-top:      0;
  border-radius:   0 0 var(--bx-r-m) var(--bx-r-m);
}

.uhr {
  font-size:            1.125rem;
  font-variant-numeric: tabular-nums;
  font-weight:          600;
}

.uhr.knapp {
  color: var(--bx-warn);
}

.uhr.vorbei {
  color: var(--bx-bad);
}

/* wie viele Teilaufgaben schon eine Antwort haben */
.fortschritt {
  flex-basis:    100%;
  height:        4px;
  overflow:      hidden;
  background:    var(--bx-sunken);
  border-radius: 2px;
}

.fortschritt > span {
  display:    block;
  height:     100%;
  background: var(--bx-accent);
  transition: width 0.2s ease-out;
}

.situation {
  background:   var(--bx-accent-soft);
  border-color: color-mix(in srgb, var(--bx-accent) 30%, var(--bx-line));
}

.teil {
  padding:           20px 22px 18px;
  scroll-margin-top: calc(var(--bx-bar-h) + 76px);
}

.teil-kopf {
  display:         flex;
  align-items:     baseline;
  justify-content: space-between;
  gap:             12px;
  margin-bottom:   8px;
}

.kontext {
  margin:       8px 0 12px;
  padding-left: 12px;
  border-left:  2px solid var(--bx-line-2);
  color:        var(--bx-muted);
}

.frage {
  margin:      8px 0;
  font-weight: 600;
}

.material {
  margin:        12px 0;
  padding:       10px 14px;
  background:    var(--bx-sunken);
  border-radius: var(--bx-r-s);
  font-size:     0.9375rem;
}

.grafik {
  margin:        12px 0;
  padding:       8px;
  overflow-x:    auto;
  background:    var(--papier);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-s);
}

.grafik img {
  display:   block;
  max-width: 100%;
  height:    auto;
  margin:    0 auto;
}

/* Aufgabentext: Zeilen nicht länger, als man bequem liest */
.text p,
.text ul {
  max-width:     var(--lesebreite);
  margin:        8px 0;
  overflow-wrap: anywhere;
}

.text ul {
  padding-left: 22px;
}

.text pre {
  margin:        8px 0;
  padding:       10px 12px;
  overflow-x:    auto;
  background:    var(--bx-sunken);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-s);
  font-size:     0.875rem;
  line-height:   1.5;
  overflow-wrap: anywhere;
  white-space:   pre-wrap;
}

.material pre {
  background: var(--bx-surface);
}

.text table {
  margin:          8px 0;
  border-collapse: collapse;
  font-size:       0.9375rem;
  font-weight:     400;
}

.text th,
.text td {
  padding:    5px 10px;
  border:     1px solid var(--bx-line-2);
  text-align: left;
}

.text th {
  font-weight: 600;
}

/* ─── Auswertung ───────────────────────────────────────────────── */
.ergebnis-kopf {
  display:               grid;
  grid-template-columns: auto 1fr;
  align-items:           center;
  gap:                   20px;
}

/* Note als Kasten: Zahl groß, Wort darunter */
.note-kreis {
  min-width:     108px;
  padding:       14px 12px 12px;
  background:    var(--bx-sunken);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-m);
  font-family:   var(--bx-head);
  font-size:     3rem;
  font-weight:   600;
  line-height:   1;
  text-align:    center;
}

.note-kreis small {
  display:     block;
  margin-top:  6px;
  font-family: var(--bx-sans);
  font-size:   0.8125rem;
  font-weight: 600;
  line-height: 1.2;
}

.note-kreis.gut {
  background:   var(--ok-soft);
  border-color: var(--bx-ok);
  color:        var(--bx-ok);
}

.note-kreis.mittel {
  background:   var(--warn-soft);
  border-color: var(--bx-warn);
  color:        var(--bx-warn);
}

.note-kreis.schlecht {
  background:   var(--bad-soft);
  border-color: var(--bx-bad);
  color:        var(--bx-bad);
}

.gross-zahl {
  font-family: var(--bx-head);
  font-size:   1.875rem;
  font-weight: 600;
  line-height: 1.15;
}

.balken {
  height:        8px;
  overflow:      hidden;
  background:    var(--bx-sunken);
  border-radius: 4px;
}

.balken > span {
  display:    block;
  height:     100%;
  background: var(--bx-accent);
}

.aufgaben-balken {
  display:               grid;
  grid-template-columns: minmax(90px, max-content) 1fr 90px;
  align-items:           center;
  gap:                   8px 12px;
  margin-top:            16px;
  font-size:             0.875rem;
}

.aufgaben-balken:empty {
  margin-top: 0;
}

.deine-antwort {
  margin:        6px 0 10px;
  padding:       10px 14px;
  background:    var(--bx-sunken);
  border-radius: var(--bx-r-s);
  white-space:   pre-wrap;
  overflow-wrap: anywhere;
}

.deine-antwort.leer {
  color:      var(--bx-muted);
  font-style: italic;
}

.punkte-eingabe {
  display:     inline-flex;
  align-items: center;
  gap:         6px;
  font-weight: 600;
  white-space: nowrap;
}

.punkte-eingabe input {
  width:      76px;
  min-height: 34px;
  padding:    3px 8px;
  text-align: right;
}

/* Rand links: wie gut die Teilaufgabe gelöst ist */
.rand-gut {
  border-left: 4px solid var(--bx-ok);
}

.rand-mittel {
  border-left: 4px solid var(--bx-warn);
}

.rand-schlecht {
  border-left: 4px solid var(--bx-bad);
}

.rand-offen {
  border-left: 4px solid var(--bx-line-2);
}

.hinweis {
  margin:        10px 0;
  padding:       10px 14px;
  border-radius: var(--bx-r-s);
  font-size:     0.9375rem;
}

.hinweis.tipp {
  background: var(--bx-accent-soft);
}

.hinweis.anmerkung {
  background: var(--warn-soft);
}

.hinweis.fehler {
  background: var(--bad-soft);
  color:      var(--bx-bad);
}

details {
  margin: 10px 0;
}

details > summary {
  color:     var(--bx-accent);
  font-size: 0.875rem;
  cursor:    pointer;
}

details.karte > summary {
  color:     var(--bx-text);
  font-size: 1rem;
}

details.karte > summary .leise {
  margin-left: 6px;
}

details.situation > summary {
  list-style-position: inside;
}

/* Lädt gerade: dreht nur, solange eine Bewertung läuft */
.dreher {
  display:          inline-block;
  width:            14px;
  height:           14px;
  border:           2px solid var(--bx-line-2);
  border-top-color: var(--bx-accent);
  border-radius:    50%;
  vertical-align:   -2px;
  animation:        drehen 0.8s linear infinite;
}

@keyframes drehen {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Seitenbilder und Dialog ──────────────────────────────────── */
.overlay {
  position:       fixed;
  inset:          0;
  z-index:        60;
  display:        flex;
  flex-direction: column;
  background:     var(--schleier);
}

.overlay-leiste {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             12px;
  padding:         8px 16px;
  color:           var(--schleier-text);
}

.overlay-leiste .bx-btn,
.overlay-leiste .bx-btn:hover {
  background:   transparent;
  border-color: var(--schleier-text);
  color:        var(--schleier-text);
}

.overlay-inhalt {
  padding:    0 16px 24px;
  overflow:   auto;
  text-align: center;
}

.overlay-inhalt img {
  display:    block;
  max-width:  min(100%, 1000px);
  margin:     0 auto 14px;
  background: var(--papier);
  cursor:     zoom-in;
}

.overlay-inhalt img.gross {
  width:     1600px;
  max-width: none;
  cursor:    zoom-out;
}

.dialog-huelle {
  align-items:     center;
  justify-content: center;
}

.dialog {
  width:         min(460px, calc(100% - 32px));
  padding:       22px 24px 20px;
  background:    var(--bx-surface);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-m);
  box-shadow:    var(--bx-shadow);
  color:         var(--bx-text);
}

.dialog p {
  margin: 0;
}

.dialog.melden h3 {
  margin: 0 0 4px;
}

.dialog.melden label {
  display:     block;
  margin:      14px 0 6px;
  font-size:   0.875rem;
  font-weight: 600;
}

.dialog.melden select,
.dialog.melden textarea {
  width: 100%;
}

.dialog.melden textarea {
  padding:       8px 10px;
  background:    var(--bx-surface);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-s);
  color:         var(--bx-text);
  font:          inherit;
  resize:        vertical;
}

.dialog-knoepfe {
  display:         flex;
  flex-wrap:       wrap;
  justify-content: flex-end;
  gap:             10px;
  margin-top:      18px;
}

/* ─── Übersicht: Filter, Auswahl, Themen ───────────────────────── */
.filterleiste {
  display:         flex;
  flex-wrap:       wrap;
  align-items:     center;
  justify-content: space-between;
  gap:             10px;
  margin:          16px 0 4px;
}

.filter-chip {
  min-height:    32px;
  padding:       4px 12px;
  background:    var(--bx-surface);
  border:        1px solid var(--bx-line-2);
  border-radius: var(--bx-r-s);
  color:         var(--bx-text);
  font:          inherit;
  font-size:     0.875rem;
  cursor:        pointer;
}

.filter-chip:hover {
  border-color: var(--bx-accent);
}

.filter-chip.aktiv {
  background:   var(--bx-accent);
  border-color: var(--bx-accent);
  color:        var(--bx-accent-ink);
  font-weight:  600;
}

.filter-chip.aktiv .leise {
  color:   inherit;
  opacity: 0.8;
}

.karte-kopf {
  display:         flex;
  align-items:     baseline;
  justify-content: space-between;
  gap:             8px;
  margin-bottom:   2px;
}

.stand {
  display:     flex;
  flex:        0 0 auto;
  flex-wrap:   nowrap;
  align-items: center;
  gap:         6px;
}

/* kleiner Knopf „nur diesen Fortschritt zurücksetzen" */
.stand .bx-btn,
.thema .bx-btn.klein {
  width:      28px;
  min-height: 26px;
  padding:    0;
  font-size:  0.875rem;
}

.teilwahl {
  font-size: 0.875rem;
}

.teilgruppe {
  display:       flex;
  flex-wrap:     wrap;
  gap:           2px 12px;
  padding:       5px 0;
  border-bottom: 1px dashed var(--bx-line);
}

.teilgruppe label {
  white-space: nowrap;
  cursor:      pointer;
}

.themen-raster {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
  gap:                   4px 20px;
  margin-top:            8px;
}

.thema {
  display:               grid;
  grid-template-columns: auto 1fr 70px auto;
  align-items:           center;
  gap:                   10px;
  padding:               6px 8px;
  border-radius:         var(--bx-r-s);
  cursor:                pointer;
}

.thema:hover {
  background: var(--bx-sunken);
}

.thema-text {
  display:        flex;
  flex-direction: column;
  line-height:    1.35;
}

.thema .platzhalter {
  display: inline-block;
  width:   28px;
}

.nachlesen {
  margin-top:    10px;
  padding:       8px 12px;
  background:    var(--bx-sunken);
  border-radius: var(--bx-r-s);
}

.nachlesen a {
  text-decoration: none;
}

.nachlesen a:hover {
  text-decoration: underline;
}

#lesestoff details {
  margin: 6px 0 6px 12px;
}

#lesestoff summary {
  color:     var(--bx-text);
  font-size: 0.9375rem;
}

.ruecksetzer {
  margin:  16px 0 0;
  padding: 10px 16px;
}

.ruecksetzer .zeile.zwischen {
  gap: 10px;
}

.mini-balken {
  display:        inline-block;
  width:          100%;
  min-width:      60px;
  height:         8px;
  overflow:       hidden;
  background:     var(--bx-sunken);
  border-radius:  4px;
  vertical-align: middle;
}

.mini-balken > span {
  display:    block;
  height:     100%;
  background: var(--bx-accent);
}

.mini-balken.gut > span {
  background: var(--bx-ok);
}

.mini-balken.mittel > span {
  background: var(--bx-warn);
}

.mini-balken.schlecht > span {
  background: var(--bx-bad);
}

.mini-balken.leer > span {
  width: 0;
}

.vorschau {
  margin-top:    16px;
  padding:       10px 14px;
  background:    var(--bx-accent-soft);
  border-radius: var(--bx-r-s);
  font-size:     0.9375rem;
}

.abstand-klein {
  margin-top: 6px;
}

.abstand {
  margin-top: 14px;
}

.abstand-gross {
  margin-top: 28px;
}

.rechts {
  text-align:  right;
  white-space: nowrap;
}

td.breit {
  width: 40%;
}

/* ─── Netzwerk-Trainer: eingebettete Seite, füllt den Rest des Fensters ─── */
.inhalt.breit {
  display:   flex;
  max-width: none;
  padding:   0;
}

.netzwerk-rahmen {
  display:    block;
  flex:       1;
  width:      100%;
  height:     calc(100vh - 170px);
  min-height: 520px;
  border:     0;
}

body:has(.inhalt.breit) {
  height:   100vh;
  height:   100dvh;
  overflow: hidden;
}

body:has(.inhalt.breit) .inhalt {
  min-height: 0;
}

body:has(.inhalt.breit) .netzwerk-rahmen {
  height:     100%;
  min-height: 0;
}

body:has(.inhalt.breit) .fuss,
body:has(.inhalt.breit) .statuszeile {
  display: none;
}

/* ─── Schmal ───────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .kopf {
    gap:     2px 12px;
    padding: 6px 12px 0;
  }

  .konto {
    margin-left: auto;
  }

  .reiter {
    order:  3;
    width:  100%;
    margin: 0 -4px;
  }

  .wer {
    max-width: 8rem;
  }

  .statuszeile {
    padding: 8px 12px 0;
  }

  .inhalt {
    padding: 20px 12px 48px;
  }

  .leiste {
    margin-top: -20px;
  }

  .karte {
    padding: 16px;
  }

  .teil {
    padding: 16px 14px 14px;
  }

  input.suche {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .ergebnis-kopf {
    grid-template-columns: 1fr;
    justify-items:         start;
  }

  .aufgaben-balken {
    grid-template-columns: minmax(70px, 40%) 1fr 80px;
  }

  table.eingabe th.zeilenkopf {
    width: 40%;
  }

  .uhr {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .bx-bar {
    gap:     8px;
    padding: 0 10px;
  }
}

/* ─── Programmieren ────────────────────────────────────────────── */
.prog-karte {
  display:         flex;
  flex-direction:  column;
  gap:             10px;
  color:           var(--bx-text);
  text-decoration: none;
}

.prog-karte:hover {
  border-color: var(--bx-accent);
}

.prog-code,
.prog-eingabe,
.prog-ausgabe {
  width:         100%;
  margin-top:    10px;
  padding:       10px 12px;
  background:    var(--bx-sunken);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-s);
  color:         var(--bx-text);
  font-family:   var(--bx-mono, ui-monospace, "Cascadia Mono", Consolas, monospace);
  font-size:     0.875rem;
  line-height:   1.5;
  tab-size:      4;
}

.prog-code {
  resize:      vertical;
  white-space: pre;
  overflow-x:  auto;
}

.prog-eingabe {
  margin-top: 4px;
  resize:     vertical;
}

.prog-ausgabe {
  margin-bottom: 0;
  max-height:    22rem;
  overflow:      auto;
  white-space:   pre-wrap;
}

.prog-ausgabe.fehler {
  border-color: var(--bx-bad);
}

#prog-eigen {
  margin-top: 14px;
}

.prog-tests pre {
  margin:      0;
  font-size:   0.8125rem;
  white-space: pre-wrap;
}

.prog-tests th {
  text-align: left;
}

.prog-ergebnis {
  white-space: nowrap;
}

.prog-ergebnis.gut {
  color: var(--bx-ok);
}

.prog-ergebnis.schlecht {
  color: var(--bx-bad);
}

/* Aufgabe mit Erklär-Leiste: breit nebeneinander, schmal untereinander */
.inhalt:has(> .prog-seite) {
  max-width: 1300px;
}

.prog-seite {
  display:               grid;
  grid-template-columns: minmax(0, 1fr);
  gap:                   0 20px;
}

.prog-hilfe h3:first-child {
  margin-top: 0;
}

.prog-hilfe pre {
  margin:        6px 0 10px;
  padding:       8px 10px;
  overflow-x:    auto;
  background:    var(--bx-sunken);
  border:        1px solid var(--bx-line);
  border-radius: var(--bx-r-s);
  font-size:     0.8125rem;
  white-space:   pre-wrap;
}

.prog-hilfe dl {
  margin: 0;
}

.prog-hilfe dt {
  margin-top: 10px;
}

.prog-hilfe dd,
.prog-hilfe details p {
  margin:      4px 0 0;
  font-size:   0.875rem;
  line-height: 1.5;
}

.prog-hilfe code {
  font-size:   0.8125rem;
  font-weight: 600;
}

.prog-hilfe details {
  padding:    6px 0;
  border-top: 1px solid var(--bx-line);
}

.prog-hilfe summary {
  cursor: pointer;
}

.prog-zeile {
  display:       block;
  margin:        0 -6px;
  padding:       0 6px;
  border-radius: 3px;
}

.prog-zeile:hover {
  background: var(--bx-accent-soft);
}

@media (min-width: 1180px) {
  .prog-seite {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .prog-hilfe {
    position:   sticky;
    top:        64px;
    align-self: start;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
}

/* der Spickzettel rollt für sich, damit "Was macht diese Zeile?" oben stehen bleibt */
@media (min-width: 1180px) {
  #prog-befehle {
    max-height: 38vh;
    overflow-y: auto;
  }
}
