/* Codekiste – gemeinsames Aussehen aller eigenen Seiten */
:root {
  --mint: #1f9e86;
  --mint-dunkel: #146f5f;
  --mint-hell: #e3f4ef;
  --grund: #f5faf8;
  --karte: #ffffff;
  --text: #1d2b28;
  --leise: #5b6b67;
  --linie: #d5e3df;
  --warnung: #b3261e;
  --warnung-hell: #fdecea;
  --hinweis: #8a5a00;
  --hinweis-hell: #fff4dc;
  --ok: #1e7b3a;
  --radius: 10px;
  --schatten: 0 1px 3px rgba(20, 60, 50, 0.12);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, sans-serif;
  color: var(--text);
  background: var(--grund);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { min-height: 100vh; line-height: 1.45; font-size: 16px; }
a { color: var(--mint-dunkel); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; }
[hidden] { display: none !important; }
.leise { color: var(--leise); }
.klein { font-size: 0.875rem; }
.vorschrift { white-space: pre-line; }

/* ---- Knöpfe und Felder ---- */
button, .knopf {
  font: inherit; cursor: pointer; border: 1px solid var(--mint); background: var(--mint); color: #fff;
  border-radius: 8px; padding: 0.5em 1em; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4em;
  line-height: 1.2; white-space: nowrap;
}
button:hover, .knopf:hover { background: var(--mint-dunkel); border-color: var(--mint-dunkel); }
button:disabled { opacity: 0.55; cursor: default; }
button.zweit, .knopf.zweit { background: #fff; color: var(--mint-dunkel); }
button.zweit:hover, .knopf.zweit:hover { background: var(--mint-hell); }
button.gefahr { background: #fff; color: var(--warnung); border-color: var(--warnung); }
button.gefahr:hover { background: var(--warnung-hell); }
button.klein, .knopf.klein { padding: 0.25em 0.6em; font-size: 0.875rem; }
button.gross { font-size: 1.1rem; padding: 0.7em 1.4em; }
input, select, textarea {
  font: inherit; color: inherit; border: 1px solid var(--linie); border-radius: 8px; padding: 0.5em 0.6em; background: #fff;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(31, 158, 134, 0.35); outline-offset: 1px; }
textarea { width: 100%; min-height: 8em; resize: vertical; }
label { display: block; font-weight: 600; margin: 0.6em 0 0.25em; }
label.zeile { display: flex; align-items: center; gap: 0.5em; font-weight: normal; }
.feldreihe { display: flex; flex-wrap: wrap; gap: 0.75em; align-items: flex-end; }
.feldreihe > div { flex: 1 1 12em; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 0.5em; align-items: center; margin: 0.6em 0; }

/* ---- Bausteine ---- */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.1em 1.25em; box-shadow: var(--schatten); margin-bottom: 1em; }
.meldung { border-radius: 8px; padding: 0.6em 0.9em; margin: 0.6em 0; }
.meldung.fehler { background: var(--warnung-hell); color: var(--warnung); }
.meldung.hinweis { background: var(--hinweis-hell); color: var(--hinweis); }
.meldung.ok { background: var(--mint-hell); color: var(--mint-dunkel); }
.marke { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.1em 0.55em; border-radius: 999px; background: var(--mint-hell); color: var(--mint-dunkel); white-space: nowrap; }
.marke.grau { background: #eef1f0; color: var(--leise); }
.marke.warn { background: var(--hinweis-hell); color: var(--hinweis); }
.marke.rot { background: var(--warnung-hell); color: var(--warnung); }
.marke.gruen { background: #e2f5e7; color: var(--ok); }
.code { font-family: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", monospace; letter-spacing: 0.08em; }
.punkt { display: inline-block; width: 0.65em; height: 0.65em; border-radius: 50%; background: #c9d4d1; margin-right: 0.35em; vertical-align: 0.05em; }
.punkt.an { background: #2fb36a; }

/* ---- Kopfleiste ---- */
.kopf { display: flex; align-items: center; gap: 0.8em; padding: 0.55em 1em; background: #fff; border-bottom: 1px solid var(--linie); min-height: 3.2rem; }
.kopf .marke-logo { display: flex; align-items: center; gap: 0.45em; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.kopf .marke-logo img { width: 2rem; height: 2rem; }
.kopf .titel { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kopf .luecke { flex: 1; }
.kopf .wer { color: var(--leise); white-space: nowrap; }

/* ---- Startseite (Anmeldung) ---- */
.mitte { max-width: 30rem; margin: 0 auto; padding: 2.5rem 1rem; }
.logo-gross { display: flex; flex-direction: column; align-items: center; gap: 0.3em; margin-bottom: 1.5rem; text-align: center; }
.logo-gross img { width: 5.5rem; height: 5.5rem; }
.logo-gross h1 { font-size: 2rem; margin: 0; }
.eingabe-gross { font-size: 1.35rem; width: 100%; padding: 0.55em 0.7em; }
.eingabe-code { text-transform: uppercase; letter-spacing: 0.15em; text-align: center; font-family: ui-monospace, monospace; }
.fuss { text-align: center; color: var(--leise); font-size: 0.875rem; margin: 2rem 0 1rem; }
.fuss a { color: var(--leise); margin: 0 0.4em; }

/* ---- Inhaltsseiten ---- */
.inhalt { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.text { max-width: 46rem; margin: 0 auto; padding: 2rem 1rem 3rem; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1em; }
.raster .karte { margin: 0; display: flex; flex-direction: column; gap: 0.4em; }
.raster .karte .knopfreihe { margin-top: auto; }

/* ---- Tabellen ---- */
.tabelle-huelle { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { text-align: left; padding: 0.45em 0.6em; border-bottom: 1px solid var(--linie); vertical-align: middle; }
th { font-size: 0.85rem; color: var(--leise); font-weight: 600; background: #f8fbfa; white-space: nowrap; }
td .knopfreihe { margin: 0; flex-wrap: nowrap; }

/* ---- Editor-Seite ---- */
body.arbeit { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.arbeit .kopf { flex: 0 0 auto; flex-wrap: nowrap; }
.status { font-size: 0.9rem; color: var(--leise); white-space: nowrap; }
.status.fehler { color: var(--warnung); font-weight: 600; }
.restzeit { font-variant-numeric: tabular-nums; font-weight: 700; padding: 0.2em 0.6em; border-radius: 8px; background: var(--mint-hell); color: var(--mint-dunkel); white-space: nowrap; }
.restzeit.knapp { background: var(--hinweis-hell); color: var(--hinweis); }
.restzeit.vorbei { background: var(--warnung-hell); color: var(--warnung); }
.buehne { position: relative; flex: 1 1 auto; min-height: 0; }
.buehne iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.aufgabentext { flex: 0 0 auto; max-height: 30vh; overflow: auto; background: var(--hinweis-hell); border-bottom: 1px solid var(--linie); padding: 0.6em 1em; }
.sperre { position: absolute; inset: 0; background: rgba(245, 250, 248, 0.86); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 1em; }
.sperre .karte { max-width: 32rem; text-align: center; }
.laden { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 0.8em; color: var(--leise); background: #fff; z-index: 5; }
.kreisel { width: 2.4rem; height: 2.4rem; border: 4px solid var(--mint-hell); border-top-color: var(--mint); border-radius: 50%; animation: drehen 0.9s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }
.versionen { width: 17rem; flex: 0 0 auto; overflow: auto; border-left: 1px solid var(--linie); background: #fff; padding: 0.6em; }
.versionen button { width: 100%; justify-content: space-between; margin-bottom: 0.3em; }
.zweispaltig { display: flex; flex: 1 1 auto; min-height: 0; }
.zweispaltig .buehne { flex: 1 1 auto; }

/* ---- Lehrkraft-Bereich ---- */
body.lehrkraft .inhalt { max-width: 84rem; }
td.nw { white-space: nowrap; }
details.menue { position: relative; display: inline-block; }
details.menue > summary { list-style: none; cursor: pointer; border: 1px solid var(--linie); border-radius: 8px; padding: 0.15em 0.6em; font-weight: 700; color: var(--mint-dunkel); background: #fff; }
details.menue > summary::-webkit-details-marker { display: none; }
details.menue[open] > summary { background: var(--mint-hell); }
details.menue .menue-inhalt { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; background: #fff; border: 1px solid var(--linie); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); padding: 0.4em; display: flex; flex-direction: column; gap: 0.3em; min-width: 11rem; }
details.menue .menue-inhalt > * { justify-content: flex-start; }
.reiter { display: flex; gap: 0.3em; }
.reiter button { background: transparent; color: var(--text); border-color: transparent; }
.reiter button[aria-current="page"] { background: var(--mint-hell); color: var(--mint-dunkel); border-color: var(--mint-hell); font-weight: 600; }
.code-gross { font-size: 2rem; font-weight: 700; }
.kopfzeile-gruppe { display: flex; flex-wrap: wrap; gap: 1.2em; align-items: flex-start; justify-content: space-between; }
details.aufklapp > summary { cursor: pointer; font-weight: 600; margin: 0.4em 0; }
dialog { border: none; border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); max-width: 34rem; width: calc(100% - 2rem); }
dialog::backdrop { background: rgba(20, 40, 35, 0.35); }

@media (max-width: 700px) {
  .kopf { flex-wrap: wrap; }
  .versionen { display: none; }
}
