/* ============================================================
   STYLES.CSS — Inglés Técnico para Electricistas
   Tema: obra de construcción (azul marino + ámbar seguridad)
   ============================================================ */

:root {
  --navy-900: #0f1b2d;
  --navy-800: #16263e;
  --navy-700: #1f3352;
  --navy-600: #2a4368;
  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --amber-100: #fef3c7;
  --sky-500: #0ea5e9;
  --sky-100: #e0f2fe;
  --violet-500: #8b5cf6;
  --violet-100: #ede9fe;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --red-500: #ef4444;
  --red-100: #fee2e2;
  --paper: #f6f4ef;
  --card: #ffffff;
  --ink: #1c2733;
  --ink-soft: #52616f;
  --line: #e4e0d6;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 27, 45, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 27, 45, 0.16);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button { font-family: inherit; cursor: pointer; }

/* ---------------- Header ---------------- */

.topbar {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  border-bottom: 4px solid var(--amber-500);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.brand .bolt {
  width: 40px; height: 40px;
  background: var(--amber-500);
  color: var(--navy-900);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 800;
}

.brand h1 { font-size: 1.05rem; line-height: 1.15; }
.brand small { display: block; font-weight: 400; opacity: 0.75; font-size: 0.72rem; }

.topbar .spacer { flex: 1; }

.nav-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.18); }
.nav-btn.active { background: var(--amber-500); color: var(--navy-900); font-weight: 700; border-color: var(--amber-500); }

.progress-chip {
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.progress-chip .bar {
  width: 90px; height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-chip .bar span { display: block; height: 100%; background: var(--amber-400); border-radius: 99px; }

/* ---------------- Layout ---------------- */

main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.4rem 1rem 3rem;
  flex: 1;
}

footer {
  background: var(--navy-900);
  color: rgba(255,255,255,0.55);
  font-size: 0.75rem;
  text-align: center;
  padding: 1rem;
  line-height: 1.5;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.crumbs a { color: var(--navy-600); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }

/* ---------------- Hero (inicio) ---------------- */

.hero {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  border-radius: var(--radius);
  color: #fff;
  padding: 1.6rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "⚡";
  position: absolute;
  right: -10px; bottom: -30px;
  font-size: 9rem;
  opacity: 0.08;
}
.hero h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.hero p { opacity: 0.85; font-size: 0.95rem; max-width: 640px; line-height: 1.55; }
.hero .hero-stats {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.hero .stat {
  background: rgba(255,255,255,0.1);
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  font-size: 0.85rem;
}
.hero .stat b { color: var(--amber-400); font-size: 1.05rem; }

/* ---------------- Tarjetas de nivel ---------------- */

.levels-grid { display: grid; gap: 1rem; }

.level-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  border-left: 6px solid var(--amber-500);
  display: flex;
  gap: 1rem;
  align-items: center;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.level-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.level-card.locked { opacity: 0.6; cursor: not-allowed; filter: grayscale(0.5); }
.level-card.amber { border-left-color: var(--amber-500); }
.level-card.sky { border-left-color: var(--sky-500); }
.level-card.violet { border-left-color: var(--violet-500); }
.level-card.emerald { border-left-color: var(--emerald-500); }
.level-card.red { border-left-color: var(--red-500); background: linear-gradient(180deg, #fff8f8, var(--card)); }
.level-card.red .lv-num { color: var(--red-500); }

.level-badge {
  width: 62px; height: 62px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  color: var(--navy-800);
}
.level-card.amber .level-badge { background: var(--amber-100); }
.level-card.sky .level-badge { background: var(--sky-100); }
.level-card.violet .level-badge { background: var(--violet-100); }
.level-card.emerald .level-badge { background: var(--emerald-100); }
.level-card.red .level-badge { background: var(--red-100); }
.level-badge .svg-icon svg { width: 38px; height: 38px; }

.level-info { flex: 1; min-width: 0; }
.level-info .lv-num { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 700; }
.level-info h3 { font-size: 1.15rem; }
.level-info h3 small { color: var(--ink-soft); font-weight: 500; font-size: 0.85rem; }
.level-info p { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.25rem; line-height: 1.45; }

.level-progress { text-align: right; flex-shrink: 0; }
.level-progress .pct { font-weight: 800; font-size: 1.2rem; color: var(--navy-700); }
.level-progress .modcount { font-size: 0.75rem; color: var(--ink-soft); }
.level-progress .lock { font-size: 1.5rem; }

.minibar { width: 110px; height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 0.35rem; }
.minibar span { display: block; height: 100%; background: var(--emerald-500); border-radius: 99px; }

/* ---------------- Vista de nivel: módulos ---------------- */

.level-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.level-head h2 { font-size: 1.4rem; }
.level-head p { color: var(--ink-soft); font-size: 0.9rem; margin-top: 0.15rem; }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.module-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.module-card.locked { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.6); }

.module-card .mod-top { display: flex; align-items: center; gap: 0.6rem; }
.module-card .mod-icon {
  width: 46px; height: 46px;
  background: var(--navy-800);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}
.module-card h4 { font-size: 1rem; line-height: 1.25; }
.module-card h4 small { display: block; color: var(--ink-soft); font-weight: 500; font-size: 0.78rem; }
.module-card p { font-size: 0.83rem; color: var(--ink-soft); line-height: 1.45; flex: 1; }

.mod-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font-weight: 700;
  font-size: 0.74rem;
}
.badge.pass { background: var(--emerald-100); color: #067a5b; }
.badge.todo { background: var(--amber-100); color: #92600a; }
.badge.lock { background: #eceae4; color: var(--ink-soft); }
.badge.count { background: var(--sky-100); color: #0369a1; }

/* ---------------- Vista de estudio ---------------- */

.study-head {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.study-head .row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.study-head h2 { font-size: 1.3rem; flex: 1; min-width: 200px; }
.study-head h2 small { display: block; font-size: 0.85rem; color: var(--ink-soft); font-weight: 500; }
.study-head .desc { color: var(--ink-soft); font-size: 0.9rem; margin-top: 0.55rem; line-height: 1.5; }

.tipbox, .necbox {
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font-size: 0.86rem;
  line-height: 1.5;
  margin-top: 0.8rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.tipbox { background: var(--sky-100); color: #0b4a6f; }
.necbox { background: var(--amber-100); color: #7c5205; }
.tipbox .ico, .necbox .ico { font-size: 1.1rem; flex-shrink: 0; }

.action-row {
  display: flex;
  gap: 0.7rem;
  margin: 1.1rem 0;
  flex-wrap: wrap;
  position: sticky;
  top: 70px;
  z-index: 10;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.1s, filter 0.15s;
  box-shadow: var(--shadow);
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--amber-500); color: var(--navy-900); }
.btn.dark { background: var(--navy-800); color: #fff; }
.btn.ghost { background: var(--card); color: var(--navy-800); border: 1px solid var(--line); }
.btn.green { background: var(--emerald-500); color: #fff; }
.btn.red { background: var(--red-500); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: grayscale(0.4); }
.btn.big { font-size: 1.05rem; padding: 0.9rem 1.7rem; }

/* ---- Tarjetas de vocabulario ---- */

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.vocab-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vocab-main {
  display: flex;
  gap: 0.9rem;
  padding: 1rem 1.1rem 0.7rem;
  align-items: flex-start;
}

.item-icon {
  width: 64px; height: 64px;
  border-radius: 14px;
  background: var(--navy-800);
  color: var(--amber-400);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.item-icon svg { width: 46px; height: 46px; }
.item-icon.emoji-icon { font-size: 2rem; }

.vocab-words { flex: 1; min-width: 0; }
.vocab-words .es { font-size: 0.92rem; color: var(--ink-soft); font-weight: 600; }
.vocab-words .en {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy-800);
  line-height: 1.2;
  margin: 0.1rem 0;
  overflow-wrap: anywhere;
}
.vocab-words .pron {
  font-size: 0.84rem;
  color: #a16207;
  font-weight: 600;
  background: var(--amber-100);
  display: inline-block;
  border-radius: 8px;
  padding: 0.12rem 0.5rem;
  margin-top: 0.15rem;
}

.audio-row {
  display: flex;
  gap: 0.45rem;
  padding: 0 1.1rem 0.6rem;
  flex-wrap: wrap;
}
.audio-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--navy-700);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s;
}
.audio-btn:hover { background: var(--amber-100); border-color: var(--amber-400); }
.audio-btn.speaking { background: var(--amber-400); border-color: var(--amber-500); }

/* Botón de práctica: lo dice lento y luego a velocidad real */
.audio-btn.drill {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}
.audio-btn.drill:hover { background: var(--navy-600); border-color: var(--navy-600); }

.vocab-example {
  border-top: 1px dashed var(--line);
  padding: 0.65rem 1.1rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.vocab-example .en-ex { color: var(--navy-800); font-weight: 600; }
.vocab-example .en-ex button { margin-left: 0.3rem; }
.vocab-example .es-ex { color: var(--ink-soft); }

.vocab-note {
  background: #f2f7ff;
  color: #24476b;
  font-size: 0.8rem;
  padding: 0.55rem 1.1rem;
  line-height: 1.45;
}
.vocab-nec {
  background: var(--amber-100);
  color: #7c5205;
  font-size: 0.8rem;
  padding: 0.55rem 1.1rem;
  line-height: 1.45;
}
.vocab-nec b, .vocab-note b { font-weight: 800; }

.mini-audio {
  border: none;
  background: transparent;
  font-size: 0.95rem;
  cursor: pointer;
  vertical-align: middle;
  padding: 0 0.15rem;
}
.mini-audio:hover { transform: scale(1.15); }

/* ---- Resaltado karaoke: palabra que se está pronunciando ---- */

/* El padding va en TODAS las palabras para que nada se mueva al
   iluminarse (si solo lo llevara la resaltada, el texto brincaría). */
.w {
  border-radius: 4px;
  padding: 0 2px;
  transition: background-color 0.05s linear, color 0.05s linear;
}

/* Palabra que suena en este instante: bloque oscuro + letra ámbar.
   Invertir los colores da mucho más contraste que solo pintar el fondo. */
.w.speaking-word {
  background: var(--navy-900);
  color: var(--amber-400);
  box-shadow: 0 0 0 3px var(--navy-900), 0 2px 10px rgba(15, 27, 45, 0.45);
  position: relative;
  z-index: 1;
}

/* En la palabra grande en inglés, el reflector es aún más marcado */
.vocab-words .en .w.speaking-word,
.q-prompt .w.speaking-word {
  background: #000814;
  color: #ffd24a;
  box-shadow: 0 0 0 4px #000814, 0 3px 14px rgba(0, 0, 0, 0.5);
}

/* Ojo: no cambiamos el grosor de la letra a propósito. Si lo hiciéramos,
   las palabras se recorrerían de lugar en cada sílaba. */

/* ---------------- Quiz / Examen ---------------- */

.quiz-wrap { max-width: 720px; margin: 0 auto; }

.quiz-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.quiz-top .qbar { flex: 1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.quiz-top .qbar span { display: block; height: 100%; background: var(--amber-500); border-radius: 99px; transition: width 0.25s; }
.quiz-top .qcount { font-weight: 800; color: var(--navy-700); font-size: 0.9rem; }
.quiz-top .quit { font-size: 0.8rem; }

.question-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem 1.4rem;
}

.q-kind {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--ink-soft);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.q-prompt { font-size: 1.3rem; font-weight: 800; color: var(--navy-800); line-height: 1.3; margin-bottom: 0.3rem; }
.q-sub { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 1rem; }

.q-icon-hint { text-align: center; margin: 0.4rem 0 1rem; }
.q-icon-hint .item-icon { width: 84px; height: 84px; margin: 0 auto; }
.q-icon-hint .item-icon svg { width: 60px; height: 60px; }
.q-icon-hint .item-icon.emoji-icon { font-size: 2.6rem; }

.listen-big {
  display: flex;
  justify-content: center;
  margin: 0.8rem 0 1.2rem;
}
.listen-big button {
  width: 92px; height: 92px;
  border-radius: 50%;
  border: none;
  background: var(--navy-800);
  color: var(--amber-400);
  font-size: 2.2rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.12s;
}
.listen-big button:hover { transform: scale(1.06); }

.options { display: grid; gap: 0.6rem; }
@media (min-width: 560px) { .options.two-col { grid-template-columns: 1fr 1fr; } }

.opt {
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.12s, background 0.12s;
  line-height: 1.35;
}
.opt:hover { border-color: var(--amber-400); background: #fffbeb; }
.opt.correct { border-color: var(--emerald-500); background: var(--emerald-100); }
.opt.wrong { border-color: var(--red-500); background: var(--red-100); }
.opt:disabled { cursor: default; }
.opt .opt-letter {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--navy-800);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  margin-right: 0.55rem;
}

.type-zone { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.type-zone input {
  flex: 1;
  min-width: 220px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
}
.type-zone input:focus { border-color: var(--amber-400); }
.type-zone input.correct { border-color: var(--emerald-500); background: var(--emerald-100); }
.type-zone input.wrong { border-color: var(--red-500); background: var(--red-100); }

.feedback {
  margin-top: 1rem;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  display: none;
}
.feedback.show { display: block; }
.feedback.good { background: var(--emerald-100); color: #065f46; }
.feedback.bad { background: var(--red-100); color: #991b1b; }
.feedback b { font-size: 1.05rem; }

.quiz-next { margin-top: 1rem; display: flex; justify-content: flex-end; }

/* ---- Resultados ---- */

.result-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}
.result-card .big-emoji { font-size: 4rem; }
.result-card h2 { font-size: 1.6rem; margin: 0.5rem 0 0.3rem; }
.result-card .score {
  font-size: 3rem;
  font-weight: 900;
  color: var(--navy-800);
}
.result-card .score.pass { color: var(--emerald-500); }
.result-card .score.fail { color: var(--red-500); }
.result-card p { color: var(--ink-soft); margin: 0.5rem 0 1rem; line-height: 1.5; }
.result-actions { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

.missed-list {
  text-align: left;
  margin: 1.2rem auto 0;
  max-width: 560px;
  border-top: 1px dashed var(--line);
  padding-top: 1rem;
}
.missed-list h4 { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.6rem; }
.missed-item {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--red-100);
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  align-items: center;
}
.missed-item .en { font-weight: 800; color: var(--navy-800); }
.missed-item .es { color: var(--ink-soft); }

/* ---------------- Diccionario ---------------- */

.dict-head { margin-bottom: 1rem; }
.dict-head input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  background: var(--card);
  box-shadow: var(--shadow);
}
.dict-head input:focus { border-color: var(--amber-400); }
.dict-count { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.5rem; }

.dict-list { display: grid; gap: 0.55rem; }
.dict-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  box-shadow: var(--shadow);
}
.dict-row .item-icon { width: 44px; height: 44px; border-radius: 10px; }
.dict-row .item-icon svg { width: 30px; height: 30px; }
.dict-row .item-icon.emoji-icon { font-size: 1.4rem; }
.dict-row .words { flex: 1; min-width: 0; }
.dict-row .en { font-weight: 800; color: var(--navy-800); font-size: 0.98rem; }
.dict-row .es { font-size: 0.84rem; color: var(--ink-soft); }
.dict-row .tag {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--sky-100);
  color: #0369a1;
  padding: 0.18rem 0.5rem;
  border-radius: 99px;
  white-space: nowrap;
}

/* ---------------- Ajustes (modal) ---------------- */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(15,27,45,0.55);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 1rem;
}
.modal-back.show { display: grid; }
.modal {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 460px;
  width: 100%;
  padding: 1.4rem;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 0.8rem; }
.modal .field { margin-bottom: 1rem; }
.modal label { font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); display: block; margin-bottom: 0.3rem; }
.modal input[type="range"] { width: 100%; }
.modal .voices-info { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.5; background: var(--paper); border-radius: 10px; padding: 0.6rem 0.8rem; }
.modal .modal-actions { display: flex; justify-content: space-between; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--navy-900);
  color: #fff;
  border-radius: 12px;
  padding: 0.75rem 1.2rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s;
  z-index: 200;
  max-width: 92vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------------- Responsive ---------------- */

@media (max-width: 640px) {
  .brand h1 { font-size: 0.95rem; }
  .progress-chip { display: none; }
  .level-card { flex-direction: column; align-items: flex-start; }
  .level-progress { text-align: left; }
  .action-row { position: static; }
  .q-prompt { font-size: 1.15rem; }
}

@media print {
  .topbar, .action-row, footer { display: none; }
}

/* ---------------- Teléfono / app instalada (PWA) ---------------- */

/* Respetar el notch y la barra de gestos del teléfono */
.topbar { padding-top: calc(0.7rem + env(safe-area-inset-top)); }
footer { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }

/* Evitar que un jalón hacia abajo recargue la página a media pregunta */
body { overscroll-behavior-y: contain; }

/* Botones más cómodos para el dedo en pantallas táctiles */
@media (pointer: coarse) {
  .opt { padding: 1rem 1.1rem; }
  .audio-btn { padding: 0.5rem 0.95rem; }
  .btn { padding: 0.85rem 1.4rem; }
}

/* ---------------- Reconocimiento de voz (pronunciar) ---------------- */

/* Si el navegador no reconoce voz, los botones de micrófono no aparecen */
.no-mic .mic-only { display: none !important; }

.audio-btn.mic {
  background: var(--emerald-500);
  border-color: var(--emerald-500);
  color: #fff;
}
.audio-btn.mic:hover { background: #0d9668; border-color: #0d9668; }

/* Mientras escucha: rojo con latido, para que se note que está grabando */
.audio-btn.escuchando, .btn.escuchando, .mini-audio.escuchando {
  background: var(--red-500) !important;
  border-color: var(--red-500) !important;
  color: #fff !important;
  animation: latido 1s ease-in-out infinite;
}
.mini-audio.escuchando { border-radius: 999px; padding: 0 0.35rem; }
@keyframes latido {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.mic-res {
  display: none;
  margin: 0 1.1rem 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
}
.mic-res.show { display: block; }
.mic-res.listening { background: var(--sky-100); color: #075985; }
.mic-res.good { background: var(--emerald-100); color: #065f46; }
.mic-res.ok { background: var(--amber-100); color: #7c5205; }
.mic-res.bad { background: var(--red-100); color: #991b1b; }
.vocab-example .mic-res { margin: 0.5rem 0 0; }
.mic-pct { float: right; font-weight: 800; font-size: 1rem; margin-left: 0.5rem; }
.mic-oido { margin-top: 0.25rem; font-style: italic; }
.mic-tip { margin-top: 0.2rem; font-size: 0.78rem; }
.dicho-mal-demo { color: #991b1b; font-weight: 800; }

/* Palabras después de hablar: verde se entendió, rojo no */
.w.dicho-ok { background: var(--emerald-100); color: #065f46; box-shadow: inset 0 -2px 0 var(--emerald-500); }
.w.dicho-mal { background: var(--red-100); color: #991b1b; box-shadow: inset 0 -2px 0 var(--red-500); }

.badge.mic-badge { background: var(--emerald-100); color: #067a5b; font-size: 0.8rem; }

/* Práctica de pronunciación, término por término */
.speak-card .speak-es { color: var(--ink-soft); font-size: 1rem; text-align: center; margin-bottom: 0.3rem; }
.speak-card .q-prompt, .speak-card .q-sub, .speak-card .q-kind { text-align: center; }
.speak-audio { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin: 0.9rem 0 0.6rem; }
.speak-mic { text-align: center; margin: 0.4rem 0; }
.speak-card .mic-res { margin: 0.6rem 0 0; }
.speak-ex { border-top: 1px dashed var(--line); margin-top: 1.1rem; padding-top: 0.9rem; font-size: 0.92rem; line-height: 1.5; }
.speak-ex .en-ex { color: var(--navy-800); font-weight: 600; margin: 0.3rem 0; }
.speak-ex .es-ex { color: var(--ink-soft); margin-bottom: 0.6rem; }
.speak-nav { display: flex; justify-content: space-between; gap: 0.6rem; margin-top: 1.3rem; }

/* ---------------- Cuentas de usuario ---------------- */

.auth-card {
  max-width: 440px;
  margin: 1.2rem auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.6rem 1.4rem;
}
.auth-ico { font-size: 2.4rem; text-align: center; }
.auth-card h2 { text-align: center; color: var(--navy-800); margin: 0.2rem 0 0.4rem; }
.auth-lead { color: var(--ink-soft); font-size: 0.9rem; text-align: center; margin-bottom: 1.1rem; line-height: 1.45; }
.auth-field { margin-bottom: 0.8rem; }
.auth-field label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 0.3rem; }
.auth-input { position: relative; }
.auth-input input {
  width: 100%;
  font-size: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}
.auth-input input:focus { outline: 2px solid var(--amber-400); background: #fff; }
.auth-input input.con-ojo { padding-right: 2.8rem; }
.auth-eye {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 1.15rem;
  padding: 0.3rem 0.4rem;
}
.auth-hint { font-size: 0.78rem; color: var(--ink-soft); margin: -0.3rem 0 0.8rem; line-height: 1.4; }
.auth-go { width: 100%; justify-content: center; margin-top: 0.4rem; }
.auth-msg { min-height: 1.2rem; margin-top: 0.8rem; font-size: 0.9rem; text-align: center; color: #991b1b; font-weight: 600; }
.auth-msg.info { color: var(--navy-700); }
.auth-alt { text-align: center; margin-top: 0.9rem; font-size: 0.92rem; }
.auth-alt a { color: var(--navy-700); font-weight: 800; }
.auth-skip { text-align: center; margin-top: 0.7rem; font-size: 0.8rem; }
.auth-skip a { color: var(--ink-soft); }

.hola { font-weight: 800; color: var(--amber-400); margin-bottom: 0.3rem; font-size: 1.05rem; }

/* La ventana de ajustes ahora tiene más cosas: que se pueda desplazar */
.modal { max-height: 92vh; overflow-y: auto; }
.btn.compartir { width: 100%; justify-content: center; }
.cuenta-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1rem;
  background: var(--paper);
  font-size: 0.88rem;
  line-height: 1.5;
}
.cuenta-info code { background: #fff; padding: 0 0.3rem; border-radius: 4px; }
.cuenta-estado { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.3rem; }
.cuenta-acciones { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.cuenta-acciones .btn { padding: 0.5rem 0.9rem; font-size: 0.85rem; }
.cuenta-clave { margin-top: 0.7rem; }
.cuenta-clave input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}
