:root {
  --width: min(300px, 60vw);
  --height: calc(var(--width) * 1.3);
}

body {
  background-color: rgb(168, 165, 165);
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.container {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
}

.ball {
  width: var(--width);
  height: var(--height);
  background: url('../images/guiness.webp');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: absolute;
  cursor: pointer;
}

.bouncing {
  animation: toRight linear 5s infinite alternate, bounce linear 8s infinite alternate;
}

.instructions {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  font-size: clamp(16px, 4vw, 24px);
  color: white;
  text-shadow: 1px 1px 3px black;
  max-width: 80vw;
  line-height: 1.2;
  margin-bottom: 5px;
}

.pint-count {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  font-size: clamp(14px, 3.5vw, 20px);
  color: white;
  text-shadow: 1px 1px 3px black;
  font-weight: bold;
  margin-bottom: 10px;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.speed-control label {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  font-size: clamp(12px, 3vw, 16px);
  color: white;
  text-shadow: 1px 1px 3px black;
  white-space: nowrap;
}

.speed-slider {
  width: 100px;
  height: 20px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.3);
  outline: none;
  border-radius: 10px;
  cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.speed-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#speed-value {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  font-size: clamp(12px, 3vw, 16px);
  color: white;
  text-shadow: 1px 1px 3px black;
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  :root {
    --width: min(200px, 55vw);
  }
  
  .container {
    top: 5px;
    left: 5px;
  }
  
  .instructions {
    font-size: clamp(14px, 5vw, 20px);
  }
  
  .pint-count {
    font-size: clamp(12px, 4vw, 18px);
  }
  
  .speed-control {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .speed-control label {
    font-size: clamp(10px, 4vw, 14px);
  }
  
  .speed-slider {
    width: 80px;
  }
  
  #speed-value {
    font-size: clamp(10px, 4vw, 14px);
  }
}

/* Very small screens */
@media (max-width: 480px) {
  :root {
    --width: min(150px, 50vw);
  }
}

@keyframes bounce {
  0% {
    top: 0;
  }
  48% {
  }
  50% {
    top: calc(100vh - var(--height));
  }
  52% {
  }
  100% {
    top: 0;
  }
}

@keyframes toRight {
  0% {
    left: 0;
  }
  100% {
    left: calc(100vw - var(--width));
  }
}
