/* =========================================================
   Mario · 40 años — estilos
   Tema claro: "Reino Champiñón" · Tema oscuro: "Galaxia"
   ========================================================= */

:root {
  --red: #e52521;
  --red-ink: #c0181a;
  --blue: #049cd8;
  --yellow: #fbd000;
  --green: #43b047;
  --brown: #b85c00;

  --sky-top: #5cb8f5;
  --sky-bottom: #bfe6ff;
  --bg: #f6fbff;
  --bg-alt: #e9f5ff;
  --surface: #ffffff;
  --surface-2: #f2f7fc;
  --ink: #12233a;
  --ink-2: #3a4d66;
  --ink-3: #5c6f87;
  --line: #d4e3f1;
  --accent: var(--red-ink);
  --focus: #0a5fd6;
  --shadow: 0 1px 2px rgb(18 35 58 / .06), 0 8px 24px rgb(18 35 58 / .08);
  --shadow-lg: 0 2px 4px rgb(18 35 58 / .06), 0 20px 48px rgb(18 35 58 / .14);
  --glass: rgb(255 255 255 / .72);
  --ground: #c8743a;
  --ground-top: #5fbf3f;

  --radius: 20px;
  --radius-sm: 12px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky-top: #05071a;
    --sky-bottom: #1a1450;
    --bg: #0b1026;
    --bg-alt: #10173a;
    --surface: #161e45;
    --surface-2: #1d2654;
    --ink: #eef2ff;
    --ink-2: #c3cbea;
    --ink-3: #98a2c9;
    --line: #2a3566;
    --accent: #ff6b6b;
    --focus: #8ab4ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .3), 0 20px 48px rgb(0 0 0 / .5);
    --glass: rgb(11 16 38 / .72);
    --ground: #3b2f6b;
    --ground-top: #6c5ce7;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sky-top: #05071a;
  --sky-bottom: #1a1450;
  --bg: #0b1026;
  --bg-alt: #10173a;
  --surface: #161e45;
  --surface-2: #1d2654;
  --ink: #eef2ff;
  --ink-2: #c3cbea;
  --ink-3: #98a2c9;
  --line: #2a3566;
  --accent: #ff6b6b;
  --focus: #8ab4ff;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / .3), 0 20px 48px rgb(0 0 0 / .5);
  --glass: rgb(11 16 38 / .72);
  --ground: #3b2f6b;
  --ground-top: #6c5ce7;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: 112.5%; /* 18px: texto cómodo para todas las edades */
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(2rem, 1.4rem + 3vw, 3.2rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 10px;
  font-weight: 800; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 1rem; }

.container { width: min(1180px, 100% - 2rem); margin-inline: auto; }
.container--narrow { width: min(780px, 100% - 2rem); }

.eyebrow {
  font-family: var(--font-display);
  font-weight: 600; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .6rem;
}

/* ---------- Barra de progreso ---------- */
.progress { position: fixed; inset: 0 0 auto; height: 4px; z-index: 60; pointer-events: none; }
.progress__bar {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue));
  transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
}
@supports (animation-timeline: scroll()) {
  .progress__bar { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.nav {
  width: min(1180px, 100% - 2rem); margin-inline: auto;
  display: flex; align-items: center; gap: 1rem; min-height: 4.2rem;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
}
.brand__block {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 8px;
  background: var(--yellow); color: var(--brown); font-weight: 700;
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / .18), inset 0 0 0 2px var(--brown);
}
.brand__dim { color: var(--ink-3); font-weight: 500; }
.nav__menu {
  display: flex; gap: .25rem; list-style: none; margin: 0 0 0 auto; padding: 0;
}
.nav__menu a {
  display: block; padding: .55rem .9rem; border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: .95rem;
  transition: background .2s, color .2s;
}
.nav__menu a:hover, .nav__menu a[aria-current="true"] { background: var(--surface-2); color: var(--ink); }
.nav__menu a[aria-current="true"] { box-shadow: inset 0 -3px 0 var(--red); }
.nav__toggle { display: none; }

.theme-toggle {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none;
  transition: transform .4s var(--ease-bounce);
}
.theme-toggle:hover { transform: rotate(25deg) scale(1.06); }
.theme-toggle__sun {
  width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--yellow);
  box-shadow: 0 0 0 3px rgb(251 208 0 / .3);
  transition: box-shadow .4s, background .4s;
}
[data-theme="dark"] .theme-toggle__sun,
.dark-auto .theme-toggle__sun { background: transparent; box-shadow: inset -5px -3px 0 0 #ffe9a8; }

@media (max-width: 860px) {
  .nav__toggle {
    display: grid; gap: 5px; margin-left: auto; padding: .7rem; border: 0; background: none; cursor: pointer;
    width: 2.9rem; height: 2.9rem; place-content: center;
  }
  .nav__toggle span { display: block; width: 22px; height: 2.5px; border-radius: 2px; background: var(--ink); transition: transform .3s, opacity .3s; }
  .nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
  .nav__menu {
    position: absolute; inset: 100% 0 auto; flex-direction: column; gap: 0; margin: 0;
    padding: .5rem 1rem 1rem; background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform-origin: top; transform: scaleY(.9); opacity: 0; visibility: hidden;
    transition: transform .25s var(--ease-out), opacity .2s, visibility .2s;
  }
  .nav__menu.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav__menu a { padding: .9rem 1rem; font-size: 1.05rem; }
  .brand__dim { display: none; }
}

/* ---------- Botones y chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 3rem; padding: .7rem 1.5rem; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; text-decoration: none;
  transition: transform .25s var(--ease-bounce), box-shadow .25s;
}
.btn--primary {
  background: var(--red); color: #fff;
  box-shadow: 0 4px 0 var(--red-ink), 0 10px 24px rgb(229 37 33 / .35);
}
.btn--primary:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--red-ink), 0 16px 30px rgb(229 37 33 / .4); }
.btn--primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--red-ink); }
.btn--ghost {
  background: var(--surface); color: var(--ink); border: 2px solid var(--line);
}
.btn--ghost:hover { transform: translateY(-3px); border-color: var(--ink-3); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips--center { justify-content: center; margin-bottom: 2rem; }
.chip {
  min-height: 2.75rem; padding: .5rem 1.1rem; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-weight: 700; font-size: .95rem;
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease-bounce);
}
.chip:hover { transform: translateY(-2px); border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: min(100svh, 920px);
  display: grid; grid-template-columns: 1.15fr .85fr; align-items: center;
  padding: 3rem max(1rem, (100% - 1180px) / 2) 7rem;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  color: #0d2340;
}
:root[data-theme="dark"] .hero { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { color: var(--ink); } }

.sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.cloud {
  position: absolute; width: 9rem; height: 3rem; border-radius: 3rem; background: #fff;
  opacity: .95; animation: drift linear infinite;
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.cloud::before { width: 4rem; height: 4rem; left: 1.4rem; top: -2rem; }
.cloud::after { width: 3rem; height: 3rem; left: 4.4rem; top: -1.3rem; }
.cloud--1 { top: 14%; left: -10rem; animation-duration: 55s; }
.cloud--2 { top: 32%; left: -10rem; animation-duration: 75s; animation-delay: -30s; transform: scale(.7); }
.cloud--3 { top: 8%; left: -10rem; animation-duration: 90s; animation-delay: -60s; transform: scale(.55); }
@keyframes drift { to { translate: calc(100vw + 20rem) 0; } }

.star { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; opacity: 0; }
.star--1 { top: 12%; left: 8%; } .star--2 { top: 22%; left: 46%; } .star--3 { top: 9%; left: 70%; }
.star--4 { top: 38%; left: 88%; } .star--5 { top: 52%; left: 18%; } .star--6 { top: 30%; left: 60%; }
:root[data-theme="dark"] .cloud { opacity: .08; }
:root[data-theme="dark"] .star { opacity: 1; animation: twinkle 3s ease-in-out infinite; }
:root[data-theme="dark"] .star:nth-child(even) { animation-delay: -1.5s; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cloud { opacity: .08; }
  :root:not([data-theme="light"]) .star { opacity: 1; animation: twinkle 3s ease-in-out infinite; }
}
@keyframes twinkle { 50% { opacity: .2; transform: scale(.6); } }

.hero__content { position: relative; z-index: 2; max-width: 40rem; }
.hero .eyebrow { color: inherit; opacity: .85; }
.hero__title {
  font-size: clamp(3rem, 1.6rem + 7vw, 6.4rem);
  font-weight: 700; margin-bottom: 1.2rem; line-height: 1;
  display: flex; flex-wrap: wrap; column-gap: .3em;
}
.jump-word { display: inline-flex; }
.jump-word--accent { color: var(--red); text-shadow: 0 4px 0 rgb(0 0 0 / .12); }
.char {
  display: inline-block;
  animation: char-in .7s var(--ease-bounce) both;
  animation-delay: calc(var(--i) * 45ms + 150ms);
}
@keyframes char-in { from { transform: translateY(.6em) scale(.6); opacity: 0; } }
.char:hover { animation: char-jump .5s var(--ease-bounce); }
@keyframes char-jump { 40% { transform: translateY(-.25em); } }

.hero__lead { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); max-width: 34rem; font-weight: 600; opacity: .92; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.8rem 0; }
.hero__chips { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; padding: 0; margin: 0; }
.hero__chips li {
  padding: .45rem .95rem; border-radius: 999px; font-size: .95rem; font-weight: 600;
  background: rgb(255 255 255 / .55); backdrop-filter: blur(6px); border: 1px solid rgb(255 255 255 / .6);
}
:root[data-theme="dark"] .hero__chips li { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .15); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero__chips li { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .15); } }

.hero__scene { position: static; }
.qblock {
  position: absolute; right: 24%; top: 30%; width: 6rem; height: 6rem; border-radius: 12px; z-index: 1;
  background: var(--yellow); display: grid; place-items: center; cursor: pointer;
  box-shadow: inset 0 -8px 0 rgb(0 0 0 / .18), inset 0 0 0 4px var(--brown), 0 14px 30px rgb(0 0 0 / .2);
  animation: bob 2.6s ease-in-out infinite;
}
.qblock span { font-family: var(--font-display); font-weight: 700; font-size: 3.6rem; color: var(--brown); line-height: 1; }
.qblock::before, .qblock::after {
  content: ""; position: absolute; width: 8px; height: 8px; border-radius: 2px; background: var(--brown);
  top: 10px; left: 10px; box-shadow: calc(6rem - 28px) 0 0 var(--brown), 0 calc(6rem - 28px) 0 var(--brown), calc(6rem - 28px) calc(6rem - 28px) 0 var(--brown);
}
.qblock.is-hit { animation: hit .35s var(--ease-bounce); }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes hit { 40% { transform: translateY(-22px); } }
.coin-pop {
  position: absolute; right: calc(24% + 1.75rem); top: 30%; width: 2.5rem; height: 3.2rem; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6b0, var(--yellow) 45%, #d9a400);
  box-shadow: inset 0 0 0 3px #b88a00; opacity: 0; pointer-events: none;
}
.coin-pop.is-pop { animation: coin .8s var(--ease-out); }
@keyframes coin {
  0% { opacity: 1; transform: translateY(0) scaleX(1); }
  50% { transform: translateY(-110px) scaleX(.2); }
  75% { transform: translateY(-130px) scaleX(1); opacity: 1; }
  100% { transform: translateY(-90px) scaleX(.2); opacity: 0; }
}
.pipe {
  position: absolute; right: 10%; bottom: 3.5rem; width: 6.5rem; height: 9rem; z-index: 1;
  background: linear-gradient(90deg, #2f8a2f, var(--green) 30%, #8fe08c 45%, var(--green) 60%, #2f8a2f);
  border: 3px solid #1e5e1e; border-bottom: 0;
}
.pipe__lip {
  position: absolute; left: -12px; right: -12px; top: -2.4rem; height: 2.4rem;
  background: inherit; border: 3px solid #1e5e1e; border-radius: 6px;
}
.hill { position: absolute; bottom: 3.5rem; border-radius: 50% 50% 0 0; background: #4fb84a; opacity: .9; z-index: -1; }
.hill--1 { width: 22rem; height: 10rem; left: 48%; }
.hill--2 { width: 13rem; height: 6rem; left: calc(48% + 15rem); background: #6cc865; }
:root[data-theme="dark"] .hill { background: #2b2270; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hill { background: #2b2270; } }

.ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3.5rem; z-index: 1;
  background:
    linear-gradient(var(--ground-top) 0 .7rem, transparent .7rem),
    repeating-linear-gradient(90deg, var(--ground) 0 3.4rem, color-mix(in srgb, var(--ground) 80%, #000) 3.4rem 3.5rem),
    var(--ground);
}
.scroll-cue {
  position: absolute; left: 50%; bottom: 4.5rem; translate: -50% 0; z-index: 3;
  width: 1.8rem; height: 2.8rem; border: 2.5px solid currentColor; border-radius: 1rem; color: inherit; opacity: .7;
}
.scroll-cue span { position: absolute; left: 50%; top: .5rem; width: 4px; height: .6rem; border-radius: 2px; background: currentColor; translate: -50% 0; animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 60% { transform: translateY(.8rem); opacity: 0; } }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 2.5rem; padding-bottom: 15rem; }
  .qblock { width: 4rem; height: 4rem; right: 40%; top: auto; bottom: 10.5rem; }
  .qblock span { font-size: 2.4rem; }
  .qblock::before, .qblock::after { width: 6px; height: 6px; top: 7px; left: 7px; box-shadow: calc(4rem - 20px) 0 0 var(--brown), 0 calc(4rem - 20px) 0 var(--brown), calc(4rem - 20px) calc(4rem - 20px) 0 var(--brown); }
  .coin-pop { right: calc(40% + .75rem); top: auto; bottom: 10.5rem; }
  .pipe { width: 4.5rem; height: 5rem; right: 8%; }
  .hill--1 { left: -3rem; width: 16rem; height: 7rem; }
  .hill--2 { left: 9rem; width: 9rem; height: 4rem; }
  .scroll-cue { display: none; }
}

/* ---------- Secciones ---------- */
.section { padding: clamp(4rem, 3rem + 5vw, 7.5rem) 0; position: relative; }
.section--alt { background: var(--bg-alt); }
.section__head { text-align: center; max-width: 46rem; margin: 0 auto 3rem; }
.section__lead { font-size: 1.12rem; color: var(--ink-2); }

/* Revelado al hacer scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Origen ---------- */
.steps {
  list-style: none; padding: 0; margin: 0 0 3.5rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: s;
}
.step {
  position: relative; background: var(--surface); border-radius: var(--radius); padding: 2rem 1.6rem 1.6rem;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.step:nth-child(2) { transition-delay: .1s; }
.step:nth-child(3) { transition-delay: .2s; }
.step__num {
  display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 50%; margin-bottom: 1rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: #fff; background: var(--red);
}
.step:nth-child(2) .step__num { background: var(--blue); }
.step:nth-child(3) .step__num { background: var(--green); }
.step:not(:last-child)::after {
  content: "→"; position: absolute; right: -1.05rem; top: 50%; translate: 0 -50%; z-index: 1;
  width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%;
  background: var(--yellow); color: var(--brown); font-weight: 800;
}
.step p { color: var(--ink-2); margin: 0; }
@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr; }
  .step:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -1.05rem; translate: 50% 0; }
}

.pixel-lab {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center;
  background: var(--surface); border-radius: calc(var(--radius) + 8px); padding: clamp(1.5rem, 1rem + 2vw, 3rem);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.pixel-lab p { color: var(--ink-2); }
.toggles { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.2rem 0; }
.toggle {
  min-height: 3rem; padding: .6rem 1.1rem; border-radius: 14px; cursor: pointer; font-weight: 700;
  border: 2px solid var(--line); background: var(--surface-2); color: var(--ink);
  transition: transform .2s var(--ease-bounce), background .2s, border-color .2s;
}
.toggle:hover { transform: translateY(-2px); }
.toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--red) 14%, var(--surface)); border-color: var(--red); }
.cite { font-size: .9rem; color: var(--ink-3) !important; }
.pixel-grid {
  display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px;
  width: min(100%, 22rem); aspect-ratio: 1; margin-inline: auto; padding: 8px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.px { border-radius: 2px; background: transparent; transition: background-color .35s, transform .35s var(--ease-bounce); }
.px.is-on { transform: scale(1); }
.px.flash { animation: px-flash .5s var(--ease-bounce); }
@keyframes px-flash { 0% { transform: scale(.2); } }
@media (max-width: 760px) { .pixel-lab { grid-template-columns: 1fr; } }

/* ---------- Cronología ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; }
.filters__count { text-align: center; color: var(--ink-3); font-weight: 600; margin: 1rem 0 0; min-height: 1.6em; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 700; color: var(--ink-2); min-height: 2.75rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 3rem; height: 1.7rem; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: calc(1.7rem - 6px); aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .3s var(--ease-bounce); }
.switch input:checked + .switch__track { background: var(--yellow); }
.switch input:checked + .switch__track::after { transform: translateX(1.3rem); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 3px; }

.decades {
  position: sticky; top: 4.6rem; z-index: 10; display: flex; justify-content: center; gap: .3rem; flex-wrap: wrap;
  width: fit-content; max-width: 100%; margin: 1.5rem auto 2.5rem; padding: .35rem;
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.decades a {
  padding: .4rem .85rem; border-radius: 999px; font-weight: 800; font-size: .9rem; text-decoration: none; color: var(--ink-2);
  min-height: 2.4rem; display: grid; place-items: center;
}
.decades a:hover { background: var(--surface-2); color: var(--ink); }
.decades a.is-active { background: var(--red); color: #fff; }

.timeline { list-style: none; margin: 0 auto; padding: 0; position: relative; max-width: 980px; }
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; translate: -50% 0; border-radius: 2px;
  background: linear-gradient(var(--red), var(--yellow), var(--green), var(--blue));
}
.year-marker {
  position: relative; display: flex; justify-content: center; margin: 2.2rem 0 1rem; z-index: 1;
}
.year-marker span {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--ink);
  background: var(--bg-alt); padding: .2rem 1rem; border-radius: 999px; border: 3px solid var(--ink);
}
.tl-item { position: relative; width: 50%; padding: .6rem 2.4rem .6rem 0; }
.tl-item.is-right { margin-left: 50%; padding: .6rem 0 .6rem 2.4rem; }
.tl-item::before {
  content: ""; position: absolute; top: 1.9rem; right: -.6rem; width: 1.2rem; height: 1.2rem; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--dot, var(--blue)); z-index: 1;
}
.tl-item.is-right::before { right: auto; left: -.6rem; }
.tl-card {
  background: var(--surface); border-radius: var(--radius); padding: 1.25rem 1.4rem;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  border-top: 5px solid var(--dot, var(--blue));
  transition: transform .3s var(--ease-out), box-shadow .3s;
}
.tl-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tl-card__meta { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin-bottom: .4rem; font-size: .85rem; font-weight: 700; color: var(--ink-3); }
.tag { padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 800; background: color-mix(in srgb, var(--dot) 16%, var(--surface)); color: var(--ink); }
.tl-card h3 { font-size: 1.2rem; margin-bottom: .3rem; }
.tl-card p { margin: 0; color: var(--ink-2); font-size: .98rem; }
.tl-card .star-badge { margin-left: auto; font-size: 1.1rem; }
.tl-item.is-hidden, .year-marker.is-hidden { display: none; }

/* Animación de entrada nativa ligada al scroll, si el navegador la soporta */
@supports (animation-timeline: view()) {
  .tl-card.sda { animation: tl-in linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  @keyframes tl-in { from { opacity: 0; transform: translateY(40px) scale(.96); } }
}

.cat-plataformas { --dot: var(--red); }
.cat-kart { --dot: var(--green); }
.cat-rpg { --dot: #7e57c2; }
.cat-party { --dot: #f59e0b; }
.cat-medios { --dot: var(--blue); }
.cat-hito { --dot: #ec407a; }

@media (max-width: 760px) {
  .timeline::before { left: 1rem; }
  .year-marker { justify-content: flex-start; padding-left: 0; }
  .tl-item, .tl-item.is-right { width: 100%; margin-left: 0; padding: .5rem 0 .5rem 2.6rem; }
  .tl-item::before, .tl-item.is-right::before { left: .4rem; right: auto; }
  .decades { top: 4.4rem; }
}

/* ---------- Bento de récords ---------- */
.bento {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(10.5rem, auto);
  grid-auto-flow: dense;
}
.tile {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: flex-end;
  transition: transform .35s var(--ease-out), box-shadow .35s;
}
.tile:hover { transform: translateY(-5px) rotate(-.4deg); box-shadow: var(--shadow-lg); }
.tile::before {
  content: ""; position: absolute; width: 11rem; height: 11rem; border-radius: 50%; top: -4rem; right: -4rem;
  background: var(--tile); opacity: .14; transition: transform .6s var(--ease-out);
}
.tile:hover::before { transform: scale(1.3); }
.tile__value {
  font-family: var(--font-display); font-weight: 700; line-height: 1; letter-spacing: -.02em;
  font-size: clamp(2.2rem, 1.6rem + 2vw, 3rem); color: var(--ink); font-variant-numeric: tabular-nums;
}
.tile__mark { width: 2.2rem; height: .45rem; border-radius: 4px; background: var(--tile); margin-bottom: .9rem; }
.tile__label { font-weight: 800; color: var(--ink); margin: .5rem 0 .2rem; font-size: 1.02rem; }
.tile__note { font-size: .88rem; color: var(--ink-3); margin: 0; }
.tile--xl { grid-column: span 2; grid-row: span 2; }
.tile--xl .tile__value { font-size: clamp(3.4rem, 2rem + 5vw, 6rem); }
.tile--lg { grid-column: span 2; }
.tile--red { --tile: var(--red); } .tile--green { --tile: var(--green); }
.tile--yellow { --tile: #f2b705; } .tile--blue { --tile: var(--blue); }
@media (max-width: 960px) { .bento { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) {
  .bento { grid-template-columns: 1fr; }
  .tile--xl, .tile--lg { grid-column: auto; grid-row: auto; }
}

/* ---------- Personajes ---------- */
.cards {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr));
}
.pj { transition: opacity .3s, transform .3s var(--ease-out); }
.pj.is-hidden { display: none; }
.pj button {
  width: 100%; text-align: left; cursor: pointer; padding: 1.3rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; gap: .8rem; height: 100%;
  transition: transform .35s var(--ease-bounce), box-shadow .3s;
}
.pj button:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.avatar {
  width: 4.2rem; height: 4.2rem; border-radius: 22px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; color: #fff;
  background: var(--c); box-shadow: inset 0 -6px 0 rgb(0 0 0 / .18);
  text-shadow: 0 2px 0 rgb(0 0 0 / .2);
  transition: transform .4s var(--ease-bounce);
}
.pj button:hover .avatar { transform: rotate(-8deg) scale(1.08); }
.pj__name { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--ink); }
.pj__debut { font-size: .88rem; color: var(--ink-3); font-weight: 600; }
.pj__debut strong { color: var(--ink-2); }

.modal {
  width: min(32rem, calc(100% - 2rem)); border: 0; border-radius: calc(var(--radius) + 6px);
  padding: 2rem; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgb(5 10 30 / .55); backdrop-filter: blur(4px); }
.modal[open] { animation: modal-in .4s var(--ease-bounce); }
@keyframes modal-in { from { opacity: 0; transform: translateY(30px) scale(.94); } }
.modal__close {
  position: absolute; top: 1rem; right: 1rem; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 1.1rem;
}
.modal__avatar { width: 5rem; height: 5rem; font-size: 2.4rem; margin-bottom: 1rem; }
.modal__meta { color: var(--ink-3); font-weight: 700; }
.modal p { color: var(--ink-2); }

/* ---------- Cine / gráfico ---------- */
.chart {
  position: relative; margin: 0 0 2rem; padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.chart figcaption { display: grid; gap: .2rem; margin-bottom: 1.5rem; }
.chart__title { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; }
.chart__sub { color: var(--ink-3); font-size: .9rem; }
.bars { display: grid; gap: 1.1rem; }
.bar-row { display: grid; grid-template-columns: minmax(8rem, 15rem) 1fr; gap: 1rem; align-items: center; }
.bar-row__label { font-weight: 700; font-size: .95rem; color: var(--ink); line-height: 1.3; }
.bar-row__label small { display: block; color: var(--ink-3); font-weight: 600; }
.bar-track { position: relative; display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; cursor: default; }
.bar {
  height: 1.6rem; border-radius: 0 4px 4px 0; background: var(--red);
  width: var(--w); min-width: 3px; transform-origin: left; transform: scaleX(0);
  transition: transform 1.1s var(--ease-out), filter .2s;
}
.bars.is-visible .bar { transform: scaleX(1); }
.bar-track:hover .bar, .bar-track:focus-visible .bar { filter: brightness(1.1); }
.bar-value { font-weight: 800; font-size: .95rem; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; padding: .55rem .8rem; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: .88rem; font-weight: 700; box-shadow: var(--shadow-lg);
  translate: -50% calc(-100% - 10px); white-space: nowrap;
}
.chart__table { margin-top: 1.5rem; }
.chart__table summary { cursor: pointer; font-weight: 700; color: var(--accent); min-height: 2.75rem; display: flex; align-items: center; }
.chart__table table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .95rem; }
.chart__table th, .chart__table td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
.chart__table td:last-child, .chart__table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 1fr; gap: .2rem; } }

.media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.media-card {
  padding: 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.media-card:nth-child(2) { transition-delay: .1s; } .media-card:nth-child(3) { transition-delay: .2s; }
.media-card__tag { display: inline-block; font-size: .8rem; font-weight: 800; padding: .2rem .7rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); margin-bottom: .8rem; }
.media-card p { color: var(--ink-2); margin: 0; }

/* ---------- Trivia ---------- */
.quiz {
  background: var(--surface); border-radius: calc(var(--radius) + 6px); padding: clamp(1.4rem, 1rem + 2vw, 2.5rem);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.quiz__top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; font-weight: 800; color: var(--ink-3); }
.quiz__coins { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink); }
.coin-icon { width: 1.1rem; height: 1.4rem; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6b0, var(--yellow) 45%, #d9a400); box-shadow: inset 0 0 0 2px #b88a00; }
.quiz__bar { height: .6rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-bottom: 1.6rem; }
.quiz__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); border-radius: inherit; transition: width .5s var(--ease-out); }
.quiz__q { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); margin-bottom: 1.2rem; }
.quiz__options { display: grid; gap: .7rem; list-style: none; padding: 0; margin: 0 0 1.2rem; }
.opt {
  width: 100%; min-height: 3.4rem; text-align: left; padding: .8rem 1.1rem; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 1.05rem;
  display: flex; align-items: center; gap: .8rem;
  transition: transform .2s var(--ease-bounce), border-color .2s, background .2s;
}
.opt:hover:not(:disabled) { transform: translateX(4px); border-color: var(--ink-3); }
.opt__key { flex: none; width: 2rem; height: 2rem; border-radius: 8px; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); font-size: .9rem; }
.opt:disabled { cursor: default; }
.opt.is-correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--surface)); }
.opt.is-wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--surface)); animation: shake .4s; }
.opt.is-correct .opt__key { background: var(--green); border-color: var(--green); color: #fff; }
.opt.is-wrong .opt__key { background: var(--red); border-color: var(--red); color: #fff; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.quiz__feedback { min-height: 1.6em; font-weight: 700; margin-bottom: 1rem; }
.quiz__feedback .ok { color: #1f7a26; } .quiz__feedback .ko { color: var(--red-ink); }
:root[data-theme="dark"] .quiz__feedback .ok { color: #7ee08a; } :root[data-theme="dark"] .quiz__feedback .ko { color: #ff8a80; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .quiz__feedback .ok { color: #7ee08a; }
  :root:not([data-theme="light"]) .quiz__feedback .ko { color: #ff8a80; }
}
.quiz__feedback p { margin: .3rem 0 0; font-weight: 600; color: var(--ink-2); }
.quiz__end { text-align: center; }
.quiz__score { font-family: var(--font-display); font-size: clamp(3rem, 2rem + 4vw, 5rem); font-weight: 700; line-height: 1; margin: .5rem 0; }
.quiz__end .btn { margin-top: 1rem; }
.confetti { position: fixed; top: -1rem; width: .7rem; height: 1rem; border-radius: 2px; z-index: 90; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Acordeón ---------- */
.accordion { display: grid; gap: .8rem; }
.acc {
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  overflow: hidden;
}
.acc summary {
  list-style: none; cursor: pointer; padding: 1.1rem 1.3rem; min-height: 3.4rem;
  display: flex; align-items: center; gap: 1rem; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: "+"; margin-left: auto; flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--yellow); color: var(--brown); font-weight: 800; transition: transform .3s var(--ease-bounce);
}
.acc[open] summary::after { transform: rotate(45deg); }
.acc__body { padding: 0 1.3rem 1.2rem; color: var(--ink-2); }
.acc__body p { margin-bottom: .6rem; }
.acc__src { font-size: .88rem; }
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  .acc::details-content { block-size: 0; overflow: hidden; transition: block-size .4s var(--ease-out), content-visibility .4s allow-discrete; }
  .acc[open]::details-content { block-size: auto; }
}

/* ---------- Footer ---------- */
.footer { background: #0b1530; color: #dbe4ff; padding: 4rem 0 3rem; }
.footer a { color: #ffd84d; }
.footer__title { font-size: 1.6rem; }
.sources { columns: 2 16rem; gap: 2rem; padding-left: 1.2rem; margin: 0 0 2rem; }
.sources li { margin-bottom: .5rem; break-inside: avoid; }
.footer__note { font-size: .92rem; color: #aab6dd; max-width: 50rem; margin: 0; }

.to-top {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 40; width: 3.2rem; height: 3.2rem; border-radius: 50%; border: 0;
  background: var(--red); color: #fff; font-size: 1.4rem; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 0 var(--red-ink), var(--shadow-lg); transition: transform .3s var(--ease-bounce);
}
.to-top:hover { transform: translateY(-4px); }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .cloud, .star, .qblock, .scroll-cue span { animation: none !important; }
  .tl-card.sda { animation: none !important; }
  .progress__bar { animation: none !important; }
}

/* ---------- Alto contraste forzado ---------- */
@media (forced-colors: active) {
  .bar { background: CanvasText; }
  .chip[aria-pressed="true"], .toggle[aria-pressed="true"] { outline: 3px solid Highlight; }
}

/* =========================================================
   Imágenes (carátulas, personajes, pósters)
   ========================================================= */

/* Mario en el hero, bajo el bloque "?" */
.hero__mario {
  position: absolute; right: calc(24% - 1rem); bottom: 3.5rem; z-index: 1;
  height: min(16rem, 30vh); width: auto;
  filter: drop-shadow(0 10px 14px rgb(0 0 0 / .22));
  transform-origin: bottom center;
  animation: mario-idle 3.2s ease-in-out infinite;
}
.hero__mario.is-jump { animation: mario-jump .6s var(--ease-out); }
@keyframes mario-idle { 50% { transform: scaleY(.98) translateY(1px); } }
@keyframes mario-jump { 0% { transform: scaleY(.9); } 35% { transform: translateY(-7rem) scaleY(1.04); } 70% { transform: translateY(-1rem); } 100% { transform: none; } }
@media (max-width: 860px) {
  .hero__mario { right: calc(40% - .6rem); height: 6.5rem; }
}

/* Cronología con carátula */
.tl-card--cover { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1.1rem; align-items: start; }
.tl-cover {
  padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 4px rgb(0 0 0 / .12), 0 8px 18px rgb(0 0 0 / .14);
  transition: transform .35s var(--ease-bounce), box-shadow .3s;
  rotate: -2deg;
}
.tl-item.is-right .tl-cover { rotate: 2deg; }
.tl-cover img { width: 100%; height: auto; display: block; background: var(--surface-2); }
.tl-cover:hover, .tl-cover:focus-visible { transform: scale(1.08); rotate: 0deg; box-shadow: var(--shadow-lg); }
.tl-card__body { min-width: 0; }
@media (max-width: 420px) { .tl-card--cover { grid-template-columns: 4.2rem 1fr; gap: .8rem; } }

/* Visor de carátulas */
.lightbox {
  border: 0; padding: 1.2rem; border-radius: var(--radius); background: var(--surface); color: var(--ink);
  max-width: min(30rem, calc(100% - 2rem)); box-shadow: var(--shadow-lg);
}
.lightbox::backdrop { background: rgb(5 10 30 / .7); backdrop-filter: blur(6px); }
.lightbox[open] { animation: modal-in .4s var(--ease-bounce); }
.lightbox img { width: 100%; height: auto; max-height: 75vh; object-fit: contain; border-radius: 10px; }
.lightbox p { margin: .8rem 2.5rem 0 0; font-family: var(--font-display); font-weight: 600; }
.lightbox .modal__close { z-index: 2; }

/* Personajes con render oficial */
.pj .avatar { width: 100%; height: 11rem; border-radius: 16px; overflow: hidden; position: relative; isolation: isolate;
  background: radial-gradient(circle at 50% 110%, color-mix(in srgb, var(--c) 55%, var(--surface)) 0 45%, color-mix(in srgb, var(--c) 16%, var(--surface)) 46%);
  box-shadow: none; }
.avatar img { width: 100%; height: 100%; object-fit: contain; padding: .6rem .4rem 0; filter: drop-shadow(0 6px 8px rgb(0 0 0 / .2));
  transition: transform .45s var(--ease-bounce); }
.pj button:hover .avatar { transform: none; }
.pj button:hover .avatar img { transform: translateY(-6px) scale(1.06) rotate(-3deg); }
.modal__avatar.avatar { width: 100%; height: 16rem; border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 50% 110%, color-mix(in srgb, var(--c) 55%, var(--surface)) 0 45%, color-mix(in srgb, var(--c) 16%, var(--surface)) 46%);
  box-shadow: none; font-size: 3rem; }

/* Pósters en el gráfico */
.bar-row__label { display: flex; align-items: center; gap: .8rem; }
.bar-row__poster { width: 2.6rem; height: auto; border-radius: 6px; box-shadow: 0 2px 6px rgb(0 0 0 / .2); flex: none; }

@media (prefers-reduced-motion: reduce) {
  .hero__mario { animation: none !important; }
}

/* Estrella de hito fija en la esquina de la tarjeta */
.tl-card { position: relative; }
.tl-card .star-badge { position: absolute; top: .9rem; right: 1rem; margin: 0; }
.tl-card:has(.star-badge) .tl-card__meta { padding-right: 1.8rem; }

/* La imagen ocupa toda la caja del avatar y se ve completa */
.avatar img { position: absolute; inset: 0; z-index: 1; }

/* Dos personajes por fila en móvil */
@media (max-width: 560px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .pj button { padding: .8rem; gap: .5rem; }
  .pj .avatar { height: 9rem; }
  .pj__name { font-size: 1.1rem; }
  .pj__debut { font-size: .8rem; }
}
