:root {
  --main-bg: #ffffff;
  --teal-dark: #0a8770;
  --cream: #fff7e6;
  --dusty-pink: #d99a9a;
  --butter-yellow: #fae392;
  --teal-light: #16a085;
  --espresso: #3b2b20;
}

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

body {
  font-family: 'Outfit', sans-serif;
  color: var(--espresso);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

.bg-wrapper {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  position: relative;
  background-color: var(--main-bg);
}

.bg-image {
  position: absolute;
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.3;
  z-index: 1;
  pointer-events: none;
}

.content-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
  margin-bottom: 40px;
  color: #222222;
}

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

.wheel-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
  margin-bottom: 40px;
}

.wheel-pointer {
  position: absolute;
  top: -20px; left: 50%;
  transform: translateX(-50%);
  transform-origin: top center;
  width: 40px; height: 50px;
  background: var(--espresso);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  z-index: 10;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
  animation: pointer-wobble 2.5s ease-in-out infinite;
}

@keyframes pointer-wobble {
  0% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(-50%) rotate(-4deg); }
  50% { transform: translateX(-50%) rotate(0deg); }
  75% { transform: translateX(-50%) rotate(4deg); }
  100% { transform: translateX(-50%) rotate(0deg); }
}

#wheel-canvas {
  width: 100%; height: 100%;
  border-radius: 50%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 0 0 8px rgba(0, 0, 0, 0.05);
  transition: transform 5s cubic-bezier(0.2, 0.8, 0.1, 1);
  transform: rotate(0deg);
}

.wheel-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 110px; height: 110px;
  background: #ffffff;
  border-radius: 50%;
  z-index: 5;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15), inset 0 -4px 10px rgba(0,0,0,0.05);
  display: flex; justify-content: center; align-items: center;
  padding: 8px;
}

.wheel-center .bean-img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(250, 227, 146, 0.6);
}

/* Loading animations while spinning */
.wheel-container.is-spinning .wheel-center {
  animation: pulse-glow 0.8s infinite alternate;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 4px 15px rgba(0,0,0,0.15), inset 0 -4px 10px rgba(0,0,0,0.05), 0 0 0 0 rgba(196, 214, 0, 0); }
  100% { box-shadow: 0 4px 15px rgba(0,0,0,0.15), inset 0 -4px 10px rgba(0,0,0,0.05), 0 0 30px 10px rgba(196, 214, 0, 0.6); }
}

.wheel-container.is-spinning .wheel-pointer {
  animation: pointer-bounce 0.15s infinite;
}

@keyframes pointer-bounce {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  50% { transform: translateX(-50%) rotate(-8deg); }
}

.spin-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
  background-color: #2a2a2a; /* Dark grey section */
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.form-row {
  display: flex;
  width: 100%;
  gap: 12px;
}

.spin-form input {
  flex-grow: 1;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #ffffff;
  color: var(--espresso);
  outline: none;
  transition: all 0.3s;
}

.spin-form input::placeholder { color: rgba(0, 0, 0, 0.4); }
.spin-form input:focus { border-color: var(--teal-light); }

.spin-form button {
  padding: 18px 36px;
  font-size: 1.2rem;
  font-weight: 800;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  background: #C4D600;
  color: var(--espresso);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(196, 214, 0, 0.4);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spin-form button::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
  transform: rotate(45deg) translate(-100%, -100%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: rotate(45deg) translate(-100%, -100%); }
  20% { transform: rotate(45deg) translate(100%, 100%); }
  100% { transform: rotate(45deg) translate(100%, 100%); }
}

.spin-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196, 214, 0, 0.6);
}

.spin-form button:disabled {
  opacity: 0.8; cursor: not-allowed; transform: none;
}

.loader-inline {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border: 3px solid rgba(59, 43, 32, 0.2);
  border-top-color: var(--espresso);
  border-radius: 50%;
  animation: spin-loader 1s linear infinite;
}

@keyframes spin-loader {
  to { transform: rotate(360deg); }
}

.error-msg {
  color: #ff6b6b;
  margin-top: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}

.footer-text {
  font-size: 0.95rem;
  color: rgba(0, 0, 0, 0.6);
  font-weight: 400;
  line-height: 1.5;
}

/* Toast */
.toast {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex; justify-content: center; align-items: center;
  padding: 20px;
  animation: fadeIn 0.3s forwards;
}

.toast-content {
  background: #ffffff;
  color: var(--espresso);
  padding: 40px;
  border-radius: 24px;
  text-align: center;
  max-width: 400px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  transform: scale(0.9);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  border: 1px solid rgba(0,0,0,0.05);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { to { transform: scale(1); } }

.toast h2 {
  font-family: 'Sora', sans-serif;
  font-size: 2.2rem; margin-bottom: 12px; color: var(--teal-dark);
}

#toast-prize { font-size: 1.6rem; font-weight: 800; margin-bottom: 24px; }

.code-box {
  background: rgba(0,0,0,0.03); padding: 16px; border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; border: 1px dashed rgba(0,0,0,0.15);
}
.code-box span { font-family: monospace; font-size: 1.3rem; font-weight: bold; }
.code-box button {
  background: var(--teal-dark); color: #ffffff; border: none;
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 600;
}

.redeem-msg {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 24px;
  line-height: 1.5;
}

.qr-box { margin-bottom: 20px; }
.qr-box img { width: 150px; height: 150px; margin: 0 auto 10px; display: block; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1); }
.qr-box p { font-size: 0.9rem; color: #666; }

/* Official Rules Accordion */
.official-rules {
  width: 100%;
  max-width: 600px;
  margin: 40px auto 20px;
  text-align: left;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  overflow: hidden;
}

.official-rules summary {
  padding: 16px 24px;
  font-weight: 600;
  cursor: pointer;
  background: #ffffff;
  color: var(--teal-dark);
  font-size: 1.1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.official-rules summary::-webkit-details-marker {
  display: none;
}

.official-rules summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 400;
  transition: transform 0.3s;
}

.official-rules[open] summary::after {
  transform: rotate(45deg);
}

.rules-content {
  padding: 24px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #444;
  max-height: 400px;
  overflow-y: auto;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.rules-content h4 {
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--espresso);
  font-size: 0.9rem;
  font-weight: 800;
}

.rules-content h4:first-child {
  margin-top: 0;
}

.rules-content p {
  margin-bottom: 12px;
}

.rules-content ul {
  margin-left: 20px;
  margin-bottom: 12px;
}

.rules-content a {
  color: var(--teal-dark);
  text-decoration: underline;
}

.rules-content a:hover {
  text-decoration: none;
}

#wbx-powered-by-slot {
  margin-top: 40px; width: 100%; display: flex; justify-content: center;
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; }
  .spin-form button { width: 100%; }
  h1 { font-size: 1.8rem; }
}