/* ===== Aprender Inglés — estilos ===== */
:root {
  --c-bg: #f4f3ff;
  --c-surface: #ffffff;
  --c-primary: #6c5ce7;
  --c-primary-dark: #5546c9;
  --c-accent: #00b894;
  --c-accent-warm: #ff9f43;
  --c-pink: #ff6b9d;
  --c-yellow: #ffd166;
  --c-text: #2d2a45;
  --c-muted: #7b7895;
  --c-good: #00b894;
  --c-bad: #ff6b6b;
  --c-line: #e7e5f5;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 18px rgba(108, 92, 231, 0.12);
  --shadow-lg: 0 12px 32px rgba(108, 92, 231, 0.22);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --maxw: 760px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

/* ===== Header ===== */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--c-primary), #8e7bff);
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #fff; }
.brand-mascot { font-size: 28px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: .2px; }
.header-stats { display: flex; gap: 10px; font-weight: 800; }
.header-stats span {
  background: rgba(255,255,255,.18); padding: 6px 10px; border-radius: 999px; font-size: 14px;
}

/* ===== Layout ===== */
.app-main {
  max-width: var(--maxw); margin: 0 auto;
  padding: 18px max(16px, env(safe-area-inset-left)) 24px max(16px, env(safe-area-inset-right));
  outline: none;
}
.view { animation: fade-up .28s ease; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { line-height: 1.2; }
.page-title { font-size: 24px; font-weight: 800; margin: 4px 0 4px; }
.page-sub { color: var(--c-muted); margin: 0 0 18px; font-weight: 600; }

/* ===== Mascota / hero ===== */
.hero {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-surface); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.hero .mascot { font-size: 52px; line-height: 1; }
.hero .bubble { font-weight: 700; }
.hero .bubble small { display: block; color: var(--c-muted); font-weight: 600; margin-top: 2px; }

/* ===== Tarjetas / camino de módulos ===== */
.path { display: grid; gap: 14px; }
.module-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-surface); border: none; border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); text-align: left;
  cursor: pointer; width: 100%; color: var(--c-text);
  transition: transform .12s ease, box-shadow .12s ease;
  text-decoration: none;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.module-card:active { transform: translateY(0); }
.module-card .m-badge {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center; font-size: 26px; color: #fff; font-weight: 800;
}
.module-card .m-body { flex: 1 1 auto; min-width: 0; }
.module-card .m-title { font-weight: 800; font-size: 17px; }
.module-card .m-meta { color: var(--c-muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.module-card .m-state { font-size: 22px; flex: 0 0 auto; }
.module-card.locked { opacity: .55; }

/* paleta rotativa para insignias de módulo */
.bg-1 { background: linear-gradient(135deg,#6c5ce7,#8e7bff); }
.bg-2 { background: linear-gradient(135deg,#00b894,#55efc4); }
.bg-3 { background: linear-gradient(135deg,#ff6b9d,#ff9ff3); }
.bg-4 { background: linear-gradient(135deg,#ff9f43,#ffd166); }
.bg-5 { background: linear-gradient(135deg,#0984e3,#74b9ff); }
.bg-6 { background: linear-gradient(135deg,#e17055,#fab1a0); }
.bg-7 { background: linear-gradient(135deg,#00cec9,#81ecec); }
.bg-8 { background: linear-gradient(135deg,#a29bfe,#d6a2e8); }
.bg-9 { background: linear-gradient(135deg,#fd79a8,#fab1c8); }
.bg-10 { background: linear-gradient(135deg,#fdcb6e,#ffeaa7); color:#2d2a45 !important; }

/* progreso */
.progress-bar { background: var(--c-line); border-radius: 999px; height: 10px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg,var(--c-accent),#55efc4); border-radius: 999px; transition: width .4s ease; }

/* ===== Lección ===== */
.lesson-tabs { display: flex; gap: 8px; margin: 6px 0 16px; }
.lesson-tabs button {
  flex: 1; border: none; background: var(--c-surface); color: var(--c-muted);
  font-weight: 800; font-family: inherit; padding: 10px; border-radius: var(--radius-sm);
  cursor: pointer; box-shadow: var(--shadow); font-size: 15px;
}
.lesson-tabs button.active { background: var(--c-primary); color: #fff; }

.teach-card {
  background: var(--c-surface); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.teach-card h3 { margin: 0 0 8px; font-size: 18px; }
.teach-card p { margin: 6px 0; line-height: 1.5; }
.teach-card .hack { background: #fff7e6; border-left: 4px solid var(--c-accent-warm); padding: 8px 12px; border-radius: 8px; font-weight: 700; }
.example-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--c-line);
}
.example-row:first-of-type { border-top: none; }
.example-row .ex-en { font-weight: 800; }
.example-row .ex-es { color: var(--c-muted); font-size: 14px; }
.example-row .ex-pron { color: var(--c-primary); font-size: 13px; font-style: italic; }
.example-row .ex-text { flex: 1; min-width: 0; }

/* botón de audio */
.speak-btn {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  border: none; background: var(--c-primary); color: #fff; font-size: 18px;
  cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow);
}
.speak-btn:active { transform: scale(.92); }
.speak-btn.lg { width: 64px; height: 64px; font-size: 26px; }

/* ===== Ejercicios ===== */
.exercise {
  background: var(--c-surface); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.ex-prompt { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.ex-hint { color: var(--c-muted); font-weight: 600; margin: 0 0 16px; }
.ex-input {
  width: 100%; font-family: inherit; font-size: 18px; font-weight: 700;
  padding: 14px 16px; border: 2px solid var(--c-line); border-radius: var(--radius-sm);
  outline: none; color: var(--c-text);
}
.ex-input:focus { border-color: var(--c-primary); }
.ex-options { display: grid; gap: 10px; }
.ex-option {
  text-align: left; font-family: inherit; font-size: 17px; font-weight: 700;
  padding: 14px 16px; border: 2px solid var(--c-line); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; color: var(--c-text); transition: all .12s ease;
}
.ex-option:hover { border-color: var(--c-primary); }
.ex-option.correct { border-color: var(--c-good); background: #e9fbf4; }
.ex-option.wrong { border-color: var(--c-bad); background: #ffeaea; }
.ex-option:disabled { cursor: default; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 800; font-size: 16px;
  padding: 14px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--c-primary); color: #fff; box-shadow: var(--shadow);
  transition: transform .1s ease, background .15s ease;
}
.btn:hover { background: var(--c-primary-dark); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--c-surface); color: var(--c-primary); }
.btn.accent { background: var(--c-accent); }
.btn.block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.feedback { margin-top: 14px; font-weight: 800; font-size: 16px; border-radius: var(--radius-sm); padding: 12px 14px; }
.feedback.good { background: #e9fbf4; color: var(--c-good); }
.feedback.bad { background: #ffeaea; color: var(--c-bad); }
.feedback .sol { display: block; color: var(--c-text); font-weight: 700; margin-top: 4px; }

/* barra de progreso de ejercicios */
.ex-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.ex-progress .bar { flex: 1; }
.ex-progress .count { font-weight: 800; color: var(--c-muted); font-size: 14px; }

/* ===== Vocabulario ===== */
.vocab-groups { display: grid; gap: 14px; }
.vocab-cat {
  width: 100%; text-align: left; background: var(--c-surface); border: none;
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  cursor: pointer; font-weight: 800; font-size: 16px; color: var(--c-text);
  display: flex; justify-content: space-between; align-items: center;
}
.vocab-list { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .vocab-list { grid-template-columns: 1fr 1fr; } }
.vocab-item {
  display: flex; align-items: center; gap: 10px; background: var(--c-surface);
  border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow);
}
.vocab-item .vi-en { font-weight: 800; }
.vocab-item .vi-es { color: var(--c-muted); font-size: 14px; }
.vocab-item .vi-pron { color: var(--c-primary); font-size: 12px; font-style: italic; }
.vocab-item .vi-text { flex: 1; min-width: 0; }

/* ===== Insignias / progreso ===== */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--c-surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 800; color: var(--c-primary); }
.stat-card .lbl { color: var(--c-muted); font-weight: 700; font-size: 13px; }
.badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge { background: var(--c-surface); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.badge.locked { opacity: .4; filter: grayscale(1); }

/* ===== Navegación inferior ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: var(--c-surface); border-top: 1px solid var(--c-line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(108,92,231,.08);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--c-muted); font-weight: 800; font-size: 11px;
  padding: 6px 0; border-radius: 12px; min-height: 48px; justify-content: center;
}
.nav-ico { font-size: 22px; }
.nav-item.active { color: var(--c-primary); }

/* ===== Celebración / confeti ===== */
.celebration { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti {
  position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 1; }
}
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--c-text); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 800; box-shadow: var(--shadow-lg); opacity: 0; z-index: 60;
  transition: opacity .25s ease, transform .25s ease; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Utilidades ===== */
.center { text-align: center; }
.muted { color: var(--c-muted); }
.mt { margin-top: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--c-primary); font-weight: 800; text-decoration: none; margin-bottom: 12px; }
.notice { background: #fff7e6; border-radius: var(--radius-sm); padding: 12px 14px; color: #8a6d3b; font-weight: 700; margin: 12px 0; }
.credit { text-align: center; color: var(--c-muted); font-size: 12px; margin-top: 24px; font-weight: 600; }
.credit a { color: var(--c-primary); }
.big-emoji { font-size: 64px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
