/* BiakFit · web
   Concepto: la página es el mapa del Viaje de Draki. Un sendero central baja por
   cinco mundos; Draki lo recorre al ritmo del scroll y el contenido se reparte a
   los dos lados. Estilo «pegatina»: contorno petrol grueso y sombra sólida, como
   el propio Draki. Paleta y tipografías: docs/BRAND.md del repo de la app. */

/* Fuentes alojadas en la propia web (licencia OFL): sin llamadas a Google Fonts */
@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/baloo-2-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/baloo-2-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  /* Marca (BRAND.md) */
  --teal: #14B4A4;
  --deep: #0C948C;
  --petrol: #0E3B39;
  --orange: #F98A3D;
  --cream: #FCECC4;
  --light: #F6F4EF;
  --yellow: #FFD23F;
  --white: #FFFFFF;

  /* Superficies (cambian al entrar en el volcán) */
  --bg: var(--light);
  --ink: var(--petrol);
  --ink-soft: #3E5F5C;
  --panel: var(--white);
  --panel-ink: var(--petrol);
  --edge: var(--petrol);
  --muted-chip: #E9F2EF;

  --display: "Baloo 2", "Nunito", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --trail: min(520px, 38vw);
  --ratio: 2.1667;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --pop: cubic-bezier(.2, 1.4, .4, 1);
  color-scheme: light;
}

body.night {
  --bg: var(--petrol);
  --ink: var(--light);
  --ink-soft: #B8D4CF;
  --muted-chip: #1B524E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
  transition: background-color .9s ease, color .9s ease;
}
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.02; letter-spacing: -.01em; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#sparks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- Botones «pegatina» ---------- */
.btn {
  --b-bg: var(--white);
  --b-ink: var(--petrol);
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 700 1.05rem/1 var(--display);
  padding: .85em 1.35em .75em;
  border: 2.5px solid var(--petrol);
  border-radius: 999px;
  background: var(--b-bg); color: var(--b-ink);
  box-shadow: 0 4px 0 var(--petrol);
  text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--petrol); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--petrol); }
.btn-primary { --b-bg: var(--orange); --b-ink: var(--petrol); }
.btn-ghost { --b-bg: transparent; }
body.night .panel:not(.panel-dark) { box-shadow: 6px 7px 0 var(--teal); }
body.night .btn { box-shadow: 0 4px 0 #062220; }
body.night .panel .btn { box-shadow: 0 3px 0 var(--petrol); }
body.night .btn-ghost { --b-ink: var(--light); border-color: var(--light); box-shadow: 0 4px 0 var(--light); }
.btn-sm { font-size: .95rem; padding: .7em 1.1em .6em; }
.btn-small { font-size: .95rem; padding: .65em 1em .55em; box-shadow: 0 3px 0 var(--petrol); }
.btn-quiet { --b-bg: var(--light); }

/* ---------- Barra superior ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 51; background: var(--bg); }
.bar { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 50; padding-left: var(--gutter-l); padding-right: var(--gutter-r); transition: background-color .4s, box-shadow .4s; }
.bar.scrolled { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 12%, transparent); }
.bar-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 22px; padding-block: 12px; }
.bar-logo { display: block; height: 40px; flex: none; }
.bar-logo img { height: 40px; width: auto; display: block; }
.logo-night { display: none !important; }
body.night .logo-day { display: none !important; }
body.night .logo-night { display: block !important; }
.bar-nav { display: flex; gap: 20px; margin-left: auto; font-weight: 600; font-size: .95rem; }
.bar-nav a { text-decoration: none; padding: 6px 2px; border-bottom: 2px solid transparent; }
.bar-nav a:hover { border-color: var(--orange); }
.lang { display: flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; flex: none; }
.lang button { font: 700 .8rem/1 var(--body); padding: 7px 10px; background: transparent; color: var(--ink); border: 0; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
@media (max-width: 720px) {
  .bar-nav { display: none; }
  .lang { margin-left: auto; }
  .bar .btn-sm { display: none; }
  .bar-logo, .bar-logo img { height: 34px; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: calc(110px + env(safe-area-inset-top, 0px)); padding-bottom: 72px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); text-align: center; overflow: hidden; }
.hero::before { /* sol de fondo detrás de Draki */
  content: ""; position: absolute; left: 50%; top: calc(80px + 9vw); width: min(78vw, 760px); aspect-ratio: 1; translate: -50% -38%;
  background: radial-gradient(circle, var(--cream) 0 55%, transparent 56%);
  z-index: -1; opacity: .9;
}
.hero-word {
  display: flex; align-items: flex-end; justify-content: center;
  font-family: var(--display); font-weight: 800; color: var(--petrol);
  font-size: clamp(104px, 22vw, 340px); line-height: .78; letter-spacing: -.035em;
  user-select: none;
}
.hw { display: inline-block; transition: transform 1.1s var(--pop); }
.hero-word .hw-l { transform: translateX(.18em); }
.hero-word .hw-r { transform: translateX(-.18em); }
.hero-stage { display: inline-block; width: .2em; height: 1.02em; position: relative; transition: width 1.1s var(--pop); }
.is-ready .hero-word .hw-l, .is-ready .hero-word .hw-r { transform: none; }
.is-ready .hero-stage { width: .98em; }
.hero-draki {
  position: absolute; left: 50%; bottom: -.06em; width: 1.12em; height: 1.2em; translate: -50% 0;
  padding: 0; border: 0; background: none; cursor: pointer; font-size: inherit;
  transform: translateY(40%) scale(.2); opacity: 0;
  transition: transform .9s var(--pop) .35s, opacity .3s ease .35s;
  perspective: 900px;
}
.is-ready .hero-draki { transform: none; opacity: 1; }
.hero-draki .flip { position: absolute; inset: 0; transform-style: preserve-3d; }
.hero-draki .flip.spin { animation: spin .8s cubic-bezier(.5, 0, .3, 1); }
@keyframes spin {
  0% { transform: rotateY(0) scale(1); }
  45% { transform: rotateY(180deg) scale(.86, 1.08) translateY(-6%); }
  100% { transform: rotateY(360deg) scale(1); }
}
.hero-ex { margin-top: 14px; min-height: 1.6em; font: 700 1rem/1.4 var(--display); color: var(--deep); }
.hero-ex span { display: inline-block; padding: 2px 14px; border-radius: 999px; background: var(--white); border: 2px solid var(--petrol); color: var(--petrol); }
.hero-copy { max-width: 640px; margin: 26px auto 0; display: grid; gap: 14px; justify-items: center; }
.hero-def { font-size: 1rem; color: var(--ink-soft); }
.hero-lema { font: 800 clamp(1.9rem, 4.2vw, 2.9rem)/1.05 var(--display); text-wrap: balance; }
.hero-sub { font-size: 1.12rem; color: var(--ink-soft); max-width: 34em; text-wrap: pretty; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 8px; }
.hero-soon { font-size: .9rem; color: var(--ink-soft); }

/* ---------- Animación de frames (como en la app: fundido entre frames) ---------- */
.flip { display: block; position: relative; }
.flip .fr { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .16s linear; }
.flip .fr.on { opacity: 1; z-index: 1; transition: none; }

/* ---------- Prólogo ---------- */
.prologue { padding-block: 40px 120px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.prologue-text {
  max-width: 980px; margin: 0 auto;
  font: 800 clamp(1.7rem, 3.9vw, 3.2rem)/1.14 var(--display);
  letter-spacing: -.01em; text-wrap: pretty;
}
.prologue-text .w { color: color-mix(in srgb, var(--ink) 18%, transparent); transition: color .35s ease; }
.prologue-text .w.lit { color: var(--ink); }
.prologue-text .w.lit.key { color: var(--deep); }
.prologue-hint { max-width: 980px; margin: 28px auto 0; font-weight: 600; color: var(--ink-soft); display: flex; align-items: center; gap: 10px; }
.prologue-hint::after { content: ""; width: 12px; height: 12px; border-right: 3px solid var(--orange); border-bottom: 3px solid var(--orange); rotate: 45deg; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { translate: 0 5px; } }

/* ---------- El viaje ---------- */
.journey { position: relative; }
.trail { position: absolute; top: 0; bottom: 0; left: 50%; width: var(--trail); transform: translateX(-50%); pointer-events: none; z-index: 0; }
.trail-maps { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 15%, #000 85%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 15%, #000 85%, transparent 100%); }
.trail-maps img { display: block; width: 100%; height: calc(var(--trail) * var(--ratio)); object-fit: cover; }
.trail::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 220px; background: linear-gradient(transparent, var(--bg)); transition: background .9s; }
.trail-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.p-todo { fill: none; stroke: var(--deep); stroke-opacity: .45; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 2 14; }
.p-done { fill: none; stroke: var(--teal); stroke-width: 10; stroke-linecap: round; filter: drop-shadow(0 3px 0 rgba(14, 59, 57, .35)); }

.node { position: absolute; width: 150px; height: 150px; translate: -50% -50%; }
.node img.obs { position: absolute; inset: 22px; width: 106px; height: 106px; object-fit: contain; transition: filter .6s, opacity .6s; }
.node:not(.passed) img.obs { filter: grayscale(.85); opacity: .65; }
.node svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.node .seg { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 9; stroke-linecap: round; transition: stroke .4s; }
.node .seg.on { stroke: var(--orange); }
.node .ring-bg { fill: none; stroke: var(--petrol); stroke-width: 13; stroke-linecap: round; opacity: .9; }
.node .medal { position: absolute; right: -6px; top: -6px; width: 64px; height: 64px; transform: scale(0) rotate(-30deg); transition: transform .6s var(--pop); }
.node.passed .medal { transform: none; }

.walker { position: absolute; left: 0; top: 0; width: 160px; height: 170px; will-change: transform; z-index: 3; }
.walker-body { position: absolute; inset: 0; transform-origin: 50% 92%; }
.walker-pose, .walker-ex { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .2s; }
.walker-ex { opacity: 0; }
.walker.training .walker-pose { opacity: 0; }
.walker.training .walker-ex { opacity: 1; }
.walker-bubble {
  position: absolute; bottom: calc(100% - 6px); left: 50%; translate: -50% 6px; scale: .7;
  white-space: nowrap; font: 700 .95rem/1.2 var(--display); color: var(--petrol);
  background: var(--white); border: 2.5px solid var(--petrol); border-radius: 16px; padding: 6px 12px 5px;
  box-shadow: 0 3px 0 var(--petrol); opacity: 0; transition: opacity .25s, translate .35s var(--pop), scale .35s var(--pop);
}
.walker-bubble::after { content: ""; position: absolute; left: 50%; top: 100%; width: 12px; height: 12px; background: var(--white); border-right: 2.5px solid var(--petrol); border-bottom: 2.5px solid var(--petrol); translate: -50% -6px; rotate: 45deg; }
.walker-bubble.show { opacity: 1; translate: -50% 0; scale: 1; }

.world {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--trail) minmax(0, 1fr);
  height: calc(var(--trail) * var(--ratio));
  align-items: center;
}
.world-band { display: none; }
.world-copy { grid-column: 1; grid-row: 1; justify-self: end; max-width: 430px; padding: 0 clamp(28px, 3.4vw, 64px) 0 var(--gutter-l); display: grid; gap: 16px; }
.world-widget { grid-column: 3; grid-row: 1; justify-self: start; width: 100%; max-width: 420px; padding: 0 var(--gutter-r) 0 clamp(28px, 3.4vw, 64px); }
.world.flipside .world-copy { grid-column: 3; justify-self: start; padding: 0 var(--gutter-r) 0 clamp(28px, 3.4vw, 64px); }
.world.flipside .world-widget { grid-column: 1; justify-self: end; padding: 0 clamp(28px, 3.4vw, 64px) 0 var(--gutter-l); }
.world-copy h2 { font-size: clamp(2.3rem, 3.6vw, 3.4rem); }
.world-copy p:not(.world-kicker) { color: var(--ink-soft); font-size: 1.06rem; max-width: 30em; }
.world-kicker { display: flex; align-items: baseline; gap: 8px; font: 700 1rem/1 var(--display); color: var(--deep); }
.world-kicker b { font-weight: 800; color: var(--orange); font-size: 1.2em; }
body.night .world-kicker { color: var(--teal); }

/* ---------- Paneles ---------- */
.panel {
  background: var(--panel); color: var(--panel-ink);
  border: 2.5px solid var(--petrol); border-radius: 28px;
  box-shadow: 6px 7px 0 var(--petrol);
  padding: 22px; display: grid; gap: 14px;
}
.panel-dark { background: var(--petrol); color: var(--light); border-color: var(--petrol); box-shadow: 6px 7px 0 var(--deep); }
.panel-q { font: 700 1.15rem/1.2 var(--display); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 .88rem/1 var(--body); padding: 8px 12px 8px 9px;
  border-radius: 999px; border: 2px solid var(--petrol); background: var(--white); color: var(--petrol);
  cursor: pointer; transition: background-color .2s, transform .15s;
}
.chip svg { width: 20px; height: 20px; flex: none; }
.chip:hover { transform: translateY(-1px); }
.chip[aria-pressed="true"] { background: var(--teal); }
.chip.fixed { cursor: default; background: var(--muted-chip); border-style: dashed; }
.panel-dark .chip { background: transparent; color: var(--light); border-color: rgba(246, 244, 239, .5); }
.panel-dark .chip[aria-pressed="true"] { background: var(--orange); color: var(--petrol); border-color: var(--orange); }

/* Mundo 1: material */
.kit-stage { height: 230px; border-radius: 20px; background: radial-gradient(ellipse at 50% 85%, var(--cream) 0 38%, transparent 39%), #EAF6F3; position: relative; overflow: hidden; }
.kit-stage .flip { position: absolute; inset: 10px 0 0; }
.kit-stage .flip.pop { animation: popin .5s var(--pop); }
@keyframes popin { from { transform: scale(.6) translateY(20px); opacity: 0; } }
.kit-name { font: 800 1.3rem/1.1 var(--display); }
.kit-cue { font-size: .95rem; color: var(--ink-soft); min-height: 3em; }
.panel .kit-cue { color: #3E5F5C; }
.kit-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 2px dashed rgba(14, 59, 57, .2); padding-top: 12px; }
.kit-count { font-weight: 600; }
.kit-count b { font: 800 1.7rem/1 var(--display); color: var(--deep); font-variant-numeric: tabular-nums; }

/* Mundo 2: semana */
.week-head { display: flex; align-items: center; gap: 12px; }
.week-draki { width: 84px; height: 84px; flex: none; object-fit: contain; }
.week-draki.bump { animation: popin .45s var(--pop); }
.week-msg { font: 700 1.12rem/1.2 var(--display); }
.week-strip { position: relative; display: grid; grid-template-columns: repeat(7, 1fr) 1.1fr; gap: 4px; padding: 10px 0 4px; }
.day { display: grid; justify-items: center; gap: 6px; font: 700 .8rem/1 var(--body); color: #5E7C78; }
.day.today { color: var(--petrol); }
.day .slot { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed rgba(14, 59, 57, .2); }
.day.today .slot { border: 3px solid var(--orange); }
.day.next { color: var(--deep); }
.day.next .slot { border-style: dotted; }
.tok {
  position: absolute; top: 26px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font: 800 .9rem/1 var(--display); color: var(--white);
  background: var(--deep); border: 2.5px solid var(--petrol);
  transition: left .9s var(--pop), background-color .3s, transform .3s;
}
.tok.done { background: var(--teal); }
.tok.done::after { content: ""; width: 8px; height: 14px; border-right: 3px solid var(--white); border-bottom: 3px solid var(--white); rotate: 45deg; translate: 0 -2px; }
.tok.done span { display: none; }
.tok.moved { background: var(--orange); color: var(--petrol); }
.week-count { font-size: .92rem; color: #3E5F5C; }
.week-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Mundo 3: coach */
.coach-top { display: flex; gap: 14px; align-items: center; }
.coach-flip { width: 132px; height: 142px; flex: none; border-radius: 18px; background: #EAF6F3; }
.coach-info { display: grid; gap: 6px; position: relative; flex: 1; min-width: 0; }
.coach-name { font: 700 1.05rem/1.15 var(--display); padding-right: 52px; }
.coach-load { display: grid; gap: 2px; font-weight: 600; color: #3E5F5C; }
.coach-kg { font: 800 2.6rem/1 var(--display); color: var(--petrol); display: inline-flex; align-items: baseline; gap: 6px; }
.roll { display: inline-block; min-width: 1.2em; font-variant-numeric: tabular-nums; }
.roll.up { animation: rollUp .5s var(--pop); }
.roll.down { animation: rollDown .5s var(--pop); }
@keyframes rollUp { from { transform: translateY(60%); opacity: 0; } }
@keyframes rollDown { from { transform: translateY(-60%); opacity: 0; } }
.coach-face { position: absolute; right: -6px; top: -14px; width: 64px; height: 64px; object-fit: contain; }
.coach-face.bump { animation: popin .45s var(--pop); }
.coach-bells { display: flex; gap: 8px; align-items: flex-end; }
.bell { display: grid; justify-items: center; gap: 2px; font: 600 .72rem/1 var(--body); color: #5E7C78; }
.bell i { display: block; border-radius: 50% 50% 44% 44%; background: #CFE2DE; border: 2px solid var(--petrol); position: relative; transition: background-color .3s, transform .3s var(--pop); }
.bell i::before { content: ""; position: absolute; left: 50%; top: -42%; width: 56%; height: 50%; translate: -50% 0; border: 2px solid var(--petrol); border-bottom: 0; border-radius: 40% 40% 0 0; }
.bell.cur i { background: var(--orange); transform: translateY(-4px); }
.bell.cur { color: var(--petrol); font-weight: 800; }
.coach-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.coach-btns .btn { padding-inline: .4em; font-size: .9rem; }
.coach-btns .btn.sel { --b-bg: var(--teal); }
.coach-msg { min-height: 2.8em; font-size: .95rem; color: #3E5F5C; }

/* Mundo 4: mapa muscular */
.muscles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.mm { perspective: 1000px; aspect-ratio: 640 / 1001; width: 100%; }
.mm-card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .9s var(--pop); }
.mm-card.back { transform: rotateY(180deg); }
.mm-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.mm-back { transform: rotateY(180deg); }
.mm-face .m, .mm-face .ol { position: absolute; inset: 0; width: 100%; height: 100%; }
.mm-face .m { background: rgba(246, 244, 239, .1); -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; transition: background-color .45s; }
.mm-face .m.p { background: var(--orange); }
.mm-face .m.s { background: var(--teal); }
.mm-side { display: grid; gap: 12px; align-content: center; }
.chips-col { flex-direction: column; align-items: flex-start; }
.btn-turn { --b-bg: var(--light); justify-self: start; white-space: nowrap; font-size: .88rem; padding: .6em .9em .5em; }
.turn-ico { display: inline-block; font-size: 1.1em; transition: rotate .6s var(--pop); }
.btn-turn:hover .turn-ico { rotate: 180deg; }
.mm-legend { display: flex; align-items: center; gap: 6px 14px; font-size: .82rem; color: #B8D4CF; flex-wrap: wrap; }
.lg { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.lg-p { background: var(--orange); }
.lg-s { background: var(--teal); }
.mm-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.streak { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; border-top: 2px dashed rgba(246, 244, 239, .2); padding-top: 12px; }
.streak b { font: 800 1.6rem/1 var(--display); color: var(--yellow); }
.streak small { color: #B8D4CF; }
.streak-flame { width: 26px; height: 32px; background: radial-gradient(circle at 50% 70%, var(--yellow) 0 30%, var(--orange) 31% 100%); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; clip-path: polygon(50% 0, 78% 30%, 100% 62%, 88% 92%, 50% 100%, 12% 92%, 0 62%, 22% 30%); animation: flick 1.2s ease-in-out infinite; }
@keyframes flick { 50% { transform: scaleY(1.12) skewX(-4deg); } }

/* Mundo 5: niveles */
.level { justify-items: center; text-align: center; }
.level-ring-wrap { position: relative; width: 180px; height: 180px; }
.level-ring { width: 100%; height: 100%; }
.level-ring .bg { fill: var(--cream); stroke: var(--petrol); stroke-width: 2.5; }
.level-ring .seg { fill: none; stroke: #DCE7E4; stroke-width: 11; stroke-linecap: round; transition: stroke .45s; }
.level-ring .seg.on { stroke: var(--orange); }
.level-left { position: absolute; inset: 0; display: grid; place-items: center; font: 800 3.4rem/1 var(--display); color: var(--petrol); transition: opacity .3s, transform .4s var(--pop); }
.level-medal { position: absolute; left: 50%; top: 50%; width: 112px; height: 112px; translate: -50% -50%; transform: scale(0) rotate(-40deg); transition: transform .7s var(--pop); }
.level.won .level-medal { transform: scale(1) rotate(0); }
.level.won .level-left { opacity: 0; transform: scale(.4); }
.level-title { font: 800 1.45rem/1.1 var(--display); }
.level-sub { color: #3E5F5C; font-size: .95rem; max-width: 26em; }

/* ---------- Biblioteca ---------- */
.library { padding-block: 120px 100px; overflow: hidden; }
.lib-head { max-width: 900px; margin: 0 auto 48px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); display: grid; gap: 16px; }
.lib-head h2 { font-size: clamp(2.2rem, 4.6vw, 4rem); }
.lib-head p { color: var(--ink-soft); font-size: 1.1rem; max-width: 36em; }
.marquee { display: flex; width: max-content; gap: 18px; padding-block: 10px; animation: slide 70s linear infinite; }
.marquee + .marquee { margin-top: 10px; }
.marquee-rev { animation-direction: reverse; animation-duration: 80s; }
.library:hover .marquee { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }
.card {
  flex: none; width: 176px; padding: 12px 12px 14px; border-radius: 22px;
  background: var(--cream); color: var(--petrol); border: 2.5px solid var(--petrol); box-shadow: 4px 5px 0 rgba(0, 0, 0, .35);
  display: grid; gap: 8px; text-align: left; cursor: pointer; font: inherit;
  transition: transform .25s var(--pop);
}
.card:nth-child(3n) { transform: rotate(-2deg); }
.card:nth-child(3n+1) { transform: rotate(1.5deg); }
.card:hover, .card:focus-visible { transform: translateY(-8px) rotate(0); }
.card .flip { height: 150px; }
.card b { font: 700 1rem/1.15 var(--display); }
.card small { font-size: .76rem; color: #3E5F5C; }
.card.locked { background: var(--teal); place-content: center; text-align: center; cursor: default; }
.card.locked .lock-draki { width: 120px; height: 120px; margin: 0 auto; object-fit: contain; filter: brightness(0) invert(1); opacity: .9; }
.card.locked b { font-size: 1.5rem; }

/* ---------- Beta ---------- */
.beta { padding-block: 60px 120px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.beta-in { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 40px; align-items: center; }
.beta-draki { width: 100%; height: auto; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px); } }
.beta-copy { display: grid; gap: 16px; }
.beta-copy h2 { font-size: clamp(2.2rem, 4.4vw, 3.8rem); }
.beta-copy > p { color: var(--ink-soft); font-size: 1.1rem; }
.beta-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.beta-alt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .95rem; color: var(--ink-soft); }
.beta-addr { font-weight: 700; color: var(--ink); user-select: all; }
.beta-alt .btn { font-size: .82rem; padding: .5em .9em .42em; }
.beta-small { font-size: .85rem; color: var(--ink-soft); }

.foot { background: var(--petrol); color: var(--light); padding-block: 48px calc(48px + env(safe-area-inset-bottom, 0px)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); border-top: 2px solid rgba(246, 244, 239, .12); }
.foot-in { max-width: 1040px; margin: 0 auto; display: grid; justify-items: center; gap: 10px; text-align: center; }
.foot-lema { font: 800 1.4rem/1 var(--display); color: var(--teal); }
.foot-legal { font-size: .85rem; color: #B8D4CF; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; font-size: .9rem; }
.foot-links a { color: var(--light); }
.beta-small a { color: inherit; }

/* ---------- Móvil y tablet: el sendero se convierte en estampas por mundo ---------- */
@media (max-width: 1059px) {
  .trail { display: none; }
  .world { display: block; height: auto; padding-bottom: 72px; }
  .world-band {
    display: block; position: relative; height: 340px; margin-bottom: 28px; overflow: hidden;
    background-size: cover; background-position: 50% 42%;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 82%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 82%, transparent 100%);
  }
  .world-band .flip { position: absolute; left: 50%; bottom: 36px; width: 210px; height: 222px; translate: -50% 0; }
  .world-band .obs { position: absolute; width: 96px; bottom: 54px; right: 12%; }
  .world.flipside .world-band .obs { right: auto; left: 12%; }
  .world-copy, .world.flipside .world-copy, .world-widget, .world.flipside .world-widget {
    max-width: 560px; margin: 0 auto; padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  }
  .world-widget, .world.flipside .world-widget { margin-top: 28px; }
}
@media (max-width: 560px) {
  .hero-word { font-size: clamp(96px, 30vw, 150px); }
  .muscles { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); padding: 16px; }
  .beta-in { grid-template-columns: 1fr; text-align: center; }
  .beta-draki { width: 200px; margin: 0 auto; }
  .beta-actions, .beta-alt { justify-content: center; }
  .coach-flip { width: 108px; height: 118px; }
  .coach-kg { font-size: 2.2rem; }
  .panel { padding: 18px; }
  .week-strip { gap: 2px; }
  .day .slot, .tok { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee { animation: none; flex-wrap: nowrap; }
  .library .marquee { overflow-x: auto; width: auto; padding-left: var(--gutter-l); }
  .beta-draki, .streak-flame, .prologue-hint::after { animation: none; }
  .hero-draki .flip.spin { animation: none; }
}

/* ---------- Páginas legales ---------- */
.legal-main { padding-top: calc(104px + env(safe-area-inset-top, 0px)); padding-bottom: 96px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.legal-back { margin-left: auto; font-weight: 600; font-size: .95rem; text-decoration: none; border-bottom: 2px solid var(--orange); padding-bottom: 2px; }
.legal-page .lang { margin-left: 8px; }
.legal-tabs { max-width: 70ch; margin: 0 auto 32px; display: flex; gap: 8px; flex-wrap: wrap; }
.legal-tabs a { font: 700 .95rem/1 var(--display); text-decoration: none; padding: .7em 1.1em .6em; border-radius: 999px; border: 2.5px solid var(--petrol); background: var(--white); }
.legal-tabs a[aria-current="page"] { background: var(--teal); box-shadow: 0 3px 0 var(--petrol); }
.legal-doc { max-width: 70ch; margin: 0 auto; font-size: 1.02rem; line-height: 1.68; }
.legal-doc h1 { font-size: clamp(2.3rem, 5vw, 3.4rem); margin-bottom: 8px; }
.legal-doc h2 { font-size: 1.45rem; margin: 2.1em 0 .6em; scroll-margin-top: 96px; }
.legal-doc h3 { font-size: 1.12rem; margin: 1.4em 0 .4em; color: var(--deep); }
.legal-doc p { margin: 0 0 1em; }
.legal-doc ul { margin: 0 0 1em; padding-left: 1.2em; display: grid; gap: .45em; }
.legal-doc li::marker { color: var(--orange); }
.legal-doc a { color: var(--deep); font-weight: 600; }
.legal-date { color: var(--ink-soft); font-size: .92rem; }
.legal-note { font-style: italic; color: var(--ink-soft); font-size: .92rem; }
.legal-callout { background: var(--cream); border: 2.5px solid var(--petrol); border-radius: 22px; box-shadow: 5px 6px 0 var(--petrol); padding: 18px 20px; font-weight: 600; }
mark.todo { background: var(--yellow); color: var(--petrol); padding: 0 .35em; border-radius: 6px; font-weight: 700; }
@media (max-width: 720px) { .legal-back { display: none; } .legal-page .lang { margin-left: auto; } }
