/* [p1:id.visual] Igual que polku.cl, con el verde hoja solo para la racha y lo que se abre. */
:root {
  --ink: #111;
  --paper: #fafaf8;
  --muted: #6b6b66;
  --line: #dcdcd6;
  --soft: #f0f0eb;
  --hoja: #7cc576;
  --hoja-osc: #3f7d3a;
  --err: #a12020;
  --head: "Host Grotesk", system-ui, sans-serif;
  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--head); letter-spacing: -0.03em; line-height: 1.05; }
h1 { font-size: clamp(34px, 9vw, 48px); font-weight: 700; margin-bottom: 14px; }
h2 { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; }
p { color: #2b2b28; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

header.top { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 16px; }
.logo { font: 700 26px/1 var(--head); letter-spacing: -0.04em; color: var(--ink); text-decoration: none; }
.back { font: 600 15px var(--head); color: var(--ink); text-decoration: none; padding: 8px 0; }

section { padding: 8px 0 24px; }
.stack > * + * { margin-top: 14px; }

/* Formularios */
label.q { display: block; font: 600 15px var(--sans); margin-bottom: 10px; }
input[type=text], input[type=email], input[inputmode=numeric], textarea {
  width: 100%;
  font: inherit;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { outline: none; border-color: var(--ink); }
button, .btn {
  display: inline-block;
  font: 600 16px var(--head);
  padding: 13px 22px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
button:disabled { opacity: .45; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.link { background: none; color: var(--muted); padding: 8px 0; font: 400 15px var(--sans); text-decoration: underline; }
.full { width: 100%; }
.link-a { color: var(--muted); font-size: 15px; }
.msg { font-size: 15px; min-height: 1.4em; }
.msg.err { color: var(--err); }
.hint { font-size: 14px; color: var(--muted); margin-top: 8px; }

/* Opciones del onboarding */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font: 400 15px var(--sans);
}
.chips button:hover { border-color: var(--ink); }
.chips button[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips button.nose { border-style: dashed; color: var(--muted); }
.chips button.nose[aria-pressed=true] { color: #fff; border-style: solid; }
.steps { display: flex; gap: 4px; margin-bottom: 22px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--ink); }
.actions { display: flex; gap: 10px; margin-top: 24px; }
.actions > * { flex: 1; }

/* Kettu */
.kettu { display: flex; gap: 12px; align-items: flex-end; }
.kettu img { width: 54px; height: auto; flex: none; }
.bubble { background: var(--soft); border-radius: 18px 18px 18px 4px; padding: 12px 16px; }

/* Inicio */
.racha {
  display: flex; align-items: center; gap: 16px;
  background: var(--soft); border-radius: 22px; padding: 18px 20px;
}
.racha b { font: 700 52px/0.9 var(--head); letter-spacing: -0.05em; }
.racha.viva b { color: var(--hoja-osc); }
.racha .txt { flex: 1; }
.racha .txt strong { display: block; font: 600 17px var(--head); }
.racha img { width: 46px; }

.camino { list-style: none; padding: 0; }
.camino li { position: relative; padding-left: 34px; }
.camino li + li { margin-top: 10px; }
.camino li::before {
  content: ""; position: absolute; left: 8px; top: 18px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--line);
}
.camino li.hecha::before { background: var(--hoja); }
.camino li.abierta::before { background: var(--ink); box-shadow: 0 0 0 4px var(--hoja); }
.camino a, .camino span.c {
  display: block; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); text-decoration: none;
}
.camino li.abierta a { border-color: var(--ink); }
.camino li.bloqueada span.c { color: var(--muted); background: transparent; border-style: dashed; }
.camino small { display: block; color: var(--muted); font-size: 13px; }
.tag { font-size: 12px; background: #fff3c4; color: #6b5300; border-radius: 6px; padding: 1px 6px; margin-left: 6px; white-space: nowrap; }
.tag.tipo { background: var(--soft); color: var(--muted); }
.camino li.bloque { padding: 14px 0 2px; font: 600 13px var(--head); letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.camino li.bloque::before { display: none; }

.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu a, .menu button {
  display: block; text-align: left; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none;
  font: 600 15px var(--head);
}
.menu small { display: block; font: 400 13px var(--sans); color: var(--muted); margin-top: 2px; }
.menu .rendir { grid-column: 1 / -1; border-color: var(--line); background: var(--soft); }

/* Clase con tarjetas */
.card {
  min-height: 46vh; display: flex; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px;
  font: 600 22px/1.3 var(--head); letter-spacing: -0.015em;
}
.dots { display: flex; gap: 6px; justify-content: center; margin: 14px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--ink); }

/* Chats */
.chat { display: flex; flex-direction: column; gap: 10px; padding: 8px 0 16px; }
.m { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--soft); white-space: pre-wrap; }
.m.mine { align-self: flex-end; background: var(--ink); color: #fff; border-radius: 16px 16px 4px 16px; }
.m.other { border-radius: 16px 16px 16px 4px; }
.m .who { display: block; font: 600 13px var(--head); margin-bottom: 2px; }
.m.aviso { align-self: center; max-width: 100%; background: #e9f6e7; color: #234d20; font-size: 15px; text-align: center; }
.m .rep { background: none; border: 0; padding: 0; margin-left: 8px; font: 400 12px var(--sans); color: var(--muted); text-decoration: underline; }
.composer { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--paper); }
.composer textarea { min-height: 48px; height: 48px; }
.typing { color: var(--muted); font-size: 15px; }

/* Ánimo */
.video { aspect-ratio: 9 / 16; max-height: 60vh; width: 100%; border-radius: 18px; background: #111; color: #fff;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
video.video { object-fit: cover; padding: 0; }

.center { text-align: center; }
.celebra img { width: 120px; margin: 10px auto 16px; display: block; }

/* ---------- Camino como inicio, a la manera de Duolingo (v4, 26 oct). Ver reverse/camino-duolingo.md ---------- */
#app:has(.tabs) { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
#app:has(.tabs) .composer { bottom: calc(58px + env(safe-area-inset-bottom)); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; max-width: 180px; text-align: center; padding: 10px 0; border-radius: 12px;
  font: 600 15px var(--head); color: var(--muted); text-decoration: none;
}
.tabs a.on { color: var(--ink); background: var(--soft); }

.barra {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  display: flex; align-items: center; justify-content: space-between; padding: 16px 0 12px;
}
.racha-mini { font: 600 16px var(--head); color: var(--muted); }
.racha-mini b { font-size: 24px; letter-spacing: -0.03em; color: var(--ink); }
.racha-mini.viva b { color: var(--hoja-osc); }

.sendero { padding: 4px 0 24px; overflow-x: clip; }
.unidad {
  position: sticky; top: 62px; z-index: 4;
  background: var(--ink); color: #fff; border-radius: 16px; padding: 12px 18px; margin: 18px 0 22px;
}
.unidad small { display: block; font: 600 12px var(--head); letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
.unidad b { font: 700 20px/1.15 var(--head); letter-spacing: -0.02em; }

.nodo-fila { position: relative; display: flex; justify-content: center; transform: translateX(var(--x)); margin: 0 0 18px; }
.nodo {
  width: 64px; height: 64px; border-radius: 50%; padding: 0;
  font: 700 20px var(--head); color: var(--muted);
  background: #e7e7e1; border: 0; box-shadow: 0 5px 0 #cfcfc8;
}
.nodo.hecha { background: var(--hoja); color: #fff; box-shadow: 0 5px 0 var(--hoja-osc); font-size: 26px; }
.nodo.hoy { width: 76px; height: 76px; background: var(--ink); color: #fff; box-shadow: 0 6px 0 #000, 0 0 0 6px var(--paper), 0 0 0 10px var(--hoja); font-size: 24px; }
.nodo.manana { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line); border: 2px solid var(--ink); }
.nodo.saltada { background: transparent; border: 2px dashed var(--line); box-shadow: none; }
.nodo:active { transform: translateY(4px); box-shadow: none; }
.globo {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font: 700 13px var(--head); letter-spacing: .04em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 10px; white-space: nowrap;
}
.globo::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--ink); }
.globo.suave { background: var(--soft); color: var(--muted); }
.globo.suave::after { border-top-color: var(--soft); }
.nodo-fila:has(.globo) { margin-top: 44px; }

.pop {
  position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 12;
  max-width: 536px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 20px;
  padding: 18px 18px 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.pop small { color: var(--muted); font-size: 13px; }
.pop h3 { margin: 4px 0 6px; }
.pop .btn { margin-top: 10px; }
.pop .link { display: block; margin: 4px auto 0; }

.rendir-flot {
  position: fixed; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 9;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px;
  font: 600 14px var(--head); color: var(--ink); text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.08);
}
#app:has(.pop) .rendir-flot { display: none; }

/* ---------- v5 (26 oct): Kettu en el sendero, íconos por tipo e hito por bloque ---------- */
.nodo svg { display: block; margin: auto; }
.kettu-sendero { position: absolute; top: 50%; width: 74px; transform: translateY(-50%); pointer-events: none; }
.kettu-sendero.izq { right: calc(50% + 74px); }
.kettu-sendero.der { left: calc(50% + 74px); }
.kettu-sendero.lejos { opacity: .4; filter: grayscale(1); }
.nodo.hito { width: 70px; height: 70px; border-radius: 22px; background: #efe7c8; color: #8a7420; box-shadow: 0 5px 0 #d8cc9c; }
.nodo.hito.listo { background: #f3c94b; color: #5c4400; box-shadow: 0 5px 0 #c99a12; }
.celebra .bubble { text-align: left; }

/* ---------- v6 (26 oct): mentor que se gana y chat que parece chat ---------- */
.meta-mentor { height: 12px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.meta-mentor i { display: block; height: 100%; background: var(--hoja); border-radius: 6px; min-width: 12px; }
.chat-head {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 12px;
  margin: 0 -16px; padding: 12px 16px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.chat-head b { display: block; font: 600 17px var(--head); }
.chat-head small { color: var(--muted); font-size: 13px; }
.grupo-ico { width: 42px; height: 42px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; overflow: hidden; }
.grupo-ico img { width: 30px; }
.chat.wa { gap: 3px; margin: 0 -16px; padding: 12px 12px 16px; background: #efeee8; min-height: 60vh; }
.fila { display: flex; align-items: flex-end; gap: 6px; margin-top: 8px; }
.fila.seguido { margin-top: 0; }
.fila.mine { justify-content: flex-end; }
.ava { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 13px var(--head); }
.fila.seguido .ava { visibility: hidden; }
.kettu-ava { background: #fff; }
.kettu-ava img { width: 20px; }
.chat.wa .m { position: relative; max-width: 78%; padding: 7px 10px 6px; border-radius: 12px; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: 16px; line-height: 1.4; }
.chat.wa .m.other { background: #fff; border-radius: 4px 12px 12px 12px; }
.chat.wa .fila.seguido .m.other { border-radius: 12px; }
.chat.wa .m.mine { background: var(--ink); color: #fff; border-radius: 12px 4px 12px 12px; }
.chat.wa .fila.seguido .m.mine { border-radius: 12px; }
.chat.wa .m .who { font: 600 13px var(--head); margin-bottom: 1px; }
.chat.wa .m .t { float: right; margin: 8px 0 -4px 10px; font-size: 11px; opacity: .55; }
.chat.wa .m .rep { display: none; margin: 2px 0 0; padding: 0; background: none; border: 0; font: 400 11px var(--sans); color: var(--muted); text-decoration: none; opacity: .7; }
.chat.wa .m.aviso { align-self: center; max-width: 92%; margin: 8px auto; background: #e3f3e0; color: #234d20; font-size: 14px; text-align: center; box-shadow: none; }
.dia { align-self: center; margin: 10px auto 4px; padding: 4px 10px; border-radius: 8px; background: #fff; color: var(--muted); font-size: 12px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.composer.wa { margin: 0 -16px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: #efeee8; align-items: flex-end; }
.composer.wa textarea { min-height: 44px; height: 44px; border-radius: 22px; padding: 10px 16px; border: 0; }
.composer.wa button { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
#app:has(.composer.wa):not(:has(.tabs)) .composer.wa { bottom: 0; }
.chat.wa .m.sel .rep { display: block; }

/* ---------- v7 (27 oct): clase en tres pasos ---------- */
.pasos-clase { display: flex; gap: 6px; margin: 4px 0 18px; }
.pasos-clase span { flex: 1; text-align: center; padding: 7px 4px; border-radius: 10px; background: var(--soft); color: var(--muted); font: 600 12px var(--head); }
.pasos-clase span.on { background: var(--ink); color: #fff; }
.pasos-clase span.ok { background: var(--hoja); color: #fff; }
.card.consejo { flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px; }
.card.consejo small { font: 600 13px var(--head); color: var(--hoja-osc); letter-spacing: .02em; }
.chat.wa .m .ej { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.chip { align-self: flex-end; margin-top: 8px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: 600 14px var(--head); }
.nodo.bifurca { border-radius: 22px; background: #fff; color: var(--ink); border: 2px dashed var(--ink); box-shadow: none; }
.nodo.bifurca.hoy { border-style: solid; }

/* ---------- [p1:piloto] Botón de feedback (27 oct) ---------- */
.fb-btn {
  position: fixed; top: 14px; right: 14px; z-index: 20; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  background: #fff; color: var(--ink); border: 1px solid var(--line); font: 700 16px var(--head); box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
@media (min-width: 600px) { .fb-btn { right: calc(50% - 280px + 14px); } }
header.top, .barra, .chat-head { padding-right: 48px; }
.fb-sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.25); }
.fb-sheet .pop { bottom: 16px; }
.fb-sheet textarea { margin-top: 10px; min-height: 100px; }
