/* ==========================================================================
   Schreibtrainer (tools/seiten_schreiben.py, assets/js/schreibtrainer.js)

   Drei Farben, und jede heisst genau eine Sache — die Werte kommen aus den
   Tokens von stil.css, damit hell und dunkel von selbst stimmen:

   * Blaugruen (`--ok` der Uebungskarte): richtig.
   * Orange (`--fehler` der Uebungskarte, Okabe & Ito): weicht ab. Kein Rot:
     Ein Fehler beim Schreiben ist Teil des Lernens.
   * Bernstein (`--akzent`): Hinweis beim freien Schreiben — eine Frage,
     kein Urteil.

   Keine dieser Farben steht allein. Richtig traegt einen Haken, falsch ein
   Kreuz, und jede Art der Abweichung hat ihre eigene Linie: Wellenlinie
   (anderes Wort), durchgestrichen (zu viel), gestrichelt (falsche Stelle),
   gepunktet (Gross/klein, Akzent, Tippfehler), ein Einfuegezeichen (fehlt).
   ========================================================================== */

.st-seite { --st-mass: 46rem; }
.st-seite .seitenkopf { margin-bottom: 1.4rem; }

.st-versprechen {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .5rem .9rem;
}
.st-versprechen li {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .92rem; color: var(--ink-2);
}
.st-versprechen svg {
  width: 18px; height: 18px; color: var(--marke-ink); flex: none;
}

/* --- Die beiden Wege ------------------------------------------------------ */

.st-wahl {
  display: grid; gap: .9rem; margin: 0 0 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
}
.st-wahl-karte {
  display: grid; grid-template-columns: auto 1fr; gap: .2rem .9rem;
  align-items: start; padding: 1.05rem 1.15rem;
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--rund); box-shadow: var(--schatten-1);
  color: var(--ink); text-decoration: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.st-wahl-karte:hover { box-shadow: var(--schatten-2); border-color: var(--flaeche-umriss); }
.st-wahl-karte b { display: block; font-size: 1.05rem; margin-bottom: .15rem; }
.st-wahl-karte span span { color: var(--ink-2); font-size: .93rem; }
.st-wahl-zeichen {
  grid-row: span 2; display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--marke-weich); color: var(--marke-ink);
}
.st-wahl-zeichen svg { width: 20px; height: 20px; }
.st-wahl-marke {
  grid-column: 2; justify-self: start; margin-top: .45rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  padding: .12rem .55rem; border-radius: 999px;
}
.st-marke-exakt { background: var(--ok-weich); color: var(--ok-ink); }
.st-marke-hinweis { background: var(--akzent-weich); color: var(--akzent-ink); }

/* --- Start ---------------------------------------------------------------- */

.st-start h2, .st-frei h2 { margin-top: 0; }
.st-schrifthinweis { margin: .2rem 0 1rem; }
.st-einstellung { display: grid; gap: 1rem; margin: 1rem 0 .4rem; }
.st-feld { display: grid; gap: .35rem; border: 0; margin: 0; padding: 0; min-width: 0; }
.st-feld select { max-width: 24rem; }
.st-etikett {
  font-size: .85rem; font-weight: 600; color: var(--ink-2);
  padding: 0; margin: 0 0 .2rem;
}
.st-artenliste {
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
}
.st-art {
  position: relative; display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: .65rem; cursor: pointer;
  padding: .6rem .75rem; border-radius: var(--rund);
  border: 1px solid var(--linie-kraeftig); background: var(--karte);
  min-height: 3rem;
}
.st-art input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.st-art-zeichen {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem;
  border-radius: 8px; background: var(--bg-tief); color: var(--ink-3);
  font-weight: 700; font-size: .95rem;
}
.st-art-text b { display: block; font-size: .95rem; }
.st-art-text small { color: var(--ink-3); font-size: .82rem; }
.st-art-zahl { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.st-art:has(input:checked) {
  border-color: var(--marke); background: var(--marke-weich);
}
.st-art:has(input:checked) .st-art-zeichen { background: var(--marke); color: var(--knopf-ink); }
.st-art:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--marke); }
/* Ohne :has() (aeltere Browser) bleibt das Kaestchen sichtbar. */
@supports not selector(:has(*)) {
  .st-art input { position: static; opacity: 1; width: auto; height: auto; pointer-events: auto; }
}
.st-knoepfe { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.1rem 0 .3rem; }
.st-mit-thema .st-einstellung { display: none; }

/* --- Die Runde ------------------------------------------------------------- */

.st-karte { max-width: var(--st-mass); margin-left: auto; margin-right: auto; }
.st-kopf { justify-content: space-between; }
.st-art-name { font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.st-zaehler { margin-left: auto; font-variant-numeric: tabular-nums; }
.st-schliessen {
  font: inherit; font-size: 1.35rem; line-height: 1; color: var(--ink-3);
  background: none; border: 0; cursor: pointer;
  min-width: 2.2rem; min-height: 2.2rem; border-radius: 50%;
}
.st-schliessen:hover { background: var(--karte); color: var(--ink); }
.st-band { height: 4px; background: var(--bg-tief); }
.st-band i {
  display: block; height: 100%; background: var(--marke);
  transition: width .3s ease;
}
@media (prefers-reduced-motion: reduce) { .st-band i { transition: none; } }

.st-auftrag-zeile { font-size: .92rem; color: var(--ink-3); margin: 0 0 .5rem; }
.st-vorgabe {
  font-size: 1.22rem; line-height: 1.55; margin: 0 0 .6rem;
  overflow-wrap: anywhere;
}
.st-vorgabe-quelle { font-family: var(--schrift-lese, inherit); }
.st-luecke {
  display: inline-block; min-width: 3.2rem; margin: 0 .2rem;
  border-bottom: 2px solid var(--marke); vertical-align: baseline;
}
.st-karten { display: flex; flex-wrap: wrap; gap: .4rem; }
.st-karte-wort {
  display: inline-block; padding: .2rem .6rem; border-radius: 8px;
  background: var(--bg-tief); border: 1px solid var(--linie);
  font-size: 1.05rem;
}
.st-hilfe { font-size: .93rem; color: var(--ink-2); margin: .2rem 0 .5rem; }
.st-etikett-klein {
  font-size: .8rem; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-3); text-transform: none;
}
.st-koerper .st-etikett { display: block; margin-top: 1rem; }
.st-eingabe {
  width: 100%; font-size: 1.15rem; line-height: 1.5; padding: .6rem .75rem;
  resize: vertical;
}
.st-eingabe:focus { outline: none; box-shadow: 0 0 0 3px var(--marke-weich); border-color: var(--marke); }

/* Die Rueckmeldung: eine Flaeche mit Zeichen, nie nur eine Farbe. */
.st-rueck:empty { display: none; }
.st-rueck {
  margin-top: 1rem; padding: .95rem 1.05rem; border-radius: var(--rund);
  border-left: 4px solid transparent;
}
.st-rueck > :last-child { margin-bottom: 0; }
.st-gut { background: var(--ok-weich); border-left-color: var(--ok); }
.st-falsch { background: var(--fehler-weich); border-left-color: var(--fehler); }
.st-urteil { display: flex; align-items: center; gap: .45rem; margin: 0 0 .5rem; }
.st-gut .st-urteil { color: var(--ok-ink); }
.st-falsch .st-urteil { color: var(--fehler-ink); }
.st-urteil-zeichen { display: inline-grid; place-items: center; }

.st-eigen {
  font-size: 1.12rem; line-height: 2; margin: .3rem 0 .6rem;
  padding: .45rem .7rem; border-radius: 10px;
  background: var(--karte); overflow-wrap: anywhere;
}
.st-m { text-decoration-thickness: 2px; text-underline-offset: .28em; }
.st-m-falsch { text-decoration: underline wavy var(--fehler); }
.st-m-zuviel { text-decoration: line-through var(--fehler); color: var(--ink-3); }
.st-m-stelle { text-decoration: underline dashed var(--fehler); }
.st-m-gross, .st-m-akzent, .st-m-tipp { text-decoration: underline dotted var(--fehler); }
.st-m-fehlt {
  display: inline-block; min-width: .9rem; margin: 0 .1rem; padding: 0 .2rem;
  border: 2px dashed var(--fehler); border-radius: 6px;
  color: var(--fehler-ink); font-weight: 700; line-height: 1.4;
}
.st-m-soll {
  display: inline-block; margin-left: .25rem; padding: 0 .35rem;
  border-radius: 6px; background: var(--ok-weich); color: var(--ok-ink);
  font-weight: 600; line-height: 1.5;
}
.st-m-fehlt .st-m-soll { margin: 0; background: none; padding: 0; }
.st-unsichtbar {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.st-arten-chips { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .5rem; padding: 0; }
.st-chip {
  font-size: .8rem; padding: .12rem .55rem; border-radius: 999px;
  background: var(--karte); color: var(--fehler-ink); border: 1px solid var(--fehler);
}
.st-vorschlaege { display: flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 .8rem; }
.st-vorschlag {
  font: inherit; font-size: .98rem; cursor: pointer;
  padding: .4rem .8rem; min-height: 2.6rem; border-radius: 999px;
  background: var(--karte); color: var(--ink);
  border: 1px solid var(--linie-kraeftig);
}
.st-vorschlag:hover { border-color: var(--marke); color: var(--marke-ink); }
.st-vorschlag:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--marke); }
.st-vorschlag-genommen, .st-vorschlag:disabled {
  background: var(--ok-weich); color: var(--ok-ink); border-color: var(--ok);
  cursor: default;
}
.st-loesung { margin: .5rem 0 .3rem; font-size: 1.05rem; overflow-wrap: anywhere; }
.st-loesung .ziel { font-weight: 600; }
.st-auch { font-size: .95rem; }
.st-regel {
  margin: .8rem 0 .4rem; padding: .7rem .85rem; border-radius: 10px;
  background: var(--karte); border: 1px solid var(--linie);
}
.st-regel p { margin: 0 0 .35rem; }
.st-regel-text { font-size: .95rem; color: var(--ink-2); }
.st-wege { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .93rem; }
.st-gezaehlt { color: var(--ok-ink); font-weight: 600; }

/* --- Ergebnis -------------------------------------------------------------- */

.st-zahlen {
  display: grid; gap: .6rem; margin-bottom: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.st-zahl {
  display: grid; gap: .1rem; text-align: center; padding: .8rem .4rem;
  border-radius: var(--rund); background: var(--bg-tief);
}
.st-zahl b { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.st-zahl span { font-size: .82rem; color: var(--ink-2); }
.st-zahl-gut b { color: var(--ok-ink); }
.st-zahl-selbst b { color: var(--marke-ink); }
.st-zahl-hilfe b { color: var(--fehler-ink); }
.st-punkte { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0 0 1rem; }
.st-punkt { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--linie-kraeftig); }
.st-punkt-erst, .st-punkt-eigen { background: var(--ok); border-color: var(--ok); }
.st-punkt-selbst { background: var(--marke); border-color: var(--marke); border-radius: 4px; }
.st-punkt-hilfe { background: transparent; border-color: var(--fehler); border-style: dashed; }
.st-lob { font-weight: 600; color: var(--ok-ink); }
.st-daneben { margin: .3rem 0 0; padding-left: 1.2rem; }
.st-daneben li { margin: .2rem 0; }

/* --- Freies Schreiben ------------------------------------------------------ */

.st-frei { margin-top: 1.6rem; }
.st-frei-wahl { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 1rem; }
.st-frei-wahl [aria-pressed="true"] {
  background: var(--marke-weich); color: var(--marke-ink); border-color: var(--marke);
}
.st-auftrag { margin: 0 0 1rem; }
.st-frei-auftrag { font-weight: 600; margin: 0 0 .5rem; }
.st-pflicht { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 .7rem; }
.st-pflicht-wort {
  display: grid; gap: .05rem; padding: .45rem .75rem; border-radius: var(--rund);
  background: var(--bg-tief); border: 1px solid var(--linie);
}
.st-pflicht-ziel { font-size: 1.1rem; font-weight: 700; }
.st-pflicht-wort > span:last-child { font-size: .85rem; color: var(--ink-3); }
.st-frei textarea { width: 100%; font-size: 1.1rem; line-height: 1.55; }
.st-frei-ergebnis { margin-top: 1rem; }
.st-frei-ergebnis h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
.st-checkliste { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.st-check { display: grid; grid-template-columns: auto 1fr; gap: .55rem; align-items: start; }
.st-check-zeichen {
  display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem;
  border-radius: 50%; font-weight: 700; font-size: .9rem;
}
.st-ok.st-check-zeichen { background: var(--ok-weich); color: var(--ok-ink); }
.st-offen.st-check-zeichen { background: var(--bg-tief); color: var(--ink-3); }
.st-check-offen .st-check-text > span:first-child { color: var(--ink-2); }
.st-wortstaende { display: flex; flex-wrap: wrap; gap: .35rem .6rem; margin-top: .3rem; }
.st-wortstand {
  display: inline-flex; align-items: baseline; gap: .3rem;
  padding: .1rem .5rem; border-radius: 999px; font-size: .9rem;
}
.st-wortstand.st-ok { background: var(--ok-weich); color: var(--ok-ink); }
.st-wortstand.st-offen { background: var(--akzent-weich); color: var(--akzent-ink); }
.st-doch {
  font: inherit; font-size: .82rem; margin-left: .3rem; cursor: pointer;
  background: none; border: 0; color: var(--marke-ink); text-decoration: underline;
}
.st-hinweise { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.st-hinweis {
  padding: .7rem .85rem; border-radius: var(--rund);
  background: var(--akzent-weich); border-left: 4px solid var(--akzent);
}
.st-hinweis p { margin: 0 0 .35rem; }
.st-hinweis-kopf { font-size: .93rem; }
.st-marke-klein {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .05em;
  padding: .05rem .45rem; border-radius: 999px;
  background: var(--karte); color: var(--akzent-ink); border: 1px solid var(--akzent);
}
.st-hinweis-stelle { font-size: 1.02rem; overflow-wrap: anywhere; }
.st-m-hinweis {
  background: none; color: inherit;
  text-decoration: underline wavy var(--akzent); text-decoration-thickness: 2px;
  text-underline-offset: .28em;
}
.st-keine { margin: 0; }
.st-muster { margin-top: 1rem; }
.st-musterliste { margin: .4rem 0 0; padding-left: 1.2rem; }
.st-musterliste li { margin: .35rem 0; }
.st-musterliste .zeile-still { display: block; }
.st-selbst { margin-top: 1rem; }
.st-selbst ul { margin: .2rem 0 0; padding-left: 1.2rem; color: var(--ink-2); }

/* Der eingebettete Schreibpruefer: seine Befunde stehen unter den eigenen. */
.st-frei [data-rolle="schreibbefund"] { margin-top: 1.2rem; }

/* --- Erklaerung ------------------------------------------------------------ */

.st-ehrlich { margin-top: 2.4rem; }
.st-ehrlich-raster {
  display: grid; gap: .8rem; margin: 1rem 0 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
}
.st-ehrlich-karte {
  padding: .9rem 1rem; border-radius: var(--rund);
  background: var(--karte); border: 1px solid var(--linie);
}
.st-ehrlich-karte p { margin: 0; font-size: .95rem; }
.st-ehrlich-kopf { font-weight: 700; margin-bottom: .35rem !important; }
.st-ehrlich-exakt { border-top: 3px solid var(--ok); }
.st-ehrlich-hinweis { border-top: 3px solid var(--akzent); }

@media (max-width: 520px) {
  .st-vorgabe { font-size: 1.1rem; }
  .st-zahl b { font-size: 1.5rem; }
  .st-knoepfe .knopf { flex: 1 1 auto; }
}
@media print {
  .st-wahl, .st-start, .st-karte, .st-frei { display: none; }
}
