/* La Chispa Perdida — hoja de estilos única, sin dependencias externas.
   El juego pasa de noche: el sitio es oscuro a propósito, en cualquier sistema. */

:root {
  color-scheme: dark;
  --bg:       #0d0b1a;
  --bg-2:     #151130;
  --surface:  #1a1535;
  --surface-2:#231c46;
  --ink:      #efeafc;
  --ink-2:    #c3badf;
  --muted:    #9187b3;
  --line:     #2f2758;
  --spark:    #7dfc9a;
  --spark-d:  #3fcf69;
  --lamp:     #f4c979;
  --lamp-d:   #d9a44a;
  --rose:     #ff8fc7;
  --radius:   16px;
  --wrap:     1160px;
  --sans:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif:    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--lamp); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--spark); }
kbd { font-family: ui-monospace, Menlo, monospace; font-size: .85em; background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: .05em .4em; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-family: var(--serif); font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 700; }
h2 { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 700; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 28px; } }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--spark); margin: 0 0 .8em; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--lamp); color: #1a1200; padding: 8px 14px; border-radius: 8px; z-index: 20; }
.skip:focus { left: 8px; }

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

/* ---------- encabezado ---------- */

.site-header { position: sticky; top: 0; z-index: 10; background: rgba(13, 11, 26, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,.06); }
.site-header__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand__mark { color: var(--lamp); display: grid; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-family: var(--serif); font-size: 1.12rem; }
.brand__text small { color: var(--muted); font-size: .78rem; }

.nav { display: flex; align-items: center; gap: 6px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.nav a.nav__play { background: var(--spark); color: #06220f; }
.nav a.nav__play:hover { background: #a3ffb8; color: #06220f; }
@media (max-width: 420px) { .brand__text small { display: none; } }

/* ---------- botones ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 24px; border-radius: 999px; font-weight: 700; font-size: 1rem; text-decoration: none; border: 2px solid transparent; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn--spark { background: var(--spark); color: #06220f; box-shadow: 0 0 0 0 rgba(125, 252, 154, .5), 0 10px 30px -10px rgba(125, 252, 154, .6); }
.btn--spark:hover { color: #06220f; background: #a3ffb8; transform: translateY(-1px); box-shadow: 0 0 0 6px rgba(125, 252, 154, .15), 0 14px 34px -10px rgba(125, 252, 154, .7); }
.btn--ghost { border-color: rgba(255,255,255,.22); color: var(--ink); }
.btn--ghost:hover { border-color: var(--lamp); color: var(--lamp); }

/* ---------- portada ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(13,11,26,.92) 38%, rgba(13,11,26,.35) 70%, rgba(13,11,26,.2) 100%),
    var(--hero) right center / cover no-repeat,
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 120px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.hero__in { position: relative; z-index: 1; padding-top: clamp(56px, 10vw, 120px); padding-bottom: clamp(64px, 10vw, 120px); }
.hero h1 { max-width: 12ch; text-shadow: 0 2px 30px rgba(0,0,0,.6); }
.hero__lead { max-width: 34rem; font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; }
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 0; margin: 36px 0 0; color: var(--ink-2); font-size: .95rem; }
.facts strong { color: var(--lamp); font-size: 1.25rem; font-family: var(--serif); margin-right: 4px; }
@media (max-width: 700px) {
  .hero { background: linear-gradient(180deg, rgba(13,11,26,.1) 0%, rgba(13,11,26,.2) 40%, rgba(13,11,26,.92) 68%, var(--bg) 82%), var(--hero-m) center top / 100% auto no-repeat, var(--bg); }
  .hero__in { padding-top: 88vw; }
}

.section { padding-top: clamp(56px, 8vw, 96px); padding-bottom: 8px; }
.section__head { max-width: 42rem; margin-bottom: 32px; }
.section__head p:last-child { margin-bottom: 0; }

.cast { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 520px) {
  .cast { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card__body { padding: 12px 12px 14px; }
  .card__body h3 { font-size: 1.05rem; }
  .card__body p { font-size: .85rem; }
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--spark-d); }
.card img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.card__body { padding: 16px 18px 20px; }
.card__body h3 { margin-bottom: .35em; font-family: var(--serif); font-size: 1.25rem; }
.card__body p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.card__body .card__place { color: var(--spark); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }

.steps { list-style: none; counter-reset: paso; padding: 0; margin: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps li { counter-increment: paso; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: relative; }
.steps li::before { content: counter(paso); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--lamp); color: #231800; font-weight: 800; margin-bottom: 14px; }
.steps p { color: var(--ink-2); margin: 0; }

.faq { max-width: 46rem; display: grid; gap: 10px; }
.faq details { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 0 20px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 16px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--spark); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--ink-2); padding-bottom: 6px; }

.cta { text-align: center; padding-bottom: 40px; }
.cta .btn { margin-top: 8px; }

/* ---------- páginas de texto ---------- */

.pagehead { padding: clamp(48px, 8vw, 88px) 0 8px; background: radial-gradient(ellipse at 20% 0%, rgba(125,252,154,.10), transparent 60%); }
.pagehead h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.pagehead__lead { color: var(--ink-2); font-size: 1.15rem; max-width: 40rem; }
.prose { max-width: 44rem; }
.prose h2 { font-size: 1.5rem; margin-top: 1.8em; }
.prose p, .prose li { color: var(--ink-2); }
.prose strong { color: var(--ink); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }

/* ---------- pie ---------- */

.site-footer { margin-top: clamp(64px, 10vw, 110px); border-top: 1px solid var(--line); background: var(--bg-2); padding: 40px 0 28px; font-size: .95rem; }
.site-footer__grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .site-footer__grid { grid-template-columns: 2fr 1fr; } }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--spark); }
.site-footer__legal { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .85rem; }
.site-footer__legal p { margin: 0 0 .4em; }

/* ---------- juego ---------- */

.is-game .site-footer { margin-top: 40px; }

.game {
  --tint: var(--spark);
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 24px 16px 0;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 861px) {
  .game { grid-template-columns: minmax(280px, 5fr) minmax(0, 7fr); padding: 32px 28px 0; align-items: start; }
  .game__art { position: sticky; top: 88px; }
}
.game[data-mundo="capitan"]    { --tint: #f6d24a; }
.game[data-mundo="gallina"]    { --tint: #ffb35c; }
.game[data-mundo="cientifico"] { --tint: #ff8fc7; }
.game[data-mundo="pastelero"]  { --tint: #e59cff; }
.game[data-mundo="zeus"]       { --tint: #8cc8ff; }
.game[data-mundo="faro"]       { --tint: var(--lamp); }

.game__art { margin: 0; position: relative; border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px -30px color-mix(in srgb, var(--tint) 55%, transparent); transition: box-shadow .6s ease; }
.game__art img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; transition: opacity .35s ease, transform .6s ease; }
.game__art img.is-changing { opacity: 0; transform: scale(1.02); }
@media (max-width: 860px) { .game__art img { aspect-ratio: 1; object-position: center 62%; } }
.game__chapter { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 14px; background: linear-gradient(transparent, rgba(8,6,20,.92)); font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tint); }

.game__panel { min-width: 0; }

.game__status { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 22px; }
.sparks { display: flex; align-items: center; gap: 7px; }
.spark { width: 16px; height: 16px; border-radius: 50%; border: 2px dashed #4a4180; }
.spark.is-on { border: 0; background: radial-gradient(circle, #eaffef 0 22%, var(--spark) 45%, rgba(125,252,154,.0) 72%); box-shadow: 0 0 12px var(--spark); }
.spark.is-prisa { background: radial-gradient(circle, #fff5dc 0 22%, var(--lamp-d) 45%, rgba(0,0,0,0) 72%); box-shadow: 0 0 10px var(--lamp-d); }
.sparks__n { margin-left: 4px; font-weight: 700; color: var(--ink-2); font-size: .9rem; }
.bag { display: flex; flex-wrap: wrap; gap: 6px; }
.item { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.item.is-used { opacity: .45; text-decoration: line-through; }
.item--empty { background: transparent; color: var(--muted); }

.game__text { font-family: var(--serif); font-size: clamp(1.08rem, 1.5vw, 1.2rem); line-height: 1.7; scroll-margin-top: 80px; }
.game__text p { margin: 0 0 1em; }
.game__text em { color: var(--ink); }
.game__text.is-in p { animation: aparecer .5s ease both; }
.game__text.is-in p:nth-child(2) { animation-delay: .06s; }
.game__text.is-in p:nth-child(3) { animation-delay: .12s; }
.game__text.is-in p:nth-child(4) { animation-delay: .18s; }
.game__text.is-in p:nth-child(n+5) { animation-delay: .24s; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pista { display: block; font-family: var(--sans); font-size: .95rem; line-height: 1.7; background: var(--bg-2); border-left: 3px solid var(--tint); padding: 12px 16px; border-radius: 0 10px 10px 0; color: var(--ink-2); }
.ritmo { display: inline-block; font-family: var(--sans); letter-spacing: .08em; color: var(--tint); font-size: 1.1rem; }
.final { display: block; font-family: var(--sans); margin-top: .6em; padding: 14px 18px; border-radius: 12px; background: color-mix(in srgb, var(--lamp) 14%, transparent); border: 1px solid color-mix(in srgb, var(--lamp) 40%, transparent); color: var(--ink-2); }
.final strong { color: var(--lamp); }
.game[data-final="derrota"] .game__art { filter: saturate(.5) brightness(.7); }

.game__choices { display: grid; gap: 10px; margin-top: 10px; }
.choice { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; font: inherit; font-size: 1rem; line-height: 1.45; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.choice:hover { border-color: var(--tint); background: var(--surface-2); transform: translateX(3px); }
.choice__n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); color: var(--tint); font-size: .85rem; font-weight: 800; }
.choice:hover .choice__n { background: var(--tint); color: #120e25; }

.game__tools { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.linkbtn { font: inherit; font-size: .88rem; background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--ink); }
.linkbtn[hidden] { display: none; }
