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

body {
  font-family: "Arial", sans-serif;
  background: #1a1c1f;
  color: #fff;
  overflow: hidden;
  height: 100vh;
}

.game-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  position: relative;
  /* Prevent double-tap zoom */
  touch-action: manipulation;
}

/* UI Top */
.ui-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 800px;
  font-size: 18px;

  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  position: relative;
}

.score {
  padding: 10px;

  font-weight: bold;
  font-size: 24px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #464343;
}

#score {
  color: #4ecdc4;
}

/* Mute Button */
.mute-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #fff;
  position: relative;
  backdrop-filter: blur(10px);
}

.mute-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.mute-btn:active {
  transform: scale(0.95);
}

.mute-btn.muted {
  background: rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.5);
  color: #ff6b6b;
}

.mute-btn.muted:hover {
  background: rgba(255, 107, 107, 0.3);
  border-color: rgba(255, 107, 107, 0.7);
}

.sound-icon {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

/* Add X slash for muted state */
.mute-btn.muted .sound-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 2px;
  background: #ff6b6b;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 1px;
}

/* Game Area */
.game-area {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  overflow: visible;
  padding-top: 20px;
  position: relative;
}

/* Score Line */
.score-line {
  position: absolute;
  top: 25%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    #555555 20%,
    #333333 50%,
    #555555 80%,
    transparent 100%
  );
  transform: translateY(-50%);
  z-index: 1;
  box-shadow: 0 0 10px rgba(85, 85, 85, 0.5);
}

.score-line::before {
  content: "2 PTS";
  position: absolute;
  top: -25px;
  left: 10px;
  font-size: 12px;
  font-weight: bold;
  color: #4ecdc4;
  text-shadow: 0 0 5px rgba(78, 205, 196, 0.8);
  transition: all 0.3s ease;
}

.score-line::after {
  content: "1 PT";
  position: absolute;
  bottom: -25px;
  left: 10px;
  font-size: 12px;
  font-weight: bold;
  color: #ffa726;
  text-shadow: 0 0 5px rgba(255, 167, 38, 0.8);
  transition: all 0.3s ease;
}

/* Highlight animations for scoring */
.score-line.highlight-2pts::before {
  color: #00ffff;
  text-shadow: 0 0 15px rgba(0, 255, 255, 1), 0 0 25px rgba(78, 205, 196, 0.8);
  transform: scale(1.3);
  font-weight: 900;
}

.score-line.highlight-1pt::after {
  color: #ff9500;
  text-shadow: 0 0 15px rgba(255, 149, 0, 1), 0 0 25px rgba(255, 167, 38, 0.8);
  transform: scale(1.3);
  font-weight: 900;
}

/* Coin System */
.coin {
  position: absolute;
  width: 60px;
  height: 60px;
  left: 50%;
  bottom: -200px;
  transform: translateX(-50%);
  transform-style: preserve-3d;
  transition: transform 0.1s ease;
  z-index: 0;
}

.coin-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid #b8860b;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
}

.coin-front {
  background: linear-gradient(
    135deg,
    #ffd700 0%,
    #ffed4e 25%,
    #ffc107 50%,
    #ff8f00 75%,
    #ff6f00 100%
  );
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.3), 0 4px 8px rgba(0, 0, 0, 0.2);
}

.coin-back {
  background: linear-gradient(
    135deg,
    #c9b037 0%,
    #b8860b 25%,
    #daa520 50%,
    #b8860b 75%,
    #8b6914 100%
  );
  transform: rotateY(180deg);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.2), 0 4px 8px rgba(0, 0, 0, 0.2);
}

.coin-bullet-shape {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Coin Flip Animation */
@keyframes coinFlip {
  0% {
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%) rotateX(0deg);
    opacity: 1;
  }
  10% {
    bottom: 40%;
    left: 50%;
    transform: translateX(-50%) rotateX(720deg);
    opacity: 1;
  }
  20% {
    bottom: 70%;
    left: 50%;
    transform: translateX(-50%) rotateX(1440deg);
    opacity: 1;
  }
  30% {
    bottom: 85%;
    left: 50%;
    transform: translateX(-50%) rotateX(2160deg);
    opacity: 1;
  }
  50% {
    bottom: 90%;
    left: 50%;
    transform: translateX(-50%) rotateX(3600deg);
    opacity: 1;
  }
  100% {
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%) rotateX(3600deg);
    opacity: 1;
  }
}

.coin.flipping {
  animation: coinFlip 7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Coin Break Animation - Success */
@keyframes coinBreak {
  0% {
    transform: translateX(-50%) scale(1) rotateY(0deg);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) scale(1.4) rotateY(180deg);
    opacity: 0.8;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
  }
  100% {
    transform: translateX(-50%) scale(0.1) rotateY(360deg);
    opacity: 0;
  }
}

.coin.breaking {
  animation: coinBreak 0.6s ease-out forwards;
}

/* Revolver Container */
.revolver-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 0;
}

.cylinder-mask {
  width: 400px;
  height: 200px;
  overflow: hidden;
  position: relative;
  border-radius: 200px 200px 0 0;
  background: rgba(0, 0, 0, 0.1);
  margin: 0;
  padding: 0;
}

.cylinder {
  width: 400px;
  height: 400px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(45deg, #2c3e50, #34495e);
  position: absolute;
  top: 0;
  left: 0;
  cursor: grab;
  transition: transform 0.3s ease;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
  overflow: visible;
  z-index: 1;
  /* Hardware acceleration for smoother mobile performance */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  /* Optimize for smooth rotation */
  transform-origin: center center;
  image-rendering: optimizeSpeed;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  /* Prevent double-tap zoom */
  touch-action: manipulation;
}

/* Add decorative curves around the circumference */
.cylinder::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #4a5568 0deg,
    #2d3748 30deg,
    #4a5568 60deg,
    #2d3748 90deg,
    #4a5568 120deg,
    #2d3748 150deg,
    #4a5568 180deg,
    #2d3748 210deg,
    #4a5568 240deg,
    #2d3748 270deg,
    #4a5568 300deg,
    #2d3748 330deg,
    #4a5568 360deg
  );
  z-index: 0;
  opacity: 1;
  will-change: transform;
}

/* Add inner decorative ring with notches */
.cylinder::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border-radius: 50%;
  border: 2px solid #718096;
  background: repeating-conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 28deg,
    #718096 29deg,
    #718096 31deg,
    transparent 32deg,
    transparent 60deg
  );
  z-index: 3;
  pointer-events: none;
  opacity: 1;
  will-change: transform;
}

/* Add radial grooves for more detail */
.cylinder-grooves {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    transparent 35%,
    rgba(113, 128, 150, 0.3) 36%,
    rgba(113, 128, 150, 0.3) 37%,
    transparent 38%,
    transparent 42%,
    rgba(113, 128, 150, 0.2) 43%,
    rgba(113, 128, 150, 0.2) 44%,
    transparent 45%
  );
  pointer-events: none;
  z-index: 4;
}

.cylinder:active {
  cursor: grabbing;
}

.chamber {
  position: absolute;
  width: 80px;
  height: 80px;
  border: 4px solid #2d3748;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    #f4e4a6 0%,
    #d4af37 25%,
    #b8941f 50%,
    #9c7a1a 75%,
    #7d6118 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  opacity: 1;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 215, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  /* Hardware acceleration for smoother mobile performance */
  transform: translateZ(0);
  backface-visibility: hidden;
  /* Optimize for smooth rotation */
  transform-origin: center center;
  image-rendering: optimizeSpeed;
}

/* Chamber positions - using precise trigonometry for perfect equal spacing */
/* Center of cylinder: (200px, 200px), Radius: 130px, Chamber size: 80px */
/* 6 chambers at exactly 60° intervals starting from top: 0°, 60°, 120°, 180°, 240°, 300° */
.chamber-0 {
  top: 30px; /* 200 - 130*cos(0°) - 40 = 200 - 130 - 40 = 30px (TOP) */
  left: 160px; /* 200 + 130*sin(0°) - 40 = 200 + 0 - 40 = 160px */
}
.chamber-1 {
  top: 95px; /* 200 - 130*cos(60°) - 40 = 200 - 65 - 40 = 95px */
  left: 273px; /* 200 + 130*sin(60°) - 40 = 200 + 112.6 - 40 = 273px */
}
.chamber-2 {
  top: 225px; /* 200 - 130*cos(120°) - 40 = 200 - (-65) - 40 = 225px */
  left: 273px; /* 200 + 130*sin(120°) - 40 = 200 + 112.6 - 40 = 273px */
}
.chamber-3 {
  top: 290px; /* 200 - 130*cos(180°) - 40 = 200 - (-130) - 40 = 290px (BOTTOM) */
  left: 160px; /* 200 + 130*sin(180°) - 40 = 200 + 0 - 40 = 160px */
}
.chamber-4 {
  top: 225px; /* 200 - 130*cos(240°) - 40 = 200 - (-65) - 40 = 225px */
  left: 47px; /* 200 + 130*sin(240°) - 40 = 200 + (-112.6) - 40 = 47px */
}
.chamber-5 {
  top: 95px; /* 200 - 130*cos(300°) - 40 = 200 - 65 - 40 = 95px */
  left: 47px; /* 200 + 130*sin(300°) - 40 = 200 + (-112.6) - 40 = 47px */
}

/* Bullet Shapes - SVG based */
.bullet-shape {
  width: 25px;
  height: 25px;
  transition: all 0.3s ease;
  color: #d4af37; /* Bright brass/gold color */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 4px rgba(212, 175, 55, 0.4));
}

.bullet-shape.circle {
}

.bullet-shape.square {
}

.bullet-shape.triangle {
  margin-top: -8px;
}

.bullet-shape.star {
}

.bullet-shape.heart {
}

.bullet-shape.cross {
}

/* Trigger */
.trigger-container {
  position: absolute;
  top: 120px; /* Moved lower from 100px */
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
}

.trigger {
  width: 90px;
  height: 90px;
  font-size: 16px;
  font-weight: bold;
  background: linear-gradient(
    135deg,
    #e8e8e8 0%,
    #c0c0c0 25%,
    #a8a8a8 50%,
    #808080 75%,
    #696969 100%
  );
  color: #2c3e50;
  border: none !important;
  outline: none !important;
  border-radius: 50%; /* Make it perfectly circular */
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4),
    inset 0 1px 3px rgba(255, 255, 255, 0.3),
    inset 0 -1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
  /* Prevent double-tap zoom */
  touch-action: manipulation;
}

.trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 3px rgba(255, 255, 255, 0.4),
    inset 0 -1px 3px rgba(0, 0, 0, 0.3);
  background: linear-gradient(
    135deg,
    #f0f0f0 0%,
    #d0d0d0 25%,
    #b8b8b8 50%,
    #909090 75%,
    #787878 100%
  );
}

.trigger:active {
  transform: translateY(0);
}

/* Game Over Screen */
.game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.game-over h2 {
  font-size: 48px;
  margin-bottom: 20px;
  color: #ff6b6b;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-over p {
  font-size: 24px;
  margin-bottom: 30px;
}

.restart-btn {
  padding: 15px 30px;
  font-size: 20px;
  font-weight: bold;
  background: linear-gradient(45deg, #1abc9c, #16a085);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(26, 188, 156, 0.4);
  transition: all 0.3s ease;
}

.restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 188, 156, 0.6);
}

/* Animations */
@keyframes shoot {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

@keyframes hit {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
    background: #ffd700;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes miss {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
  100% {
    transform: translateX(0);
  }
}

.shoot-animation {
  animation: shoot 0.5s ease-out forwards;
}

.hit-animation {
  animation: hit 0.5s ease-out;
}

.miss-animation {
  animation: miss 0.5s ease-out;
}

/* Special handling for triangle shape which has margin-top */
.bullet-shape.triangle {
  transition: none !important;
  transform-origin: center center !important;
  margin-top: -8px !important; /* Maintain the triangle positioning */
}

/* Responsive Design */
@media (max-width: 768px) {
  .cylinder-mask {
    width: 320px;
    height: 160px;
    border-radius: 160px 160px 0 0;
    margin: 0;
    padding: 0;
  }

  .cylinder {
    width: 320px;
    height: 320px;
    top: 0;
    left: 0;
  }

  .chamber {
    width: 60px;
    height: 60px;
    border: 3px solid #2d3748;
  }

  /* Precise trigonometry for mobile - Center: (160px, 160px), Radius: 112px */
  /* 6 chambers at exactly 60° intervals: 0°, 60°, 120°, 180°, 240°, 300° */
  .chamber-0 {
    top: 23px; /* 160 - 112*cos(0°) - 25 = 160 - 112 - 25 = 23px */
    left: 135px; /* 160 + 112*sin(0°) - 25 = 160 + 0 - 25 = 135px */
  }
  .chamber-1 {
    top: 79px; /* 160 - 112*cos(60°) - 25 = 160 - 56 - 25 = 79px */
    left: 232px; /* 160 + 112*sin(60°) - 25 = 160 + 97 - 25 = 232px */
  }
  .chamber-2 {
    top: 191px; /* 160 - 112*cos(120°) - 25 = 160 - (-56) - 25 = 191px */
    left: 232px; /* 160 + 112*sin(120°) - 25 = 160 + 97 - 25 = 232px */
  }
  .chamber-3 {
    top: 247px; /* 160 - 112*cos(180°) - 25 = 160 - (-112) - 25 = 247px */
    left: 135px; /* 160 + 112*sin(180°) - 25 = 160 + 0 - 25 = 135px */
  }
  .chamber-4 {
    top: 191px; /* 160 - 112*cos(240°) - 25 = 160 - (-56) - 25 = 191px */
    left: 38px; /* 160 + 112*sin(240°) - 25 = 160 + (-97) - 25 = 38px */
  }
  .chamber-5 {
    top: 79px; /* 160 - 112*cos(300°) - 25 = 160 - 56 - 25 = 79px */
    left: 38px; /* 160 + 112*sin(300°) - 25 = 160 + (-97) - 25 = 38px */
  }

  .bullet-shape {
    width: 22px;
    height: 22px;
  }

  .trigger-container {
    top: 100px; /* Moved lower for mobile as well */
  }

  .ui-top {
    font-size: 20px;
  }

  /* Mobile decorative elements */
  .cylinder::before {
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
  }

  .cylinder::after {
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border-width: 1px;
  }
}

/* Chamber Arrow Indicator */
.chamber-arrow {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid #a7a9a2;
  z-index: 15;
  /* filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); */
}

/* Background Coins Display */
.coins-bg-display {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.05);
  z-index: 0;
  pointer-events: none;
  font-family: "Arial", sans-serif;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
}
