html {
  overflow: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    #667eea 0%,
    #764ba2 25%,
    #f093fb 50%,
    #f5576c 75%,
    #4facfe 100%
  );
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    radial-gradient(
      circle at 20% 20%,
      rgba(255, 255, 255, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(240, 147, 251, 0.2) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 60%,
      rgba(245, 87, 108, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 60% 40%,
      rgba(79, 172, 254, 0.2) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 10% 90%,
      rgba(118, 75, 162, 0.15) 0%,
      transparent 50%
    );
  background-size: 40px 40px, 40px 40px, auto, auto, auto, auto, auto;
  pointer-events: none;
  animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

#game-container {
  margin: 0 !important;
  padding: 0 !important;
  text-align: center;
  position: relative;
  overflow: hidden;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Game Control Buttons - Top Left */
.game-controls {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
  display: flex;
  gap: 12px;
  flex-direction: column;
  max-width: 100vw;
}

.control-btn {
  background: linear-gradient(
    135deg,
    rgba(240, 147, 251, 0.9),
    rgba(245, 87, 108, 0.8)
  );
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 20px rgba(240, 147, 251, 0.4);
  color: #ffffff;
  position: relative;
  overflow: hidden;
}

.control-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.control-btn:hover {
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 30px rgba(240, 147, 251, 0.6);
}

.control-btn:hover::before {
  opacity: 1;
}

.control-btn:active {
  transform: translateY(-2px) scale(1.02);
}

.control-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  z-index: 1;
  position: relative;
}

.icon-btn {
  background: linear-gradient(135deg, #23284a 60%, #ff5e62 100%);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px #ff5e6244;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  margin-left: 12px;
  outline: none;
}
.icon-btn:hover {
  background: linear-gradient(135deg, #ff5e62 0%, #23284a 100%);
  box-shadow: 0 4px 24px #ffb347cc;
}
.icon-btn svg {
  display: block;
}

/* Modal pop-up for game over */
#game-over-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 35, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  backdrop-filter: blur(30px);
}

#game-over-modal .modal-content {
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(40px);
  border-radius: 28px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7), 0 0 60px rgba(168, 85, 247, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  padding: 48px 64px 40px 64px;
  text-align: center;
  color: #fff;
  min-width: 380px;
  border: 2px solid rgba(168, 85, 247, 0.5);
  position: relative;
  overflow: hidden;
}

#game-over-modal .modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(
    90deg,
    rgba(168, 85, 247, 0.8),
    rgba(236, 72, 153, 0.8),
    rgba(34, 197, 94, 0.8)
  );
}

#game-over-modal h1 {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 16px;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 2px;
}

#game-over-modal h2 {
  color: rgba(168, 85, 247, 0.9);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  margin-bottom: 24px;
  font-size: 1.8rem;
  font-weight: bold;
  letter-spacing: 1px;
}

#game-over-modal #final-score-modal {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 28px;
  border: 2px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 30px rgba(168, 85, 247, 0.3);
  margin: 24px 0;
  font-size: 2.8rem;
  font-weight: 900;
  color: rgba(168, 85, 247, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  position: relative;
  overflow: hidden;
}

#game-over-modal #final-score-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#game-over-modal #final-score-modal:hover::before {
  opacity: 1;
}

#game-over-modal #game-over-reason {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 30px;
}

#game-over-modal button {
  background: linear-gradient(
    135deg,
    rgba(168, 85, 247, 0.9),
    rgba(139, 92, 246, 0.8)
  );
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 16px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 30px rgba(168, 85, 247, 0.4);
  position: relative;
  overflow: hidden;
}

#game-over-modal button svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

#game-over-modal button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#game-over-modal button:hover {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.9),
    rgba(168, 85, 247, 0.8)
  );
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 40px rgba(168, 85, 247, 0.6);
  transform: translateY(-4px) scale(1.08);
}

#game-over-modal button:hover::before {
  opacity: 1;
}

#game-over-modal button:active {
  transform: translateY(0) scale(0.98);
}

/* Responsive Design - Mobile First */
@media (min-width: 768px) {
  #game-container {
    padding: 0 20px;
  }

  #tubes {
    gap: 20px;
  }

  .tube {
    width: 80px;
    height: 350px;
    min-width: 70px;
    min-height: 300px;
  }

  .tube-icon {
    width: 44px;
    height: 44px;
    bottom: 12px;
  }

  .ball {
    width: 28px;
    height: 28px;
  }

  .bullet {
    width: 7px;
    height: 7px;
  }

  #score-display {
    width: 160px;
    min-width: 140px;
    max-width: 180px;
    padding: 15px;
    gap: 8px;
  }

  .score-item {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .score-label {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }

  .score-value {
    font-size: 1.2rem;
  }

  .score-item.total .score-value {
    font-size: 1.5rem;
  }

  .miss-progress {
    max-width: 400px;
    gap: 8px;
    margin-bottom: 15px;
  }

  .progress-label {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  .progress-bar {
    height: 14px;
  }
}

@media (min-width: 1024px) {
  #tubes {
    gap: 80px;
    justify-content: center;
    margin-bottom: 50px;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .tube {
    width: 160px;
    height: 750px;
    min-width: 150px;
    min-height: 700px;
    border-radius: 40px 40px 80px 80px;
    border: 6px solid #23284a;
  }

  .tube-icon {
    width: 80px;
    height: 80px;
    bottom: 30px;
    border: 6px solid #fff2;
  }

  .ball {
    width: 56px;
    height: 56px;
  }

  .bullet {
    width: 16px;
    height: 16px;
  }

  .miss-progress {
    max-width: 800px;
    gap: 20px;
    margin-bottom: 40px;
  }

  .progress-label {
    font-size: 1.8rem;
    margin-bottom: 20px;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  }

  .progress-bar {
    height: 30px;
    border-radius: 18px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  }
}

/* Extra Large Desktop Screens */
@media (min-width: 1400px) {
  #tubes {
    gap: 100px;
    justify-content: center;
    margin-bottom: 60px;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .tube {
    width: 180px;
    height: 850px;
    min-width: 170px;
    min-height: 800px;
    border-radius: 45px 45px 90px 90px;
    border: 7px solid #23284a;
  }

  .tube-icon {
    width: 90px;
    height: 90px;
    bottom: 35px;
    border: 7px solid #fff2;
  }

  .ball {
    width: 64px;
    height: 64px;
  }

  .bullet {
    width: 18px;
    height: 18px;
  }

  #score-display {
    width: 360px;
    min-width: 340px;
    max-width: 400px;
    padding: 40px;
    gap: 25px;
    border-radius: 40px;
    border: 6px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 45px 160px rgba(0, 0, 0, 0.6),
      0 0 80px rgba(59, 130, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .score-item {
    padding: 35px 40px;
    border-radius: 32px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  .score-label {
    font-size: 1.5rem;
    margin-bottom: 15px;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  }

  .score-value {
    font-size: 2.2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  }

  .score-item.total .score-value {
    font-size: 3.4rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  }

  .miss-progress {
    max-width: 900px;
    gap: 25px;
    margin-bottom: 50px;
  }

  .progress-label {
    font-size: 2rem;
    margin-bottom: 25px;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  }

  .progress-bar {
    height: 35px;
    border-radius: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  }
}

/* Desktop Score Display Positioning */
@media (min-width: 1024px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #game-container {
    margin-left: -150px !important;
    margin-top: 20px !important;
    padding: 0 20px;
    width: 100%;
    max-width: 1200px;
    overflow: visible;
    height: auto;
    display: block;
  }

  #score-display {
    top: 50%;
    right: 0px;
    transform: translateY(-50%);
    width: 320px;
    min-width: 300px;
    max-width: 360px;
    padding: 35px;
    gap: 20px;
    border-radius: 36px;
    border: 5px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 40px 140px rgba(0, 0, 0, 0.6),
      0 0 70px rgba(59, 130, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .score-item {
    padding: 30px 35px;
    border-radius: 28px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  .score-label {
    font-size: 1.3rem;
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  }

  .score-value {
    font-size: 2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  }

  .score-item.total .score-value {
    font-size: 3rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  }
}

/* Small mobile devices */
@media (max-width: 360px) {
  #tubes {
    gap: 4px;
    padding: 0 4px;
  }

  .tube {
    width: 50px;
    height: 200px;
    min-width: 45px;
    min-height: 180px;
  }

  .tube-icon {
    width: 28px;
    height: 28px;
    bottom: 6px;
  }

  #score-display {
    width: 100px;
    min-width: 80px;
    max-width: 110px;
    padding: 8px;
    gap: 4px;
  }

  .score-item {
    padding: 4px 6px;
    border-radius: 6px;
  }

  .score-label {
    font-size: 0.5rem;
    margin-bottom: 1px;
  }

  .score-value {
    font-size: 0.8rem;
  }

  .score-item.total .score-value {
    font-size: 1rem;
  }

  .miss-progress {
    max-width: 280px;
    gap: 4px;
    margin-bottom: 8px;
  }

  .progress-label {
    font-size: 0.7rem;
    margin-bottom: 4px;
  }

  .progress-bar {
    height: 10px;
  }

  .game-controls {
    top: 5px;
    left: 5px;
    gap: 4px;
  }

  .control-btn {
    width: 36px;
    height: 36px;
    min-width: 32px;
    min-height: 32px;
  }

  .control-btn svg {
    width: 14px;
    height: 14px;
  }
}

/* Extra small screens and landscape mode */
@media (max-height: 500px) {
  #game-container {
    height: 100vh;
    justify-content: flex-start;
    padding-top: 10px;
  }

  .tube {
    height: 120px;
    min-height: 100px;
  }

  .miss-progress {
    margin-bottom: 5px;
  }

  #score-display {
    top: 5px;
    right: 5px;
  }

  .game-controls {
    top: 5px;
    left: 5px;
  }
}

/* Home modal responsive fixes */
@media (max-width: 768px) {
  .rules-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .home-modal {
    padding: 10px;
  }

  .rules-section {
    padding: 20px;
  }

  #game-over-modal .modal-content {
    padding: 30px 40px;
    min-width: 300px;
    width: 90%;
  }
}

@media (max-width: 480px) {
  .rules-section {
    padding: 15px;
  }

  #game-over-modal .modal-content {
    padding: 20px 30px;
    min-width: 280px;
    width: 95%;
  }

  #game-over-modal button {
    width: 56px;
    height: 56px;
    margin: 12px;
  }

  #game-over-modal button svg {
    width: 20px;
    height: 20px;
  }

  .home-modal {
    align-items: flex-start;
    padding: 10px;
  }

  .home-container {
    min-height: auto;
    padding: 10px;
    margin: 10px 0;
  }

  .rule-card {
    padding: 15px;
  }
}

/* Remove old #controls styles if present */
#controls {
  display: none !important;
}

#score {
  font-size: 2rem;
  margin-bottom: 24px;
  font-weight: bold;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px #4a90e2;
}

#score-display {
  position: fixed;
  top: 10px;
  right: 10px;
  transform: none;
  z-index: 50;
  width: 120px;
  min-width: 100px;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(15, 15, 35, 0.9);
  backdrop-filter: blur(30px);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.score-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.score-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.score-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.score-item:hover::before {
  opacity: 1;
}

.score-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.score-item:hover::before {
  opacity: 1;
}

.score-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.score-item.positive {
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.2),
    rgba(22, 163, 74, 0.15)
  );
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(34, 197, 94, 0.2);
}

.score-item.negative {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.2),
    rgba(220, 38, 38, 0.15)
  );
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(239, 68, 68, 0.2);
}

.score-item.total {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.25),
    rgba(217, 119, 6, 0.2)
  );
  border-color: rgba(245, 158, 11, 0.5);
  border-width: 2px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(245, 158, 11, 0.3),
    0 0 0 1px rgba(245, 158, 11, 0.3);
  transform: scale(1.05);
  order: -1;
  animation: totalGlow 3s ease-in-out infinite alternate;
}

@keyframes totalGlow {
  0% {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(245, 158, 11, 0.3),
      0 0 0 1px rgba(245, 158, 11, 0.3);
  }
  100% {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 40px rgba(245, 158, 11, 0.5),
      0 0 0 1px rgba(245, 158, 11, 0.5);
  }
}

.score-separator {
  display: none;
}

.score-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.score-value {
  font-size: 1rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  font-family: "Courier New", monospace;
}

.score-item.total .score-value {
  font-size: 1.2rem;
  color: #ffffff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  font-weight: 900;
}

.miss-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.progress-label {
  text-align: center;
  font-size: 0.8rem;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #dc2626);
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.total-score {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(
    135deg,
    rgba(255, 179, 71, 0.3),
    rgba(255, 94, 98, 0.3)
  );
  border-radius: 12px;
  border: 1px solid rgba(255, 179, 71, 0.4);
  margin-bottom: 12px;
}

.total-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.total-value {
  font-size: 1.8rem;
  font-weight: bold;
  color: #ffb347;
  text-shadow: 0 2px 12px rgba(255, 179, 71, 0.6);
}

#miss-count {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: #ff5e62;
  text-shadow: 0 2px 8px rgba(255, 94, 98, 0.4);
  background: rgba(255, 94, 98, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 94, 98, 0.2);
}

#tubes {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: flex-end;
  margin: 0;
  padding: 0 8px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  flex-shrink: 0;
}

.tube {
  background: linear-gradient(180deg, #23284a 60%, #23284a 100%);
  border-radius: 12px 12px 20px 20px;
  width: 60px;
  height: 250px;
  min-width: 50px;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: 0 4px 32px 0 #181c2faa, 0 0 24px 4px #ffb34733;
  border: 2px solid #23284a;
  transition: box-shadow 0.2s, border-color 0.2s;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}
.tube:active,
.tube.glow,
.tube.touch-active {
  box-shadow: 0 0 40px 10px #fff, 0 0 80px 20px #ff5e62;
  border-color: #fff;
  transform: scale(0.98);
}

/* Mobile touch feedback */
@media (max-width: 768px) {
  .tube:active,
  .tube.touch-active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}

.tube-icon {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px #ffb34755, 0 0 16px #ff5e62aa;
  border: 2px solid #fff2;
  z-index: 10;
  transition: box-shadow 0.2s, border-color 0.2s;
}

/* Mobile touch indicator */
@media (max-width: 768px) {
  .tube-icon {
    animation: mobilePulse 2s ease-in-out infinite;
  }
}

@keyframes mobilePulse {
  0%,
  100% {
    box-shadow: 0 2px 12px #ffb34755, 0 0 16px #ff5e62aa;
  }
  50% {
    box-shadow: 0 2px 16px #ffb34788, 0 0 24px #ff5e62cc;
  }
}
.tube-icon svg {
  display: block;
}

/* Smaller, slower, more energetic ball */
.ball {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  background: radial-gradient(
    circle at 30% 30%,
    #fff 0%,
    #ffb347 60%,
    #ff5e62 100%
  );
  border-radius: 50%;
  /* Remove default border - only show when absorbing */
  z-index: 2;
  animation: pop 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
  /* Remove shadow */
}

/* Bullet absorption effect */
.ball.absorbing {
  border: 4px solid #fff;
  box-shadow: 0 0 20px 8px #fff8, 0 0 40px 16px #ffb34788;
  animation: absorb 0.3s ease-out, blinkBorder 0.3s ease-out;
}

@keyframes absorb {
  0% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.1);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

@keyframes blinkBorder {
  0% {
    border-color: #fff;
  }
  25% {
    border-color: #ffb347;
  }
  50% {
    border-color: #ff5e62;
  }
  75% {
    border-color: #36d1c4;
  }
  100% {
    border-color: #fff;
  }
}

/* Bubble burst effect */
.burst-effect {
  position: absolute;
  width: 64px;
  height: 64px;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(circle, #fff 0%, #ff5e62 40%, transparent 80%);
  opacity: 0.8;
  animation: burstAnim 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
  box-shadow: 0 0 32px 8px #fff8, 0 0 64px 16px #ff5e6288;
}

@keyframes burstAnim {
  0% {
    opacity: 1;
    transform: scale(0.5);
  }
  60% {
    opacity: 0.9;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(2.2);
  }
}

/* Gun/muzzle flash effect at the bottom of the tube */
.gun-effect {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 36px;
  height: 36px;
  background: radial-gradient(
    circle,
    #fff 0%,
    #ffb347 40%,
    #ff5e62 80%,
    transparent 100%
  );
  border-radius: 50%;
  transform: translateX(-50%) scale(1.3);
  opacity: 0.95;
  z-index: 20;
  pointer-events: none;
  animation: gunFlash 0.18s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
  box-shadow: 0 0 32px 8px #fff8, 0 0 64px 16px #ff5e6288;
  border: 2px solid #fff;
}
@keyframes gunFlash {
  0% {
    opacity: 1;
    transform: translateX(-50%) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(2.2);
  }
}

#game-over {
  margin-top: 24px;
  animation: fadeIn 0.7s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#restart-btn {
  background: linear-gradient(90deg, #ffb347 0%, #ff5e62 100%);
  color: #23284a;
  border: none;
  border-radius: 12px;
  padding: 16px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 12px #ff5e62aa;
}
#restart-btn:hover {
  background: linear-gradient(90deg, #ff5e62 0%, #ffb347 100%);
  color: #fff;
  box-shadow: 0 4px 24px #ffb347cc;
}

h1 {
  font-size: 3rem;
  letter-spacing: 4px;
  margin-bottom: 8px;
  color: #fff;
  color: #4a90e2;

  font-family: "Luckiest Guy", cursive, "Segoe UI", Arial, sans-serif;
  animation: crazyTitle 2s infinite alternate;
  /* Remove margin-top */
  margin-top: 0;
}
@keyframes crazyTitle {
  0% {
    transform: rotate(-2deg) scale(1.05);
  }
  100% {
    transform: rotate(2deg) scale(1.12);
  }
}

/* Bullet fired from the bottom of the tube */
.bullet {
  width: 6px;
  height: 6px;
  background: radial-gradient(circle, #fff 0%, #ffb347 60%, #ff5e62 100%);
  border-radius: 50%;
  position: fixed;
  z-index: 10;
  animation: bulletFire 0.3s ease-out;
  box-shadow: 0 0 8px 3px #ffb347cc;
}
@keyframes bulletFire {
  0% {
    opacity: 0.7;
    transform: translateX(-50%) scale(0.7);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

/* Mini burst effect for first hit */
.mini-burst-effect {
  position: absolute;
  width: 32px;
  height: 32px;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 12;
  background: radial-gradient(
    circle,
    #fff 0%,
    #ffb347 40%,
    #ff5e62 80%,
    transparent 100%
  );
  opacity: 0.7;
  animation: miniBurstAnim 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
  box-shadow: 0 0 16px 4px #ffb34788;
}
@keyframes miniBurstAnim {
  0% {
    opacity: 1;
    transform: scale(0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

.tube.miss-effect {
  animation: missFlash 0.3s;
  border-color: #ff2222 !important;
  box-shadow: 0 0 40px 10px #ff2222, 0 0 80px 20px #ff5e62;
}
@keyframes missFlash {
  0% {
    border-color: #ff2222;
    box-shadow: 0 0 40px 10px #ff2222, 0 0 80px 20px #ff5e62;
  }
  100% {
    border-color: #ff5e62;
    box-shadow: 0 4px 32px 0 #ff5e62aa, 0 0 24px 4px #ffb34755;
  }
}

.bubble-piece {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 1;
  pointer-events: none;
  z-index: 30;
  box-shadow: 0 0 8px 2px #fff8, 0 0 16px 4px #ffb34788;
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s;
  will-change: transform, opacity;
}

/* Home page modal styles */
.home-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 15, 35, 0.95);
  background-image: linear-gradient(
      rgba(168, 85, 247, 0.1) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(168, 85, 247, 0.1) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(30px);
  overflow-y: auto;
  overflow-x: hidden;
}

.home-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.home-header {
  text-align: center;
  margin-bottom: 10px;
}

.play-button {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.9),
    rgba(217, 119, 6, 0.8)
  );
  border: none;
  border-radius: 20px;
  padding: 20px 40px;
  font-size: 1.3rem;
  font-weight: bold;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 30px rgba(245, 158, 11, 0.4);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 10px 0;
  display: inline-block;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.play-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.play-button:hover {
  background: linear-gradient(
    135deg,
    rgba(217, 119, 6, 0.9),
    rgba(245, 158, 11, 0.8)
  );
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 40px rgba(245, 158, 11, 0.6);
  transform: translateY(-6px) scale(1.05);
}

.play-button:hover::before {
  opacity: 1;
}

.play-button:active {
  transform: translateY(-2px) scale(1.02);
}

.rules-section {
  border-radius: 24px;
  padding: 10px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.rule-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.rule-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.rule-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.rule-card:hover::before {
  opacity: 1;
}

.rule-card h3 {
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 12px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.rule-card ul {
  margin: 0;
  padding-left: 20px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

.rule-card li {
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.highlight {
  color: rgba(59, 130, 246, 0.9);
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.game-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.feature-card {
  background: rgba(255, 179, 71, 0.1);
  border-radius: 12px;
  padding: 15px;
  border: 1px solid rgba(255, 179, 71, 0.3);
  text-align: center;
}

.feature-card h4 {
  color: #ffb347;
  margin-bottom: 8px;
  font-size: 1rem;
}

.feature-card p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  line-height: 1.4;
}
