/* ============================================
   STORIES — Historias interactivas por nivel
   ============================================ */

/* ── Header de historia ── */
.story-header {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 2.5rem 0 2rem;
  margin-bottom: 2.5rem;
}
.story-back {
  font-size: .875rem;
  color: var(--color-text-muted);
  font-weight: var(--weight-medium);
  transition: color var(--transition);
  display: inline-block;
  margin-bottom: 1rem;
}
.story-back:hover { color: var(--color-primary); }
.story-level-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .3rem .9rem;
  border-radius: 9999px;
  margin-bottom: .75rem;
}
.story-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  margin: .25rem 0 .5rem;
  line-height: 1.2;
}
.story-meta {
  color: var(--color-text-muted);
  font-size: .9375rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.story-meta-item { display: flex; align-items: center; gap: .35rem; }

/* ── Controles de audio ── */
.story-audio-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1.25rem;
  padding: .875rem 1.25rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: 420px;
}
.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-full);
  font-size: .875rem;
  font-weight: var(--weight-semi);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.audio-btn-play {
  background: var(--color-primary);
  color: #fff;
}
.audio-btn-play:hover { background: var(--color-primary-dk); }
.audio-btn-stop {
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.audio-btn-stop:hover { color: var(--color-text); border-color: var(--color-text-muted); }
.audio-hint { font-size: .8125rem; color: var(--color-text-muted); }

/* ── Texto de la historia ── */
.story-body {
  max-width: 680px;
  margin: 0 auto 3rem;
}
.story-paragraph {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--color-text);
  margin-bottom: 1.25rem;
}

/* ── Palabras interactivas ── */
.vocab-word {
  color: var(--color-primary);
  font-weight: var(--weight-semi);
  border-bottom: 2px dotted var(--color-primary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.vocab-word:hover {
  background: var(--color-primary-lt);
  border-radius: 3px;
  padding: 0 2px;
}
.vocab-word.active {
  background: var(--color-primary-lt);
  border-radius: 3px;
  padding: 0 2px;
}

/* ── Tooltip de vocabulario ── */
.vocab-tooltip {
  position: fixed;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-width: 280px;
  z-index: 500;
  display: none;
  animation: tooltipIn .15s ease;
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tooltip-word {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.tooltip-phonetic {
  font-size: .875rem;
  color: var(--color-text-muted);
  margin: .2rem 0 .5rem;
  font-style: italic;
}
.tooltip-translation {
  font-size: .9375rem;
  color: var(--color-primary);
  font-weight: var(--weight-semi);
  padding: .4rem .75rem;
  background: var(--color-primary-lt);
  border-radius: var(--radius-sm);
  display: inline-block;
}
.tooltip-audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  transition: transform var(--transition);
}
.tooltip-audio-btn:hover { transform: scale(1.2); }
.tooltip-close {
  position: absolute;
  top: .5rem; right: .6rem;
  background: none; border: none;
  color: var(--color-text-muted);
  cursor: pointer; font-size: .9rem;
}

/* ── Preguntas de comprensión ── */
.story-questions {
  background: var(--color-bg-alt);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 3rem;
}
.questions-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}
.question-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
.question-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.question-text {
  font-size: .9375rem;
  font-weight: var(--weight-semi);
  margin-bottom: .75rem;
  color: var(--color-text);
}
.question-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.q-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .9rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: .9375rem;
  background: var(--color-surface);
  transition: all var(--transition);
  user-select: none;
}
.q-option:hover { border-color: var(--color-primary); }
.q-option.correct { border-color: var(--color-accent); background: #ecfdf5; color: #065f46; }
.q-option.incorrect { border-color: #ef4444; background: #fef2f2; color: #991b1b; }
.q-option input { display: none; }

/* ── Resultado final ── */
.story-complete {
  text-align: center;
  padding: 2rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  margin-bottom: 3rem;
  display: none;
}
.story-complete.show { display: block; }
.story-complete-icon { font-size: 3rem; margin-bottom: .75rem; }
.story-complete-title { font-size: 1.375rem; font-weight: 700; margin-bottom: .5rem; }
.story-complete-sub { color: var(--color-text-muted); margin-bottom: 1.5rem; }
.story-complete-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ── Badge de nivel por color ── */
.badge-a1 { background: #dbeafe; color: #1e40af; }
.badge-a2 { background: #dcfce7; color: #166534; }
.badge-b1 { background: #fef3c7; color: #92400e; }
.badge-b2 { background: #fce7f3; color: #9d174d; }
.badge-c1 { background: #f5f3ff; color: #3b1f6e; }

/* ── Índice de historias ── */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}
.story-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  text-decoration: none;
  transition: all var(--transition);
}
.story-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.sc-badge { align-self: flex-start; }
.sc-title { font-size: 1.0625rem; font-weight: var(--weight-semi); color: var(--color-text); }
.sc-desc { font-size: .875rem; color: var(--color-text-muted); line-height: 1.5; }
.sc-meta { font-size: .8125rem; color: var(--color-text-light); display: flex; gap: 1rem; margin-top: .25rem; }

/* ── Selector de voz ── */
.voice-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: .2rem;
}
.voice-btn {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .75rem;
  border-radius: var(--radius-full);
  border: none;
  background: none;
  font-size: .8125rem;
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.voice-btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.voice-btn:hover:not(.active) { color: var(--color-text); }

/* ── Nota de contexto ── */
.story-context {
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: .875rem 1.25rem;
  margin-bottom: 2rem;
  font-size: .9375rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}
.story-context strong { color: var(--color-text); }

/* ── Vocab en lecciones (botón audio) ── */
.vc-audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: .2rem .3rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: all var(--transition);
  line-height: 1;
}
.vc-audio-btn:hover {
  background: var(--color-primary-lt);
  color: var(--color-primary);
}
