/* ═══════════════════════════════════════════════════════
   HubFlow — Components (Unified Learn Platform tokens)
   Warm analog aesthetic: tactile cards, restrained pills,
   editorial flashcards, hand-crafted details
   ═══════════════════════════════════════════════════════ */

@import url('./ex-bottom-nav.css');

/* Top bar + learnflow-signature: exercise-enhanced.css (shell-ready / top-bar--secondary) */

/* ─── BUTTONS ───
   Legacy .btn block removed — all exercises migrated to .lp-btn (buttons.css).
   See AGENTS.md for canonical button spec. */

/* ─── PILL TABS ─── */
/* Scroll horizontal por defecto: en pantallas angostas (≤375px) las bars de 4-5
   modos desbordaban la página entera (31 ejercicios sin --scroll). El modificador
   --scroll se conserva por compatibilidad pero ya es redundante. */
.pill-bar {
  display: flex; background: var(--lp-bg-paper); border-radius: var(--lp-radius-sm);
  padding: 3px; gap: 2px; border: 1.5px solid var(--lp-border);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.pill-bar::-webkit-scrollbar { display: none; }
.pill-bar--scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pill-bar--scroll::-webkit-scrollbar { display: none; }

.pill-btn {
  flex: 1 0 auto; font-family: var(--lp-font-body); font-size: .7rem; font-weight: var(--lp-weight-bold);
  padding: 7px 10px; border-radius: var(--lp-radius-full); border: none; cursor: pointer;
  transition: all .2s var(--lp-ease); color: var(--lp-muted); background: transparent;
  text-align: center; min-height: 36px; white-space: nowrap; position: relative;
}
/* Área táctil extendida a 44px sin alterar el tamaño visual */
.pill-btn::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%); height: 44px; min-height: 44px;
}
.pill-btn:hover { color: var(--lp-ink-soft); background: var(--lp-surface); }

/* Mode pills — chip azul discreto homologado (Study/Practice/Timed/etc.) */
.pill-bar .pill-btn.active,
.pill-bar .pill-btn.active:is(.purple, .green, .red, .orange, .teal),
.ex-header__modes .pill-btn.active,
.ex-header__modes .pill-btn.active:is(.purple, .green, .red, .orange, .teal),
.wrap[data-color] .pill-bar .pill-btn.active,
.wrap[data-color] .pill-bar .pill-btn.active:is(.purple, .green, .red, .orange, .teal),
.wrap[data-color] .ex-header__modes .pill-btn.active,
.wrap[data-color] .ex-header__modes .pill-btn.active:is(.purple, .green, .red, .orange, .teal) {
  background: var(--lp-chip-active-bg);
  color: var(--lp-chip-active-text);
  border: 1.5px solid var(--lp-chip-active-border);
  box-shadow: var(--lp-chip-active-shadow);
  font-weight: var(--lp-weight-extrabold);
}
.pill-bar .pill-btn.active:hover,
.pill-bar .pill-btn.active:is(.purple, .green, .red, .orange, .teal):hover,
.ex-header__modes .pill-btn.active:hover,
.ex-header__modes .pill-btn.active:is(.purple, .green, .red, .orange, .teal):hover {
  background: var(--lp-chip-active-bg-hover);
  color: var(--lp-chip-active-text);
  border-color: var(--lp-chip-active-border);
}

/* Fallback fuera de .pill-bar (legacy) */
.pill-btn.active {
  background: var(--lp-chip-active-bg);
  color: var(--lp-chip-active-text);
  border: 1.5px solid var(--lp-chip-active-border);
  box-shadow: var(--lp-chip-active-shadow);
  font-weight: var(--lp-weight-extrabold);
}

/* ─── PROGRESS BAR ─── */
.progress { margin-bottom: 6px; }
.progress__labels {
  display: flex; justify-content: space-between;
  font-size: .62rem; font-weight: var(--lp-weight-bold); color: var(--lp-muted); margin-bottom: 3px;
}
.progress__track { height: var(--lp-progress-height); background: var(--lp-border); border-radius: var(--lp-radius-full); overflow: hidden; }
.progress__fill {
  height: 100%; border-radius: var(--lp-radius-full); transition: width .5s var(--lp-ease); width: 0%;
  background: var(--lp-accent);
}
.progress__fill--purple { background: var(--lp-cat-purple); }

/* ─── TIMER ─── */
.timer-bar { display: none; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.timer-bar.show { display: flex; }
.timer-display {
  font-family: var(--lp-font-mono); font-weight: var(--lp-weight-bold); font-size: 1rem; color: var(--lp-error);
}
.timer-display.warn { animation: pulse .5s infinite alternate; }

/* ─── FLASHCARD ─── */
.fc-card {
  width: 100%; max-width: 720px; height: 260px;
  cursor: pointer; perspective: 1200px; position: relative;
}
.fc-inner {
  position: absolute; inset: 0; border-radius: var(--lp-radius-lg);
  transition: transform .5s var(--lp-ease), opacity .15s;
  transform-style: preserve-3d; will-change: transform;
}
.fc-card.flip .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: var(--lp-radius-lg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; gap: 8px;
  text-align: center; background: var(--lp-surface);
  border: 1.5px solid var(--lp-border); box-shadow: var(--lp-shadow-sm);
}
.fc-back {
  transform: rotateY(180deg);
  background: var(--lp-accent-soft); border-color: var(--lp-accent);
  box-shadow: var(--lp-shadow-lg);
}
[data-theme="dark"] .fc-back { background: var(--lp-surface); border-color: var(--lp-accent); }
.fc-emoji { font-size: 2.8rem; line-height: 1; }
.fc-term { font-family: var(--lp-font-display); font-size: 1.8rem; font-weight: var(--lp-weight-semibold); color: var(--lp-ink); letter-spacing: -.01em; }
.fc-detail {
  font-family: var(--lp-font-mono); font-size: .72rem;
  color: var(--lp-ink-soft); text-align: center; line-height: 1.5;
  white-space: pre-line; max-width: 320px;
}
.fc-hint { font-size: .62rem; color: var(--lp-muted); font-weight: var(--lp-weight-semibold); margin-top: 4px; font-style: italic; }
.fc-count {
  font-family: var(--lp-font-mono); font-size: .65rem;
  color: var(--lp-muted); font-weight: var(--lp-weight-bold); letter-spacing: 1px;
}

/* ─── QUIZ ─── */
.quiz-prompt {
  width: 100%; max-width: 440px; text-align: center;
  background: var(--lp-surface); border: 1.5px solid var(--lp-border);
  border-radius: var(--lp-radius-lg); padding: 18px; box-shadow: var(--lp-shadow-sm);
}
.quiz-prompt__label {
  font-size: .6rem; font-weight: var(--lp-weight-bold); color: var(--lp-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px;
}
.quiz-prompt__text { font-family: var(--lp-font-display); font-size: 1.25rem; font-weight: var(--lp-weight-medium); color: var(--lp-ink); line-height: 1.3; }
.quiz-prompt__emoji { font-size: 1.8rem; margin-bottom: 4px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; max-width: 440px; }
@media (max-width: 639px) { .quiz-options { grid-template-columns: 1fr; } }

.quiz-opt {
  font-family: var(--lp-font-body); font-weight: var(--lp-weight-bold); font-size: .8rem;
  padding: 11px 14px; border-radius: var(--lp-radius-sm); border: 1.5px solid var(--lp-border);
  background: var(--lp-surface); color: var(--lp-ink); cursor: pointer;
  transition: all .2s var(--lp-ease); text-align: center;
}
@media (hover: hover) {
  .quiz-opt:hover:not(.disabled) { border-color: var(--lp-accent); background: var(--lp-accent-soft); transform: translateY(-1px); }
}
.quiz-opt.correct { border-color: var(--lp-success); background: var(--lp-success-soft); color: var(--lp-success-dark); }
.quiz-opt.wrong { border-color: var(--lp-error); background: var(--lp-error-soft); color: var(--lp-error-dark); }
.quiz-opt.disabled { cursor: default; opacity: .65; }
[data-theme="dark"] .quiz-opt.correct { background: color-mix(in srgb, var(--lp-success) 35%, transparent); border-color: color-mix(in srgb, var(--lp-success) 55%, white); color: color-mix(in srgb, var(--lp-success) 55%, white); box-shadow: 0 0 0 1px color-mix(in srgb, var(--lp-success) 30%, transparent); }
[data-theme="dark"] .quiz-opt.wrong { background: color-mix(in srgb, var(--lp-error) 35%, transparent); border-color: color-mix(in srgb, var(--lp-error) 45%, white); color: color-mix(in srgb, var(--lp-error) 45%, white); box-shadow: 0 0 0 1px color-mix(in srgb, var(--lp-error) 30%, transparent); }

/* ─── PAIR MATCH ─── */
.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; width: 100%; max-width: 720px; }
@media (max-width: 639px) { .pair-grid { gap: 6px 8px; } }
.pair-col-label {
  font-size: .6rem; font-weight: var(--lp-weight-bold); color: var(--lp-muted);
  text-transform: uppercase; letter-spacing: .05em; text-align: center; padding-bottom: 4px;
}
.pair-item {
  font-family: var(--lp-font-body); font-weight: var(--lp-weight-bold); font-size: .76rem;
  padding: 9px 12px; border-radius: var(--lp-radius-sm); border: 1.5px solid var(--lp-border);
  background: var(--lp-surface); color: var(--lp-ink); cursor: pointer;
  transition: all .2s; text-align: center; user-select: none;
  display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px;
}
.pair-item:hover:not(.matched):not(.selected) { border-color: var(--lp-accent); background: var(--lp-accent-soft); }
.pair-item.selected { border-color: var(--lp-accent); background: var(--lp-accent-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--lp-accent) 15%, transparent); }
.pair-item.matched { border-color: var(--lp-success); background: var(--lp-success-soft); color: var(--lp-success-dark); cursor: default; opacity: .75; }
.pair-item.wrong-flash { border-color: var(--lp-error); background: var(--lp-error-soft); animation: shake .3s; }
[data-theme="dark"] .pair-item.matched { color: color-mix(in srgb, var(--lp-success) 55%, white); }

/* ─── RESULT OVERLAY ─── */
.result-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--lp-bg); backdrop-filter: none;
  align-items: center; justify-content: center; z-index: 200; padding: 16px;
}
.result-overlay.show { display: flex; }
.result-box {
  background: var(--lp-surface); border: 1.5px solid var(--lp-border);
  border-radius: var(--lp-radius-lg); padding: 28px;
  max-width: 360px; width: 100%; text-align: center;
  box-shadow: var(--lp-shadow-lg); animation: popIn .18s var(--lp-ease);
  position: relative;
}
.result-close {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--lp-ink) 10%, transparent);
  border: 1.5px solid var(--lp-border); border-radius: 50%;
  font-size: 1rem; font-weight: 700; color: var(--lp-ink); cursor: pointer;
  transition: color .2s, background .2s, transform .2s;
  line-height: 1;
}
.result-close:hover { background: color-mix(in srgb, var(--lp-ink) 18%, transparent); transform: scale(1.06); }
.result-close:active { transform: scale(0.97); }
.result-close:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.result-stars { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.result-star { font-size: 2rem; opacity: .2; transition: opacity .15s, transform .15s; }
.result-star.lit { opacity: 1; transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
  .result-box { animation: none; }
  .result-star { transition: none; }
}
.result-title { font-family: var(--lp-font-display); font-weight: var(--lp-weight-semibold); font-size: 1.4rem; color: var(--lp-ink); margin-bottom: 4px; }
.result-sub { font-size: .8rem; color: var(--lp-muted); font-weight: var(--lp-weight-semibold); margin-bottom: 14px; }
.result-time { font-size: .85rem; color: var(--lp-accent); font-weight: var(--lp-weight-semibold); margin-bottom: 14px; margin-top: -8px; }
.result-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ─── BATTLE ─── */
.battle-scores {
  display: flex; gap: 12px; justify-content: center; align-items: center;
  margin: 0 0 6px; width: 100%;
}
.player-score {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 16px; border-radius: var(--lp-radius-sm);
  background: var(--lp-surface); border: 1.5px solid var(--lp-border); min-width: 80px;
}
.player-score.p1 { border-color: var(--lp-cat-blue); }
.player-score.p2 { border-color: var(--lp-warning); }
.player-score .p-label { font-size: .5rem; font-weight: var(--lp-weight-extrabold); text-transform: uppercase; letter-spacing: .05em; color: var(--lp-muted); }
.player-score .p-points { font-family: var(--lp-font-display); font-size: 1.4rem; font-weight: var(--lp-weight-semibold); }
.player-score.p1 .p-points { color: var(--lp-cat-blue); }
.player-score.p2 .p-points { color: var(--lp-warning); }
.vs-badge { font-family: var(--lp-font-display); font-size: .8rem; font-style: italic; color: var(--lp-muted); }

/* ─── SPELLING CARDS ─── */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 5px; width: 100%;
}
.word-card {
  background: var(--lp-surface); border: 1.5px solid var(--lp-border); border-radius: var(--lp-radius-sm);
  padding: 6px 8px 5px; text-align: center; position: relative;
  transition: border-color .2s, background .2s;
}
.word-card__verb {
  font-family: var(--lp-font-display); font-weight: var(--lp-weight-semibold); font-size: .85rem;
  color: var(--lp-ink); margin-bottom: 2px;
}
.word-card__input {
  width: 100%; font-family: var(--lp-font-mono); font-weight: var(--lp-weight-semibold);
  font-size: .72rem; text-align: center; padding: 4px 6px;
  border-radius: 4px; border: 1.5px solid var(--lp-border);
  background: var(--lp-bg-paper); color: var(--lp-ink); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.word-card__input:focus { border-color: var(--lp-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--lp-accent) 10%, transparent); }
.word-card.correct { border-color: var(--lp-success); background: var(--lp-success-soft); }
.word-card.wrong { border-color: var(--lp-error); background: var(--lp-error-soft); }
.word-card.correct .word-card__input { border-color: var(--lp-success); }
.word-card.wrong .word-card__input { border-color: var(--lp-error); }

/* ─── SELECT INPUT (Noun Adjuncts) ─── */
.word-card__select {
  width: 100%; font-family: var(--lp-font-mono); font-weight: var(--lp-weight-semibold);
  font-size: .72rem; text-align: center; padding: 6px 8px;
  border-radius: 4px; border: 1.5px solid var(--lp-border);
  background: var(--lp-bg-paper); color: var(--lp-ink); outline: none;
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  transition: border-color .2s, box-shadow .2s;
}
.word-card__select:focus { border-color: var(--lp-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--lp-accent) 10%, transparent); }
.word-card__select option[disabled] { color: var(--lp-muted); }
.word-card.correct .word-card__select { border-color: var(--lp-success); }
.word-card.wrong .word-card__select { border-color: var(--lp-error); }

/* ─── COLOR PICKER ─── */
.color-picker { display: flex; gap: 4px; justify-content: center; margin-top: 3px; }
.color-dot {
  width: 12px; height: 12px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s, border-color .15s;
}
.color-dot:hover { transform: scale(1.2); }
.color-dot.selected { border-color: var(--lp-ink); transform: scale(1.15); }
.color-dot.red { background: var(--lp-error); }
.color-dot.blue { background: var(--lp-cat-blue); }
.color-dot.green { background: var(--lp-success); }

/* ─── RESPONSIVE ─── */
@media (max-width: 639px) {
  .wrap { padding: 0 10px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 5px; }
  .fc-card { height: 220px; }
  .fc-emoji { font-size: 2.2rem; }
  .fc-term { font-size: 1.4rem; }
}

/* ═══ Category pills + Word options — centralizado (INFORME-BOTONES Fase D) ═══
   Antes duplicados inline en ~30/21 ejercicios. Colores tokenizados. */

.cat-btn {
  font-family: var(--lp-font-body);
  font-size: .68rem; font-weight: var(--lp-weight-bold);
  padding: 8px 12px; border-radius: var(--lp-radius-md);
  border: 1.5px solid var(--lp-border); background: var(--lp-surface); color: var(--lp-muted);
  cursor: pointer; transition: all .2s var(--lp-ease); white-space: nowrap;
  min-height: 36px; position: relative; scroll-snap-align: start; flex-shrink: 0;
}
/* Hit-area táctil 44px sin agrandar el visual (INFORME-BOTONES §3.4 rec.6) */
.cat-btn::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%); height: 44px; min-height: 44px;
}
.cat-btn:hover {
  border-color: color-mix(in srgb, var(--lp-accent) 40%, var(--lp-border));
  color: var(--lp-accent-text);
  background: color-mix(in srgb, var(--lp-accent) 6%, var(--lp-surface));
}
.cat-btn:focus-visible {
  outline: 2px solid var(--lp-accent);
  outline-offset: 2px;
}
.cat-btn.active {
  background: var(--lp-chip-active-bg);
  color: var(--lp-chip-active-text);
  border-color: var(--lp-chip-active-border);
  box-shadow: var(--lp-chip-active-shadow);
  font-weight: var(--lp-weight-extrabold);
}
.cat-btn.active:hover {
  background: var(--lp-chip-active-bg-hover);
  color: var(--lp-chip-active-text);
  border-color: var(--lp-chip-active-border);
}
.cat-btn.locked {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Cat-bar pills (vocabulary, opposites, etc.) — mismo chip que .cat-btn */
.cat-scroll-wrapper .pill-btn {
  border: 1.5px solid var(--lp-border);
  background: var(--lp-surface);
  color: var(--lp-muted);
}
.cat-scroll-wrapper .pill-btn.active,
.cat-scroll-wrapper #catBar .pill-btn.active {
  background: var(--lp-chip-active-bg);
  color: var(--lp-chip-active-text);
  border-color: var(--lp-chip-active-border);
  box-shadow: var(--lp-chip-active-shadow);
  font-weight: var(--lp-weight-extrabold);
}
.cat-scroll-wrapper .pill-btn.active:hover,
.cat-scroll-wrapper #catBar .pill-btn.active:hover {
  background: var(--lp-chip-active-bg-hover);
  color: var(--lp-chip-active-text);
  border-color: var(--lp-chip-active-border);
}

/* Cat-bar: scroll horizontal + expander (patrón unificado HubFlow).
   .cat-scroll-wrapper aporta fades laterales; .cat-expand-btn muestra +N ocultos. */
.cat-scroll-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
  min-height: 44px;
}
.cat-scroll-wrapper::before,
.cat-scroll-wrapper::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity .2s;
}
.cat-scroll-wrapper::before {
  left: 0;
  width: 28px;
  background: linear-gradient(to right, var(--lp-bg-paper), transparent);
  border-radius: var(--lp-radius-sm) 0 0 var(--lp-radius-sm);
}
.cat-scroll-wrapper::after {
  right: 0;
  width: 48px;
  background: linear-gradient(to left, var(--lp-bg-paper) 40%, transparent);
  border-radius: 0 var(--lp-radius-sm) var(--lp-radius-sm) 0;
}
.cat-scroll-wrapper.fade-left::before { opacity: 1; }
.cat-scroll-wrapper.fade-right::after { opacity: 1; }

.cat-scroll-wrapper .cat-bar,
.cat-scroll-wrapper #catBar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 0;
  padding: 6px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  background: var(--lp-bg-paper);
  border: 1.5px solid var(--lp-border);
  border-radius: var(--lp-radius-sm);
  transition: flex-wrap 0s;
}
.cat-scroll-wrapper .cat-bar::-webkit-scrollbar,
.cat-scroll-wrapper #catBar::-webkit-scrollbar { display: none; }

.cat-expand-btn {
  flex: 0 0 auto;
  position: sticky;
  right: 0;
  min-width: 36px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--lp-radius-full, 999px);
  border: none;
  background: var(--lp-accent);
  color: var(--lp-ink-inverse, #fff);
  font-family: var(--lp-font-mono);
  font-size: .7rem;
  font-weight: var(--lp-weight-bold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background .2s, transform .2s, box-shadow .2s;
  z-index: 3;
  white-space: nowrap;
  box-shadow: -6px 0 12px -2px var(--lp-bg-paper), 0 2px 6px color-mix(in srgb, var(--lp-accent) 30%, transparent);
}
.cat-expand-btn::after {
  content: ''; position: absolute; inset: 50%; translate: -50% -50%;
  min-width: 44px; min-height: 44px;
}
.cat-expand-btn:hover {
  transform: scale(1.06);
  box-shadow: -6px 0 12px -2px var(--lp-bg-paper), 0 3px 10px color-mix(in srgb, var(--lp-accent) 40%, transparent);
}
.cat-expand-btn:active { transform: scale(0.97); }
.cat-expand-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.cat-expand-btn:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.cat-expand-btn[aria-expanded="true"] {
  background: color-mix(in srgb, var(--lp-accent) 80%, black);
}
.cat-expand-btn .expand-count { letter-spacing: -.02em; }
.cat-expand-btn .expand-icon {
  font-size: .55rem;
  transition: transform .2s;
  display: inline-block;
}
.cat-expand-btn[aria-expanded="true"] .expand-icon { transform: rotate(180deg); }

@keyframes nudge-badge {
  0%, 100% { transform: scale(1); box-shadow: -6px 0 12px -2px var(--lp-bg-paper), 0 2px 6px color-mix(in srgb, var(--lp-accent) 30%, transparent); }
  50% { transform: scale(1.15); box-shadow: -6px 0 12px -2px var(--lp-bg-paper), 0 4px 16px color-mix(in srgb, var(--lp-accent) 55%, transparent); }
}
.cat-expand-btn.nudge { animation: nudge-badge .5s ease-in-out 2; }

.cat-scroll-wrapper .scroll-hint-bar {
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 2px;
  border-radius: 1px;
  background: var(--lp-accent);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity .3s, transform .6s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
  z-index: 4;
}
.cat-scroll-wrapper .scroll-hint-bar.flash {
  opacity: .7;
  transform: scaleX(1);
}

.cat-scroll-wrapper.expanded .cat-bar,
.cat-scroll-wrapper.expanded #catBar {
  flex-wrap: wrap;
  overflow-x: visible;
  gap: 5px;
  padding: 8px 6px;
}
.cat-scroll-wrapper.expanded .cat-expand-btn {
  position: relative;
  right: auto;
  margin-left: auto;
}
.cat-scroll-wrapper.expanded::before,
.cat-scroll-wrapper.expanded::after { opacity: 0 !important; }

/* Icon-only category pills (phonics — 4 distinct emojis fit on mobile) */
.cat-scroll-wrapper--icon-pills .cat-btn {
  font-size: 1.05rem;
  padding: 8px 12px;
  min-width: 44px;
  text-align: center;
}
.cat-scroll-wrapper--icon-pills.expanded .cat-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 1rem;
  padding: 8px 10px;
  min-width: 52px;
}
.cat-scroll-wrapper--icon-pills.expanded .cat-btn::after {
  content: attr(aria-label);
  font-size: .56rem;
  font-family: var(--lp-font-body);
  font-weight: var(--lp-weight-bold);
  line-height: 1.1;
  color: inherit;
}

.cat-bar {
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}
.cat-bar::-webkit-scrollbar { display: none; }

.word-options { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 480px; }
.word-opt {
  font-family: var(--lp-font-body); font-weight: var(--lp-weight-bold); font-size: .88rem;
  padding: 12px 20px; border-radius: var(--lp-radius-md); border: 1.5px solid var(--lp-border);
  background: var(--lp-surface); color: var(--lp-ink); cursor: pointer;
  transition: all .2s var(--lp-ease); min-width: 60px; text-align: center;
}
.word-opt:hover:not(.disabled) { border-color: var(--lp-cat-blue); background: color-mix(in srgb, var(--lp-cat-blue) 8%, transparent); transform: translateY(-2px); }
.word-opt.correct { border-color: var(--lp-success); background: var(--lp-success-soft); color: var(--lp-success-dark); }
.word-opt.wrong { border-color: var(--lp-error); background: var(--lp-error-soft); color: var(--lp-error-dark); }
.word-opt.disabled { cursor: default; opacity: .7; }
[data-theme="dark"] .word-opt.correct { color: color-mix(in srgb, var(--lp-success) 55%, white); }
[data-theme="dark"] .word-opt.wrong { color: color-mix(in srgb, var(--lp-error) 45%, white); }
@media (max-width: 639px) { .word-opt { min-width: 50px; padding: 10px 14px; font-size: .8rem; } }

/* Header de ejercicio: acciones agrupadas a la derecha (portal + tema) — Fase E */
.tb-actions { display: flex; align-items: center; gap: 8px; }

/* ─── PILL BAR MOBILE: scroll when tabs don't fit (e.g. 5 modes) ─── */
@media (max-width: 639px) {
  .pill-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 2px;
  }
  .pill-bar::-webkit-scrollbar { display: none; }
  .pill-btn {
    flex: 0 0 auto;
    padding: 5px 7px;
    font-size: 0.56rem;
    min-height: 32px;
    min-width: 0;
  }
}

/* ═══ FEEDBACK CALLOUTS (hint / explain — all exercises) ═══ */

.hint-box,
.explain-box {
  width: 100%;
  max-width: 720px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--lp-ink-soft);
  background: var(--lp-bg-paper);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-md);
  padding: 10px 12px;
  text-align: left;
}

.hint-box {
  display: none;
  border-left: 3px solid var(--lp-warning);
}

.hint-box.show {
  display: block;
}

.explain-box:empty {
  display: none;
  padding: 0;
  margin: 0;
  border: none;
  min-height: 0;
}

.explain-box:not(:empty) {
  display: block;
  border-left: 3px solid var(--lp-accent);
  animation: lpFeedbackIn 0.2s ease both;
}

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

@media (prefers-reduced-motion: reduce) {
  .explain-box:not(:empty) { animation: none; }
}

/* ═══ LESSON PROGRESS (detail button — bar removed; button lives in .fc-nav) ═══ */

.lesson-progress--anchor {
  display: none !important;
}

/* ═══ PROGRESS DETAIL MODAL ═══ */

.pg-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.pg-modal--open {
  opacity: 1;
  pointer-events: auto;
}

.pg-modal__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--lp-ink) 45%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

[data-theme="dark"] .pg-modal__backdrop {
  background: color-mix(in srgb, #14171c 55%, transparent);
}

.pg-modal__panel {
  position: relative;
  width: min(100%, 360px);
  max-height: min(480px, calc(100dvh - 40px));
  background: var(--lp-bg-paper, var(--lp-surface));
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-lg);
  box-shadow:
    0 24px 48px color-mix(in srgb, var(--lp-ink) 18%, transparent),
    0 4px 12px color-mix(in srgb, var(--lp-ink) 8%, transparent);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.pg-modal--open .pg-modal__panel {
  transform: translateY(0) scale(1);
}

.pg-modal__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--lp-border);
  flex-shrink: 0;
}

.pg-modal__mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lp-accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--lp-accent) 28%, transparent);
  font-size: 0.95rem;
}

.pg-modal__header-text {
  flex: 1;
  min-width: 0;
}

.pg-modal__eyebrow {
  margin: 0 0 2px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--lp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pg-modal__header h3 {
  font-family: var(--lp-font-display);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.15;
  margin: 0;
  color: var(--lp-ink);
}

.pg-modal__summary-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--lp-radius-full);
  font-family: var(--lp-font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--lp-accent);
  background: color-mix(in srgb, var(--lp-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--lp-accent) 22%, transparent);
}

.pg-modal__close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: -6px -8px -6px 0;
  padding: 0;
  border: none;
  border-radius: var(--lp-radius-full);
  background: transparent;
  color: var(--lp-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.pg-modal__close:hover {
  background: color-mix(in srgb, var(--lp-ink) 6%, transparent);
  color: var(--lp-ink);
}

.pg-modal__close:active {
  transform: scale(0.97);
}

.pg-modal__close:focus-visible {
  outline: 2px solid var(--lp-accent);
  outline-offset: 2px;
}

.pg-modal__body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px;
  flex: 0 1 auto;
  min-height: 0;
}

.pg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-radius-md);
  background: var(--lp-surface);
}

.pg-item__label {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--lp-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pg-item__modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.pg-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 36px;
  min-height: 28px;
  padding: 2px 8px;
  border-radius: var(--lp-radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  border: 1px solid var(--lp-border);
  background: var(--lp-bg-paper);
  color: var(--lp-muted);
  white-space: nowrap;
}

.pg-status__mode {
  font-size: 0.58rem;
  font-weight: 600;
  opacity: 0.85;
}

.pg-status--pass {
  background: color-mix(in srgb, var(--lp-success) 14%, transparent);
  border-color: color-mix(in srgb, var(--lp-success) 32%, transparent);
  color: var(--lp-success);
}

.pg-status--tried {
  background: color-mix(in srgb, var(--lp-accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--lp-accent) 28%, transparent);
  color: var(--lp-accent);
}

.pg-modal__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--lp-border);
  font-size: 0.62rem;
  color: var(--lp-muted);
  flex-shrink: 0;
}

.pg-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pg-legend-item .pg-status {
  min-width: 22px;
  min-height: 20px;
  padding: 0 5px;
  font-size: 0.58rem;
}

@media (max-width: 639px) {
  .pg-modal {
    align-items: flex-end;
    padding: 0;
  }

  .pg-modal__panel {
    width: 100%;
    max-height: min(72dvh, 520px);
    border-radius: var(--lp-radius-lg) var(--lp-radius-lg) 0 0;
    border-bottom: none;
    transform: translateY(100%);
  }

  .pg-modal--open .pg-modal__panel {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-modal,
  .pg-modal__panel {
    transition: none;
  }
}
