:root {
  --bg: #08261d;
  --bg-elevated: #0f3a2c;
  --surface: #ffffff;
  --text: #f3fbf6;
  --text-muted: #a9cbbb;
  --text-on-surface: #13261f;
  --accent: #b6f36a;
  --accent-strong: #8fd63f;
  --danger: #ff6b5b;
  --success: #3ddc84;
  --option-0: #e4572e;
  --option-1: #2e86ab;
  --option-2: #c98a0c;
  --option-3: #7d5ba6;
  --gold: #f5c542;
  --silver: #c9d3dc;
  --bronze: #d58a4e;
  --radius: 18px;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  --ease-bounce: cubic-bezier(0.2, 0.9, 0.3, 1.3);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgb(182 243 106 / 0.12), transparent 40%),
    radial-gradient(circle at 85% 90%, rgb(46 134 171 / 0.18), transparent 45%),
    var(--bg);
  min-height: 100dvh;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }

.brand {
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 6vw, 3.25rem);
}
.brand span { color: var(--accent); }

.muted { color: var(--text-muted); }

/* ---------- Botones ---------- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 14px 26px;
  font: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  background: var(--accent);
  color: #10301f;
  box-shadow: 0 5px 0 var(--accent-strong);
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.2s;
}
.btn:hover { filter: brightness(1.05); }
.btn:focus-visible, .option:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.btn:active { filter: brightness(0.92); box-shadow: 0 2px 0 var(--accent-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.25); }
.btn--ghost:active { box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.4); }
.btn--lg { font-size: 1.4rem; padding: 18px 40px; }

/* ---------- Formularios ---------- */
.card {
  background: var(--surface);
  color: var(--text-on-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 800; font-size: 0.95rem; }
.field input {
  font: inherit;
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #d4e3db;
  background: #f7fbf9;
  color: var(--text-on-surface);
}
.field input:focus { outline: none; border-color: var(--option-1); background: #fff; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: #c0392b; font-size: 0.85rem; font-weight: 700; min-height: 1em; }

.form-error {
  background: #ffe9e6;
  color: #a12a1c;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

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

.option {
  --option-color: var(--option-0);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 84px;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  background: var(--option-color);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: left;
  overflow: hidden;
  box-shadow: 0 6px 0 rgb(0 0 0 / 0.25);
  transition: opacity 0.25s, transform 0.08s, filter 0.25s;
}
.option[data-index="1"] { --option-color: var(--option-1); }
.option[data-index="2"] { --option-color: var(--option-2); }
.option[data-index="3"] { --option-color: var(--option-3); }
button.option { cursor: pointer; }
/* Sin transform: mover el botón al presionar deja el cursor fuera y se pierde el clic en su borde. */
button.option:active { filter: brightness(0.88); box-shadow: 0 2px 0 rgb(0 0 0 / 0.25); }
button.option:disabled { cursor: default; }

.option__letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.22);
  font-weight: 900;
}

.option.is-dimmed { opacity: 0.3; filter: grayscale(0.6); }
.option.is-correct { outline: 5px solid #fff; outline-offset: 3px; }
.option.is-selected { outline: 4px solid #fff; outline-offset: 2px; }

/* ---------- Temporizador ---------- */
.timer-bar { height: 10px; border-radius: 999px; background: rgb(255 255 255 / 0.12); overflow: hidden; }
.timer-bar__fill { height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.timer-bar__fill.is-low { background: var(--danger); }

/* ---------- Utilidades ---------- */
.stack { display: grid; gap: 16px; }
.center { text-align: center; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  font-weight: 800;
  font-size: 0.9rem;
}

.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); }
.status-dot.is-offline { background: var(--danger); }

.pulse {
  width: 110px;
  height: 110px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent), var(--accent-strong) 60%, #4f8f1f);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.92); box-shadow: 0 0 0 0 rgb(182 243 106 / 0.45); }
  50% { transform: scale(1); box-shadow: 0 0 0 26px rgb(182 243 106 / 0); }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(24px) scale(0.92); }
  to { opacity: 1; transform: none; }
}

.pop-in { animation: pop-in 0.45s var(--ease-bounce) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
