:root {
  --purple: #59026B;
  --purple-light: #7a1590;
  --purple-dark: #3d0149;
  --blue: #18a8e4;
  --blue-light: #4dc0ed;
  --blue-dark: #0d85b8;
  --gold: #fbbf24;
  --white: #ffffff;
  --gray: #b0a0b8;
  --dark: #1a0620;
  --card-bg: rgba(89,2,107,0.07);
}
/* Force dark background on the course wrapper, overriding WP theme */
.eml-course-wrap,
.eml-course-wrap * {
  box-sizing: border-box;
}
.eml-course-wrap {
  background: var(--dark) !important;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  min-height: 60vh;
  overflow-x: hidden;
}
/* Also darken the page body when course is present */
body:has(.eml-course-wrap) {
  background: var(--dark) !important;
}


  

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

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

  /* HERO */
  .hero {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple) 50%, #8b0aaa 100%);
    padding: 0;
    position: relative;
    overflow: hidden;
  }
  .hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 80% 20%, rgba(24,168,228,0.25) 0%, transparent 60%),
                radial-gradient(ellipse at 10% 80%, rgba(24,168,228,0.15) 0%, transparent 50%);
  }
  .hero-inner {
    position: relative; z-index: 1;
    max-width: 900px; margin: 0 auto;
    padding: 60px 32px 48px;
  }
  .hero-tag {
    display: inline-block;
    background: rgba(24,168,228,0.2);
    border: 1px solid var(--blue);
    color: var(--blue-light);
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
    text-transform: uppercase;
  }
  .hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 12px;
  }
  .hero h1 span { color: var(--blue); }
  .hero-sub {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.75);
    font-weight: 300;
    margin-bottom: 28px;
    max-width: 560px;
  }
  .hero-meta {
    display: flex; gap: 24px; flex-wrap: wrap;
  }
  .meta-pill {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 30px;
    padding: 7px 16px;
    font-size: 0.82rem; font-weight: 500;
  }
  .meta-pill svg { width:15px; height:15px; }

  /* DIVIDER WAVE */
  .wave {
    display: block; width: 100%; height: 50px;
    background: var(--dark);
    clip-path: ellipse(55% 100% at 50% 100%);
    margin-top: -2px;
  }

  /* MODULE HEADER */
  .module-header {
    max-width: 900px; margin: 0 auto;
    padding: 10px 32px 32px;
  }
  .module-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    color: var(--blue);
    text-transform: uppercase;
    margin-bottom: 8px;
  }
  .module-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    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: 12px;
  }

  /* LESSON BUTTON */
  .lesson-btn {
    width: 100%;
    background: rgba(89,2,107,0.12);
    border: 1px solid rgba(89,2,107,0.35);
    border-radius: 14px;
    padding: 0;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.25s, background 0.25s;
    overflow: hidden;
  }
  .lesson-btn:hover {
    border-color: var(--blue);
    background: rgba(24,168,228,0.06);
  }
  .lesson-btn.open {
    border-color: var(--purple-light);
    background: rgba(89,2,107,0.2);
  }
  .lesson-header {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 22px;
  }
  .lesson-num {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--blue);
    background: rgba(24,168,228,0.12);
    border: 1px solid rgba(24,168,228,0.3);
    border-radius: 8px;
    padding: 4px 10px;
    min-width: 44px;
    text-align: center;
    flex-shrink: 0;
  }
  .lesson-info { flex: 1; }
  .lesson-title {
    font-size: 1rem; font-weight: 600;
    color: var(--white);
    margin-bottom: 2px;
  }
  .lesson-mission {
    font-size: 0.78rem;
    color: var(--blue-light);
    font-weight: 400;
  }
  .lesson-time {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: var(--gray);
    margin-right: 8px;
  }
  .chevron {
    color: var(--gray);
    transition: transform 0.3s;
    font-size: 1.1rem;
  }
  .lesson-btn.open .chevron { transform: rotate(180deg); color: var(--blue); }

  /* LESSON CONTENT */
  .lesson-content {
    display: none;
    border-top: 1px solid rgba(89,2,107,0.3);
    padding: 0;
  }
  .lesson-btn.open .lesson-content { display: block; }

  /* TABS */
  .tabs-bar {
    display: flex; overflow-x: auto;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(89,2,107,0.3);
    padding: 0 22px;
    gap: 2px;
    scrollbar-width: none;
  }
  .tabs-bar::-webkit-scrollbar { display: none; }
  .tab-btn {
    background: none; border: none;
    color: var(--gray);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem; font-weight: 500;
    padding: 12px 16px;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
  }
  .tab-btn:hover { color: var(--white); }
  .tab-btn.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
  }
  .tab-panel { display: none; padding: 26px 26px 30px; }
  .tab-panel.active { display: block; }

  /* CONTENT STYLES */
  .tab-panel h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem; font-weight: 700;
    color: var(--white);
    margin-bottom: 6px;
  }
  .tab-panel .lead {
    color: var(--blue-light);
    font-size: 1rem; font-weight: 400;
    margin-bottom: 20px;
    font-style: italic;
  }
  .tab-panel p {
    color: rgba(255,255,255,0.82);
    font-size: 0.92rem; line-height: 1.75;
    margin-bottom: 14px;
  }
  .tab-panel h3 {
    font-size: 1rem; font-weight: 600;
    color: var(--blue-light);
    margin: 20px 0 8px;
    display: flex; align-items: center; gap: 8px;
  }
  .tab-panel h3::before {
    content: '';
    display: inline-block;
    width: 3px; height: 16px;
    background: var(--blue);
    border-radius: 2px;
  }
  .tab-panel ul, .tab-panel ol {
    padding-left: 20px;
    color: rgba(255,255,255,0.82);
    font-size: 0.92rem; line-height: 1.85;
    margin-bottom: 14px;
  }
  .tab-panel li { margin-bottom: 6px; }
  .tab-panel strong { color: var(--white); font-weight: 600; }

  /* CARDS IN TABS */
  .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px; margin: 16px 0;
  }
  .mini-card {
    background: rgba(89,2,107,0.15);
    border: 1px solid rgba(89,2,107,0.4);
    border-radius: 10px;
    padding: 14px;
  }
  .mini-card .card-icon { font-size: 1.5rem; margin-bottom: 6px; }
  .mini-card .card-label {
    font-size: 0.82rem; font-weight: 600; color: var(--white);
    margin-bottom: 4px;
  }
  .mini-card .card-desc {
    font-size: 0.75rem; color: var(--gray); line-height: 1.5;
  }

  /* MISSION BOX */
  .mission-box {
    background: linear-gradient(135deg, rgba(24,168,228,0.12), rgba(89,2,107,0.2));
    border: 1px solid var(--blue);
    border-radius: 12px;
    padding: 20px 22px;
    margin-top: 20px;
  }
  .mission-box .mission-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--blue);
    text-transform: uppercase;
    margin-bottom: 8px;
  }
  .mission-box h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem; font-weight: 700;
    color: var(--white); margin-bottom: 10px;
  }
  .mission-box p {
    color: rgba(255,255,255,0.8);
    font-size: 0.88rem;
    margin-bottom: 8px;
  }
  .mission-box ol {
    color: rgba(255,255,255,0.8);
    font-size: 0.88rem;
    padding-left: 18px;
    line-height: 1.8;
  }

  /* QUOTE */
  .quote-block {
    border-left: 3px solid var(--purple-light);
    padding: 12px 18px;
    background: rgba(89,2,107,0.1);
    border-radius: 0 8px 8px 0;
    margin: 14px 0;
    font-style: italic;
    color: rgba(255,255,255,0.75);
    font-size: 0.92rem;
    line-height: 1.7;
  }

  /* TABLE */
  .styled-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.85rem; margin: 14px 0;
  }
  .styled-table th {
    background: rgba(89,2,107,0.4);
    color: var(--blue-light);
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
  }
  .styled-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(89,2,107,0.2);
    color: rgba(255,255,255,0.8);
    vertical-align: top;
  }
  .styled-table tr:last-child td { border-bottom: none; }
  .styled-table tr:hover td { background: rgba(89,2,107,0.1); }

  /* HIGHLIGHT BADGE */
  .badge {
    display: inline-block;
    background: rgba(24,168,228,0.15);
    border: 1px solid rgba(24,168,228,0.4);
    color: var(--blue-light);
    font-size: 0.72rem; font-weight: 600;
    padding: 3px 10px; border-radius: 20px;
    margin: 2px 3px 2px 0;
  }

  /* FOOTER */
  footer {
    text-align: center;
    padding: 30px;
    color: var(--gray);
    font-size: 0.78rem;
    border-top: 1px solid rgba(89,2,107,0.25);
  }
  footer a { color: var(--blue); text-decoration: none; }

  /* ── QUIZ ── */
  .quiz-wrap { padding: 4px 0; }
  .quiz-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; flex-wrap: wrap; gap: 10px;
  }
  .quiz-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem; font-weight: 700; margin: 0;
  }
  .quiz-score-badge {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    background: rgba(24,168,228,0.12);
    border: 1px solid rgba(24,168,228,0.35);
    color: var(--blue-light);
    padding: 5px 14px; border-radius: 20px;
  }
  .quiz-progress {
    display: flex; gap: 5px; margin-bottom: 22px; flex-wrap: wrap;
  }
  .qp-dot {
    width: 24px; height: 6px; border-radius: 3px;
    background: rgba(255,255,255,0.1);
    transition: background 0.3s;
  }
  .qp-dot.answered { background: var(--blue); }
  .qp-dot.correct  { background: #22c55e; }
  .qp-dot.wrong    { background: #ef4444; }

  .q-block {
    background: rgba(89,2,107,0.13);
    border: 1px solid rgba(89,2,107,0.35);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 14px;
    transition: border-color 0.2s;
  }
  .q-block.answered { border-color: rgba(89,2,107,0.6); }
  .q-num {
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem; color: var(--blue);
    letter-spacing: 0.1em; margin-bottom: 8px;
  }
  .q-text {
    font-size: 0.93rem; font-weight: 600; color: var(--white);
    line-height: 1.5; margin-bottom: 14px;
  }
  .q-options { display: flex; flex-direction: column; gap: 8px; }
  .q-opt {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.87rem; color: rgba(255,255,255,0.85);
    cursor: pointer;
    text-align: left;
    transition: background 0.18s, border-color 0.18s, transform 0.1s;
    display: flex; align-items: flex-start; gap: 10px;
  }
  .q-opt:hover:not([disabled]) {
    background: rgba(24,168,228,0.1);
    border-color: rgba(24,168,228,0.4);
    transform: translateX(3px);
  }
  .q-opt[disabled] { cursor: default; }
  .q-opt.opt-correct {
    background: rgba(34,197,94,0.12);
    border-color: #22c55e;
    color: #86efac;
  }
  .q-opt.opt-wrong {
    background: rgba(239,68,68,0.12);
    border-color: #ef4444;
    color: #fca5a5;
  }
  .q-opt.opt-reveal {
    background: rgba(34,197,94,0.07);
    border-color: rgba(34,197,94,0.3);
    color: rgba(134,239,172,0.6);
  }
  .opt-letter {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem; font-weight: 700;
    color: var(--blue); flex-shrink: 0;
    margin-top: 1px;
  }
  .q-opt.opt-correct .opt-letter { color: #22c55e; }
  .q-opt.opt-wrong   .opt-letter { color: #ef4444; }
  .q-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.84rem; line-height: 1.6;
    display: none;
  }
  .q-feedback.show { display: flex; gap: 10px; align-items: flex-start; }
  .q-feedback.fb-correct {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    color: #86efac;
  }
  .q-feedback.fb-wrong {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
  }
  .fb-icon { font-size: 1rem; flex-shrink: 0; }

  .quiz-result {
    display: none;
    background: linear-gradient(135deg, rgba(89,2,107,0.3), rgba(24,168,228,0.15));
    border: 1px solid var(--blue);
    border-radius: 14px;
    padding: 26px 24px;
    text-align: center;
    margin-top: 10px;
  }
  .quiz-result.show { display: block; }
  .qr-emoji { font-size: 2.8rem; margin-bottom: 10px; }
  .qr-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem; font-weight: 700;
    color: var(--white); margin-bottom: 6px;
  }
  .qr-score {
    font-family: 'Space Mono', monospace;
    font-size: 2rem; font-weight: 700;
    color: var(--blue); margin: 8px 0;
  }
  .qr-msg {
    font-size: 0.9rem; color: rgba(255,255,255,0.75);
    margin-bottom: 18px; line-height: 1.6;
  }
  .quiz-reset-btn {
    background: var(--purple);
    border: 1px solid var(--purple-light);
    color: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem; font-weight: 600;
    padding: 10px 24px; border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
  }
  .quiz-reset-btn:hover { background: var(--purple-light); }

  /* ── GROUP ACTIVITY ── */
  .group-wrap { padding: 4px 0; }
  .group-box {
    background: linear-gradient(135deg, rgba(89,2,107,0.2), rgba(24,168,228,0.08));
    border: 1px solid rgba(89,2,107,0.5);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 18px;
  }
  .group-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.63rem; letter-spacing: 0.15em;
    color: var(--blue); text-transform: uppercase;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 7px;
  }
  .group-tag::after {
    content: ''; flex: 1; height: 1px;
    background: rgba(24,168,228,0.25);
  }
  .group-box h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem; font-weight: 700;
    color: var(--white); margin-bottom: 10px;
  }
  .group-box p {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem; line-height: 1.7;
    margin-bottom: 10px;
  }
  .group-steps {
    counter-reset: gstep;
    list-style: none; padding: 0;
    margin: 14px 0;
  }
  .group-steps li {
    counter-increment: gstep;
    display: flex; gap: 12px; align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(89,2,107,0.2);
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem; line-height: 1.6;
  }
  .group-steps li:last-child { border-bottom: none; }
  .group-steps li::before {
    content: counter(gstep);
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem; font-weight: 700;
    color: var(--purple-dark);
    background: var(--blue);
    border-radius: 50%;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
  }
  .timer-bar {
    display: flex; align-items: center; gap: 12px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(24,168,228,0.25);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 16px 0;
  }
  .timer-display {
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem; font-weight: 700;
    color: var(--blue); min-width: 64px;
  }
  .timer-display.urgent { color: #ef4444; animation: pulse 1s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
  .timer-btn {
    background: var(--purple);
    border: 1px solid var(--purple-light);
    color: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem; font-weight: 600;
    padding: 7px 18px; border-radius: 7px;
    cursor: pointer; transition: background 0.2s;
  }
  .timer-btn:hover { background: var(--purple-light); }
  .timer-btn.stop { background: rgba(239,68,68,0.3); border-color: #ef4444; }
  .timer-progress-wrap {
    flex: 1; height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px; overflow: hidden;
  }
  .timer-progress-bar {
    height: 100%; background: var(--blue);
    border-radius: 3px; transition: width 1s linear, background 0.5s;
    width: 100%;
  }
  .roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
    gap: 10px; margin: 14px 0;
  }
  .role-card {
    background: rgba(89,2,107,0.2);
    border: 1px solid rgba(89,2,107,0.45);
    border-radius: 9px; padding: 12px;
    text-align: center;
  }
  .role-card .role-icon { font-size: 1.4rem; margin-bottom: 5px; }
  .role-card .role-name {
    font-size: 0.8rem; font-weight: 700; color: var(--blue-light);
    margin-bottom: 3px;
  }
  .role-card .role-desc {
    font-size: 0.72rem; color: var(--gray); line-height: 1.4;
  }
  .share-prompt {
    background: rgba(24,168,228,0.08);
    border: 1px dashed rgba(24,168,228,0.4);
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 14px;
    font-size: 0.87rem; color: rgba(255,255,255,0.8);
    line-height: 1.65;
  }
  .share-prompt strong { color: var(--blue-light); }

  /* ── MATCHING ACTIVITY ── */
  .match-wrap { padding: 4px 0; }
  .match-section { margin-bottom: 32px; }
  .match-section-title {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem; letter-spacing: 0.15em;
    color: var(--blue); text-transform: uppercase;
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
  }
  .match-section-title::after { content:''; flex:1; height:1px; background:rgba(24,168,228,0.2); }
  .match-game {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .match-col { display: flex; flex-direction: column; gap: 8px; }
  .match-col-label {
    font-size: 0.72rem; font-weight: 600; color: var(--gray);
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 4px;
  }
  .match-item {
    background: rgba(89,2,107,0.15);
    border: 1.5px solid rgba(89,2,107,0.4);
    border-radius: 9px;
    padding: 11px 14px;
    font-size: 0.86rem; color: var(--white);
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, transform 0.1s;
    user-select: none;
    line-height: 1.4;
    min-height: 46px;
    display: flex; align-items: center;
  }
  .match-item:hover:not(.matched):not(.wrong-flash) {
    border-color: var(--blue);
    background: rgba(24,168,228,0.1);
    transform: translateX(2px);
  }
  .match-item.selected {
    border-color: var(--blue);
    background: rgba(24,168,228,0.18);
    box-shadow: 0 0 0 2px rgba(24,168,228,0.3);
  }
  .match-item.matched {
    border-color: #22c55e;
    background: rgba(34,197,94,0.1);
    color: #86efac;
    cursor: default;
    opacity: 0.75;
  }
  .match-item.wrong-flash {
    border-color: #ef4444;
    background: rgba(239,68,68,0.15);
    animation: wrongShake 0.4s ease;
  }
  @keyframes wrongShake {
    0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)}
  }
  .match-score-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding: 10px 14px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    font-size: 0.83rem;
  }
  .match-score-text { color: var(--gray); }
  .match-score-val {
    font-family: 'Space Mono', monospace;
    color: var(--blue); font-size: 0.9rem;
  }
  .match-complete {
    display: none;
    margin-top: 12px;
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.4);
    border-radius: 10px;
    padding: 14px 18px;
    text-align: center;
    color: #86efac;
    font-weight: 600;
    font-size: 0.9rem;
  }
  .match-complete.show { display: block; }
  .match-reset-link {
    display: inline-block; margin-top: 8px;
    font-size: 0.78rem; color: var(--blue);
    cursor: pointer; text-decoration: underline;
  }

  /* ── CANVA ACTIVITY ── */
  .canva-wrap { padding: 4px 0; }
  .canva-box {
    background: linear-gradient(135deg, rgba(24,168,228,0.08), rgba(89,2,107,0.18));
    border: 1px solid rgba(24,168,228,0.3);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 16px;
  }
  .canva-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.63rem; letter-spacing: 0.15em;
    color: #7dd3fc; text-transform: uppercase;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 7px;
  }
  .canva-tag::after { content:''; flex:1; height:1px; background:rgba(24,168,228,0.2); }
  .canva-box h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem; font-weight: 700;
    color: var(--white); margin-bottom: 8px;
  }
  .canva-box p {
    color: rgba(255,255,255,0.8); font-size: 0.9rem;
    line-height: 1.7; margin-bottom: 10px;
  }
  .canva-steps {
    counter-reset: cstep; list-style: none; padding: 0; margin: 14px 0;
  }
  .canva-steps li {
    counter-increment: cstep;
    display: flex; gap: 12px; align-items: flex-start;
    padding: 9px 0; border-bottom: 1px solid rgba(24,168,228,0.1);
    color: rgba(255,255,255,0.85); font-size: 0.9rem; line-height: 1.6;
  }
  .canva-steps li:last-child { border-bottom: none; }
  .canva-steps li::before {
    content: counter(cstep);
    font-family: 'Space Mono', monospace; font-size: 0.68rem; font-weight: 700;
    color: #0c1a24; background: #7dd3fc;
    border-radius: 50%; width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
  }
  .canva-specs {
    display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr));
    gap: 10px; margin: 14px 0;
  }
  .canva-spec {
    background: rgba(0,0,0,0.2); border: 1px solid rgba(24,168,228,0.2);
    border-radius: 8px; padding: 10px 12px;
  }
  .canva-spec .spec-label {
    font-size: 0.68rem; font-weight: 700; color: #7dd3fc;
    text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px;
  }
  .canva-spec .spec-val { font-size: 0.83rem; color: rgba(255,255,255,0.8); }
  .canva-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #00c4cc; color: #000; font-weight: 700;
    font-family: 'DM Sans', sans-serif; font-size: 0.85rem;
    padding: 10px 20px; border-radius: 8px; text-decoration: none;
    transition: background 0.2s; margin-top: 14px;
    border: none; cursor: pointer;
  }
  .canva-btn:hover { background: #00e0e8; }
  .canva-checklist { margin: 14px 0; list-style: none; padding: 0; }
  .canva-checklist li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 7px 0; font-size: 0.88rem;
    color: rgba(255,255,255,0.8); line-height: 1.5;
    border-bottom: 1px solid rgba(89,2,107,0.15);
  }
  .canva-checklist li:last-child { border-bottom: none; }
  .canva-checklist li::before {
    content: '☐'; color: var(--blue); font-size: 1rem; flex-shrink: 0;
  }

  /* ── PROGRESS SYSTEM ── */
  #progressBar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(26,6,32,0.95);
    border-bottom: 1px solid rgba(89,2,107,0.4);
    backdrop-filter: blur(10px);
    padding: 10px 32px;
    display: flex; align-items: center; gap: 14px;
    flex-wrap: wrap;
  }
  .prog-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem; color: var(--gray);
    text-transform: uppercase; letter-spacing: 0.1em;
    white-space: nowrap;
  }
  .prog-lessons {
    display: flex; gap: 6px; flex-wrap: wrap; flex: 1;
  }
  .prog-lesson-dot {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(89,2,107,0.25);
    border: 2px solid rgba(89,2,107,0.5);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem; font-weight: 700; color: var(--gray);
    transition: all 0.4s; cursor: default;
    position: relative;
  }
  .prog-lesson-dot.partial {
    border-color: rgba(24,168,228,0.6);
    color: var(--blue-light);
    background: rgba(24,168,228,0.08);
  }
  .prog-lesson-dot.complete {
    border-color: #22c55e;
    background: rgba(34,197,94,0.15);
    color: #4ade80;
  }
  .prog-lesson-dot.complete::after {
    content: '✓';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; color: #4ade80;
  }
  .prog-count {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem; color: var(--blue);
    white-space: nowrap;
  }
  .prog-xp {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem; color: #fbbf24;
    white-space: nowrap;
  }

  /* ── AWARD MODAL ── */
  #awardModal {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.85);
    align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
  }
  #awardModal.show { display: flex; }
  .award-card {
    background: linear-gradient(145deg, #1a0620, #3d0149, #1a0620);
    border: 2px solid #fbbf24;
    border-radius: 20px;
    padding: 40px 32px;
    max-width: 440px; width: 90%;
    text-align: center;
    animation: awardPop 0.6s cubic-bezier(0.34,1.56,0.64,1);
    position: relative; overflow: hidden;
  }
  .award-card::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(251,191,36,0.12) 0%, transparent 70%);
  }
  @keyframes awardPop {
    0%{transform:scale(0.5) rotate(-10deg);opacity:0}
    100%{transform:scale(1) rotate(0deg);opacity:1}
  }
  .award-medal { font-size: 5rem; margin-bottom: 12px; animation: medalSpin 1s ease 0.3s both; display: block; }
  @keyframes medalSpin {
    0%{transform:rotateY(180deg)} 100%{transform:rotateY(0deg)}
  }
  .award-stars { font-size: 1.4rem; margin-bottom: 14px; letter-spacing: 4px; }
  .award-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem; font-weight: 900;
    color: #fbbf24; margin-bottom: 8px;
  }
  .award-sub {
    font-size: 0.95rem; color: rgba(255,255,255,0.8);
    line-height: 1.6; margin-bottom: 20px;
  }
  .award-xp {
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem; color: #fbbf24;
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 8px; padding: 8px 20px;
    display: inline-block; margin-bottom: 20px;
  }
  .award-close {
    background: var(--purple); border: 1px solid var(--purple-light);
    color: var(--white); font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem; font-weight: 600;
    padding: 11px 28px; border-radius: 9px;
    cursor: pointer; transition: background 0.2s;
  }
  .award-close:hover { background: var(--purple-light); }
  .confetti-piece {
    position: absolute; width: 8px; height: 8px;
    border-radius: 2px; opacity: 0;
    animation: confettiFall 2s ease-in forwards;
  }
  @keyframes confettiFall {
    0%{transform:translateY(-20px) rotate(0deg);opacity:1}
    100%{transform:translateY(400px) rotate(720deg);opacity:0}
  }

  /* ── LESSON COMPLETION BADGE ── */
  .lesson-complete-badge {
    display: none;
    background: rgba(34,197,94,0.12);
    border: 1px solid rgba(34,197,94,0.4);
    border-radius: 8px;
    padding: 10px 16px;
    margin: 12px 0 0;
    font-size: 0.85rem; color: #86efac;
    align-items: center; gap: 8px;
    font-weight: 600;
  }
  .lesson-complete-badge.show { display: flex; }

  /* ── CASE FLAG ── */
  .case-flag {
    display: inline-flex; align-items: center; gap: 7px;
    background: rgba(24,168,228,0.1);
    border: 1px solid rgba(24,168,228,0.25);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.75rem; font-weight: 600;
    color: var(--blue-light);
    margin: 18px 0 8px;
    letter-spacing: 0.03em;
  }

  /* ── GRADE DISPLAY ── */
  .grade-banner {
    margin-top: 18px;
    background: linear-gradient(135deg, rgba(89,2,107,0.35), rgba(24,168,228,0.15));
    border: 1px solid rgba(89,2,107,0.6);
    border-radius: 14px;
    padding: 18px 22px;
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  }
  .grade-circle {
    width: 72px; height: 72px; border-radius: 50%;
    border: 3px solid var(--purple-light);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    background: rgba(89,2,107,0.3);
  }
  .grade-circle .grade-num {
    font-family: 'Space Mono', monospace;
    font-size: 1.4rem; font-weight: 700;
    line-height: 1;
  }
  .grade-circle .grade-lbl {
    font-size: 0.55rem; color: var(--gray);
    text-transform: uppercase; letter-spacing: 0.1em;
  }
  .grade-details { flex: 1; min-width: 180px; }
  .grade-details h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1rem; font-weight: 700;
    color: var(--white); margin-bottom: 6px;
  }
  .grade-row {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 5px;
    font-size: 0.82rem; color: rgba(255,255,255,0.75);
  }
  .grade-bar-wrap {
    flex: 1; height: 6px; background: rgba(255,255,255,0.1);
    border-radius: 3px; overflow: hidden;
  }
  .grade-bar-fill {
    height: 100%; border-radius: 3px;
    background: var(--blue);
    transition: width 0.8s ease;
  }
  .grade-letter {
    font-family: 'Space Mono', monospace;
    font-size: 2rem; font-weight: 700;
    margin-left: auto;
  }
  .grade-A { color: #4ade80; }
  .grade-B { color: #86efac; }
  .grade-C { color: #fbbf24; }
  .grade-D { color: #fb923c; }
  .grade-F { color: #f87171; }

  /* ── SCOREBOARD ── */
  #scoreboard {
    max-width: 900px; margin: 0 auto;
    padding: 0 32px 60px;
  }
  .scoreboard-box {
    background: linear-gradient(135deg, rgba(89,2,107,0.25), rgba(24,168,228,0.1));
    border: 1px solid rgba(89,2,107,0.5);
    border-radius: 18px;
    padding: 28px;
  }
  .scoreboard-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem; font-weight: 700;
    text-align: center; margin-bottom: 24px;
    color: var(--white);
  }
  .score-table {
    width: 100%; border-collapse: collapse; margin-bottom: 24px;
  }
  .score-table th {
    background: rgba(89,2,107,0.4);
    color: var(--blue-light);
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem; letter-spacing: 0.08em;
    padding: 10px 14px; text-align: left;
  }
  .score-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(89,2,107,0.2);
    font-size: 0.85rem; color: rgba(255,255,255,0.8);
    vertical-align: middle;
  }
  .score-table tr:last-child td { border-bottom: none; }
  .score-table .td-grade { font-family: 'Space Mono', monospace; font-weight: 700; }
  .score-table .td-bar { width: 120px; }
  .score-final-row {
    background: linear-gradient(90deg, rgba(89,2,107,0.4), rgba(24,168,228,0.15));
    border: 1px solid var(--blue);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 14px; margin-top: 8px;
  }
  .final-label {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem; font-weight: 700; color: var(--white);
  }
  .final-score-val {
    font-family: 'Space Mono', monospace;
    font-size: 2rem; font-weight: 700; color: var(--blue);
  }
  .final-letter-val {
    font-family: 'Playfair Display', serif;
    font-size: 2rem; font-weight: 900;
  }
  .diploma-btn {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none; color: #1a0620;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem; font-weight: 700;
    padding: 12px 24px; border-radius: 10px;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    display: flex; align-items: center; gap: 8px;
  }
  .diploma-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(251,191,36,0.3); }
  .diploma-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

  /* ── DIPLOMA MODAL ── */
  #diplomaModal {
    display: none; position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.9);
    align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
  }
  #diplomaModal.show { display: flex; }
  .diploma-card {
    background: #faf7f0;
    border: 3px solid #c9a227;
    border-radius: 4px;
    max-width: 680px; width: 100%;
    padding: 48px 52px;
    text-align: center;
    position: relative;
    box-shadow: 0 0 0 8px rgba(201,162,39,0.15), 0 0 60px rgba(0,0,0,0.6);
    color: #1a0a00;
  }
  .diploma-card::before, .diploma-card::after {
    content: ''; position: absolute;
    border: 2px solid rgba(201,162,39,0.4);
    border-radius: 2px;
  }
  .diploma-card::before { inset: 10px; }
  .diploma-card::after { inset: 14px; }
  .diploma-header {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem; letter-spacing: 0.25em;
    text-transform: uppercase; color: #8b6914;
    margin-bottom: 10px;
  }
  .diploma-school {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem; font-weight: 700;
    color: #59026B; margin-bottom: 4px;
  }
  .diploma-course {
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem; color: #6b4600; margin-bottom: 28px;
  }
  .diploma-certifies {
    font-size: 0.85rem; color: #6b4600; margin-bottom: 8px;
    letter-spacing: 0.05em;
  }
  .diploma-name {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem; font-weight: 900;
    color: #1a0a00; margin-bottom: 6px;
    border-bottom: 2px solid #c9a227;
    padding-bottom: 10px; display: inline-block;
    min-width: 280px;
  }
  .diploma-desc {
    font-size: 0.83rem; color: #6b4600;
    line-height: 1.7; margin: 18px auto;
    max-width: 480px;
  }
  .diploma-grade-box {
    display: inline-flex; align-items: center; gap: 20px;
    background: rgba(89,2,107,0.08);
    border: 2px solid rgba(89,2,107,0.25);
    border-radius: 12px;
    padding: 14px 28px;
    margin: 10px 0 24px;
  }
  .diploma-grade-item { text-align: center; }
  .diploma-grade-item .dg-val {
    font-family: 'Space Mono', monospace;
    font-size: 1.8rem; font-weight: 700;
    color: #59026B; line-height: 1;
  }
  .diploma-grade-item .dg-lbl {
    font-size: 0.65rem; color: #8b6914;
    text-transform: uppercase; letter-spacing: 0.1em;
    margin-top: 3px;
  }
  .diploma-divider { width: 1px; height: 50px; background: rgba(89,2,107,0.2); }
  .diploma-footer {
    display: flex; justify-content: space-between;
    align-items: flex-end; margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid rgba(201,162,39,0.3);
    flex-wrap: wrap; gap: 16px;
  }
  .diploma-sig { text-align: center; flex: 1; min-width: 140px; }
  .diploma-sig .sig-line {
    border-top: 1px solid #8b6914;
    margin-bottom: 6px; width: 140px; margin-left: auto; margin-right: auto;
  }
  .diploma-sig .sig-name {
    font-family: 'Playfair Display', serif;
    font-size: 0.85rem; font-weight: 700; color: #1a0a00;
  }
  .diploma-sig .sig-title { font-size: 0.68rem; color: #8b6914; }
  .diploma-seal {
    font-size: 3rem; text-align: center;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
  }
  .diploma-close {
    position: absolute; top: 12px; right: 16px;
    background: rgba(89,2,107,0.1);
    border: 1px solid rgba(89,2,107,0.3);
    color: #59026B; font-size: 1.1rem;
    width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.2s;
  }
  .diploma-close:hover { background: rgba(89,2,107,0.2); }
  .diploma-print-btn {
    background: #59026B; color: white;
    border: none; border-radius: 8px;
    padding: 10px 22px; font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem; font-weight: 600;
    cursor: pointer; margin-top: 16px;
    transition: background 0.2s;
    display: inline-flex; align-items: center; gap: 7px;
  }
  .diploma-print-btn:hover { background: #7a1590; }
  .name-input-wrap {
    margin-bottom: 20px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
  }
  .name-input-wrap label {
    font-size: 0.8rem; color: #8b6914; letter-spacing: 0.05em;
  }
  .name-input-field {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem; font-weight: 700;
    background: transparent; border: none;
    border-bottom: 2px solid #c9a227;
    text-align: center; color: #1a0a00;
    padding: 6px 12px; width: 280px;
    outline: none;
  }
  .name-input-field::placeholder { color: #c9a227; opacity: 0.6; }

  @media (max-width: 600px) {
    .hero-inner, .module-header, .lessons-container, #scoreboard, #rankingSection { padding-left: 16px; padding-right: 16px; }
    .card-grid { grid-template-columns: 1fr 1fr; }
    .roles-grid { grid-template-columns: 1fr 1fr; }
    .match-game { grid-template-columns: 1fr; }
    #progressBar { padding: 10px 16px; }
    .prog-lesson-dot { width: 28px; height: 28px; }
    .diploma-card { padding: 30px 20px; }
    .diploma-name { font-size: 1.6rem; }
    .score-table .td-bar { display: none; }
    .rank-bar-wrap { display: none; }
  }
  @media print {
    body > *:not(#diplomaModal) { display: none !important; }
    #diplomaModal { display: flex !important; position: static !important;
      background: white !important; backdrop-filter: none !important;
      padding: 0 !important; }
    .diploma-close, .diploma-print-btn, .name-input-wrap { display: none !important; }
    .diploma-card { box-shadow: none !important; max-width: 100% !important; }
  }

  /* ── RANKING SECTION ── */
  #rankingSection {
    max-width: 900px; margin: 0 auto;
    padding: 0 32px 60px;
  }
  .ranking-box {
    background: linear-gradient(135deg, rgba(89,2,107,0.2), rgba(24,168,228,0.08));
    border: 1px solid rgba(89,2,107,0.5);
    border-radius: 18px;
    overflow: hidden;
  }
  .ranking-header {
    background: linear-gradient(135deg, var(--purple-dark), var(--purple));
    padding: 22px 28px;
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
  }
  .ranking-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem; font-weight: 700; color: var(--white); margin: 0;
  }
  .ranking-header p { font-size: 0.82rem; color: rgba(255,255,255,0.65); margin: 4px 0 0; }
  .ranking-header-left { display: flex; flex-direction: column; }
  .ranking-header-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .ranking-refresh-btn {
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
    color: var(--white); font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem; font-weight: 600; padding: 7px 14px;
    border-radius: 7px; cursor: pointer; transition: background 0.2s;
    display: flex; align-items: center; gap: 6px;
  }
  .ranking-refresh-btn:hover { background: rgba(255,255,255,0.2); }
  .ranking-body { padding: 20px 24px 24px; }
  .ranking-empty {
    text-align: center; padding: 40px 20px;
    color: var(--gray); font-size: 0.9rem; line-height: 1.7;
  }
  .ranking-empty .empty-icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }
  .ranking-table { width: 100%; border-collapse: collapse; }
  .ranking-table th {
    background: rgba(89,2,107,0.35);
    color: var(--blue-light);
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem; letter-spacing: 0.1em;
    text-transform: uppercase; padding: 10px 14px; text-align: left;
  }
  .ranking-table td {
    padding: 11px 14px;
    border-bottom: 1px solid rgba(89,2,107,0.18);
    vertical-align: middle;
  }
  .ranking-table tr:last-child td { border-bottom: none; }
  .ranking-table tr { transition: background 0.15s; }
  .ranking-table tr:hover td { background: rgba(89,2,107,0.1); }
  .rank-pos {
    font-family: 'Space Mono', monospace;
    font-size: 1rem; font-weight: 700; text-align: center; width: 42px;
  }
  .rank-pos.gold   { color: #fbbf24; }
  .rank-pos.silver { color: #94a3b8; }
  .rank-pos.bronze { color: #cd7c34; }
  .rank-pos.other  { color: var(--gray); font-size: 0.82rem; }
  .rank-name { font-size: 0.93rem; font-weight: 600; color: var(--white); }
  .rank-name.me { color: var(--blue-light); }
  .rank-name.me::after {
    content: ' ← tú'; font-size: 0.68rem; font-weight: 400;
    color: var(--blue); margin-left: 6px; font-family: 'Space Mono', monospace;
  }
  .rank-score { font-family: 'Space Mono', monospace; font-size: 0.9rem; font-weight: 700; }
  .rank-letter { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 900; text-align: center; }
  .rank-xp { font-family: 'Space Mono', monospace; font-size: 0.75rem; color: #fbbf24; }
  .rank-date { font-size: 0.75rem; color: var(--gray); white-space: nowrap; }
  .rank-bar-wrap { width: 80px; height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
  .rank-bar-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
  .rank-row-top1 td { background: rgba(251,191,36,0.06); }
  .submit-ranking-wrap { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(89,2,107,0.25); }
  .submit-to-ranking-btn {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: none; color: #1a0620;
    font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 700;
    padding: 11px 22px; border-radius: 8px; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex; align-items: center; gap: 7px;
  }
  .submit-to-ranking-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(251,191,36,0.3); }
  .submit-to-ranking-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
  .ranking-submitted-msg {
    display: none; margin-top: 10px;
    background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3);
    border-radius: 8px; padding: 10px 16px;
    font-size: 0.85rem; color: #86efac; align-items: center; gap: 8px;
  }
  .ranking-submitted-msg.show { display: flex; }
  .ranking-loading {
    text-align: center; padding: 30px; color: var(--gray); font-size: 0.85rem;
    font-family: 'Space Mono', monospace;
  }

  /* ── NAME CAPTURE MODAL ── */
  #nameModal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999; /* below WP admin bar which is z-index:99999 */
    background: rgba(0,0,0,0.85);
    align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
  }
  #nameModal.show { display: flex; }
  /* WordPress admin bar is 32px tall (46px on mobile) — push modal content below it */
  body.admin-bar #nameModal { padding-top: 32px; }
  @media screen and (max-width: 782px) {
    body.admin-bar #nameModal { padding-top: 46px; }
  }
  .name-modal-card {
    background: linear-gradient(145deg, #1a0620, #3d0149);
    border: 2px solid var(--purple-light);
    border-radius: 18px;
    padding: 36px 32px;
    max-width: 420px; width: 90%;
    text-align: center;
    animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
  }
  @keyframes popIn { 0%{transform:scale(0.8);opacity:0} 100%{transform:scale(1);opacity:1} }
  .name-modal-icon { font-size: 2.8rem; margin-bottom: 12px; display: block; }
  .name-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem; font-weight: 700;
    color: var(--white); margin-bottom: 8px;
  }
  .name-modal-sub {
    font-size: 0.88rem; color: rgba(255,255,255,0.7);
    line-height: 1.6; margin-bottom: 22px;
  }
  .name-modal-sub strong { color: var(--blue-light); }
  .name-modal-input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(89,2,107,0.6);
    border-radius: 10px;
    color: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem; font-weight: 500;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 8px;
    text-align: center;
  }
  .name-modal-input:focus { border-color: var(--blue); }
  .name-modal-input::placeholder { color: rgba(255,255,255,0.3); }
  .name-modal-dni {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(89,2,107,0.6);
    border-radius: 10px;
    color: var(--white);
    font-family: 'Space Mono', monospace;
    font-size: 1rem; font-weight: 600;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 4px;
    text-align: center;
    letter-spacing: 0.15em;
  }
  .name-modal-dni:focus { border-color: var(--blue); }
  .name-modal-dni::placeholder { color: rgba(255,255,255,0.3); letter-spacing: 0.05em; font-weight: 400; }
  .name-modal-returning {
    display: none;
    background: rgba(34,197,94,0.12);
    border: 1px solid rgba(34,197,94,0.35);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82rem; color: #86efac;
    margin-bottom: 12px; text-align: left;
    line-height: 1.5;
  }
  .name-modal-returning.show { display: block; }
  .name-modal-hint {
    font-size: 0.72rem; color: var(--gray);
    margin-bottom: 18px; display: block;
  }
  .name-modal-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--purple), var(--purple-light));
    border: none; color: var(--white);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem; font-weight: 700;
    padding: 13px 24px; border-radius: 10px;
    cursor: pointer; transition: opacity 0.2s, transform 0.2s;
  }
  .name-modal-btn:hover { opacity: 0.9; transform: translateY(-1px); }
  .name-modal-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
  .name-modal-error {
    color: #fca5a5; font-size: 0.78rem;
    margin-top: 8px; display: none;
  }
  .name-modal-error.show { display: block; }
  .name-modal-progress {
    display: flex; gap: 4px; justify-content: center; margin-top: 16px;
  }
  .nm-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
  }
  .nm-dot.done { background: #22c55e; }
  .nm-dot.current { background: var(--blue); animation: nmPulse 1.2s infinite; }
  @keyframes nmPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.6;transform:scale(1.3)} }
  .ranking-tabs-bar {
    display: flex; overflow-x: auto;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(89,2,107,0.35);
    padding: 0 20px; gap: 2px;
    scrollbar-width: none;
  }
  .ranking-tabs-bar::-webkit-scrollbar { display: none; }
  .ranking-tab-btn {
    background: none; border: none;
    color: var(--gray); font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem; font-weight: 500;
    padding: 11px 14px; cursor: pointer;
    white-space: nowrap;
    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(--gold); border-bottom-color: var(--gold); }
  .ranking-tab-panel { display: none; padding: 20px 22px 22px; }
  .ranking-tab-panel.active { display: block; }

  /* ── MINI LESSON RANKING (inside quiz result) ── */
  .mini-ranking {
    margin-top: 16px;
    background: rgba(89,2,107,0.15);
    border: 1px solid rgba(89,2,107,0.4);
    border-radius: 10px;
    overflow: hidden;
  }
  .mini-ranking-header {
    background: rgba(89,2,107,0.3);
    padding: 8px 14px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
  }
  .mini-ranking-header span {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--blue-light);
  }
  .mini-ranking-refresh {
    background: none; border: none; color: var(--gray);
    font-size: 0.8rem; cursor: pointer; padding: 2px 6px;
    border-radius: 4px; transition: color 0.2s;
  }
  .mini-ranking-refresh:hover { color: var(--white); }
  .mini-ranking-body { padding: 8px 0; max-height: 220px; overflow-y: auto; }
  .mini-rank-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 14px;
    transition: background 0.15s;
  }
  .mini-rank-row:hover { background: rgba(89,2,107,0.1); }
  .mini-rank-row.me-row { background: rgba(24,168,228,0.08); }
  .mini-pos {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem; font-weight: 700;
    min-width: 28px; text-align: center;
  }
  .mini-name {
    flex: 1; font-size: 0.82rem; color: var(--white);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mini-name.is-me { color: var(--blue-light); font-weight: 600; }
  .mini-name.is-me::after { content: ' ←'; font-size: 0.65rem; color: var(--blue); }
  .mini-score {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem; font-weight: 700;
  }
  .mini-letter {
    font-family: 'Playfair Display', serif;
    font-size: 0.88rem; font-weight: 700;
    min-width: 18px; text-align: right;
  }
  .mini-ranking-empty {
    padding: 14px; text-align: center;
    color: var(--gray); font-size: 0.78rem; line-height: 1.5;
  }
  .mini-submit-row {
    padding: 10px 14px;
    border-top: 1px solid rgba(89,2,107,0.25);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  }
  .mini-submit-btn {
    background: rgba(251,191,36,0.15); border: 1px solid rgba(251,191,36,0.4);
    color: #fbbf24; font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem; font-weight: 700;
    padding: 5px 12px; border-radius: 6px; cursor: pointer;
    transition: background 0.2s; white-space: nowrap;
  }
  .mini-submit-btn:hover { background: rgba(251,191,36,0.25); }
  .mini-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .mini-submit-hint { font-size: 0.72rem; color: var(--gray); }

  /* ── GLOBAL RANKING TAB STYLES ── */
  .global-podium {
    display: flex; justify-content: center; align-items: flex-end;
    gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
  }
  .gpod-slot { display: flex; flex-direction: column; align-items: center; flex: 1; max-width: 180px; }
  .gpod-avatar {
    font-size: 1.6rem; margin-bottom: 6px;
    width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
  }
  .gpod-slot.gp1 .gpod-avatar { background: rgba(251,191,36,0.15); border: 2px solid #fbbf24; }
  .gpod-slot.gp2 .gpod-avatar { background: rgba(148,163,184,0.1); border: 2px solid #94a3b8; }
  .gpod-slot.gp3 .gpod-avatar { background: rgba(205,124,52,0.1); border: 2px solid #cd7c34; }
  .gpod-name { font-size: 0.82rem; font-weight: 700; text-align: center; margin-bottom: 3px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gpod-score { font-family: 'Space Mono', monospace; font-size: 0.75rem; margin-bottom: 6px; }
  .gpod-block { width: 100%; border-radius: 6px 6px 0 0; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
  .gpod-slot.gp1 .gpod-block { height: 70px; background: linear-gradient(180deg,#f59e0b,#92400e); }
  .gpod-slot.gp2 .gpod-block { height: 50px; background: linear-gradient(180deg,#6b7280,#374151); }
  .gpod-slot.gp3 .gpod-block { height: 38px; background: linear-gradient(180deg,#92400e,#451a03); }

  @media (max-width: 600px) {
    .hero-inner, .module-header, .lessons-container, #scoreboard, #rankingSection { padding-left: 16px; padding-right: 16px; }
    .card-grid, .roles-grid { grid-template-columns: 1fr 1fr; }
    .match-game { grid-template-columns: 1fr; }
    #progressBar { padding: 10px 16px; }
    .prog-lesson-dot { width: 28px; height: 28px; }
    .diploma-card { padding: 30px 20px; }
    .diploma-name { font-size: 1.6rem; }
    .score-table .td-bar, .rank-bar-wrap { display: none; }
    .global-podium { gap: 6px; }
    .gpod-slot { max-width: 110px; }
  }
  @media print {
    body > *:not(#diplomaModal) { display: none !important; }
    #diplomaModal { display: flex !important; position: static !important;
      background: white !important; backdrop-filter: none !important; padding: 0 !important; }
    .diploma-close, .diploma-print-btn, .name-input-wrap { display: none !important; }
    .diploma-card { box-shadow: none !important; max-width: 100% !important; }
  }

/* ── LOGOUT / SWITCH USER BUTTON ── */
#eml-logout-btn {
  display: none;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
#eml-logout-btn:hover {
  background: rgba(239,68,68,0.22);
  color: #fff;
}
