/* ============================================================
   AHA STUDENT COURSE — SHARED GAME ENGINE STYLES
   Research basis: Gamification increases engagement 60%,
   retention 40%. Activity switch every 3-4 min. Immediate feedback.
   ============================================================ */

:root {
  --navy: #162035; --navy-mid: #1e2a3e;
  --gold: #c49a28; --gold-light: #d4ae48;
  --cream: #f8f5ee; --cream-dark: #efe9dc;
  --text: #1a1a1a; --text-mid: #3d3d3d; --text-light: #6b6b6b;
  --white: #ffffff;
  /* Game colors */
  --xp: #7c3aed;        /* purple for XP */
  --xp-light: #a78bfa;
  --correct: #16a34a;   --correct-bg: #f0fdf4; --correct-border: #86efac;
  --wrong: #dc2626;     --wrong-bg: #fef2f2;   --wrong-border: #fca5a5;
  --streak: #ea580c;    /* orange streak fire */
  --badge: #c49a28;
}

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

body {
  font-family: 'Jost', sans-serif;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── XP NAV BAR ── */
.game-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: var(--navy);
  height: 60px;
  display: flex; align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  border-bottom: 2px solid var(--xp);
  box-shadow: 0 2px 20px rgba(124,58,237,0.3);
}
.nav-back {
  color: rgba(255,255,255,0.6); text-decoration: none;
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  display: flex; align-items: center; gap: 0.35rem; transition: color 0.2s;
  flex-shrink: 0;
}
.nav-back:hover { color: var(--gold); }
.nav-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.12); flex-shrink: 0; }
.nav-module-label {
  color: var(--xp-light); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* XP COUNTER */
.xp-counter {
  margin-left: auto;
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(124,58,237,0.2);
  border: 1px solid rgba(167,139,250,0.3);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  flex-shrink: 0;
}
.xp-icon { font-size: 0.9rem; }
.xp-value {
  color: var(--xp-light);
  font-size: 0.82rem; font-weight: 700;
  transition: transform 0.2s;
}
.xp-value.pop { animation: xpPop 0.4s ease-out; }
@keyframes xpPop {
  0%   { transform: scale(1); color: #ffd700; }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* STREAK BADGE */
.streak-badge {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; color: var(--streak);
  font-weight: 700;
}

/* MODULE PROGRESS DOTS */
.mod-dots { display: flex; gap: 5px; flex-shrink: 0; }
.mod-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: background 0.4s, transform 0.2s;
}
.mod-dot.done { background: var(--gold); }
.mod-dot.active { background: var(--xp-light); transform: scale(1.3); }

/* ── SECTION PROGRESS BAR ── */
.section-progress {
  position: fixed; top: 60px; left: 0; right: 0; z-index: 199;
  height: 4px;
  background: rgba(255,255,255,0.1);
}
.section-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--xp) 0%, var(--xp-light) 100%);
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 8px rgba(124,58,237,0.6);
}

/* ── MODULE HERO ── */
.module-hero {
  min-height: 44vh; position: relative;
  display: flex; align-items: flex-end;
  padding-top: 64px;
}
.module-hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(0.28);
}
.module-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--navy) 0%, rgba(22,32,53,0.35) 70%, transparent 100%);
}
.module-hero-content {
  position: relative; z-index: 2;
  padding: 0 2.5rem 2.5rem;
  max-width: 1000px; width: 100%; margin: 0 auto;
}
.module-badge-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(124,58,237,0.25);
  border: 1px solid rgba(167,139,250,0.4);
  border-radius: 20px; padding: 0.25rem 0.75rem;
  color: var(--xp-light); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.module-hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 700; color: var(--white);
  line-height: 1.05; margin-bottom: 0.5rem;
}
.module-hero h1 em { font-style: italic; color: var(--gold-light); }
.module-hero-sub {
  color: rgba(255,255,255,0.65); font-size: 0.95rem;
  max-width: 480px; font-weight: 300; line-height: 1.6;
}
.hero-xp-preview {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.78rem; color: var(--xp-light);
}

/* ── CONTENT BODY ── */
.module-body {
  max-width: 800px; margin: 0 auto;
  padding: 2.5rem 1.5rem 6rem;
}

/* ── CONTENT SECTIONS (slide in) ── */
.content-block {
  margin-bottom: 2rem;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s, transform 0.5s;
}
.content-block.visible { opacity: 1; transform: translateY(0); }

.content-block h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem; font-weight: 700; color: var(--navy);
  margin-bottom: 0.6rem; line-height: 1.2;
}
.content-block h2 em { font-style: italic; color: var(--gold); }
.content-block p {
  color: var(--text-mid); font-size: 0.95rem; line-height: 1.8;
  margin-bottom: 0.75rem;
}

/* LILY CARD */
.lily-card {
  display: flex; align-items: flex-start; gap: 1rem;
  background: var(--white);
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.lily-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background-image: url('lily-hero.png');
  background-size: cover; background-position: center 15%;
  flex-shrink: 0;
  border: 2px solid var(--gold);
}
.lily-name {
  font-size: 0.68rem; font-weight: 600; color: var(--gold);
  letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.3rem;
}
.lily-text { font-size: 0.9rem; color: var(--text-mid); line-height: 1.7; }

/* CALLOUT */
.callout {
  background: var(--navy); border-radius: 8px;
  padding: 1.25rem 1.5rem; color: var(--white);
  margin: 1.5rem 0;
  border-left: 3px solid var(--xp);
}
.callout-label {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--xp-light); margin-bottom: 0.4rem;
}
.callout p { color: rgba(255,255,255,0.92); font-size: 0.9rem; margin: 0; }
.callout strong { color: var(--white); }

/* ── ACTIVITY CONTAINERS ── */
.activity-block {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  border: 1.5px solid rgba(124,58,237,0.15);
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.5s, transform 0.5s;
}
.activity-block.visible { opacity: 1; transform: translateY(0); }

.activity-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.activity-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--xp);
}
.activity-xp-tag {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.2);
  color: var(--xp); font-size: 0.7rem; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 10px;
}

/* ── QUIZ STYLES ── */
.quiz-question {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem; font-weight: 600; color: var(--navy);
  margin-bottom: 1rem; line-height: 1.3;
}
.quiz-options { display: flex; flex-direction: column; gap: 0.6rem; }
.quiz-opt {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--cream); border: 2px solid rgba(0,0,0,0.08);
  border-radius: 8px; padding: 0.85rem 1rem;
  cursor: pointer; transition: all 0.18s;
  font-size: 0.9rem; color: var(--text-mid);
  user-select: none;
}
.quiz-opt:hover:not(.disabled) {
  border-color: var(--xp);
  background: rgba(124,58,237,0.04);
  transform: translateX(4px);
}
.quiz-opt.correct {
  border-color: var(--correct); background: var(--correct-bg); color: var(--correct);
  animation: correctBounce 0.4s ease-out;
}
.quiz-opt.wrong {
  border-color: var(--wrong); background: var(--wrong-bg); color: var(--wrong);
  animation: wrongShake 0.4s ease-out;
}
.quiz-opt.disabled { pointer-events: none; }
.quiz-opt.reveal-correct { border-color: var(--correct); background: var(--correct-bg); }
.quiz-letter {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,0.08); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
}

@keyframes correctBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.04) translateX(4px); }
  100% { transform: scale(1) translateX(4px); }
}
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.quiz-feedback {
  margin-top: 0.75rem; padding: 0.85rem 1rem;
  border-radius: 8px; font-size: 0.88rem; line-height: 1.6;
  display: none;
}
.quiz-feedback.show { display: flex; align-items: flex-start; gap: 0.5rem; }
.quiz-feedback.correct-fb { background: var(--correct-bg); border: 1px solid var(--correct-border); color: #14532d; }
.quiz-feedback.wrong-fb { background: var(--wrong-bg); border: 1px solid var(--wrong-border); color: #7f1d1d; }

/* XP TOAST */
.xp-toast {
  position: fixed;
  top: 75px; right: 1.5rem;
  background: var(--xp);
  color: white; font-weight: 700; font-size: 1rem;
  padding: 0.5rem 1rem; border-radius: 20px;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  z-index: 300;
  animation: toastIn 0.3s ease-out;
  pointer-events: none;
}
@keyframes toastIn {
  from { transform: translateY(-20px) scale(0.8); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── DRAG SORT ── */
.sort-arena {
  display: flex; flex-direction: column; gap: 1rem;
}
.sort-cards {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  min-height: 60px;
  justify-content: center;
}
.sort-card {
  background: var(--navy-mid); color: var(--white);
  border-radius: 8px; padding: 0.6rem 1rem;
  font-size: 0.85rem; cursor: grab;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
}
.sort-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.sort-card.dragging { opacity: 0.4; cursor: grabbing; }
.sort-card.placed-correct { background: var(--correct); border-color: #15803d; cursor: default; }
.sort-card.placed-wrong { background: var(--wrong); border-color: #b91c1c; }

.sort-bins {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.sort-bin {
  border: 2px dashed rgba(0,0,0,0.15);
  border-radius: 10px; padding: 1rem;
  min-height: 90px;
  transition: border-color 0.2s, background 0.2s;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.sort-bin.drag-over { border-color: var(--xp); background: rgba(124,58,237,0.05); }
.sort-bin-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-light);
  margin-bottom: 0.5rem;
}

/* ── RAPID FIRE ── */
.rapid-fire-display {
  text-align: center;
}
.rapid-question {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem; font-weight: 700; color: var(--navy);
  margin-bottom: 1.5rem; line-height: 1.3;
  min-height: 80px; display: flex; align-items: center; justify-content: center;
}
.rapid-timer {
  width: 100%; height: 6px; background: var(--cream-dark);
  border-radius: 3px; margin-bottom: 1.5rem; overflow: hidden;
}
.rapid-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--correct), var(--gold));
  border-radius: 3px;
  transition: width linear;
}
.rapid-timer-fill.urgent { background: linear-gradient(90deg, var(--wrong), var(--streak)); }
.rapid-tf-btns {
  display: flex; gap: 1rem; justify-content: center;
}
.rapid-btn {
  flex: 1; max-width: 160px;
  padding: 1rem; border-radius: 10px;
  font-family: 'Jost', sans-serif;
  font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  border: 2px solid transparent;
}
.rapid-btn.true-btn {
  background: rgba(22,163,74,0.1); border-color: var(--correct); color: var(--correct);
}
.rapid-btn.false-btn {
  background: rgba(220,38,38,0.1); border-color: var(--wrong); color: var(--wrong);
}
.rapid-btn:hover { transform: scale(1.04); }
.rapid-btn:disabled { pointer-events: none; }
.rapid-counter {
  font-size: 0.8rem; color: var(--text-light); margin-top: 1rem;
  text-align: center;
}
.rapid-result {
  display: none; text-align: center; padding: 1rem;
}
.rapid-result.show { display: block; }
.rapid-score-big {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3rem; font-weight: 700;
  color: var(--xp);
}

/* ── TAP REVEAL CARDS ── */
.tap-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.tap-card {
  border-radius: 10px; overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  position: relative;
  transition: transform 0.2s;
}
.tap-card:hover { transform: scale(1.03); }
.tap-card-front, .tap-card-back {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1rem; text-align: center;
  transition: opacity 0.3s;
}
.tap-card-front {
  background: var(--navy-mid);
  color: var(--white);
}
.tap-card-front-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.tap-card-front-hint { font-size: 0.72rem; color: rgba(255,255,255,0.5); }
.tap-card-back {
  background: linear-gradient(135deg, var(--xp), #4f46e5);
  color: white; opacity: 0;
}
.tap-card-back-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 0.35rem; }
.tap-card-back-body { font-size: 0.78rem; opacity: 0.9; line-height: 1.4; }
.tap-card.revealed .tap-card-front { opacity: 0; }
.tap-card.revealed .tap-card-back { opacity: 1; }

/* ── SCENARIO BRANCH ── */
.scenario-box {
  background: linear-gradient(135deg, var(--navy) 0%, #1a1040 100%);
  border-radius: 12px; padding: 1.5rem;
  color: #ffffff !important; margin-bottom: 1rem;
  border: 1px solid rgba(196,181,253,0.25);
}
.scenario-label-tag {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.2em;
  text-transform: uppercase; color: #c4b5fd !important;
  margin-bottom: 0.75rem;
}
.scenario-text {
  font-size: 0.95rem; color: #ffffff !important;
  line-height: 1.75; margin-bottom: 1.25rem;
}
.scenario-choices { display: flex; flex-direction: column; gap: 0.6rem; }
.scenario-choice {
  display: flex; align-items: center; gap: 0.75rem;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 8px; padding: 0.85rem 1rem;
  cursor: pointer; transition: all 0.18s;
  font-size: 0.9rem; color: #ffffff !important;
}
.scenario-choice:hover:not(.disabled) {
  background: rgba(124,58,237,0.2);
  border-color: var(--xp-light);
}
.scenario-choice.chosen-correct {
  background: rgba(22,163,74,0.2); border-color: var(--correct); color: #86efac;
}
.scenario-choice.chosen-wrong {
  background: rgba(220,38,38,0.15); border-color: var(--wrong); color: #fca5a5;
}
.scenario-choice.reveal-best {
  background: rgba(22,163,74,0.1); border-color: rgba(22,163,74,0.4);
}
.scenario-choice.disabled { pointer-events: none; }
.choice-letter {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
}
.scenario-outcome {
  margin-top: 1rem; padding: 1rem;
  border-radius: 8px; font-size: 0.88rem; line-height: 1.6;
  display: none;
}
.scenario-outcome.show { display: block; }
.scenario-outcome.good { background: rgba(22,163,74,0.15); border: 1px solid rgba(22,163,74,0.3); color: #86efac; }
.scenario-outcome.bad  { background: rgba(220,38,38,0.15);  border: 1px solid rgba(220,38,38,0.3);  color: #fca5a5; }

/* ── BOSS CHALLENGE ── */
.boss-block {
  background: linear-gradient(135deg, #1a0533 0%, #0f1729 100%);
  border-radius: 14px; padding: 1.75rem;
  border: 2px solid rgba(167,139,250,0.3);
  margin: 2rem 0;
  position: relative; overflow: hidden;
}
.boss-block::before {
  content: '';
  position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.3) 0%, transparent 70%);
}
.boss-header {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem;
}
.boss-icon { font-size: 1.8rem; }
.boss-title-wrap {}
.boss-eyebrow {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.2em;
  text-transform: uppercase; color: #fb923c; margin-bottom: 0.2rem;
}
.boss-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem; font-weight: 700; color: #ffffff; line-height: 1.2;
}

/* ── BADGE UNLOCK ── */
.badge-unlock {
  text-align: center; padding: 2rem 1.5rem;
  display: none;
}
.badge-unlock.show { display: block; animation: badgeIn 0.6s ease-out; }
@keyframes badgeIn {
  from { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.1); }
  to   { transform: scale(1); opacity: 1; }
}
.badge-icon-wrap {
  width: 100px; height: 100px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; margin: 0 auto 1rem;
  box-shadow: 0 0 40px rgba(196,154,40,0.5);
}
.badge-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem; font-weight: 700; color: var(--navy);
  margin-bottom: 0.5rem;
}
.badge-sub { color: var(--text-mid); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ── KEY TAKEAWAYS ── */
.takeaways {
  background: var(--navy); border-radius: 10px;
  padding: 1.75rem; margin: 2rem 0;
}
.takeaways-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem; font-weight: 700; color: white; margin-bottom: 1rem;
}
.takeaways-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.takeaways-list li {
  display: flex; align-items: flex-start; gap: 0.75rem;
  color: rgba(255,255,255,0.8); font-size: 0.9rem; line-height: 1.6;
}
.tk-icon { color: var(--gold); flex-shrink: 0; margin-top: 0.05rem; }

/* ── NEXT MODULE BTN ── */
.next-mod-btn {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gold); color: var(--navy);
  padding: 1.1rem 1.5rem; border-radius: 8px;
  text-decoration: none; margin-top: 1.5rem;
  transition: all 0.25s;
  box-shadow: 0 4px 20px rgba(196,154,40,0.3);
}
.next-mod-btn:hover {
  background: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(196,154,40,0.4);
}
.next-mod-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.2rem; }
.next-mod-title { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 700; }
.next-arrow { font-size: 1.4rem; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .module-hero-content { padding: 0 1.25rem 2rem; }
  .module-body { padding: 2rem 1rem 5rem; }
  .sort-bins { grid-template-columns: 1fr; }
  .rapid-tf-btns { gap: 0.5rem; }
  .nav-module-label { display: none; }
}
