@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=Outfit:wght@300;400;500;600&display=swap");

:root {
  --fb-ink: #1f2f2a;
  --fb-ink-deep: #15231f;
  --fb-gold: #a77d48;
  --fb-gold-light: #c6a56d;
  --fb-sand: #efe8dc;
  --fb-sand-deep: #e1d7c7;
  --fb-ivory: #f8f4eb;
  --fb-sage: #78837c;
  --fb-text: #526159;
  --ink: var(--fb-ivory);
  --muted: rgba(248, 244, 235, 0.58);
  --night: var(--fb-ink-deep);
  --line: rgba(198, 165, 109, 0.22);
  --lime: var(--fb-gold-light);
  --blue: var(--fb-sage);
  --amber: var(--fb-gold);
  --font-display: "Cormorant Garamond", serif;
  --font-body: "Outfit", sans-serif;
  color: var(--fb-ink);
  background: var(--fb-sand);
  font-family: var(--font-body);
}

html { background: var(--fb-ink-deep); }
body {
  min-width: 320px;
  background: var(--fb-sand);
  color: var(--fb-ink);
}
button,
input { font-family: var(--font-body); }
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--fb-gold-light);
  outline-offset: 4px;
}

.app-shell {
  min-height: 100dvh;
  overflow-x: clip;
  background:
    radial-gradient(circle at 82% 11rem, rgba(167, 125, 72, 0.08), transparent 24rem),
    var(--fb-sand);
}
.app-shell::before {
  opacity: 0.055;
  mix-blend-mode: multiply;
}

/* Navegación compartida con las demás herramientas */
.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  justify-content: flex-end;
  height: 76px;
  padding: 0 3.5rem;
  border-bottom: 1px solid rgba(198, 165, 109, 0.24);
  background: rgba(21, 35, 31, 0.97);
  box-shadow: 0 12px 38px rgba(10, 22, 17, 0.14);
  backdrop-filter: blur(14px);
}
.brand,
.topbar > .top-actions { display: none; }
.local-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
.utility-nav-inner {
  width: min(1180px, 100%);
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}
.nav-icon-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(198, 165, 109, 0.3);
  border-radius: 0;
  background: transparent;
  color: rgba(248, 244, 235, 0.72);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.nav-icon-btn:hover,
.nav-icon-btn[aria-expanded="true"] {
  color: var(--fb-gold-light);
  border-color: rgba(198, 165, 109, 0.7);
  background: rgba(248, 244, 235, 0.05);
}
.nav-icon-btn svg { width: 21px; height: 21px; }
.nav-tools-item { position: relative; }
.tools-dropdown {
  position: absolute;
  top: calc(100% + 0.8rem);
  right: 0;
  width: min(780px, calc(100vw - 3rem));
  padding: 0.85rem;
  border: 1px solid rgba(198, 165, 109, 0.34);
  background: rgba(21, 35, 31, 0.99);
  box-shadow: 0 30px 90px rgba(4, 12, 9, 0.45);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.22s, visibility 0.18s;
}
.tools-dropdown.open {
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.tools-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.75rem 1rem;
  border-bottom: 1px solid rgba(248, 244, 235, 0.12);
}
.tools-dropdown-head strong {
  color: var(--fb-ivory);
  font: 500 1.2rem "Cormorant Garamond", serif;
}
.tools-dropdown-head span {
  color: rgba(248, 244, 235, 0.5);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
.tools-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.tools-menu-group { padding: 0.85rem 0.6rem 0.5rem; }
.tools-menu-group + .tools-menu-group {
  border-left: 1px solid rgba(248, 244, 235, 0.1);
}
.tools-menu-label {
  margin: 0 0 0.45rem 0.55rem;
  color: var(--fb-gold-light);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tools-menu-link {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-height: 58px;
  padding: 0.48rem 0.55rem;
  color: var(--fb-ivory);
  text-decoration: none;
  transition: background 0.2s;
}
.tools-menu-link:hover,
.tools-menu-link.active { background: rgba(248, 244, 235, 0.06); }
.tools-menu-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(198, 165, 109, 0.28);
  color: var(--fb-gold-light);
}
.tools-menu-icon svg { width: 20px; height: 20px; }
.tools-menu-copy strong,
.tools-menu-copy small { display: block; }
.tools-menu-copy strong { font-size: 0.76rem; font-weight: 500; }
.tools-menu-copy small {
  margin-top: 0.1rem;
  color: rgba(248, 244, 235, 0.43);
  font-size: 0.62rem;
  line-height: 1.25;
}

/* Composición principal */
.game-layout {
  grid-template-columns: minmax(370px, 39%) minmax(0, 1fr);
  width: min(1440px, 100%);
  min-height: calc(100dvh - 122px);
  margin: 0 auto;
  background: var(--fb-ivory);
  box-shadow: 0 28px 78px rgba(31, 47, 42, 0.09);
}
.lesson-panel {
  border-right: 1px solid rgba(31, 47, 42, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 48%),
    var(--fb-sand);
  color: var(--fb-ink);
  padding: clamp(3.5rem, 5vw, 6.5rem) clamp(2.25rem, 4vw, 4.75rem);
}
.mission-tag {
  margin-bottom: 1.2rem;
  color: var(--fb-gold);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}
.mission-tag span {
  width: 24px;
  background: var(--fb-gold);
  box-shadow: none;
}
h1 {
  max-width: 10ch;
  color: var(--fb-ink);
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(3.35rem, 5.3vw, 5.4rem);
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 0.96;
}
h1 span {
  color: var(--fb-gold);
  font-style: italic;
  font-weight: 300;
}
.intro {
  max-width: 31rem;
  margin: 1.35rem 0 1.75rem;
  color: var(--fb-text);
  font-size: 0.94rem;
  font-weight: 300;
  line-height: 1.75;
}
.savings-inputs {
  gap: 0.75rem;
  max-width: 34rem;
  margin-bottom: 1rem;
}
.savings-inputs label > span {
  margin-bottom: 0.55rem;
  color: var(--fb-text);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.savings-inputs label > small {
  margin-top: 0.45rem;
  color: var(--fb-sage);
  font-size: 0.66rem;
}
.money-input {
  height: 50px;
  padding: 0 0.85rem;
  border: 1px solid rgba(31, 47, 42, 0.18);
  border-radius: 2px;
  background: rgba(248, 244, 235, 0.78);
}
.money-input:focus-within {
  border-color: var(--fb-gold);
  background: var(--fb-ivory);
  box-shadow: 0 0 0 3px rgba(167, 125, 72, 0.09);
}
.money-input b {
  color: var(--fb-gold);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  font-weight: 500;
}
.money-input input {
  color: var(--fb-ink);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.28rem;
  font-weight: 500;
}
.simulation-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 34rem;
  margin: 0.5rem 0 1.15rem;
}
.simulation-meta .rate-chip {
  min-height: 42px;
  padding: 0 0.9rem;
  border: 1px solid rgba(167, 125, 72, 0.25);
  border-radius: 2px;
  background: rgba(248, 244, 235, 0.58);
  color: var(--fb-gold);
}
.simulation-meta .rate-chip span {
  color: var(--fb-sage);
  font-size: 0.58rem;
  font-weight: 600;
}
.simulation-meta .rate-chip strong {
  color: var(--fb-ink);
  font-size: 0.7rem;
  font-weight: 500;
}
.simulation-meta .icon-button {
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(167, 125, 72, 0.25);
  border-radius: 2px;
  background: rgba(248, 244, 235, 0.58);
  color: var(--fb-text);
}
.simulation-meta .icon-button:hover {
  border-color: var(--fb-gold);
  background: var(--fb-ivory);
  color: var(--fb-gold);
}
.lesson-card {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 1rem;
  max-width: 34rem;
  padding: 1.15rem 0;
  border-color: rgba(31, 47, 42, 0.15);
}
.lesson-number {
  color: rgba(167, 125, 72, 0.28);
  font-family: "Cormorant Garamond", serif;
  font-size: 2.6rem;
  font-weight: 400;
}
.eyebrow {
  color: var(--fb-gold);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}
.lesson-card h2 {
  margin: 0.25rem 0 0.4rem;
  color: var(--fb-ink);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.4rem;
  font-weight: 500;
}
.lesson-card p {
  color: var(--fb-text);
  font-size: 0.78rem;
  line-height: 1.65;
}
.formula-strip {
  max-width: 34rem;
  margin-top: 0.85rem;
}
.formula-strip > div:not(.formula-arrow) {
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(31, 47, 42, 0.13);
  border-radius: 2px;
  background: rgba(248, 244, 235, 0.7);
}
.formula-strip span {
  color: var(--fb-sage);
  font-size: 0.62rem;
}
.formula-strip strong {
  color: var(--fb-ink);
  font-family: "Cormorant Garamond", serif;
  font-size: 1rem;
  font-weight: 500;
}
.formula-strip > div:last-child strong { color: var(--fb-gold); }
.formula-arrow { color: var(--fb-sage); }
.plain-rule {
  max-width: 34rem;
  margin-top: 0.75rem;
  color: var(--fb-text);
  font-size: 0.7rem;
  line-height: 1.55;
}
.plain-rule strong { color: var(--fb-ink); font-weight: 500; }

/* Escena y resultados */
.world-panel {
  min-width: 0;
  min-height: 670px;
  background:
    radial-gradient(circle at 58% 36%, rgba(120, 131, 124, 0.18), transparent 34%),
    linear-gradient(150deg, #263c35, var(--fb-ink-deep) 76%);
}
.scene-wrap::before {
  background: radial-gradient(at 50% 58%, transparent 24%, rgba(9, 23, 17, 0.68) 100%);
}
.three-stage canvas {
  filter: saturate(0.62) sepia(0.08) brightness(0.94);
}
.scene-legend {
  top: 5%;
  gap: 0.55rem;
}
.scene-label {
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(198, 165, 109, 0.22);
  border-radius: 2px;
  background: rgba(21, 35, 31, 0.88);
  box-shadow: 0 16px 34px rgba(7, 20, 14, 0.2);
}
.scene-label small {
  color: rgba(248, 244, 235, 0.48);
  font-size: 0.55rem;
  font-weight: 600;
}
.scene-label strong {
  color: var(--fb-ivory);
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1rem, 1.45vw, 1.4rem);
  font-weight: 500;
  letter-spacing: -0.015em;
}
.scene-label b {
  color: rgba(248, 244, 235, 0.42);
  font-size: 0.55rem;
  font-weight: 300;
}
.label-dot { border-radius: 50%; }
.simple-label .label-dot {
  background: var(--fb-sage);
  box-shadow: 0 0 10px rgba(120, 131, 124, 0.7);
}
.contribution-label .label-dot {
  background: var(--fb-ivory);
  box-shadow: 0 0 10px rgba(248, 244, 235, 0.5);
}
.compound-label .label-dot {
  background: var(--fb-gold-light);
  box-shadow: 0 0 10px rgba(198, 165, 109, 0.7);
}
.simple-label strong { color: #aab5ae; }
.contribution-label strong { color: var(--fb-ivory); }
.compound-label strong { color: var(--fb-gold-light); }
.difference-pill {
  top: 23%;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(198, 165, 109, 0.48);
  border-radius: 2px;
  background: rgba(31, 47, 42, 0.92);
  color: var(--fb-gold-light);
}
.difference-pill span { color: rgba(248, 244, 235, 0.52); }
.drag-hint { color: rgba(248, 244, 235, 0.45); }
.control-deck {
  min-height: 124px;
  border-top: 1px solid rgba(198, 165, 109, 0.2);
  background: rgba(21, 35, 31, 0.98);
}
.year-readout span { color: var(--fb-gold-light); }
.year-readout strong {
  color: var(--fb-ivory);
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
}
.year-readout small,
.range-row { color: rgba(248, 244, 235, 0.48); }
.timeline-control input {
  border-radius: 1px;
  background: linear-gradient(90deg, var(--fb-gold-light) 0 var(--progress), rgba(248, 244, 235, 0.16) var(--progress));
}
.timeline-control input::-webkit-slider-thumb {
  border: 4px solid var(--fb-gold-light);
  background: var(--fb-ink-deep);
  box-shadow: 0 0 12px rgba(198, 165, 109, 0.38);
}
.timeline-control input::-moz-range-thumb {
  border-color: var(--fb-gold-light);
  background: var(--fb-ink-deep);
}
.tick-row i.active { background: var(--fb-gold-light); }
.reset-button,
.play-button {
  border-radius: 2px;
}
.reset-button {
  border-color: rgba(198, 165, 109, 0.25);
  background: rgba(248, 244, 235, 0.04);
  color: rgba(248, 244, 235, 0.68);
}
.reset-button:hover { border-color: var(--fb-gold-light); color: var(--fb-gold-light); }
.play-button {
  border-color: var(--fb-gold-light);
  background: var(--fb-gold-light);
  color: var(--fb-ink-deep);
}
.play-button:hover { background: #dfc18d; filter: none; }

footer {
  min-height: 54px;
  padding: 0 3.5rem;
  border-top: 1px solid rgba(198, 165, 109, 0.14);
  background: var(--fb-ink-deep);
  color: rgba(248, 244, 235, 0.38);
}
footer p { color: rgba(248, 244, 235, 0.54); }

@media (max-width: 1050px) {
  .game-layout { grid-template-columns: minmax(330px, 40%) minmax(0, 60%); }
  .lesson-panel { padding-inline: 2rem; }
  h1 { font-size: clamp(3rem, 5.6vw, 4.2rem); }
}

@media (max-width: 960px) {
  .topbar { height: 70px; padding: 0 1.5rem; }
  .utility-nav-inner { min-height: 70px; }
  .game-layout {
    display: flex;
    width: 100%;
    min-height: auto;
    box-shadow: none;
  }
  .lesson-panel {
    order: 1;
    padding: 4.75rem 1.5rem 4rem;
    border-right: 0;
  }
  h1 { max-width: 11ch; font-size: clamp(3.5rem, 10vw, 5rem); }
  .intro { max-width: 34rem; }
  .world-panel {
    order: 2;
    grid-template-rows: 560px auto;
    min-height: 730px;
    border-top: 1px solid rgba(198, 165, 109, 0.18);
  }
  .control-deck { grid-template-columns: 84px minmax(0, 1fr); }
  .play-controls {
    grid-column: 1 / -1;
    grid-template-columns: 48px minmax(140px, 240px);
    justify-content: end;
  }
  footer { padding: 1.5rem; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 1rem; }
  .tools-dropdown {
    position: fixed;
    top: 76px;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-height: calc(100vh - 92px);
    overflow-y: auto;
  }
  .tools-dropdown-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .tools-menu-grid { grid-template-columns: 1fr; }
  .tools-menu-group + .tools-menu-group {
    border-top: 1px solid rgba(248, 244, 235, 0.1);
    border-left: 0;
  }
  .lesson-panel { padding: 4rem 1rem 3.5rem; }
  h1 { font-size: clamp(3.15rem, 15vw, 4.35rem); }
  .savings-inputs,
  .formula-strip { grid-template-columns: 1fr; }
  .formula-arrow { display: none; }
  .simulation-meta { align-items: stretch; }
  .simulation-meta .rate-chip { flex: 1; }
  .world-panel {
    grid-template-rows: 510px auto;
    min-height: 700px;
  }
  .scene-legend { top: 0.75rem; right: 0.5rem; left: 0.5rem; }
  .scene-label {
    display: block;
    padding: 0.55rem 0.25rem;
    text-align: center;
  }
  .scene-label .label-dot,
  .scene-label b { display: none; }
  .scene-label small { white-space: nowrap; font-size: 0.42rem; letter-spacing: 0.04em; }
  .scene-label strong { font-size: clamp(0.72rem, 3.4vw, 0.9rem); }
  .difference-pill { top: 5.2rem; }
  .control-deck {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 0.9rem;
    min-height: 176px;
    padding: 1.15rem 1rem;
  }
  .year-readout strong { font-size: 2.35rem; }
  .play-controls { grid-template-columns: 48px minmax(0, 1fr); }
  footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: 0;
    padding: 1.5rem 1rem;
    line-height: 1.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ================================================================
   REVISIÓN ESPACIAL · CÁMARA VERDE
   Configuración, visualización y explicación viven en planos separados.
================================================================ */
:root {
  --stage-deep: #10231c;
  --stage-ink: #173229;
  --stage-mid: #254439;
  --stage-surface: #2d4d42;
  --stage-soft: #3a5c50;
}

html,
body { background: var(--stage-deep); }
.app-shell {
  background:
    radial-gradient(circle at 10% 22%, rgba(120, 131, 124, 0.13), transparent 28rem),
    linear-gradient(145deg, var(--stage-ink), var(--stage-deep) 72%);
}
.app-shell::before {
  opacity: 0.045;
  mix-blend-mode: soft-light;
}

.game-layout {
  grid-template-columns: minmax(390px, 460px) minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-height: calc(100svh - 76px);
  margin: 0;
  background: var(--stage-ink);
  box-shadow: none;
}
.lesson-panel {
  justify-content: center;
  padding: clamp(3.5rem, 5vw, 5.75rem) clamp(2.25rem, 4vw, 4.5rem);
  border-right: 1px solid rgba(198, 165, 109, 0.18);
  background:
    radial-gradient(circle at 12% 8%, rgba(120, 131, 124, 0.16), transparent 17rem),
    linear-gradient(155deg, var(--stage-surface), var(--stage-mid));
  color: var(--fb-ivory);
}
.mission-tag { color: var(--fb-gold-light); }
.mission-tag span { background: var(--fb-gold-light); }
h1 {
  max-width: 9ch;
  color: var(--fb-ivory);
  font-size: clamp(3.7rem, 5vw, 5.15rem);
}
h1 span { color: var(--fb-gold-light); }
.intro {
  max-width: 27rem;
  margin: 1.3rem 0 1.8rem;
  color: rgba(248, 244, 235, 0.66);
}
.savings-inputs {
  grid-template-columns: 1fr;
  gap: 1.05rem;
  width: min(100%, 22rem);
  max-width: none;
  margin-bottom: 1.15rem;
}
.savings-inputs label > span { color: rgba(248, 244, 235, 0.72); }
.savings-inputs label > small { color: rgba(248, 244, 235, 0.45); }
.money-input {
  height: 52px;
  border-color: rgba(198, 165, 109, 0.25);
  background: rgba(16, 35, 28, 0.34);
}
.money-input:hover { border-color: rgba(198, 165, 109, 0.48); }
.money-input:focus-within {
  border-color: var(--fb-gold-light);
  background: rgba(16, 35, 28, 0.52);
  box-shadow: 0 0 0 3px rgba(198, 165, 109, 0.09);
}
.money-input b,
.money-input input { color: var(--fb-gold-light); }
.simulation-meta {
  width: min(100%, 22rem);
  max-width: none;
  margin: 0.35rem 0 0;
}
.simulation-meta .rate-chip,
.simulation-meta .icon-button {
  border-color: rgba(198, 165, 109, 0.22);
  background: rgba(16, 35, 28, 0.28);
}
.simulation-meta .rate-chip { flex: 1; }
.simulation-meta .rate-chip span { color: rgba(248, 244, 235, 0.46); }
.simulation-meta .rate-chip strong { color: var(--fb-ivory); }
.simulation-meta .icon-button { color: rgba(248, 244, 235, 0.7); }
.simulation-meta .icon-button:hover {
  border-color: var(--fb-gold-light);
  background: rgba(16, 35, 28, 0.48);
  color: var(--fb-gold-light);
}
.lesson-panel > .lesson-card,
.lesson-panel > .formula-strip,
.lesson-panel > .plain-rule { display: none; }

.world-panel {
  min-height: calc(100svh - 76px);
  background:
    radial-gradient(circle at 50% 38%, rgba(58, 92, 80, 0.36), transparent 34%),
    linear-gradient(150deg, var(--stage-ink), var(--stage-deep) 78%);
}
.scene-wrap::before {
  background: radial-gradient(at 50% 58%, transparent 22%, rgba(7, 21, 15, 0.62) 100%);
}
.three-stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(31, 47, 42, 0.13);
  content: "";
  pointer-events: none;
  mix-blend-mode: color;
}
.three-stage canvas {
  filter: saturate(0.52) sepia(0.12) brightness(0.91);
}
.scene-label {
  border-color: rgba(198, 165, 109, 0.2);
  background: rgba(16, 35, 28, 0.86);
}
.difference-pill { background: rgba(23, 50, 41, 0.94); }
.control-deck {
  min-height: 116px;
  background: rgba(16, 35, 28, 0.97);
}

.learning-strip {
  position: relative;
  z-index: 3;
  border-top: 1px solid rgba(198, 165, 109, 0.16);
  background:
    radial-gradient(circle at 88% 25%, rgba(120, 131, 124, 0.13), transparent 24rem),
    var(--stage-mid);
}
.learning-strip-inner {
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.65fr);
  align-items: start;
  gap: clamp(3rem, 6vw, 6.5rem);
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 7rem 3.5rem;
}
.learning-heading p {
  margin: 0 0 1rem;
  color: var(--fb-gold-light);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.learning-heading h2 {
  margin: 0;
  color: var(--fb-ivory);
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.45rem, 4.2vw, 4rem);
  font-weight: 300;
  line-height: 1.02;
}
.learning-heading h2 em {
  color: var(--fb-gold-light);
  font-style: italic;
}
.learning-content {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: stretch;
  gap: 1.25rem;
}
.learning-strip .lesson-card {
  display: grid;
  align-content: center;
  max-width: none;
  margin: 0;
  padding: 2rem;
  border: 1px solid rgba(198, 165, 109, 0.19);
  border-radius: 2px;
  background: var(--stage-surface);
}
.learning-strip .lesson-number { color: rgba(198, 165, 109, 0.32); }
.learning-strip .eyebrow { color: var(--fb-gold-light); }
.learning-strip .lesson-card h2 { color: var(--fb-ivory); }
.learning-strip .lesson-card p { color: rgba(248, 244, 235, 0.58); }
.learning-numbers {
  display: grid;
  align-content: center;
  gap: 0.9rem;
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid rgba(198, 165, 109, 0.15);
  background: rgba(16, 35, 28, 0.24);
}
.learning-strip .formula-strip {
  max-width: none;
  margin: 0;
}
.learning-strip .formula-strip > div:not(.formula-arrow) {
  border-color: rgba(198, 165, 109, 0.16);
  background: var(--stage-surface);
}
.learning-strip .formula-strip span { color: rgba(248, 244, 235, 0.45); }
.learning-strip .formula-strip strong { color: var(--fb-ivory); }
.learning-strip .formula-strip > div:last-child strong { color: var(--fb-gold-light); }
.learning-strip .formula-arrow { color: var(--fb-gold-light); }
.learning-strip .plain-rule {
  max-width: none;
  margin: 0;
  color: rgba(248, 244, 235, 0.54);
}
.learning-strip .plain-rule strong { color: var(--fb-ivory); }
footer { background: var(--stage-deep); }

@media (max-width: 1180px) and (min-width: 961px) {
  .game-layout { grid-template-columns: minmax(350px, 410px) minmax(0, 1fr); }
  .lesson-panel { padding-inline: 2.4rem; }
  h1 { font-size: clamp(3.45rem, 5vw, 4.5rem); }
  .scene-legend { right: 2%; left: 2%; }
}

@media (max-width: 960px) {
  .game-layout {
    display: flex;
    flex-direction: column;
    min-height: auto;
  }
  .lesson-panel {
    min-height: auto;
    padding: 5.5rem 1.5rem;
    border-right: 0;
  }
  h1 { max-width: 10ch; }
  .savings-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 36rem);
  }
  .simulation-meta { width: min(100%, 36rem); }
  .world-panel {
    grid-template-rows: 560px auto;
    min-height: 730px;
  }
  .learning-strip-inner {
    grid-template-columns: 1fr;
    gap: 2.75rem;
    padding: 6rem 1.5rem;
  }
  .learning-heading { max-width: 37rem; }
}

@media (max-width: 680px) {
  .learning-content { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .lesson-panel { padding: 4.5rem 1rem; }
  h1 { font-size: clamp(3.2rem, 15vw, 4.35rem); }
  .savings-inputs { grid-template-columns: 1fr; }
  .world-panel {
    grid-template-rows: 500px auto;
    min-height: 690px;
  }
  .learning-strip-inner { padding: 4.75rem 1rem; }
  .learning-strip .lesson-card,
  .learning-numbers { padding: 1.35rem; }
  .learning-strip .formula-strip { grid-template-columns: 1fr; }
}

/* ================================================================
   REVISIÓN ESTABLE · UNA SOLA ESCENA
   Ningún nodo administrado por React cambia de lugar.
================================================================ */
.standalone-utility-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 700;
  height: 76px;
  padding: 0 3.5rem;
  border-bottom: 1px solid rgba(198, 165, 109, 0.2);
  background: rgba(16, 35, 28, 0.95);
  box-shadow: 0 12px 38px rgba(7, 21, 15, 0.14);
  backdrop-filter: blur(14px);
}
.standalone-utility-nav .utility-nav-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  justify-content: flex-end;
}
.topbar { display: none; }
.app-shell {
  height: 100svh;
  min-height: 680px;
  padding-top: 76px;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 22%, rgba(120, 151, 135, 0.16), transparent 28rem),
    radial-gradient(circle at 18% 82%, rgba(58, 92, 80, 0.2), transparent 30rem),
    linear-gradient(135deg, #1b392f, var(--stage-deep) 76%);
}
.game-layout {
  grid-template-columns: minmax(390px, 38%) minmax(0, 62%);
  width: 100%;
  height: calc(100svh - 122px);
  min-height: 558px;
  background: transparent;
}
.lesson-panel {
  min-height: 0;
  padding: clamp(1.65rem, 3.5vh, 3.25rem) clamp(2.25rem, 3.8vw, 4.5rem);
  overflow-y: auto;
  border-right: 1px solid rgba(198, 165, 109, 0.15);
  background:
    radial-gradient(circle at 12% 16%, rgba(120, 131, 124, 0.08), transparent 19rem),
    linear-gradient(155deg, rgba(23, 50, 41, 0.98), rgba(16, 35, 28, 0.98));
  scrollbar-width: thin;
  scrollbar-color: rgba(198, 165, 109, 0.34) transparent;
}
.mission-tag { margin-bottom: 0.8rem; }
h1 {
  max-width: 11ch;
  font-size: clamp(3.05rem, 4.35vw, 4.75rem);
  line-height: 0.94;
}
.intro {
  margin: 0.85rem 0 1rem;
  font-size: 0.84rem;
  line-height: 1.6;
}
.savings-inputs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  width: 100%;
  max-width: 34rem;
  margin-bottom: 0.75rem;
}
.savings-inputs label > span {
  margin-bottom: 0.35rem;
  font-size: 0.58rem;
}
.savings-inputs label > small {
  margin-top: 0.25rem;
  font-size: 0.56rem;
}
.money-input {
  height: 44px;
  padding-inline: 0.75rem;
}
.money-input input { font-size: 1.12rem; }
.lesson-panel > .lesson-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 0.8rem;
  max-width: 34rem;
  padding: 0.72rem 0;
  border-color: rgba(198, 165, 109, 0.15);
}
.lesson-panel .lesson-number { font-size: 2.2rem; }
.lesson-panel .lesson-card h2 {
  margin: 0.15rem 0 0.28rem;
  color: var(--fb-ivory);
  font-size: 1.12rem;
}
.lesson-panel .lesson-card p {
  color: rgba(248, 244, 235, 0.54);
  font-size: 0.68rem;
  line-height: 1.5;
}
.lesson-panel > .formula-strip {
  display: grid;
  max-width: 34rem;
  margin-top: 0.65rem;
}
.lesson-panel .formula-strip > div:not(.formula-arrow) {
  padding: 0.55rem 0.65rem;
  border-color: rgba(198, 165, 109, 0.15);
  background: rgba(16, 35, 28, 0.28);
}
.lesson-panel .formula-strip span {
  margin-bottom: 0.15rem;
  color: rgba(248, 244, 235, 0.43);
  font-size: 0.54rem;
}
.lesson-panel .formula-strip strong {
  color: var(--fb-ivory);
  font-size: 0.85rem;
}
.lesson-panel .formula-strip > div:last-child strong { color: var(--fb-gold-light); }
.lesson-panel > .plain-rule {
  display: block;
  max-width: 34rem;
  margin-top: 0.45rem;
  color: rgba(248, 244, 235, 0.48);
  font-size: 0.62rem;
}
.lesson-panel .plain-rule strong { color: var(--fb-ivory); }
.learning-strip { display: none !important; }

.world-panel {
  grid-template-rows: minmax(0, 1fr) 110px;
  height: 100%;
  min-height: 0;
  border: 0;
  background:
    radial-gradient(circle at 54% 38%, rgba(120, 151, 135, 0.25), transparent 34%),
    linear-gradient(145deg, #315547, #254439 72%);
}
.scene-wrap {
  min-height: 0;
  background: rgba(45, 77, 66, 0.38);
}
.scene-wrap::before {
  background:
    radial-gradient(at 50% 56%, transparent 28%, rgba(10, 30, 22, 0.45) 100%),
    linear-gradient(90deg, rgba(23, 50, 41, 0.24), transparent 20%);
}
.three-stage::after {
  display: none;
}
.three-stage canvas {
  opacity: 1;
  filter: grayscale(0.06) sepia(0.1) saturate(0.78) contrast(1.14) brightness(1.04);
  mix-blend-mode: normal;
}
.scene-legend { top: 3.5%; }
.scene-label {
  background: rgba(16, 35, 28, 0.76);
  box-shadow: 0 16px 34px rgba(7, 21, 15, 0.13);
}
.difference-pill { top: 22%; }
.control-deck {
  min-height: 110px;
  padding-block: 0.85rem;
  border-top-color: rgba(198, 165, 109, 0.15);
  background: rgba(23, 50, 41, 0.72);
  backdrop-filter: blur(10px);
}
footer {
  height: 46px;
  min-height: 46px;
  background: rgba(16, 35, 28, 0.82);
}

@media (min-width: 961px) {
  body { overflow: hidden; }
}

@media (max-width: 1180px) and (min-width: 961px) {
  .game-layout { grid-template-columns: minmax(350px, 40%) minmax(0, 60%); }
  .lesson-panel { padding-inline: 2rem; }
  h1 { font-size: clamp(2.9rem, 4.4vw, 4rem); }
  .scene-label { padding-inline: 0.65rem; }
}

@media (max-width: 960px) {
  body { overflow: auto; }
  .standalone-utility-nav {
    height: 70px;
    padding: 0 1.5rem;
  }
  .standalone-utility-nav .utility-nav-inner { min-height: 70px; }
  .app-shell {
    height: auto;
    min-height: 100svh;
    padding-top: 70px;
    overflow: visible;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .lesson-panel {
    padding: 4.75rem 1.5rem;
    overflow: visible;
  }
  h1 { max-width: 10ch; font-size: clamp(3.5rem, 10vw, 5rem); }
  .savings-inputs { max-width: 36rem; }
  .world-panel {
    grid-template-rows: 560px 150px;
    height: 710px;
    min-height: 710px;
  }
  footer { height: auto; min-height: 54px; }
}

@media (max-width: 520px) {
  .standalone-utility-nav { padding: 0 1rem; }
  .lesson-panel { padding: 4rem 1rem; }
  .savings-inputs { grid-template-columns: 1fr; }
  .money-input { height: 50px; }
  .lesson-panel > .formula-strip { grid-template-columns: 1fr; }
  .world-panel {
    grid-template-rows: 500px 176px;
    height: 676px;
    min-height: 676px;
  }
  .scene-legend { top: 0.75rem; }
}
