:root {
  --green: #58cc02;
  --green-dark: #46a302;
  --red: #ea2b2b;
  --red-bg: #ffdfe0;
  --green-bg: #d7ffb8;
  --blue: #1cb0f6;
  --orange: #ff9600;
  --bg: #ffffff;
  --card: #ffffff;
  --text: #3c3c3c;
  --muted: #777777;
  --border: #e5e5e5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131f24;
    --card: #1f2c33;
    --text: #f1f7fb;
    --muted: #9fb1ba;
    --border: #37464f;
    --red-bg: #4b2326;
    --green-bg: #26401a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
}

#app { max-width: 560px; margin: 0 auto; padding: 16px; min-height: 100vh; }

h1 { font-size: 1.5rem; margin: 0; }
.muted { color: var(--muted); }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.stats { display: flex; gap: 14px; font-weight: 700; }

.lesson-list { display: grid; gap: 12px; }

.lesson {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--card); color: inherit; text-align: left;
  border: 2px solid var(--border); border-bottom-width: 4px; border-radius: 16px;
  padding: 14px 16px; font: inherit; cursor: pointer;
}
.lesson:hover { border-color: var(--blue); }
.lesson .emoji { font-size: 2rem; }
.lesson .info { flex: 1; }
.lesson .title { font-weight: 700; }
.lesson .score { font-weight: 700; color: var(--green-dark); }
.lesson.review { border-color: var(--orange); }

.progress { height: 14px; background: var(--border); border-radius: 7px; flex: 1; overflow: hidden; }
.progress > div { height: 100%; background: var(--green); transition: width 0.3s; }
.exercise-top { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.close { background: none; border: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; }

.question { font-size: 1.4rem; font-weight: 700; margin: 0 0 6px; }
.instruction { color: var(--muted); margin: 0 0 18px; }
.prompt-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.prompt { font-size: 1.5rem; font-weight: 700; }

.choices { display: grid; gap: 10px; }
.choice, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 14px;
  border: 2px solid var(--border); border-bottom-width: 4px;
  background: var(--card); color: var(--text); padding: 14px 16px; text-align: left;
}
.choice:hover:not(:disabled) { background: var(--border); }
.choice.right { border-color: var(--green); background: var(--green-bg); }
.choice.wrong { border-color: var(--red); background: var(--red-bg); }

.btn { text-align: center; text-transform: uppercase; letter-spacing: 0.05em; }
.btn.primary { background: var(--green); border-color: var(--green-dark); color: #fff; }
.btn.primary:disabled { background: var(--border); border-color: var(--border); color: var(--muted); cursor: default; }
.btn.secondary { color: var(--muted); }
.btn.big { width: 100%; margin-top: 18px; }

.icon-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--blue);
  background: var(--card); font-size: 1.4rem; cursor: pointer;
}
.icon-btn.listening { background: var(--red-bg); border-color: var(--red); }
.icon-btn.large { width: 96px; height: 96px; font-size: 2.4rem; }

input[type="text"] {
  width: 100%; font: inherit; padding: 14px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--card); color: var(--text);
}
.center { text-align: center; }
.heard { min-height: 1.5em; margin-top: 14px; color: var(--muted); }

.feedback {
  position: sticky; bottom: 0; margin: 24px -16px -16px; padding: 16px;
}
.feedback.right { background: var(--green-bg); color: var(--green-dark); }
.feedback.wrong { background: var(--red-bg); color: var(--red); }
.feedback .answer { color: var(--text); font-weight: 400; margin: 4px 0 0; }
.feedback strong { font-size: 1.15rem; }

.result { text-align: center; padding-top: 40px; }
.result .big-emoji { font-size: 4rem; }
.result-stats { display: flex; justify-content: center; gap: 28px; margin: 24px 0; font-weight: 700; }
.result-stats div span { display: block; font-size: 1.8rem; }

.error { background: var(--red-bg); color: var(--red); padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
