/* ===== RESET & BASE ===== */
@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Press+Start+2P&display=swap");

:root {
  --primary: #6e45e2;
  --secondary: #88d3ce;
  --accent: #ff7e5f;
  --dark: #1a1a2e;
  --light: #f8f8f8;
  --glow: 0 0 20px rgba(110, 69, 226, 0.7);
}

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

html {
  font-size: 62.5%;
  background: radial-gradient(circle at center, #2a2a4a 0%, #1a1a2e 100%);
}

body {
  font-family: "Orbitron", "Press Start 2P", sans-serif;
  color: var(--light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* ===== COSMIC BACKGROUND ===== */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 20% 30%,
      rgba(110, 69, 226, 0.15) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(255, 126, 95, 0.15) 0%,
      transparent 25%
    );
  z-index: -1;
}

/* ===== HEADER ===== */
header {
  position: relative;
  width: 100%;
  height: 35vh;
  border-bottom: 4px solid var(--secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 2rem;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

h1 {
  font-size: 4rem;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: var(--glow);
  margin-bottom: 2rem;
}

.between {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 1.4rem;
  color: var(--secondary);
}

/* ===== MYSTERY NUMBER ===== */
.number {
  position: absolute;
  bottom: -9rem;
  left: 50%;
  transform: translateX(-50%);
  width: 15rem;
  height: 15rem;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  color: var(--light);
  border: 8px solid var(--light);
  box-shadow: 0 0 30px var(--primary), inset 0 0 20px rgba(255, 255, 255, 0.3);
  animation: pulse 2s infinite alternate;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 30px var(--primary);
  }
  100% {
    box-shadow: 0 0 50px var(--primary), 0 0 70px rgba(110, 69, 226, 0.5);
  }
}

/* ===== MAIN GAME AREA ===== */
main {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10rem 5rem 5rem;
  background: rgba(26, 26, 46, 0.7);
  backdrop-filter: blur(10px);
}

.left {
  width: 52rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.right {
  width: 52rem;
  font-size: 2rem;
}

/* ===== INPUT & BUTTONS ===== */
.guess {
  background: rgba(255, 255, 255, 0.1);
  border: 4px solid var(--secondary);
  font-family: inherit;
  color: var(--light);
  font-size: 5rem;
  padding: 2rem;
  width: 26rem;
  text-align: center;
  display: block;
  margin-bottom: 3rem;
  border-radius: 1rem;
  transition: all 0.3s;
}

.guess:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 25px rgba(255, 126, 95, 0.5);
}

.btn {
  border: none;
  background: linear-gradient(to right, var(--primary), var(--accent));
  color: var(--light);
  font-size: 2rem;
  font-family: inherit;
  padding: 2rem 3rem;
  cursor: pointer;
  border-radius: 5rem;
  transition: all 0.3s;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: 0.5s;
  z-index: -1;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn:hover::before {
  left: 100%;
}

.again {
  position: absolute;
  top: 2rem;
  left: 2rem;
}

/* ===== RANGE INDICATOR ===== */
.range-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 26rem;
}

.range-line {
  flex: 1;
  height: 2px;
  background: var(--secondary);
  position: relative;
}

.range-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
  transform: translateY(-1px);
}

.range-indicator span {
  font-size: 1.8rem;
  color: var(--secondary);
}

/* ===== HELP BUTTON ===== */
.btn.help {
  margin-top: 3rem;
  padding: 1.5rem;
  width: 26rem;
  font-size: 1.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--secondary);
}

.btn.help:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.hidden,
.overlay.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.modal-content {
  background: var(--dark);
  padding: 3rem;
  border-radius: 1rem;
  border: 3px solid var(--accent);
  max-width: 50rem;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 3rem;
  background: none;
  border: none;
  color: var(--light);
  cursor: pointer;
}

.modal h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: var(--accent);
}

.modal ul {
  font-size: 1.8rem;
  line-height: 1.6;
  padding-left: 2rem;
}

.modal li {
  margin-bottom: 1rem;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 1000;
}

/* ===== MESSAGE & SCORES ===== */
.message {
  margin-bottom: 6rem;
  height: 60px;
  font-size: 2.5rem;
}

.label-score {
  margin-bottom: 2rem;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10; /* Make sure it's above other elements */
}
.modal {
  z-index: 20; /* Higher than overlay, but still allows overlay clicks */
}

/* ===== WIN EFFECTS ===== */
@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

.winner .number {
  animation: pulse 0.5s infinite alternate, warp 1s ease-in-out;
}

@keyframes warp {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.2);
    filter: hue-rotate(180deg);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  html {
    font-size: 50%;
  }

  main {
    flex-direction: column;
    padding: 15rem 2rem 5rem;
  }

  .left,
  .right {
    width: 100%;
    margin-bottom: 5rem;
  }

  .number {
    width: 12rem;
    height: 12rem;
    font-size: 5rem;
    bottom: -6rem;
  }
}

/* ===== CONFETTI EFFECT ===== */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100px) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg) scale(0.5);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 15px;
  height: 15px;
  background-color: #f00;
  animation: confetti-fall 3s linear forwards;
  z-index: 1000;
  pointer-events: none;
}

/* Different confetti shapes */
.confetti.ribbon {
  clip-path: polygon(0% 50%, 15% 0%, 100% 0%, 85% 50%, 100% 100%, 15% 100%);
  width: 30px;
  height: 10px;
}

.confetti.flower {
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}
