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

body {
  background-color: #0d0d0d;
  color: #ffffff;
  font-family: 'Orbitron', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  transition: background-color 0.3s ease;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 255, 247, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 247, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 8s linear infinite;
  z-index: -1;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 255, 247, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 247, 0.06) 1px, transparent 1px),
    radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.92) 100%);
  background-size: 130px 130px, 130px 130px, 100% 100%;
  animation: gridMoveSlow 20s linear infinite;
  z-index: -1;
}

@keyframes gridMove {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 50px 50px, 50px 50px; }
}

@keyframes gridMoveSlow {
  0% { background-position: 0 0, 0 0, center; }
  100% { background-position: -130px 130px, -130px 130px, center; }
}

h1::before,
h1::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
  pointer-events: none;
}

h1::before {
  width: 400px;
  height: 400px;
  background: rgba(0, 255, 247, 0.18);
  top: -100px;
  left: -100px;
  filter: blur(70px);
  animation: floatOrb1 14s ease-in-out infinite alternate;
}

h1::after {
  width: 350px;
  height: 350px;
  background: rgba(130, 0, 255, 0.2);
  bottom: -100px;
  right: -80px;
  filter: blur(70px);
  animation: floatOrb2 10s ease-in-out infinite alternate;
}

@keyframes floatOrb1 {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(80px, 60px); }
}

@keyframes floatOrb2 {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-60px, -50px); }
}

body.win-flash {
  animation: winFlash 0.6s ease;
}

body.lose-flash {
  animation: loseFlash 0.6s ease;
}

@keyframes winFlash {
  0%, 100% { background-color: #0d0d0d; }
  50% { background-color: #002a1a; }
}

@keyframes loseFlash {
  0%, 100% { background-color: #0d0d0d; }
  50% { background-color: #2a0000; }
}

h1 {
  font-size: 3rem;
  margin-bottom: 40px;
  text-transform: uppercase;
  letter-spacing: 8px;
  color: #00fff7;
  text-shadow: 0 0 10px #00fff7, 0 0 30px #00fff7;
  animation: neonFlicker 6s infinite;
}

@keyframes neonFlicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    color: #00fff7;
    text-shadow: 0 0 10px #00fff7, 0 0 30px #00fff7, 0 0 60px #00fff7;
  }
  20%, 24%, 55% {
    color: rgba(0, 255, 247, 0.4);
    text-shadow: none;
  }
  22% {
    color: rgba(0, 255, 247, 0.7);
    text-shadow: 0 0 5px #00fff7;
  }
}

#buttons {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
}

button {
  padding: 14px 30px;
  font-size: 0.9rem;
  font-family: 'Orbitron', sans-serif;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 2px solid #00fff7;
  background: transparent;
  color: #00fff7;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  background: #00fff7;
  color: #0d0d0d;
  box-shadow: 0 0 15px #00fff7, 0 0 40px #00fff7;
}

button:active {
  transform: translateY(4px) scale(0.96);
  box-shadow: none;
}

#clear-btn {
  border-color: #ff4d4d;
  color: #ff4d4d;
}

#clear-btn:hover {
  background: #ff4d4d;
  color: #0d0d0d;
  box-shadow: 0 0 15px #ff4d4d, 0 0 40px #ff4d4d;
}

#coin {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid #00fff7;
  box-shadow: 0 0 20px #00fff7, 0 0 50px rgba(0, 255, 247, 0.2);
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  color: #00fff7;
  margin-bottom: 30px;
}

#coin.flipping {
  animation: coinFlip 0.8s ease-in-out;
}

@keyframes coinFlip {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(720deg); }
}

#result-message {
  font-size: 1.3rem;
  letter-spacing: 2px;
  min-height: 2rem;
  margin-bottom: 16px;
}

#result-message.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

#streak {
  font-size: 1rem;
  letter-spacing: 2px;
  color: #ffd700;
  text-shadow: 0 0 10px #ffd700;
  min-height: 1.5rem;
  margin-bottom: 30px;
}

#score-board {
  display: flex;
  gap: 50px;
  font-size: 1.1rem;
  letter-spacing: 2px;
  border: 1px solid #333;
  padding: 20px 40px;
  border-radius: 12px;
  background: #1a1a1a;
}

#wins {
  color: #00ff88;
  text-shadow: 0 0 8px #00ff88;
  font-weight: bold;
}

#losses {
  color: #ff4d4d;
  text-shadow: 0 0 8px #ff4d4d;
  font-weight: bold;
}

#keyboard-hint {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 2px;
  margin-top: 20px;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.8rem;
    letter-spacing: 4px;
    margin-bottom: 30px;
  }

  #buttons {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
  }

  button {
    width: 220px;
    padding: 14px 20px;
    font-size: 0.85rem;
  }

  #coin {
    width: 90px;
    height: 90px;
    font-size: 1.6rem;
    margin-bottom: 24px;
  }

  #result-message {
    font-size: 1rem;
    text-align: center;
    padding: 0 20px;
  }

  #streak {
    font-size: 0.85rem;
    text-align: center;
  }

  #score-board {
    gap: 30px;
    padding: 16px 28px;
    font-size: 0.95rem;
  }

  #keyboard-hint {
    display: none;
  }
}
