/* Estimario — el deslizador es una cinta métrica: amarillo de cinta, tinta azul noche y un
   marcador coral para la cifra real. Una sola columna centrada; el juego manda en la página. */
@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --bg: #eef1fa;
  --surface: #ffffff;
  --surface-2: #e4e8f6;
  --ink: #0e1333;
  --muted: #555e85;
  --line: #cfd5ea;
  --tape: #ffd426;
  --tape-deep: #f2bd00;
  --tape-ink: #1c1700;
  --real: #ff4f3d;
  --link: #2a35d6;
  --p4: #16a566; --p3: #e3b400; --p2: #f0862a; --p1: #e2463f;
  --shadow: 5px 5px 0 var(--ink);
  --radius: 18px;
  --display: "Bricolage Grotesque", "Arial Black", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e24;
    --surface: #141a3b;
    --surface-2: #1d2450;
    --ink: #f1f3ff;
    --muted: #a2abd6;
    --line: #2b3366;
    --tape-deep: #d9a900;
    --real: #ff6a5a;
    --link: #9fb0ff;
    --shadow: 5px 5px 0 #000413;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--body); }
main { overflow-x: clip; min-height: 60vh; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 6.4vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 4vw, 1.8rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* Cabecera */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 2px solid var(--ink); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 1.35rem/1 var(--display); letter-spacing: -0.03em; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 999px; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.nav-toggle { display: none; background: none; border: 2px solid var(--ink); color: var(--ink); border-radius: 10px; padding: 6px 8px; cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; background: var(--surface); border-bottom: 2px solid var(--ink); padding: 10px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 1.05rem; }
}

/* Escenario del juego */
.stage { max-width: 640px; margin: 0 auto; padding-block: clamp(22px, 5vw, 44px) 12px; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-weight: 600; font-size: .95rem; color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 34em; }
.juego { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 4vw, 26px); margin-top: 8px; display: flex; flex-direction: column; gap: 16px; min-height: 420px; }
.cargando, .aviso { color: var(--muted); }
.aviso { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }

.g-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-size: .9rem; }
.g-dots { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.g-dots li { width: 26px; height: 10px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid var(--line); }
.g-dots li.act { border-color: var(--ink); background: var(--tape); }
.g-dots li.t4 { background: var(--p4); border-color: var(--p4); }
.g-dots li.t3 { background: var(--p3); border-color: var(--p3); }
.g-dots li.t2 { background: var(--p2); border-color: var(--p2); }
.g-dots li.t1 { background: var(--p1); border-color: var(--p1); }
.g-total { font-variant-numeric: tabular-nums; }
.g-cat { align-self: flex-start; font-weight: 700; font-size: .88rem; background: var(--ink); color: var(--bg); padding: 3px 11px; border-radius: 999px; }
.g-q { font-size: clamp(1.35rem, 5vw, 1.85rem); font-weight: 700; }
.g-num { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font: 800 clamp(2.6rem, 13vw, 4.4rem)/1 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.g-num small { font: 600 1rem/1.2 var(--body); letter-spacing: 0; color: var(--muted); }

/* La cinta métrica */
.tape { position: relative; height: 64px; margin-top: 6px; border: 2px solid var(--ink); border-radius: 12px; background: linear-gradient(var(--tape), var(--tape-deep)); touch-action: pan-y; }
.tape:has(input:focus-visible) { outline: 3px solid var(--link); outline-offset: 3px; }
.tape input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.tape input:disabled { cursor: default; }
.tick { position: absolute; top: 0; width: 2px; margin-left: -1px; height: 14px; background: var(--tape-ink); opacity: .55; pointer-events: none; }
.tick.may { height: 24px; opacity: .9; }
.tick-l { position: absolute; top: 26px; transform: translateX(-50%); font: 700 .74rem/1 var(--body); color: var(--tape-ink); white-space: nowrap; pointer-events: none; }
.tick-l.ini { transform: none; margin-left: 6px; }
.tick-l.fin { transform: translateX(-100%); margin-left: -6px; }
.mark { position: absolute; top: -8px; bottom: -8px; width: 0; pointer-events: none; }
.mark::before { content: ""; position: absolute; left: -2.5px; top: 0; bottom: 0; width: 5px; border-radius: 3px; background: var(--ink); }
.mark::after { content: ""; position: absolute; left: -11px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 4px solid var(--ink); }
.mark.real::before { background: var(--real); }
.mark.real::after { border-color: var(--real); top: -4px; bottom: auto; }
.gap { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--real) 34%, transparent); pointer-events: none; }
.tape-key { display: flex; gap: 18px; font-size: .88rem; font-weight: 600; color: var(--muted); margin-top: 6px; }
.tape-key i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--ink); margin-right: 6px; vertical-align: -1px; }
.tape-key i.real { border-color: var(--real); }

.g-actions { display: flex; gap: 10px; align-items: stretch; margin-top: 4px; }
.btn { flex: 1; font: 700 1.08rem/1 var(--body); color: var(--bg); background: var(--ink); border: 2px solid var(--ink); border-radius: 14px; padding: 16px 20px; cursor: pointer; text-decoration: none; text-align: center; transition: transform .08s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.alt { background: var(--tape); color: var(--tape-ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.nudge { width: 54px; flex: none; font: 800 1.5rem/1 var(--display); background: var(--surface); color: var(--ink); border: 2px solid var(--ink); border-radius: 14px; cursor: pointer; }
.nudge:hover { background: var(--surface-2); }
.g-hint { font-size: .9rem; color: var(--muted); }

/* Resultado de una pregunta */
.g-res { display: flex; flex-direction: column; gap: 12px; border-top: 2px dashed var(--line); padding-top: 16px; }
.g-pts { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.g-pts b { font: 800 2.6rem/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.g-pts span { font-weight: 700; font-size: 1.1rem; }
.g-pts.t4 b { color: var(--p4); } .g-pts.t3 b { color: var(--p3); } .g-pts.t2 b { color: var(--p2); } .g-pts.t1 b { color: var(--p1); }
.g-real { font-size: 1.1rem; }
.g-real strong { font-family: var(--display); font-size: 1.3rem; }
.g-dato { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.fuente { font-size: .84rem; color: var(--muted); }
.g-link { font-weight: 600; }

/* Pantalla final */
.fin-total { font: 800 clamp(3.4rem, 17vw, 5.6rem)/0.95 var(--display); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.fin-total small { font: 700 1.3rem/1 var(--body); letter-spacing: 0; color: var(--muted); }
.fin-veredicto { font: 700 1.35rem/1.2 var(--display); }
.tiles { display: flex; gap: 8px; }
.tiles i { width: 38px; height: 38px; border-radius: 9px; border: 2px solid var(--ink); }
.tiles .t4 { background: var(--p4); } .tiles .t3 { background: var(--p3); } .tiles .t2 { background: var(--p2); } .tiles .t1 { background: var(--p1); }
.fin-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.kpi b { display: block; font: 800 1.5rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.kpi span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.fin-next { font-weight: 600; }
.fin-next b { font-variant-numeric: tabular-nums; }
.repaso { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.repaso details { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.repaso summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; font-weight: 600; }
.repaso summary i { flex: none; width: 14px; height: 14px; border-radius: 4px; align-self: center; }
.repaso summary b { margin-left: auto; font-variant-numeric: tabular-nums; }
.repaso p { margin-top: 8px; font-size: .95rem; }
.copiado { font-weight: 700; color: var(--p4); }
.copiado:empty { display: none; }
.fin-total:focus { outline: none; }
.share-box { width: 100%; font: inherit; border: 2px solid var(--ink); border-radius: 12px; padding: 10px; background: var(--surface-2); color: var(--ink); resize: none; }

/* Texto */
.prose { max-width: 640px; margin: 0 auto; padding-block: 26px; display: flex; flex-direction: column; gap: 14px; }
.prose h1 { margin-bottom: 4px; }
.prose h2 { margin-top: 14px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 6px; }
.pasos { counter-reset: paso; list-style: none; padding: 0 !important; gap: 10px !important; }
.pasos li { counter-increment: paso; display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start; }
.pasos li::before { content: counter(paso); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--tape); color: var(--tape-ink); border: 2px solid var(--ink); font: 800 1.1rem/1 var(--display); }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1.5px solid var(--line); vertical-align: top; }
th { font-weight: 700; }
.callout { background: var(--surface); border: 2px solid var(--ink); border-radius: 14px; padding: 14px 16px; }
details.faq, .soluciones { border: 2px solid var(--ink); border-radius: 14px; padding: 12px 16px; background: var(--surface); }
details.faq summary, .soluciones > summary { cursor: pointer; font-weight: 700; }
details.faq p { margin-top: 8px; }
.soluciones ol { margin-top: 12px; gap: 16px; }
.sol-q { font-weight: 700; }
.sol-v { font: 800 1.4rem/1.2 var(--display); }
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 600; margin-top: 8px; }

/* Archivo */
.archivo { list-style: none; padding: 0 !important; gap: 8px !important; }
.archivo a { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
.archivo a:hover { border-color: var(--ink); }
.archivo .a-n { font-family: var(--display); font-weight: 800; }
.archivo .a-f::first-letter { text-transform: uppercase; }
.archivo .a-p { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .92rem; }
.archivo .a-p.hecho { color: var(--ink); background: var(--tape); color: var(--tape-ink); border-radius: 999px; padding: 2px 10px; }
.archivo .vacio { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } .archivo a { grid-template-columns: 56px 1fr; } .archivo .a-p { grid-column: 2; } }

/* Pie */
.site-footer { margin-top: 40px; border-top: 2px solid var(--ink); background: var(--surface); padding-block: 28px 18px; font-size: .93rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 24px; }
.footer-grid > div { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.footer-grid a { color: var(--ink); text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; }
.brand-foot { font: 800 1.25rem/1 var(--display); letter-spacing: -0.03em; }
.foot-title { font-weight: 700; color: var(--muted); }
.copy { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; padding-top: 14px; border-top: 1.5px solid var(--line); font-size: .86rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > div:first-child { grid-column: 1 / -1; } }
@media (max-width: 420px) { .footer-grid { grid-template-columns: 1fr; } }

/* Movimiento */
@media (prefers-reduced-motion: no-preference) {
  .mark { transition: left .12s ease-out; }
  .mark.real, .gap { animation: aparece .5s cubic-bezier(.2, .9, .3, 1.2) both; }
  @keyframes aparece { from { opacity: 0; transform: scaleY(.3); } to { opacity: 1; transform: none; } }
}
