:root { --bg: #f6f5f2; --fg: #1d1d1f; --karte: #fff; --rand: #d9d6cf; --akzent: #2f5d7c;
  --gut: #2e7d32; --schlecht: #c62828; --mild: #6b6b6b; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181a; --fg: #e8e6e3; --karte: #222427; --rand: #3a3d42; --akzent: #7fb2d6; --mild: #a0a0a0; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
a { color: var(--akzent); }
.kopf { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  padding: .6rem 1rem; border-bottom: 1px solid var(--rand); background: var(--karte); }
.marke { font-weight: 700; text-decoration: none; color: var(--fg); }
nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
nav a { text-decoration: none; }
.abmelden { display: inline; margin: 0; }
.abmelden button { background: none; border: 0; color: var(--mild); cursor: pointer; padding: 0; font: inherit; }
main { max-width: 760px; margin: 0 auto; padding: 1rem; }
.karte, .fertig, .login { background: var(--karte); border: 1px solid var(--rand); border-radius: 12px; padding: 1rem 1.2rem; }
.stufe { color: var(--mild); font-size: .85rem; }
h2 { margin: .3rem 0 .8rem; font-size: 1.25rem; }
/* 1. Notenbilder: SVGs sind schwarz auf transparent -> immer heller Grund */
.notenbild { background: #fff; border-radius: 8px; padding: .8rem; text-align: center; overflow-x: auto; }
.notenbild img { height: clamp(110px, 20vh, 190px); width: auto; max-width: 100%; object-fit: contain; }
.notenbild.trad img { height: clamp(70px, 12vh, 130px); }
.notenbild.trad { margin-top: .6rem; position: relative; }
.beschriftung { position: absolute; top: .3rem; left: .6rem; font-size: .75rem; color: #777; }
.hinweis { color: var(--mild); font-size: .9rem; }
/* 2. Antworten */
.optionen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; margin-top: 1rem; }
.option { padding: .7rem; border: 1px solid var(--rand); border-radius: 8px; background: var(--bg); color: var(--fg);
  font-size: 1.05rem; cursor: pointer; text-align: left; min-height: 44px; }
.option kbd { font-size: .7rem; color: var(--mild); margin-right: .3rem; }
.option.richtig { border-color: var(--gut); background: rgba(46,125,50,.15); }
.option.falsch { border-color: var(--schlecht); background: rgba(198,40,40,.15); }
.frei { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.frei input { flex: 1 1 220px; max-width: 100%; font-size: 1.15rem; padding: .55rem .7rem; border-radius: 8px;
  border: 1px solid var(--rand); background: var(--bg); color: var(--fg); }
.frei > button, .einstellungen button, .login button { padding: .55rem 1.1rem; border-radius: 8px; border: 0;
  background: var(--akzent); color: #fff; font-size: 1rem; cursor: pointer; min-height: 44px; }
.tasten { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .3rem; }
.tasten button { min-width: 2.6rem; min-height: 40px; border-radius: 6px; border: 1px solid var(--rand);
  background: var(--bg); color: var(--fg); font-size: 1rem; cursor: pointer; }
/* 3. Ergebnis und Bewertung */
.ergebnis { margin-top: 1rem; border-top: 1px solid var(--rand); padding-top: .8rem; }
.urteil { font-weight: 700; font-size: 1.1rem; margin: 0; }
.urteil.gut { color: var(--gut); } .urteil.schlecht { color: var(--schlecht); }
.toene .ok { color: var(--gut); font-weight: 600; } .toene .nok { color: var(--schlecht); font-weight: 600; text-decoration: underline; }
.quelle { color: var(--mild); font-size: .85rem; font-style: italic; }
.bewertung { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-top: .8rem; }
.bewertung button { padding: .55rem .2rem; border-radius: 8px; border: 1px solid var(--rand); background: var(--bg);
  color: var(--fg); cursor: pointer; font-size: .95rem; min-height: 48px; }
.bewertung small { display: block; color: var(--mild); font-size: .75rem; }
.bewertung .vorschlag { outline: 2px solid var(--akzent); }
.r1 { border-bottom: 3px solid #c62828 !important; } .r2 { border-bottom: 3px solid #ef6c00 !important; }
.r3 { border-bottom: 3px solid #2e7d32 !important; } .r4 { border-bottom: 3px solid #1565c0 !important; }
/* 4. Zähler, Tabellen, Formulare */
.zaehler { display: flex; flex-wrap: wrap; gap: .3rem .9rem; justify-content: center; margin-bottom: .6rem; font-weight: 600; }
.z-neu { color: #1565c0; } .z-lernen { color: #c62828; } .z-wdh { color: #2e7d32; } .z-heute { color: var(--mild); font-weight: 400; }
.scroll-x { overflow-x: auto; }
.tabelle { border-collapse: collapse; width: 100%; font-size: .9rem; }
.tabelle th, .tabelle td { border-bottom: 1px solid var(--rand); padding: .4rem; text-align: left; vertical-align: top; }
.tabelle tr.zu { color: var(--mild); }
.erklaerung { color: var(--mild); font-size: .9rem; }
.einstellungen { display: flex; flex-direction: column; gap: .8rem; max-width: 520px; }
.einstellungen fieldset { border: 1px solid var(--rand); border-radius: 8px; }
.einstellungen label { display: block; }
.einstellungen input[type=number] { width: 6rem; max-width: 100%; }
.login { max-width: 380px; margin: 3rem auto; display: flex; flex-direction: column; gap: .8rem; }
.login input[type=password] { width: 100%; font-size: 1rem; padding: .5rem; }
.unsichtbar-benutzer { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fehler { color: var(--schlecht); } .ok { color: var(--gut); }
.fuss { max-width: 760px; margin: 2rem auto 1rem; padding: 0 1rem; color: var(--mild); font-size: .75rem; }
.zaehler small { font-weight: 400; color: var(--mild); margin-left: .2rem; }
@media (max-width: 700px) {
  /* rating buttons always reachable on phones */
  .bewertung { position: sticky; bottom: 0; background: var(--karte); padding: .5rem 0 .6rem;
    margin-bottom: -.6rem; box-shadow: 0 -6px 10px -8px rgba(0,0,0,.35); z-index: 2; }
  main { padding: .6rem; }
  .karte { padding: .8rem; }
}
