/* ============================================================
   Wheel landing page — responsive
   ============================================================ */

:root {
  /* Overridden at runtime by JS with the actual wheel pixel size */
  --wheel-size: 520px;
}

.wheel-page {
  background: radial-gradient(ellipse at top, #1b1040 0%, #0a0620 55%, #050311 100%);
  color: #fff;
  min-height: 100vh;
  font-family: Tahoma, Arial, sans-serif;
  overflow-x: hidden;
}

.wheel-landing {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 20px) clamp(40px, 8vw, 80px);
  text-align: center;
}

/* ---------- Header ---------- */
.wheel-header { margin-bottom: clamp(24px, 5vw, 40px); }

.wheel-title {
  font-size: clamp(24px, 6vw, 48px);
  font-weight: 900;
  margin: 0 0 clamp(8px, 2vw, 12px);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.wheel-title-glow {
  background: linear-gradient(135deg, #ffd166 0%, #ff8a5b 45%, #ff4b6e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 20px rgba(255, 100, 120, 0.35));
}

.wheel-sub {
  max-width: 640px;
  margin: 0 auto;
  font-size: clamp(13px, 3.4vw, 15px);
  line-height: 1.9;
  color: #c9c5e0;
  text-align: justify;
  text-align-last: center;
}

/* ---------- Stage ---------- */
.wheel-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

/* ---------- Wheel wrapper ---------- */
.wheel-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.wheel-wrapper.hidden { display: none; }

/* ---------- Pointer ---------- */
.wheel-pointer {
  position: absolute;
  top: calc(var(--wheel-size) * -0.075);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  filter: drop-shadow(0 6px 14px rgba(255, 75, 110, 0.6));
  animation: pointerBounce 2s ease-in-out infinite;
  pointer-events: none;
}

.wheel-pointer svg {
  display: block;
  width: calc(var(--wheel-size) * 0.08);
  height: calc(var(--wheel-size) * 0.12);
}

@keyframes pointerBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-4px); }
}

/* ---------- Glow ---------- */
.wheel-glow {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle,
              rgba(255, 100, 120, 0.45) 0%,
              rgba(255, 100, 120, 0.15) 40%,
              transparent 70%);
  animation: glowPulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes glowPulse {
  0%, 100% { transform: scale(1);    opacity: 0.85; }
  50%      { transform: scale(1.08); opacity: 1;    }
}

/* ---------- Canvas ---------- */
#wheel-canvas {
  position: relative;
  z-index: 1;
  display: block;
  border-radius: 50%;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.06),
    0 0 40px rgba(255, 100, 120, 0.35),
    0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ---------- Spin button ---------- */
.spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--wheel-size) * 0.21);
  height: calc(var(--wheel-size) * 0.21);
  min-width: 76px;
  min-height: 76px;
  border-radius: 50%;
  border: 3px solid #fff;
  cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #ff8a5b 0%, #ff4b6e 60%, #c9184a 100%);
  color: #fff;
  font-size: clamp(13px, calc(var(--wheel-size) * 0.034), 18px);
  font-weight: 900;
  z-index: 2;
  padding: 0;
  box-shadow:
    0 8px 24px rgba(255, 75, 110, 0.5),
    inset 0 -4px 12px rgba(0, 0, 0, 0.25);
  transition: transform .15s ease, box-shadow .2s ease;
}

/* Small lock indicator when the user isn't verified yet */
.spin-btn.needs-auth::after {
  content: '🔒';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: clamp(12px, calc(var(--wheel-size) * 0.03), 16px);
  opacity: 0.95;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.spin-btn:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow:
    0 12px 30px rgba(255, 75, 110, 0.7),
    inset 0 -4px 12px rgba(0, 0, 0, 0.25);
}

.spin-btn:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.97);
}

.spin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.spin-btn-label {
  display: block;
  transform: rotate(-10deg);
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ---------- Result box ---------- */
.result-box {
  margin-top: clamp(24px, 5vw, 40px);
  animation: resultPop .55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.result-box.hidden { display: none; }

@keyframes resultPop {
  0%   { opacity: 0; transform: translateY(30px) scale(0.85); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.result-card {
  background: linear-gradient(160deg, #221a4d 0%, #1a1038 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: clamp(16px, 4vw, 24px);
  padding: clamp(24px, 5vw, 40px) clamp(18px, 4vw, 32px);
  max-width: 480px;
  margin: 0 auto;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.result-card.win {
  border-color: rgba(255, 209, 102, 0.5);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(255, 209, 102, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.result-card.lose {
  border-color: rgba(150, 150, 180, 0.25);
}

.result-icon {
  font-size: clamp(48px, 12vw, 64px);
  line-height: 1;
  margin-bottom: 12px;
  animation: iconBounce .8s ease both;
}

@keyframes iconBounce {
  0%   { transform: scale(0) rotate(-30deg); }
  60%  { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

.result-title {
  font-size: clamp(20px, 5.5vw, 28px);
  font-weight: 900;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #ffd166, #ff8a5b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-card.lose .result-title {
  background: linear-gradient(135deg, #b8b6d0, #888);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-text {
  font-size: clamp(14px, 3.8vw, 17px);
  line-height: 1.9;
  color: #d5d2ec;
  margin: 0 0 clamp(16px, 4vw, 24px);
}

/* ---------- Promo code ---------- */
.result-code-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(255, 209, 102, 0.08);
  border: 1px dashed rgba(255, 209, 102, 0.4);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0 20px;
}

.result-code-wrap.hidden { display: none; }

.result-code-label { color: #ffd166; font-size: 13px; }

.result-code {
  font-family: 'Courier New', monospace;
  font-size: clamp(15px, 4.5vw, 20px);
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  word-break: break-all;
}

.copy-btn {
  background: #ffd166;
  color: #1a1038;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: transform .15s ease, background .2s ease;
}

.copy-btn:hover { transform: translateY(-2px); }
.copy-btn.copied { background: #06d6a0; color: #fff; }

.result-cta {
  display: inline-block;
  color: #b8b6d0;
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px dashed #b8b6d0;
  padding-bottom: 2px;
  transition: color .2s ease;
}

.result-cta:hover { color: #fff; }

/* ============================================================
   Modal
   ============================================================ */
.wheel-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 17, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  overflow-y: auto;
}

.wheel-modal-backdrop.hidden { display: none !important; }

.wheel-modal {
  position: relative;
  background: linear-gradient(160deg, #221a4d 0%, #1a1038 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: clamp(16px, 4vw, 24px);
  padding: clamp(30px, 5vw, 40px) clamp(18px, 4vw, 32px) clamp(22px, 5vw, 36px);
  max-width: 420px;
  width: 100%;
  color: #fff;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn .35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-height: 92vh;
  overflow-y: auto;
  margin: auto;
}

@keyframes modalIn {
  0%   { opacity: 0; transform: translateY(20px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Close (×) button — top-left in RTL */
.wheel-modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
  /* Override the generic .wheel-modal button rule */
  box-shadow: none !important;
  margin: 0 !important;
  width: 36px !important;
  min-width: 0;
  font-weight: 400;
}

.wheel-modal-close:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: none !important;
}

.wheel-modal h3 {
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 700;
  margin: 0 0 clamp(16px, 4vw, 24px);
  text-align: center;
  line-height: 1.5;
}

.wheel-field { display: block; text-align: right; margin-bottom: 14px; }

.wheel-field span {
  display: block;
  font-size: 13px;
  color: #b8b6d0;
  margin-bottom: 8px;
}

.wheel-field input,
.wheel-modal input {
  width: 100%;
  padding: 13px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
  transition: border-color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
}

.wheel-modal input:focus {
  outline: none;
  border-color: #ff8a5b;
  box-shadow: 0 0 0 3px rgba(255, 138, 91, 0.2);
}

.wheel-modal input::placeholder { color: #6a6880; }

.wheel-btn,
.wheel-modal button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ff8a5b, #ff4b6e);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease;
  box-shadow: 0 8px 24px rgba(255, 75, 110, 0.4);
  margin-top: 8px;
  -webkit-tap-highlight-color: transparent;
}

.wheel-btn:hover,
.wheel-modal button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 75, 110, 0.6);
}

.wheel-modal .link-btn {
  background: transparent !important;
  color: #ffd166 !important;
  box-shadow: none !important;
  padding: 8px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  margin-top: 12px;
}

.wheel-modal .link-btn:hover {
  text-decoration: underline;
  transform: none !important;
}

.error-text {
  color: #ff6b6b;
  font-size: 13px;
  min-height: 18px;
  margin: 12px 0 0;
  text-align: center;
}

.small { font-size: 13px; color: #b8b6d0; }
.small.center { text-align: center; margin: 12px 0 0; }

.hidden { display: none !important; }

/* ============================================================
   Small screens
   ============================================================ */
@media (max-width: 420px) {
  .wheel-modal { padding: 28px 20px 24px; }
  .wheel-modal h3 { margin-bottom: 18px; }
  .result-code-wrap { padding: 10px; }
  .result-code { letter-spacing: 1px; }
  .wheel-modal-close { top: 10px; left: 10px; width: 32px !important; height: 32px; font-size: 20px; }
}

/* Landscape phones — avoid the wheel being clipped */
@media (max-height: 500px) and (orientation: landscape) {
  .wheel-landing { padding-top: 16px; }
  .wheel-header { margin-bottom: 12px; }
  .wheel-title { font-size: 22px; }
  .wheel-sub { display: none; }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .wheel-glow,
  .wheel-pointer,
  .result-box,
  .result-icon,
  .wheel-modal {
    animation: none !important;
  }
}