* { margin: 0; padding: 0; box-sizing: border-box; }

/* Farbwelt: derkiassistent.de (Ozean-Töne) */
:root {
  --bg: #e8f4f8;
  --bg-mid: #d0eaf3;
  --card: #ffffff;
  --ink: #073744;
  --muted: #4a7080;
  --border: #b8dde8;
  --cta: #0DB6C7;
  --cta-hover: #0caabc;
  --green: #0BA39A;
  --green-deep: #0A7570;
  --bolt: #FFD83D;
  --amber-bg: #fff7df;
  --amber-line: #f0d98a;
  --tip-bg: #e3f6f4;
  --tip-line: #a9dfd9;
}

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-mid) 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 26px;
  background: var(--card);
  border-bottom: 3px solid var(--cta);
  box-shadow: 0 2px 12px rgba(7, 55, 68, .06);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 36px; }
h1 { font-size: 26px; letter-spacing: -0.5px; color: var(--ink); }
.tagline { font-size: 12.5px; color: var(--muted); }

.progress-wrap { text-align: right; min-width: 190px; }
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.progress-label strong { color: var(--green-deep); font-size: 15px; }
.progress-bar { height: 9px; background: var(--bg-mid); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--cta)); border-radius: 5px; transition: width .4s; }

/* ---------- Setup ---------- */
.setup { max-width: 680px; margin: 44px auto; padding: 0 22px; width: 100%; }
.setup h2 { font-size: 24px; margin-bottom: 26px; color: var(--ink); }

.level-row {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 20px; margin-bottom: 28px;
  box-shadow: 0 3px 10px rgba(7, 55, 68, .05);
}
.level-caption { color: var(--muted); font-size: 14px; font-weight: 600; }
.levels { display: flex; gap: 10px; }
.levels button {
  padding: 9px 20px; border: 1.5px solid var(--border); background: var(--card);
  border-radius: 22px; cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted);
  transition: all .15s;
}
.levels button:hover { border-color: var(--cta); color: var(--ink); }
.levels button.active { background: var(--cta); border-color: var(--cta); color: #fff; box-shadow: 0 3px 8px rgba(13, 182, 199, .35); }

.scenario-group { margin-bottom: 26px; }
.scenario-group h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin-bottom: 12px; padding-left: 4px;
  display: flex; align-items: center; gap: 10px;
}
.scenario-group h3::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.scenarios { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.scenarios button {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 12px; background: var(--card); border: 1.5px solid var(--border);
  border-radius: 16px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--ink);
  transition: transform .13s, box-shadow .13s, border-color .13s;
  box-shadow: 0 2px 8px rgba(7, 55, 68, .05);
}
.scenarios button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(13, 182, 199, .22);
  border-color: var(--cta);
}
.scenarios button span { font-size: 32px; }

/* ---------- Chat ---------- */
.hidden { display: none !important; }
.chat { flex: 1; display: flex; flex-direction: column; max-width: 780px; width: 100%; margin: 0 auto; padding: 0 18px 18px; }
.chat-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; gap: 10px; }
.chat-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.ghost { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 600; }
.ghost:hover { color: var(--cta-hover); }
.speak-toggle { font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.speak-toggle input { accent-color: var(--cta); }

.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px 0; }

.bubble { max-width: 82%; padding: 13px 16px; border-radius: 18px; line-height: 1.5; font-size: 16px; }
.bubble.user {
  align-self: flex-end; color: #fff; border-bottom-right-radius: 5px;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  box-shadow: 0 3px 10px rgba(10, 117, 112, .25);
}
.bubble.assistant {
  align-self: flex-start; background: var(--card); border: 1px solid var(--border);
  border-bottom-left-radius: 5px; box-shadow: 0 3px 10px rgba(7, 55, 68, .06);
}

.bubble .tools { display: flex; gap: 12px; margin-top: 9px; }
.bubble .tools button { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--muted); padding: 0; font-weight: 600; }
.bubble .tools button:hover { color: var(--cta-hover); }
.translation { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--border); font-size: 14px; color: var(--muted); font-style: italic; }

.correction {
  align-self: flex-end; max-width: 82%;
  background: var(--amber-bg); border: 1px solid var(--amber-line); border-left: 4px solid var(--bolt);
  border-radius: 12px; padding: 9px 14px; font-size: 13.5px; line-height: 1.45;
}
.correction .corr-label { font-weight: 700; color: #8a6d00; }
.correction .corr-text { color: var(--ink); }
.correction small { color: var(--muted); }

.vocab-chip {
  align-self: flex-start; max-width: 82%;
  background: var(--tip-bg); border: 1px solid var(--tip-line); border-left: 4px solid var(--green);
  border-radius: 12px; padding: 9px 14px; font-size: 13.5px; line-height: 1.45;
}
.vocab-chip .v-lemma { font-weight: 700; color: var(--green-deep); }
.vocab-chip .v-example { font-style: italic; color: var(--muted); }

.typing { align-self: flex-start; color: var(--muted); font-size: 14px; padding: 6px 4px; }
.typing::after { content: "…"; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- Composer ---------- */
.composer { display: flex; gap: 10px; padding-top: 12px; }
.composer input {
  flex: 1; padding: 14px 18px; border: 1.5px solid var(--border); border-radius: 28px;
  font-size: 16px; background: var(--card); outline: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.composer input:focus { border-color: var(--cta); box-shadow: 0 0 0 3px rgba(13, 182, 199, .15); }
.composer button {
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 20px; display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
.composer button:hover { transform: scale(1.06); }
#micBtn { background: var(--card); border: 1.5px solid var(--border); }
#micBtn.recording { background: #c0392b; color: #fff; border-color: #c0392b; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(192, 57, 43, .15); } }
#sendBtn { background: var(--cta); color: #fff; box-shadow: 0 3px 10px rgba(13, 182, 199, .35); }
#sendBtn:hover { background: var(--cta-hover); }
#sendBtn:disabled { opacity: .5; }
.mic-hint { font-size: 12px; color: var(--muted); padding: 6px 4px 0; }

/* ---------- Vokabeltrainer ---------- */
.quiz { flex: 1; display: flex; flex-direction: column; max-width: 600px; width: 100%; margin: 0 auto; padding: 0 18px 24px; }

.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; }
.quiz-progress { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* Fortschritt als Punktereihe — Zustand auf einen Blick */
.quiz-dots { display: flex; gap: 7px; flex: 1; justify-content: center; flex-wrap: wrap; }
.quiz-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--border);
  transition: background .2s, transform .2s, box-shadow .2s;
}
.quiz-dot.correct { background: var(--green); }
.quiz-dot.wrong { background: var(--bolt); }
.quiz-dot.current { background: var(--cta); transform: scale(1.45); box-shadow: 0 0 0 3px rgba(13, 182, 199, .2); }

/* Bühne zentriert die Karte vertikal, statt sie oben kleben zu lassen */
.quiz-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 40px; }

.quiz-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 24px;
  padding: 34px 30px 30px; text-align: center;
  box-shadow: 0 10px 30px rgba(7, 55, 68, .09);
}

.quiz-head { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 26px; }
.quiz-direction {
  display: inline-block; padding: 5px 14px; border-radius: 20px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .3px;
}
.quiz-repeat {
  display: inline-block; padding: 5px 12px; border-radius: 20px;
  background: var(--amber-bg); border: 1px solid var(--amber-line);
  font-size: 12px; font-weight: 700; color: #8a6d00;
}

/* Das abgefragte Wort ist die Hauptfigur der Karte */
.quiz-word { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 30px 0 34px; min-height: 58px; }
.quiz-prompt { font-size: 42px; font-weight: 800; color: var(--ink); letter-spacing: -.8px; line-height: 1.15; }
.quiz-speak {
  background: none; border: none; cursor: pointer; font-size: 20px; opacity: .45;
  padding: 4px; line-height: 1; transition: opacity .15s, transform .12s;
}
.quiz-speak:hover { opacity: 1; transform: scale(1.12); }

.quiz-card input {
  width: 100%; padding: 15px 18px; border: 1.5px solid var(--border); border-radius: 16px;
  font-size: 18px; background: var(--bg); outline: none; color: var(--ink); text-align: center;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.quiz-card input::placeholder { color: var(--muted); opacity: .6; font-size: 16px; }
.quiz-card input:focus { border-color: var(--cta); background: var(--card); box-shadow: 0 0 0 3px rgba(13, 182, 199, .15); }
.quiz-card input:disabled { opacity: 1; background: var(--card); color: var(--muted); }

/* Reservierter Platz — die Karte springt beim Feedback nicht */
.quiz-slot { min-height: 92px; display: flex; align-items: center; padding: 12px 0; }
.quiz-feedback { width: 100%; padding: 11px 14px; border-radius: 14px; font-size: 15px; line-height: 1.45; }
.quiz-feedback.correct { background: var(--tip-bg); border: 1px solid var(--tip-line); color: var(--green-deep); }
.quiz-feedback.wrong { background: var(--amber-bg); border: 1px solid var(--amber-line); color: #8a4b00; }
.quiz-feedback strong { font-weight: 800; }
.quiz-feedback .fb-origin { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); font-style: italic; }

.quiz-actions button {
  padding: 13px 38px; border: none; border-radius: 26px; font-size: 15px; font-weight: 700;
  cursor: pointer; background: var(--cta); color: #fff; box-shadow: 0 4px 12px rgba(13, 182, 199, .35);
  transition: background .15s, transform .12s;
}
.quiz-actions button:hover { background: var(--cta-hover); transform: translateY(-1px); }

/* Rundenende */
.quiz-summary {
  background: var(--card); border: 1px solid var(--border); border-radius: 24px;
  padding: 34px 30px; text-align: center; box-shadow: 0 10px 30px rgba(7, 55, 68, .09);
}
.quiz-summary .score { font-size: 40px; font-weight: 800; color: var(--green-deep); letter-spacing: -1px; }
.quiz-summary .score-sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }

.quiz-review { margin: 24px 0 4px; text-align: left; }
.quiz-review h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  margin-bottom: 10px; font-weight: 700;
}
.quiz-review-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 9px 13px; margin-bottom: 6px; border-radius: 12px;
  background: var(--amber-bg); border: 1px solid var(--amber-line); font-size: 14.5px;
}
.quiz-review-item .rw-it { font-weight: 700; color: var(--ink); }
.quiz-review-item .rw-de { color: var(--muted); text-align: right; }

.quiz-summary-actions { margin-top: 24px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.quiz-summary-actions button {
  padding: 12px 26px; border-radius: 26px; font-size: 15px; font-weight: 700; cursor: pointer;
  border: none; background: var(--cta); color: #fff;
  box-shadow: 0 4px 12px rgba(13, 182, 199, .35); transition: background .15s;
}
.quiz-summary-actions button:hover { background: var(--cta-hover); }
.quiz-summary-actions button.ghost {
  background: none; box-shadow: none; color: var(--muted); border: 1.5px solid var(--border);
}
.quiz-summary-actions button.ghost:hover { color: var(--ink); border-color: var(--cta); }

@media (max-width: 560px) {
  .progress-wrap { min-width: 130px; }
  h1 { font-size: 21px; }
  .bubble { max-width: 90%; }
  .level-row { flex-wrap: wrap; }

  .quiz-prompt { font-size: 32px; }
  .quiz-card { padding: 26px 20px 24px; }
  .quiz-word { margin: 24px 0 26px; }
  .quiz-progress { display: none; }
  .quiz-review-item { flex-direction: column; gap: 2px; }
  .quiz-review-item .rw-de { text-align: left; }
}
