/* ============================================================
   500 MILLION — SPIN TO WIN
   Mobile-first. Channels the Feastables energy with original
   branding: Kanit display type, cyan/pink/lime, sticker outlines.
   ============================================================ */

:root {
  --bg1: #15CCFF;
  --bg2: #0069A6;
  --accent: #FF2F9F;
  --lime: #CEFC17;
  --cream: #F2EBE0;
  --ink: #0a2535;
  --white: #ffffff;

  --stroke: 4px;
  --radius: 22px;
  --shadow-hard: 0 6px 0 rgba(0,0,0,0.25);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Kanit", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* dotted texture overlay */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.14) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Marquee ---------- */
.marquee {
  position: relative;
  z-index: 5;
  background: var(--ink);
  color: var(--lime);
  overflow: hidden;
  white-space: nowrap;
  padding: 7px 0;
  border-bottom: var(--stroke) solid rgba(255,255,255,0.9);
  font-weight: 800;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.marquee__track {
  display: inline-block;
  animation: marquee 18s linear infinite;
  will-change: transform;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Gear ---------- */
.gear {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 44px);
  right: 12px;
  z-index: 40;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: var(--stroke) solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  transition: transform 0.15s;
}
.gear:active { transform: scale(0.92) rotate(40deg); }

/* ---------- Clouds ---------- */
.clouds { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.cloud {
  position: absolute;
  background: rgba(255,255,255,0.85);
  border-radius: 50px;
  filter: blur(0.3px);
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 50%;
}
.cloud--1 { width: 90px; height: 26px; top: 110px; left: -20px; animation: drift 26s linear infinite; }
.cloud--2 { width: 120px; height: 32px; top: 240px; right: -40px; opacity: 0.6; animation: drift 34s linear infinite reverse; }
.cloud--3 { width: 70px; height: 22px; top: 70px; right: 30px; opacity: 0.7; animation: drift 30s linear infinite; }
.cloud::before { width: 50%; height: 180%; top: -60%; left: 12%; }
.cloud::after { width: 40%; height: 150%; top: -40%; right: 14%; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(40px); } }

/* ---------- Stage ---------- */
.stage {
  position: relative;
  z-index: 10;
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 16px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin-top: 4px; }

.hero__badge {
  display: inline-block;
  background: var(--lime);
  color: var(--ink);
  font-weight: 900;
  font-style: italic;
  font-size: 22px;
  padding: 4px 16px;
  border-radius: 999px;
  border: var(--stroke) solid var(--ink);
  transform: rotate(-3deg);
  box-shadow: var(--shadow-hard);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.hero__title {
  margin: 6px 0 8px;
  line-height: 0.86;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hero__title .line {
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  color: var(--white);
  letter-spacing: 0.01em;
  /* chunky sticker outline */
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink), 0 5px 8px rgba(0,0,0,0.3);
}
.hero__title .line--top { font-size: clamp(38px, 12vw, 58px); }
.hero__title .line--mid { font-size: clamp(26px, 8vw, 40px); color: var(--lime); }
.hero__title .line--bot {
  font-size: clamp(30px, 9.5vw, 46px);
  color: var(--accent);
  transform: rotate(-2deg);
  margin-top: 2px;
}

.hero__sub {
  color: var(--white);
  font-weight: 500;
  font-size: 14px;
  margin: 4px auto 0;
  max-width: 300px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ---------- Wheel ---------- */
.wheel-area {
  margin-top: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-wrap {
  position: relative;
  width: min(86vw, 380px);
  aspect-ratio: 1;
  margin-bottom: 8px;
}

.wheel {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  /* 3D drop shadow under the disc; rim/gloss are drawn inside the SVG */
  filter: drop-shadow(0 16px 22px rgba(0,0,0,0.4));
}

.wheel-shadow {
  position: absolute;
  left: 50%; bottom: -4%;
  width: 78%; height: 9%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.32);
  border-radius: 50%;
  filter: blur(7px);
  z-index: 0;
}

/* fill-box keeps rotation centered cross-browser (Safari ignores px origins on SVG) */
#wheelSpinner { transform-box: fill-box; transform-origin: center; }

.seg-label {
  font-family: "Kanit", sans-serif;
  font-weight: 900;
  font-style: italic;
  font-size: 17px;            /* uniform across all prizes */
  letter-spacing: 0.01em;
  fill: #ffffff;
  stroke: var(--ink);
  stroke-width: 3px;
  paint-order: stroke fill;
}

/* Pointer — a revamped illustrated marker pointing DOWN into the wheel */
.pointer {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: 58px; height: 76px;
  filter: drop-shadow(0 5px 5px rgba(0,0,0,0.4));
  animation: pointer-bob 1.4s ease-in-out infinite;
}
.pointer svg { width: 100%; height: 100%; display: block; }
@keyframes pointer-bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(3px); } }

/* Center hub */
.hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--lime);
  border: var(--stroke) solid var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3), inset 0 3px 5px rgba(255,255,255,0.4);
}
.hub__glyph { line-height: 1; }

/* ---------- Spin button ---------- */
.spin-btn {
  margin-top: 14px;
  position: relative;
  background: var(--lime);
  color: var(--ink);
  font-family: inherit;
  font-weight: 900;
  font-style: italic;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 16px 42px;
  border: var(--stroke) solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 7px 0 var(--ink), 0 10px 18px rgba(0,0,0,0.3);
  transition: transform 0.1s, box-shadow 0.1s;
  /* glow pulse only — no transform, so the button stays clickable/stable */
  animation: pulse 1.5s ease-in-out infinite;
}
.spin-btn:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--ink), 0 4px 8px rgba(0,0,0,0.3);
}
.spin-btn:disabled { cursor: not-allowed; }
.spin-btn.is-locked { background: #b9c2c7; color: #5b676d; animation: none; opacity: 0.85; box-shadow: 0 7px 0 #6d7a80; }
.spin-btn.is-spinning { animation: none; background: var(--accent); color: #fff; }
@keyframes pulse {
  0%,100% { box-shadow: 0 7px 0 var(--ink), 0 10px 18px rgba(0,0,0,0.3); }
  50%     { box-shadow: 0 7px 0 var(--ink), 0 10px 26px rgba(206,252,23,0.85), 0 0 24px rgba(206,252,23,0.5); }
}

/* ---------- Wheel style switcher ---------- */
.variant-switch {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(10,37,53,0.85);
  border: 3px solid rgba(255,255,255,0.9);
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.25);
}
.variant-switch__label {
  color: #fff;
  font-weight: 700;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 132px;
  text-align: center;
}
.variant-switch__label strong { color: var(--lime); }
.variant-switch__label em { font-style: normal; opacity: 0.7; font-size: 11px; }
.variant-switch__btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--lime);
  color: var(--ink);
  font-size: 13px; font-weight: 900;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.1s;
}
.variant-switch__btn:active { transform: scale(0.9); }

.locked-note {
  margin-top: 14px;
  color: var(--white);
  font-weight: 600;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.link-reset {
  background: none; border: none;
  color: var(--lime);
  font: inherit; font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.claim-resume-link {
  display: inline-block;
  margin-top: 12px;
  background: var(--lime);
  color: var(--ink);
  border: var(--stroke) solid var(--ink);
  border-radius: 999px;
  padding: 12px 24px;
  font-weight: 900; font-style: italic;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 5px 0 var(--ink);
}
.claim-resume-link:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

/* ---------- Footer ---------- */
.foot {
  margin-top: 34px;
  max-width: 360px;
  text-align: center;
}
.foot p {
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

/* ============================================================
   MODAL
   ============================================================ */
/* CRITICAL: a class-level display overrides the UA [hidden] rule, so we must
   re-assert display:none — otherwise these fixed full-screen overlays sit
   invisibly on top and swallow every click (incl. the spin button). */
.modal[hidden], .tweaks[hidden] { display: none !important; }

.modal {
  position: fixed; inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(8,30,45,0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.28s;
}
.modal.is-open .modal__backdrop { opacity: 1; }

.modal__card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 360px;
  background: var(--cream);
  border: var(--stroke) solid var(--ink);
  border-radius: 28px;
  padding: 34px 26px 28px;
  text-align: center;
  box-shadow: 0 10px 0 rgba(0,0,0,0.3), 0 22px 40px rgba(0,0,0,0.5);
  transform: scale(0.7) translateY(20px);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  overflow: hidden;
}
.modal.is-open .modal__card { transform: scale(1) translateY(0); opacity: 1; }

.modal__burst {
  position: absolute;
  top: -40%; left: -40%;
  width: 180%; height: 180%;
  background: conic-gradient(from 0deg, var(--bg1) 0 15deg, transparent 15deg 30deg);
  opacity: 0.18;
  z-index: 0;
  animation: spinslow 12s linear infinite;
}
@keyframes spinslow { to { transform: rotate(360deg); } }

.modal__icon {
  position: relative; z-index: 1;
  width: 116px; height: 116px;
  margin: 0 auto 4px;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.18)) drop-shadow(0 8px 10px rgba(0,0,0,0.3));
  animation: pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both 0.1s;
}
.modal__icon svg { width: 100%; height: 100%; display: block; }
@keyframes pop-in { from { transform: scale(0) rotate(-25deg); } to { transform: scale(1) rotate(0); } }

.modal__eyebrow {
  position: relative; z-index: 1;
  font-weight: 800; font-style: italic;
  color: var(--accent);
  font-size: 18px;
  letter-spacing: 0.1em;
  margin: 0 0 4px;
}
.modal__prize {
  position: relative; z-index: 1;
  font-weight: 900; font-style: italic;
  text-transform: uppercase;
  font-size: clamp(44px, 16vw, 62px);
  color: var(--bg2);
  line-height: 0.9;
  margin: 4px 0 8px;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.modal__desc {
  position: relative; z-index: 1;
  font-weight: 500;
  color: var(--ink);
  font-size: 15px;
  margin: 0 0 20px;
}
.modal__btn {
  position: relative; z-index: 1;
  background: var(--lime);
  color: var(--ink);
  font: inherit; font-weight: 900; font-style: italic;
  text-transform: uppercase;
  font-size: 22px;
  padding: 13px 36px;
  border: var(--stroke) solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s;
}
.modal__btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.modal__close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--white);
  color: var(--ink);
  font-size: 14px; font-weight: 800;
  cursor: pointer;
}

/* ---------- Confetti canvas ---------- */
.confetti-canvas {
  position: fixed; inset: 0;
  z-index: 55;
  pointer-events: none;
}

/* ============================================================
   TWEAKS PANEL
   ============================================================ */
.tweaks { position: fixed; inset: 0; z-index: 70; }
.tweaks__backdrop {
  position: absolute; inset: 0;
  background: rgba(8,30,45,0.6);
  opacity: 0; transition: opacity 0.25s;
}
.tweaks.is-open .tweaks__backdrop { opacity: 1; }

.tweaks__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(88vw, 360px);
  background: var(--cream);
  border-left: var(--stroke) solid var(--ink);
  padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}
.tweaks.is-open .tweaks__panel { transform: translateX(0); }

.tweaks__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.tweaks__head h2 {
  margin: 0; font-weight: 900; font-style: italic;
  font-size: 30px; color: var(--ink);
}
.tweaks__close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--ink); background: var(--white);
  font-size: 15px; font-weight: 800; cursor: pointer;
}

.tweaks__body { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 700; font-size: 13px; color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; }
.field--row { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.field--row > span { flex: 1; }
.field input[type="text"] {
  font: inherit; font-weight: 700;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
}
.field input[type="range"] { flex: 1 1 120px; accent-color: var(--accent); }
.field--row em { font-style: normal; font-weight: 800; min-width: 34px; text-align: right; }
.field select {
  font: inherit; font-weight: 700;
  padding: 8px 10px; border: 3px solid var(--ink);
  border-radius: 10px; background: var(--white); color: var(--ink);
}
.field input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 46px; height: 46px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  cursor: pointer;
  transition: transform 0.12s;
}
.swatch.is-active { transform: scale(1.12); box-shadow: 0 0 0 3px var(--lime), 0 0 0 6px var(--ink); }

.tweaks__save {
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit; font-weight: 800; font-style: italic;
  padding: 12px; border: var(--stroke) solid var(--ink);
  border-radius: 14px; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
}
.tweaks__save:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .spin-btn, .marquee__track, .cloud, .modal__burst { animation: none !important; }
}

/* ---------- Larger screens: keep it phone-shaped & centered ---------- */
@media (min-width: 560px) {
  .stage { padding-top: 26px; }
}
