/* Sprachtrainer 3.0 — Oberfläche
   Gestaltung aus Claude Design, ergänzt um die Regeln, die der Betrieb braucht:
   .hidden, Fokusringe, deaktivierte Schalter und die Rücksicht auf
   prefers-reduced-motion. Keine externen Schriften, keine externen Skripte. */

:root {
  --paper: #f9f8f5;
  --paper: oklch(98% 0.004 90);
  --surface: #ffffff;
  --surface: oklch(100% 0 0);
  --surface-in: #f0eee9;
  --surface-in: oklch(95% 0.008 90);
  --ink: #0f130f;
  --ink: oklch(18% 0.01 150);
  --ink-soft: #5d665f;
  --ink-soft: oklch(50% 0.015 150);
  --rule: #ecebe7;
  --rule: oklch(94% 0.005 90);
  --focus: #095c34;
  --focus: oklch(42% 0.1 155);
  --focus-on: #f4faf6;
  --focus-on: oklch(98% 0.008 155);
  --live: #b32228;
  --live: oklch(50% 0.18 25);
  --live-on: #fef6f6;
  --live-on: oklch(98% 0.008 25);
  --amber: #905d00;
  --amber: oklch(52% 0.12 75);
  --akzent: #da720d;
  --akzent: oklch(66% 0.16 55);
  --error-bg: #ffe3df;
  --error-bg: oklch(94% 0.035 25);
  --error-text: #19221a;
  --error-text: oklch(24% 0.02 150);
  --dark-surface: #111812;
  --dark-surface: oklch(20% 0.015 150);
  --dark-ink: #eff3f0;
  --dark-ink: oklch(96% 0.005 150);
  --dark-ink-soft: #9aa09b;
  --dark-ink-soft: oklch(70% 0.01 150);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Noto Serif", serif;

  --radius-card: 22px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.06);
  --shadow-card: 0 1px 2px oklch(0% 0 0 / 0.04), 0 12px 32px oklch(0% 0 0 / 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--focus); }
a:hover { color: #00461f; }
a:hover { color: oklch(34% 0.1 155); }

/* Das JavaScript blendet ueber diese Klasse ein und aus. Ohne sie steht
   die ganze App gleichzeitig auf dem Bildschirm. */
.hidden { display: none !important; }
[hidden] { display: none !important; }

@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(207, 64, 64, 0.35); }
  0%, 100% { box-shadow: 0 0 0 0 oklch(58% 0.18 25 / 0.35); }
  50%      { box-shadow: 0 0 0 14px rgba(207, 64, 64, 0); }
  50%      { box-shadow: 0 0 0 14px oklch(58% 0.18 25 / 0); }
}

.wrap { max-width: 34rem; margin: 0 auto; padding: 1.5rem 1.1rem 5rem; }

h1 { font-family: var(--sans); font-size: 1.85rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 0.6rem; color: var(--ink); }

.question { font-family: var(--serif); font-size: 1.5rem; font-weight: 400; line-height: 1.4; margin: 0 0 0.7rem; color: var(--ink); }

.qualifikation { margin: 0 0 1.2rem; font-size: 0.9rem; font-weight: 600; color: var(--akzent); }

.lead { color: var(--ink-soft); margin: 0 0 1.5rem; line-height: 1.55; }
.note { color: var(--ink-soft); font-size: 0.85rem; margin: 1rem 0 0; line-height: 1.5; }
.meta { color: var(--ink-soft); font-size: 0.82rem; font-weight: 600; }

#hint { margin: -0.3rem 0 1.2rem; }

.panel { background: var(--surface); border-radius: var(--radius-card); padding: 1.6rem 1.4rem; box-shadow: var(--shadow-card); }
.settings-panel { margin-top: 0.7rem; }

/* ================================================================== Logo */

.logo { display: block; width: 100%; max-width: 13rem; height: auto; margin: 0 0 1.7rem; }
.logo-small { max-width: 8rem; margin-bottom: 1.3rem; opacity: 0.8; }

/* ============================================================= Anmeldung */

.login-panel { padding: 0; overflow: hidden; }
.login-hero { width: 100%; height: 190px; position: relative; background: var(--surface-in); }
.login-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-hero__scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17, 24, 18, 0) 50%, rgba(17, 24, 18, 0.55) 100%); pointer-events: none; }
.login-hero__scrim { position: absolute; inset: 0; background: linear-gradient(180deg, oklch(20% 0.015 150 / 0) 50%, oklch(20% 0.015 150 / 0.55) 100%); pointer-events: none; }
.login-content { padding: 1.5rem 1.4rem 1.7rem; }

/* =================================================== Bereichsuebersicht */

.topic {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 0; border-radius: 20px;
  padding: 1.15rem 1.25rem; margin-bottom: 0.7rem; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 20px rgba(0, 0, 0, 0.05);
  box-shadow: 0 1px 2px oklch(0% 0 0 / 0.03), 0 8px 20px oklch(0% 0 0 / 0.05);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.topic:last-child { margin-bottom: 0; }
.topic:hover { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 12px 28px rgba(0, 0, 0, 0.09); }
.topic:hover { box-shadow: 0 2px 4px oklch(0% 0 0 / 0.05), 0 12px 28px oklch(0% 0 0 / 0.09); }
.topic:active { transform: scale(0.995); }

.topic-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; }
.topic-title { font-family: var(--sans); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.topic-meta { color: var(--ink-soft); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.topic-bar { display: block; height: 6px; border-radius: var(--radius-pill); background: #e9e8e3; margin-top: 0.9rem; overflow: hidden; }
.topic-bar { display: block; height: 6px; border-radius: var(--radius-pill); background: oklch(93% 0.006 90); margin-top: 0.9rem; overflow: hidden; }
.topic-bar > span { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--focus); }

.crumb { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink); font-size: 0.92rem; font-weight: 600; cursor: pointer; }
.crumb span { color: var(--ink-soft); }
.crumb:hover { color: var(--focus); }

/* ============================================================= Kopfzeile */

.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }

.ticks { display: flex; gap: 4px; margin-bottom: 1.5rem; }
.tick { flex: 1 1 0; height: 7px; border-radius: var(--radius-pill); background: #e9e8e3; transition: background 0.18s ease; }
.tick { flex: 1 1 0; height: 7px; border-radius: var(--radius-pill); background: oklch(93% 0.006 90); transition: background 0.18s ease; }
.tick[data-state="current"]              { background: var(--akzent); }
.tick[data-state="vollstaendig_richtig"] { background: var(--focus); }
.tick[data-state="richtig_unvollstaendig"],
.tick[data-state="teilweise_richtig"]    { background: var(--amber); }
.tick[data-state="falsch"]               { background: var(--live); }
.tick[data-state="aufgeloest"]           { background: var(--ink-soft); }

/* =============================================================== Buttons */

button { font: inherit; font-weight: 700; border: 0; border-radius: var(--radius-pill); padding: 0.85rem 1.1rem; min-height: 48px; cursor: pointer; color: var(--ink); background: var(--surface-in); }
button.primary { background: var(--focus); color: var(--focus-on); width: 100%; font-size: 1.02rem; }
button.live    { background: var(--live);  color: var(--live-on);  width: 100%; font-size: 1.02rem; }
button.quiet   { background: var(--surface-in); font-size: 0.95rem; }
button.link    { background: none; padding: 0.4rem 0; min-height: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; font-size: 0.88rem; width: auto; }

button:disabled { opacity: 0.45; cursor: not-allowed; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.7rem; }
.row > button { flex: 1 1 auto; }
.row--links { justify-content: center; gap: 1.2rem; margin-top: 1rem; }
.row--links > button { flex: 0 0 auto; }
.row--center { justify-content: center; margin-top: 0.5rem; }
.row--center > button { flex: 0 0 auto; }

details { margin-top: 1.1rem; text-align: center; }
summary { cursor: pointer; color: var(--focus); font-size: 0.92rem; font-weight: 600; padding: 0.3rem 0; }
details textarea, details .row { text-align: left; }

/* ============================================== Aufnahme (Signature) */

/* Waehrend der Aufnahme wird die ganze Karte dunkel. Der Moment, in dem
   die App zuhoert, soll sich vom Rest unterscheiden. */
.panel.is-recording { background: var(--dark-surface); box-shadow: 0 20px 44px rgba(0, 0, 0, 0.28); }
.panel.is-recording { background: var(--dark-surface); box-shadow: 0 20px 44px oklch(0% 0 0 / 0.28); }
.panel.is-recording .question { color: var(--dark-ink); font-size: 1.35rem; margin-bottom: 1.5rem; }
.panel.is-recording .meta { color: var(--dark-ink-soft); }
.panel.is-recording .transcript { background: #1f2620; }
.panel.is-recording .transcript { background: oklch(26% 0.015 150); }
.panel.is-recording .transcript strong,
.panel.is-recording .transcript p { color: var(--dark-ink); }

.recording-badge { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1.1rem; }
.recording-badge__dot { display: block; width: 10px; height: 10px; border-radius: 50%; background: #f05653; flex: none; animation: pulseDot 1.4s ease-in-out infinite; }
.recording-badge__dot { display: block; width: 10px; height: 10px; border-radius: 50%; background: oklch(66% 0.19 25); flex: none; animation: pulseDot 1.4s ease-in-out infinite; }
.recording-badge__label { font-size: 0.82rem; font-weight: 700; color: #f47b74; letter-spacing: 0.06em; text-transform: uppercase; }
.recording-badge__label { font-size: 0.82rem; font-weight: 700; color: oklch(72% 0.15 25); letter-spacing: 0.06em; text-transform: uppercase; }

.level-ring { width: 88px; height: 88px; border-radius: 50%; background: var(--live); display: flex; align-items: center; justify-content: center; margin: 0.4rem auto; animation: ringPulse 1.8s ease-in-out infinite; }
.level { display: flex; align-items: center; gap: 3px; height: 36px; }
.level span { width: 4px; border-radius: 2px; background: var(--dark-ink); opacity: 0.9; }

.recording-meta { display: flex; justify-content: space-between; color: var(--dark-ink); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 1.3rem 0 1.4rem; }
.recording-meta span:last-child { color: var(--dark-ink-soft); font-weight: 600; font-size: 0.88rem; }

.panel.is-recording button.primary { background: var(--dark-ink); color: var(--dark-surface); }
.panel.is-recording button.quiet { background: transparent; box-shadow: inset 0 0 0 1px #444945; color: var(--dark-ink); }
.panel.is-recording button.quiet { background: transparent; box-shadow: inset 0 0 0 1px oklch(40% 0.01 150); color: var(--dark-ink); }

/* Die Rueckfrage sitzt auf hellem Grund, dort bleibt die Aufnahme hell. */
.followup .recording-meta { color: var(--ink); }
.followup .recording-meta span:last-child { color: var(--ink-soft); }
.followup .level span { background: var(--surface); }

/* ============================================================ Transkript */

.transcript { margin-top: 1.1rem; padding: 1rem 1.1rem; background: var(--surface-in); border-radius: 16px; }
.transcript strong { font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.transcript p { margin: 0.4rem 0 0; line-height: 1.5; }

/* ============================================================== Ergebnis */

.result { margin-top: 1.5rem; }

.verdict { font-family: var(--sans); font-size: 1.25rem; font-weight: 700; margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.55rem; color: var(--ink); }
.verdict-text { min-width: 0; }
.verdict-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; background: var(--rule); }
.result[data-result="vollstaendig_richtig"]   .verdict-dot { background: var(--focus); }
.result[data-result="richtig_unvollstaendig"] .verdict-dot,
.result[data-result="teilweise_richtig"]      .verdict-dot { background: var(--amber); }
.result[data-result="falsch"]                 .verdict-dot { background: var(--live); }
.result[data-result="aufgeloest"]             .verdict-dot { background: var(--ink-soft); }

.points { margin: 1.1rem 0 1.5rem; }
.points h3 { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); margin: 0 0 0.5rem; text-transform: uppercase; letter-spacing: 0.06em; }
.points ul { margin: 0; padding-left: 1.15rem; line-height: 1.7; }
.points p { margin: 0; line-height: 1.65; background: var(--surface-in); padding: 1rem 1.1rem; border-radius: 16px; }

.followup { margin-top: 1.4rem; padding: 1.2rem 1.25rem; background: var(--surface-in); border-radius: 18px; }
.followup .prompt { font-family: var(--serif); font-size: 1.05rem; margin: 0 0 1rem; color: var(--ink); }

/* ================================================================ Formen */

textarea, input[type="password"], input[type="text"] {
  width: 100%; font: inherit; font-size: 16px; padding: 0.9rem 1rem;
  border: 0; border-radius: 14px; background: var(--surface-in); color: var(--ink);
}
textarea { min-height: 7rem; resize: vertical; margin-top: 0.8rem; }
label { display: block; font-weight: 700; margin-bottom: 0.5rem; font-size: 0.92rem; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--rule); }
.switch:last-of-type { border-bottom: 0; }
.switch label { margin: 0; font-weight: 500; }
.switch input { width: 1.25rem; height: 1.25rem; accent-color: var(--focus); }

/* ================================================================ Status */

.status { margin-top: 1.1rem; font-size: 0.86rem; color: var(--ink-soft); }

.error { color: var(--error-text); font-size: 1.05rem; line-height: 1.4; font-weight: 700; }

/* Fehler im laufenden Betrieb erscheinen im Kartenfluss, nicht als
   eigene Seite. Dafuer eine ruhigere Variante. */
.error-inline {
  margin-top: 1.1rem;
  padding: 0.9rem 1.1rem;
  background: var(--error-bg);
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
}
.error-inline code { font-size: 0.8em; font-weight: 500; opacity: 0.7; }

/* ======================================================== Zusammenfassung */

.summary-bar { display: flex; height: 16px; border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 1.4rem; gap: 2px; }
.summary-bar__segment { display: block; }

.tally { margin: 0 0 1.5rem; }
.tally-row { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.tally-row:last-child { border-bottom: 0; }
.tally-label { display: flex; align-items: center; gap: 0.6rem; font-weight: 500; }
.tally-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tally-value { font-variant-numeric: tabular-nums; font-weight: 700; }

.footnote { margin-top: 2.6rem; color: var(--ink-soft); font-size: 0.78rem; line-height: 1.5; text-align: center; max-width: 26rem; margin-left: auto; margin-right: auto; }

/* ================================================================ Rücksicht */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
