:root {
  --page: #f4f1ea; --surface: #fffdf8; --text: #1d1d1b; --text-2: #5b5a55; --muted: #8c8a83;
  --accent: #1b5e20; --accent-soft: #e5efe0; --rain: #2a78d6; --et: #eb6834; --border: rgba(0,0,0,.08);
  --ease: cubic-bezier(.22,.8,.24,1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--page); color: var(--text); }
.player { max-width: 1100px; margin: 0 auto; padding: 1rem 1.2rem 2rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.brand { font-weight: 700; color: var(--accent); text-decoration: none; }
.counter { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }

/* ---------- escenario 16:9 ---------- */
.stage {
  position: relative; aspect-ratio: 16 / 9; background: var(--surface); border-radius: 22px;
  box-shadow: 0 10px 40px rgba(60,50,20,.10); overflow: hidden; display: flex; flex-direction: column;
  padding: 2.2rem 2.6rem 1.4rem;
}
.headline { margin: 0; font-size: clamp(1.4rem, 3.2vw, 2.4rem); line-height: 1.15; letter-spacing: -.01em; }
.headline.in { animation: rise .7s var(--ease) both; }
.subhead { color: var(--text-2); margin: .35rem 0 0; font-size: clamp(.9rem, 1.6vw, 1.1rem); min-height: 1.2em; }
.stage-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* pasos que aparecen con cada frase */
.step { opacity: 0; transform: translateY(16px) scale(.98); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--d, 0ms); }
.step.on { opacity: 1; transform: none; }

/* ---------- 1 portada ---------- */
.scene { width: min(100%, 720px); max-height: 74%; }
.scene .sun { fill: #f6c445; transform: translateY(60px); opacity: 0; transition: all 1.6s var(--ease); }
.scene.on .sun { transform: none; opacity: 1; }
.scene .furrows path { fill: none; stroke: #6f9b4f; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 400; stroke-dashoffset: 400;
  transition: stroke-dashoffset 1.4s var(--ease); transition-delay: var(--d); }
.scene.on .furrows path { stroke-dashoffset: 0; }
.scene .pin { transform: translateY(-140px); opacity: 0; transition: transform .9s cubic-bezier(.3,1.6,.5,1) 1.1s, opacity .3s 1.1s; }
.scene.on .pin { transform: none; opacity: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: .4rem; }
.chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: .45rem .95rem; font-weight: 600; font-size: clamp(.8rem, 1.5vw, 1rem); }
.big-chip { font-size: clamp(1rem, 2vw, 1.3rem); padding: .6rem 1.3rem; }

/* ---------- 2 clima ---------- */
.chart { width: 100%; max-height: 82%; overflow: visible; }
.chart .axis { stroke: #c9c5b8; stroke-width: 2; }
.chart .tick { font-size: 15px; fill: var(--text-2); text-anchor: middle; }
.chart .bar { fill: var(--rain); transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); opacity: 1;
  transition: transform .8s var(--ease); transition-delay: var(--d); }
.chart .bar.on { transform: scaleY(1); }
.chart .et-line { fill: none; stroke: var(--et); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; transition: stroke-dashoffset 2s var(--ease); }
.chart .et-line.on { stroke-dashoffset: 0 !important; }
.chart .et-dots circle { fill: var(--et); stroke: var(--surface); stroke-width: 2.5; }
.chart .et-dots { transition-delay: 1.4s; }
.chart .thirst-band { fill: #fde7dc; }
.chart .thirst-label { font-size: 17px; font-weight: 700; fill: #b0441a; text-anchor: middle; }
.chart-legend { display: flex; gap: 1.4rem; font-size: .95rem; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend .step { transform: none; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---------- 3 cambio ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; width: 100%; max-width: 860px; }
.stat { background: var(--page); border-radius: 18px; padding: 1.4rem 1.6rem; text-align: center; }
.stat .icon { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.stat.on .icon { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.stat-label { color: var(--text-2); margin: .3rem 0 .6rem; }
.stat-row { display: flex; align-items: baseline; justify-content: center; gap: .5rem; font-variant-numeric: tabular-nums; }
.stat .old { color: var(--muted); font-size: clamp(1rem, 2vw, 1.4rem); text-decoration: line-through; }
.stat .arrow { color: var(--muted); }
.stat .new { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; }
.stat .unit { color: var(--text-2); }
.delta { display: inline-block; margin-top: .5rem; padding: .2rem .7rem; border-radius: 999px; font-weight: 700; }
.delta.down { background: #fde7dc; color: #b0441a; }
.delta.up { background: var(--accent-soft); color: var(--accent); }
.period { color: var(--muted); font-size: .85rem; margin-top: .4rem; }

/* ---------- anillo ---------- */
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center; width: 100%; height: 100%; }
.vis { height: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
.ring-svg { width: 100%; max-height: 100%; overflow: visible; }
.ring .seg { opacity: 0; transform-box: view-box; transform-origin: 200px 200px; transform: scale(.85) rotate(-20deg);
  transition: opacity .5s var(--ease), transform .7s var(--ease); transition-delay: var(--d); }
.ring .seg.on { opacity: 1; transform: none; }
.ring .seg.bare.pulse { animation: pulse 1.6s ease-in-out 2; }
@keyframes pulse { 50% { filter: brightness(.82); } }
.seg-label { font-size: 15px; font-weight: 700; fill: #fff; text-anchor: middle; pointer-events: none; }
.seg-label.dark { fill: #1d1d1b; }
.month-label { font-size: 15px; fill: var(--muted); text-anchor: middle; }
.ring-center { font-size: 26px; font-weight: 800; text-anchor: middle; fill: var(--text); }
.ring-center-sub { font-size: 15px; text-anchor: middle; fill: var(--muted); }
.rain-drops { opacity: 0; transition: opacity .6s; }
.rain-drops.on { opacity: 1; }
.drop { stroke: var(--rain); stroke-width: 3; stroke-linecap: round; animation: fall 1.1s linear infinite; }
@keyframes fall { from { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(46px); opacity: 0; } }
.side { display: flex; flex-direction: column; gap: 1.6rem; }
.big-fact { display: flex; flex-direction: column; }
.big-fact .num { font-size: clamp(3rem, 8vw, 5.5rem); font-weight: 800; line-height: 1; color: #8a6d3b; font-variant-numeric: tabular-nums; }
.big-fact .unit { font-size: clamp(1rem, 2vw, 1.4rem); color: var(--text-2); }

.meter { width: 100%; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .45rem; color: var(--text-2); }
.meter-head strong { color: var(--text); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.meter-track { position: relative; height: 18px; background: #ece8dd; border-radius: 9px; }
.meter-fill { height: 100%; width: 0; border-radius: 9px; transition: width 1.4s var(--ease); }
.meter-tol { position: absolute; top: -6px; bottom: -6px; width: 3px; background: var(--text); border-radius: 2px; }
.meter-tol span { position: absolute; top: 28px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .78rem; color: var(--text-2); }

/* ---------- 5 comparación ---------- */
.compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.2rem; align-items: start; width: 100%; max-width: 900px; }
.col { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.col .ring-svg.small { width: min(100%, 210px); }
.col-title { font-weight: 700; color: var(--text-2); font-size: 1.1rem; }
.col-title.accent { color: var(--accent); }
.vs { align-self: center; font-size: 2.4rem; color: var(--muted); margin-top: -3rem; }
.chips { margin-top: 2.2rem; }

/* ---------- 6 checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; width: 100%; max-width: 820px; }
.checklist li { display: flex; gap: 1rem; align-items: center; background: var(--page); border-radius: 14px; padding: .9rem 1.2rem;
  font-size: clamp(.95rem, 1.8vw, 1.25rem); transform: translateX(-24px); }
.checklist li.on { transform: none; }
.checklist .ic { font-size: 1.6rem; }
.checklist li.strong { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- 7 cierre ---------- */
.closing { display: flex; flex-direction: column; align-items: center; gap: 2rem; }
.hand { font-size: clamp(4rem, 12vw, 8rem); }
.hand.on { animation: shake 1.2s var(--ease) .4s; }
@keyframes shake { 30% { transform: rotate(-10deg) scale(1.08); } 60% { transform: rotate(8deg); } }
.close-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* ---------- subtítulos y controles ---------- */
.subs {
  margin-top: 1rem; background: var(--surface); border-radius: 16px; padding: 1rem 1.3rem; font-size: clamp(1rem, 1.9vw, 1.25rem);
  line-height: 1.55; max-height: 8.5em; overflow-y: auto; border: 1px solid var(--border);
}
.subs span { color: var(--muted); transition: color .3s; }
.subs span.done { color: var(--text-2); }
.subs span.now { color: var(--text); background: linear-gradient(transparent 62%, #fbe3a6 62%); }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .9rem; flex-wrap: wrap; }
.ctl-group { display: flex; align-items: center; gap: .5rem; }
.btn { border: 1px solid #cfcabd; background: var(--surface); color: var(--text); border-radius: 12px; padding: .55rem .95rem;
  font: inherit; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn.round { width: 3.2rem; height: 3.2rem; justify-content: center; border-radius: 50%; font-size: 1.2rem; padding: 0; }
.play .pause-ic { display: none; }
.is-playing .play .pause-ic { display: inline; }
.is-playing .play .play-ic { display: none; }
.dots { display: flex; gap: .4rem; }
.dots button { width: 11px; height: 11px; border-radius: 50%; border: 0; background: #d3cfc3; cursor: pointer; padding: 0; }
.dots button.active { background: var(--accent); width: 28px; border-radius: 6px; }
.opt { display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; color: var(--text-2); }
.opt select { font: inherit; font-size: .85rem; padding: .3rem; border-radius: 8px; border: 1px solid #cfcabd; background: var(--surface); max-width: 220px; }
.note { margin-top: 1rem; font-size: .82rem; color: var(--muted); text-align: center; }

/* portada para iniciar (el navegador exige un clic para hablar) */
.start {
  position: absolute; inset: 0; background: rgba(255,253,248,.92); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1rem; z-index: 5; text-align: center; padding: 1rem;
}
.start h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 2.2rem); }
.start p { margin: 0; color: var(--text-2); max-width: 520px; }
.start .btn.primary { font-size: 1.2rem; padding: .9rem 1.6rem; }

@media (max-width: 720px) {
  .stage { aspect-ratio: auto; min-height: 70vh; padding: 1.4rem; }
  .split, .stats { grid-template-columns: 1fr; }
}
.static *, .static *::before, .static *::after { animation: none !important; transition: none !important; }
.static .rain-drops { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .step { opacity: 1; transform: none; }
}

/* selector de estilo */
.styles { font-size: .88rem; color: var(--muted); }
.styles a { color: var(--text-2); text-decoration: none; padding: .1rem .4rem; border-radius: 6px; }
.styles a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }


/* ---------- diagnóstico: lo bueno y lo flojo ---------- */
.diag { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; width: 100%; max-width: 860px; }
.diag li { display: flex; gap: .9rem; align-items: flex-start; background: var(--page); border-radius: 14px; padding: .7rem 1rem;
  border-left: 6px solid #c9c6bb; font-size: clamp(.82rem, 1.5vw, 1rem); }
.diag li.lvl-fuerte { border-left-color: #2e7d32; }
.diag li.lvl-flojo { border-left-color: #b0441a; }
.diag li.lvl-medio { border-left-color: #d9a400; }
.diag .ic { font-size: 1.4rem; line-height: 1.3; }
.diag li > div { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.diag small { font-weight: 600; color: var(--text-2); margin-left: .35rem; }
.diag .why { color: var(--text-2); }
.diag em { font-style: normal; color: var(--accent); font-weight: 600; }
