:root {
  --bg: #0f172a; --card: #fff; --ink: #1e293b;
  --accent: #15803d; --line: #e2e8f0;
  --ok: #16a34a; --bad: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: system-ui, sans-serif;
  background: linear-gradient(160deg, #0f172a, #1e293b);
  color: var(--ink); padding: 24px 14px;
}
#app { max-width: 860px; margin: 0 auto; }
.card { background: var(--card); border-radius: 18px; padding: 28px 26px; margin-bottom: 16px; }

/* Prompt */
.prompt { font-size: 1.4rem; font-weight: 600; margin: 0 0 6px; }
.prompt-secondary { font-size: 1.15rem; color: #64748b; margin: 0 0 6px; }
.prompt-translit { font-size: .95rem; font-style: italic; color: #7c3aed; margin: 2px 0 0; }
.prompt-tones { font-size: .9rem; color: #b45309; letter-spacing: .15em; margin: 2px 0 0; }

/* RTL */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .prompt-translit { direction: ltr; text-align: left; }

/* Options */
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px 16px; border: 2px solid var(--line); border-radius: 13px;
  background: #fff; font: inherit; text-align: left; cursor: pointer;
  transition: .15s;
}
.opt:hover:not(.disabled) { border-color: var(--accent); background: #f0fdf4; }
.opt.correct { border-color: var(--ok); background: #dcfce7; }
.opt.wrong { border-color: var(--bad); background: #fee2e2; }
.opt-translit { display: block; font-size: .82rem; color: #7c3aed; margin-top: 4px; }

.feedback { margin-top: 16px; padding: 14px 16px; border-radius: 12px; display: none; }
.feedback.show { display: block; }
.feedback.ok { background: #dcfce7; color: #14532d; }
.feedback.no { background: #fee2e2; color: #7f1d1d; }

.btn { padding: 12px 24px; border-radius: 12px; border: none; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* ==========================================================================
   Politur (Option C)
   ========================================================================== */

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  cursor: pointer;
  transition: .15s;
}
.audio-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: #f0fdf4;
}
.audio-btn:active:not(:disabled) { transform: scale(0.97); }
.audio-btn:disabled { opacity: .5; cursor: not-allowed; }
.audio-btn.compact {
  padding: 6px 12px;
  font-size: 1.1rem;
  line-height: 1;
}

.audio-row { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

.quiz-meta {
  font-size: .85rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}
.prompt-block { margin-bottom: 22px; }
.actions { margin-top: 16px; }

.picker {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}
.picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .95rem;
  color: #475569;
}
.picker select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.picker select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

#themePicker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 18px;
  width: 100%;
}
.theme {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  transition: .15s;
}
.theme:hover {
  border-color: var(--accent);
  background: #f0fdf4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(21,128,61,.08);
}
.theme .emoji { font-size: 1.4rem; }
.theme .name { font-weight: 600; }

.hero h1 { margin: 0 0 4px; font-size: 1.8rem; }
.hero p { margin: 0; color: #64748b; }

.opt-tones {
  display: block;
  font-size: .85rem;
  color: #b45309;
  letter-spacing: .2em;
  margin-top: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.opt-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.opt-text { display: block; }
.opt-translit {
  display: block;
  font-size: .82rem;
  color: #7c3aed;
  margin-top: 2px;
}
.opt .key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.opt.correct .key { background: var(--ok); color: #fff; }
.opt.wrong .key   { background: var(--bad); color: #fff; }

/* Audio-Icon */
.audio-icon {
  display: inline-block;
  color: var(--accent);
  font-size: .9em;
  margin-right: 4px;
  transform: translateY(-1px);
}
.audio-btn.compact .audio-icon {
  font-size: 1.1em;
  margin: 0;
  transform: translateY(0);
}

/* ==========================================================================
   Option A — Progress, Stats, Keyboard-Hint, Finish
   ========================================================================== */

.progress-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  margin-bottom: 12px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 3px;
  transition: width .3s ease;
}

.quiz-meta strong { color: var(--ink); font-weight: 700; }

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  background: #f0fdf4;
}

.key-hint {
  margin-top: 14px;
  font-size: .8rem;
  color: #94a3b8;
  text-align: center;
}
.key-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  font-family: ui-monospace, monospace;
  font-size: .75rem;
}

.finish-card h2 { margin: 0 0 12px; font-size: 1.5rem; }
.finish-score {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0;
}
.finish-score .pct { color: #64748b; font-size: 1rem; font-weight: 500; }
.finish-msg {
  font-size: 1.05rem;
  color: #64748b;
  margin: 6px 0 20px;
}
.wrong-details {
  margin: 16px 0;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.wrong-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #475569;
}
.wrong-details ul {
  margin: 12px 0 0;
  padding-left: 20px;
  font-size: .9rem;
  color: #475569;
}
.wrong-details li { margin: 4px 0; }
.wrong-details .badge {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
  color: #64748b;
}

/* ============================================================
   Prefs-Toggle (Transliteration / Tonzeichen)
   ============================================================ */

#prefsBox {
  margin-top: 16px;
}

#prefsBtn {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: #334;
  transition: background 0.15s, border-color 0.15s;
}
#prefsBtn:hover {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.25);
}
#prefsBtn:active {
  background: rgba(0,0,0,0.10);
}

#prefsPanel {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f7f7f9;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: #223;
  max-width: 320px;
}
#prefsPanel[hidden] {
  display: none;
}
#prefsPanel label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
#prefsPanel input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #2c7a4b;
}

/* ============================================================
   Feedback-Audio (Button unter dem „Leider falsch"-Text)
   ============================================================ */

.feedback-audio {
  margin-top: 10px;
}
.feedback-audio .audio-btn {
  font-size: 13px;
  padding: 6px 12px;
}

/* ============================================================
   Audio-Button inline in Antwortoptionen
   ============================================================ */

.opt .audio-btn-inline {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
}
.opt .audio-btn-inline:hover {
  background: rgba(0,0,0,0.10);
}
.opt .audio-btn-inline:active {
  transform: scale(0.94);
}

/* ============================================================
   Transliteration / Tonzeichen in Antwortoptionen
   (nur sichtbar, wenn Prefs sie aktivieren)
   ============================================================ */

.opt-content .opt-translit {
  display: block;
  font-size: 12px;
  color: #667;
  margin-top: 2px;
  font-style: italic;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.opt-content .opt-tones {
  display: block;
  font-size: 12px;
  color: #8a5a2b;
  margin-top: 2px;
  letter-spacing: 2px;
  font-family: "Menlo", monospace;
}