/* Schreibtakt – Oberfläche. Tokens oben, dann Komponenten. Keine externen Schriften. */

:root {
  --schrift: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

  --grund: #f6f7f9;
  --flaeche: #ffffff;
  --flaeche-2: #eef1f5;
  --linie: #d9dee6;
  --text: #1b2430;
  --text-2: #5a6678;
  --text-3: #8b95a5;

  --primaer: #1f5eff;
  --primaer-dunkel: #174bd1;
  --primaer-hell: #e6edff;
  --gruen: #1f8a4c;
  --gruen-hell: #e3f5ea;
  --gelb: #b7791f;
  --gelb-hell: #fbf1dc;
  --rot: #c53030;
  --rot-hell: #fde8e8;

  /* Fingerfarben (links 5→2, rechts 2→5, Daumen) */
  --finger-l5: #c8a2ff;
  --finger-l4: #9fd0ff;
  --finger-l3: #a8e6b8;
  --finger-l2: #ffe08a;
  --finger-r2: #ffc08a;
  --finger-r3: #a8e6b8;
  --finger-r4: #9fd0ff;
  --finger-r5: #c8a2ff;
  --finger-d: #e2e6ee;

  --radius: 10px;
  --schatten: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .05);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--grund); color: var(--text);
  font-family: var(--schrift); line-height: 1.5;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primaer); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); background: var(--flaeche-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.code-breit { display: block; padding: .6rem .8rem; word-break: break-all; }
.dezent { color: var(--text-2); }
.klein { font-size: .85rem; }
.inline { display: inline; }

/* Kopf und Navigation */
.kopf {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem 1.5rem; background: var(--flaeche); border-bottom: 1px solid var(--linie);
}
.marke { font-weight: 700; font-size: 1.1rem; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.marke:hover { text-decoration: none; }
.marke-gross { font-size: 1.4rem; justify-content: center; margin-bottom: 1.5rem; }
.marke-zeichen {
  display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 7px;
  background: var(--primaer); color: #fff; font-family: var(--mono); font-size: .95em;
}
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a, .kopf-rechts a {
  padding: .4rem .75rem; border-radius: 8px; color: var(--text-2); font-weight: 600; font-size: .95rem;
}
.nav a:hover, .kopf-rechts a:hover { background: var(--flaeche-2); text-decoration: none; color: var(--text); }
.nav a.aktiv { background: var(--primaer-hell); color: var(--primaer-dunkel); }
.kopf-rechts { display: flex; align-items: center; gap: .5rem; }

.inhalt { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 1.5rem; }
.inhalt-breit { max-width: 1320px; }
.fuss { text-align: center; color: var(--text-3); font-size: .8rem; padding: 1.5rem; }
.seite-schlicht { justify-content: center; align-items: center; padding: 2rem 1rem; }
.seite-schlicht .karte { width: 100%; max-width: 760px; }

/* Karten, Raster, Kacheln */
.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--schatten);
}
.karte-schmal { max-width: 560px; }
.karte-hinweis { border-color: var(--gelb); background: var(--gelb-hell); }
.raster { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.raster-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.raster-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.raster-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.raster .karte { margin-bottom: 0; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.25rem; }
.kachel-wert { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.kachel-text { color: var(--text-2); font-size: .9rem; margin-top: .25rem; }
.kopfzeile { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.kopfzeile h1 { margin: 0; }

/* Meldungen und Pillen */
.meldung { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.meldung ul { margin: 0; padding-left: 1.2rem; }
.meldung-ok { background: var(--gruen-hell); border-color: var(--gruen); color: #155c33; }
.meldung-fehler { background: var(--rot-hell); border-color: var(--rot); color: #8a1f1f; }
.meldung-hinweis { background: var(--gelb-hell); border-color: var(--gelb); color: #6b4a0f; }
.pille { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pille-gruen { background: var(--gruen-hell); color: var(--gruen); }
.pille-gelb { background: var(--gelb-hell); color: var(--gelb); }
.pille-rot { background: var(--rot-hell); color: var(--rot); }
.pille-grau { background: var(--flaeche-2); color: var(--text-2); }
.pille-blau { background: var(--primaer-hell); color: var(--primaer-dunkel); }

/* Formulare */
.formular label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; }
.formular input:not([type=checkbox]), .formular select, .formular textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; font: inherit; font-weight: 400;
  border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); color: var(--text);
}
.formular input:focus, .formular select:focus, .formular textarea:focus { outline: 2px solid var(--primaer-hell); border-color: var(--primaer); }
.formular .zeile { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.kontrollkaestchen { display: flex !important; align-items: center; gap: .5rem; }
.knopfzeile { display: flex; gap: .5rem; align-items: center; }
.knopf {
  display: inline-block; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--linie);
  background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; line-height: 1.2;
}
.knopf:hover { background: var(--flaeche-2); text-decoration: none; }
.knopf-primaer { background: var(--primaer); border-color: var(--primaer); color: #fff; }
.knopf-primaer:hover { background: var(--primaer-dunkel); }
.knopf-leise { border-color: transparent; background: transparent; color: var(--text-2); }
.knopf-klein { padding: .25rem .6rem; font-size: .82rem; }
.knopf-breit { width: 100%; }
.knopf-gross { padding: .75rem 1.4rem; font-size: 1.05rem; }
.knopf[disabled] { opacity: .5; cursor: default; }

/* Tabellen und Listen */
.tabelle { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabelle th, .tabelle td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--linie); vertical-align: middle; }
.tabelle th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); }
.tabelle-klein { font-size: .85rem; }
.tabelle .aktionen { white-space: nowrap; text-align: right; }
.tabelle .aktionen form { margin-left: .25rem; }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; }
.zeile-inaktiv { opacity: .55; }
.liste-dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.liste-dl dt { color: var(--text-2); font-size: .9rem; }
.liste-dl dd { margin: 0; }
.liste-pruefung { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .25rem; }
.liste-pruefung li::before { content: "✓ "; color: var(--gruen); font-weight: 700; }
.liste-pruefung li.fehler::before { content: "✗ "; color: var(--rot); }

/* Ampel und Fortschrittsbalken */
.ampel { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; background: var(--linie); vertical-align: middle; }
.ampel-gruen { background: var(--gruen); }
.ampel-gelb { background: var(--gelb); }
.ampel-rot { background: var(--rot); }
.balken { height: 8px; background: var(--flaeche-2); border-radius: 999px; overflow: hidden; }
.balken > span { display: block; height: 100%; background: var(--primaer); border-radius: 999px; }

/* Lektionsliste */
.abschnitt { margin-bottom: 1.5rem; }
.abschnitt-kopf { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .5rem; }
.abschnitt-kopf h2 { margin: 0; }
.lektionen { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; }
.lektion {
  display: block; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: .9rem 1rem; color: var(--text); position: relative;
}
.lektion:hover { text-decoration: none; border-color: var(--primaer); }
.lektion-nummer { font-size: .75rem; color: var(--text-3); font-weight: 600; letter-spacing: .04em; }
.lektion-titel { font-weight: 700; margin: .15rem 0 .3rem; }
.lektion-tasten { font-family: var(--mono); color: var(--text-2); font-size: .9rem; }
.lektion-status { position: absolute; top: .8rem; right: .8rem; }
.lektion.bestanden { border-color: var(--gruen); }
.lektion.naechste { border-color: var(--primaer); box-shadow: 0 0 0 3px var(--primaer-hell); }
.uebungsliste { list-style: none; padding: 0; margin: 0; }
.uebungsliste li { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--linie); }
.uebungsliste li:last-child { border-bottom: 0; }
.uebungsliste .uebung-typ { font-size: .78rem; color: var(--text-2); min-width: 9rem; }
.uebungsliste .uebung-titel { flex: 1; font-weight: 600; }
.uebungsliste .uebung-ergebnis { font-size: .85rem; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Übung */
.uebung-kopf { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.uebung-kopf h1 { margin: 0; font-size: 1.3rem; }
.uebung-werte { display: flex; gap: 1.5rem; font-variant-numeric: tabular-nums; }
.uebung-werte div { text-align: center; }
.uebung-werte b { display: block; font-size: 1.3rem; line-height: 1.1; }
.uebung-werte span { font-size: .75rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }

.tippfeld {
  position: relative; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1.5rem 1.75rem; font-family: var(--mono); font-size: 1.45rem; line-height: 2.1; cursor: text;
  min-height: 7.5rem; max-height: 18rem; overflow-y: auto; user-select: none;
}
.tippfeld.fokus { border-color: var(--primaer); box-shadow: 0 0 0 3px var(--primaer-hell); }
.tippfeld .z { white-space: pre-wrap; border-radius: 3px; }
.tippfeld .z.ok { color: var(--text-3); }
.tippfeld .z.fehler { color: var(--rot); background: var(--rot-hell); text-decoration: underline; }
.tippfeld .z.korrigiert { color: var(--gelb); }
.tippfeld .z.aktuell { background: var(--primaer-hell); outline: 2px solid var(--primaer); }
.tippfeld .z.leer.fehler::before { content: "␣"; }
.tippfeld .hinweis-start {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.85);
  font-family: var(--schrift); font-size: 1rem; color: var(--text-2); border-radius: var(--radius);
}
.tippfeld.laeuft .hinweis-start { display: none; }
.tippfeld textarea {
  position: absolute; opacity: 0; width: 1px; height: 1px; top: 0; left: 0; resize: none; pointer-events: none;
}
.tippfeld.versteckt .z:not(.aktuell):not(.ok):not(.fehler):not(.korrigiert) { color: transparent; text-shadow: 0 0 0 transparent; }
.tippfeld.diktat-zeigt .z { color: var(--text) !important; }

/* Tastatur */
.tastatur { margin: 1rem 0; user-select: none; }
.tastatur-reihe { display: flex; gap: 4px; margin-bottom: 4px; }
.taste {
  flex: 1 0 0; height: 2.6rem; display: grid; place-items: center; border-radius: 6px;
  background: var(--flaeche); border: 1px solid var(--linie); border-bottom-width: 3px;
  font-family: var(--mono); font-size: .9rem; color: var(--text-2);
}
.taste[data-breite="1.5"] { flex-grow: 1.5; }
.taste[data-breite="2"] { flex-grow: 2; }
.taste[data-breite="2.5"] { flex-grow: 2.5; }
.taste[data-breite="7"] { flex-grow: 7; }
.taste small { font-size: .65rem; }
.taste.f-l5, .taste.f-r5 { background: var(--finger-l5); }
.taste.f-l4, .taste.f-r4 { background: var(--finger-l4); }
.taste.f-l3, .taste.f-r3 { background: var(--finger-l3); }
.taste.f-l2 { background: var(--finger-l2); }
.taste.f-r2 { background: var(--finger-r2); }
.taste.f-d { background: var(--finger-d); }
.tastatur.ohne-farben .taste { background: var(--flaeche); }
.taste.naechste { outline: 3px solid var(--primaer); outline-offset: -1px; color: var(--text); font-weight: 700; transform: translateY(1px); }
.taste.grundposition::after { content: ""; position: absolute; }
.taste.grund { box-shadow: inset 0 -5px 0 -3px rgba(0,0,0,.25); }
.uebung-optionen { display: flex; gap: 1.25rem; font-size: .85rem; color: var(--text-2); flex-wrap: wrap; }
.uebung-optionen label { display: flex; gap: .35rem; align-items: center; cursor: pointer; }

/* Ergebnis */
.ergebnis { display: none; }
.ergebnis.sichtbar { display: block; }
.ergebnis-werte { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1rem 0; }
.ergebnis-werte .kachel { text-align: center; }
.ergebnis-bestanden { font-size: 1.2rem; font-weight: 700; }
.ergebnis-bestanden.ja { color: var(--gruen); }
.ergebnis-bestanden.nein { color: var(--gelb); }
.tasten-fehler { display: flex; flex-wrap: wrap; gap: .4rem; }
.tasten-fehler span { font-family: var(--mono); background: var(--rot-hell); color: var(--rot); padding: .15rem .5rem; border-radius: 6px; }

/* Diagramm */
.diagramm { width: 100%; height: auto; }
.diagramm .achse { stroke: var(--linie); }
.diagramm .linie { fill: none; stroke: var(--primaer); stroke-width: 2; }
.diagramm .punkt { fill: var(--primaer); }
.diagramm text { font-family: var(--schrift); font-size: 11px; fill: var(--text-2); }

/* Schwache Tasten */
.tasten-liste { display: flex; flex-wrap: wrap; gap: .5rem; }
.tasten-liste .taste-chip {
  display: inline-flex; flex-direction: column; align-items: center; min-width: 3.2rem; padding: .4rem .5rem;
  border-radius: 8px; background: var(--flaeche-2);
}
.tasten-liste .taste-chip b { font-family: var(--mono); font-size: 1.2rem; }
.tasten-liste .taste-chip small { color: var(--text-2); font-size: .72rem; }

@media (max-width: 720px) {
  .kopf { flex-wrap: wrap; gap: .5rem; padding: .6rem 1rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .inhalt { padding: 1rem; }
  .formular .zeile { grid-template-columns: 1fr; }
  .tastatur { display: none; }
  .tippfeld { font-size: 1.15rem; }
  .uebung-werte { gap: .8rem; }
}
@media print {
  .kopf, .fuss, .knopf, .nav { display: none !important; }
  body { background: #fff; }
  .karte { box-shadow: none; }
}
