/* Trainer — Üben, eine Aufgabe pro Bildschirm.
   CI-Book Kap. 7: Handy zuerst, Touch-Ziele ab 48 px, Bodenbedienung mit einer Hand,
   Fortschritt oben schmal, keine Seitenleisten. Farben ausschließlich aus den Token. */

/* --- Quiz-Auswahl ---------------------------------------------------------- */

.uebe-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.uebekarte {
  display: flex;
  align-items: center;
  gap: 18px;
}

.uebekarte-text {
  flex: 1 1 auto;
  min-width: 0;
}

.uebekarte h2 {
  margin: 0 0 2px;
  font-size: 1.25rem;
}

.uebekarte .knopfreihe {
  margin-top: 10px;
}

/* Fortschrittsring: ein Kreis, kein Diagramm — die Zahl steht daneben im Text. */

.ring {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  transform: rotate(-90deg);
}

.ring-bahn {
  fill: none;
  stroke: var(--rk-linie);
  stroke-width: 7;
}

.ring-anteil {
  fill: none;
  stroke: var(--rk-petrol);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dasharray 0.4s ease-out;
}

.ring-fertig .ring-anteil {
  stroke: var(--rk-richtig);
}

.ring-zahl {
  transform: rotate(90deg);
  transform-origin: 50% 50%;
  fill: var(--rk-tinte);
  font-family: var(--rk-font-display);
  font-size: 20px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

/* --- Übungsschirm ---------------------------------------------------------- */

.uebung {
  max-width: 560px;
  margin: 0 auto;
}

/* Fortschritt oben schmal — ein Balken, keine Statistik. */
.uebung-leiste {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--rk-tinte-sanft);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 4px 0 8px;
}

.uebung-balken {
  height: 6px;
  border-radius: 3px;
  background: var(--rk-linie);
  overflow: hidden;
}

.uebung-balken span {
  display: block;
  height: 100%;
  background: var(--rk-petrol);
  transition: width 0.3s ease-out;
}

.aufgabe {
  text-align: center;
  padding: 28px 24px 24px;
}

.aufgabe-quelle {
  color: var(--rk-tinte-sanft);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.aufgabe-text {
  font-family: var(--rk-font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.aufgabe-ziel {
  color: var(--rk-tinte-sanft);
  font-size: 0.95rem;
  margin: 0 0 20px;
}

.antwortfeld {
  width: 100%;
  min-height: 60px;
  padding: 14px 16px;
  text-align: center;
  font-family: var(--rk-font-text);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rk-tinte);
  background: var(--rk-flaeche);
  border: 2.5px solid var(--rk-linie);
  border-radius: var(--rk-radius-klein);
}

.antwortfeld:focus {
  outline: 3px solid var(--rk-petrol);
  outline-offset: 1px;
  border-color: var(--rk-petrol);
}

/* Bodenbedienung: die Knöpfe liegen unten und sind mit einer Hand erreichbar. */
.uebung-knoepfe {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-weissnicht {
  background: transparent;
  color: var(--rk-tinte-sanft);
  box-shadow: inset 0 0 0 2.5px var(--rk-linie);
  min-height: 52px;
  width: 100%;
  border: none;
  border-radius: var(--rk-radius-klein);
  font-family: var(--rk-font-text);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

/* --- Rückmeldung ----------------------------------------------------------- */

.ergebnis {
  border-radius: var(--rk-radius);
  padding: 22px 24px;
  text-align: center;
  margin-top: 4px;
}

.ergebnis:focus-visible {
  outline: 3px solid var(--rk-petrol);
  outline-offset: 2px;
}

.ergebnis-wort {
  font-family: var(--rk-font-display);
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 6px;
}

.ergebnis-getippt {
  color: var(--rk-tinte-sanft);
  font-size: 0.95rem;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

/* Bei „fast richtig" und „falsch" steht die Soll-Antwort groß da — erst die
   richtige Antwort, dann weiter (CI-Book Kap. 6). */
.ergebnis-soll {
  font-family: var(--rk-font-display);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--rk-tinte);
  margin: 0;
  overflow-wrap: anywhere;
}

.ergebnis-richtig {
  background: var(--rk-richtig-fond);
}

.ergebnis-richtig .ergebnis-wort {
  color: var(--rk-richtig);
}

.ergebnis-fast {
  background: var(--rk-fast-fond);
}

.ergebnis-fast .ergebnis-wort {
  color: var(--rk-fast);
}

.ergebnis-falsch {
  background: var(--rk-falsch-fond);
}

.ergebnis-falsch .ergebnis-wort {
  color: var(--rk-falsch);
}

.ergebnis-weissnicht {
  background: var(--rk-neutral-fond);
}

.ergebnis-weissnicht .ergebnis-wort {
  color: var(--rk-neutral);
}

/* Stern-Moment: dosiert. Ein Stern, ein kurzer Hüpfer, kein Konfetti. */
.stern-moment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-weight: 800;
  color: var(--rk-tinte);
}

.stern-moment .stern {
  width: 26px;
  height: 26px;
  color: var(--rk-stern);
  animation: stern-huepfer 0.5s ease-out;
}

@keyframes stern-huepfer {
  0% { transform: scale(0.4) translateY(6px); opacity: 0; }
  60% { transform: scale(1.15) translateY(-3px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .stern-moment .stern {
    animation: none;
  }
}

/* --- Rundenende ------------------------------------------------------------ */

/* Die Ueberschrift bekommt am Rundenende den Fokus, damit Vorlesehilfen dort neu
   ansetzen. Sie ist aber nichts zum Anklicken — also kein Fokusrahmen. */
.karte h1[tabindex="-1"]:focus {
  outline: none;
}

.bilanz {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin: 16px 0 4px;
}

.bilanz-feld {
  border-radius: var(--rk-radius-klein);
  padding: 12px 8px;
  text-align: center;
}

.bilanz-zahl {
  display: block;
  font-family: var(--rk-font-display);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}

.bilanz-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.bilanz-richtig { background: var(--rk-richtig-fond); color: var(--rk-richtig); }
.bilanz-fast { background: var(--rk-fast-fond); color: var(--rk-fast); }
.bilanz-falsch { background: var(--rk-falsch-fond); color: var(--rk-falsch); }
.bilanz-weissnicht { background: var(--rk-neutral-fond); color: var(--rk-neutral); }

/* --- Sync-Anzeige ---------------------------------------------------------- */

.syncstand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rk-tinte-sanft);
}

.syncstand-punkt {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rk-neutral);
  flex: 0 0 auto;
}

.syncstand-gesichert .syncstand-punkt { background: var(--rk-richtig); }
.syncstand-wartet .syncstand-punkt { background: var(--rk-fast); }
.syncstand-laeuft .syncstand-punkt { background: var(--rk-petrol); }
.syncstand-fehler .syncstand-punkt { background: var(--rk-falsch); }
.syncstand-fehler { color: var(--rk-falsch); }

.hinweis-wlan {
  background: var(--rk-fast-fond);
  border-radius: var(--rk-radius);
  padding: 16px 20px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.hinweis-wlan p {
  margin: 0;
}

/* --- Elternsicht ----------------------------------------------------------- */

.fortschrittszeile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rk-linie);
  min-height: 48px;
}

.fortschrittszeile:last-child {
  border-bottom: none;
}

.fortschrittszeile .titel {
  flex: 1 1 auto;
  font-weight: 700;
  min-width: 0;
}

.fortschrittszeile .sitzt {
  font-family: var(--rk-font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--rk-petrol);
  white-space: nowrap;
}

/* --- Kopfzeile am Handy ------------------------------------------------------
   Mit dem Trainer bekommt die Navigation einen zweiten Eintrag; bei 390 px lief die
   Kopfzeile dadurch aus dem Bild und die ganze Seite liess sich seitwaerts schieben.
   Sie darf umbrechen, das Logo wird kleiner — Ruhe statt Querscrollen (CI-Book Kap. 7). */

@media (max-width: 620px) {
  .app-header {
    padding: 12px 16px;
  }

  .app-header .wrap {
    flex-wrap: wrap;
    gap: 10px;
  }

  .app-header .logo {
    height: 34px;
  }

  .app-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 22px;
  }

  .app-main {
    padding: 20px 16px 56px;
  }

  .aufgabe {
    padding: 24px 18px 20px;
  }

  .aufgabe-text {
    font-size: 1.75rem;
  }
}

@media (min-width: 620px) {
  .uebung-knoepfe {
    flex-direction: row-reverse;
    justify-content: center;
  }

  .uebung-knoepfe .btn-gross {
    width: auto;
    min-width: 220px;
  }

  .uebung-knoepfe .btn-weissnicht {
    width: auto;
    min-width: 160px;
  }
}
