/* ============================================================================
   Seiyuu Streak — estilos
   Mobile-first, minimalista. Tema oscuro por defecto + claro automático.
   ========================================================================== */

:root {
  --bg: #0e0f14;
  --surface: #171922;
  --surface-2: #1f2230;
  --border: #2a2e40;
  --text: #eef0f6;
  --muted: #9aa0b4;
  --accent: #ff7a59;
  --accent-soft: rgba(255, 122, 89, 0.14);
  --ok: #3ecf8e;
  --bad: #ff5470;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f9;
    --surface: #ffffff;
    --surface-2: #eef0f6;
    --border: #e2e4ee;
    --text: #191b24;
    --muted: #626880;
    --accent: #e85d3d;
    --accent-soft: rgba(232, 93, 61, 0.1);
    --shadow: 0 4px 20px rgba(25, 27, 36, 0.08);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* ---------- Pantallas ---------- */
.screen {
  max-width: 700px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px);
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen[hidden] { display: none; }

/* ---------- Carga ---------- */
#screen-loading {
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--muted);
}

.loader {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inicio ---------- */
#screen-home {
  justify-content: center;
  gap: clamp(20px, 4vh, 36px);
  text-align: center;
}

.kicker {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.logo {
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.05;
}

.logo-accent { color: var(--accent); display: block; }

.stats-row {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 3vw, 20px);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px clamp(12px, 4vw, 26px);
  min-width: 90px;
}

.stat-value {
  display: block;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 800;
  color: var(--accent);
}

.stat-big .stat-value { font-size: clamp(2.2rem, 9vw, 3.2rem); }

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Botones ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  border-radius: 999px;
  padding: 16px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: min(100%, 320px);
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: min(100%, 320px);
  margin: 0 auto;
}

.btn-ghost:hover { color: var(--text); }

/* ---------- Cómo se juega ---------- */
.howto {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: left;
  font-size: 0.92rem;
  color: var(--muted);
}

.howto summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style-position: inside;
}

.howto ol { margin: 12px 0 4px 22px; display: grid; gap: 8px; }
.howto strong { color: var(--text); }

.credits { font-size: 0.78rem; color: var(--muted); }
.credits a { color: inherit; }

/* ---------- HUD ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 16px;
}

.hud-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 1.05rem;
}

.hud-streak {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hud-streak.bump { animation: bump 0.35s ease; }

@keyframes bump {
  30% { transform: scale(1.18); }
}

.hud-label {
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.hud-dim { margin-left: auto; color: var(--muted); }
.hud-icon { font-size: 0.95rem; }

/* ---------- Tarjeta del seiyuu ---------- */
.seiyuu-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  animation: slide-in 0.3s ease;
}

.anchor-img {
  width: clamp(84px, 22vw, 120px);
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.seiyuu-label {
  font-size: 0.68rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.seiyuu-name {
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  font-weight: 800;
  line-height: 1.2;
}

.anchor-line { color: var(--muted); font-size: 0.92rem; margin-top: 6px; }
.anchor-line strong { color: var(--text); }
.anchor-anime { color: var(--muted); font-size: 0.8rem; font-style: italic; }

/* ---------- Pregunta y turnos ---------- */
.question-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 2px 12px;
}

.question { font-weight: 700; font-size: clamp(1rem, 4vw, 1.15rem); }

.steps { display: flex; gap: 6px; }

.step-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface);
}

.step-pill.current { color: var(--accent); border-color: var(--accent); }
.step-pill.done { color: var(--ok); border-color: var(--ok); }

/* ---------- Opciones ---------- */
.options {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 620px) {
  .options { grid-template-columns: repeat(3, 1fr); }
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: slide-in 0.3s ease backwards;
}

.option:nth-child(2) { animation-delay: 0.06s; }
.option:nth-child(3) { animation-delay: 0.12s; }

@media (hover: hover) {
  .option:not(:disabled):hover {
    border-color: var(--accent);
    transform: translateY(-2px);
  }
}

.option:disabled { cursor: default; }

.option-img {
  width: 72px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.option-name { font-weight: 700; font-size: 0.98rem; line-height: 1.25; }
.option-anime { color: var(--muted); font-size: 0.78rem; font-style: italic; margin-top: 3px; }

.option-key {
  margin-left: auto;
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  flex-shrink: 0;
}

@media (min-width: 620px) {
  .option { flex-direction: column; text-align: center; padding: 14px; }
  .option-img { width: 100%; max-width: 150px; }
  .option-key { margin: 0; order: -1; align-self: flex-end; }
}

/* Resultado de la elección */
.option.correct {
  border-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
}

.option.wrong {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, var(--surface));
  animation: shake 0.4s ease;
}

.option.faded { opacity: 0.45; }

@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 16px;
}

@media (pointer: coarse) {
  .hint, .option-key { display: none; }
}

/* ---------- Fin de partida ---------- */
#screen-over {
  justify-content: center;
  text-align: center;
  gap: clamp(16px, 3.5vh, 28px);
}

.over-title { font-size: clamp(1.6rem, 7vw, 2.4rem); font-weight: 800; }

.over-record {
  color: var(--ok);
  font-weight: 700;
  animation: bump 0.5s ease;
}

.over-reveal {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 auto;
  max-width: 420px;
}

.over-reveal:empty { display: none; }

.over-reveal img {
  width: 64px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
}

.over-reveal .reveal-text { font-size: 0.9rem; color: var(--muted); }
.over-reveal .reveal-text strong { color: var(--text); display: block; font-size: 1rem; }

.over-actions { display: grid; gap: 12px; }

/* ---------- Accesibilidad ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
