/* =============================================
   VARIABLES & RESET
   ============================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --gold:       #f0c040;
  --gold-light: #ffe082;
  --gold-dark:  #b8860b;
  --navy:       #0a0f2e;
  --navy-mid:   #111936;
  --navy-light: #1a2550;
  --white:      #ffffff;
  --glass-bg:   rgba(255, 255, 255, 0.06);
  --glass-border: rgba(240, 192, 64, 0.25);
  --shadow-gold: 0 0 30px rgba(240, 192, 64, 0.15);
  --font: 'Outfit', sans-serif;
  --transition: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--navy);
  color: var(--white);
}

/* =============================================
   INTRO OVERLAY
   ============================================= */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.intro-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-logo {
  text-align: center;
  animation: introFadeIn 0.6s ease forwards;
}

.intro-shield {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: introPulse 1.2s ease-in-out infinite alternate;
}

.intro-title {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.4em;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.intro-sub {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.15em;
  margin-bottom: 2rem;
}

.intro-bar {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin: 0 auto;
  overflow: hidden;
}

.intro-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  border-radius: 3px;
  animation: introLoad 2.2s ease forwards;
}

@keyframes introLoad {
  0%   { width: 0%; }
  60%  { width: 70%; }
  100% { width: 100%; }
}

@keyframes introFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes introPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

/* =============================================
   CANVAS PARTÍCULAS
   ============================================= */
#particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* =============================================
   LAYOUT PRINCIPAL
   ============================================= */
.main-wrapper {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: 1fr auto 1fr;
  grid-template-areas:
    "tl . tr"
    ".  ch  ."
    "bl . br";
  align-items: center;
  justify-items: center;
  padding: 2rem;
  gap: 1rem;
  opacity: 0;
  transition: opacity 0.8s ease 0.2s;
}

.main-wrapper.visible {
  opacity: 1;
}

/* =============================================
   INFO CARDS
   ============================================= */
.info-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.2rem 1.4rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,0.08);
  min-width: 220px;
  max-width: 280px;
  width: 100%;
  transition: transform 0.35s var(--transition), box-shadow 0.35s ease;
  opacity: 0;
  transform: translateY(30px);
}

.info-card.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.info-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 0 40px rgba(240, 192, 64, 0.28), inset 0 1px 0 rgba(255,255,255,0.1);
}

.card-top-left    { grid-area: tl; justify-self: end;   align-self: end; }
.card-top-right   { grid-area: tr; justify-self: start; align-self: end; }
.card-bottom-left { grid-area: bl; justify-self: end;   align-self: start; }
.card-bottom-right{ grid-area: br; justify-self: start; align-self: start; }

.card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
  display: block;
}

.card-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.35rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.card-detail {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
}

.card-badge {
  display: inline-block;
  margin-top: 0.5rem;
  background: rgba(240,192,64,0.15);
  border: 1px solid rgba(240,192,64,0.35);
  color: var(--gold-light);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.stat-item {
  text-align: center;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 0.5rem;
}

.stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold-light);
  line-height: 1;
}

.stat-name {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Titles list */
.titles-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.title-row:last-child { border-bottom: none; }

.title-name { color: rgba(255,255,255,0.75); }
.title-count {
  font-weight: 700;
  color: var(--gold);
}

/* =============================================
   PERSONAJE CENTRAL
   ============================================= */
.character-section {
  grid-area: ch;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.character-container {
  position: relative;
  display: inline-block;
  /* Leve rotación 3D sutil al mover mouse */
  transform-style: preserve-3d;
  transition: transform 0.12s ease-out;
}

.character-img {
  width: clamp(240px, 28vw, 420px);
  height: auto;
  display: block;
  border-radius: 24px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.6));
  opacity: 0;
  transform: translateY(60px) scale(0.9);
  transition:
    opacity 0.7s ease,
    transform 0.7s var(--transition);
}

.character-img.animate-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Glow detrás del personaje */
.character-glow {
  position: absolute;
  inset: 10% 5%;
  background: radial-gradient(ellipse, rgba(240,192,64,0.18) 0%, transparent 70%);
  z-index: 0;
  border-radius: 50%;
  filter: blur(20px);
  animation: glowPulse 3s ease-in-out infinite alternate;
}

@keyframes glowPulse {
  from { opacity: 0.6; transform: scale(1); }
  to   { opacity: 1;   transform: scale(1.08); }
}

/* =============================================
   OVERLAY DE OJOS
   ============================================= */
.eyes-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.eye-wrapper {
  position: absolute;
  /* Posiciones calibradas para los ojos del personaje.
     Se ajustan en JS también con getBoundingClientRect. */
}

/* Ojo izquierdo PANTALLA = ojo derecho del personaje (calibrado en la cuenca del rostro) */
.eye-left {
  left: 43.4%;
  top: 25.2%;
  width: 5.0%;
  aspect-ratio: 1;
}

/* Ojo derecho PANTALLA = ojo izquierdo del personaje (calibrado en la cuenca del rostro) */
.eye-right {
  left: 51%;
  top: 25.2%;
  width: 5.0%;
  aspect-ratio: 1;
}

.eye-ball {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  /* Fondo blanco realista de la esclerótica con ligero sombreado 3D */
  background: radial-gradient(circle at 45% 40%, #ffffff 65%, #e8e8f0 85%, #d0d2df 100%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35), inset 0 2px 4px rgba(0,0,0,0.22);
  border: 1px solid rgba(0,0,0,0.18);
}

.pupil {
  position: absolute;
  width: 60%;
  height: 60%;
  /* Iris marrón realista */
  background: radial-gradient(circle at 35% 35%, #8b5e3c 0%, #4a2c10 55%, #150900 85%);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.08s linear;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.3);
}

/* Pupila negra central */
.pupil::after {
  content: '';
  position: absolute;
  inset: 26%;
  background: #080402;
  border-radius: 50%;
}

.eye-shine {
  position: absolute;
  width: 22%;
  height: 22%;
  background: rgba(255,255,255,0.95);
  border-radius: 50%;
  top: 18%;
  left: 20%;
  pointer-events: none;
  filter: drop-shadow(0 0 1px rgba(255,255,255,0.8));
}

/* =============================================
   NOMBRE DEL PERSONAJE
   ============================================= */
.character-name {
  margin-top: 1rem;
  text-align: center;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s ease 0.5s, transform 0.6s ease 0.5s;
}

.character-name.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.name-text {
  display: block;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.3em;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.name-sub {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.1em;
  margin-top: 0.2rem;
}

/* =============================================
   HINT DE INTERACCIÓN
   ============================================= */
.interaction-hint {
  position: fixed;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 50px;
  padding: 0.5rem 1.4rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
  white-space: nowrap;
}

.interaction-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.interaction-hint.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}

/* =============================================
   ANIMACIÓN DE ENTRADA (cards)
   ============================================= */
.card-top-left    { transition-delay: 0.1s; }
.card-top-right   { transition-delay: 0.2s; }
.card-bottom-left { transition-delay: 0.3s; }
.card-bottom-right{ transition-delay: 0.4s; }

.info-card {
  transition:
    opacity 0.6s ease,
    transform 0.6s var(--transition),
    box-shadow 0.35s ease;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
  .main-wrapper {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "tr"
      "tl"
      "ch"
      "bl"
      "br";
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    padding: 1.5rem 1rem;
  }

  .info-card {
    max-width: 100%;
    justify-self: stretch !important;
  }

  .character-img {
    width: clamp(200px, 60vw, 320px);
  }
}

/* =============================================
   DEMO SWITCHER FLOTANTE
   ============================================= */
.demo-switcher {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 10, 18, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 5px 8px;
  border-radius: 40px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2);
}

.switcher-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 30px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.switcher-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.switcher-btn.active {
  background: linear-gradient(135deg, rgba(138, 92, 245, 0.35), rgba(255, 200, 59, 0.2));
  color: #fff;
  border: 1px solid rgba(180, 142, 255, 0.5);
  box-shadow: 0 4px 15px rgba(138, 92, 245, 0.2);
}

.switcher-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.switcher-badge {
  font-size: 0.62rem;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.switcher-btn.active .switcher-badge {
  background: rgba(180, 142, 255, 0.35);
  color: #e5d7ff;
}

.switcher-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 2px;
}

@media (max-width: 600px) {
  .demo-switcher {
    top: 10px;
    padding: 4px;
    gap: 4px;
    width: 95%;
    justify-content: center;
  }
  .switcher-btn {
    padding: 5px 8px;
    font-size: 0.74rem;
  }
  .switcher-badge {
    display: none;
  }
}

