/* ═══════════════════════════════════════════════════════════════
   BRANDING EN RRSS — Hoja de estilos completa
   Paleta: Violeta/Magenta + Cyan + Dark
   Prefijo de clases: .br- para evitar conflictos con CM Course
   ═══════════════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ─────────────────────────────────────────────── */
.br-course-wrap {
  --violet: #7c3aed;
  --violet-light: #a78bfa;
  --violet-dark: #4c1d95;
  --magenta: #db2777;
  --cyan: #06b6d4;
  --cyan-light: #67e8f9;
  --white: #ffffff;
  --gray: #9ca3af;
  --dark: #0d0515;
  --dark-2: #120a1e;
  --card-bg: rgba(124,58,237,0.10);
  --border: rgba(124,58,237,0.28);
  --gold: #fbbf24;
  --gold-dim: rgba(251,191,36,0.15);
  --green: #22c55e;
  --red: #ef4444;

  font-family: 'DM Sans', sans-serif;
  background: var(--dark);
  color: var(--white);
  min-height: 60vh;
  overflow-x: hidden;
}

/* Forzar fondo oscuro — el tema WP no puede sobreescribirlo */
body:has(.br-course-wrap) {
  background: #0d0515 !important;
}
.br-course-wrap {
  background: #0d0515 !important;
}

/* ─── HERO ─────────────────────────────────────────────────────── */
.br-hero {
  background: linear-gradient(135deg, #1a0533 0%, #4c1d95 45%, #7c3aed 100%);
  padding: 0;
  position: relative;
  overflow: hidden;
}
.br-hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 85% 15%, rgba(219,39,119,0.30) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 85%, rgba(6,182,212,0.20) 0%, transparent 50%);
}
.br-hero::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0; height: 60px;
  background: var(--dark);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 900px; margin: 0 auto;
  padding: 64px 32px 72px;
}
.hero-tag {
  display: inline-block;
  background: rgba(219,39,119,0.18);
  border: 1px solid rgba(219,39,119,0.5);
  color: #f9a8d4;
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 22px;
  text-transform: uppercase;
}
.br-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  font-weight: 900;
  line-height: 1.08;
  margin-bottom: 14px;
  color: #fff;
}
.br-hero h1 span { color: var(--magenta); }
.hero-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.72);
  font-weight: 300;
  margin-bottom: 30px;
  max-width: 560px;
  line-height: 1.65;
}
.hero-meta { display: flex; gap: 16px; flex-wrap: wrap; }
.meta-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 30px;
  padding: 7px 16px;
  font-size: 0.80rem; font-weight: 500;
}

/* ─── PROGRESS BAR ─────────────────────────────────────────────── */
.br-progress-bar {
  position: sticky; top: 0; z-index: 90;
  background: rgba(13,5,21,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(124,58,237,0.25);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 32px;
  flex-wrap: wrap;
}
.prog-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: var(--gray);
  text-transform: uppercase;
}
.prog-lessons { display: flex; gap: 5px; }
.prog-dot {
  width: 22px; height: 22px;
  border-radius: 4px;
  background: rgba(124,58,237,0.18);
  border: 1px solid rgba(124,58,237,0.30);
  transition: all 0.3s;
}
.prog-dot.done {
  background: var(--violet);
  border-color: var(--violet-light);
  box-shadow: 0 0 8px rgba(124,58,237,0.5);
}
.prog-count {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem; font-weight: 700;
  color: var(--violet-light);
}
.prog-xp {
  background: var(--gold-dim);
  border: 1px solid rgba(251,191,36,0.35);
  color: var(--gold);
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}

/* ─── NAME MODAL ─────────────────────────────────────────────────── */
#brNameModal {
  /* BUG-11: una sola declaración display — se activa con .show */
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
  padding: 20px;
}
#brNameModal.show { display: flex !important; }

.name-modal-card {
  background: linear-gradient(145deg, #1a0a2e, #2d0e50);
  border: 1px solid rgba(124,58,237,0.45);
  border-radius: 20px;
  padding: 38px 36px 32px;
  max-width: 440px; width: 100%;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(124,58,237,0.2);
  text-align: center;
}
.name-modal-icon { font-size: 2.8rem; display: block; margin-bottom: 12px; }
.name-modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; font-weight: 700;
  color: #fff; margin-bottom: 10px;
}
.name-modal-sub {
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem; margin-bottom: 22px;
  line-height: 1.6;
}
.name-modal-input, .name-modal-dni {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(124,58,237,0.40);
  border-radius: 10px;
  padding: 13px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem; color: #fff;
  margin-bottom: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.name-modal-input:focus, .name-modal-dni:focus {
  outline: none;
  border-color: var(--violet-light);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}
.name-modal-hint {
  display: block;
  font-size: 0.72rem; color: var(--gray);
  margin-bottom: 14px;
}
.name-modal-error {
  display: none;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  font-size: 0.80rem;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.name-modal-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  border: none; border-radius: 10px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem; font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.name-modal-btn:not(:disabled):hover { opacity: 0.9; transform: translateY(-1px); }
.name-modal-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── MODULE HEADER ─────────────────────────────────────────────── */
.module-header {
  max-width: 900px; margin: 0 auto;
  padding: 12px 32px 28px;
}
.module-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.2em;
  color: var(--cyan); text-transform: uppercase; margin-bottom: 8px;
}
.module-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 3.5vw, 2.3rem);
  font-weight: 700; margin-bottom: 6px;
}
.module-desc { color: var(--gray); font-size: 0.95rem; font-weight: 300; }

/* ─── LESSON GRID ───────────────────────────────────────────────── */
.lessons-container {
  max-width: 900px; margin: 0 auto;
  padding: 0 32px 80px;
}
.lessons-grid {
  display: flex; flex-direction: column; gap: 10px;
}
.lesson-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.15s;
}
.lesson-card:hover {
  border-color: var(--violet-light);
  background: rgba(124,58,237,0.18);
  transform: translateY(-1px);
}
.lesson-num {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem; font-weight: 700;
  color: var(--cyan);
  background: rgba(6,182,212,0.12);
  border: 1px solid rgba(6,182,212,0.30);
  border-radius: 7px;
  padding: 3px 9px;
  display: inline-block; margin-bottom: 6px;
}
.lesson-title {
  font-size: 1rem; font-weight: 600;
  color: var(--white); margin-bottom: 3px;
}
.lesson-mission {
  font-size: 0.76rem; color: var(--violet-light); font-weight: 400;
  margin-bottom: 10px;
}
.lesson-scores { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.score-pill {
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem; font-weight: 700;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.30);
  color: var(--violet-light);
  padding: 2px 8px; border-radius: 20px;
}
.lesson-progress-bar {
  height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
}
.lesson-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--magenta));
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ─── LESSON MODAL ──────────────────────────────────────────────── */
.br-lesson-modal {
  display: none;
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.80);
  backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 20px 16px;
}
.br-lesson-modal.show { display: flex; align-items: flex-start; justify-content: center; }
.lesson-modal-inner {
  background: linear-gradient(160deg, #12052a 0%, #1a082e 100%);
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: 20px;
  width: 100%; max-width: 900px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  overflow: hidden;
}
.lesson-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(124,58,237,0.25);
  background: rgba(124,58,237,0.10);
  position: sticky; top: 0; z-index: 10;
}
.lesson-modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem; font-weight: 700; color: var(--white);
}
.lesson-modal-close {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5;
  font-size: 1rem; font-weight: 700;
  width: 34px; height: 34px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.lesson-modal-close:hover { background: rgba(239,68,68,0.30); }
.lesson-modal-body { padding: 24px; }

/* ─── SECTIONS INSIDE MODAL ─────────────────────────────────────── */
.br-section {
  margin-bottom: 36px;
  background: rgba(124,58,237,0.07);
  border: 1px solid rgba(124,58,237,0.20);
  border-radius: 14px;
  padding: 22px;
}
.br-section-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem; font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.score-badge {
  font-size: 0.65rem; color: var(--gold);
  background: var(--gold-dim); border: 1px solid rgba(251,191,36,0.35);
  padding: 2px 8px; border-radius: 20px; font-weight: 700;
}

/* ─── TAB BAR (inside lesson modal) ────────────────────────────── */
.br-tab-bar {
  display: flex; flex-wrap: wrap; gap: 2px;
  border-bottom: 1px solid rgba(124,58,237,0.25);
  margin-bottom: 20px;
}
.eml-tab-btn {
  background: none; border: none;
  color: var(--gray);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem; font-weight: 500;
  padding: 10px 14px;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.eml-tab-btn:hover { color: var(--white); }
.eml-tab-btn.active { color: var(--violet-light); border-bottom-color: var(--violet); }

/* ─── TAB CONTENT (lesson reading) ─────────────────────────────── */
.br-tab-content h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; font-weight: 700;
  color: var(--white); margin-bottom: 8px;
}
.br-tab-content .lead {
  color: var(--violet-light); font-size: 0.97rem;
  font-style: italic; margin-bottom: 18px; line-height: 1.6;
}
.br-tab-content p {
  color: rgba(255,255,255,0.80); font-size: 0.92rem;
  line-height: 1.78; margin-bottom: 14px;
}
.br-tab-content h3 {
  font-size: 1rem; font-weight: 600;
  color: var(--cyan-light); margin: 22px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.br-tab-content h3::before {
  content: '';
  display: inline-block; width: 3px; height: 15px;
  background: var(--magenta); border-radius: 2px;
}
.br-tab-content ul, .br-tab-content ol {
  padding-left: 20px;
  color: rgba(255,255,255,0.80);
  font-size: 0.92rem; line-height: 1.85; margin-bottom: 14px;
}
.br-tab-content li { margin-bottom: 6px; }
.br-tab-content strong { color: var(--white); font-weight: 600; }
.br-tab-content em { color: var(--violet-light); }
.br-tab-content .quote-block {
  background: rgba(219,39,119,0.10);
  border-left: 3px solid var(--magenta);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
  margin: 20px 0;
  color: #fbcfe8; font-style: italic; font-size: 0.95rem;
}
.br-tab-content .vocab-grid p {
  background: rgba(124,58,237,0.10);
  border: 1px solid rgba(124,58,237,0.25);
  border-radius: 10px; padding: 12px 14px;
  margin-bottom: 8px;
}
.br-tab-content .mission-box {
  background: rgba(219,39,119,0.08);
  border: 1px solid rgba(219,39,119,0.30);
  border-radius: 12px; padding: 20px 22px;
}
.br-tab-content .mission-box h3 {
  color: var(--magenta); margin-top: 0;
}
.br-tab-content .mission-box ol {
  padding-left: 18px;
  color: rgba(255,255,255,0.82);
}
.br-tab-content .mission-note {
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 8px; padding: 10px 14px;
  color: #fde68a; font-size: 0.84rem; margin-top: 14px;
}

/* ─── FLASHCARDS ─────────────────────────────────────────────────── */
.flashcard {
  width: 100%;
  /* BUG-12+17: height fija para que los hijos absolute sean visibles */
  height: 180px;
  min-height: 180px;
  position: relative;
  cursor: pointer;
  perspective: 1000px;
  margin-bottom: 14px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(.4,0,.2,1);
}
.flashcard.flipped { transform: rotateY(180deg); }
.fc-front, .fc-back {
  position: absolute; inset: 0;
  border-radius: 14px; padding: 24px 22px;
  display: flex; flex-direction: column; justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.fc-front {
  background: linear-gradient(135deg, rgba(124,58,237,0.22) 0%, rgba(76,29,149,0.30) 100%);
  border: 1px solid rgba(124,58,237,0.40);
  text-align: center;
}
.fc-back {
  background: linear-gradient(135deg, rgba(219,39,119,0.18) 0%, rgba(124,58,237,0.22) 100%);
  border: 1px solid rgba(219,39,119,0.40);
  transform: rotateY(180deg);
}
.fc-term {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem; font-weight: 700; color: var(--white); margin-bottom: 8px;
}
.fc-hint { font-size: 0.75rem; color: var(--gray); }
.fc-def { color: rgba(255,255,255,0.88); font-size: 0.93rem; line-height: 1.7; margin-bottom: 8px; }
.fc-ex { color: var(--violet-light); font-size: 0.82rem; font-style: italic; line-height: 1.5; }
.fc-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px;
}
.fc-nav button {
  background: rgba(124,58,237,0.18); border: 1px solid rgba(124,58,237,0.35);
  color: var(--violet-light); font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem; font-weight: 600; padding: 7px 16px; border-radius: 8px;
  cursor: pointer; transition: background 0.2s;
}
.fc-nav button:not(:disabled):hover { background: rgba(124,58,237,0.35); }
.fc-nav button:disabled { opacity: 0.3; cursor: not-allowed; }
.fc-nav span { font-family: 'Space Mono', monospace; font-size: 0.72rem; color: var(--gray); }

/* ─── GROUP ACTIVITY ─────────────────────────────────────────────── */
#brGroupActivity h3 {
  font-size: 1.05rem; font-weight: 700; color: var(--white); margin-bottom: 4px;
}
.act-subtitle {
  font-family: 'Space Mono', monospace; font-size: 0.65rem;
  color: var(--cyan); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 12px;
}
#brGroupActivity p { color: rgba(255,255,255,0.78); font-size: 0.90rem; line-height: 1.7; margin-bottom: 16px; }
.act-roles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 18px;
}
.act-role {
  background: rgba(124,58,237,0.12); border: 1px solid rgba(124,58,237,0.25);
  border-radius: 10px; padding: 12px 14px;
}
.act-icon { font-size: 1.5rem; display: block; margin-bottom: 6px; }
.act-role strong { color: var(--white); font-size: 0.85rem; display: block; margin-bottom: 4px; }
.act-role p { color: var(--gray) !important; font-size: 0.78rem !important; margin-bottom: 0 !important; }
.act-steps {
  padding-left: 18px; color: rgba(255,255,255,0.80);
  font-size: 0.88rem; line-height: 1.75; margin-bottom: 14px;
}
.act-steps li { margin-bottom: 7px; }
.act-share {
  background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.25);
  border-radius: 10px; padding: 12px 16px;
  color: var(--cyan-light); font-size: 0.85rem; line-height: 1.6;
}

/* ─── CANVA ACTIVITY ─────────────────────────────────────────────── */
#brCanvaActivity h3 {
  font-size: 1rem; font-weight: 700; color: var(--white); margin-bottom: 8px;
}
#brCanvaActivity p { color: rgba(255,255,255,0.78); font-size: 0.90rem; line-height: 1.7; margin-bottom: 16px; }
.canva-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #6366f1, var(--violet));
  color: #fff; font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem; font-weight: 600;
  padding: 11px 22px; border-radius: 10px;
  text-decoration: none; transition: opacity 0.2s, transform 0.15s;
}
.canva-btn:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; color: #fff; }

/* ─── MATCH ──────────────────────────────────────────────────────── */
.match-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
  font-family: 'Space Mono', monospace; font-size: 0.70rem; color: var(--gray);
}
.match-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  background: rgba(124,58,237,0.12); border: 1px solid rgba(124,58,237,0.28);
  border-radius: 10px; padding: 11px 14px;
  color: rgba(255,255,255,0.85); font-size: 0.83rem; line-height: 1.4;
  cursor: pointer; transition: all 0.2s;
  user-select: none;
}
.match-item:hover { border-color: var(--violet-light); background: rgba(124,58,237,0.22); }
.match-item.selected { border-color: var(--cyan); background: rgba(6,182,212,0.15); color: #fff; }
.match-item.matched {
  border-color: var(--green); background: rgba(34,197,94,0.12);
  color: var(--green); cursor: default; pointer-events: none;
}
.match-item.wrong {
  border-color: var(--red); background: rgba(239,68,68,0.12);
  animation: shake 0.4s ease;
}
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.match-result {
  margin-top: 14px; padding: 12px 16px; border-radius: 10px;
  background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.35);
  color: var(--green); font-weight: 600; font-size: 0.88rem; text-align: center;
}

/* ─── WORD SORT ──────────────────────────────────────────────────── */
.ws-intro { color: rgba(255,255,255,0.75); font-size: 0.88rem; margin-bottom: 16px; line-height: 1.6; }
#brWordSortWrap h4 { font-size: 1rem; font-weight: 700; color: var(--white); margin-bottom: 6px; }
.ws-items {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 18px; min-height: 50px;
}
.ws-chip {
  background: rgba(124,58,237,0.16); border: 1px solid rgba(124,58,237,0.35);
  border-radius: 20px; padding: 7px 14px;
  color: rgba(255,255,255,0.88); font-size: 0.80rem; font-weight: 500;
  cursor: grab; transition: all 0.2s; user-select: none;
}
.ws-chip:active { cursor: grabbing; }
.ws-chip.selected { border-color: var(--cyan); background: rgba(6,182,212,0.18); }
.ws-chip.placed { cursor: default; font-size: 0.77rem; padding: 5px 10px; }
.ws-chip.correct { border-color: var(--green); background: rgba(34,197,94,0.15); color: var(--green); }
.ws-chip.incorrect { border-color: var(--red); background: rgba(239,68,68,0.15); color: #fca5a5; }
.ws-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ws-cat {
  border-radius: 12px; overflow: hidden;
  border: 1.5px solid rgba(124,58,237,0.25);
  min-height: 120px;
  display: flex; flex-direction: column;
  /* BUG-13: indicar que la categoría es clicable en móvil */
  cursor: pointer;
  transition: border-color 0.2s;
}
.ws-cat:hover {
  border-color: rgba(124,58,237,0.55);
}
.ws-cat-header {
  padding: 10px 14px;
  font-size: 0.78rem; font-weight: 700; color: #fff;
  letter-spacing: 0.02em;
}
.ws-cat-body {
  flex: 1; padding: 10px; display: flex; flex-wrap: wrap;
  gap: 6px; align-content: flex-start;
  background: rgba(0,0,0,0.15);
}
.ws-result {
  margin-top: 14px; padding: 14px 18px; border-radius: 10px;
  background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.35);
  color: var(--green); font-size: 0.90rem;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.ws-retry-btn {
  background: rgba(124,58,237,0.20); border: 1px solid rgba(124,58,237,0.40);
  color: var(--violet-light); font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem; font-weight: 600; padding: 8px 16px;
  border-radius: 8px; cursor: pointer; transition: background 0.2s;
  white-space: nowrap;
}
.ws-retry-btn:hover { background: rgba(124,58,237,0.35); }

/* Grade letter colors — usadas en quiz, scoreboard y diploma */
.grade-A { color: var(--green); }
.grade-B { color: #86efac; }
.grade-C { color: var(--gold); }
.grade-D { color: #fdba74; }
.grade-F { color: #fca5a5; }

/* ─── QUIZ ──────────────────────────────────────────────────────── */
.quiz-header { margin-bottom: 18px; }
.quiz-progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.quiz-progress-txt {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem; color: var(--gray);
  letter-spacing: 0.08em;
}
.quiz-progress-bar-outer {
  height: 4px; background: rgba(255,255,255,0.10); border-radius: 4px; overflow: hidden;
}
.quiz-progress-bar-inner {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--violet), var(--magenta));
  transition: width 0.4s ease;
}
/* legacy alias */
.quiz-progress {
  font-family: 'Space Mono', monospace;
  font-size: 0.68rem; color: var(--gray); margin-bottom: 14px;
}
.quiz-q {
  font-size: 1rem; font-weight: 600; color: var(--white);
  line-height: 1.55; margin-bottom: 18px;
}
.quiz-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 0; }
.quiz-opt {
  background: rgba(124,58,237,0.12); border: 1px solid rgba(124,58,237,0.30);
  border-radius: 10px; padding: 13px 16px;
  color: rgba(255,255,255,0.88); font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem; text-align: left; cursor: pointer;
  transition: all 0.18s; line-height: 1.45;
}
.quiz-opt:not(:disabled):hover {
  border-color: var(--violet-light);
  background: rgba(124,58,237,0.24);
  color: #fff;
  transform: translateX(3px);
}
.quiz-opt.correct {
  border-color: var(--green); background: rgba(34,197,94,0.16);
  color: var(--green); font-weight: 600;
}
.quiz-opt.incorrect {
  border-color: var(--red); background: rgba(239,68,68,0.14);
  color: #fca5a5;
}
.quiz-exp {
  display: none;
  background: rgba(124,58,237,0.10); border: 1px solid rgba(124,58,237,0.25);
  border-radius: 10px; padding: 14px; font-size: 0.85rem;
  color: rgba(255,255,255,0.78); line-height: 1.68;
  margin-top: 14px;
}
.quiz-nav { margin-top: 14px; }
.quiz-next {
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  border: none; border-radius: 10px; color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 0.90rem; font-weight: 700;
  padding: 12px 28px; cursor: pointer; transition: opacity 0.2s, transform 0.15s;
}
.quiz-next:hover { opacity: 0.88; transform: translateY(-1px); }

/* Resultado del quiz */
.quiz-result {
  text-align: center; padding: 36px 20px;
}
.qr-emoji { font-size: 2.5rem; margin-bottom: 8px; }
.qr-score {
  font-family: 'Playfair Display', serif;
  font-size: 4.5rem; font-weight: 900; color: var(--violet-light); line-height: 1;
}
.qr-score span { font-size: 1.6rem; color: var(--gray); }
.qr-sub { color: var(--gray); font-size: 0.92rem; margin: 8px 0 4px; }
.qr-letter {
  font-family: 'Space Mono', monospace;
  font-size: 2.2rem; font-weight: 700; margin: 6px 0 20px;
}
.qr-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.quiz-retry-btn {
  background: rgba(124,58,237,0.20); border: 1px solid rgba(124,58,237,0.40);
  color: var(--violet-light); font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem; font-weight: 600; padding: 11px 24px;
  border-radius: 10px; cursor: pointer; transition: background 0.2s;
}
.quiz-retry-btn:hover { background: rgba(124,58,237,0.35); }

/* ─── SCOREBOARD ─────────────────────────────────────────────────── */
#brScoreboard {
  max-width: 900px; margin: 0 auto 60px;
  padding: 0 32px;
}
.scoreboard-box {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px; overflow: hidden;
}
.scoreboard-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem; font-weight: 700;
  color: var(--white); margin-bottom: 18px;
}
.score-table {
  width: 100%; border-collapse: collapse; font-size: 0.84rem;
}
.score-table th {
  background: rgba(124,58,237,0.30);
  color: #e2d9ff; font-family: 'Space Mono', monospace;
  font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 10px 12px; text-align: left; border-bottom: 2px solid rgba(124,58,237,0.4);
}
.score-table td {
  padding: 10px 12px; border-bottom: 1px solid rgba(124,58,237,0.15);
  color: rgba(255,255,255,0.88);
}
.score-table tr:hover td { background: rgba(124,58,237,0.10); }
.score-table td:first-child {
  font-family: 'Space Mono', monospace;
  font-weight: 700; color: var(--cyan); font-size: 0.78rem;
}
.td-bar { min-width: 100px; }
.bar-bg { background: rgba(255,255,255,0.08); border-radius: 4px; height: 6px; }
.bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--violet), var(--magenta));
  transition: width 0.6s ease;
}
.score-final-row {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid rgba(124,58,237,0.25);
}
.final-label {
  font-family: 'Space Mono', monospace; font-size: 0.68rem;
  color: var(--gray); text-transform: uppercase; letter-spacing: 0.12em;
  margin-right: auto;
}
.final-score-val {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem; font-weight: 900; color: var(--violet-light);
}
.final-letter-val {
  font-family: 'Space Mono', monospace;
  font-size: 1.8rem; font-weight: 700;
}
.diploma-btn {
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  border: none; border-radius: 10px; color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 700;
  padding: 11px 24px; cursor: pointer; transition: opacity 0.2s;
  white-space: nowrap;
  position: relative;
}
.diploma-btn:not(:disabled):hover { opacity: 0.88; }
.diploma-btn:disabled {
  opacity: 1;
  background: rgba(124,58,237,0.15);
  border: 1px solid rgba(124,58,237,0.25);
  color: rgba(255,255,255,0.35);
  cursor: not-allowed;
}
.diploma-btn:disabled::before {
  content: '🔒 ';
}

/* ─── RANKING ─────────────────────────────────────────────────────── */
#brRankingSection {
  max-width: 900px; margin: 0 auto 80px; padding: 0 32px;
}
.ranking-box {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
}
.ranking-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 28px 0; gap: 16px; flex-wrap: wrap;
}
.ranking-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem; font-weight: 700; color: var(--white); margin: 0 0 4px;
}
.ranking-header p { color: var(--gray); font-size: 0.82rem; margin: 0; }
.ranking-refresh-btn {
  background: rgba(124,58,237,0.18); border: 1px solid rgba(124,58,237,0.35);
  color: var(--violet-light); font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem; font-weight: 600; padding: 7px 16px;
  border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: background 0.2s;
}
.ranking-refresh-btn:hover { background: rgba(124,58,237,0.32); }
.ranking-tabs-bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 16px 28px 0; border-bottom: 1px solid rgba(124,58,237,0.20);
}
.ranking-tab-btn {
  background: none; border: none;
  color: var(--gray); font-family: 'Space Mono', monospace;
  font-size: 0.65rem; font-weight: 700; padding: 8px 12px;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.ranking-tab-btn:hover { color: var(--white); }
.ranking-tab-btn.active { color: var(--violet-light); border-bottom-color: var(--violet); }
#brRankingPanels { padding: 20px 28px; }
.ranking-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
.ranking-table th {
  background: rgba(124,58,237,0.18);
  color: var(--violet-light); font-family: 'Space Mono', monospace;
  font-size: 0.60rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid rgba(124,58,237,0.25);
}
.ranking-table td {
  padding: 8px 12px; border-bottom: 1px solid rgba(124,58,237,0.10);
  color: rgba(255,255,255,0.78);
}
.ranking-table tr:hover td { background: rgba(124,58,237,0.08); }
.ranking-table tr.my-row td {
  background: rgba(219,39,119,0.10) !important;
  color: #fbcfe8;
  border-bottom-color: rgba(219,39,119,0.20);
}

/* ─── AWARD MODAL ────────────────────────────────────────────────── */
#brAwardModal {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.80); backdrop-filter: blur(8px);
  align-items: center; justify-content: center; padding: 20px;
}
#brAwardModal.show { display: flex; }
.award-card {
  background: linear-gradient(145deg, #1a0a2e, #2d0e50);
  border: 1px solid rgba(124,58,237,0.50);
  border-radius: 20px; padding: 44px 36px 36px;
  max-width: 420px; width: 100%; text-align: center;
  box-shadow: 0 30px 70px rgba(0,0,0,0.6), 0 0 60px rgba(124,58,237,0.25);
  position: relative;
}
.award-dismiss {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,0.08); border: none;
  color: rgba(255,255,255,0.40); font-size: 1.1rem;
  width: 30px; height: 30px; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.award-medal { font-size: 3.5rem; display: block; margin-bottom: 10px; }
.award-stars { font-size: 1.3rem; letter-spacing: 4px; margin-bottom: 12px; }
.award-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem; font-weight: 700; color: var(--white); margin-bottom: 8px;
}
.award-sub { color: rgba(255,255,255,0.68); font-size: 0.90rem; line-height: 1.6; margin-bottom: 22px; }
.award-close {
  background: linear-gradient(135deg, var(--violet), var(--magenta));
  border: none; border-radius: 12px; color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 0.95rem; font-weight: 700;
  padding: 14px 28px; cursor: pointer; width: 100%;
}

/* ─── DIPLOMA MODAL ──────────────────────────────────────────────── */
#brDiplomaModal {
  display: none; position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(10px);
  align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
}
#brDiplomaModal.show { display: flex; }
.diploma-card {
  background: linear-gradient(160deg, #0f0820 0%, #1a0a30 60%, #0d0515 100%);
  border: 2px solid rgba(124,58,237,0.55);
  border-radius: 22px; padding: 44px 40px 36px;
  max-width: 700px; width: 100%; text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
}
.diploma-close {
  position: absolute; top: 14px; right: 14px;
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.30);
  color: #fca5a5; font-size: 0.85rem; font-weight: 700;
  width: 30px; height: 30px; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.diploma-header {
  font-family: 'Space Mono', monospace; font-size: 0.62rem;
  letter-spacing: 0.22em; color: var(--magenta); text-transform: uppercase; margin-bottom: 4px;
}
.diploma-school {
  font-family: 'Space Mono', monospace; font-size: 0.60rem;
  color: var(--gray); letter-spacing: 0.15em; margin-bottom: 18px;
}
.diploma-course {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.2rem, 3vw, 1.7rem); font-weight: 700;
  color: var(--white); margin-bottom: 18px; line-height: 1.25;
}
.diploma-certifies { color: var(--gray); font-size: 0.85rem; margin-bottom: 6px; }
.diploma-name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 900;
  color: var(--violet-light); margin-bottom: 16px; line-height: 1.1;
}
.diploma-desc {
  color: rgba(255,255,255,0.62); font-size: 0.82rem;
  line-height: 1.70; margin-bottom: 24px; max-width: 520px; margin-left: auto; margin-right: auto;
}
.diploma-grade-box {
  display: flex; justify-content: center; align-items: center;
  gap: 0; flex-wrap: wrap;
  background: rgba(124,58,237,0.12); border: 1px solid rgba(124,58,237,0.30);
  border-radius: 14px; padding: 18px 10px; margin-bottom: 24px;
}
.diploma-grade-item { padding: 0 20px; text-align: center; }
.diploma-divider { width: 1px; height: 40px; background: rgba(124,58,237,0.30); }
.dg-val {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem; font-weight: 700; color: var(--white); line-height: 1;
}
.dg-lbl {
  font-size: 0.62rem; color: var(--gray); text-transform: uppercase;
  letter-spacing: 0.08em; margin-top: 4px;
}
.diploma-footer { display: flex; justify-content: center; gap: 48px; margin-bottom: 24px; flex-wrap: wrap; }
.diploma-sig { text-align: center; }
.diploma-seal { font-size: 2.5rem; margin-bottom: 6px; }
.sig-line { width: 120px; height: 1px; background: rgba(255,255,255,0.25); margin: 0 auto 6px; }
.sig-name { font-family: 'Playfair Display', serif; font-size: 0.90rem; color: var(--white); font-weight: 700; }
.sig-title { font-size: 0.68rem; color: var(--gray); }
.diploma-actions {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.diploma-print-btn {
  background: rgba(124,58,237,0.20); border: 1px solid rgba(124,58,237,0.40);
  color: var(--violet-light); font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem; font-weight: 600; padding: 9px 18px;
  border-radius: 8px; cursor: pointer;
}
.dip-share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DM Sans', sans-serif; font-size: 0.78rem; font-weight: 600;
  padding: 9px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer; transition: opacity 0.2s;
}
.dip-share-btn:hover { opacity: 0.85; }
.dip-share-wa  { background: rgba(37,211,102,0.15); border-color: rgba(37,211,102,0.40); color: #4ade80; }
.dip-share-li  { background: rgba(10,102,194,0.15); border-color: rgba(10,102,194,0.40); color: #93c5fd; }
.dip-share-tw  { background: rgba(0,0,0,0.20); border-color: rgba(255,255,255,0.20); color: #e2e8f0; }
.dip-share-copy{ background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.35); color: var(--gold); }
.dip-back-btn {
  background: transparent; border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.50); font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem; padding: 9px 14px; border-radius: 8px; cursor: pointer;
}

/* ─── PRINT ────────────────────────────────────────────────────────*/
@media print {
  body > *:not(#brDiplomaModal) { display: none !important; }
  #brDiplomaModal { display: block !important; background: #fff !important; position: static !important; }
  .diploma-card { box-shadow: none !important; border: 2px solid #7c3aed !important; }
  .diploma-close, .diploma-actions { display: none !important; }
  .diploma-name, .diploma-course { color: #4c1d95 !important; }
  .diploma-grade-box { background: #f3e8ff !important; border-color: #7c3aed !important; }
  .dg-val { color: #4c1d95 !important; }
  .dg-lbl { color: #6b7280 !important; }
  .diploma-desc { color: #374151 !important; }
  .diploma-header, .diploma-school { color: #db2777 !important; }
  .sig-line { background: #9ca3af !important; }
  .sig-name { color: #1f2937 !important; }
  .sig-title { color: #6b7280 !important; }
}

/* ─── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero-inner { padding: 44px 20px 56px; }
  .module-header, .lessons-container, #brScoreboard, #brRankingSection { padding-left: 16px; padding-right: 16px; }
  .match-grid { grid-template-columns: 1fr; }
  .ws-cats { grid-template-columns: 1fr; }
  .act-roles { grid-template-columns: 1fr 1fr; }
  .diploma-grade-box { gap: 0; }
  .diploma-grade-item { padding: 0 10px; }
  .diploma-actions { gap: 6px; }
  .lesson-modal-body { padding: 14px; }
  .br-section { padding: 16px; }
  .prog-dot { width: 18px; height: 18px; }
  .br-progress-bar { padding: 8px 16px; gap: 6px; }
  .ranking-header, #brRankingPanels, .ranking-tabs-bar { padding-left: 16px; padding-right: 16px; }
}
