/* =============== GLOBAL =============== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: #ffffff;
  text-align: center;
  padding: 20px;
  min-height: 100vh;
}

h1 {
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 6px;
}

#chosen {
  font-size: 30px;
  font-weight: 900;
  margin-top: 8px;
  padding: 6px 18px;

  /* SHARP NEON BLUE TEXT */
  color: #4adeff;

  /* 🔵 CLEAN & SHARP (reduced glow) */
  text-shadow:
      0 0 3px #4adeff,
      0 0 6px #22d3ee;

  /* Dark cyber glass */
  background: rgba(0, 8, 20, 0.55);
  border: 2px solid #38bdf8;
  border-radius: 10px;

  display: inline-block;
  letter-spacing: 1px;

  /* Clean glow — NO BLUR FEEL */
  box-shadow:
      0 0 8px rgba(56, 189, 248, 0.55),
      0 0 14px rgba(14, 165, 233, 0.4),
      inset 0 0 4px rgba(56, 189, 248, 0.18);

  /* blur reduced to minimum */
  backdrop-filter: blur(1px);
}


/* =============== RULES POPUP =============== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.70);
  display: none;   /* ← IMPORTANT: default hide */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.rules-card {
  width: min(520px, 90%);
  background: #0f172a;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid #94a3b8;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  text-align: left;
  color: #e5e7eb;
}

.rules-card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.rules-card h3 {
  font-size: 17px;
  margin-top: 6px;
  margin-bottom: 4px;
}

.rules-card ul {
  margin-left: 18px;
  margin-bottom: 6px;
  font-size: 15px;
}

.rules-card li {
  margin-bottom: 4px;
}

.rules-btn {
  display: inline-block;
  padding: 10px 18px;
  background: #22c55e;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  margin-top: 10px;
  color: #022c22;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.8);
}

/* =============== MAIN GAME BOX =============== */
.console-box {
  width: 100%;
  max-width: 900px;
  margin: 22px auto 0;
  padding: 20px 18px 24px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #94a3b8;
  box-shadow: 0 0 30px rgba(129, 140, 248, 0.6) inset;
}

/* =============== TOP ICON BUTTONS =============== */
.top-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sound-btn {
  background: #0ea5e9;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

/* =============== GUESS BUTTONS (SILVER METALLIC 3D) =============== */

#guessBtns {
  margin-top: 12px;
}

/* Default button */
.guess-btn {
  background: linear-gradient(145deg, #d4d7dd, #b9bcc2, #9fa2a7);
  border: 2px solid #e6e7eb; /* silver edge */
  font-size: 22px;
  font-weight: 800;
  padding: 10px 24px;
  margin: 6px;
  border-radius: 12px;
  cursor: pointer;
  color: #1a1a1a; /* dark text for contrast */
  transition: 0.25s ease;
  box-shadow: 
      0 4px 10px rgba(0,0,0,0.35),      /* soft 3D drop shadow */
      inset 0 2px 4px rgba(255,255,255,0.6), /* top shine */
      inset 0 -2px 6px rgba(0,0,0,0.25);     /* bottom depth */
}

/* Hover 3D Pop */
.guess-btn:hover {
  transform: translateY(-4px) scale(1.05);  /* soft lift */
  box-shadow: 
      0 10px 18px rgba(0,0,0,0.45),
      inset 0 2px 4px rgba(255,255,255,0.7),
      inset 0 -2px 6px rgba(0,0,0,0.3);
}

/* Selected state */
.guess-btn.selected {
  background: linear-gradient(145deg, #facc15, #eab308, #c38f06);
  color: #0f172a;
  border-color: #facc15;
  box-shadow:
      0 0 18px rgba(250, 204, 21, 0.9),
      inset 0 2px 4px rgba(255,255,255,0.6),
      inset 0 -2px 6px rgba(0,0,0,0.25);
  transform: scale(1.10);
}


/* =============== CARDS (ROYAL BLACK + GOLD STYLE) =============== */

.cards {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 18px;
}

.card {
  width: 120px;
  height: 150px;
  perspective: 1000px;
  position: relative;
}

/* Flip Inner */
.inner {
  width: 100%;
  height: 100%;
  transition: transform 1s ease;
  transform-style: preserve-3d;
  border-radius: 16px;
}

/* Common Face Styling */
.front,
.back {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 2px solid rgba(255, 215, 0, 0.65);   /* Royal gold border */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 800;
  backface-visibility: hidden;
  box-shadow: 0 8px 22px rgba(0,0,0,0.55);
  transition: all 0.3s ease;
}

/* ROYAL BLACK FRONT */
.front {
  background: linear-gradient(145deg, #0d0d0d, #1a1a1a, #000000);
  color: #ffd700; /* pure gold text */
  text-shadow: 0 0 6px rgba(255,215,0,0.8);
}

/* GOLDEN BACK FACE */
.back {
  background: linear-gradient(150deg, #fceabb, #f8d98b, #f2c758, #e0ad32);
  color: #000000;  /* strong contrast black */
  font-weight: 900;
  transform: rotateY(180deg);
  text-shadow: 0 0 4px rgba(255,255,255,0.3);
}

/* Flip Trigger */
.flip {
  transform: rotateY(180deg);
}

/* Light shake animation (unchanged) */
.pre-anim {
  animation: shake 0.7s ease-in-out infinite alternate;
}

@keyframes shake {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.03) rotate(3deg); }
  100% { transform: scale(1) rotate(-3deg); }
}


/* =============== SPARK PARTICLES =============== */
.spark-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #facc15, #f97316, transparent);
  opacity: 0;
  animation: spark 0.6s ease-out forwards;
}

@keyframes spark {
  0% {
    opacity: 1;
    transform: scale(0.9);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.1);
  }
}

/* =============== ACTION BUTTONS =============== */
.play,
.restart {
  font-size: 18px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  margin: 10px 6px 6px;
}

.play {
  background: #22c55e;
  color: white;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.7);
}

.play:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.restart {
  background: #ef4444;
  color: white;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.7);
}

/* =============== TIMER + PROGRESS BAR (3D RICH STYLE) =============== */

#timer {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;

  color: #e0f4ff; /* soft bright text */
  text-shadow:
      0 0 6px rgba(56, 189, 248, 0.8),
      0 0 10px rgba(14, 165, 233, 0.7);

  padding: 6px 14px;
  background: rgba(0, 20, 40, 0.55);
  border: 2px solid rgba(56,189,248,0.5);
  border-radius: 8px;
  display: inline-block;
  box-shadow:
      0 0 12px rgba(56,189,248,0.65),
      inset 0 0 6px rgba(56,189,248,0.25);
  backdrop-filter: blur(3px);
}

/* Track background */
.progress-track {
  width: 100%;
  max-width: 450px;
  height: 14px;
  margin: 14px auto 0;
  background: linear-gradient(135deg, #0b1220, #0f172a);
  border-radius: 50px;
  overflow: hidden;

  /* 3D depth */
  box-shadow:
      inset 0 0 6px rgba(255,255,255,0.06),
      inset 0 4px 12px rgba(0,0,0,0.8),
      0 4px 12px rgba(0,0,0,0.5);
}

/* Progress moving bar */
.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg,
    #38bdf8,
    #4adeff,
    #22c55e,
    #facc15,
    #fb7185
  );
  background-size: 300% 300%;
  border-radius: 50px;
  transition: width 0.4s ease-out, background-position 1.5s ease;

  /* Neon glowing effect */
  box-shadow:
      0 0 10px rgba(56,189,248,0.7),
      0 0 20px rgba(56,189,248,0.5),
      inset 0 0 6px rgba(255,255,255,0.3);

  animation: barFlow 3s infinite linear;
}

@keyframes barFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Result text */
#result {
  margin-top: 14px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* WIN = Neon Green */
.win {
  color: #4ade80;
  text-shadow:
      0 0 8px rgba(74, 222, 128, 0.9),
      0 0 16px rgba(34, 197, 94, 0.7);
}

/* LOSE = Neon Red */
.lose {
  color: #fb7185;
  text-shadow:
      0 0 8px rgba(251, 113, 133, 0.9),
      0 0 16px rgba(244, 63, 94, 0.7);
}


/* =============== HISTORY BOX =============== */
.history-box {
  width: 100%;
  max-width: 1200px;
  margin: 10px auto;
  padding: 8px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: 16px;
  border: 1px solid #94a3b8;
  text-align: left;
  color: #e5e7eb;
}

.history-box h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.history-entry {
  padding: 6px 4px;
  border-bottom: 1px solid #475569;
  font-size: 14px;
}

/* ================= REAL FIRE CRACKER STYLE ================= */
#fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

/* Single spark particle */
.firework {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  
  /* real spark color */
  background: radial-gradient(circle, #fffceb 0%, #ffdd55 40%, #ff9b00 80%, transparent 100%);
  
  animation: blast 1.2s ease-out forwards;
  
  /* bright flash glow */
  box-shadow:
      0 0 10px rgba(255, 198, 52, 1),
      0 0 24px rgba(255, 132, 0, 0.8);
}

/* Main realistic explosion */
@keyframes blast {
  0% {
    opacity: 1;
    transform: scale(0.4);
  }
  
  /* Explosion outward */
  35% {
    opacity: 1;
    transform: translate(var(--dx), var(--dy)) scale(1.5);
  }
  
  /* Natural gravity pull */
  70% {
    opacity: 0.9;
    transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) * 1.5)) scale(0.9);
  }
  
  /* Fade + fall like real sparks */
  100% {
    opacity: 0;
    transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) * 2.2)) scale(0.2);
  }
}


/* =============== RESPONSIVE =============== */
@media (max-width: 600px) {
  .cards {
    gap: 12px;
  }
  .card {
    width: 95px;
    height: 120px;
  }
  .front, .back {
    font-size: 32px;
  }
}


