/* Chaski, versión juego. Dirección visual: textil andino de día, con el paisaje a pantalla completa.
   Tokens de color y tipografía arriba; después, la estructura y los componentes por escena. */
:root {
  --ink: #3A2412; --ink2: #6B4A2E; --cream: #FFF4DA; --cream2: #F6E4B6;
  --magenta: #C2185B; --turq: #0E8396; --turqd: #0B5A69; --ochre: #E8A12B; --sun: #FFC83D; --terra: #B5602A;
  --stone: #D5C9AE; --stone-d: #8E8165; --clay: #E4B27C; --clay-d: #8C5A2E;
  --shadow: rgba(58, 36, 18, .38);
  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --hand: "Patrick Hand", "Segoe Print", "Comic Sans MS", cursive;
  /* Franja tejida que decora el borde de los paneles. */
  --zig: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='12' viewBox='0 0 28 12'><rect width='28' height='12' fill='%230B5A69'/><path d='M0 12 L7 2 L14 12 L21 2 L28 12' fill='none' stroke='%23FFC83D' stroke-width='3'/><path d='M0 6 L7 -4 L14 6 L21 -4 L28 6' fill='none' stroke='%23C2185B' stroke-width='2'/></svg>");
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #7FD0EC; color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--turqd); outline-offset: 2px; border-radius: 8px; }

/* El paisaje cubre toda la ventana; el contenido va encima, centrado. */
.world { position: fixed; inset: 0; z-index: 0; }
.world svg { width: 100%; height: 100%; display: block; }
#app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 1120px; margin: 0 auto;
  padding: 14px max(clamp(14px, 3vw, 36px), env(safe-area-inset-right, 0px)) max(22px, env(safe-area-inset-bottom, 0px)) max(clamp(14px, 3vw, 36px), env(safe-area-inset-left, 0px)); }
.spacer { flex: 1; }
.center { display: flex; justify-content: center; }

/* Encabezado */
.hud { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: var(--cream); border: 3px solid var(--ink); border-radius: 99px; padding: 3px 14px; font: 800 .92rem var(--display); color: var(--ink); white-space: nowrap; box-shadow: 0 3px 0 var(--shadow); }
.knots { display: inline-flex; gap: 5px; }
.knots i { width: 12px; height: 12px; border-radius: 50%; background: var(--cream2); border: 2px solid var(--ink); }
.knots i.on { background: var(--magenta); }

/* Estructura: una columna en el celular; en pantallas anchas, Chaski a la izquierda y la tarea a la derecha,
   todo el bloque centrado en la pantalla. */
.cols { flex: 1; display: grid; gap: 14px; align-content: center; max-width: 620px; width: 100%; margin-inline: auto; }
.hero-col { display: flex; align-items: flex-end; gap: 10px; min-width: 0; }
.panel-col { display: grid; gap: 12px; align-content: center; min-width: 0; }
.hero-col .chsvg { flex: none; width: var(--chw, 110px); height: auto; }
.duo { display: flex; align-items: flex-end; gap: 10px; }
.duo .hut { display: none; }
@media (min-width: 880px) {
  .cols { max-width: none; grid-template-columns: minmax(300px, 1fr) minmax(430px, 560px); gap: clamp(20px, 4vw, 56px); align-items: center; }
  .hero-col { flex-direction: column; justify-content: center; align-items: center; gap: 14px; }
  .hero-col .chsvg { --chw: clamp(150px, 40vh, 270px); filter: drop-shadow(0 8px 0 rgba(58, 36, 18, .22)); }
  .hero-col > .hint, .hero-col > .bubble { order: -1; }
  .duo .hut { display: block; }
  .cols.tall { align-items: start; }
  .cols.tall .hero-col { position: sticky; top: 16px; justify-content: flex-start; }
}
.cols.solo { grid-template-columns: 1fr; max-width: 560px; }

/* Botones */
.gbtn { border: 0; border-radius: 16px; padding: 12px 16px; font: 800 1.08rem var(--display); min-height: 52px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  box-shadow: 0 5px 0 var(--shadow); transition: transform .06s, box-shadow .06s; }
.gbtn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--shadow); }
.gbtn:disabled { background: #DCCBB8; color: #7A6552; box-shadow: 0 3px 0 rgba(58, 36, 18, .25); cursor: not-allowed; }
.gbtn.go, .gbtn.stop { background: var(--magenta); color: #fff; }
.gbtn.pass { background: var(--turq); color: #fff; }
.gbtn.ghost { background: var(--cream); color: var(--ink); border: 3px solid var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack { display: grid; gap: 10px; }
svg.ic { width: 22px; height: 22px; flex: none; }

/* Chaski */
.chsvg { display: block; overflow: visible; }
.bob { animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.nod { animation: nod .6s ease-in-out 1; }
@keyframes nod { 30% { transform: translateY(6px) rotate(-2deg); } 60% { transform: translateY(-3px); } }
.runout { animation: none; transition: transform .8s cubic-bezier(.5, 0, .9, .6); transform: translateX(160%); }
.bubble { position: relative; background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; padding: 10px 14px; font-weight: 600; font-size: .98rem; display: grid; gap: 6px; box-shadow: 0 4px 0 var(--shadow); max-width: 340px; }
.hero-col > .bubble { flex: 1; margin-bottom: 40px; }
.hero-col > .bubble::before { content: ""; position: absolute; left: -14px; bottom: 16px; border: 8px solid transparent; border-right-color: var(--ink); border-left: 0; }
@media (min-width: 880px) {
  .hero-col > .bubble { flex: none; margin: 0 0 4px; }
  .hero-col > .bubble::before { left: 50%; bottom: -14px; border: 8px solid transparent; border-top-color: var(--ink); border-bottom: 0; transform: translateX(-50%); }
}
.hint { font: 1.15rem/1.15 var(--hand); color: #3A2B12; background: rgba(255, 244, 218, .92); border: 2px dashed var(--terra); border-radius: 12px; padding: 6px 10px; }
.hero-col > .hint { flex: 1; margin-bottom: 30px; max-width: 340px; }
@media (min-width: 880px) { .hero-col > .hint { flex: none; margin: 0; } }

/* Paneles de tela */
.card { position: relative; background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; padding: 22px 16px 16px; display: grid; gap: 10px; box-shadow: 0 5px 0 var(--shadow); }
.card::before { content: ""; position: absolute; left: 10px; right: 10px; top: -3px; height: 12px; background: var(--zig) repeat-x; border-radius: 0 0 8px 8px; }
.kicker { font: 800 .76rem var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--terra); }
.small { font-size: .86rem; color: var(--ink2); }
.msgerr { color: #B3260A; font-size: .92rem; font-weight: 700; min-height: 1.2em; }
label { font-weight: 700; font-size: .92rem; color: var(--ink); }
.inp { width: 100%; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 10px 12px; font-size: 1.05rem; color: var(--ink); }
.inp:focus { border-color: var(--magenta); outline: none; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-weight: 400; font-size: .88rem; color: var(--ink2); }
.check input { width: 22px; height: 22px; accent-color: var(--magenta); margin: 0; }
.footlinks { text-align: center; font-size: .82rem; font-weight: 700; color: var(--ink); background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; padding: 5px 10px; box-shadow: 0 3px 0 var(--shadow); }
.footlinks a { color: var(--ink); }
.card .small a { color: var(--turqd); font-weight: 700; }
.ask { background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 14px; font-weight: 700; box-shadow: 0 4px 0 var(--shadow); }

/* Bienvenida */
.brandrow { display: grid; gap: 6px; justify-items: start; }
.tag { background: var(--magenta); color: #fff; font: 800 .8rem var(--display); letter-spacing: .08em; text-transform: uppercase; padding: 3px 12px; border-radius: 99px; border: 3px solid var(--ink); }
.logo { font: 800 clamp(3.6rem, 8vw, 5.4rem)/1 var(--display); color: var(--cream); -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--shadow); margin: 0; }

/* Enseñar: placa de indicación, tablilla de arcilla y cuerda de nudos.
   La indicación es lo primero que se debe leer: placa oscura con letras claras, la de más contraste de la pantalla. */
.plaque { position: relative; background: linear-gradient(#5E3D24, #3A2412); border: 4px solid #24140A; border-radius: 16px; padding: 18px 22px 20px; box-shadow: inset 0 0 0 3px rgba(255, 244, 218, .16), 0 7px 0 var(--shadow); color: var(--cream); text-align: center; }
.plaque::before, .plaque::after { content: ""; position: absolute; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: #C9A66B; }
.plaque::before { left: 9px; } .plaque::after { right: 9px; }
.plaque .kicker { color: var(--sun); font-size: .82rem; }
.plaque .q { font: 800 clamp(1.4rem, 2.8vw, 1.85rem)/1.16 var(--display); margin: 4px 0 0; color: var(--cream); text-wrap: balance; }
.tablet { position: relative; background: linear-gradient(#EBC196, var(--clay)); border: 4px solid var(--clay-d); border-radius: 22px; padding: 14px 12px 10px; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25), 0 6px 0 var(--shadow); }
.tablet label { position: absolute; top: -13px; left: 16px; background: var(--turqd); color: var(--cream); font: 800 .74rem var(--display); letter-spacing: .09em; text-transform: uppercase; padding: 2px 10px; border-radius: 99px; }
.tablet textarea { display: block; width: 100%; height: 136px; resize: none; border: 0; outline: none; background: repeating-linear-gradient(transparent 0 31px, rgba(110, 70, 30, .28) 31px 32px); font: 1.4rem/32px var(--hand); color: #4A2E14; padding: 2px 6px; }
.tablet textarea::placeholder { color: rgba(74, 46, 20, .55); }
.tablet .foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: .78rem; color: #5A3A17; padding: 2px 4px 0; }
.fly { position: fixed; z-index: 50; max-width: 170px; background: var(--cream); border: 3px solid var(--ink); border-radius: 10px; padding: 4px 8px; font: 1rem/1.1 var(--hand); color: var(--ink); pointer-events: none; }
.cordwrap { position: relative; }
.cordbar { display: flex; align-items: center; position: relative; padding: 4px 6px; background: var(--cream); border: 3px solid var(--ink); border-radius: 99px; box-shadow: 0 3px 0 var(--shadow); overflow: hidden; }
.cordbar::before { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 4px; background: linear-gradient(#C9A66B, #8C6A3B); border-radius: 3px; transform: translateY(-50%); }
.cordbar .lbl { position: relative; font: 800 .8rem var(--display); color: var(--ink); padding: 0 8px 0 6px; background: var(--cream); white-space: nowrap; }
.k { position: relative; flex: none; width: 26px; height: 26px; margin: 0 8px; border-radius: 50%; border: 3px dashed #A58A5A; background: var(--cream); padding: 0; cursor: default; }
.k.on { border: 3px solid var(--ink); background: radial-gradient(circle at 35% 35%, #FF6FA3, var(--magenta)); box-shadow: 0 0 0 3px var(--cream); cursor: pointer; }
.k.on::after { content: ""; position: absolute; inset: 5px; border: 2px dotted rgba(255, 255, 255, .75); border-radius: 50%; }
.pop { position: absolute; z-index: 6; left: 0; right: 0; bottom: calc(100% + 10px); background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; padding: 10px 12px; font: 1.1rem/1.25 var(--hand); color: var(--ink); box-shadow: 0 6px 0 var(--shadow); overflow-wrap: anywhere; }
.pop small { display: block; font: 800 .72rem var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--terra); margin-bottom: 2px; }
.pop[hidden] { display: none; }

/* El cerebro: nube de pensamiento y tablillas colgadas */
.thought { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 26px; padding: 14px 16px; font-weight: 600; color: var(--ink); box-shadow: 0 5px 0 var(--shadow); }
.thought .kicker { display: block; margin-bottom: 4px; }
.beam { height: 16px; border-radius: 8px; background: linear-gradient(#A8713C, #7A4D26); border: 3px solid #4A2E14; margin: 8px 6px 0; }
.hang { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 6px; }
.hang .f { position: relative; padding-top: 22px; text-align: center; }
.hang .f::before { content: ""; position: absolute; left: 50%; top: 0; width: 3px; height: 24px; background: #7A4D26; transform: translateX(-50%); }
.hang .tab { border-radius: 14px; background: linear-gradient(#D9D2C4, #B9B0A0); border: 3px solid #7C7364; padding: 12px 6px 10px; font: 800 .82rem/1.1 var(--display); color: #5B5446; min-height: 76px; display: grid; place-items: center; gap: 4px; }
.hang .on .tab { background: linear-gradient(#FFE08A, var(--sun)); border-color: var(--terra); color: #4A2E14; box-shadow: 0 0 0 4px rgba(255, 200, 61, .45), 0 0 18px rgba(255, 200, 61, .9); }
.hang .dot { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #7C7364; background: #CFC8B8; }
.hang .on .dot { background: var(--magenta); border-color: var(--ink); }
.legend { margin: 0; background: var(--cream); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 10px; text-align: center; font-size: .82rem; font-weight: 700; color: var(--ink); box-shadow: 0 3px 0 var(--shadow); }
.think { display: flex; gap: 6px; justify-content: center; padding: 14px 0; }
.think i { width: 12px; height: 12px; border-radius: 50%; background: var(--magenta); animation: dots 1s ease-in-out infinite; }
.think i:nth-child(2) { animation-delay: .15s; } .think i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* Camino */
.mapcard { background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--shadow); padding: 6px; height: min(64vh, 560px); display: flex; }
.mapcard svg { width: 100%; height: 100%; }
.node text { font: 800 20px var(--display); fill: var(--ink); text-anchor: middle; }
.node.lock text { fill: #8E8165; }
.pulse { animation: pulse 1.6s ease-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }

/* Revisar */
.board { background: linear-gradient(#A8713C, #7A4D26); border: 4px solid #4A2E14; border-radius: 12px; padding: 10px 14px; color: var(--cream); font: 800 1.1rem/1.25 var(--display); box-shadow: 0 5px 0 var(--shadow); }
.quipu { position: relative; display: grid; gap: 8px; padding-left: 38px; }
.quipu::before { content: ""; position: absolute; left: 13px; top: -6px; bottom: -6px; width: 5px; border-radius: 3px; background: linear-gradient(#C9A66B, #8C6A3B); }
.step { position: relative; background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 12px; font-weight: 600; color: var(--ink); text-align: left; width: 100%; box-shadow: 0 3px 0 var(--shadow); }
.step::before { content: attr(data-n); position: absolute; left: -37px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--sun); border: 3px solid var(--ink); font: 800 .85rem var(--display); display: grid; place-items: center; color: var(--ink); }
.step.hot { cursor: pointer; border-color: var(--magenta); animation: glow 1.4s ease-in-out infinite; }
.step.hot:hover { background: var(--cream2); }
.step.sel { background: var(--sun); animation: none; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px rgba(194, 24, 91, .3); } }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--cream); font: 800 .95rem var(--display); padding: 8px 16px; border-radius: 99px; opacity: 0; transition: .25s; pointer-events: none; z-index: 5; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Teclado de piedra */
.slot { background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 16px; text-align: right; font: 800 2.4rem/1.1 var(--display); min-height: 66px; color: var(--magenta); box-shadow: 0 4px 0 var(--shadow); }
.slot small { display: block; text-align: left; font: 700 .75rem system-ui; color: var(--ink2); letter-spacing: .08em; text-transform: uppercase; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.key { background: linear-gradient(#E6DBC3, var(--stone)); border: 3px solid var(--stone-d); border-radius: 14px; min-height: 54px; font: 800 1.5rem var(--display); color: #2F2616; box-shadow: 0 5px 0 var(--shadow); }
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--shadow); }
.key.sm { font-size: 1.1rem; color: #5B5446; }

/* Rendición y cierre */
.sellos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; padding: 10px 6px 8px; box-shadow: 0 5px 0 var(--shadow); }
.sello { display: grid; gap: 4px; justify-items: center; font-size: .66rem; font-weight: 800; text-align: center; line-height: 1.1; color: var(--ink); }
.sello b { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font: 800 1.1rem var(--display); color: var(--ink); border: 4px solid var(--ink); box-shadow: 0 3px 0 var(--shadow), inset 0 0 0 3px var(--cream); }
.sello.hit b { background: #5BD08A; } .sello.miss b { background: #FF8A6B; } .sello.fa b { background: #7FD3F0; } .sello.okc b { background: var(--cream2); }
.parch { background: #F4E6C2; color: #3B2A14; border-radius: 6px; padding: 12px 14px; display: grid; gap: 7px; box-shadow: 0 4px 0 var(--shadow); border: 2px solid #CDB27A; }
.parch h3 { margin: 0; font: 800 1rem var(--display); color: var(--ink); }
.parch .ln { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed rgba(59, 42, 20, .4); padding-bottom: 5px; font-weight: 600; font-size: .93rem; }
.parch .ln em { font-style: normal; font-weight: 800; white-space: nowrap; }
.parch .ok em { color: #0E7A4A; }
.parch .bad { background: rgba(255, 107, 74, .22); border-radius: 4px; padding: 3px 5px; }
.parch .bad em { color: #B3260A; }
.parch .note { font-size: .8rem; font-weight: 700; color: #B3260A; }
.rulecard { background: var(--cream); border: 3px solid var(--ink); border-left: 10px solid var(--magenta); border-radius: 12px; padding: 9px 12px; font-size: .9rem; color: var(--ink); display: grid; gap: 3px; }
.rulecard strong { color: var(--magenta); }
.rulecard .why { font-weight: 700; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--cream2); border-radius: 14px; padding: 10px 12px; display: grid; gap: 2px; border: 2px solid rgba(58, 36, 18, .2); }
.stat span { color: var(--ink2); font-size: .85rem; }
.big { font: 800 2.2rem/1 var(--display); color: var(--magenta); }

/* Fondo animado */
.w-cl1 { animation: drift 38s ease-in-out infinite alternate; } .w-cl2 { animation: drift 52s ease-in-out infinite alternate-reverse; } .w-cl3 { animation: drift 70s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-26px); } to { transform: translateX(34px); } }
.w-condor { animation: glide 18s ease-in-out infinite alternate; transform-box: fill-box; }
@keyframes glide { from { transform: translate(180px, 290px) rotate(-4deg) scale(.9); } to { transform: translate(980px, 230px) rotate(5deg) scale(1.1); } }
.w-sway { animation: sway 3.4s ease-in-out infinite alternate; transform-origin: 50% 100%; transform-box: fill-box; }
@keyframes sway { from { transform: skewX(-2deg); } to { transform: skewX(2.5deg); } }

@media (prefers-reduced-motion: reduce) {
  .bob, .nod, .pulse, .step.hot, .think i, .w-cl1, .w-cl2, .w-cl3, .w-condor, .w-sway { animation: none; }
  .w-condor { transform: translate(560px, 260px); }
  .runout, .gbtn { transition: none; }
}
