/* Klartext mobil: dasselbe Schulheft wie auf dem Mac. Königsblaue Tinte, Rotstift nur für Korrekturen und Aufnahme. */
@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-grotesque-latin-ext-standard-normal.woff2") format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0;
}

:root {
  --papier: #F4F6FA;
  --blatt: #FFFFFF;
  --tinte: #101A3A;
  --tinte-2: #4D5879;
  --blau: #1F3FD0;
  --blau-hell: #E6EBFC;
  --rot: #D7263D;
  --rot-hell: #FBE4E7;
  --linie: #D3DAEA;
  --gruen: #1D7F4E;
  --display: "Bricolage", -apple-system, "SF Pro Display", system-ui, sans-serif;
  --text: -apple-system, "SF Pro Text", system-ui, sans-serif;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papier: #0D1226;
    --blatt: #141A34;
    --tinte: #E9EDFA;
    --tinte-2: #9CA7CA;
    --blau: #8AA2FF;
    --blau-hell: #1D2752;
    --rot: #FF6B7D;
    --rot-hell: #3A1A26;
    --linie: #2A345C;
    --gruen: #6FD9A0;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--papier); color: var(--tinte);
  font: 400 16px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.app {
  min-height: 100dvh;
  padding: calc(var(--oben) + 18px) 18px calc(var(--unten) + 96px);
  max-width: 640px; margin: 0 auto;
}
.app.ohne-tabs { padding-bottom: calc(var(--unten) + 32px); }

.marke {
  font: 750 22px/1 var(--display); font-stretch: 80%; letter-spacing: -.01em;
  color: var(--blau); margin: 2px 0 22px;
  padding-left: 12px; border-left: 2px solid var(--rot);
}

h1 { font: 650 31px/1.08 var(--display); font-stretch: 84%; letter-spacing: -.015em; margin: 0 0 8px; text-wrap: balance; }
h2 { font: 650 16px/1.3 var(--text); margin: 30px 0 10px; }
p { margin: 0 0 12px; }
.vorspann { color: var(--tinte-2); margin-bottom: 20px; }
.leise { color: var(--tinte-2); font-size: 14px; }
.klein { font-size: 13px; }

/* Knöpfe */
button { font: inherit; color: inherit; }
.knopf {
  appearance: none; border: 1.5px solid var(--blau); background: var(--blau); color: #fff;
  font: 600 16px/1 var(--text); padding: 14px 18px; border-radius: 12px; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
@media (prefers-color-scheme: dark) { .knopf { color: #0D1226; } }
.knopf.zweit { background: transparent; color: var(--blau); }
.knopf.rot { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.rot-rand { background: transparent; border-color: var(--rot); color: var(--rot); }
.knopf.breit { width: 100%; }
.knopf:disabled { opacity: .45; }
.knopf:active { transform: scale(.98); }
.schlicht {
  appearance: none; border: 0; background: none; color: var(--blau);
  font: 500 15px/1 var(--text); padding: 10px 8px; border-radius: 8px; min-height: 40px;
}
.schlicht.rot { color: var(--rot); }
.reihe { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.reihe > .knopf { flex: 1 1 auto; }
:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }

input[type="text"], input[type="password"], textarea, select {
  font: 400 16px/1.35 var(--text); color: var(--tinte);
  background: var(--blatt); border: 1.5px solid var(--linie); border-radius: 10px;
  padding: 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blau); }
textarea { resize: vertical; min-height: 80px; }
label.feld { display: block; margin: 0 0 14px; }
label.feld > span { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }

/* Aufnahmeknopf: die Tonspur aus dem App-Symbol */
.mikro {
  display: grid; place-items: center; gap: 14px; margin: 10px 0 8px; text-align: center;
}
.mikro button {
  appearance: none; border: 0; cursor: pointer;
  width: 168px; height: 168px; border-radius: 50%;
  background: var(--blau); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 28px rgba(31, 63, 208, .28);
  transition: background .18s, box-shadow .18s, transform .1s;
}
.mikro button:active { transform: scale(.97); }
.mikro .wellen { display: flex; align-items: center; gap: 7px; height: 64px; }
.mikro .wellen i { display: block; width: 10px; border-radius: 6px; background: currentColor; transition: height .08s linear; }
.mikro.laeuft button { background: var(--rot); box-shadow: 0 0 0 10px var(--rot-hell), 0 10px 28px rgba(215, 38, 61, .3); }
.mikro .zeit { font: 600 17px/1 var(--text); font-variant-numeric: tabular-nums; color: var(--tinte-2); min-height: 20px; }
.mikro .unter { color: var(--tinte-2); font-size: 15px; max-width: 30ch; }

.arbeitet { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--linie); border-top-color: var(--blau); animation: dreh .7s linear infinite; vertical-align: -3px; }
@keyframes dreh { to { transform: rotate(360deg); } }

/* Ergebnis wie eine Heftseite */
.blatt {
  background: var(--blatt); border: 1px solid var(--linie); border-radius: 14px;
  padding: 16px 16px 14px 22px; margin: 18px 0; position: relative;
}
.blatt::before { content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px; width: 1.5px; background: var(--rot); opacity: .7; }
.blatt .text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; line-height: 1.55; }
.blatt .meta { color: var(--tinte-2); font-size: 13px; margin-bottom: 6px; }
.blatt .reihe { margin-top: 12px; }

.korrektur { font-size: 15px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 10px; }
.korrektur del { color: var(--rot); text-decoration-thickness: 1.5px; }
.korrektur ins { color: var(--blau); text-decoration: none; font-weight: 500; }

.wartet { border-left: 2px solid var(--rot); padding: 4px 0 4px 14px; margin: 18px 0; }
.wartet p { margin-bottom: 10px; }

/* Listen */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { border-top: 1px solid var(--linie); }
.liste > li:last-child { border-bottom: 1px solid var(--linie); }
.zeile {
  appearance: none; border: 0; background: none; width: 100%; text-align: left; color: inherit;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 0; font: inherit;
}
.zeile .name { font-weight: 600; }
.zeile .rechts { color: var(--tinte-2); font-variant-numeric: tabular-nums; }
.zeile .unter { grid-column: 1 / -1; color: var(--tinte-2); font-size: 13.5px; }
.eintrag { padding: 14px 0; }
.eintrag .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.eintrag .meta { color: var(--tinte-2); font-size: 13px; margin-bottom: 4px; }
.leer { color: var(--tinte-2); padding: 22px 0; border-top: 1px solid var(--linie); }

.wortliste li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; }
.wortliste .wort { font-weight: 600; }
.wortliste .neben { color: var(--tinte-2); font-size: 14px; flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Gespräch läuft */
.live { display: flex; align-items: center; gap: 9px; color: var(--tinte-2); font-variant-numeric: tabular-nums; margin: 4px 0 18px; }
.punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--rot); flex: none; animation: puls 1.4s ease-in-out infinite; }
@keyframes puls { 50% { opacity: .3; } }
.mitschrift { display: grid; grid-template-columns: 52px 1fr; gap: 10px 6px; font-size: 15px; line-height: 1.55; }
.mitschrift .zt { color: var(--tinte-2); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.mitschrift .fehlt { color: var(--rot); }
.zusammenfassung h3 { font: 650 15px/1.3 var(--text); margin: 16px 0 4px; }
.zusammenfassung h3:first-child { margin-top: 0; }
.zusammenfassung p { margin: 0 0 8px; }
.zusammenfassung ul { margin: 0 0 8px; padding-left: 20px; }
.zusammenfassung li { margin: 3px 0; }
.kopfzeile { display: flex; align-items: baseline; gap: 8px; margin: 28px 0 8px; }
.kopfzeile h2 { margin: 0; }
.kopfzeile .schlicht { margin-left: auto; padding-right: 0; }
audio { width: 100%; margin: 6px 0; }

/* Aufgaben zum Abhaken */
.aufgaben { list-style: none; margin: 0; padding: 0; }
.aufgaben li { display: flex; align-items: flex-start; gap: 4px; border-top: 1px solid var(--linie); }
.aufgaben li:last-child { border-bottom: 1px solid var(--linie); }
.haken { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; cursor: pointer; position: relative; }
.haken input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.kasten {
  flex: none; width: 26px; height: 26px; margin-top: -1px; border-radius: 8px;
  border: 2px solid var(--blau); background: var(--blatt); display: grid; place-items: center;
  transition: background .12s;
}
.kasten::after {
  content: ""; width: 7px; height: 13px; margin-top: -3px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); opacity: 0;
}
@media (prefers-color-scheme: dark) { .kasten::after { border-color: #0D1226; } }
.haken input:checked + .kasten { background: var(--blau); }
.haken input:checked + .kasten::after { opacity: 1; }
.haken input:focus-visible + .kasten { outline: 2px solid var(--blau); outline-offset: 2px; }
.aufgabe { display: grid; gap: 2px; min-width: 0; }
.aufgabe .was { font-size: 16.5px; line-height: 1.4; overflow-wrap: anywhere; }
.aufgabe .wer { color: var(--tinte-2); font-size: 13.5px; }
.aufgaben li.erledigt .was { color: var(--tinte-2); text-decoration: line-through; text-decoration-color: var(--rot); }
.weg {
  appearance: none; border: 0; background: none; color: var(--tinte-2);
  font: 400 22px/1 var(--text); width: 40px; height: 44px; margin-top: 4px; border-radius: 8px; flex: none;
}
.gruppe {
  appearance: none; border: 0; background: none; color: inherit; text-align: left; width: 100%;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 0; margin: 26px 0 6px; font: inherit;
}
.gruppe .name { font-weight: 650; color: var(--blau); }
.gruppe .leise { flex: none; }
.zurueck { margin: -6px 0 6px -8px; }

/* Tab-Leiste */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 2px;
  background: color-mix(in srgb, var(--papier) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--linie);
  padding: 6px 6px calc(var(--unten) + 6px);
}
.tabs[hidden] { display: none; }
.tabs button {
  appearance: none; border: 0; background: none; color: var(--tinte-2);
  font: 600 12px/1.2 var(--text); padding: 10px 7px; border-radius: 10px; min-height: 44px;
}
.tabs button[aria-current="page"] { color: var(--blau); background: var(--blau-hell); }

.hinweis {
  position: fixed; left: 50%; bottom: calc(var(--unten) + 84px); transform: translate(-50%, 16px);
  background: var(--tinte); color: var(--papier); font-weight: 500; font-size: 15px;
  padding: 11px 16px; border-radius: 12px; opacity: 0; pointer-events: none; z-index: 20;
  transition: opacity .15s, transform .15s; max-width: calc(100vw - 32px); text-align: center;
}
.hinweis.da { opacity: 1; transform: translate(-50%, 0); }

.schalter-zeile { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--linie); }
.schalter-zeile:last-of-type { border-bottom: 1px solid var(--linie); }
.schalter { position: relative; width: 51px; height: 31px; flex: none; }
.schalter input { position: absolute; inset: 0; opacity: 0; margin: 0; }
.schalter span { position: absolute; inset: 0; border-radius: 16px; background: var(--linie); transition: background .15s; pointer-events: none; }
.schalter span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.schalter input:checked + span { background: var(--blau); }
.schalter input:checked + span::after { transform: translateX(20px); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
