* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.container {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
}
.background {
  position: relative;
  width: 550px;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.background img {
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.main-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}
.lineball {
  position: absolute;
  top: 23%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.lineball img {
  width: 100%;
  height: 100%;
  max-width: 400px;
  object-fit: cover;
}
.middle {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.middle img {
  width: 100%;
  height: 100%;
  max-width: 40px;
  object-fit: cover;
}
.ball {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.ball img {
  width: 100%;
  height: 100%;
  max-width: 40px;
  object-fit: cover;
}
/* Row 1: 3 pegs */
.pegs1 {
  position: absolute;
  top: 35%;
  left: 35%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs1 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs2 {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs2 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs3 {
  position: absolute;
  top: 35%;
  left: 65%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs3 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

/* Row 2: 4 pegs */
.pegs4 {
  position: absolute;
  top: 45%;
  left: 20%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs4 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs5 {
  position: absolute;
  top: 45%;
  left: 40%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs5 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs6 {
  position: absolute;
  top: 45%;
  left: 60%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs6 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs7 {
  position: absolute;
  top: 45%;
  left: 80%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs7 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

/* Row 3: 4 pegs */
.pegs8 {
  position: absolute;
  top: 55%;
  left: 20%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs8 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs9 {
  position: absolute;
  top: 55%;
  left: 40%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs9 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs10 {
  position: absolute;
  top: 55%;
  left: 60%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs10 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs11 {
  position: absolute;
  top: 55%;
  left: 80%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs11 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

/* Row 4: 5 pegs */
.pegs12 {
  position: absolute;
  top: 65%;
  left: 10%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs12 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs13 {
  position: absolute;
  top: 65%;
  left: 30%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs13 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs14 {
  position: absolute;
  top: 65%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs14 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs15 {
  position: absolute;
  top: 65%;
  left: 70%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs15 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}

.pegs16 {
  position: absolute;
  top: 65%;
  left: 90%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.pegs16 img {
  width: 100%;
  height: 100%;
  max-width: 65px;
  object-fit: cover;
}
.reward {
  position: absolute;
  top: 85%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.reward img {
  width: 100%;
  height: 100%;
  max-width: 390px;
  object-fit: cover;
}
.buttonPlay {
  position: absolute;
  top: 73%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.buttonPlay img {
  width: 100%;
  height: 100%;
  max-width: 200px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.buttonPlay img:active {
  transform: scale(0.92);
}
/* Ball renders above pegs (pegs use z-index: 2).
   Squish is driven by JS setting the inline transform. */
.ball {
  transition: transform 0.16s ease;
  z-index: 3;
}
/* Peg flash when the ball physically hits it */
.peg-lit img {
  animation: pegLit 0.35s ease forwards;
}
@keyframes pegLit {
  0% {
    filter: brightness(1) drop-shadow(0 0 0px #fff0);
    transform: scale(1);
  }
  40% {
    filter: brightness(2.2) drop-shadow(0 0 12px #ffe87a);
    transform: scale(1.18);
  }
  100% {
    filter: brightness(1) drop-shadow(0 0 0px #fff0);
    transform: scale(1);
  }
}
/* Win overlay — completely removed from layout until .show is added */
.win-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  z-index: 100;
}
.win-overlay.show {
  display: flex;
}
/* Win image pops in via keyframes — more reliable than transition
   when the parent flips from opacity:0 to opacity:1 */
.win-overlay .win-img {
  width: 80%;
  max-width: 320px;
  object-fit: contain;
  transform: scale(0);
  opacity: 0;
  margin-top: 100px;
}
.win-overlay.show .win-img {
  animation: winPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes winPop {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.win-overlay .claim-btn {
  width: 55%;
  max-width: 210px;
  object-fit: contain;
  cursor: pointer;
  opacity: 0;
  margin-top: -200px;
}
.win-overlay.show .claim-btn {
  animation: winPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
}
@media (max-width: 440px) {
  .reward img {
    max-width: 300px;
  }
  [class^="pegs"] img {
    max-width: 45px;
  }
}
