/* Estilo compartido del curso: una pantalla por paso, botón grande abajo al alcance del pulgar.
   Mismos colores que la landing. Reglas de claridad: nada se mueve solo, todo arranca con un toque. */
[hidden] { display: none !important; }
:root {
  --bg: #f6f7f4; --surface: #ffffff; --ink: #16302b; --muted: #4d625d; --line: #d7dfdb;
  --teal: #1f6f63; --teal-soft: #e2efec; --marker: #ffe45c; --marker-band: #ffe45c;
  --screen: #16302b; --screen-glow: #7fe3cf; --ok: #1f6f63; --ok-soft: #e2efec; --no: #b4462f; --no-soft: #fbe9e4;
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Verdana", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1b19; --surface: #162624; --ink: #e8f1ee; --muted: #a9bdb7; --line: #2a3d3a;
    --teal: #6fd0bd; --teal-soft: #1d3632; --marker: #f2d64b; --marker-band: rgba(242,214,75,.45);
    --screen: #0a1412; --ok: #6fd0bd; --ok-soft: #1d3632; --no: #f0957f; --no-soft: #3a211b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1.125rem; line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 800; }
p { margin: 0; }
button { font-family: inherit; }
.mark { background: linear-gradient(transparent 70%, var(--marker-band) 70%, var(--marker-band) 95%, transparent 95%); }
.muted { color: var(--muted); }
.center { text-align: center; }

.app {
  max-width: 520px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0) max(18px, env(safe-area-inset-right, 0)) 0 max(18px, env(safe-area-inset-left, 0));
}

/* Barra de arriba */
.top { display: flex; align-items: center; gap: 14px; padding: 14px 0 10px; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; flex: none; text-decoration: none; display: grid; place-items: center; }
.back { flex: none; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 6px 12px; font: 700 .95rem var(--font-body); cursor: pointer; }
.back[hidden] { display: none; }
.bar { flex: 1; height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--teal); border-radius: 99px; transition: width .4s ease; }
.day { font-weight: 700; font-size: .9rem; color: var(--muted); white-space: nowrap; }

/* Pasos */
.step { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 10px 0 0; animation: in .35s ease; }
@keyframes in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.grow { flex: 1; }
.eyebrow { font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); }
.head { display: grid; gap: 6px; }

/* Iri */
.iri { width: 150px; height: auto; display: block; }
.iri.small { width: 60px; flex: none; }
.iri .blink { animation: blink 5s infinite; transform-origin: center 96px; }
/* Reacciones de Iri: se disparan una vez por una acción de la persona */
.iri.saluda { transform-origin: 50% 90%; animation: saluda 1.3s ease .3s 1; }
@keyframes saluda { 0%,100% { rotate: 0deg; } 20% { rotate: -9deg; } 40% { rotate: 9deg; } 60% { rotate: -6deg; } 80% { rotate: 3deg; } }
.iri.habla { animation: habla .5s ease 1; }
@keyframes habla { 0% { scale: .8; opacity: 0; } 70% { scale: 1.08; opacity: 1; } 100% { scale: 1; } }
.iri.salta { animation: salta .8s cubic-bezier(.3,1.6,.5,1) 1; }
@keyframes salta { 0%,100% { translate: 0 0; } 30% { translate: 0 -14px; } 55% { translate: 0 0; } 70% { translate: 0 -5px; } }
.iri.duda { transform-origin: 50% 90%; animation: duda 1.2s ease 1; }
@keyframes duda { 0%,100% { rotate: 0deg; } 25%,70% { rotate: 12deg; } }
.iri.festeja { transform-origin: 50% 90%; animation: festeja 1.4s ease .2s 2; }
@keyframes festeja { 0%,100% { translate: 0 0; rotate: 0deg; } 20% { translate: 0 -18px; rotate: -8deg; } 40% { translate: 0 0; rotate: 0deg; } 60% { translate: 0 -12px; rotate: 8deg; } 80% { translate: 0 0; rotate: 0deg; } }
.feedback.con-iri { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; }
.feedback.con-iri .iri.small { width: 52px; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.says { display: flex; gap: 12px; align-items: flex-start; }
.says .spacer { width: 60px; flex: none; }
.bubble {
  background: var(--surface); border: 3px solid var(--ink); border-radius: 20px; padding: 14px 16px;
  box-shadow: 4px 4px 0 var(--ink); flex: 1;
}
.hello { display: grid; justify-items: center; gap: 16px; text-align: center; padding-top: 8px; }
.tag { font-size: .85rem; color: var(--muted); }

/* Botones */
.cta-zone { position: sticky; bottom: 0; display: grid; gap: 10px; padding: 16px 0 max(18px, env(safe-area-inset-bottom, 0)); background: linear-gradient(transparent, var(--bg) 26%); }
.btn {
  width: 100%; min-height: 56px; border-radius: 16px; border: 3px solid var(--ink);
  background: var(--teal); color: #fff; font: 800 1.12rem var(--font-display);
  box-shadow: 0 5px 0 var(--ink); cursor: pointer; transition: transform .08s, box-shadow .08s;
  padding: 10px 16px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
@media (prefers-color-scheme: dark) { .btn { color: #0f1b19; } }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn[disabled] { background: var(--line); color: var(--muted); cursor: default; box-shadow: 0 5px 0 var(--line); border-color: var(--line); }
.btn.light { background: var(--surface); color: var(--ink); }
.btn.yellow { background: var(--marker); color: #16302b; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 1rem; padding: 6px; cursor: pointer; }
.choice { display: grid; gap: 12px; }
.choice .btn { justify-content: flex-start; text-align: left; padding: 14px 18px; background: var(--surface); color: var(--ink); flex-direction: column; align-items: flex-start; }
.choice .btn small { display: block; font: 400 .95rem var(--font-body); color: var(--muted); margin-top: 2px; }
.choice .btn.picked { background: var(--teal-soft); border-color: var(--teal); }

/* Tarjetas */
.card { background: var(--surface); border: 3px solid var(--ink); border-radius: 20px; padding: 20px 18px; box-shadow: 4px 4px 0 var(--ink); }
.card .big { font: 800 1.3rem var(--font-display); line-height: 1.25; }
.count { font-size: .85rem; color: var(--muted); font-weight: 700; }
.emoji { font-size: 3.2rem; line-height: 1; }

/* Demo: el chat con reloj */
.demo { background: var(--surface); border: 3px solid var(--ink); border-radius: 22px; overflow: hidden; }
.demo-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--screen); color: var(--screen-glow); font-weight: 700; font-size: .9rem; }
.clock { font: 800 1.4rem var(--font-display); font-variant-numeric: tabular-nums; color: var(--marker); }
.chat { padding: 14px; display: grid; gap: 10px; }
.msg { padding: 10px 13px; border-radius: 16px; font-size: .98rem; white-space: pre-wrap; }
.msg.me { background: var(--teal-soft); justify-self: end; border-bottom-right-radius: 4px; max-width: 92%; }
.msg.ai { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; min-height: 2.2em; }
.msg.note { background: var(--marker); color: #16302b; font-weight: 700; text-align: center; justify-self: center; }
.msg .who { display: block; font-weight: 700; font-size: .78rem; color: var(--muted); margin-bottom: 2px; white-space: normal; }
.msg.voice .who::before { content: "🎙️ "; }
.caret::after { content: "▍"; animation: caret 1s steps(1) infinite; color: var(--teal); }
@keyframes caret { 50% { opacity: 0; } }
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: center; }
.versus div { border: 3px solid var(--ink); border-radius: 16px; padding: 10px; background: var(--surface); }
.versus b { display: block; font: 800 1.5rem var(--font-display); }
.versus .before b { color: var(--no); text-decoration: line-through; text-decoration-thickness: 3px; }
.versus .after { background: var(--marker); color: #16302b; }
.fine { font-size: .85rem; color: var(--muted); text-align: center; }
.tip { border: 2px dashed var(--teal); background: var(--teal-soft); border-radius: 16px; padding: 14px 16px; }

/* Juego */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.options.three { grid-template-columns: 1fr; }
.options .btn { background: var(--surface); color: var(--ink); font-size: 1.05rem; }
.options .btn.right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.options .btn.wrong { background: var(--no-soft); border-color: var(--no); color: var(--no); }
.options .btn[disabled].right, .options .btn[disabled].wrong { box-shadow: none; }
.feedback { border-radius: 16px; padding: 14px 16px; font-weight: 700; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); border: 2px solid var(--ok); }
.feedback.no { background: var(--no-soft); color: var(--no); border: 2px solid var(--no); }
.feedback span { display: block; font-weight: 400; color: var(--ink); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { border: 2px solid var(--ink); border-radius: 99px; padding: 6px 14px; background: var(--surface); font-weight: 700; font-size: .95rem; color: var(--ink); cursor: pointer; }
.chip.on { background: var(--marker); color: #16302b; }

/* Etiquetas que muestran las opciones de un juego (no se tocan) */
.pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pill { background: var(--teal-soft); color: var(--ink); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: .95rem; }

/* Predicción (día 3) */
.predict { display: grid; gap: 8px; }
.pbar { display: grid; grid-template-columns: 5.5em 1fr 3em; gap: 10px; align-items: center; font-weight: 700; }
.pbar i { display: block; height: 18px; border-radius: 99px; background: var(--teal); width: 0; transition: width .8s ease; }
.pbar.mine i { background: var(--marker); }

/* Explicación en dos columnas */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split div { border-radius: 16px; padding: 12px; border: 2px solid var(--line); background: var(--surface); }
.split h3 { margin: 0 0 6px; font-size: 1rem; }
.split ul { margin: 0; padding-left: 18px; font-size: .95rem; }

/* Práctica */
.pedido { background: var(--surface); border: 3px solid var(--ink); border-radius: 18px; padding: 14px 16px; white-space: pre-wrap; font-size: 1rem; }
.pedido .blank { background: var(--marker); color: #16302b; border-radius: 6px; padding: 0 4px; font-weight: 700; }
.pedido .blank.empty { background: transparent; border: 2px dashed var(--muted); color: var(--muted); font-weight: 400; }
.howto { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: n; }
.howto li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; counter-increment: n; }
.howto li::before { content: counter(n); width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.howto .btn { min-height: 48px; font-size: 1rem; margin-top: 6px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; }
.field textarea, .field input {
  width: 100%; border: 3px solid var(--ink); border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 1rem;
  background: var(--surface); color: var(--ink); resize: vertical;
}
.field textarea:focus, .field input:focus { outline: 3px solid var(--marker); outline-offset: 2px; }
.ia-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.ia-pick .btn { min-height: 48px; font-size: .95rem; padding: 6px; background: var(--surface); color: var(--ink); }
.quote { border-left: 6px solid var(--marker); padding: 10px 14px; background: var(--surface); border-radius: 0 14px 14px 0; font-size: 1.1rem; font-style: italic; }

/* Checklist */
.checks { display: grid; gap: 12px; }
.check { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; text-align: left; background: var(--surface); border: 3px solid var(--ink); border-radius: 18px; padding: 14px; cursor: pointer; color: var(--ink); font: inherit; }
.check .box { width: 40px; height: 40px; border-radius: 12px; border: 3px solid var(--ink); display: grid; place-items: center; font-size: 1.3rem; }
.check.done { background: var(--teal-soft); border-color: var(--teal); }
.check.done .box { background: var(--teal); border-color: var(--teal); color: #fff; }
.check b { display: block; }
.check small { color: var(--muted); font-size: .95rem; }

/* Frases mágicas */
.phrases { display: grid; gap: 10px; }
.phrase { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 3px solid var(--ink); border-radius: 16px; padding: 12px 14px; font-weight: 700; cursor: pointer; color: var(--ink); font-size: 1rem; text-align: left; }
.phrase span { font-size: .85rem; color: var(--teal); white-space: nowrap; }

/* Logro */
.win { text-align: center; display: grid; justify-items: center; gap: 16px; padding-top: 8px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.stat { border: 3px solid var(--ink); border-radius: 16px; padding: 12px; background: var(--surface); }
.stat b { display: block; font: 800 1.8rem var(--font-display); }
.stat.fire { background: var(--marker); color: #16302b; }
.days { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.days i, .days a { width: 31px; height: 31px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: .9rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.days i.done, .days a.done { background: var(--teal); border-color: var(--teal); color: #fff; }
@media (prefers-color-scheme: dark) { .days a.done { color: #0f1b19; } }
.days a:active { transform: scale(.92); }
.daybtn { border: 2px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 10px; cursor: pointer; font-family: var(--font-body); }
.mapa { display: grid; gap: 8px; max-height: 50dvh; overflow-y: auto; }
.mapa-item { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; border: 2px solid var(--line); color: var(--ink); text-decoration: none; font-size: .98rem; }
.mapa-item .dot { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 800; }
.mapa-item.done .dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.mapa-item.actual { border-color: var(--teal); background: var(--teal-soft); }
.mapa-item small { color: var(--teal); font-weight: 700; }
.mapa-item.cerrado { opacity: .6; cursor: default; }
.mapa-item.cerrado .dot { border-color: var(--line); }
.mapa-item small.muted { color: var(--muted); font-weight: 400; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Certificado */
.cert canvas { width: 100%; height: auto; border-radius: 12px; border: 3px solid var(--ink); }

/* Hoja inferior (instalar) y aviso */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: flex-end; z-index: 10; }
.sheet.on { display: flex; }
.sheet > div { background: var(--surface); width: 100%; max-width: 520px; margin: 0 auto; border-radius: 24px 24px 0 0; padding: 22px 20px max(22px, env(safe-area-inset-bottom, 0)); display: grid; gap: 12px; }
.sheet ol { margin: 0; padding-left: 22px; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 700; z-index: 20; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; }

/* Inicio: el camino de 10 días */
.path { display: grid; gap: 14px; padding: 8px 0 24px; }
.node { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; text-align: left; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; font: inherit; text-decoration: none; }
.node:nth-child(4n+2) { margin-left: 34px; } .node:nth-child(4n+3) { margin-left: 56px; } .node:nth-child(4n) { margin-left: 34px; }
.node .dot { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font: 800 1.4rem var(--font-display); background: var(--surface); box-shadow: 0 5px 0 var(--ink); }
.node.done .dot { background: var(--teal); color: #fff; }
.node.now .dot { background: var(--marker); color: #16302b; animation: pulse 2s infinite; }
.node.locked { opacity: .7; }
.node.locked .dot { box-shadow: 0 5px 0 var(--line); border-color: var(--line); color: var(--muted); }
.node b { display: block; font-family: var(--font-display); font-size: 1.05rem; line-height: 1.2; }
.node small { color: var(--muted); font-size: .9rem; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg .btn { min-height: 46px; font-size: .95rem; background: var(--surface); color: var(--ink); }
.seg .btn.on { background: var(--teal-soft); border-color: var(--teal); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Nivel 2: calculadora y kit de recetas */
.iri { overflow: visible; }
.calc { display: grid; gap: 14px; }
.calc-fila { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 8px; }

/* Tablet y computadora: letra más grande y columna un poco más ancha (muchas personas grandes usan pantallas grandes porque ven mejor) */
@media (min-width: 760px) {
  html { font-size: 118%; }
  .app, .sheet > div { max-width: 620px; }
}
