:root {
  --bg: #f5c400;
  --circle-diameter: 200px;
  --r: 70px;
  --primary: #8b5cf6; /* Beautiful purple */
  --secondary: #06b6d4; /* Cyan accent */
  --success: #10b981; /* Green for success */
  --warning: #f59e0b; /* Orange for buttons */
  --danger: #ef4444; /* Red for alerts */
  --dark: #1f2937; /* Dark background */
  --light: #f8fafc; /* Light text areas */
}

/* Basic page styling */
* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh; /* Changed from height: 100vh */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden; /* Changed from overflow: hidden */
  overflow-y: auto; /* Allow vertical scrolling */
  padding: 10px 0; /* Add some padding */
}

.screen { 
  display: none; 
  width: 100%; 
  min-height: 100vh; /* Changed from height: 100% */
  justify-content: center; 
  align-items: center; 
  padding: 15px 10px; /* Increased padding */
  overflow-y: auto; /* Allow scrolling within screen */
}
.screen.active { display: flex; }

.box {
  background: linear-gradient(145deg, #1e293b, #334155);
  color: white;
  padding: 25px 35px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3), 0 0 20px rgba(139, 92, 246, 0.2);
  min-width: 320px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  backdrop-filter: blur(10px);
}

.box.wide { 
  width: 480px; 
  max-width: 95vw;
  max-height: none; /* Remove height restriction */
  overflow: visible; /* Allow content to show */
}

.logo { 
  max-width: 100px; 
  margin: 10px auto 15px; 
  display: block;
  filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.3));
}

.stats { 
  display: flex; 
  justify-content: space-between; 
  margin-bottom: 12px; 
  font-size: 14px; 
  font-weight: bold;
  background: rgba(139, 92, 246, 0.1);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.btn {
  display: block;
  width: 180px;
  margin: 12px auto;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  background: linear-gradient(145deg, #f59e0b, #d97706);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover {
  background: linear-gradient(145deg, #d97706, #b45309);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.btn:hover::before {
  left: 100%;
}

.btn:active {
  transform: translateY(0);
}

/* Circle layout */
.circle {
  position: relative;
  width: var(--circle-diameter);
  height: var(--circle-diameter);
  margin: 25px auto 55px;
  margin-left: calc(50% - 25px);
  transform: translateX(-50%);
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
}

/* Cup container */
.cup-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: rotate(var(--angle, 0deg)) translate(var(--r)) rotate(calc(-1 * var(--angle, 0deg)));
  transition: transform 250ms ease-out;
  width: 50px;
  height: 75px;
}

/* Cup image */
.cup {
  width: 100%;
  display: block;
  opacity: 0.6;
  cursor: default;
  transition: all 300ms ease;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.cup:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 6px 12px rgba(139, 92, 246, 0.4));
}

/* Ball position */
.ball {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  opacity: 1;
  transition: opacity 200ms ease;
  z-index: -1;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.6));
}

.hidden { 
  opacity: 0; 
  pointer-events: none; 
}

/* Prompt */
.prompt {
  margin: 15px auto 10px;
  background: linear-gradient(145deg, #8b5cf6, #7c3aed);
  color: #fff;
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  pointer-events: none;
  position: relative;
  font-weight: bold;
  font-size: 15px;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
  border: 1px solid rgba(255,255,255,0.2);
}

.prompt.hidden { display: none; }

/* Toast */
#toast {
  visibility: hidden;
  min-width: 250px;
  margin-left: -125px;
  background: linear-gradient(145deg, #1f2937, #374151);
  color: #fff;
  text-align: center;
  border-radius: 12px;
  padding: 16px 20px;
  position: fixed;
  left: 50%;
  bottom: 30px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.5s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

#toast.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px;
  transform: scale(1.05);
}

/* Reward section */
.reward-section {
  margin: 15px 0 10px 0;
  background: rgba(139, 92, 246, 0.1);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.reward-options {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.reward-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  color: #fff;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: rgba(255,255,255,0.1);
}

.reward-option:hover {
  background: rgba(139, 92, 246, 0.3);
  transform: scale(1.05);
}

.reward-option input[type="radio"] {
  margin: 0;
  cursor: pointer;
  accent-color: #8b5cf6;
}

.reward-option span {
  cursor: pointer;
  font-weight: 500;
}

.reward-message {
  background: linear-gradient(145deg, #059669, #047857);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: bold;
  margin: 0 auto;
  max-width: 280px;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.3);
  border: 1px solid rgba(255,255,255,0.2);
}

.controls {
  margin-top: 20px;
}

/* Age check styling */
.age-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 15px 0;
  color: #e5e7eb;
  font-size: 14px;
  cursor: pointer;
}

.age-check input[type="checkbox"] {
  accent-color: #8b5cf6;
  cursor: pointer;
}

/* Input fields */
input[type="text"] {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: white;
  border-radius: 8px;
  transition: all 0.3s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
  background: rgba(255,255,255,0.15);
}

input[type="text"]::placeholder {
  color: rgba(255,255,255,0.5);
}

/* Mobile optimizations */
@media (max-width: 600px) {
  :root { 
    --circle-diameter: 160px;
    --r: 55px;
  }
  
  body {
    padding: 5px 0; /* Changed from padding: 5px; */
  }
  
  .screen {
    padding: 10px 5px; /* Changed from 15px 10px */
    align-items: flex-start; /* NEW: Align to top instead of center */
    padding-top: 20px; /* NEW: Add top padding */
  }
  
  .box {
    padding: 15px 20px; /* Reduced from 20px 25px */
    border-radius: 16px;
    margin: 0 auto; /* NEW: Center horizontally */
  }
  
  .box.wide { 
    width: 95vw; 
    max-height: none; /* Changed from 95vh */
    overflow: visible; /* Changed from overflow-y: auto */
  }
  
  .logo { 
    max-width: 70px;
    margin: 5px auto 10px; /* Reduced from 10px auto 15px */
  }
  
  .cup-container { 
    width: 40px; 
    height: 60px; 
  }
  
  .ball { 
    width: 16px; 
    height: 16px; 
    bottom: 6px; 
  }
  
  .btn { 
    width: 160px; 
    font-size: 13px; 
    padding: 8px 12px; /* Reduced from 10px 12px */
    margin: 6px auto; /* Reduced from 8px auto */
  }
  
  .stats { 
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .prompt { 
    font-size: 13px; 
    padding: 8px 12px; 
  }
  
  .circle {
    margin: 10px auto 15px; /* Reduced from 15px auto 25px */
  }
  .reward-options {
    flex-direction: column;
    gap: 6px; /* Reduced from 8px */
    align-items: center;
  }
  
  .reward-option {
    font-size: 12px;
    justify-content: center;
    padding: 4px 10px; /* Reduced from 6px 12px */
  }
  
  .reward-message {
    font-size: 12px;
    padding: 8px 12px;
    max-width: 250px;
  }
  
  .reward-section {
    padding: 10px; /* Reduced from 12px */
    margin: 8px 0 5px 0; /* Reduced from 12px 0 8px 0 */
  }
  
  .controls {
    margin-top: 10px; /* NEW: Reduced from 20px */
  }
  
  #toast {
    min-width: 200px;
    margin-left: -100px;
    font-size: 13px;
    padding: 12px 16px;
  }
  
  input[type="text"] {
    width: 280px !important;
    max-width: 85% !important;
    padding: 10px;
    font-size: 14px;
  }
  
  h2 {
    font-size: 1.2rem; /* Reduced from 1.3rem */
    margin-bottom: 10px; /* Reduced from 15px */
  }
}

@media (max-height: 700px) {
  .circle {
    margin: 8px auto 12px;
  }
  
  .logo {
    max-width: 60px;
    margin: 3px auto 8px;
  }
  
  .reward-section {
    margin: 5px 0 3px 0;
    padding: 8px;
  }
  
  .btn {
    margin: 4px auto;
    padding: 6px 10px;
  }
  
  .controls {
    margin-top: 8px;
  }
}
@media (max-width: 400px) {
  :root { 
    --circle-diameter: 130px; /* Reduced from 140px */
    --r: 45px; /* Reduced from 48px */
  }
  
  .cup-container { 
    width: 32px; /* Reduced from 35px */
    height: 48px; /* Reduced from 52px */
  }
  
  .ball { 
    width: 12px; /* Reduced from 14px */
    height: 12px; /* Reduced from 14px */
  }
  
  .btn { 
    width: 130px; /* Reduced from 140px */
    font-size: 12px;
    padding: 6px 8px; /* Reduced padding */
  }
  
  .reward-message {
    max-width: 180px; /* Reduced from 200px */
  }
  
  .box {
    padding: 12px 15px; /* Reduced padding */
  }
}