@import url('https://fonts.googleapis.com/css2?family=Almendra+SC&family=Lora:wght@400;500;600;700&display=swap');

/* ============================================= */
/* ESTILO MÁGICO - GRISES PROFUNDOS + ROJO ELÉCTRICO */
/* Fondos en escala de grises, detalles en rojo vibrante */
/* Más partículas flotantes sutiles y elegantes       */
/* ============================================= */

@keyframes float-particles {
  0% { 
    transform: translateY(120vh) translateX(0) rotate(0deg); 
    opacity: 0; 
  }
  10% { opacity: 0.5; }
  90% { opacity: 0.5; }
  100% { 
    transform: translateY(-150px) translateX(var(--drift)) rotate(360deg); 
    opacity: 0; 
  }
}

@keyframes pulse-glow {
  0% { text-shadow: 0 0 8px #c00303, 0 0 16px #ff1a5e; }
  100% { text-shadow: 0 0 14px #c00303, 0 0 24px #d1cdcd; }
}

@keyframes button-glow {
  0% { box-shadow: 0 0 10px #cc0039; }
  100% { box-shadow: 0 0 25px #c00303, 0 0 35px #cc0039; }
}

/* ======================== */
/* ESTILOS BASE (MOBILE-FIRST) */
/* ======================== */

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

body {
  font-family: 'Lora', serif;
  background: linear-gradient(to bottom, #121212, #1e1e1e, #000000);
  color: #e0e0e0; /* Texto gris claro para alta legibilidad */
  min-height: 100vh;
  padding: 20px 15px;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ================== PARTÍCULAS PRINCIPALES ================== */
.particle {
  position: absolute;
  width: 5px;
  height: 5px;
  background: radial-gradient(circle, #ff334b, #cc0000);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 0 10px #ff0026;
  opacity: 0.6;
  animation: float-particles linear infinite;
  --drift: 100px;
  top: 0;
  left: 0;
}

/* Variaciones individuales (30 partículas) */
.particle:nth-child(1)  { left: 5%;   animation-duration: 32s; animation-delay: 0s;   --drift: 80px; }
.particle:nth-child(2)  { left: 12%;  animation-duration: 28s; animation-delay: -5s;  --drift: -120px; }
.particle:nth-child(3)  { left: 18%;  animation-duration: 35s; animation-delay: -12s; --drift: 60px; }
.particle:nth-child(4)  { left: 25%;  animation-duration: 26s; animation-delay: -8s;  --drift: 140px; }
.particle:nth-child(5)  { left: 32%;  animation-duration: 40s; animation-delay: -20s; --drift: -80px; }
.particle:nth-child(6)  { left: 38%;  animation-duration: 30s; animation-delay: -2s;  --drift: 100px; }
.particle:nth-child(7)  { left: 45%;  animation-duration: 33s; animation-delay: -15s; --drift: -150px; }
.particle:nth-child(8)  { left: 52%;  animation-duration: 27s; animation-delay: -10s; --drift: 90px; }
.particle:nth-child(9)  { left: 58%;  animation-duration: 38s; animation-delay: -25s; --drift: 120px; }
.particle:nth-child(10) { left: 65%;  animation-duration: 29s; animation-delay: -7s;  --drift: -100px; }
.particle:nth-child(11) { left: 72%;  animation-duration: 34s; animation-delay: -18s; --drift: 70px; }
.particle:nth-child(12) { left: 78%;  animation-duration: 31s; animation-delay: -3s;  --drift: -130px; }
.particle:nth-child(13) { left: 85%;  animation-duration: 36s; animation-delay: -22s; --drift: 110px; }
.particle:nth-child(14) { left: 90%;  animation-duration: 25s; animation-delay: -14s; --drift: -90px; }
.particle:nth-child(15) { left: 8%;   animation-duration: 39s; animation-delay: -28s; --drift: 150px; }
.particle:nth-child(16) { left: 22%;  animation-duration: 24s; animation-delay: -6s;  --drift: -70px; }
.particle:nth-child(17) { left: 35%;  animation-duration: 37s; animation-delay: -19s; --drift: 130px; }
.particle:nth-child(18) { left: 48%;  animation-duration: 30s; animation-delay: -11s; --drift: -110px; }
.particle:nth-child(19) { left: 62%;  animation-duration: 32s; animation-delay: -26s; --drift: 95px; }
.particle:nth-child(20) { left: 80%;  animation-duration: 28s; animation-delay: -4s;  --drift: -140px; }
.particle:nth-child(21) { left: 3%;   animation-duration: 34s; animation-delay: -9s;  --drift: 130px; }
.particle:nth-child(22) { left: 15%;  animation-duration: 29s; animation-delay: -21s; --drift: -90px; }
.particle:nth-child(23) { left: 27%;  animation-duration: 41s; animation-delay: -13s; --drift: 110px; }
.particle:nth-child(24) { left: 34%;  animation-duration: 26s; animation-delay: -30s; --drift: -140px; }
.particle:nth-child(25) { left: 41%;  animation-duration: 38s; animation-delay: -4s;  --drift: 80px; }
.particle:nth-child(26) { left: 49%;  animation-duration: 31s; animation-delay: -17s; --drift: -120px; }
.particle:nth-child(27) { left: 56%;  animation-duration: 35s; animation-delay: -24s; --drift: 150px; }
.particle:nth-child(28) { left: 63%;  animation-duration: 28s; animation-delay: -1s;  --drift: -70px; }
.particle:nth-child(29) { left: 69%;  animation-duration: 39s; animation-delay: -27s; --drift: 100px; }
.particle:nth-child(30) { left: 76%;  animation-duration: 25s; animation-delay: -11s; --drift: -160px; }

/* Partículas extras en el contenedor (opcionales) */
.container::before,
.container::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: #f51111;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff0026;
  animation: float-particles 35s linear infinite;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

.container::before { left: 10%; animation-delay: -16s; --drift: 100px; }
.container::after { left: 88%; animation-delay: -9s;  --drift: -100px; }

.container {
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
}

main {
  background: rgba(25, 25, 25, 0.75);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 8px 35px rgba(0, 0, 0, 0.8);
  margin-bottom: 20px;
  border: 1px solid rgba(255, 0, 77, 0.3); /* Borde rojo sutil */
}

/* ======================== */
/* TÍTULO PRINCIPAL */
/* ======================== */
header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-family: 'Almendra SC', serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: #d1cdcd;
  letter-spacing: 1.5px;
  animation: pulse-glow 5s ease-in-out infinite alternate;
}

.subtitle {
  font-size: 1.2rem;
  color: #d1cdcd;
  margin-top: 12px;
  font-weight: 500;
}

/* ======================== */
/* SECCIONES COLAPSABLES */
/* ======================== */
.collapsible-section {
  margin-bottom: 20px;
  background: rgba(35, 35, 35, 0.7);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 0, 77, 0.25);
}

.collapsible-header {
  cursor: pointer;
  user-select: none;
  padding: 20px 24px;
  background: rgba(45, 45, 45, 0.85);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Almendra SC', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: #d1cdcd;
  transition: all 0.4s ease;
}

.collapsible-header:hover {
  background: rgba(55, 55, 55, 0.95);
  box-shadow: 0 0 20px rgba(255, 0, 77, 0.4);
}

.toggle-icon {
  font-size: 1.6rem;
  transition: transform 0.4s ease;
  color: #d1cdcd;
}

.toggle-icon.rotated {
  transform: rotate(180deg);
}

.collapsible-content {
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.4s ease, padding 0.5s ease;
  max-height: 1500px;
  opacity: 1;
  padding: 0 24px;
  background: rgba(40, 40, 40, 0.6);
}

/* ======================== */
/* GRID DE DADOS */
/* ======================== */
.dice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
  padding: 12px 0;
}

.dice-btn {
  background: rgba(50, 50, 50, 0.9);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 0, 77, 0.5);
  border-radius: 12px;
  padding: 18px 10px;
  cursor: pointer;
  transition: all 0.4s ease;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #d1cdcd;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.dice-btn:hover {
  transform: translateY(-8px) scale(1.05);
  border-color: #c00303;
  background: rgba(65, 65, 65, 0.95);
  box-shadow: 0 15px 40px rgba(255, 0, 77, 0.5);
}

.dice-btn.active {
  background: linear-gradient(to bottom, #910808, #271919);
  color: white;
  box-shadow: 0 5px 35px rgba(255, 0, 77, 0.4);
}

/* ======================== */
/* CONTROLES Y BOTONES */
/* ======================== */
.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 40px 0;
}

.control-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #d1cdcd;
  font-size: 1.1rem;
}

.control-group input {
  width: 100%;
  padding: 16px;
  background: rgba(60, 60, 60, 0.95);
  border: 2px solid rgba(255, 0, 77, 0.6);
  border-radius: 12px;
  font-size: 1.3rem;
  color: #ffffff;
  text-align: center;
  transition: all 0.4s ease;
}

.control-group input:focus {
  outline: none;
  border-color: #c00303;
  box-shadow: 0 0 0 4px rgba(255, 0, 77, 0.4);
  background: rgba(70, 70, 70, 1);
}

.buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 30px 0;
}

.primary-btn,
.secondary-btn {
  padding: 20px;
  font-size: 1.4rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.primary-btn {
  background: linear-gradient(to bottom, #910808, #271919);
  color: white;
  box-shadow: 0 5px 35px rgba(255, 0, 77, 0.3);
  animation: button-glow 4s ease-in-out infinite alternate;
}

.primary-btn:hover {
  transform: translateY(-6px) scale(1.05);
  box-shadow: 0 20px 55px rgba(255, 0, 77, 0.8);
}

.secondary-btn {
  background: rgba(60, 60, 60, 0.95);
  color: #d1cdcd;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.secondary-btn:hover {
  background: rgba(75, 75, 75, 1);
  transform: translateY(-6px);
}

/* ======================== */
/* RESULTADOS Y DADOS VISUALES */
/* ======================== */
.hero-result {
  min-height: 200px;
  background: rgba(40, 40, 40, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 0, 77, 0.5);
  border-radius: 16px;
  padding: 28px;
  margin: 30px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 24px;
  box-shadow: 0 8px 35px rgba(0, 0, 0, 0.8);
}

.placeholder {
  color: #d1cdcd;
  font-size: 1.6rem;
  font-style: italic;
}

.die {
  width: 100px;
  height: 100px;
  background: rgba(55, 55, 55, 0.95);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  font-weight: bold;
  color: #d1cdcd;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.9), 0 0 15px rgba(255, 0, 77, 0.4);
  transition: transform 0.3s ease;
}

.die:hover {
  transform: scale(1.1) rotate(10deg);
}

/* ======================== */
/* ESTADÍSTICAS E HISTORIAL */
/* ======================== */
.result-display,
.stats-display,
.history {
  background: rgba(35, 35, 35, 0.75);
  backdrop-filter: blur(12px);
  border-radius: 14px;
  padding: 28px;
  margin: 30px 0;
  border: 1px solid rgba(255, 0, 77, 0.3);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.8);
}

.stat-item,
.history-header {
  color: #d1cdcd;
  font-weight: 600;
}

.history-item {
  background: rgba(50, 50, 50, 0.9);
  padding: 24px;
  border-radius: 14px;
  border-left: 6px solid #c00303;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.8);
}

/* ======================== */
/* BARRA DE PROGRESO */
/* ======================== */
.progress-container {
  margin: 30px 0;
}

.progress-bar {
  height: 32px;
  background: rgba(50, 50, 50, 0.8);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.6);
}

#progress-fill {
  height: 100%;
  background: linear-gradient(to right, #c00303, #d1cdcd);
  width: 0%;
  transition: width 0.5s ease;
  box-shadow: 0 0 20px #c00303;
}

#progress-text {
  text-align: center;
  margin-top: 16px;
  font-weight: 600;
  color: #d1cdcd;
  font-size: 1.2rem;
}

/* ======================== */
/* RESPONSIVE: TABLET */
/* ======================== */
@media (min-width: 768px) {
  body {
    padding: 30px 20px;
  }

  main {
    padding: 36px;
    border-radius: 18px;
  }

  header h1 {
    font-size: 3.4rem;
  }

  .controls,
  .buttons {
    grid-template-columns: 1fr 1fr;
  }

  .dice-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
  }

  .die {
    width: 120px;
    height: 120px;
    font-size: 3.2rem;
  }
}

/* ======================== */
/* RESPONSIVE: DESKTOP */
/* ======================== */
@media (min-width: 1024px) {
  header h1 {
    font-size: 4rem;
  }

  .dice-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ======================== */
/* RESPONSIVE: DESKTOP GRANDE */
/* ======================== */
@media (min-width: 1440px) {
  .container {
    max-width: 1200px;
  }
}