/* ============================================================
   GetMedLingo — Design System
   Stack: Static HTML/CSS/JS  |  Mobile-first
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand */
  --color-primary:        #0d9488; /* teal-600  */
  --color-primary-dark:   #0f766e; /* teal-700  */
  --color-primary-light:  #ccfbf1; /* teal-100  */
  --color-primary-xlight: #f0fdfa; /* teal-50   */

  --color-navy:           #14213d;
  --color-navy-light:     #1e3a5f;

  --color-accent:         #f59e0b; /* amber-400 */
  --color-accent-dark:    #d97706; /* amber-500 */
  --color-accent-light:   #fef3c7; /* amber-100 */

  /* Feedback */
  --color-success:        #16a34a;
  --color-success-light:  #dcfce7;
  --color-danger:         #dc2626;
  --color-danger-light:   #fee2e2;
  --color-warning:        #d97706;
  --color-warning-light:  #fef3c7;
  --color-info:           #2563eb;
  --color-info-light:     #dbeafe;

  /* Neutrals */
  --color-text:           #1e293b;
  --color-text-muted:     #64748b;
  --color-text-faint:     #94a3b8;
  --color-border:         #e2e8f0;
  --color-border-focus:   #0d9488;
  --color-bg:             #f8fafc;
  --color-surface:        #ffffff;
  --color-surface-2:      #f1f5f9;

  /* Category colors */
  --cat-vitals:           #0d9488;
  --cat-sbar:             #7c3aed;
  --cat-medications:      #2563eb;
  --cat-emergencies:      #dc2626;
  --cat-discharge:        #16a34a;
  --cat-bedside:          #d97706;

  /* Typography */
  --font-base:   'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:     0.75rem;
  --text-sm:     0.875rem;
  --text-base:   1rem;
  --text-lg:     1.125rem;
  --text-xl:     1.25rem;
  --text-2xl:    1.5rem;
  --text-3xl:    1.875rem;

  --fw-normal:   400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --fw-extrabold:800;

  /* Spacing */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* Radius */
  --radius-sm:  0.375rem;
  --radius-md:  0.625rem;
  --radius-lg:  1rem;
  --radius-xl:  1.5rem;
  --radius-full:9999px;

  /* Shadow */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.10);
  --shadow-card:0 2px 8px rgba(14,165,152,.10);

  /* Motion */
  --ease:        cubic-bezier(.4,0,.2,1);
  --dur-fast:    150ms;
  --dur-base:    250ms;
  --dur-slow:    400ms;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-weight: var(--fw-bold);
  line-height: 1.25;
  color: var(--color-text);
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

.text-muted  { color: var(--color-text-muted); }
.text-faint  { color: var(--color-text-faint); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.text-lg     { font-size: var(--text-lg); }
.font-bold   { font-weight: var(--fw-bold); }
.font-medium { font-weight: var(--fw-medium); }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

.container--wide {
  max-width: 1100px;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  background: var(--color-navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 var(--sp-4);
  max-width: 1100px;
  margin: 0 auto;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xl);
  font-weight: var(--fw-extrabold);
  color: #fff;
  letter-spacing: -.3px;
}

.navbar__brand span.brand-med { color: var(--color-accent); }

.navbar__logo-icon {
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* Language toggle */
.lang-toggle {
  display: flex;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.lang-toggle__btn {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: rgba(255,255,255,.7);
  transition: all var(--dur-fast) var(--ease);
  letter-spacing: .4px;
}

.lang-toggle__btn.active {
  background: var(--color-primary);
  color: #fff;
}

/* XP pill in navbar */
.xp-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: #fff;
}

.xp-pill__star { color: var(--color-accent); }

/* ── Hero / Stats Banner ─────────────────────────────────────── */
.stats-banner {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
  color: #fff;
  padding: var(--sp-6) var(--sp-4);
}

.stats-banner__greeting {
  font-size: var(--text-sm);
  color: rgba(255,255,255,.65);
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-1);
  letter-spacing: .2px;
}

.stats-banner__name {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  margin-bottom: var(--sp-4);
}

.stats-banner__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.stat-card {
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  text-align: center;
}

.stat-card__value {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  color: var(--color-accent);
  line-height: 1;
}

.stat-card__label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.65);
  margin-top: var(--sp-1);
  font-weight: var(--fw-medium);
}

/* XP progress bar in banner */
.xp-bar-wrapper {
  margin-top: var(--sp-4);
}

.xp-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: rgba(255,255,255,.65);
  margin-bottom: var(--sp-2);
}

.xp-bar {
  height: 8px;
  background: rgba(255,255,255,.2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.xp-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease);
}

/* ── Section headings ───────────────────────────────────────── */
.section {
  padding: var(--sp-6) var(--sp-4);
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.section__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-text);
}

.section__link {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
}

/* ── Category Grid ──────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

@media (min-width: 520px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
}

.category-card {
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  text-align: center;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.category-card__icon {
  font-size: 2rem;
  margin-bottom: var(--sp-2);
  display: block;
}

.category-card__name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-bottom: var(--sp-1);
}

.category-card__count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.category-card__progress {
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(0,0,0,.1);
  margin-top: var(--sp-3);
  overflow: hidden;
}

.category-card__progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

/* Category color themes */
.cat--vitals      { background: #f0fdfa; border-color: #99f6e4; }
.cat--vitals .category-card__progress-fill { background: var(--cat-vitals); }

.cat--sbar        { background: #faf5ff; border-color: #e9d5ff; }
.cat--sbar .category-card__progress-fill { background: var(--cat-sbar); }

.cat--medications { background: #eff6ff; border-color: #bfdbfe; }
.cat--medications .category-card__progress-fill { background: var(--cat-medications); }

.cat--emergencies { background: #fff5f5; border-color: #fecaca; }
.cat--emergencies .category-card__progress-fill { background: var(--cat-emergencies); }

.cat--discharge   { background: #f0fdf4; border-color: #bbf7d0; }
.cat--discharge .category-card__progress-fill { background: var(--cat-discharge); }

.cat--bedside     { background: #fffbeb; border-color: #fde68a; }
.cat--bedside .category-card__progress-fill { background: var(--cat-bedside); }

/* ── Lesson Cards ───────────────────────────────────────────── */
.lesson-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.lesson-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  text-decoration: none;
  color: inherit;
}

.lesson-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card);
  text-decoration: none;
}

.lesson-card--completed {
  background: var(--color-primary-xlight);
  border-color: var(--color-primary-light);
}

.lesson-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.lesson-card__body { flex: 1; min-width: 0; }

.lesson-card__title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-bottom: var(--sp-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}

.lesson-card__arrow {
  color: var(--color-text-faint);
  font-size: 1.2rem;
  align-self: center;
  flex-shrink: 0;
}

/* ── Badges / Chips ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}

.badge--primary   { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge--accent    { background: var(--color-accent-light);  color: var(--color-accent-dark); }
.badge--success   { background: var(--color-success-light); color: var(--color-success); }
.badge--danger    { background: var(--color-danger-light);  color: var(--color-danger); }
.badge--muted     { background: var(--color-surface-2);     color: var(--color-text-muted); }
.badge--purple    { background: #f3e8ff; color: #7c3aed; }

/* Level badge */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  letter-spacing: .4px;
  text-transform: uppercase;
}

.level--beginner     { background: var(--color-success-light); color: var(--color-success); }
.level--intermediate { background: var(--color-warning-light); color: var(--color-warning); }
.level--advanced     { background: var(--color-danger-light);  color: var(--color-danger); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  transition: all var(--dur-fast) var(--ease);
  cursor: pointer;
  border: 2px solid transparent;
  line-height: 1;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover { background: var(--color-primary-dark); }

.btn--accent {
  background: var(--color-accent);
  color: #fff;
}
.btn--accent:hover { background: var(--color-accent-dark); }

.btn--outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn--outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn--ghost {
  background: transparent;
  color: var(--color-primary);
}
.btn--ghost:hover { background: var(--color-primary-xlight); }

.btn--full  { width: 100%; }
.btn--sm    { padding: var(--sp-2) var(--sp-4); font-size: var(--text-sm); }
.btn--lg    { padding: var(--sp-4) var(--sp-8); font-size: var(--text-lg); }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Progress Bar (generic) ─────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width var(--dur-slow) var(--ease);
}

/* ── LESSON PLAYER ──────────────────────────────────────────── */
.lesson-header {
  background: var(--color-navy);
  color: #fff;
  padding: var(--sp-4);
  position: sticky;
  top: 60px;
  z-index: 90;
}

.lesson-header__top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.lesson-header__back {
  color: rgba(255,255,255,.75);
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}

.lesson-header__title {
  flex: 1;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: #fff;
}

.lesson-header__xp {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-accent);
  background: rgba(245,158,11,.15);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-full);
}

/* Lesson progress dots */
.lesson-progress {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lesson-progress__dot {
  height: 6px;
  flex: 1;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.2);
  transition: background var(--dur-base) var(--ease);
}

.lesson-progress__dot.done     { background: var(--color-primary); }
.lesson-progress__dot.current  { background: var(--color-accent); }

/* ── Lesson Items ────────────────────────────────────────────── */
.lesson-body {
  padding: var(--sp-6) var(--sp-4);
  max-width: 720px;
  margin: 0 auto;
}

/* Info card */
.info-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-4);
  animation: fadeUp var(--dur-base) var(--ease);
}

.info-card__type-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--color-primary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.info-card__en {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-bottom: var(--sp-3);
  line-height: 1.5;
}

.info-card__es {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  border-left: 3px solid var(--color-accent);
  line-height: 1.6;
}

.info-card__example {
  margin-top: var(--sp-4);
  background: var(--color-primary-xlight);
  border: 1px solid var(--color-primary-light);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--color-primary-dark);
}

.info-card__example-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-primary);
  margin-bottom: var(--sp-1);
}

/* Question card */
.question-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: fadeUp var(--dur-base) var(--ease);
}

.question-card__header {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
  padding: var(--sp-5) var(--sp-6);
}

.question-card__num {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .6px;
  color: rgba(255,255,255,.55);
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-card__prompt-es {
  font-size: var(--text-sm);
  color: rgba(255,255,255,.65);
  margin-bottom: var(--sp-3);
  font-style: italic;
  line-height: 1.5;
}

.question-card__prompt-en {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: #fff;
  line-height: 1.5;
}

.question-card__body {
  padding: var(--sp-5) var(--sp-6);
}

/* Multiple choice options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: var(--sp-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-base);
  color: var(--color-text);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  transition: all var(--dur-fast) var(--ease);
  cursor: pointer;
  line-height: 1.5;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary-xlight);
}

.option-btn__letter {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease);
}

.option-btn.correct {
  border-color: var(--color-success);
  background: var(--color-success-light);
}

.option-btn.correct .option-btn__letter {
  background: var(--color-success);
  color: #fff;
}

.option-btn.incorrect {
  border-color: var(--color-danger);
  background: var(--color-danger-light);
}

.option-btn.incorrect .option-btn__letter {
  background: var(--color-danger);
  color: #fff;
}

.option-btn.dimmed {
  opacity: .45;
}

.option-btn:disabled { cursor: default; }

/* Fill-in-the-blank */
.fill-blank-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--dur-fast) var(--ease);
  margin-bottom: var(--sp-3);
}

.fill-blank-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}

.fill-blank-input.correct { border-color: var(--color-success); background: var(--color-success-light); }
.fill-blank-input.incorrect { border-color: var(--color-danger); background: var(--color-danger-light); }

/* Scenario / branching */
.scenario-card {
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: var(--radius-xl);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-4);
  animation: fadeUp var(--dur-base) var(--ease);
}

.scenario-card__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--color-accent-dark);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.scenario-card__situation {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin-bottom: var(--sp-2);
  line-height: 1.5;
}

.scenario-card__situation-es {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Feedback box */
.feedback-box {
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  margin-top: var(--sp-4);
  animation: fadeUp var(--dur-fast) var(--ease);
}

.feedback-box--correct {
  background: var(--color-success-light);
  border: 1.5px solid #86efac;
}

.feedback-box--incorrect {
  background: var(--color-danger-light);
  border: 1.5px solid #fca5a5;
}

.feedback-box--warning {
  background: var(--color-warning-light);
  border: 1.5px solid #fde68a;
}

.feedback-box__headline {
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-2);
}

.feedback-box--correct .feedback-box__headline { color: var(--color-success); }
.feedback-box--incorrect .feedback-box__headline { color: var(--color-danger); }
.feedback-box--warning .feedback-box__headline { color: var(--color-warning); }

.feedback-box__text {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: var(--sp-2);
}

.feedback-box__text-es {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  line-height: 1.6;
}

/* ── Lesson footer / action area ────────────────────────────── */
.lesson-footer {
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  border-top: 1.5px solid var(--color-border);
  padding: var(--sp-4);
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  justify-content: flex-end;
}

/* ── Completion screen ──────────────────────────────────────── */
.completion-screen {
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
  max-width: 480px;
  margin: 0 auto;
  animation: fadeUp var(--dur-slow) var(--ease);
}

.completion-screen__trophy {
  font-size: 5rem;
  margin-bottom: var(--sp-4);
  display: block;
}

.completion-screen__title {
  font-size: var(--text-3xl);
  font-weight: var(--fw-extrabold);
  color: var(--color-text);
  margin-bottom: var(--sp-2);
}

.completion-screen__subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-6);
}

.completion-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.completion-stat {
  background: var(--color-surface-2);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.completion-stat__value {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  color: var(--color-primary);
}

.completion-stat__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
  font-weight: var(--fw-medium);
}

/* ── Difficulty indicator ───────────────────────────────────── */
.diff-indicator {
  display: flex;
  align-items: center;
  gap: 3px;
}

.diff-indicator__bar {
  width: 6px;
  height: 14px;
  border-radius: 2px;
  background: var(--color-border);
}

.diff-indicator__bar.lit { background: var(--color-primary); }

/* ── Utilities ──────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.gap-2       { gap: var(--sp-2); }
.gap-3       { gap: var(--sp-3); }
.mt-2        { margin-top: var(--sp-2); }
.mt-4        { margin-top: var(--sp-4); }
.mt-6        { margin-top: var(--sp-6); }
.mb-2        { margin-bottom: var(--sp-2); }
.mb-4        { margin-bottom: var(--sp-4); }
.hidden      { display: none !important; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  0%   { transform: scale(.8); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.anim-pop { animation: popIn var(--dur-base) var(--ease); }

/* ── Lesson card: number + locked variants ─────────────────── */
.lesson-card__num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lesson-card--locked {
  opacity: .6;
  cursor: pointer !important;
  background: var(--color-surface);
}

.lesson-card--locked:hover {
  border-color: var(--color-text-faint);
  box-shadow: none;
}

.lesson-card__lock {
  font-size: 1.1rem;
  align-self: center;
  flex-shrink: 0;
}

/* ── Tier switcher (navbar) ─────────────────────────────────── */
.tier-switcher {
  display: flex;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.tier-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease);
  cursor: pointer;
  background: transparent;
}

.tier-btn.active {
  background: var(--color-primary);
}

.tier-btn:hover:not(.active) {
  background: rgba(255,255,255,.15);
}

.tier-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: rgba(255,255,255,.75);
  white-space: nowrap;
}

/* ── Auth navbar elements ───────────────────────────────────── */
.nav-auth {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nav-auth__btn {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}

.nav-auth__btn--signin {
  background: rgba(255,255,255,.15);
  color: #fff;
}

.nav-auth__btn--signin:hover {
  background: rgba(255,255,255,.25);
}

.nav-auth__btn--signout {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  font-size: var(--text-xs);
}

.nav-auth__btn--signout:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.nav-auth__name {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: rgba(255,255,255,.9);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Category hero ──────────────────────────────────────────── */
.cat-hero {
  background: var(--color-navy);
  color: #fff;
  padding: var(--sp-5) var(--sp-4);
}

.cat-hero--vitals      { background: linear-gradient(135deg, #0c4a4e 0%, #0d9488 100%); }
.cat-hero--sbar        { background: linear-gradient(135deg, #3b0764 0%, #7c3aed 100%); }
.cat-hero--medications { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); }
.cat-hero--emergencies { background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 100%); }
.cat-hero--discharge   { background: linear-gradient(135deg, #14532d 0%, #16a34a 100%); }
.cat-hero--bedside     { background: linear-gradient(135deg, #78350f 0%, #d97706 100%); }

.cat-hero__back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: rgba(255,255,255,.7);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-4);
  transition: color var(--dur-fast);
}
.cat-hero__back:hover { color: #fff; text-decoration: none; }

.cat-hero__main {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.cat-hero__icon {
  font-size: 2.75rem;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-lg);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cat-hero__title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  color: #fff;
  margin-bottom: var(--sp-1);
}

.cat-hero__desc {
  font-size: var(--text-sm);
  color: rgba(255,255,255,.7);
  line-height: 1.5;
}

.cat-hero__stats {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.6);
  font-weight: var(--fw-medium);
}

/* ── Tier info bar ──────────────────────────────────────────── */
.tier-info-bar {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  display: flex;
  align-items: center;
}

.tier-info-bar .container {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.tier-info-bar--guest  { background: var(--color-surface-2); color: var(--color-text-muted); }
.tier-info-bar--free   { background: var(--color-info-light); color: var(--color-info); }
.tier-info-bar--paid   { background: var(--color-accent-light); color: var(--color-accent-dark); }

.tier-info-bar__cta {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  background: var(--color-primary);
  color: #fff;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: background var(--dur-fast);
}
.tier-info-bar__cta:hover { background: var(--color-primary-dark); }

/* ── Paywall modal ──────────────────────────────────────────── */
.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  backdrop-filter: blur(2px);
}

.paywall-modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--sp-8) var(--sp-6);
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
  animation: popIn var(--dur-base) var(--ease);
  box-shadow: var(--shadow-lg);
}

.paywall-modal__close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  cursor: pointer;
  color: var(--color-text-muted);
}
.paywall-modal__close:hover { background: var(--color-border); }

.paywall-modal__icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
}

.paywall-modal__title {
  font-size: var(--text-xl);
  font-weight: var(--fw-extrabold);
  margin-bottom: var(--sp-3);
}

.paywall-modal__body {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--sp-6);
}

.paywall-modal__actions { display: flex; flex-direction: column; }

/* ── Quiz phase transition screen ───────────────────────────── */
.quiz-transition {
  background: linear-gradient(135deg, var(--color-navy), var(--color-navy-light));
  border-radius: var(--radius-xl);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  color: #fff;
  animation: fadeUp var(--dur-base) var(--ease);
  margin-bottom: var(--sp-4);
}

.quiz-transition__icon {
  font-size: 3.5rem;
  margin-bottom: var(--sp-4);
  display: block;
}

.quiz-transition__title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  color: #fff;
  margin-bottom: var(--sp-2);
}

.quiz-transition__subtitle {
  font-size: var(--text-sm);
  color: rgba(255,255,255,.7);
  margin-bottom: var(--sp-6);
  line-height: 1.6;
}

.quiz-transition__stats {
  display: flex;
  justify-content: center;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.quiz-transition__stat-val  { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--color-accent); }
.quiz-transition__stat-label{ font-size: var(--text-xs); color: rgba(255,255,255,.6); margin-top: 2px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (min-width: 640px) {
  .stats-banner { padding: var(--sp-8) var(--sp-6); }
  .section      { padding: var(--sp-8) var(--sp-6); }
  .lesson-body  { padding: var(--sp-8) var(--sp-6); }
}
