:root {
  --bg-1: #060816;
  --bg-2: #0b1224;
  --bg-3: #101a33;

  --panel: rgba(12, 18, 35, 0.62);
  --panel-strong: rgba(14, 22, 40, 0.82);
  --line: rgba(255, 255, 255, 0.08);

  --text: #eef6ff;
  --muted: #9db2d0;

  --accent: #7c3aed;
  --accent-2: #06b6d4;
  --ok: #22c55e;
  --bad: #ef4444;

  --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.28);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(124, 58, 237, 0.18), transparent 22%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.14), transparent 22%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
  overflow-x: hidden;
}

body {
  position: relative;
}

/* ===================== FONDO ===================== */

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.55;
  animation: floatGlow 12s ease-in-out infinite alternate;
}

.glow-1 {
  width: 360px;
  height: 360px;
  left: -30px;
  top: 20px;
  background: rgba(124, 58, 237, 0.50);
}

.glow-2 {
  width: 420px;
  height: 420px;
  right: -90px;
  bottom: -30px;
  background: rgba(6, 182, 212, 0.38);
  animation-delay: 1s;
}

@keyframes floatGlow {
  from {
    transform: translateY(0px) translateX(0px) scale(1);
  }
  to {
    transform: translateY(-18px) translateX(12px) scale(1.08);
  }
}

.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.particles::before,
.particles::after {
  content: "";
  position: absolute;
  inset: -30%;
  background-repeat: repeat;
  pointer-events: none;
}

.particles::before {
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.9) 1px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,0.7) 1px, transparent 2px),
    radial-gradient(circle, rgba(6,182,212,0.8) 1.3px, transparent 2.6px),
    radial-gradient(circle, rgba(124,58,237,0.7) 1.3px, transparent 2.6px);
  background-size:
    120px 120px,
    180px 180px,
    240px 240px,
    300px 300px;
  background-position:
    0 0,
    30px 60px,
    90px 120px,
    150px 40px;
  animation:
    starMove1 30s linear infinite,
    starTwinkle 3s ease-in-out infinite;
}

.particles::after {
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.95) 1.4px, transparent 2.6px),
    radial-gradient(circle, rgba(6,182,212,0.9) 1.5px, transparent 3px),
    radial-gradient(circle, rgba(124,58,237,0.8) 1.5px, transparent 3px);
  background-size:
    90px 90px,
    150px 150px,
    200px 200px;
  background-position:
    20px 20px,
    50px 80px,
    100px 40px;
  animation:
    starMove2 22s linear infinite,
    starTwinkle 2.5s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes starMove1 {
  from {
    transform: translate(0px, 0px);
  }
  to {
    transform: translate(-80px, -160px);
  }
}

@keyframes starMove2 {
  from {
    transform: translate(0px, 0px);
  }
  to {
    transform: translate(120px, -140px);
  }
}

@keyframes starTwinkle {
  0% {
    opacity: 0.4;
    filter: drop-shadow(0 0 2px white);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 8px white);
  }
  100% {
    opacity: 0.5;
    filter: drop-shadow(0 0 3px white);
  }
}

/* ===================== LAYOUT ===================== */

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  margin-bottom: 22px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16);
  color: #d8e4f7;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.18);
}

.hero h1 {
  margin: 14px 0 8px;
  font-size: clamp(2rem, 4.1vw, 3.9rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.left-col,
.right-col {
  display: grid;
  gap: 18px;
}

.glass {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 18px 40px rgba(0,0,0,0.20),
    0 30px 80px rgba(0,0,0,0.34);
}

/* ===================== BLOQUES 3D ===================== */

.top-stats,
.stage-card,
.game-card,
.result-card {
  border-radius: var(--radius-xl);
  position: relative;
  transform-style: preserve-3d;
  border: 1.2px solid rgba(255,255,255,0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 18px 40px rgba(0,0,0,0.20),
    0 30px 80px rgba(0,0,0,0.34),
    0 0 0 1px rgba(255,255,255,0.03);
}

.top-stats::before,
.stage-card::before,
.game-card::before,
.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.12), transparent 18%, transparent 72%, rgba(255,255,255,0.04));
  pointer-events: none;
}

.game-card,
.result-card,
.top-stats {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03)),
    rgba(12, 18, 35, 0.68);
}

.top-stats {
  padding: 16px;
}

.stat-block {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)),
    rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 16px 30px rgba(0,0,0,0.18);
  transform: perspective(1000px) rotateX(3deg);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8ea2c0;
  font-weight: 800;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1rem;
  font-weight: 900;
  color: white;
}

/* ===================== CÁMARA ===================== */

.stage-card {
  padding: 16px;
}

.stage-topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.live-badge,
.mini-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: #dbe8fb;
  font-weight: 700;
  font-size: 13px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 10px 24px rgba(0,0,0,0.14);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.stage {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: #020617;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 26px 50px rgba(0,0,0,0.32),
    0 0 40px rgba(255,255,255,0.03);
  transform: perspective(1400px) rotateX(2deg);
}

video,
canvas {
  display: block;
  width: 100%;
  border-radius: 24px;
}

video {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #020617;
  filter: saturate(1.08) contrast(1.03);
}

canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(2, 6, 23, 0.35), transparent 22%),
    linear-gradient(to bottom, rgba(2, 6, 23, 0.12), transparent 16%);
  pointer-events: none;
}

.stage-hud {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 2;
}

.hud-box {
  display: inline-flex;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(8, 15, 28, 0.82);
  border: 1px solid rgba(255,255,255,0.16);
  color: #eef6ff;
  font-weight: 800;
  line-height: 1.4;
  backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 12px 26px rgba(0,0,0,0.22);
}

.stage-footer {
  margin-top: 12px;
}

/* ===================== JUEGO ===================== */

.game-card {
  padding: 18px;
}

.game-header {
  margin-bottom: 12px;
}

.game-kicker,
.result-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8ea2c0;
  font-weight: 800;
  margin-bottom: 6px;
}

.game-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: white;
}

.question-line {
  font-size: 1.12rem;
  line-height: 1.5;
  font-weight: 900;
  color: white;
  margin-bottom: 14px;
}

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

.option-card {
  position: relative;
  border-radius: 20px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
    linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    rgba(255,255,255,0.06);
  border: 1.4px solid rgba(255,255,255,0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.14),
    inset 0 -1px 0 rgba(255,255,255,0.03),
    0 14px 24px rgba(0,0,0,0.18),
    0 26px 50px rgba(0,0,0,0.24),
    0 0 0 1px rgba(255,255,255,0.03);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
  transform: perspective(1100px) rotateX(7deg) translateY(0);
  transform-style: preserve-3d;
  overflow: hidden;
}

.option-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.22), transparent 18%, transparent 70%, rgba(255,255,255,0.05));
  pointer-events: none;
}

.option-card:hover {
  transform: perspective(1100px) rotateX(3deg) translateY(-6px) scale(1.015);
  border-color: rgba(255,255,255,0.34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(255,255,255,0.04),
    0 18px 34px rgba(0,0,0,0.22),
    0 32px 60px rgba(0,0,0,0.30),
    0 0 24px rgba(255,255,255,0.05);
}

.option-title {
  font-size: 1rem;
  font-weight: 900;
  color: white;
  margin-bottom: 5px;
}

.option-desc {
  color: #9fb4d3;
  font-size: 0.9rem;
  line-height: 1.45;
}

.feedback-line {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03)),
    rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.16);
  color: #c6d7ed;
  font-weight: 800;
  line-height: 1.5;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 12px 22px rgba(0,0,0,0.14);
}

.next-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(124,58,237,0.22), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03)),
    rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 14px 26px rgba(0,0,0,0.16);
}

.next-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8ea2c0;
  font-weight: 800;
  margin-bottom: 8px;
}

.next-value {
  color: white;
  font-weight: 800;
  line-height: 1.5;
}

.result-card {
  padding: 18px;
}

.result-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: white;
  margin-bottom: 8px;
}

.result-reason {
  color: #c1d2e8;
  line-height: 1.6;
}

/* ===================== TOAST ===================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(11, 18, 32, 0.92);
  color: white;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 12px 30px rgba(0,0,0,0.2);
  font-weight: 900;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 9999;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 16px, 1280px);
    padding-top: 16px;
  }

  .hero h1 {
    font-size: 2.15rem;
  }

  .top-stats,
  .stage-card,
  .game-card,
  .result-card {
    border-radius: 22px;
    padding: 14px;
  }

  .stage,
  video,
  canvas {
    border-radius: 18px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .question-line {
    font-size: 1rem;
  }

  .option-desc,
  .feedback-line,
  .next-value,
  .hero p {
    font-size: 0.94rem;
  }
}