:root {
  --primary: #C5005C;
  --primary-glow: rgba(197, 0, 92, 0.2);
  --secondary: #666666;
  --accent: #FCD2DA;
  --bg-light: #ffffff;
  --bg-page: #FCD2DA;
  --text-dark: #333333;
  --glass: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(197, 0, 92, 0.1);
}

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

html {
  overflow-x: hidden;
  overflow-y: scroll; /* Force vertical scrollbar to prevent horizontal layout shifts */
}

html, body {
  min-width: 300px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-dark);
  min-height: 100vh;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Centered on desktop */
  padding: 0.5rem;
  overflow-x: hidden; /* Ensure no horizontal jitter from contents */
  background: radial-gradient(circle at center, #ffffff 0%, #FCD2DA 100%);
}

h1, h2, h3 {
  font-family: 'Playfair Display', serif;
}

.container {
  max-width: 600px;
  width: 100%;
  padding: 0.5rem; /* Updated to 0.5rem */
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Centered on desktop */
  gap: 0.5rem;
}

header h2 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  margin-bottom: 0; /* Margin moved to title-with-icon wrapper */
  color: var(--secondary);
}

.title-with-icon {
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
}

header {
  margin-bottom: 0.5rem;
}

.brand-title {
  font-family: 'Great Vibes', cursive;
  font-size: 4rem;
  color: var(--primary);
  margin-bottom: -10px;
}

.sub-title {
  font-size: 0.9rem;
  color: var(--secondary);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Wheel Container - REWRITTEN FOR PERFECT CIRCULAR ASPECT */
.wheel-wrapper {
  position: relative;
  width: clamp(280px, 80vmin, 420px);
  aspect-ratio: 1 / 1;
  margin: 10px auto 1rem auto;
  flex-shrink: 0; /* Never allow flex parent to squash this */
  display: block;
}

.wheel-container {
  position: absolute;
  inset: 15px; /* Fixed "safe zone" for glow to prevent clipping */
  border-radius: 50%;
  border: 10px solid var(--primary);
  background: white;
  box-shadow: inset 0 0 0 6px #C5005C; /* Sharp inner magenta stroke */
  overflow: hidden;
  transition: transform 5s cubic-bezier(0.15, 0, 0.15, 1);
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Multi-animation: One for glow, one for rainbow border */
  animation: wheel-glow-pulse 2s infinite alternate, wheel-rainbow 4s linear infinite;
  z-index: 5;
}

@keyframes wheel-glow-pulse {
  0% { box-shadow: inset 0 0 0 6px #C5005C, 0 0 15px rgba(197, 0, 92, 0.2); }
  100% { box-shadow: inset 0 0 0 6px #C5005C, 0 0 40px rgba(197, 0, 92, 0.5); }
}

@keyframes wheel-rainbow {
  0% { border-color: #C5005C; filter: drop-shadow(0 0 5px #C5005C); }
  25% { border-color: #f06; filter: drop-shadow(0 0 15px #f06); }
  50% { border-color: #90f; filter: drop-shadow(0 0 10px #90f); }
  75% { border-color: #0cf; filter: drop-shadow(0 0 15px #0cf); }
  100% { border-color: #C5005C; filter: drop-shadow(0 0 5px #C5005C); }
}

.wheel-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wheel-pointer {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1.6rem;
  height: 2rem;
  background: var(--primary);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  z-index: 20;
  /* filter: drop-shadow(0 2px 5px rgba(0,0,0,0.2)); */
}


.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 15%; /* Proportionally tied to the wheel's size */
  height: 15%;
  background: var(--primary);
  border-radius: 50%;
  z-index: 15;
  border: clamp(3px, 1vw, 6px) solid white; /* Scales border thickness */
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-center img {
  width: 50%; /* Image stays half the size of the circle */
  height: auto;
}

/* UI Elements */
.stats {
  background: var(--glass);
  backdrop-filter: blur(5px);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  /* Hidden state: no space taken */
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0;
  margin-bottom: 0;
  transition: opacity 0.5s ease, max-height 0.5s ease, padding 0.5s ease, margin-bottom 0.5s ease;
}

.stats.ready {
  opacity: 1;
  max-height: 300px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.spin-count {
  font-weight: bold;
  color: var(--primary);
  font-size: 1.2rem;
}

.btn-spin {
  padding: 1rem 3.5rem;
  font-size: 1.6rem;
  font-weight: bold;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px var(--primary-glow);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-reset {
  margin-top: 5px;
  background: none;
  border: none;
  color: #999;
  text-decoration: underline;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-reset:hover {
  color: var(--primary);
}

.btn-spin:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 15px 35px var(--primary-glow);
}

.btn-spin:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal {
  background: white;
  padding: 2rem;
  border-radius: 30px;
  border: 1px solid var(--accent);
  box-shadow: 0 20px 60px rgba(0,0,0,0.1);
  max-width: 450px;
  width: 100%;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  scrollbar-width: none;
  text-align: center;
  transform: scale(0.9);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal::-webkit-scrollbar {
  display: none; /* Hide scrollbar Webkit */
}

.modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.modal-wheel-preview {
  display: none !important; /* Removed as per user request */
}



.modal h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--secondary);
  text-transform: uppercase;
}

.modal h3#resultSubTitle {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  margin: 1rem 0 2rem 0;
  line-height: 1.1;
}

#resultMessage {
  margin-bottom: 2rem; /* Margin below the message */
}

#verificationContainer p:first-child {
  margin-bottom: 1rem; /* Margin below "Verification ID:" text */
}

.screenshot-info {
  margin-bottom: 2rem; /* Margin below "Screenshot this screen now!" text */
}

/* Form Styling */
.prize-form {
  display: flex;
  flex-direction: column;
  align-items: center; /* Center buttons and inputs */
  gap: 1rem;
  margin-bottom: 2rem;
}

.prize-form input {
  width: 100%; /* Keep inputs full width */
  padding: 1rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.prize-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.verification-id {
  background: #f9f9f9;
  padding: 1.2rem;
  border-radius: 15px;
  font-family: monospace;
  font-size: 2.2rem; /* Slightly larger */
  letter-spacing: 5px;
  color: var(--primary);
  border: 2px dashed var(--primary);
  margin-bottom: 0.5rem; /* Reduced to fit expiry text */
}

.expiry-date {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 2.5rem;
}

.btn-close {
  padding: 0.8rem 2.5rem;
  background: var(--primary);
  border: none;
  color: white;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  /* width removed */
}

.btn-later {
  padding: 0.8rem 2.5rem;
  background: #f0f0f0;
  border: none;
  color: #888;
  border-radius: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  /* width removed */
  margin-top: 10px;
}

.btn-later:hover {
  background: #e4e4e4;
  color: #333;
}

/* Info Button */
.btn-info {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  margin-left: 0.8rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  color: #888;
  border: 1px solid #888;
  font-family: 'Playfair Display', serif;
  font-size: 0.8rem;
  font-style: italic;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, color 0.2s, border-color 0.2s, background 0.2s;
  z-index: 25;
}

.btn-info:hover {
  transform: translateY(-50%) scale(1.1);
}

/* Odds Table */
.table-container {
  width: 100%;
  margin: 1.5rem 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--accent);
}

.odds-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.odds-table td {
  padding: 1rem;
  border-bottom: 1px solid #f0e6eb; /* Lighter accent */
  color: var(--secondary);
  font-weight: bold;
}

.odds-table tr:last-child td {
  border-bottom: none;
}

.odds-table td:last-child {
  text-align: right;
  color: var(--primary);
}

/* ─── Mobile (≤ 480px) ─────────────────────────────────────── */
@media (max-width: 480px) {

  html, body {
    height: 100%;
    /* Horizontal overflow is forbidden on mobile to kill jitter */
    overflow-x: hidden; 
    overflow-y: scroll;
  }

  body {
    justify-content: flex-start;
    align-items: center;
    padding-top: 1rem; /* Doubled top padding */
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    padding-bottom: 0.25rem;
  }

  .container {
    /* Stop using 100vw; use parent's min-width */
    width: 100%;
    min-width: 300px;
    height: auto;
    min-height: 100dvh;
    padding: 0; /* Minimal internal padding */
    justify-content: flex-start;
    gap: 0.4rem; /* Reduced gap */
    overflow: visible;
  }

  header {
    margin-bottom: 0;
  }

  .brand-title {
    font-size: clamp(2rem, 10vw, 3.5rem);
    margin-bottom: -6px;
  }

  /* Sub-title uses rem naturally */
  .sub-title {
    font-size: 0.75rem;
    letter-spacing: 2px;
  }

  /* Maximize wheel to the edges on mobile */
  .wheel-wrapper {
    width: 95vw;
    height: 95vw; /* Explicitly match width to force a square on mobile */
    max-width: 400px;
    max-height: 400px;
    margin: 0.5rem auto 0.75rem auto;
  }

  /* Shrunk the spinner arrow by 50% using rem */
  .wheel-pointer {
    width: 1.25rem;
    height: 1.5625rem;
    top: -0.5rem;
  }


  /* Stats / controls stay compact but with spacing for button */
  .stats {
    padding: 1.25rem 1rem; /* Symmetrical padding restores vertical alignment */
    margin-bottom: 1rem; 
    gap: 0.25rem;
  }

  .spin-count {
    font-size: 1rem;
  }

  .btn-spin {
    padding: 0.8rem 2.5rem;
    font-size: 1.2rem;
  }

  /* Modal: always centred, never taller than the screen */
  .modal-overlay {
    padding: 0.75rem;
    align-items: center;   /* vertical centre */
    justify-content: center; /* horizontal centre */
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 1.5rem);
    border-radius: 24px;
    padding: 1.5rem;
  }

  .modal h3#resultSubTitle {
    font-size: 2.2rem;
    margin: 0.8rem 0 1.5rem 0;
  }

  .verification-id {
    font-size: 1.6rem;
    letter-spacing: 3px;
  }
}
