/* ¿Quién fue? Papel blanco, tinta, un amarillo de marcador. Sin tema oscuro. */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #14171a;
  --graphite: #5b6168;
  --rule: #d6d9dd;
  --wash: #f1f2f4;
  --marker: #ffd92e;
  --good: #176a40;
  --bad: #a3211b;
  --f-ui: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-read: "Source Serif 4", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#app {
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-x: clip;
}
.screen { display: flex; flex-direction: column; flex: 1; min-height: 0; }
[hidden] { display: none !important; }
a { color: inherit; }

/* ── Textos base ──────────────────────────────────────── */
.lede { font-family: var(--f-read); font-size: 20px; line-height: 1.4; margin: 0 0 16px; max-width: 30ch; }
.note { font-family: var(--f-read); font-size: 16.5px; line-height: 1.45; color: var(--graphite); margin: 0 0 16px; }
.fineprint { font-size: 12.5px; line-height: 1.45; color: var(--graphite); margin: 16px 0 0; }

/* ── Botones ──────────────────────────────────────────── */
.btn {
  appearance: none; font: inherit; font-weight: 700; font-size: 16px;
  min-height: 50px; padding: 12px 20px; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 4px;
}
.btn.solid { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ── Juego: cabecera ──────────────────────────────────── */
.hud { padding-top: 4px; }
.ticks { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.ticks i { height: 5px; background: var(--rule); }
.ticks i.done { background: var(--ink); }
.ticks i.now { background: var(--marker); outline: 1.5px solid var(--ink); outline-offset: -1.5px; }
.hud-text { margin: 8px 0 0; font-size: 13.5px; color: var(--graphite); display: flex; justify-content: space-between; }

/* ── Pila de cartas ───────────────────────────────────── */
.stack:focus { outline: none; }
.kbd .stack:focus-visible { outline: 2px solid var(--graphite); outline-offset: 4px; }
.stack:focus-visible { outline: none; }
.stack { position: relative; flex: 1; min-height: 360px; margin: 14px 0 12px; padding-top: 30px; touch-action: none; }
.card {
  position: absolute; inset: 30px 0 0 0;
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 6px;
  padding: 22px 20px 18px;
  display: flex; flex-direction: column; gap: 16px;
  user-select: none; -webkit-user-select: none; touch-action: none; cursor: grab;
  will-change: transform; transition: transform .22s ease, opacity .22s ease;
}
.card.dragging { transition: none; cursor: grabbing; }
.card.behind { transform: translateY(10px) scale(.965); pointer-events: none; }
.card.behind > * { visibility: hidden; }
.tab {
  position: absolute; left: -1.5px; top: -31px; height: 31px; padding: 0 12px;
  display: flex; align-items: center;
  background: var(--paper); border: 1.5px solid var(--ink); border-bottom: 0; border-radius: 6px 6px 0 0;
  font-size: 13px; font-weight: 700;
}
.card .q {
  font-family: var(--f-read); font-weight: 600; font-size: clamp(17px, 5.6vw, 24px); line-height: 1.3;
  margin: 0; flex: 1; overflow: auto; touch-action: none; text-wrap: pretty;
}
/* Pista: tres datos grandes, centrados y separados, en el centro de la carta */
.card.has-pista .q { flex: none; font-size: clamp(16px, 4.9vw, 21px); line-height: 1.28; overflow: visible; }
.pista { margin: auto 0; min-height: 0; text-align: center; }
.pista-h { margin: 0 0 10px; font-size: 14px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase; color: var(--ink); }
.pista ul { list-style: none; margin: 0; padding: 0; display: grid; border-block: 2px solid var(--ink); }
.pista li { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: clamp(8px, 1.6vh, 14px) 6px; border-top: 1.5px solid var(--rule); }
.pista li:first-child { border-top: 0; }
.pista .k { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--graphite); }
.pista .v { font-family: var(--f-ui); font-stretch: 112%; font-size: clamp(21px, 6.4vw, 28px); font-weight: 900; line-height: 1.1; letter-spacing: -.01em; overflow-wrap: anywhere; }
.pista .v.warn { background: var(--marker); padding: 1px 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 0; padding: 0; margin: 0; list-style: none; font-size: 13px; font-weight: 600; }
.meta li { padding: 0 10px; border-left: 1.5px solid var(--ink); }
.meta li:first-child { padding-left: 0; border-left: 0; }
.meta li.warn { background: var(--marker); border-left: 0; margin-left: 10px; padding: 1px 7px; }
.meta li.warn:first-child { margin-left: 0; }

.stamp {
  position: absolute; top: 20px; padding: 5px 13px; border: 3px solid var(--ink); border-radius: 4px;
  font-weight: 900; font-stretch: 110%; font-size: 24px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink); background: rgba(255, 255, 255, .92); opacity: 0; pointer-events: none;
}
.stamp.izq { left: 14px; transform: rotate(-10deg); }
.stamp.der { right: 14px; transform: rotate(10deg); }

/* Carta de instrucciones (portada) */
.card.tutorial { gap: 10px; overflow-y: auto; touch-action: pan-y; }
.card.tutorial .q { font-family: var(--f-ui); font-size: clamp(25px, 7.6vw, 34px); font-stretch: 112%; font-weight: 900; letter-spacing: -.03em; line-height: .95; flex: none; font-style: normal; touch-action: pan-y; }
.tutorial .lede { font-size: 16px; line-height: 1.35; margin: 0; max-width: none; }
.tutorial .how { gap: 4px; font-size: 15.5px; }
.tutorial .how li { grid-template-columns: 30px 1fr; gap: 10px; }
.tutorial .how svg { width: 26px; height: 26px; }
.tutorial .note { font-size: 13.5px; line-height: 1.38; margin: 0; color: var(--ink); }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-family: var(--f-read); font-size: 18px; line-height: 1.35; }
.how li { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; }
.how svg { width: 38px; height: 38px; }
.how b { font-family: var(--f-ui); font-weight: 800; }
.tutorial .go { margin: auto 0 0; font-size: 14.5px; font-weight: 700; padding-top: 10px; border-top: 1.5px solid var(--ink); }

/* ── Controles ────────────────────────────────────────── */
.controls { display: flex; justify-content: center; gap: 12px; }
.controls .btn { flex: 1 1 0; max-width: 200px; min-width: 0; padding-inline: 8px; }
.bulo-btn { background: var(--marker); }
.hint { text-align: center; margin-top: 10px; }
.about-link { text-align: center; margin: 4px 0 0; }

/* ── Hoja de respuesta ────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(20, 23, 26, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet-inner {
  width: 100%; max-width: 520px; max-height: 94dvh; overflow: auto;
  background: var(--paper); border-top: 1.5px solid var(--ink); border-radius: 12px 12px 0 0;
  padding: 0;
  animation: rise .26s ease;
}
@keyframes rise { from { transform: translateY(36px); opacity: 0; } to { transform: none; opacity: 1; } }
.fig { position: relative; margin: 0; background: var(--wash); border-bottom: 1.5px solid var(--ink); }
.fig img { display: block; width: 100%; height: 210px; object-fit: cover; object-position: center 35%; }
.fig.empty { height: 120px; }
.fig figcaption { position: absolute; right: 0; bottom: 0; max-width: 78%; padding: 3px 8px; background: rgba(255, 255, 255, .92); font-size: 12.5px; color: var(--graphite); }
.fig figcaption a { color: inherit; }
.seal {
  position: absolute; right: 14px; top: 14px;
  padding: 4px 13px; border: 3px solid; border-radius: 4px; background: rgba(255, 255, 255, .94);
  font-weight: 900; font-stretch: 112%; font-size: 24px; letter-spacing: .04em; text-transform: uppercase;
  transform: rotate(-6deg); animation: thump .24s ease-out both;
}
.seal.ok { color: var(--good); } .seal.ko { color: var(--bad); }
@keyframes thump { from { transform: rotate(-6deg) scale(1.5); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.sheet-body { padding: 18px 18px 0; }
.verdict { font-weight: 900; font-stretch: 112%; font-size: 27px; line-height: 1.08; letter-spacing: -.01em; margin: 0 0 10px; }
.story { font-family: var(--f-read); font-size: 18px; line-height: 1.6; margin: 0 0 16px; text-wrap: pretty; }
.facts-h { font-size: 14px; font-weight: 800; margin: 0 0 6px; padding-top: 12px; border-top: 1.5px solid var(--ink); }
.facts { margin: 0 0 12px; padding-left: 18px; font-size: 15px; line-height: 1.45; }
.facts li { margin: 0 0 6px; }
.srcs { font-size: 13px; color: var(--graphite); margin: 0 0 16px; }
.srcs a { color: var(--ink); display: inline-block; padding: 6px 0; }
.sheet-actions {
  display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px;
  position: sticky; bottom: 0; z-index: 1;
  margin: 0 -18px; padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1.5px solid var(--rule);
}
.sharebar { margin: 0; padding: 12px 0 20px; font-size: 12.5px; color: var(--graphite); text-align: center; word-break: break-all; }

/* ── Resumen ──────────────────────────────────────────── */
#screen-end h2 { font-weight: 900; font-stretch: 118%; font-size: 30px; line-height: 1; margin: 26px 0 12px; }
.tally { display: flex; align-items: baseline; gap: 10px; margin: 0 0 4px; }
.tally .big { font-weight: 900; font-stretch: 125%; font-size: 92px; line-height: .9; letter-spacing: -.04em; }
.tally .of { font-family: var(--f-read); font-size: 22px; }
.misses { font-family: var(--f-read); font-size: 20px; margin: 0 0 22px; }
.lean-h { font-size: 14px; font-weight: 800; margin: 0 0 8px; padding-top: 12px; border-top: 1.5px solid var(--ink); }
.bars { display: grid; gap: 7px; margin: 0 0 12px; }
.bar { display: grid; grid-template-columns: 74px 1fr 22px; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.bar span.track { height: 14px; background: var(--wash); }
.bar span.fill { display: block; height: 100%; background: var(--ink); }
.lean { font-family: var(--f-read); font-size: 18px; line-height: 1.5; margin: 0 0 6px; }
.lean-note { font-size: 12.5px; color: var(--graphite); margin: 0 0 20px; }
.callout { padding: 14px 16px; margin: 0 0 20px; background: var(--marker); border: 1.5px solid var(--ink); font-family: var(--f-read); font-size: 18px; line-height: 1.45; }
.callout b { font-family: var(--f-ui); font-weight: 900; }
.end-actions { display: grid; gap: 10px; margin-top: auto; }

.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 4px; font-size: 14px; z-index: 40; }

/* Móviles bajos (p. ej. 320x568): más compacto para que no se recorte la pregunta */
@media (max-height: 600px) {
  .stack { margin: 6px 0; }
  .card { padding: 14px 16px 12px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .sheet-inner, .seal { transition: none !important; animation: none !important; }
}
.stamp.bulo { left: 50%; top: 14px; transform: translateX(-50%) rotate(-3deg); background: var(--marker); }
.bar.bulo span.fill { background: var(--marker); outline: 1.5px solid var(--ink); outline-offset: -1.5px; }
