/* Schultafel-Look. Lesbarkeit vor Effekt: Kontrast >= 4,5:1, Text >= 16 px. */
@font-face { font-family: "Patrick Hand"; src: url("/static/fonts/patrick-hand.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/static/fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("/static/fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --tafel: #1f4d3a;
  --kreide: #f3f0e4;        /* Text */
  --kreide-gelb: #f7e47f;   /* Hervorhebung */
  --kreide-blau: #a5d8ff;   /* Formeln */
  --kreide-rosa: #ffa8c0;   /* Fehler / Unsicherheit */
  --kreide-gruen: #a6f0b8;  /* sicher */
  --rand: rgba(243, 240, 228, .55);
  --schrift-text: "Atkinson Hyperlegible", system-ui, sans-serif;
  --schrift-kreide: "Patrick Hand", "Comic Sans MS", cursive;
}

* { box-sizing: border-box; }

html { background: var(--tafel); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 400 1.125rem/1.6 var(--schrift-text);   /* 18 px */
  color: var(--kreide);
  background: var(--tafel) url("/static/img/tafel-textur.jpg") center / cover fixed;
}

h1, h2, h3 { font-family: var(--schrift-kreide); font-weight: 400; letter-spacing: .02em; line-height: 1.2; margin: 0 0 .6em; text-shadow: 0 0 1px rgba(255,255,255,.5); }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.6rem; color: var(--kreide-gelb); }
a { color: var(--kreide-blau); }
.klein { font-size: 1rem; opacity: .9; }
.formel { color: var(--kreide-blau); }
.unsicher { color: var(--kreide-rosa); }
.sicher { color: var(--kreide-gruen); }
.hervor { color: var(--kreide-gelb); }

/* Holzleisten */
.leiste {
  background: #d9b98a url("/static/img/holzrahmen-oben.jpg") center / cover repeat-x;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  color: #3b2a14;
}
.leiste a, .leiste button { color: inherit; }
.kopf { display: flex; align-items: center; justify-content: space-between; padding: .35rem 1rem; min-height: 56px; }
.kopf .titel { font-family: var(--schrift-kreide); font-size: 1.6rem; text-decoration: none; color: #3b2a14; text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.fuss { background-image: url("/static/img/holzrahmen-unten.jpg"); margin-top: auto; padding: .5rem 1rem; min-height: 56px; display: flex; justify-content: space-around; align-items: center; }
.fuss a { display: flex; flex-direction: column; align-items: center; min-width: 64px; min-height: 48px; justify-content: center; font-size: 1rem; font-weight: 700; text-decoration: none; color: #3b2a14; }
.fuss img { width: 28px; height: 28px; filter: invert(1) brightness(.25); } /* Kreide-Icon auf Holz dunkel */

main { width: 100%; max-width: 42rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
@media (min-width: 900px) { main { max-width: 60rem; } }

/* Formulare und Knöpfe: wie mit Kreide umrandet */
input, textarea, select {
  font: inherit; color: var(--kreide); width: 100%; min-height: 48px; padding: .6rem .8rem;
  background: rgba(0,0,0,.25); border: 2px solid var(--rand); border-radius: 10px 4px 12px 5px / 5px 12px 4px 10px;
}
input::placeholder, textarea::placeholder { color: rgba(243,240,228,.7); }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--kreide-gelb); outline-offset: 2px; }
label { display: block; margin: .9rem 0 .25rem; font-weight: 700; }

button, .knopf {
  position: relative; overflow: hidden;
  font: 400 1.25rem var(--schrift-kreide); letter-spacing: .03em;
  min-height: 48px; padding: .5rem 1.2rem; cursor: pointer; color: var(--kreide);
  background: transparent; border: 2px solid var(--kreide);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button:hover, .knopf:hover { background: rgba(243,240,228,.12); }
button.leise { border-color: var(--rand); font-size: 1.1rem; }
.leiste button { border-color: #3b2a14; color: #3b2a14; min-height: 44px; }

/* Kreidestaub beim Tippen */
button::after, .knopf::after {
  content: ""; position: absolute; inset: -30%; pointer-events: none; opacity: 0;
  background: url("/static/img/kreidestaub.png") center / contain no-repeat;
}
button:active::after, .knopf:active::after { animation: staub .45s ease-out; }
@keyframes staub { from { opacity: .85; transform: scale(.5); } to { opacity: 0; transform: scale(1.3); } }

/* Karten / Blöcke auf der Tafel */
.block { border: 2px solid var(--rand); border-radius: 14px 5px 16px 6px / 6px 16px 5px 14px; padding: 1rem 1.1rem; margin: 1rem 0; background: rgba(0,0,0,.15); }
ul.liste { list-style: none; padding: 0; margin: 0; }
ul.liste li { border-bottom: 1px dashed var(--rand); padding: .7rem 0; }
.fehler { color: var(--kreide-rosa); font-weight: 700; }

/* Fortschritt: Kreidestrich, der sich füllt */
.strich { height: 14px; background: rgba(0,0,0,.3); border-radius: 7px; overflow: hidden; }
.strich > span { display: block; height: 100%; background: url("/static/img/kreidestrich.png") left center / 100% 100% no-repeat, var(--kreide); border-radius: 7px; transition: width .6s ease; }

/* Schwamm wischt beim Seitenwechsel */
.wisch { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.wisch::before {
  content: ""; position: absolute; top: 20%; left: -30%; width: 90px; height: 90px;
  background: url("/static/img/schwamm.png") center / contain no-repeat;
  animation: wisch .7s ease-in-out forwards;
}
.wisch::after { content: ""; position: absolute; inset: 0; background: var(--tafel); animation: aufdecken .7s ease-in-out forwards; }
@keyframes wisch { from { left: -30%; opacity: 1; } to { left: 110%; opacity: 0; } }
@keyframes aufdecken { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 0 100%); } }

@media (prefers-reduced-motion: reduce) {
  .wisch { display: none; }
  button:active::after, .knopf:active::after { animation: none; }
  .strich > span { transition: none; }
}

/* Unauffälliger Textknopf (z. B. Abmelden) */
.abmelden { margin-top: 2.5rem; text-align: center; }
button.textknopf { border: 0; border-radius: 6px; background: none; font: 400 1rem var(--schrift-text); text-decoration: underline; opacity: .8; min-height: 48px; }
button.textknopf:hover { background: none; opacity: 1; }

/* Themenliste und Lernplan-Baum */
a.themenlink { font: 400 1.5rem var(--schrift-kreide); color: var(--kreide); text-decoration: none; display: block; padding: .2rem 0; min-height: 48px; }
a.themenlink:hover { color: var(--kreide-gelb); }
summary { cursor: pointer; min-height: 32px; padding: .2rem 0; }
ol.lektionen { padding-left: 1.3rem; }
ol.lektionen > li { margin: .8rem 0; }
ul.ziele { list-style: none; padding-left: .4rem; margin: .3rem 0 0; }
ul.ziele summary { font-size: 1rem; }
[hidden] { display: none !important; }

/* Fragen */
.katex { color: var(--kreide-blau); font-size: 1.1em; }
.mathe { white-space: pre-line; }
p.frage { font-size: 1.25rem; }
label.wahl { display: flex; gap: .75rem; align-items: flex-start; min-height: 48px; padding: .6rem .8rem; margin: .5rem 0; border: 2px solid var(--rand); border-radius: 12px 4px 14px 5px / 5px 14px 4px 12px; cursor: pointer; font-weight: 400; }
label.wahl:has(input:checked) { border-color: var(--kreide-gelb); background: rgba(247, 228, 127, .12); }
label.wahl input { width: 24px; min-height: 24px; height: 24px; margin: .15rem 0 0; flex: none; accent-color: var(--kreide-gelb); }
fieldset.sicherheit { border: 0; padding: 0; margin: 1.2rem 0 0; }
fieldset.sicherheit legend { font-family: var(--schrift-kreide); font-size: 1.3rem; color: var(--kreide-gelb); padding: 0; }
p.aktionen, form.aktionen { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.antworttext { margin: .8rem 0; }
.gestrichen { text-decoration: line-through; opacity: .65; }
.marke { font-size: 1rem; color: var(--kreide-gelb); }
