:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-alt: #fbfaf7;
  --ink: #1e2430;
  --ink-muted: #5a6475;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #f59e0b;
  --accent-soft: #fef3c7;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --purple: #7c3aed;
  --purple-soft: #f3e8ff;
  --border: #e2e8f0;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.08);
  --font-sans: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header & Stepper */
.app-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 65%, #3b82f6 100%);
  color: #fff;
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.16);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-title {
  font-size: clamp(1.25rem, 2.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.92rem;
  opacity: 0.9;
  margin-top: 0.2rem;
}

.progress-pill {
  background: rgba(255, 255, 255, 0.18);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

/* Stepper Navigation */
.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.step-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.88);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  transition: all 0.2s ease;
}

.step-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.step-btn.active {
  background: #ffffff;
  color: var(--primary-dark);
  border-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.step-btn.active .step-num {
  background: var(--primary);
  color: #fff;
}

.step-btn.completed .step-num {
  background: var(--success);
  color: #fff;
}

.step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main Container */
.main-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 4rem;
}

.module-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.module-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Typography */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.section-desc {
  color: var(--ink-muted);
  font-size: 1rem;
  max-width: 78ch;
}

.info-callout {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1rem 0 1.5rem;
  font-size: 0.96rem;
}

.info-callout strong {
  color: #92400e;
}

.tip-callout {
  background: var(--purple-soft);
  border-left: 4px solid var(--purple);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1rem 0 1.5rem;
  font-size: 0.96rem;
}

/* Step 1: Pairs Gallery */
.pairs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

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

.pair-header {
  background: var(--surface-alt);
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.05rem;
}

.pair-vs {
  font-size: 0.78rem;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.pair-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
}

.pair-side {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pair-side:first-child {
  border-right: 1px solid var(--border);
}

.pair-img-wrap {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.pair-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.verb-pill {
  display: inline-block;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.verb-pill.non-pron {
  background: #e0f2fe;
  color: #0369a1;
}

.verb-pill.pron {
  background: #fef3c7;
  color: #b45309;
}

.pair-meaning {
  font-size: 0.86rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.pair-example {
  font-size: 0.84rem;
  font-style: italic;
  color: var(--ink);
  background: var(--surface-alt);
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-top: auto;
}

/* Step 1 Quiz: Image Guessing */
.quiz-box {
  background: var(--surface);
  border: 2px solid var(--primary-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.quiz-top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.quiz-prompt-verb {
  font-size: clamp(1.3rem, 2.5vw, 1.7rem);
  font-weight: 800;
  color: var(--primary-dark);
}

.quiz-prompt-clue {
  font-size: 1rem;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
}

.img-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.img-option-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.img-option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.img-option-btn img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.img-option-btn.correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.img-option-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  opacity: 0.75;
}

.feedback-banner {
  margin-top: 1.15rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  display: none;
}

.feedback-banner.show {
  display: block;
}

.feedback-banner.success {
  background: var(--success-soft);
  color: #166534;
  border: 1px solid #86efac;
}

.feedback-banner.error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Step 2: Pronominal vs Non-pronominal */
.pron-items-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}

.pron-item-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pron-item-card.answered-ok {
  border-color: var(--success);
  background: #f0fdf4;
}

.pron-item-card.answered-err {
  border-color: var(--danger);
  background: #fef2f2;
}

.pron-sentence {
  font-size: 1rem;
  font-weight: 600;
}

.pron-infinitive {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.choice-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.choice-btn {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice-btn.selected-correct {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.choice-btn.selected-wrong {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.pron-explain {
  font-size: 0.84rem;
  color: var(--ink-muted);
  display: none;
}

.pron-explain.show {
  display: block;
}

/* Step 3: Vocabulary & Conjugation Trainer */
.vocab-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.vocab-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
}

.vocab-chip-term {
  font-weight: 800;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.vocab-chip-def {
  font-size: 0.84rem;
  color: var(--ink-muted);
  margin-top: 0.2rem;
}

.conj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.conj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow: var(--shadow-sm);
}

.conj-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.conj-inf {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--ink);
}

.conj-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.conj-model {
  font-size: 0.84rem;
  background: var(--surface-alt);
  border: 1px dashed #cbd5e1;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
}

.conj-model strong {
  color: var(--ink);
}

.conj-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.conj-input-row span {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 700;
  white-space: nowrap;
}

.text-input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: border-color 0.15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
}

.text-input.ok {
  border-color: var(--success);
  background: #f0fdf4;
  color: #166534;
}

.text-input.err {
  border-color: var(--danger);
  background: #fef2f2;
  color: #991b1b;
}

/* Step 4: Exercise 6 */
.ex6-header-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ex6-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f59e0b;
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  border-radius: 6px;
  margin-right: 0.6rem;
}

.verb-bank {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  background: #f1ede4;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid #dfd8c8;
  margin-bottom: 1.5rem;
}

.bank-chip {
  background: #ffffff;
  border: 1px solid #d6cfc0;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.bank-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.bank-chip.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
}

.bank-chip.used {
  opacity: 0.45;
  text-decoration: line-through;
  background: #e2e8f0;
}

.story-paper {
  background: #fffdf9;
  border: 1px solid #e5dec9;
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  font-size: clamp(1.02rem, 1.8vw, 1.15rem);
  line-height: 2.25;
  color: #1e293b;
  box-shadow: var(--shadow-sm);
}

.gap-input {
  display: inline-block;
  width: 130px;
  max-width: 100%;
  border: none;
  border-bottom: 2px solid #94a3b8;
  background: rgba(37, 99, 235, 0.05);
  border-radius: 4px 4px 0 0;
  padding: 0.1rem 0.45rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  margin: 0 0.15rem;
  transition: all 0.15s;
}

.gap-input:focus {
  outline: none;
  border-bottom-color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
}

.gap-input.ok {
  border-bottom-color: var(--success);
  background: var(--success-soft);
  color: #166534;
}

.gap-input.err {
  border-bottom-color: var(--danger);
  background: var(--danger-soft);
  color: #991b1b;
}

/* Buttons */
.actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.68rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-alt);
  border-color: #94a3b8;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
}

.score-badge {
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .stepper {
    grid-template-columns: repeat(2, 1fr);
  }
  .img-options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .verb-bank {
    grid-template-columns: repeat(2, 1fr);
  }
  .pair-sides {
    grid-template-columns: 1fr;
  }
  .pair-side:first-child {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 1rem 0.9rem;
  }
  .main-container {
    padding: 1.1rem 0.85rem 3rem;
  }
  .card {
    padding: 1.1rem;
  }
  .gap-input {
    width: 112px;
  }
}

/* Barra de Clase en Vivo */
.live-bar {
  margin-top: 0.75rem;
  background: rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  font-size: 0.86rem;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}

.live-dot.connected {
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.live-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.live-btn {
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary-dark);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.live-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

.live-btn.secondary {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.remote-focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35) !important;
  border-color: var(--primary) !important;
}

