/* ============================================================
   TERRALABS — DESAFÍO DE 60 SEGUNDOS (home)
   Sección #desafio. Se carga desde el inicio (solo CSS); la lógica
   vive en desafio.js y se importa recién al tocar "Empezar".
   No redefine :root. Reutiliza los tokens del sitio (--radius, --ease,
   --font-sans, --font-display, --ink, --muted, --preview-juegos) y define
   con prefijo --dz- solo lo que la superficie "labs" (clara) no tiene.
   Tipografía: IBM Plex Sans únicamente (sin mono, sin Bebas Neue).

   Paleta:
   - Carcasa neutra (grises y blanco). Botón principal blanco, texto oscuro.
   - Dorado  --dz-reward : SOLO recompensa (acierto, XP, racha, puntos de
                           progreso, barra del segundo intento).
   - Carmín  --dz-danger : SOLO error, siempre con ✕ y texto.
   - Naranja --dz-juegos / cian --dz-educacion : SOLO los botones finales
                           de Juegos y Educación (y el destello del secreto).
                           El de Software lleva borde neutro.
   ============================================================ */

.dz {
  /* Carcasa oscura: mismos valores que la superficie "juegos" de theme.css
     (#1F1F1F / #2A2A2A / #F5F5F5); la home (labs) es clara y no los define. */
  --dz-panel: #1F1F1F;
  --dz-panel-2: #2A2A2A;
  --dz-panel-3: #1A1A1A;
  --dz-ink: #F5F5F5;
  --dz-ink-2: #D6D6D6;
  --dz-muted: #A1A1A1;
  --dz-line: #2A2A2A;
  --dz-line-2: #333333;
  --dz-primary: #F5F5F5;
  --dz-on-primary: #141414;
  /* Recompensa: no pertenece a ninguna línea */
  --dz-reward: #FFC236;
  --dz-on-reward: #141414;
  --dz-reward-soft: rgba(255, 194, 54, .10);
  --dz-reward-glow: rgba(255, 194, 54, .35);
  /* Error */
  --dz-danger: #E5405E;
  /* Colores de línea: anticipan adónde lleva cada botón final */
  --dz-juegos: var(--preview-juegos, #ff7f43);  /* = --accent de /juegos */
  --dz-educacion: #00c8df;                      /* = --accent de /educacion */
  --dz-radius-sm: 0;
  --dz-radius-lg: 0;
  --dz-t-fast: 120ms;
  --dz-t-mid: 240ms;
  --dz-ease-back: cubic-bezier(.34, 1.56, .64, 1);

  display: grid;
  place-items: center;
}
.dz button { font: inherit; }
.dz a:focus-visible,
.dz button:focus-visible { outline-color: var(--dz-ink); }

/* ---------- Encabezado (sobre el fondo claro de la home) ---------- */
.dz-head { text-align: center; margin: 0 auto 28px; max-width: 640px; }
.dz-head .label { justify-content: center; margin-bottom: 14px; user-select: none; -webkit-tap-highlight-color: transparent; }
.dz-head .lead { max-width: none; font-size: clamp(24px, 4vw, 40px); margin: 0 0 12px; }
.dz-sub { color: var(--muted); margin: 0; line-height: 1.5; }

/* ---------- Botones ---------- */
.dz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 0;
  background: var(--dz-primary);
  color: var(--dz-on-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dz-t-fast) var(--ease), box-shadow var(--dz-t-mid) var(--ease), background var(--dz-t-fast);
  -webkit-tap-highlight-color: transparent;
}
.dz-btn:hover { background: #FFFFFF; box-shadow: 0 0 0 4px rgba(245,245,245,.14); }
.dz-btn:active { transform: scale(.96); }
.dz-btn:focus-visible { outline: 2px solid var(--dz-ink); outline-offset: 3px; }
.dz-btn--ghost { background: transparent; color: var(--dz-ink); border: 1px solid var(--dz-line-2); }
.dz-btn--ghost:hover { background: var(--dz-panel-2); box-shadow: none; }
.dz-btn--wide { width: 100%; }
.dz-btn.is-ready { animation: dz-breathe 1.6s var(--ease) infinite; }

.dz-link {
  background: none;
  border: 0;
  color: var(--dz-muted);
  text-decoration: none;
  cursor: pointer;
  padding: 8px;
  min-height: 44px;
}
.dz-link:hover { color: var(--dz-ink); }

.dz-card {
  color: var(--dz-ink);
  position: relative;
  width: 100%;
  max-width: 560px;
  min-height: 480px;
  background: var(--dz-panel);
  border: 1px solid var(--dz-line);
  border-radius: 0;
  padding: 28px 22px;
  overflow: hidden;
}
@media (min-width: 600px) { .dz-card { padding: 36px; } }

.dz-screen { display: none; }
.dz-screen.is-active { display: block; animation: dz-in var(--dz-t-mid) var(--ease); }

.dz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dz-muted);
  margin-bottom: 18px;
}

/* Intro */
.dz-intro-steps { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 12px; }
.dz-intro-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--dz-panel-3);
  border: 1px solid var(--dz-line);
  border-radius: 0;
  padding: 14px 16px;
}
.dz-intro-steps b { font-family: var(--font-display); color: var(--dz-ink); min-width: 2ch; }
.dz-fine { text-align: center; color: var(--dz-muted); font-size: 13px; margin: 14px 0 0; }

/* Ficha */
.dz-product {
  background: var(--dz-panel-3);
  border: 1px solid var(--dz-line);
  border-radius: 0;
  padding: 20px;
  margin-bottom: 20px;
}
.dz-product h3 { font-family: var(--font-display); font-size: 22px; margin: 0 0 4px; }
.dz-product .dz-kicker { color: var(--dz-muted); margin: 0 0 16px; font-size: 14px; }
.dz-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dz-facts li {
  display: flex;
  gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  animation: dz-fact var(--dz-t-mid) var(--ease) forwards;
}
.dz-facts li::before { content: "▣"; color: var(--dz-muted); font-size: 12px; line-height: 24px; flex: none; }
.dz-timer { height: 6px; background: var(--dz-panel-2); border-radius: 0; overflow: hidden; margin-bottom: 16px; }
.dz-timer span { display: block; height: 100%; width: 100%; background: var(--dz-primary); transform-origin: left; }

/* Pregunta */
.dz-dots { display: flex; gap: 6px; }
.dz-dots i { width: 22px; height: 6px; border-radius: 0; background: var(--dz-panel-2); transition: background var(--dz-t-mid); }
.dz-dots i.is-current { background: var(--dz-ink-2); }
.dz-dots i.is-first { background: var(--dz-reward); }
.dz-dots i.is-second { background: rgba(255,194,54,.45); }
.dz-dots i.is-missed { background: var(--dz-line-2); }

.dz-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 14px;
}
.dz-xp-total { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--dz-reward); }
.dz-streak {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--dz-on-reward);
  background: var(--dz-reward);
  border-radius: 0;
  padding: 3px 12px;
  opacity: 0;
  transform: scale(.8);
  transition: opacity var(--dz-t-mid), transform var(--dz-t-mid) var(--dz-ease-back);
}
.dz-streak.is-on { opacity: 1; transform: scale(1); }
.dz-streak.is-bump { animation: dz-pop 420ms var(--dz-ease-back); }

.dz-q {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(19px, 4.4vw, 24px);
  line-height: 1.25;
  margin: 0 0 20px;
}
.dz-options { display: grid; gap: 10px; }
.dz-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  text-align: left;
  background: var(--dz-panel-3);
  color: var(--dz-ink);
  border: 1px solid var(--dz-line-2);
  border-radius: 0;
  cursor: pointer;
  transition: transform var(--dz-t-fast) var(--ease), border-color var(--dz-t-fast), background var(--dz-t-fast);
  -webkit-tap-highlight-color: transparent;
}
.dz-opt:hover:not(:disabled) { border-color: var(--dz-muted); background: var(--dz-panel-2); }
.dz-opt:active:not(:disabled) { transform: scale(.98); }
.dz-opt:focus-visible { outline: 2px solid var(--dz-ink); outline-offset: 2px; }
.dz-key {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 0;
  border: 1px solid var(--dz-line-2);
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--dz-muted);
}
.dz-mark { margin-left: auto; font-weight: 700; font-size: 18px; }
.dz-opt.is-correct {
  border-color: var(--dz-reward);
  background: var(--dz-reward-soft);
  animation: dz-pop 420ms var(--dz-ease-back);
  box-shadow: 0 0 24px var(--dz-reward-glow);
}
.dz-opt.is-correct .dz-key { background: var(--dz-reward); border-color: var(--dz-reward); color: var(--dz-on-reward); }
.dz-opt.is-correct .dz-mark { color: var(--dz-reward); }
.dz-opt.is-wrong {
  border-color: var(--dz-danger);
  background: rgba(229,64,94,.08);
  color: var(--dz-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(229,64,94,.6);
  animation: dz-shake 380ms var(--ease);
  cursor: not-allowed;
}
.dz-opt.is-wrong .dz-mark { color: var(--dz-danger); }
.dz-opt.is-reveal { border-color: var(--dz-ink-2); border-style: dashed; }
.dz-opt:disabled:not(.is-correct):not(.is-wrong):not(.is-reveal) { opacity: .45; cursor: default; }

.dz-hint {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--dz-ink-2);
  border-radius: 0;
  background: rgba(245,245,245,.04);
  color: var(--dz-ink-2);
  font-size: 15px;
}
.dz-hint.is-on { display: block; animation: dz-in var(--dz-t-mid) var(--ease); }
.dz-hint b {
  display: block;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dz-ink);
  margin-bottom: 4px;
}
.dz-blank {
  display: inline-block;
  min-width: 5ch;
  border-bottom: 2px solid var(--dz-ink-2);
  color: transparent;
}

.dz-feedback {
  min-height: 52px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 500;
}
.dz-feedback.is-good { color: var(--dz-reward); }
.dz-feedback.is-retry { color: var(--dz-ink-2); }

.dz-xp {
  position: absolute;
  top: 22px;
  right: 22px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--dz-reward);
  pointer-events: none;
  opacity: 0;
}
.dz-xp.is-on { animation: dz-xp 900ms var(--ease); }

/* Resultado */
.dz-result-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 5vw, 30px);
  line-height: 1.2;
  margin: 0 0 20px;
}
.dz-bars { display: grid; gap: 16px; margin-bottom: 20px; }
.dz-bar-row { display: grid; gap: 6px; }
.dz-bar-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--dz-ink-2); }
.dz-bar-label strong { font-family: var(--font-display); font-size: 22px; color: var(--dz-ink); }
.dz-bar { height: 14px; background: var(--dz-panel-2); border-radius: 0; overflow: hidden; }
.dz-bar span { display: block; height: 100%; width: 0; border-radius: 0; transition: width 900ms var(--ease); }
.dz-bar--first span { background: var(--dz-muted); }
.dz-bar--second span { background: var(--dz-reward); }
.dz-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.dz-stat {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--dz-ink-2);
  background: var(--dz-panel-3);
  border: 1px solid var(--dz-line);
  border-radius: 0;
  padding: 4px 12px;
}
.dz-stat b { color: var(--dz-reward); }
.dz-insight { color: var(--dz-ink-2); margin: 0 0 16px; }
.dz-proof {
  background: var(--dz-panel-3);
  border: 1px solid var(--dz-line);
  border-left: 3px solid var(--dz-ink-2);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--dz-ink-2);
  margin-bottom: 24px;
}
.dz-proof strong { color: var(--dz-ink); font-family: var(--font-display); }
.dz-ask {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 12px;
}
.dz-paths { display: grid; gap: 10px; margin-bottom: 4px; }
/* Tres destinos: siempre en columna (la tarjeta mide 560 px como máximo) */
.dz-path {
  --line-color: var(--dz-line-2);
  display: grid;
  gap: 2px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1.5px solid var(--line-color);
  border-radius: 0;
  background: var(--dz-panel-3);
  color: var(--dz-ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  transition: transform var(--dz-t-fast) var(--ease), background var(--dz-t-fast), box-shadow var(--dz-t-mid);
  -webkit-tap-highlight-color: transparent;
}
.dz-path small {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--line-color);
}
.dz-path--software { --line-color: var(--dz-ink-2); }
.dz-path--juegos { --line-color: var(--dz-juegos); }
.dz-path--educacion { --line-color: var(--dz-educacion); }
.dz-path:hover { background: var(--dz-panel-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--line-color) 20%, transparent); }
.dz-path:active { transform: scale(.97); }
.dz-path:focus-visible { outline: 2px solid var(--dz-ink); outline-offset: 3px; }
.dz-actions { display: grid; gap: 10px; }
.dz-actions .dz-link { justify-self: center; }

/* Secreto */
.dz-toast {
  position: absolute;
  inset: auto 16px 16px 16px;
  background: var(--dz-panel-3);
  border: 1px solid var(--dz-reward);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--dz-ink-2);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  transform: translateY(calc(100% + 32px));
  visibility: hidden;
  transition: transform 360ms var(--dz-ease-back), visibility 0s 360ms;
  z-index: 2;
}
.dz-toast.is-on { transform: translateY(0); visibility: visible; transition-delay: 0s; }
.dz-toast b { display: block; font-family: var(--font-display); color: var(--dz-reward); margin-bottom: 4px; }
.dz-card.is-secret { animation: dz-rainbow 1.2s linear 1; }

.dz-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Animaciones ---------- */
@keyframes dz-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dz-fact { to { opacity: 1; transform: none; } }
@keyframes dz-pop { 0% { transform: scale(1); } 40% { transform: scale(1.035); } 100% { transform: scale(1); } }
@keyframes dz-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}
@keyframes dz-xp {
  0% { opacity: 0; transform: translateY(8px) scale(.9); }
  25% { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-22px) scale(1); }
}
@keyframes dz-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,245,245,.4); }
  50% { box-shadow: 0 0 0 8px rgba(245,245,245,0); }
}
@keyframes dz-rainbow {
  0% { border-color: var(--dz-juegos); }
  33% { border-color: var(--dz-reward); }
  66% { border-color: var(--dz-educacion); }
  100% { border-color: var(--dz-line); }
}


/* ---------- Enlaces dentro de la carcasa oscura ---------- */
.dz-proof a { color: var(--dz-ink); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .dz *, .dz *::before, .dz *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .dz-facts li { opacity: 1; transform: none; }
}
