/* ===============================================================
   EL PORTAL · CAMILO SÉPTIMO
   Estética: retrofuturista (scanlines, CRT, monospace) + ultramarino
   =============================================================== */

:root {
  --c-blue:        #1F1ECC;
  --c-blue-deep:   #0D0A6E;
  --c-blue-ink:    #06054A;
  --c-blue-night:  #020128;
  --c-cream:       #F2EBDC;
  --c-cream-soft:  #E8DFC8;
  --c-gold:        #E8C26A;
  --c-gold-bright: #FFD98A;
  --c-violet:      #8B6BFF;
  --c-cyan:        #6BD6FF;
  --c-magenta:     #FF6BD6;
  --c-muted:       rgba(242, 235, 220, 0.6);
  --c-line:        rgba(242, 235, 220, 0.14);

  --ff-display: "Fraunces", Georgia, serif;
  --ff-body:    "Space Grotesk", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ff-mono:    "Space Mono", ui-monospace, "SF Mono", monospace;
}

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

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

body {
  background: var(--c-blue-night);
  color: var(--c-cream);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

a { color: var(--c-gold); text-underline-offset: 3px; }
a:hover { color: var(--c-gold-bright); }

/* ---------- GLOBAL FX (scanlines + vignette) ---------- */
.fx-scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.7;
}
.fx-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(2,1,40,0.55) 100%);
}

/* ---------- LAYOUT ---------- */
.container { max-width: 920px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 2; }
.container--narrow { max-width: 480px; }
.center { text-align: center; }

.state {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  position: relative;
}
.state[hidden] { display: none !important; }

/* ---------- TYPE ---------- */
.mono {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-cyan);
  margin-bottom: 1.6rem;
  opacity: 0.85;
}
.mono--gold { color: var(--c-gold); }
.mono--blink { animation: blink 1.8s steps(2) infinite; }
@keyframes blink { 0%, 50% { opacity: 0.85; } 51%, 100% { opacity: 0.35; } }

.display {
  font-family: var(--ff-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
  text-shadow:
    0 0 30px rgba(31, 30, 204, 0.4),
    0 0 60px rgba(123, 91, 255, 0.25);
}
.display em {
  font-style: italic;
  font-weight: 500;
  color: var(--c-gold);
  text-shadow:
    0 0 30px rgba(232, 194, 106, 0.55),
    0 0 60px rgba(232, 194, 106, 0.3);
}

/* Glitch sutil en hover */
.glitch {
  position: relative;
  display: inline-block;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  opacity: 0;
  transition: opacity 0.4s;
}
.glitch::before { color: var(--c-cyan); transform: translate(-2px, 0); }
.glitch::after { color: var(--c-magenta); transform: translate(2px, 0); }
.display:hover .glitch::before, .display:hover .glitch::after { opacity: 0.55; }

.lede {
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  color: var(--c-cream-soft);
  max-width: 36ch;
  margin: 0 auto 2rem;
}
.lede strong { color: var(--c-cream); font-weight: 600; }

/* ---------- BACKGROUND ---------- */
.hero-bg {
  position: absolute;
  inset: 0;
  background: var(--c-blue) url("assets/hero.jpg") center / cover no-repeat;
  z-index: -2;
  filter: brightness(0.5) saturate(1.2) contrast(1.05);
}
.hero-tint {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(2,1,40,0.85) 100%),
    linear-gradient(to bottom, rgba(2,1,40,0.4), rgba(2,1,40,0.9));
}

/* ---------- STATE LOCKED ---------- */
.state--locked { background: var(--c-blue-night); }

/* ---------- STATE PLAY ---------- */
.play__content { width: 100%; }

/* DOOR / PORTAL — replica el shape del album cover */
.door {
  position: relative;
  width: 140px;
  height: 220px;
  margin: 2.5rem auto;
  cursor: pointer;
  transition: transform 0.3s ease;
}
.door:hover { transform: translateY(-4px); }

.door__frame {
  position: absolute;
  inset: 0;
  border: 4px solid var(--c-violet);
  background: linear-gradient(to bottom, rgba(31,30,204,0.4), rgba(13,10,110,0.7));
  box-shadow:
    0 0 40px rgba(123, 91, 255, 0.45),
    inset 0 0 30px rgba(232, 194, 106, 0.08);
  overflow: hidden;
}
.door__inner {
  position: absolute;
  inset: 12px;
  background: radial-gradient(ellipse at 50% 60%, rgba(232, 194, 106, 0.18), rgba(2,1,40,0.7) 70%);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.door__glow {
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle, rgba(232,194,106,0.25), transparent 60%);
  animation: glow 6s ease-in-out infinite alternate;
}
@keyframes glow {
  from { transform: scale(0.9); opacity: 0.4; }
  to   { transform: scale(1.15); opacity: 0.9; }
}
.door__cta {
  position: relative;
  z-index: 2;
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  color: var(--c-cream);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(232,194,106,0.6);
}
.door__shadow {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 12px;
  background: radial-gradient(ellipse, rgba(31,30,204,0.6), transparent 70%);
  filter: blur(8px);
}

/* ====================================================
   PORTAL MOTION GRAPHICS · v3
   Animación cinemática de rotación + burst de partículas
   ==================================================== */

.portal-stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2.5rem 0;
  perspective: 1000px;
}

/* Door — rotación cinemática 3D */
.door.door--opening {
  animation: portalOpen 2.2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
.door.door--opening .door__frame {
  animation: frameSpin 2.2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
.door.door--opening .door__glow {
  animation: glowExplode 2.2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
.door.door--opening .door__cta-txt {
  animation: ctaFade 0.4s ease-out forwards;
}

@keyframes portalOpen {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.08); }
  50%  { transform: scale(1.18); }
  75%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes frameSpin {
  0% {
    transform: rotateY(0deg);
    border-color: var(--c-violet);
    box-shadow: 0 0 40px rgba(123, 91, 255, 0.45);
  }
  25% {
    transform: rotateY(180deg);
    border-color: var(--c-gold);
    box-shadow: 0 0 100px rgba(232, 194, 106, 0.95),
                0 0 200px rgba(123, 91, 255, 0.6);
  }
  50% {
    transform: rotateY(360deg);
    border-color: var(--c-gold-bright);
    box-shadow: 0 0 140px rgba(232, 194, 106, 1),
                0 0 280px rgba(232, 194, 106, 0.7),
                inset 0 0 60px rgba(232, 194, 106, 0.5);
  }
  75% {
    transform: rotateY(540deg);
    border-color: var(--c-gold);
    box-shadow: 0 0 90px rgba(232, 194, 106, 0.7),
                0 0 180px rgba(123, 91, 255, 0.5);
  }
  100% {
    transform: rotateY(720deg);
    border-color: var(--c-violet);
    box-shadow: 0 0 40px rgba(123, 91, 255, 0.45);
  }
}

@keyframes glowExplode {
  0%   { opacity: 0.6; transform: scale(0.9); filter: blur(0); }
  30%  { opacity: 1;   transform: scale(2);   filter: blur(4px); }
  60%  { opacity: 1;   transform: scale(2.5); filter: blur(8px); }
  100% { opacity: 0.6; transform: scale(1);   filter: blur(0); }
}

@keyframes ctaFade {
  to { opacity: 0; transform: scale(0.5); }
}

/* Burst de partículas */
.portal-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.burst-particle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  background: var(--c-gold-bright);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--c-gold-bright), 0 0 16px var(--c-gold);
}
.portal-burst.burst--active .burst-particle {
  animation: burstFly 1.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes burstFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%)
               rotate(var(--angle))
               translateX(0)
               scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%)
               rotate(var(--angle))
               translateX(60px)
               scale(1.5);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%)
               rotate(var(--angle))
               translateX(260px)
               scale(0.3);
  }
}

/* BUTTON */
.btn {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 1rem 2.2rem;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-transform: uppercase;
}
.btn--ghost {
  background: transparent;
  color: var(--c-cream);
  border-color: var(--c-line);
}
.btn--ghost:hover:not(:disabled) {
  border-color: var(--c-cyan);
  color: var(--c-cyan);
  box-shadow: 0 0 20px rgba(107, 214, 255, 0.25);
}
.btn--gold {
  background: linear-gradient(135deg, var(--c-gold), var(--c-gold-bright));
  color: var(--c-blue-night);
  border-color: var(--c-gold);
  box-shadow: 0 0 30px rgba(232, 194, 106, 0.4);
}
.btn--gold:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 50px rgba(232, 194, 106, 0.6);
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn--block { display: block; width: 100%; margin-top: 1rem; }

.status {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  margin-top: 2rem;
  min-height: 1.4em;
  text-transform: lowercase;
}

/* ---------- STATE WIN ---------- */
.state--win {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(232,194,106,0.18), transparent 60%),
    var(--c-blue-night);
}
.win-fx {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(232,194,106,0.18), transparent 30%),
    radial-gradient(circle at 80% 60%, rgba(123,91,255,0.22), transparent 30%),
    radial-gradient(circle at 50% 90%, rgba(232,194,106,0.15), transparent 30%);
  animation: shimmer 8s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes shimmer {
  from { opacity: 0.5; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.08); }
}

/* TICKET */
.ticket {
  background: linear-gradient(135deg, #FFE8B0, #E8C26A 40%, #BF8E2A);
  color: var(--c-blue-night);
  border-radius: 4px;
  padding: 1.6rem 1.8rem 1.2rem;
  margin-bottom: 2rem;
  box-shadow:
    0 20px 80px rgba(232,194,106,0.4),
    0 0 0 1px rgba(255,255,255,0.4) inset;
  position: relative;
  overflow: hidden;
  text-align: left;
}
.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  background: var(--c-blue-night);
  border-radius: 50%;
  top: 50%; transform: translateY(-50%);
}
.ticket::before { left: -10px; }
.ticket::after { right: -10px; }

.ticket__top, .ticket__bottom {
  display: flex;
  justify-content: space-between;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
}
.ticket__top {
  padding-bottom: 1rem;
  border-bottom: 1px dashed rgba(2,1,40,0.4);
  margin-bottom: 1.4rem;
}
.ticket__bottom {
  padding-top: 1rem;
  border-top: 1px dashed rgba(2,1,40,0.4);
  margin-top: 1.4rem;
  justify-content: center;
  opacity: 0.7;
}
.ticket__title { color: var(--c-blue-night); font-size: clamp(2rem, 7vw, 3rem); margin-bottom: 0.6rem; text-shadow: none; }
.ticket__title em { color: #6E4A0E; }
.ticket__body .lede { color: var(--c-blue-deep); margin-bottom: 0; }

/* ---------- STATE CLOSED + CLAIMED ---------- */
.state--closed, .state--claimed {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(123,91,255,0.12), transparent 60%),
    var(--c-blue-night);
}

/* ---------- FORM ---------- */
.field { display: block; margin-bottom: 1rem; text-align: left; }
.field__lbl {
  display: block;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-cyan);
  margin-bottom: 0.5rem;
}
.field input {
  width: 100%;
  background: rgba(2, 1, 40, 0.7);
  border: 1px solid var(--c-line);
  border-radius: 4px;
  padding: 0.95rem 1rem;
  color: var(--c-cream);
  font-family: var(--ff-mono);
  font-size: 1rem;
  letter-spacing: 0.02em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--c-gold);
  background: rgba(2, 1, 40, 0.92);
  box-shadow: 0 0 0 3px rgba(232, 194, 106, 0.12);
}
.field input::placeholder { color: rgba(242, 235, 220, 0.28); }
.field__hint {
  display: block;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  color: var(--c-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
}

#claim-form { margin-top: 1rem; }

.fallback-txt {
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  color: var(--c-muted);
  letter-spacing: 0.04em;
}

/* =================================================================
   QUIZ STYLES
   ================================================================= */

/* Mono color variants */
.mono--magenta { color: var(--c-magenta); }

/* INTRO state */
.state--intro {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(123, 91, 255, 0.18), transparent 60%),
    var(--c-blue-night);
}
.rules {
  list-style: none;
  display: grid;
  gap: 0.6rem;
  margin: 1.5rem auto 2.5rem;
  max-width: 320px;
  text-align: left;
}
.rules li {
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  color: var(--c-cream-soft);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.rules__dot {
  color: var(--c-gold);
  font-size: 0.7rem;
}

/* QUIZ state */
.state--quiz {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(31, 30, 204, 0.22), transparent 60%),
    var(--c-blue-night);
}

/* Progress dots */
.progress {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.progress__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(242, 235, 220, 0.15);
  border: 1px solid var(--c-line);
  transition: all 0.3s ease;
}
.progress__dot--active {
  background: var(--c-gold);
  border-color: var(--c-gold);
  box-shadow: 0 0 12px rgba(232, 194, 106, 0.5);
}

/* Display variant para preguntas */
.display--question {
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1.1;
  margin-bottom: 2rem;
  max-width: 22ch;
  margin-left: auto;
  margin-right: auto;
}

/* Options grid */
.options {
  display: grid;
  gap: 0.7rem;
  max-width: 420px;
  margin: 0 auto;
}
.option {
  font-family: var(--ff-mono);
  font-size: 0.95rem;
  color: var(--c-cream);
  background: rgba(2, 1, 40, 0.7);
  border: 1px solid var(--c-line);
  border-radius: 4px;
  padding: 1.05rem 1.2rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}
.option::before {
  content: "→ ";
  color: var(--c-cyan);
  opacity: 0;
  transition: opacity 0.2s;
}
.option:hover:not(:disabled) {
  border-color: var(--c-cyan);
  color: var(--c-cyan);
  background: rgba(107, 214, 255, 0.06);
  box-shadow: 0 0 16px rgba(107, 214, 255, 0.18);
  transform: translateX(2px);
}
.option:hover:not(:disabled)::before { opacity: 1; }

.option:disabled { cursor: not-allowed; }

.option--correct {
  border-color: var(--c-gold) !important;
  background: rgba(232, 194, 106, 0.15) !important;
  color: var(--c-gold) !important;
  box-shadow: 0 0 24px rgba(232, 194, 106, 0.35) !important;
  transform: none !important;
}
.option--correct::before {
  content: "✓ " !important;
  color: var(--c-gold) !important;
  opacity: 1 !important;
}
.option--wrong {
  border-color: var(--c-magenta) !important;
  background: rgba(255, 107, 214, 0.12) !important;
  color: var(--c-magenta) !important;
}
.option--wrong::before {
  content: "✗ " !important;
  color: var(--c-magenta) !important;
  opacity: 1 !important;
}

/* Feedback */
.quiz-feedback {
  font-family: var(--ff-mono);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  margin-top: 1.5rem;
  text-transform: lowercase;
  animation: fadeIn 0.3s ease;
}
.quiz-feedback--ok { color: var(--c-gold); }
.quiz-feedback--bad { color: var(--c-magenta); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* QUIZ FAILED state */
.state--quiz-failed {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 107, 214, 0.15), transparent 60%),
    var(--c-blue-night);
}

/* LOADING state */
.state--loading {
  background: var(--c-blue-night);
}

/* WAIT FOR START (countdown a las 3 PM) */
.state--wait-start {
  /* hero-bg + tint heredados como en intro */
}

/* PORTAL CLOSED (auto-pausa global) */
.state--portal-closed {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(232,194,106,0.15), transparent 60%),
    var(--c-blue-night);
}
.ticket-mini {
  width: 100px;
  height: 56px;
  margin: 1rem auto 2rem;
  position: relative;
  background: linear-gradient(135deg, #FFE8B0, var(--c-gold) 50%, #BF8E2A);
  border-radius: 4px;
  box-shadow:
    0 12px 50px rgba(232,194,106,0.4),
    0 0 0 1px rgba(255,255,255,0.4) inset;
  animation: ticketShineMini 4s ease-in-out infinite alternate;
}
.ticket-mini::before, .ticket-mini::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  background: var(--c-blue-night);
  border-radius: 50%;
  top: 50%; transform: translateY(-50%);
}
.ticket-mini::before { left: -7px; }
.ticket-mini::after { right: -7px; }
@keyframes ticketShineMini {
  from { transform: scale(1) rotate(-2deg); box-shadow: 0 12px 50px rgba(232,194,106,0.4); }
  to   { transform: scale(1.05) rotate(2deg); box-shadow: 0 12px 70px rgba(232,194,106,0.7); }
}

/* SPIN LOST state */
.state--spin-lost {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 107, 214, 0.18), transparent 60%),
    var(--c-blue-night);
}

/* QUIZ COOLDOWN state */
.state--quiz-cooldown {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(123, 91, 255, 0.12), transparent 60%),
    var(--c-blue-night);
}
.countdown-big {
  font-family: var(--ff-display);
  font-size: clamp(3rem, 10vw, 4.5rem);
  font-weight: 600;
  color: var(--c-gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  margin: 1rem 0 2rem;
  text-shadow:
    0 0 30px rgba(232, 194, 106, 0.4),
    0 0 60px rgba(232, 194, 106, 0.2);
}

/* Small responsive */
@media (max-width: 480px) {
  .option { font-size: 0.88rem; padding: 0.95rem 1rem; }
  .display--question { font-size: 1.6rem; }
}

/* ---------- FOOTER ---------- */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--c-line);
  background: var(--c-blue-night);
  position: relative;
  z-index: 2;
}
.footer .mono { color: var(--c-muted); margin: 0; font-size: 0.62rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 480px) {
  .door { width: 110px; height: 180px; margin: 2rem auto; }
}

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