/* English Heroes — яркий детский дизайн, мобильная адаптивность от 320px */
:root {
  --accent: #ff9800;
  --bg: #fff8e7;
  --card: #ffffff;
  --text: #33302e;
  --muted: #7a746e;
  --ok: #2e7d32;
  --bad: #c62828;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(60, 40, 0, 0.12);
}

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

html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255, 200, 60, 0.18) 0 120px, transparent 130px),
    radial-gradient(circle at 85% 75%, rgba(120, 200, 255, 0.18) 0 140px, transparent 150px);
  color: var(--text);
  font-size: 18px;
  line-height: 1.45;
  min-height: 100vh;
}

#app { max-width: 720px; margin: 0 auto; padding: 0 12px 40px; overflow-x: hidden; }

/* ---------- верхняя панель ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 4px;
}
.topbar-title { font-weight: 800; color: var(--accent); font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.tts-badge {
  font-size: 0.72rem; background: #ffe3e3; color: #a33;
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
}
.btn-icon {
  min-width: 44px; min-height: 44px; font-size: 1.4rem;
  border: none; background: var(--card); border-radius: 50%;
  box-shadow: var(--shadow); cursor: pointer;
}
.char-chip { border: 3px solid var(--accent); }

/* ---------- общие элементы ---------- */
.screen { display: flex; flex-direction: column; gap: 16px; padding: 8px 0; }

.btn {
  min-height: 48px; padding: 10px 18px; font-size: 1rem; font-weight: 700;
  font-family: inherit; border: none; border-radius: var(--radius);
  background: var(--card); color: var(--text);
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.1s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--muted); text-decoration: underline; }
.btn-danger { background: #ffebee; color: var(--bad); }
.btn-small { min-height: 44px; font-size: 0.85rem; padding: 6px 12px; }
.btn-listen { background: #e3f2fd; }
.big-listen { font-size: 1.3rem; min-height: 64px; }

.error { color: var(--bad); font-weight: 700; text-align: center; padding: 20px 0; }

.speech {
  min-height: 1.4em; color: var(--muted); font-style: italic; text-align: center;
}
.speech.big { font-size: 1.15rem; color: var(--text); }

.counter { text-align: center; color: var(--muted); font-weight: 700; }

.progressbar { height: 10px; background: #eee2c8; border-radius: 999px; overflow: hidden; }
.progressbar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }

.section-title { font-size: 1rem; color: var(--muted); margin-top: 8px; }

/* ---------- экран старта / персонажи ---------- */
.hero-title { text-align: center; font-size: 2rem; color: var(--accent); margin-top: 12px; }
.hero-sub { text-align: center; color: var(--muted); }

.char-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.char-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 10px; border: 3px solid transparent; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); cursor: pointer;
  font-family: inherit; min-height: 44px;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.char-card:hover, .char-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); }
.char-avatar { font-size: 2.6rem; }
.char-name { font-weight: 800; font-size: 1.05rem; color: var(--accent); }
.char-motto { font-size: 0.8rem; color: var(--muted); text-align: center; }

.char-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 14px;
}
.char-avatar-sm { font-size: 2rem; }
.char-banner-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.char-banner-text .speech { text-align: left; font-size: 0.85rem; }

/* ---------- модули ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.module-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 8px 12px; border: none; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; font-family: inherit;
  min-height: 44px;
}
.module-tile:hover { outline: 3px solid var(--accent); }
.module-emoji { font-size: 2.2rem; }
.module-title { font-weight: 800; }
.module-meta { font-size: 0.78rem; color: var(--muted); }
.level-badge {
  position: absolute; top: 8px; right: 8px; font-size: 0.65rem;
  background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 7px;
}
.module-head { text-align: center; font-size: 1.5rem; }

/* ---------- режимы ---------- */
.mode-list { display: flex; flex-direction: column; gap: 12px; }
.mode-btn { font-size: 1.15rem; min-height: 60px; }
.done-check { font-size: 0.9rem; }

/* ---------- карточки ---------- */
.flashcard {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 16px; border-top: 8px solid var(--accent);
}
.fc-en { font-size: 2.2rem; font-weight: 900; color: var(--accent); text-align: center; overflow-wrap: anywhere; }
.fc-ru { font-size: 1.3rem; text-align: center; }
.fc-phrase { font-size: 0.95rem; color: var(--muted); text-align: center; font-style: italic; }

.nav-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.nav-row .btn { flex: 1 1 120px; max-width: 240px; }

/* ---------- квиз ---------- */
.quiz-question { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.quiz-prompt { font-size: 1.25rem; font-weight: 800; text-align: center; overflow-wrap: anywhere; }
.options { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 480px) { .options { grid-template-columns: 1fr 1fr; } }
.option { min-height: 56px; font-size: 1.05rem; overflow-wrap: anywhere; }
.option.right { background: #e8f5e9; color: var(--ok); outline: 3px solid var(--ok); }
.option.wrong { background: #ffebee; color: var(--bad); outline: 3px solid var(--bad); }
.option.locked { pointer-events: none; }

/* ---------- собери слово ---------- */
.spell-answer {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  min-height: 56px; padding: 8px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.spell-answer.ok { outline: 3px solid var(--ok); }
.slot {
  width: 44px; height: 48px; font-size: 1.3rem; font-weight: 800;
  border: 2px dashed var(--muted); border-radius: 10px; background: #faf6ee;
  cursor: pointer; font-family: inherit;
}
.slot.filled { border-style: solid; border-color: var(--accent); color: var(--accent); background: #fff; }
.sep { align-self: center; color: var(--muted); font-size: 1.2rem; padding: 0 2px; }
.spell-tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile {
  width: 48px; height: 52px; font-size: 1.4rem; font-weight: 800;
  border: none; border-radius: 12px; background: var(--accent); color: #fff;
  box-shadow: var(--shadow); cursor: pointer; font-family: inherit;
}
.tile.used { opacity: 0.25; cursor: default; }

/* ---------- диктант ---------- */
.dict-input {
  width: 100%; min-height: 56px; font-size: 1.3rem; text-align: center;
  border: 3px solid var(--accent); border-radius: var(--radius);
  padding: 8px 14px; font-family: inherit; background: var(--card);
}
.dict-input.ok { border-color: var(--ok); background: #e8f5e9; }

/* ---------- итог и прогресс ---------- */
.result { align-items: center; text-align: center; }
.result-emoji { font-size: 3.4rem; }
.result-stars { font-size: 1.5rem; font-weight: 900; color: var(--accent); }
.result-score { font-size: 1.1rem; }

.stat-cards { display: flex; gap: 12px; }
.stat-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 8px; color: var(--muted); font-size: 0.85rem;
}
.stat-num { font-size: 1.7rem; font-weight: 900; color: var(--accent); }

.progress-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.progress-row {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px;
}

/* ---------- анимации ---------- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake { animation: shake 0.35s ease; }

/* ---------- маленькие экраны ---------- */
@media (max-width: 360px) {
  body { font-size: 16px; }
  .hero-title { font-size: 1.6rem; }
  .fc-en { font-size: 1.7rem; }
  .tile, .slot { width: 40px; }
}
