:root {
  --red: #9C2233;
  --red-dark: #7D1B29;
  --red-light: #F3E8EA;
  --black: #111111;
  --gray-dark: #333;
  --gray: #666;
  --gray-light: #f4f4f4;
  --white: #ffffff;
  --border: #e5e5e5;
  --gold: #D4AF37;
}

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

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

/* NAV */
nav {
  background: var(--white);
  border-bottom: 3px solid var(--red);
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 0;
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.nav-logo-text span:first-child {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--black);
}

.nav-logo-text span:last-child {
  display: block;
  font-size: 11px;
  color: var(--red);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-badge-count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray);
  font-weight: 500;
}

.badge-pill {
  background: var(--gold);
  color: white;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* HERO */
.hero {
  background: var(--black);
  padding: 72px 48px 56px;
  position: relative;
  overflow: hidden;
  background-image: url('../Pictures/students.jpg');
  background-size: cover;
  background-position: center 30%;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.82);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 400px; height: 100%;
  background: linear-gradient(135deg, transparent 40%, rgba(156,34,51,0.15));
  pointer-events: none;
  z-index: 2;
}

.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  margin-bottom: 16px;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(30px, 4.5vw, 46px);
  font-weight: 900;
  color: var(--white);
  line-height: 1.15;
  max-width: 700px;
  margin-bottom: 20px;
  min-height: 4.8em;
}

.hero-title em {
  color: var(--red);
  font-style: normal;
}

.typewriter-cursor {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  background: var(--red);
  margin-left: 4px;
  vertical-align: baseline;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-sub {
  font-size: 16px;
  color: rgba(255,255,255,0.6);
  max-width: 500px;
  line-height: 1.6;
  margin-bottom: 36px;
}

.hero-stats {
  display: flex;
  gap: 40px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--red);
}

.hero-stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* PROGRESS BAR */
.progress-banner {
  background: var(--red-light);
  border-bottom: 1px solid rgba(156,34,51,0.15);
  padding: 16px 48px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--red-dark);
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(156,34,51,0.15);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 3px;
  transition: width 0.8s ease;
}

.progress-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  white-space: nowrap;
}

/* MAIN LAYOUT */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 48px;
}

/* EXAM CARDS */
.module-card.exam {
  border-color: var(--gold);
  background: linear-gradient(135deg, #fffdf5, #fff9e6);
}

.module-card.exam::before {
  background: var(--gold);
  opacity: 1;
}

.module-card.exam:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(212,175,55,0.2);
}

.module-card.exam .module-icon {
  background: rgba(212,175,55,0.15);
}

.status-exam {
  background: rgba(212,175,55,0.15);
  color: #b8960f;
}

/* EVENT TABS */
.event-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 48px;
}

.event-tab {
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: var(--gray);
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  letter-spacing: 0.02em;
}

.event-tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
}

.event-tab.locked {
  color: #bbb;
  cursor: default;
}

.event-tab .coming-soon {
  font-size: 10px;
  background: var(--gray-light);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 6px;
  color: #999;
  font-weight: 500;
}

/* UNIT */
.unit {
  margin-bottom: 56px;
}

.unit-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.unit-number {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  white-space: nowrap;
}

.unit-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--black);
}

.unit-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.unit-count {
  font-size: 12px;
  color: var(--gray);
  white-space: nowrap;
}

/* MODULE GRID */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.module-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  color: inherit;
}

.module-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(156,34,51,0.1);
}

.module-card.completed {
  border-color: #27ae60;
  background: #f0faf4;
}

.module-card.locked {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--red);
  opacity: 0;
  transition: opacity 0.2s;
}

.module-card:hover::before,
.module-card.active::before { opacity: 1; }
.module-card.completed::before { background: #27ae60; opacity: 1; }

.module-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.module-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.module-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.status-available {
  background: var(--red-light);
  color: var(--red);
}

.status-completed {
  background: #e6f7ed;
  color: #27ae60;
}

.status-locked {
  background: var(--gray-light);
  color: #aaa;
}

.module-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gray);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.module-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--black);
  line-height: 1.3;
  margin-bottom: 8px;
}

.module-desc {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.5;
  margin-bottom: 16px;
}

.module-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: #aaa;
}

.module-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* BADGE SHELF */
.badge-section {
  background: var(--gray-light);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 56px;
}

.badge-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--black);
}

.badge-shelf {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 80px;
  position: relative;
  cursor: help;
}

/* Hover tooltip explaining how to earn the badge */
.badge-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  width: 200px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.badge-tooltip strong {
  font-size: 12px;
  color: #ffd966;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.badge-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1a1a1a;
}
.badge-item:hover .badge-tooltip,
.badge-item:focus .badge-tooltip,
.badge-item:focus-within .badge-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* On narrow phones, anchor the tooltip to the viewport so it doesn't clip
   off the left/right edge for badges near the screen edge. */
@media (max-width: 480px) {
  .badge-tooltip { width: min(220px, 70vw); font-size: 11px; }
}

.badge-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--white);
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.badge-circle.earned {
  border-color: var(--gold);
  background: linear-gradient(135deg, #fff9e6, #fff3cc);
  box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}

.badge-circle.locked-badge {
  filter: grayscale(1);
  opacity: 0.35;
}

.badge-name {
  font-size: 11px;
  text-align: center;
  color: var(--gray);
  font-weight: 500;
  line-height: 1.3;
}

/* COMING SOON SECTION */
.coming-soon-section {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  margin-bottom: 32px;
}

.coming-soon-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.coming-soon-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: #ccc;
  margin-bottom: 8px;
}

.coming-soon-sub {
  font-size: 14px;
  color: #bbb;
}

/* PROMO SECTION */
.promo-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px 64px;
}

.promo-header {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--black);
  text-align: center;
  margin-bottom: 32px;
}

.promo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.promo-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--black);
  border-radius: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  min-height: 340px;
}

.promo-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.4s ease;
}

.promo-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.3) 100%);
}

.promo-card:hover .promo-img {
  transform: scale(1.05);
}

.promo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}

.promo-content {
  position: relative;
  z-index: 1;
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 340px;
}

.promo-badge {
  display: inline-block;
  width: fit-content;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--red);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.promo-card.sandel .promo-badge {
  background: var(--gold);
  color: var(--black);
}

.promo-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 12px;
}

.promo-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  line-height: 1.6;
  margin-bottom: 20px;
}

.promo-cta {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  padding: 10px 20px;
  border-radius: 8px;
  width: fit-content;
  transition: background 0.2s;
}

.promo-cta:hover {
  background: var(--red-dark);
}

.promo-card.sandel .promo-cta {
  background: var(--gold);
  color: var(--black);
}

.promo-card.sandel .promo-cta:hover {
  background: #c4a030;
}

/* FOOTER */
footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 32px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer .footer-logo {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
}

footer .footer-logo span {
  color: var(--red);
}

footer p {
  font-size: 12px;
  color: var(--gray);
}

/* MODULE PANEL (overlay) */
.module-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.module-overlay.open {
  display: flex;
}

.module-panel {
  background: white;
  border-radius: 20px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.panel-close {
  position: absolute;
  top: 20px; right: 20px;
  background: var(--gray-light);
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  z-index: 10;
}

.panel-close:hover { background: var(--border); }

.panel-hero {
  background: var(--black);
  padding: 40px 48px 32px;
  border-radius: 20px 20px 0 0;
}

.panel-eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 10px;
}

.panel-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 900;
  color: white;
  margin-bottom: 16px;
}

.panel-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.6);
  line-height: 1.6;
  max-width: 560px;
  margin-bottom: 24px;
}

.panel-meta-row {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

.panel-meta-row span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-body {
  padding: 40px 48px;
}

.panel-section-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gray);
  margin-bottom: 20px;
}

.panel-lesson-list {
  list-style: none;
  margin-bottom: 32px;
}

.panel-lesson-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--gray-dark);
}

.panel-lesson-list li:last-child { border-bottom: none; }

.lesson-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-light);
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.panel-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 16px 32px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
}

.panel-cta:hover { background: var(--red-dark); }

/* TOAST */
/* AUTH LOADING STATE */
.auth-pending .progress-banner,
.auth-pending .badge-section,
.auth-pending #continueCard,
.auth-pending #navAuthArea {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.auth-ready .progress-banner,
.auth-ready .badge-section,
.auth-ready #continueCard,
.auth-ready #navAuthArea {
  opacity: 1;
  transition: opacity 0.3s ease;
}

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

/* ═══ SKELETON LOADERS ═══ */
@keyframes shimmer {
  0%   { background-position: -480px 0; }
  100% { background-position: 480px 0; }
}
.skeleton {
  background: #f0f0f0;
  background-image: linear-gradient(90deg, #f0f0f0 0%, #f7f7f7 50%, #f0f0f0 100%);
  background-size: 480px 100%;
  background-repeat: no-repeat;
  border-radius: 10px;
  display: inline-block;
  animation: shimmer 1.4s infinite linear;
}
body.dark-mode .skeleton {
  background: #1f1f1f;
  background-image: linear-gradient(90deg, #1f1f1f 0%, #2a2a2a 50%, #1f1f1f 100%);
  background-size: 480px 100%;
}
.skeleton-pill {
  height: 28px;
  width: 110px;
  margin-right: 8px;
  border-radius: 14px;
  vertical-align: middle;
}

/* ═══ CONTINUE WHERE YOU LEFT OFF ═══ */
.continue-card {
  background: linear-gradient(135deg, #111, #1a1a1a);
  border-radius: 16px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.continue-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(156,34,51,0.15);
}
.continue-card-left { display: flex; align-items: center; gap: 16px; }
.continue-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(156,34,51,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.continue-card-eyebrow { font-size: 11px; color: var(--red); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.continue-card-title { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: #fff; }
.continue-card-btn {
  background: var(--red); color: #fff; border: none; border-radius: 10px;
  padding: 12px 24px; font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background 0.2s; font-family: 'DM Sans', sans-serif;
}
.continue-card-btn:hover { background: var(--red-dark); }

/* ═══ UNIT PROGRESS RING ═══ */
.unit-progress-ring {
  width: 40px; height: 40px; flex-shrink: 0;
}
.unit-progress-ring circle { fill: none; stroke-width: 3; }
.unit-progress-ring .ring-bg { stroke: var(--border); }
.unit-progress-ring .ring-fill { stroke: var(--red); stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; transform: rotate(-90deg); transform-origin: center; }
.unit-progress-ring .ring-fill.complete { stroke: #27ae60; }
.unit-progress-text { font-size: 9px; font-weight: 700; fill: var(--gray); text-anchor: middle; dominant-baseline: central; }

/* ═══ UNIT COMPLETION ═══ */
.unit-header.complete .unit-number { color: #27ae60; }
.unit-header.complete .unit-title { color: #27ae60; }
.unit-header.complete::after {
  content: '✓';
  background: #27ae60; color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
  animation: shimmer 2s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { box-shadow: 0 0 0 rgba(39,174,96,0); }
  50% { box-shadow: 0 0 12px rgba(39,174,96,0.4); }
}

/* ═══ SCROLL ANIMATIONS ═══ */
.scroll-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══ RECENTLY COMPLETED ═══ */
.module-card.just-completed {
  border-color: #27ae60;
  box-shadow: 0 0 16px rgba(39,174,96,0.2);
}
.module-card.just-completed::after {
  content: 'Just completed ✓';
  position: absolute; top: 10px; right: 10px;
  background: #27ae60; color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 10px;
}

/* ═══ BADGE ANIMATION ═══ */
@keyframes badgeBounce {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.badge-circle.new-badge {
  animation: badgeBounce 0.6s ease forwards;
  box-shadow: 0 0 16px rgba(212,175,55,0.5);
}

/* ═══ HERO PARALLAX ═══ */
.hero {
  background-attachment: fixed;
}

/* ═══ MODULE VIDEO PREVIEW (hover, desktop only) ═══ */
.module-card { position: relative; }
.module-card .module-video-preview {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none; /* don't block clicks on the card */
  opacity: 0;
  transition: opacity 0.3s ease;
  background: #000;
  z-index: 2;
}
.module-card .module-video-preview iframe {
  position: absolute;
  /* Scale up so the YouTube branding bar at the bottom stays cropped off */
  top: -10%; left: -10%;
  width: 120%; height: 120%;
  border: 0;
  pointer-events: none;
}
.module-card .module-video-preview.show {
  opacity: 0.95;
}
.module-card:has(.module-video-preview.show) .module-icon,
.module-card:has(.module-video-preview.show) .module-title,
.module-card:has(.module-video-preview.show) .module-meta,
.module-card:has(.module-video-preview.show) .module-preview {
  opacity: 0; /* let the video shine */
  transition: opacity 0.3s ease;
}

/* ═══ MODULE HOVER TEXT PREVIEW ═══ */
.module-card .module-preview {
  display: none;
  font-size: 11px;
  color: var(--red);
  font-weight: 500;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.module-card:hover .module-preview {
  display: block;
  opacity: 1;
}

/* ═══ DARK MODE ═══ */
.dark-toggle {
  background: none; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 16px; line-height: 1;
  transition: all 0.2s;
}
.dark-toggle:hover { border-color: var(--gray); }

body.dark-mode {
  --white: #111;
  --black: #f0f0f0;
  --gray-dark: #ccc;
  --gray: #999;
  --gray-light: #1a1a1a;
  --border: #333;
  --red-light: #2a1115;
  background: #0a0a0a;
  color: #f0f0f0;
}
body.dark-mode nav { background: #111; border-bottom-color: var(--red); }
body.dark-mode .hero { background-color: #0a0a0a; }
body.dark-mode .hero-title, body.dark-mode .hero-title span { color: #ffffff !important; }
body.dark-mode .module-card { background: #151515; border-color: #2a2a2a; }
body.dark-mode .module-card:hover { border-color: var(--red); box-shadow: 0 8px 24px rgba(156,34,51,0.15); }
body.dark-mode .module-card.completed { background: #0f1f14; border-color: #1a3d24; }
body.dark-mode .module-card.exam { background: #1a1810; border-color: #3d3520; }
body.dark-mode .badge-section { background: #151515; }
body.dark-mode .progress-banner { background: #1a1115; border-bottom-color: rgba(156,34,51,0.2); }
body.dark-mode footer { background: #111; border-top-color: #2a2a2a; }
/* Module preview popup: keep the panel light-themed even in dark mode so
   the title/description stay readable. Background stays light, text dark. */
body.dark-mode .module-overlay .module-panel {
  background: #fff;
  color: #111;
}
body.dark-mode .panel-hero {
  background: #0d0d0d;
}
body.dark-mode .panel-title { color: #fff; }
body.dark-mode .panel-desc { color: rgba(255,255,255,0.75); }
body.dark-mode .panel-meta-row { color: rgba(255,255,255,0.6); }
body.dark-mode .panel-eyebrow { color: var(--red); }
body.dark-mode .panel-body {
  background: #fff;
  color: #111;
}
body.dark-mode .panel-section-title { color: #555; }
body.dark-mode .panel-lesson-list li {
  color: #333;
  border-bottom-color: #e5e5e5;
}
body.dark-mode .panel-close { background: rgba(0,0,0,0.08); color: #333; }
body.dark-mode .panel-close:hover { background: rgba(0,0,0,0.16); }
body.dark-mode .auth-panel { background: #1a1a1a; }
body.dark-mode .auth-input { background: #222; border-color: #333; color: #f0f0f0; }
body.dark-mode .auth-role-card { border-color: #333; }
body.dark-mode .auth-role-card:hover { border-color: var(--red); }
body.dark-mode .continue-card { background: linear-gradient(135deg, #1a1a1a, #222); }
body.dark-mode .nav-logo-icon {
  display: none;
}
body.dark-mode .nav-logo-text span:last-child {
  display: block;
}
body.dark-mode .footer-logo img {
  display: none;
}

@media (max-width: 768px) {
  nav { padding: 0 12px; height: 52px; }
  .nav-logo { gap: 8px; }
  .nav-logo-icon { width: 36px; height: 36px; }
  .nav-logo-text span:first-child { font-size: 13px; }
  .nav-logo-text span:last-child { display: none; }
  .nav-badge-count { display: none; }
  .nav-user-name { font-size: 12px; }
  .nav-auth-btn { padding: 6px 14px; font-size: 12px; }

  /* Fixed attachment makes mobile browsers size the bg to the viewport and crop
     heavily (the "zoomed in" look). Pin it to the element instead on phones. */
  .hero { padding: 48px 20px 40px; background-attachment: scroll; background-position: center; }
  .hero-title { font-size: clamp(24px, 6.5vw, 34px); min-height: 5em; }
  .hero-sub { font-size: 14px; }
  .hero-stats { gap: 20px; flex-wrap: wrap; }
  .hero-stat-num { font-size: 24px; }

  .progress-banner { padding: 12px 20px; flex-wrap: wrap; gap: 12px; }

  .main { padding: 32px 20px; }
  .main-tabs { margin-bottom: 24px; }
  .main-tab { padding: 10px 16px; font-size: 13px; }

  .badge-section { padding: 20px; margin-bottom: 32px; }
  .badge-section-title { font-size: 16px; }
  .badge-item { width: 64px; }
  .badge-circle { width: 48px; height: 48px; font-size: 20px; }
  .badge-name { font-size: 9px; }

  .event-tabs { margin-bottom: 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .event-tab { padding: 10px 16px; font-size: 12px; white-space: nowrap; }

  .unit { margin-bottom: 32px; }
  .unit-header { flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .unit-title { font-size: 18px; }
  .unit-line { display: none; }

  .module-grid { grid-template-columns: 1fr; gap: 12px; }
  .module-card { padding: 18px; }
  .module-title { font-size: 15px; }
  .module-desc { font-size: 12px; }

  .module-panel { border-radius: 16px; }
  .panel-hero { padding: 24px 20px 20px; border-radius: 16px 16px 0 0; }
  .panel-title { font-size: 22px; }
  .panel-desc { font-size: 13px; }
  .panel-body { padding: 24px 20px; }
  .panel-lesson-list li { font-size: 13px; gap: 10px; padding: 10px 0; }

  .promo-section { padding: 0 20px 40px; }
  .promo-header { font-size: 20px; }
  .promo-grid { grid-template-columns: 1fr; }
  .promo-content { min-height: 260px; padding: 24px; }
  .promo-title { font-size: 20px; }

  footer { padding: 24px 20px; flex-direction: column; gap: 12px; text-align: center; }

  .data-grid { grid-template-columns: 1fr; }
}
