/* ─── Rooted & Rising — Main Stylesheet ──────────────────────────────────────
   Design Philosophy: Warm Earth / Civil Rights Archive
   - Deep terracotta, warm amber, and cream against near-black backgrounds
   - Serif headings (Georgia) for gravitas; clean sans-serif (system) for body
   - Textured, layered feel — like archival documents and community organizing
   - Generous whitespace, clear hierarchy, accessible contrast
   ─────────────────────────────────────────────────────────────────────────── */

/* ─── CSS Custom Properties ─────────────────────────────────────────────────── */
:root {
  --bg-deep:       #0f0d0b;
  --bg-dark:       #1a1612;
  --bg-card:       #231f1a;
  --bg-card-hover: #2e2820;
  --bg-surface:    #332d26;

  --amber:         #d4860a;
  --amber-light:   #f0a832;
  --amber-pale:    #fde68a;
  --terracotta:    #c0522a;
  --terracotta-light: #e06840;
  --sage:          #5a7a5e;
  --sage-light:    #7aaa7e;
  --sky:           #3a7ca8;
  --sky-light:     #5a9cc8;

  --text-primary:  #f5f0e8;
  --text-secondary:#c8bfb0;
  --text-muted:    #8a7f72;
  --text-inverse:  #1a1612;

  --border:        rgba(255,255,255,0.08);
  --border-amber:  rgba(212,134,10,0.3);
  --border-focus:  #d4860a;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;
  --radius-xl:     20px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);

  --transition:    0.2s ease;
  --font-serif:    Georgia, 'Times New Roman', serif;
  --font-sans:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.2;
  color: var(--text-primary);
}

p { color: var(--text-secondary); }

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

img { max-width: 100%; height: auto; }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--narrow {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─── Screen System ──────────────────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: block;
}

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

/* ─── Navigation Header ──────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,13,11,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text-primary);
  cursor: pointer;
}

.nav__brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--terracotta), var(--amber));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav__progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav__step {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: var(--transition);
}

.nav__step.active {
  background: var(--amber);
  color: var(--text-inverse);
  font-weight: 600;
}

.nav__step.done {
  background: var(--sage);
  color: white;
}

/* ─── Hero Section ───────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--bg-deep);
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(192,82,42,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(212,134,10,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(90,122,94,0.08) 0%, transparent 50%);
}

.hero__content {
  position: relative;
  z-index: 1;
  padding: 5rem 0 4rem;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-light);
  margin-bottom: 1.5rem;
  padding: 0.375rem 0.875rem;
  background: rgba(212,134,10,0.12);
  border: 1px solid var(--border-amber);
  border-radius: 999px;
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: bold;
  line-height: 1.05;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.hero__title-accent {
  color: var(--amber-light);
  display: block;
}

.hero__subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero__modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.hero__module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: var(--transition);
}

.hero__module-card:hover {
  border-color: var(--border-amber);
  background: var(--bg-card-hover);
}

.hero__module-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

.hero__module-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.hero__module-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.hero__cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: linear-gradient(135deg, var(--terracotta), var(--amber));
  color: white;
  box-shadow: 0 4px 16px rgba(192,82,42,0.35);
}
.btn--primary:hover { box-shadow: 0 6px 24px rgba(192,82,42,0.5); }

.btn--secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn--secondary:hover { border-color: var(--border-amber); background: var(--bg-card-hover); }

.btn--amber {
  background: var(--amber);
  color: var(--text-inverse);
}
.btn--amber:hover { background: var(--amber-light); }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--ghost:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); }

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn--lg {
  padding: 1rem 2.25rem;
  font-size: 1.05rem;
}

.btn--full { width: 100%; justify-content: center; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.card--hover:hover {
  border-color: var(--border-amber);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

.card--selected {
  border-color: var(--amber) !important;
  background: rgba(212,134,10,0.08) !important;
  box-shadow: 0 0 0 2px rgba(212,134,10,0.2);
}

.card--unavailable {
  opacity: 0.45;
  cursor: not-allowed;
}

.card--unavailable:hover {
  border-color: var(--border) !important;
  background: var(--bg-card) !important;
}

/* ─── Section Headers ────────────────────────────────────────────────────────── */
.section-header {
  margin-bottom: 2.5rem;
}

.section-header__eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.625rem;
}

.section-header__title {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  margin-bottom: 0.75rem;
}

.section-header__desc {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.7;
}

/* ─── Resource Bars ──────────────────────────────────────────────────────────── */
.resource-bars {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.resource-bars__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.resource-bar {
  margin-bottom: 0.875rem;
}

.resource-bar:last-child { margin-bottom: 0; }

.resource-bar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}

.resource-bar__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.resource-bar__value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.resource-bar__change {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 999px;
  margin-left: 0.375rem;
}

.resource-bar__change--up {
  background: rgba(90,122,94,0.2);
  color: var(--sage-light);
}

.resource-bar__change--down {
  background: rgba(192,82,42,0.2);
  color: var(--terracotta-light);
}

.resource-bar__track {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 999px;
  overflow: hidden;
}

.resource-bar__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.resource-bar__fill--housing  { background: linear-gradient(90deg, #3a7ca8, #5a9cc8); }
.resource-bar__fill--education { background: linear-gradient(90deg, #7c3aed, #a855f7); }
.resource-bar__fill--health    { background: linear-gradient(90deg, #059669, #34d399); }
.resource-bar__fill--public    { background: linear-gradient(90deg, #d97706, #fbbf24); }
.resource-bar__fill--civic     { background: linear-gradient(90deg, #c0522a, #e06840); }

/* ─── Character Cards ────────────────────────────────────────────────────────── */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.character-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.character-card:hover {
  border-color: var(--border-amber);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.character-card.selected {
  border-color: var(--amber);
  background: rgba(212,134,10,0.08);
  box-shadow: 0 0 0 3px rgba(212,134,10,0.2);
}

.character-card__photo {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

.character-card__name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.character-card__meta {
  font-size: 0.75rem;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.character-card__location {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.character-card__background {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.character-card__era {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-muted);
}

/* ─── Choice Cards ───────────────────────────────────────────────────────────── */
.choice-grid {
  display: grid;
  gap: 0.875rem;
}

.choice-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
  font-family: var(--font-sans);
}

.choice-card:hover:not(.unavailable) {
  border-color: var(--border-amber);
  background: var(--bg-card-hover);
  transform: translateX(3px);
}

.choice-card.selected {
  border-color: var(--amber);
  background: rgba(212,134,10,0.08);
}

.choice-card.unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}

.choice-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.choice-card__text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.choice-card__badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.choice-card__badge--available {
  background: rgba(90,122,94,0.2);
  color: var(--sage-light);
}

.choice-card__badge--unavailable {
  background: rgba(192,82,42,0.15);
  color: var(--terracotta-light);
}

.choice-card__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.625rem;
}

.choice-card__unavailable-reason {
  font-size: 0.8rem;
  color: var(--terracotta-light);
  font-style: italic;
  padding: 0.5rem 0.75rem;
  background: rgba(192,82,42,0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--terracotta);
}

.choice-card__citation {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

/* ─── Outcome Panel ──────────────────────────────────────────────────────────── */
.outcome-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-amber);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.outcome-panel__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.75rem;
}

.outcome-panel__text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.outcome-panel__reflection {
  padding: 1rem;
  background: rgba(212,134,10,0.06);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--amber);
}

.outcome-panel__reflection-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.375rem;
}

.outcome-panel__reflection-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: italic;
}

/* ─── Historical Note ────────────────────────────────────────────────────────── */
.historical-note {
  background: rgba(90,122,94,0.08);
  border: 1px solid rgba(90,122,94,0.2);
  border-left: 4px solid var(--sage);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.historical-note__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage-light);
  margin-bottom: 0.375rem;
}

.historical-note__text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── Perspective Toggle ─────────────────────────────────────────────────────── */
.perspective-toggle {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.perspective-btn {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.perspective-btn:hover {
  border-color: var(--border-amber);
  color: var(--text-secondary);
}

.perspective-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--text-inverse);
}

/* ─── Progress Steps ─────────────────────────────────────────────────────────── */
.progress-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}

.progress-step--pending {
  background: var(--bg-surface);
  color: var(--text-muted);
}

.progress-step--active {
  background: var(--amber);
  color: var(--text-inverse);
}

.progress-step--done {
  background: rgba(90,122,94,0.2);
  color: var(--sage-light);
}

/* ─── Mindfulness Pause ──────────────────────────────────────────────────────── */
.mindfulness-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(90,122,94,0.15) 0%, transparent 70%);
  padding: 3rem 1.5rem;
}

.mindfulness-card {
  max-width: 600px;
  text-align: center;
}

.mindfulness-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  display: block;
}

.mindfulness-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.mindfulness-subtitle {
  color: var(--sage-light);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.mindfulness-prompt {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 2rem;
}

.mindfulness-exercises {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: left;
}

.mindfulness-exercise {
  background: var(--bg-card);
  border: 1px solid rgba(90,122,94,0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.mindfulness-exercise__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--sage-light);
  margin-bottom: 0.375rem;
}

.mindfulness-exercise__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.mindfulness-exercise__duration {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ─── Results Screen ─────────────────────────────────────────────────────────── */
.results-header {
  padding: 4rem 0 2rem;
  text-align: center;
}

.results-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.results-score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.results-score-card__icon { font-size: 1.5rem; margin-bottom: 0.5rem; display: block; }
.results-score-card__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.results-score-card__value {
  font-size: 2rem;
  font-family: var(--font-serif);
  font-weight: bold;
  color: var(--text-primary);
}
.results-score-card__max {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Reflection Journal ─────────────────────────────────────────────────────── */
.journal-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.journal-prompt {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
  font-style: italic;
}

.journal-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 0.875rem;
  resize: vertical;
  transition: var(--transition);
}

.journal-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(212,134,10,0.15);
}

.journal-textarea::placeholder { color: var(--text-muted); }

/* ─── Pledge Card ────────────────────────────────────────────────────────────── */
.pledge-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
  border: 2px solid var(--border-amber);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pledge-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(212,134,10,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.pledge-card__title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.pledge-card__subtitle {
  font-size: 0.85rem;
  color: var(--amber);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  position: relative;
}

.pledge-card__commitments {
  list-style: none;
  text-align: left;
  margin-bottom: 1.5rem;
  position: relative;
}

.pledge-card__commitment {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.pledge-card__commitment:last-child { border-bottom: none; }

.pledge-card__commitment-icon {
  color: var(--amber);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.pledge-card__name-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  text-align: center;
  padding: 0.75rem;
  margin-bottom: 1rem;
  transition: var(--transition);
  position: relative;
}

.pledge-card__name-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(212,134,10,0.15);
}

/* ─── SPLC Steps Reference ───────────────────────────────────────────────────── */
.splc-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.875rem;
  margin-bottom: 2rem;
}

.splc-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.splc-step__number {
  font-size: 1.5rem;
  font-family: var(--font-serif);
  font-weight: bold;
  color: var(--amber);
  margin-bottom: 0.375rem;
}

.splc-step__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.splc-step__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Debrief Section ────────────────────────────────────────────────────────── */
.debrief {
  background: rgba(58,124,168,0.08);
  border: 1px solid rgba(58,124,168,0.2);
  border-left: 4px solid var(--sky);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.debrief__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sky-light);
  margin-bottom: 0.5rem;
}

.debrief__text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.debrief__sources {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Score Badge ────────────────────────────────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.score-badge--high { background: rgba(90,122,94,0.2); color: var(--sage-light); }
.score-badge--mid  { background: rgba(212,134,10,0.2); color: var(--amber-light); }
.score-badge--low  { background: rgba(192,82,42,0.2); color: var(--terracotta-light); }
.score-badge--zero { background: var(--bg-surface); color: var(--text-muted); }

/* ─── Dividers ───────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

/* ─── Badges & Tags ──────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag--amber { background: rgba(212,134,10,0.15); color: var(--amber-light); }
.tag--sage  { background: rgba(90,122,94,0.15); color: var(--sage-light); }
.tag--terra { background: rgba(192,82,42,0.15); color: var(--terracotta-light); }
.tag--sky   { background: rgba(58,124,168,0.15); color: var(--sky-light); }

/* ─── Utility Classes ────────────────────────────────────────────────────────── */
.text-amber  { color: var(--amber-light); }
.text-sage   { color: var(--sage-light); }
.text-terra  { color: var(--terracotta-light); }
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.text-sm     { font-size: 0.85rem; }
.text-xs     { font-size: 0.75rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--bg-surface); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

/* ── Tablet (≤768px) ── */
@media (max-width: 768px) {
  .container { padding: 0 1rem; }
  .container--narrow { padding: 0 1rem; }

  /* Nav: hide step labels, show only icons/numbers */
  .nav__progress { gap: 0.25rem; }
  .nav__step { padding: 0.25rem 0.5rem; font-size: 0.7rem; }
  .nav__step span:not(.nav__step-num) { display: none; }

  /* Hero */
  .hero__content { padding: 3rem 0 2.5rem; }
  .hero__title { font-size: clamp(2rem, 8vw, 3rem); }
  .hero__subtitle { font-size: 1rem; }
  .hero__modules { grid-template-columns: 1fr; gap: 0.75rem; }
  .hero__cta { flex-direction: column; align-items: stretch; }
  .hero__cta .btn { width: 100%; justify-content: center; }

  /* Character grid: 2 columns on tablet */
  .character-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

  /* Results */
  .results-score-grid { grid-template-columns: repeat(2, 1fr); }
  .results-header { padding: 2rem 0 1.5rem; }

  /* SPLC steps */
  .splc-steps { grid-template-columns: repeat(2, 1fr); }

  /* Progress steps: scrollable */
  .progress-steps { gap: 0.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 0.5rem; }
  .progress-step { font-size: 0.75rem; padding: 0.3rem 0.75rem; }

  /* Pledge card */
  .pledge-card { padding: 1.75rem 1.25rem; }

  /* Journal */
  .journal-section { padding: 1.25rem; }

  /* Simulation layout: stack sidebar below main on tablet */
  .sim-layout { flex-direction: column !important; }
  .sim-sidebar { width: 100% !important; max-width: 100% !important; }
}

/* ── Mobile (≤480px) ── */
@media (max-width: 480px) {
  /* Nav: compress further */
  .nav { padding: 0.625rem 0; }
  .nav__brand { font-size: 0.95rem; }
  .nav__brand-icon { width: 28px; height: 28px; font-size: 0.875rem; }
  .nav__progress { display: none; } /* hide step pills entirely on small phones */

  /* Hero */
  .hero__content { padding: 2rem 0 2rem; }
  .hero__title { font-size: 2rem; }
  .hero__eyebrow { font-size: 0.7rem; padding: 0.3rem 0.75rem; }
  .hero__subtitle { font-size: 0.9rem; margin-bottom: 1.75rem; }
  .hero__module-card { padding: 1rem; }

  /* Character grid: 1 column on very small phones, 2 on normal phones */
  .character-grid { grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }
  .character-card { padding: 0.875rem; }
  .character-card__photo { font-size: 2rem; margin-bottom: 0.5rem; }
  .character-card__name { font-size: 0.875rem; }
  .character-card__background { display: none; } /* hide long bio on small screens */

  /* Filter buttons: wrap and shrink */
  .filter-bar { flex-wrap: wrap; gap: 0.375rem; }
  .filter-btn { font-size: 0.75rem; padding: 0.375rem 0.75rem; }

  /* Section headers */
  .section-header__title { font-size: 1.5rem; }
  .section-header__desc { font-size: 0.9rem; }

  /* Choice cards: larger touch targets */
  .choice-card { padding: 1rem; }
  .choice-card__text { font-size: 0.9rem; }
  .choice-card__header { flex-direction: column; gap: 0.375rem; align-items: flex-start; }
  .choice-card__badge { align-self: flex-start; }

  /* Outcome panel */
  .outcome-panel { padding: 1.125rem; }
  .outcome-panel__text { font-size: 0.9rem; }

  /* Resource bars */
  .resource-bars { padding: 1rem; }
  .resource-bar__label { font-size: 0.75rem; }

  /* Buttons: full-width stacking */
  .btn-row { flex-direction: column; gap: 0.625rem; }
  .btn-row .btn { width: 100%; justify-content: center; }
  .btn--lg { padding: 0.875rem 1.5rem; font-size: 1rem; }

  /* Milestone layout */
  .milestone-header { padding: 1.5rem 0 1rem; }
  .milestone-header h2 { font-size: 1.5rem; }

  /* Results */
  .results-score-grid { grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }
  .results-score-card { padding: 0.875rem; }
  .results-score-card__value { font-size: 1.5rem; }
  .results-header h1 { font-size: 1.75rem; }

  /* SPLC steps: single column */
  .splc-steps { grid-template-columns: 1fr; }

  /* Perspective toggle: wrap */
  .perspective-toggle { gap: 0.375rem; }
  .perspective-btn { font-size: 0.75rem; padding: 0.4rem 0.875rem; }

  /* Mindfulness screen */
  .mindfulness-screen { padding: 2rem 1rem; }
  .mindfulness-title { font-size: 1.5rem; }
  .mindfulness-icon { font-size: 2.5rem; }

  /* Pledge card */
  .pledge-card { padding: 1.25rem 1rem; }
  .pledge-card__title { font-size: 1.25rem; }

  /* Journal */
  .journal-section { padding: 1rem; }
  .journal-textarea { min-height: 100px; font-size: 0.875rem; }

  /* Historical note */
  .historical-note { padding: 0.875rem 1rem; }
  .historical-note__text { font-size: 0.825rem; }

  /* Debrief */
  .debrief { padding: 1rem; }
  .debrief__text { font-size: 0.825rem; }

  /* Score badge */
  .score-badge { font-size: 0.7rem; }

  /* Progress steps: hide on very small screens, show milestone number in heading instead */
  .progress-steps { display: none; }

  /* Divider spacing */
  .divider { margin: 1.25rem 0; }
}

/* ─── Print Styles (for pledge card) ────────────────────────────────────────── */
@media print {
  body { background: white; color: black; }
  .nav, .btn, .screen:not(.active) { display: none; }
  .pledge-card {
    border: 2px solid #d4860a;
    background: white;
    color: black;
  }
}

/* ─── Milestone Grid Layout ──────────────────────────────────────────────────── */
.milestone-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .milestone-grid {
    grid-template-columns: 1fr;
  }
  /* Move resource sidebar above milestone content on mobile */
  .milestone-grid > div:last-child {
    order: -1;
  }
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 480px) {
  .filter-bar {
    gap: 0.375rem;
    margin-bottom: 1rem;
  }
  .filter-bar .btn--sm {
    font-size: 0.72rem;
    padding: 0.35rem 0.7rem;
  }
  /* Make Assign Randomly button full-width on mobile */
  .filter-bar .btn--amber {
    margin-left: 0 !important;
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
  }
}

/* ─── Button Row ─────────────────────────────────────────────────────────────── */
.btn-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 480px) {
  .btn-row {
    flex-direction: column;
    gap: 0.625rem;
  }
  .btn-row .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ─── Character Intro Mobile ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-character-intro .container--narrow {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }
  #screen-character-intro h1 {
    font-size: 1.75rem;
  }
  #screen-character-intro .card {
    padding: 1.125rem;
  }
}

/* ─── Scenario Screen Mobile ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-scenario .container--narrow {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }
  #screen-scenario h2 {
    font-size: 1.25rem;
  }
}

/* ─── M2 Context Cards Mobile ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-m2-contexts .card {
    padding: 1rem;
  }
}

/* ─── Pledge Screen Mobile ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-pledge .container--narrow {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }
}

/* ─── Character Comparison Tooltip ──────────────────────────────────────────── */
.char-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: #1e1509;
  border: 1px solid rgba(212, 163, 96, 0.4);
  border-radius: 10px;
  padding: 0.875rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  z-index: 200;
  pointer-events: none;
  animation: tooltip-in 0.15s ease;
}

@keyframes tooltip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Show on hover (desktop) */
@media (hover: hover) {
  .character-card:hover .char-tooltip {
    display: block;
  }
}

/* On mobile: show tooltip on long-press via JS class */
.character-card.tooltip-visible .char-tooltip {
  display: block;
  bottom: auto;
  top: calc(100% + 8px);
}

/* ─── Confirm Button Pulse/Glow Animation ────────────────────────────────────── */
@keyframes btn-pulse-glow {
  0%   { box-shadow: 0 0 0 0 rgba(212,163,96,0.7); }
  40%  { box-shadow: 0 0 0 12px rgba(212,163,96,0); }
  70%  { box-shadow: 0 0 0 0 rgba(212,163,96,0); }
  85%  { box-shadow: 0 0 0 8px rgba(212,163,96,0.3); }
  100% { box-shadow: 0 0 0 0 rgba(212,163,96,0); }
}

.btn-pulse {
  animation: btn-pulse-glow 1.6s ease-out 2;
}

/* ─── Milestone grid responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  #milestone-layout {
    grid-template-columns: 1fr !important;
  }
  #resource-sidebar {
    order: -1;
  }
}

/* === MILESTONE MOBILE RESPONSIVE === */
.milestone-container { padding-top: 2rem; padding-bottom: 4rem; }
.milestone-layout { display: grid; grid-template-columns: 1fr 280px; gap: 2rem; align-items: start; }
.nav__progress { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-shrink: 1; min-width: 0; }
.nav__progress::-webkit-scrollbar { display: none; }
#mobile-resource-strip { background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 0.625rem 1rem; position: sticky; top: 56px; z-index: 99; }
.mobile-resource-strip__inner { display: flex; gap: 0.25rem; justify-content: space-between; max-width: 480px; margin: 0 auto; }
.mobile-resource-item { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; flex: 1; }
.mobile-resource-item__icon { font-size: 1rem; line-height: 1; }
.mobile-resource-item__bar { width: 100%; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.mobile-resource-item__fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.mobile-resource-item__val { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); line-height: 1; }
.mobile-resource-item__change { font-size: 0.6rem; font-weight: 700; line-height: 1; }
.mobile-resource-item__change--up { color: #34d399; }
.mobile-resource-item__change--down { color: #f87171; }
.historical-note--collapsible .historical-note__toggle { display: none; }
@media (max-width: 700px) {
  .milestone-layout { grid-template-columns: 1fr; gap: 0; }
  .milestone-sidebar { display: none; }
  #mobile-resource-strip { display: block; }
  .milestone-container { padding-top: 1rem; padding-bottom: 5rem; }
  .historical-note--collapsible .historical-note__toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; cursor: pointer; padding: 0; color: #5a7a5e; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
  .historical-note--collapsible .historical-note__toggle-icon { font-size: 0.75rem; transition: transform 0.2s ease; display: inline-block; }
  .historical-note--collapsible.collapsed .historical-note__body { display: none; }
  .historical-note--collapsible.collapsed .historical-note__toggle-icon { transform: rotate(-90deg); }
  .historical-note--collapsible .historical-note__label { display: none; }
  .milestone-header { padding: 1rem 0 0.75rem; }
  .milestone-header h2 { font-size: 1.4rem; }
  .choice-card { padding: 1rem 0.875rem; }
  .choice-card__text { font-size: 0.9rem; line-height: 1.5; }
  .outcome-panel { padding: 1rem; }
  .outcome-section { margin-bottom: 1rem; }
  #btn-next-milestone, #btn-view-results { width: 100%; justify-content: center; }
  .btn-row { flex-direction: column; }
}

/* ─── Audio Mute Toggle Button ───────────────────────────────────────────────── */
.btn-mute-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}
.btn-mute-toggle:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.3);
  color: var(--text-primary);
}
.btn-mute-toggle.muted {
  background: rgba(192,82,42,0.15);
  border-color: rgba(192,82,42,0.4);
  color: var(--terracotta-light);
}
.btn-mute-toggle.muted:hover {
  background: rgba(192,82,42,0.25);
}
@media print {
  .btn-mute-toggle { display: none; }
}
