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

:root {
  --bg:     #EDF1F4;
  --bg2:    #e2eaef;
  --card:   #ffffff;
  --card2:  #f4f7fa;
  --border: rgba(23, 179, 217, 0.2);
  --border-strong: rgba(23, 179, 217, 0.4);
  --text:   #1a2a35;
  --muted:  #5a7080;
  --accent: #FC8A10;
  --accent2:#e07318;
  --teal:   #17B3D9;
  --teal2:  #0e88a8;
  --mauve:  #C4A8C0;
  --mauve2: #9e7a9a;
  --ink:    #0d1c24;
  /* affordability colors — kept distinct from palette */
  --green:  #2e9e5b;
  --yellow: #d4a017;
  --orange: #e06020;
  --red:    #c0302a;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  min-height: 100vh;
}

/* ── Typography ── */
h1, h2, h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--ink);
}

h1 {
  font-size: clamp(3.8rem, 9vw, 8.5rem);
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 em { color: var(--accent); font-style: italic; }

h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.08;
  margin-bottom: 0.9rem;
  font-style: italic;
  font-weight: 600;
}

h3 {
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 600;
  margin-bottom: 0.7rem;
  color: var(--teal2);
}

p { color: var(--muted); line-height: 1.8; font-size: 0.9rem; }

.eyebrow {
  font-size: 0.58rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--mauve2);
  margin-bottom: 0.5rem;
  display: block;
  font-weight: 600;
}

/* ═══════════════════════════════════════
   HERO — animated scene
═══════════════════════════════════════ */
.hero {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    180deg,
    #fde9c8 0%,
    #fbd5a0 18%,
    #fcc580 32%,
    #b8e4f0 55%,
    #d8eef8 70%,
    #EDF1F4 100%
  );
  animation: none;
}

/* Sun — position & color driven by JS animation loop */
.sun {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  z-index: 1;
}

.sun-rays {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    rgba(252,200,74,0.18) 0deg 10deg,
    transparent 10deg 20deg
  );
  animation: sunSpin 20s linear infinite;
}

@keyframes sunSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Clouds */
.cloud {
  position: absolute;
  background: white;
  border-radius: 50px;
  opacity: 0.82;
  z-index: 1;
}

.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: white;
  border-radius: 50%;
}

.cloud-1 {
  width: 160px; height: 40px;
  top: 20%; left: 8%;
  animation: cloudDrift 18s linear infinite;
}
.cloud-1::before { width: 70px; height: 70px; top: -35px; left: 20px; }
.cloud-1::after  { width: 50px; height: 50px; top: -25px; left: 70px; }

.cloud-2 {
  width: 110px; height: 28px;
  top: 14%; right: 18%;
  animation: cloudDrift 24s linear infinite reverse;
  opacity: 0.65;
}
.cloud-2::before { width: 50px; height: 50px; top: -25px; left: 15px; }
.cloud-2::after  { width: 35px; height: 35px; top: -18px; left: 55px; }

.cloud-3 {
  width: 90px; height: 24px;
  top: 28%; left: 60%;
  animation: cloudDrift 30s linear infinite;
  opacity: 0.55;
}
.cloud-3::before { width: 40px; height: 40px; top: -20px; left: 12px; }
.cloud-3::after  { width: 28px; height: 28px; top: -14px; left: 44px; }

@keyframes cloudDrift {
  from { transform: translateX(-40px); }
  to   { transform: translateX(40px); }
}

/* Cityscape */
.cityscape {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 300px;
  z-index: 2;
}

.hero-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Hero content */
.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 2rem;
  margin-bottom: 160px; /* lift above cityscape */
}

.hero-content h1 {
  text-shadow: 0 2px 20px rgba(13,28,36,0.1);
  margin-bottom: 0.6rem;
}

.hero-subtitle {
  max-width: 520px;
  margin: 0 auto 1.5rem;
  font-size: 1.05rem;
  color: #4a3010;
  opacity: 0.85;
  font-weight: 500;
}

.tag {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.58rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #7a5020;
  font-weight: 600;
}

.tag span {
  background: rgba(255,255,255,0.55);
  padding: 0.3rem 0.7rem;
  border-radius: 2px;
  backdrop-filter: blur(4px);
}

/* ── Main layout ── */
main { max-width: 1480px; margin: 0 auto; }

.story-section, .chapter {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(420px, 1.25fr);
  gap: 2rem;
  padding: 3.5rem 3rem;
  align-items: start;
}

.chapter-wide {
  grid-template-columns: minmax(280px, 0.6fr) minmax(420px, 1.4fr);
}

.intro-section { padding-top: 4rem; }

/* ── Cards ── */
.formula-card, .visual-card, .control-panel {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(23,179,217,0.07), 0 1px 3px rgba(0,0,0,0.04);
  position: relative;
}

.visual-card::before, .formula-card::before {
  content: "";
  position: absolute;
  top: 0; left: 1.5rem; right: 1.5rem;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--accent), var(--mauve));
  border-radius: 0 0 3px 3px;
}

.formula {
  color: var(--accent2);
  margin-top: 0.9rem;
  font-style: italic;
  font-size: 0.88rem;
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  font-family: 'Cormorant Garamond', serif;
}

/* ── Sticky controls ── */
.sticky-controls {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 3rem 1rem;
  backdrop-filter: blur(16px);
  background: rgba(237,241,244,0.93) !important;
  border-color: var(--border-strong) !important;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}

.control-row:last-child { margin-bottom: 0; }

label {
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.58rem;
  font-weight: 600;
}

/* ── Slider ── */
input[type="range"] {
  width: min(520px, 48vw);
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: linear-gradient(90deg, #c0302a 0%, #d4a017 40%, #facc15 60%, #2e9e5b 100%);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid white;
  box-shadow: 0 1px 6px rgba(252,138,16,0.4);
  cursor: pointer;
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── Select & button ── */
select, button {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 0.48rem 0.8rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  border-radius: 3px;
}

button:hover, button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(252,138,16,0.07);
}

#salaryValue {
  color: var(--accent);
  font-weight: 700;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-style: italic;
  min-width: 90px;
}

/* ── Loading ── */
.loading {
  max-width: 900px;
  margin: 2rem auto;
  padding: 1rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.62rem;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
}

.loading.hidden { display: none; }

/* ── Chapters ── */
.chapter {
  min-height: 82vh;
  border-top: 1px solid var(--border);
}

.chapter-text { position: sticky; top: 8rem; }
.chapter-map  { grid-template-columns: 0.55fr 1.45fr; }
.visual-card.wide { min-height: 650px; }

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.stat-card {
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 1rem 0.85rem;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--accent));
}

.stat-card span, .big-number {
  display: block;
  color: var(--accent);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
}

.stat-card small {
  display: block;
  color: var(--muted);
  margin-top: 0.4rem;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

/* ── Map actions / legend ── */
.map-actions, .legend-row, .salary-buttons {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
}

.hint {
  color: var(--teal2);
  text-transform: none;
  letter-spacing: 0.4px;
  font-style: italic;
  font-size: 0.68rem;
  font-weight: 400;
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.12);
}

.green  { background: var(--green); }
.yellow { background: var(--yellow); }
.orange { background: var(--orange); }
.red    { background: var(--red); }
.nodata { background: #b8c8d4; }

/* ── Insight callout ── */
.insight {
  margin-top: 0.9rem;
  font-size: 0.74rem;
  color: var(--muted);
  border-left: 3px solid var(--teal);
  padding-left: 0.75rem;
  font-style: italic;
}

/* ── SVG ── */
svg text { font-family: 'DM Sans', sans-serif; }
.axis path, .axis line { stroke: rgba(13,28,36,0.15); }
.axis text, .axis-label { fill: var(--muted); font-size: 10px; }
.grid-line { stroke: rgba(13,28,36,0.07); stroke-dasharray: 3,3; }

/* ── Map paths ── */
.state, .county { cursor: pointer; transition: opacity 0.15s, stroke-width 0.15s; }
.state  { stroke: rgba(237,241,244,0.8); stroke-width: 0.6; }
.county { stroke: rgba(237,241,244,0.6); stroke-width: 0.3; }
.state:hover  { stroke: var(--ink); stroke-width: 1.5; opacity: 1 !important; }
.county:hover { stroke: var(--ink); stroke-width: 1.2; opacity: 1 !important; }

/* ── Tooltip ── */
.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.8rem 0.95rem;
  font-size: 0.7rem;
  line-height: 1.7;
  opacity: 0;
  max-width: 300px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(23,179,217,0.12);
  border-radius: 4px;
}

.tooltip strong {
  color: var(--accent);
  font-size: 0.8rem;
  display: block;
  margin-bottom: 0.15rem;
}

/* ── Mini controls ── */
.mini-controls { margin-top: 1rem; align-items: flex-start; }
.mini-controls select { max-width: 100%; }

/* ── Comparison cards ── */
.comparison-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.place-card, .recommendation-item {
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 1rem 1rem 1rem 1.1rem;
  position: relative;
  border-radius: 4px;
}

.place-card::before, .recommendation-item::before {
  content: "";
  position: absolute;
  left: 0; top: 0.75rem; bottom: 0.75rem;
  width: 3px;
  background: linear-gradient(180deg, var(--teal), var(--accent));
  border-radius: 3px;
}

.place-card h4, .recommendation-item h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.place-card p, .recommendation-item p, .dream-card p {
  font-size: 0.72rem;
  line-height: 1.65;
}

/* ── Dream card ── */
.dream-card { text-align: center; }

.big-number {
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  margin: 0.75rem 0 0.25rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--accent);
}

/* ── Salary jump buttons ── */
.salary-buttons { margin-top: 1.25rem; gap: 0.5rem; }

.salary-jump { padding: 0.4rem 0.7rem; font-size: 0.66rem; letter-spacing: 0.5px; }
.salary-jump:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Chapter 5 — preferences + map ── */
.pref-section { margin-top: 1.25rem; }

.pref-label {
  font-size: 0.58rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--teal2);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.checkbox-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.checkbox-row label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 400;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--teal);
  width: 14px; height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.ch5-card { padding: 1.5rem; }

.ch5-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.recommendation-list { display: grid; gap: 0.6rem; }
.recommendation-item h4 { font-size: 0.9rem; }

.rec-map-wrap { position: relative; }

.rec-map-label {
  font-size: 0.6rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

#recMapChart { display: block; width: 100%; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border-strong);
  font-size: 0.6rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ── Fade-in ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chapter-text, .visual-card { animation: fadeUp 0.5s ease both; }

/* ── Responsive ── */
@media (max-width: 980px) {
  .hero { min-height: 100svh; }
  .hero-content { margin-bottom: 180px; }

  .story-section, .chapter, .chapter-map, .chapter-wide {
    grid-template-columns: 1fr;
    padding: 2.5rem 1.25rem;
  }

  .chapter-text { position: relative; top: auto; }
  input[type="range"] { width: 100%; }
  .stat-grid, .comparison-cards, .ch5-layout { grid-template-columns: 1fr; }
  .sticky-controls { margin: 0 1rem 1rem; }
}


/* ── Final story-page polish updates ───────────────────────── */
html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  scroll-padding-top: 92px;
}

main {
  max-width: none;
  width: 100%;
  margin: 0;
}

.story-section,
.chapter {
  width: 100%;
  max-width: 1480px;
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(3rem, 5vw, 5rem) clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.story-section.intro-section {
  min-height: 100svh;
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
  gap: 4rem;
  border-top: 1px solid var(--border);
}

.intro-section h2 {
  font-size: clamp(2.8rem, 4.8vw, 5.2rem);
  line-height: 0.98;
}

.intro-section .story-copy p {
  font-size: 1.08rem;
  line-height: 1.9;
  max-width: 680px;
}

.intro-section .formula-card {
  padding: 2.2rem;
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(23,179,217,0.12);
}

.intro-section .formula-card h3 {
  font-size: 1.35rem;
}

.intro-section .formula-card p {
  font-size: 1.02rem;
}

.intro-section .formula {
  font-size: 1rem;
  background: rgba(252, 138, 16, 0.06);
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--accent);
}

.chapter {
  min-height: 100svh;
}

.chapter-map {
  grid-template-columns: minmax(260px, 0.55fr) minmax(520px, 1.45fr);
  background: linear-gradient(180deg, var(--bg) 0%, #f7fafc 100%);
}

.chapter-wide {
  grid-template-columns: minmax(280px, 0.6fr) minmax(420px, 1.4fr);
}

.sticky-controls {
  margin: 0 auto 1rem;
  width: min(1480px, calc(100% - 6rem));
}

.use-note {
  margin-top: 1rem;
  color: var(--teal2);
  font-size: 0.78rem;
  font-style: italic;
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.scroll-cue {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mauve2);
  font-weight: 600;
  animation: floatCue 1.8s ease-in-out infinite;
}

@keyframes floatCue {
  0%, 100% { transform: translateY(0); opacity: 0.65; }
  50% { transform: translateY(6px); opacity: 1; }
}

@media (max-width: 980px) {
  html {
    scroll-snap-type: none;
  }

  .story-section,
  .chapter,
  .chapter-map,
  .chapter-wide,
  .story-section.intro-section {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 3rem 1.25rem;
    align-items: start;
    gap: 2rem;
  }

  .intro-section {
    min-height: 100svh;
    align-content: center;
  }

  .intro-section h2 {
    font-size: clamp(2.4rem, 11vw, 4rem);
  }

  .chapter-text {
    position: relative;
    top: auto;
  }

  .sticky-controls {
    width: calc(100% - 2rem);
    margin: 0 auto 1rem;
  }
}


/* prettier hero neighborhood + background city */
.cute-house {
  filter: drop-shadow(0 7px 10px rgba(13, 28, 36, 0.14));
  transform-origin: center bottom;
}

.cute-house:hover {
  /* Keep the SVG transform attribute intact so houses do not jump on hover. */
  filter: drop-shadow(0 9px 12px rgba(13, 28, 36, 0.18));
}

.cute-house rect,
.cute-house polygon,
.city-backdrop rect {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.city-backdrop {
  filter: drop-shadow(0 4px 8px rgba(13, 28, 36, 0.06));
}

.neighborhood {
  transform-origin: center bottom;
}
/* ── Scrollytelling upgrade ───────────────────────── */
.story-progress {
  position: fixed;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.story-progress a {
  width: 2.2rem;
  min-height: 2.2rem;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--muted);
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(13, 28, 36, 0.08);
}

.story-progress a.active,
.story-progress a:hover {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.mode-badge {
  position: absolute;
  top: -0.8rem;
  left: 1rem;
  background: var(--ink);
  color: white;
  border-radius: 999px;
  padding: 0.22rem 0.75rem;
  font-size: 0.58rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 700;
}

.story-question,
.chapter-prompt {
  margin-top: 1.2rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: rgba(252, 138, 16, 0.07);
  color: var(--ink);
  border-radius: 0 6px 6px 0;
}

.story-question span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent2);
  font-size: 0.58rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
}

.story-question strong {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(1.3rem, 2vw, 2rem);
  line-height: 1.15;
}

.chapter-prompt {
  font-size: 0.9rem;
  line-height: 1.65;
}

.tiny-note {
  margin-top: 0.9rem;
  font-size: 0.78rem !important;
  color: var(--muted);
}

.takeaway-section,
.reflection-section,
.final-explore-section {
  max-width: none;
  padding-inline: clamp(1.5rem, 8vw, 8rem);
}

.takeaway-section {
  grid-template-columns: minmax(280px, 0.55fr) minmax(520px, 1.45fr);
  background: linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
}

.takeaway-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.takeaway-card,
.explore-checklist {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(23,179,217,0.10);
}

.takeaway-card {
  min-height: 260px;
  padding: 1.6rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.takeaway-card span {
  color: var(--accent);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-style: italic;
  font-weight: 700;
}

.takeaway-card h3 {
  font-size: 1.45rem;
  color: var(--ink);
}

.reflection-section {
  display: flex;
  justify-content: center;
  text-align: center;
  background: var(--ink);
  color: white;
}

.reflection-copy {
  max-width: 900px;
}

.reflection-section h2,
.reflection-section p,
.reflection-section .eyebrow {
  color: white;
}

.reflection-section h2 {
  font-size: clamp(3rem, 7vw, 7rem);
}

.reflection-section p {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  color: rgba(255,255,255,0.78);
  margin-top: 1.2rem;
}

.final-explore-section {
  background: linear-gradient(135deg, #fde9c8 0%, #edf1f4 48%, #d8eef8 100%);
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
}

.final-explore-section h2 {
  font-size: clamp(3rem, 6vw, 6.5rem);
}

.explore-button {
  display: inline-flex;
  margin-top: 1.4rem;
  padding: 0.85rem 1.15rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  box-shadow: 0 8px 22px rgba(252, 138, 16, 0.25);
}

.explore-checklist {
  border-radius: 10px;
  padding: 1.5rem;
  display: grid;
  gap: 0.9rem;
}

.explore-checklist div {
  padding: 0.9rem 1rem;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 700;
}

body:not(.exploration-unlocked) .sticky-controls {
  box-shadow: 0 6px 24px rgba(13, 28, 36, 0.09);
}

body.exploration-unlocked .sticky-controls {
  border-color: var(--accent) !important;
  box-shadow: 0 8px 30px rgba(252, 138, 16, 0.16);
}

@media (max-width: 980px) {
  .story-progress { display: none; }
  .takeaway-section,
  .final-explore-section {
    grid-template-columns: 1fr;
  }
  .takeaway-grid {
    grid-template-columns: 1fr;
  }
  .reflection-section {
    text-align: left;
  }
}

/* ── Stronger guided scrollytelling: staged reveal + screen-fit polish ── */
.story-section,
.chapter {
  min-height: calc(100svh - 4.5rem);
  padding-top: clamp(1.4rem, 3vh, 2.4rem);
  padding-bottom: clamp(1.4rem, 3vh, 2.4rem);
  align-items: center;
  scroll-margin-top: 4.5rem;
}

.chapter-text {
  top: 6.25rem;
  max-height: calc(100svh - 7rem);
  overflow: auto;
  scrollbar-width: thin;
}

.chapter-text h2,
.story-copy h2,
.reflection-copy h2,
.final-explore-section h2 {
  margin-bottom: 0.75rem;
}

.chapter-text p,
.story-copy p,
.reflection-copy p {
  margin-top: 0.65rem;
  margin-bottom: 0.65rem;
}

.visual-card {
  padding: clamp(1rem, 1.8vw, 1.35rem);
  max-height: calc(100svh - 8rem);
  overflow: auto;
}

.visual-card.wide {
  min-height: 510px;
  max-height: calc(100svh - 8rem);
}

#mapChart {
  height: min(430px, 50svh);
}

#ladderChart {
  height: min(310px, 42svh);
}

#comparisonChart,
#jobComparisonChart {
  height: min(260px, 34svh);
}

#dreamChart {
  height: min(210px, 28svh);
}

#recMapChart {
  height: min(320px, 38svh);
}

.story-reveal {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(3px);
  transition:
    opacity 0.75s ease,
    transform 0.75s ease,
    filter 0.75s ease;
  transition-delay: calc(var(--reveal-index, 0) * 140ms);
}

.is-active .story-reveal,
.reveal-done .story-reveal {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.takeaway-card.story-reveal {
  transform: translateY(28px) scale(0.97);
}

.is-active .takeaway-card.story-reveal,
.reveal-done .takeaway-card.story-reveal {
  transform: translateY(0) scale(1);
}

/* Make the story feel guided without pretending the controls are disabled. */
body:not(.exploration-unlocked) .sticky-controls::after {
  content: "Story mode changes income automatically as you scroll — you can still interact anytime.";
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.4px;
}

body.exploration-unlocked .sticky-controls::after {
  content: "Free exploration: adjust anything and follow your own path.";
  display: block;
  margin-top: 0.35rem;
  color: var(--accent2);
  font-size: 0.62rem;
  letter-spacing: 0.4px;
  font-weight: 700;
}

.takeaway-card {
  min-height: 220px;
}

.explore-checklist {
  align-self: center;
}

@media (max-height: 760px) and (min-width: 981px) {
  .story-section,
  .chapter {
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
    gap: 1.25rem;
  }

  .chapter-text h2,
  .story-copy h2 {
    font-size: clamp(2.1rem, 4.2vw, 4rem);
  }

  .chapter-prompt,
  .story-question {
    margin-top: 0.75rem;
    padding: 0.75rem 0.85rem;
  }

  .stat-grid {
    margin-top: 0.9rem;
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.7rem 0.6rem;
  }

  .visual-card.wide {
    min-height: 455px;
  }

  #mapChart {
    height: 360px;
  }

  .takeaway-card {
    min-height: 185px;
    padding: 1.1rem;
  }

  .pref-section {
    margin-top: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-reveal {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

/* ── Personalized guided mode vs full exploration mode ───────────── */
.salary-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
}

.salary-choice {
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  padding: 0.75rem 0.45rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.salary-choice.active,
.salary-choice:focus-visible {
  background: rgba(252,138,16,0.12);
  border-color: var(--accent);
  color: var(--accent2);
  outline: none;
}

.personal-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  width: 100%;
}

.personal-summary-card {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 6px;
}

.personal-summary-card span {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.58rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.personal-summary-card strong {
  color: var(--accent);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  font-style: italic;
}

body:not(.exploration-unlocked) .exploration-only,
body:not(.exploration-unlocked) .exploration-only-inline,
body:not(.exploration-unlocked) .exploration-copy {
  display: none !important;
}

body.exploration-unlocked .guided-copy,
body.exploration-unlocked .guided-note {
  display: none !important;
}

body:not(.exploration-unlocked) .guided-chapter select,
body:not(.exploration-unlocked) .guided-chapter input,
body:not(.exploration-unlocked) .guided-chapter .salary-jump {
  pointer-events: none;
}

body:not(.exploration-unlocked) .chapter {
  grid-template-columns: minmax(300px, 0.72fr) minmax(460px, 1.28fr);
}

body:not(.exploration-unlocked) .visual-card {
  overflow: visible;
}

body.exploration-unlocked .visual-card {
  overflow: visible;
}

body.exploration-ready .final-explore-section {
  background: linear-gradient(135deg, rgba(252,138,16,0.12), rgba(23,179,217,0.12));
}

body.exploration-unlocked .sticky-controls {
  display: block !important;
  position: sticky;
  top: 0;
}

body:not(.exploration-unlocked) .sticky-controls::after {
  content: none;
}

body.exploration-unlocked .sticky-controls::after {
  content: "Free exploration: adjust anything and follow your own path.";
}

.explore-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-size: 0.85rem;
  padding: 0.85rem 1.2rem;
}

.explore-button:hover {
  color: white;
  filter: brightness(0.95);
}

/* Prevent visual clipping on short screens. */
.visual-card,
.visual-card.wide {
  max-height: none;
  min-height: 0;
}

#mapChart,
#ladderChart,
#comparisonChart,
#jobComparisonChart,
#dreamChart,
#recMapChart {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto !important;
}

@media (max-width: 980px) {
  .salary-choice-grid,
  .personal-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  body:not(.exploration-unlocked) .chapter {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 760px) and (min-width: 981px) {
  .story-section,
  .chapter {
    min-height: auto;
  }

  .chapter-text {
    max-height: none;
    overflow: visible;
  }
}

/* ── Update: stronger personalized opening + cinematic text-first chapters ── */
.story-setup-panel {
  display: grid;
  gap: 0.85rem;
}

.intro-dream-control {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.intro-dream-control label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--teal2);
  font-weight: 800;
  margin-bottom: 0.45rem;
}

.intro-dream-control select {
  width: 100%;
  max-width: 100%;
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--ink);
  padding: 0.72rem 0.85rem;
  font: inherit;
}

/* In guided mode, each chapter starts like a full-screen text scene.
   The visual fades in after the text has had time to land, then the text shifts left. */
body:not(.exploration-unlocked) .guided-chapter {
  position: relative;
  grid-template-columns: minmax(0, 1fr) !important;
  justify-items: center;
  align-items: center;
  min-height: 100svh;
  overflow: visible;
}

body:not(.exploration-unlocked) .guided-chapter .chapter-text {
  position: relative;
  top: auto;
  max-width: min(880px, 92vw);
  max-height: none;
  overflow: visible;
  text-align: center;
  z-index: 2;
  transition: max-width 850ms ease, text-align 850ms ease, transform 850ms ease;
}

body:not(.exploration-unlocked) .guided-chapter .chapter-text h2 {
  font-size: clamp(2.7rem, 6.5vw, 6.4rem);
  line-height: 0.93;
}

body:not(.exploration-unlocked) .guided-chapter .chapter-text p {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(1rem, 1.45vw, 1.2rem);
}

body:not(.exploration-unlocked) .guided-chapter .visual-card {
  width: min(920px, 96vw);
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  visibility: hidden;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 900ms ease, transform 900ms ease, visibility 0ms linear 900ms, max-height 900ms ease;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready {
  grid-template-columns: minmax(285px, 0.62fr) minmax(520px, 1.38fr) !important;
  justify-items: stretch;
  gap: clamp(1.4rem, 3vw, 3rem);
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text {
  max-width: 520px;
  text-align: left;
  justify-self: end;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text h2 {
  font-size: clamp(2rem, 4.2vw, 4.6rem);
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text p {
  margin-left: 0;
  margin-right: 0;
  font-size: 0.95rem;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .visual-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  max-height: none;
  overflow: visible;
  pointer-events: auto;
  transition-delay: 0ms;
}

body:not(.exploration-unlocked) .story-reveal {
  transition-duration: 900ms;
  transition-delay: calc(var(--reveal-index, 0) * 360ms);
}

/* Chapter 7 spacing fix: make 01 / 02 / 03 feel like labels, not cramped text. */
.takeaway-card {
  justify-content: flex-start;
  gap: 0.85rem;
}

.takeaway-card span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: rgba(252,138,16,0.12);
  border: 1px solid rgba(252,138,16,0.28);
  line-height: 1;
  margin-bottom: 0.2rem;
  flex: 0 0 auto;
}

.takeaway-card h3 {
  margin: 0;
  line-height: 1.08;
}

.takeaway-card p {
  margin: 0;
}

.takeaway-section .story-copy,
.takeaway-section .personal-summary-grid,
.takeaway-section .takeaway-grid {
  min-width: 0;
}

@media (max-width: 980px) {
  body:not(.exploration-unlocked) .guided-chapter,
  body:not(.exploration-unlocked) .guided-chapter.visual-ready {
    grid-template-columns: 1fr !important;
    min-height: auto;
  }

  body:not(.exploration-unlocked) .guided-chapter .chapter-text,
  body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text {
    max-width: 100%;
    text-align: left;
    justify-self: stretch;
  }

  body:not(.exploration-unlocked) .guided-chapter .visual-card {
    width: 100%;
  }
}

/* ── Final polish: reader-paced guided chapters + Chapter 7 sizing fix ── */
.story-action-button {
  margin-top: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.82rem 1.25rem;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  box-shadow: 0 12px 34px rgba(19, 29, 36, 0.14);
}

.story-action-button:hover,
.story-action-button:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  outline: none;
}

body.exploration-unlocked .story-action-button {
  display: none !important;
}

body:not(.exploration-unlocked) .guided-chapter:not(.visual-ready) .visual-card {
  display: none;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .visual-card {
  display: block;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready {
  min-height: auto;
  padding-top: clamp(1.8rem, 4vh, 3rem);
  padding-bottom: clamp(1.8rem, 4vh, 3rem);
}

body:not(.exploration-unlocked) .guided-chapter .chapter-text {
  padding-inline: clamp(0.5rem, 2vw, 2rem);
}

/* Chapter 7 was too narrow for 01/02/03 cards. Make it stack cleanly. */
.takeaway-section {
  grid-template-columns: 1fr !important;
  align-items: center;
  gap: clamp(1rem, 2.5vh, 1.6rem);
  min-height: auto;
  padding-top: clamp(2rem, 4vh, 3rem);
  padding-bottom: clamp(2rem, 4vh, 3rem);
}

.takeaway-section .story-copy {
  max-width: 900px;
  text-align: center;
  margin: 0 auto;
}

.takeaway-section .story-copy p {
  margin-left: auto;
  margin-right: auto;
}

.takeaway-section .personal-summary-grid {
  max-width: 980px;
  margin: 0 auto;
}

.takeaway-grid {
  width: min(100%, 1120px);
  margin: 0 auto;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: clamp(0.9rem, 2vw, 1.4rem);
}

.takeaway-card {
  min-width: 0;
  min-height: clamp(210px, 28vh, 285px);
  padding: clamp(1.15rem, 2vw, 1.55rem);
  overflow: hidden;
}

.takeaway-card span {
  width: clamp(3rem, 5vw, 4.25rem);
  height: clamp(3rem, 5vw, 4.25rem);
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.takeaway-card h3 {
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.takeaway-card p {
  font-size: clamp(0.86rem, 1.1vw, 0.98rem);
  line-height: 1.45;
}

@media (max-width: 980px) {
  .takeaway-grid,
  .personal-summary-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1180px) and (min-width: 981px) {
  .takeaway-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .takeaway-card h3 {
    font-size: clamp(1.25rem, 2.1vw, 1.7rem);
  }
}

/* ── Smooth scroll + exploration spacing fix ───────────────────────
   The earlier reader-paced version used scroll snapping and sticky chapter
   text. That made the page feel like it could get stuck between chapters.
   These overrides keep the story paced by buttons, but make manual scrolling
   feel normal again. */
html {
  scroll-snap-type: none !important;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

.story-section,
.chapter {
  scroll-snap-align: none !important;
  scroll-snap-stop: normal !important;
  scroll-margin-top: 72px;
}

.chapter-text {
  position: relative !important;
  top: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Once the reader enters full exploration, return to the compact dashboard-like
   spacing instead of the big cinematic story spacing. */
body.exploration-unlocked main {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

body.exploration-unlocked .story-section,
body.exploration-unlocked .chapter {
  min-height: auto !important;
  padding: 3rem 3rem !important;
  gap: 2rem !important;
  align-items: start !important;
}

body.exploration-unlocked .chapter {
  grid-template-columns: minmax(280px, 0.75fr) minmax(420px, 1.25fr) !important;
}

body.exploration-unlocked .chapter-map {
  grid-template-columns: minmax(280px, 0.55fr) minmax(520px, 1.45fr) !important;
}

body.exploration-unlocked .chapter-wide {
  grid-template-columns: minmax(280px, 0.6fr) minmax(420px, 1.4fr) !important;
}

body.exploration-unlocked .visual-card {
  max-height: none !important;
  overflow: visible !important;
  padding: 1.5rem !important;
}

body.exploration-unlocked .visual-card.wide {
  min-height: 650px !important;
}

body.exploration-unlocked #mapChart {
  height: 500px !important;
}

body.exploration-unlocked #ladderChart {
  height: 310px !important;
}

body.exploration-unlocked #comparisonChart,
body.exploration-unlocked #jobComparisonChart {
  height: 260px !important;
}

body.exploration-unlocked #dreamChart {
  height: 210px !important;
}

body.exploration-unlocked #recMapChart {
  height: 320px !important;
}

/* Reader-paced guided sections should still stay screen-friendly, but not trap
   scroll. The visual can appear below/next to the text based on available room. */
body:not(.exploration-unlocked) .guided-chapter.visual-ready {
  min-height: auto !important;
  padding-top: clamp(2rem, 4vh, 3.25rem) !important;
  padding-bottom: clamp(2rem, 4vh, 3.25rem) !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .visual-card {
  max-height: none !important;
  overflow: visible !important;
}

.income-animation-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0.8rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(23, 179, 217, 0.08);
  border: 1px solid rgba(23, 179, 217, 0.22);
  color: var(--teal2);
  font-size: 0.72rem;
  font-weight: 700;
}

.income-animation-status.is-animating {
  background: rgba(252, 138, 16, 0.10);
  border-color: rgba(252, 138, 16, 0.30);
  color: var(--accent2);
}

/* Stronger Chapter 7 repair: avoid narrow vertical cards and prevent text from
   being clipped at desktop widths like the screenshot. */
.takeaway-section {
  min-height: auto !important;
  align-items: start !important;
}

.takeaway-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: clamp(1rem, 2vw, 1.6rem) !important;
  width: min(100%, 1180px) !important;
}

.takeaway-card {
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
  padding: clamp(1.1rem, 1.8vw, 1.6rem) !important;
}

.takeaway-card span {
  width: clamp(2.7rem, 4vw, 3.6rem) !important;
  height: clamp(2.7rem, 4vw, 3.6rem) !important;
  font-size: clamp(1.25rem, 2.4vw, 1.8rem) !important;
}

.takeaway-card h3 {
  font-size: clamp(1.35rem, 2.2vw, 2rem) !important;
  line-height: 1.12 !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

@media (max-width: 1100px) {
  .takeaway-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 980px) {
  body.exploration-unlocked .story-section,
  body.exploration-unlocked .chapter,
  body.exploration-unlocked .chapter-map,
  body.exploration-unlocked .chapter-wide {
    grid-template-columns: 1fr !important;
    padding: 2.5rem 1.25rem !important;
  }

  body.exploration-unlocked #mapChart {
    height: 420px !important;
  }
}

/* ── Map sizing repair: keep guided/exploration visuals inside their cards ──
   SVG charts are redrawn after the visual is revealed, but this also prevents
   any temporarily-wide SVG from spilling out of the card while the layout shifts. */
.visual-card svg,
#mapChart,
#ladderChart,
#comparisonChart,
#jobComparisonChart,
#dreamChart,
#recMapChart {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready {
  grid-template-columns: minmax(260px, 0.52fr) minmax(0, 1.48fr) !important;
  width: min(100%, 1400px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  overflow-x: clip !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .visual-card {
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready #mapChart {
  height: min(460px, 54svh) !important;
}

body.exploration-unlocked .visual-card {
  min-width: 0 !important;
  overflow: hidden !important;
}

body.exploration-unlocked #mapChart {
  height: min(520px, 62svh) !important;
}

@media (max-width: 1100px) {
  body:not(.exploration-unlocked) .guided-chapter.visual-ready {
    grid-template-columns: 1fr !important;
  }
}

/* ── Final all-section visual sizing repair ───────────────────────────────
   Applies to every guided chapter after Show visual, not only Chapter 1.
   Keeps charts inside their cards and prevents the two-column story layout from
   becoming so large that the visual is cut off on normal laptop screens. */
body:not(.exploration-unlocked) .guided-chapter.visual-ready {
  width: min(100%, 1260px) !important;
  grid-template-columns: minmax(280px, 0.56fr) minmax(0, 1.05fr) !important;
  gap: clamp(1rem, 2vw, 1.75rem) !important;
  padding: clamp(1.35rem, 2.5vh, 2.25rem) clamp(1rem, 3vw, 2.25rem) !important;
  align-items: center !important;
  overflow-x: hidden !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text {
  max-width: 460px !important;
  justify-self: end !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text h2 {
  font-size: clamp(1.9rem, 3.4vw, 3.7rem) !important;
  line-height: 0.96 !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text p {
  font-size: clamp(0.86rem, 1vw, 0.98rem) !important;
  line-height: 1.55 !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .visual-card {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  padding: clamp(0.9rem, 1.6vw, 1.25rem) !important;
  overflow: hidden !important;
  align-self: center !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready .visual-card.wide,
body:not(.exploration-unlocked) .guided-chapter.visual-ready .ch5-card {
  min-height: 0 !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-ready #mapChart {
  height: min(410px, 48svh) !important;
}
body:not(.exploration-unlocked) .guided-chapter.visual-ready #ladderChart {
  height: min(270px, 36svh) !important;
}
body:not(.exploration-unlocked) .guided-chapter.visual-ready #comparisonChart,
body:not(.exploration-unlocked) .guided-chapter.visual-ready #jobComparisonChart {
  height: min(235px, 34svh) !important;
}
body:not(.exploration-unlocked) .guided-chapter.visual-ready #dreamChart {
  height: min(210px, 32svh) !important;
}
body:not(.exploration-unlocked) .guided-chapter.visual-ready #recMapChart {
  height: min(280px, 34svh) !important;
}

/* Full exploration mode should be compact like the original dashboard. */
body.exploration-unlocked .chapter,
body.exploration-unlocked .chapter-map,
body.exploration-unlocked .chapter-wide {
  width: min(100%, 1320px) !important;
  padding: 2.25rem clamp(1rem, 2vw, 2rem) !important;
  gap: 1.5rem !important;
}

body.exploration-unlocked .visual-card {
  padding: 1.15rem !important;
  overflow: hidden !important;
}

body.exploration-unlocked .visual-card.wide,
body.exploration-unlocked .ch5-card {
  min-height: 0 !important;
}

body.exploration-unlocked #mapChart { height: min(430px, 54svh) !important; }
body.exploration-unlocked #ladderChart { height: min(285px, 38svh) !important; }
body.exploration-unlocked #comparisonChart,
body.exploration-unlocked #jobComparisonChart { height: min(250px, 36svh) !important; }
body.exploration-unlocked #dreamChart { height: min(210px, 32svh) !important; }
body.exploration-unlocked #recMapChart { height: min(300px, 38svh) !important; }

.visual-card svg {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
}

@media (max-width: 1050px) {
  body:not(.exploration-unlocked) .guided-chapter.visual-ready {
    grid-template-columns: 1fr !important;
    width: min(100%, 860px) !important;
  }
  body:not(.exploration-unlocked) .guided-chapter.visual-ready .chapter-text {
    max-width: 100% !important;
    justify-self: stretch !important;
  }
}


/* ── Chapter 4 update: two job offers, with visual kept visible once shown ── */
.offer-card .offer-label {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.45rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(23, 179, 217, 0.10);
  border: 1px solid rgba(23, 179, 217, 0.22);
  color: var(--teal2);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonCards {
  margin-bottom: 0.7rem !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonChart {
  height: min(300px, 40svh) !important;
}

body.exploration-unlocked #jobComparisonChart {
  height: min(285px, 38svh) !important;
}

/* Once a chapter visual has been revealed, keep that visual visible if the reader
   scrolls away and comes back. This preserves the reader-paced state. */
body:not(.exploration-unlocked) .guided-chapter.visual-shown .visual-card {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  max-height: none;
  pointer-events: auto;
}

body:not(.exploration-unlocked) .guided-chapter.visual-shown {
  grid-template-columns: minmax(280px, 0.56fr) minmax(0, 1.05fr) !important;
}

body:not(.exploration-unlocked) .guided-chapter.visual-shown .chapter-text {
  max-width: 460px !important;
  text-align: left !important;
  justify-self: end !important;
}

@media (max-width: 1050px) {
  body:not(.exploration-unlocked) .guided-chapter.visual-shown {
    grid-template-columns: 1fr !important;
  }
  body:not(.exploration-unlocked) .guided-chapter.visual-shown .chapter-text {
    max-width: 100% !important;
    justify-self: stretch !important;
  }
}

/* ── Final reader-paced updates ────────────────────────────── */
body:not(.exploration-unlocked) .guided-chapter.visual-ready .story-action-button,
body:not(.exploration-unlocked) .guided-chapter.visual-shown .story-action-button {
  display: none !important;
}

.story-ladder-controls {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.7rem 0 0.9rem;
}

.story-ladder-controls button {
  border: 1px solid rgba(23, 179, 217, 0.30);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--teal2);
  font-weight: 800;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.story-ladder-controls button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(12, 48, 66, 0.10);
}

.story-ladder-controls button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

body:not(.exploration-unlocked) #chapter4.visual-ready .visual-card,
body:not(.exploration-unlocked) #chapter4.visual-shown .visual-card {
  align-self: stretch;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonChart,
body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonChart {
  width: 100% !important;
  height: clamp(330px, 43svh, 430px) !important;
  min-height: 330px !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonCards,
body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonCards {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  margin-bottom: 0.7rem !important;
}

body.exploration-unlocked #jobComparisonChart {
  width: 100% !important;
  height: 330px !important;
  min-height: 300px !important;
}

body.exploration-unlocked #chapter4 .visual-card {
  min-width: 0;
}

@media (max-width: 760px) {
  body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonCards,
  body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonCards {
    grid-template-columns: 1fr;
  }
  body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonChart,
  body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonChart {
    height: 340px !important;
  }
}

/* ── User-requested final fixes: Chapter 2 button + Chapter 4 wider comparison ── */
body:not(.exploration-unlocked) .guided-chapter:not(.visual-ready) .story-action-button {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Chapter 4 should read like Chapter 3: two cards on top, wide comparison chart below. */
body:not(.exploration-unlocked) #chapter4.visual-ready,
body:not(.exploration-unlocked) #chapter4.visual-shown {
  grid-template-columns: minmax(240px, 0.42fr) minmax(720px, 1.58fr) !important;
  gap: clamp(1rem, 2.2vw, 2rem) !important;
  align-items: center !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready .chapter-text,
body:not(.exploration-unlocked) #chapter4.visual-shown .chapter-text {
  max-width: 390px !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready .visual-card,
body:not(.exploration-unlocked) #chapter4.visual-shown .visual-card {
  width: min(1080px, 100%) !important;
  max-width: none !important;
  padding: clamp(1rem, 1.6vw, 1.35rem) !important;
  overflow: visible !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonCards,
body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonCards {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(250px, 1fr)) !important;
  gap: 1rem !important;
  margin-bottom: 0.75rem !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonChart,
body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonChart {
  width: 100% !important;
  height: clamp(380px, 48svh, 470px) !important;
  min-height: 380px !important;
  display: block !important;
}

body.exploration-unlocked #chapter4 .visual-card {
  width: 100% !important;
  max-width: none !important;
}

body.exploration-unlocked #jobComparisonChart {
  width: 100% !important;
  height: 390px !important;
  min-height: 360px !important;
}

@media (max-width: 1180px) {
  body:not(.exploration-unlocked) #chapter4.visual-ready,
  body:not(.exploration-unlocked) #chapter4.visual-shown {
    grid-template-columns: 1fr !important;
  }
  body:not(.exploration-unlocked) #chapter4.visual-ready .chapter-text,
  body:not(.exploration-unlocked) #chapter4.visual-shown .chapter-text {
    max-width: 100% !important;
  }
}

@media (max-width: 720px) {
  body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonCards,
  body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonCards {
    grid-template-columns: 1fr !important;
  }
  body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonChart,
  body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonChart {
    height: 390px !important;
  }
}

/* Final Chapter 4 chart cleanup: match Chapter 3's wider bar chart and remove offer badges. */
body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonChart,
body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonChart {
  width: 100% !important;
  height: clamp(300px, 40svh, 380px) !important;
  min-height: 300px !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonCards,
body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonCards {
  margin-bottom: 0.55rem !important;
}

#jobComparisonCards .offer-label {
  display: none !important;
}

/* FINAL FIX: Chapter 4 chart should match Chapter 3, not the tiny centered version. */
body:not(.exploration-unlocked) #chapter4.visual-ready,
body:not(.exploration-unlocked) #chapter4.visual-shown {
  grid-template-columns: minmax(300px, 0.48fr) minmax(760px, 1.52fr) !important;
  gap: clamp(1.5rem, 2.8vw, 3.4rem) !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready .visual-card,
body:not(.exploration-unlocked) #chapter4.visual-shown .visual-card {
  width: 100% !important;
  max-width: none !important;
  justify-self: stretch !important;
  overflow: visible !important;
}

body:not(.exploration-unlocked) #chapter4.visual-ready #jobComparisonChart,
body:not(.exploration-unlocked) #chapter4.visual-shown #jobComparisonChart {
  width: 100% !important;
  height: 390px !important;
  min-height: 390px !important;
  overflow: visible !important;
}

#jobComparisonCards .offer-label {
  display: none !important;
}

@media (max-width: 1180px) {
  body:not(.exploration-unlocked) #chapter4.visual-ready,
  body:not(.exploration-unlocked) #chapter4.visual-shown {
    grid-template-columns: 1fr !important;
  }
}

/* In full exploration mode, hide guided Chapter 2 step text above the chart. */
body.exploration-unlocked #incomeAnimationStatus {
  display: none !important;
}

/* Offer-guess opening interaction */
.offer-guess-panel {
  border-left-color: var(--teal);
  background: rgba(23, 179, 217, 0.08);
}

.guess-grid {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 170px);
  gap: 0.75rem 0.9rem;
  align-items: center;
  margin-top: 1rem;
}

.guess-grid label {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink);
}

.guess-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.74);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.25rem 0.7rem 0.25rem 0.35rem;
}

.guess-input-wrap input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.4rem;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  outline: none;
}

.guess-input-wrap span {
  margin: 0;
  display: inline;
  font-size: 0.86rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.guess-submit {
  margin-top: 1rem;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.guess-submit:hover,
.guess-submit:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.guess-result.is-revealed {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 720px) {
  .guess-grid {
    grid-template-columns: 1fr;
  }
}

.reset-story-btn {
  position: fixed;
  top: 1.1rem;
  left: 1.1rem;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(13, 28, 36, 0.08);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.reset-story-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.team-members {
  margin-top: 0.75rem;
  font-family: "DM Sans", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #4a3010;
  text-align: center;
  margin-bottom: 1rem;
}

.hero-subtitle {
  margin-bottom: 1.25rem;
}