:root {
  --orange: #C85A1A;
  --brown:  #3A200E;
  --cream:  #F5EBD9;
  --bg:     #FBF6EE;
  --shadow: 0 10px 30px rgba(58, 32, 14, 0.16);
}

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

html, body {
  background: var(--bg);
  color: var(--brown);
  font-family: 'Noto Sans Thai', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -8%, rgba(255,255,255,0.9) 0%, rgba(255,247,232,0) 45%),
    radial-gradient(80% 50% at 18% 12%, rgba(255,240,210,0.7) 0%, rgba(255,240,210,0) 50%),
    radial-gradient(circle at 50% 30%, #FFF7EA 0%, #F6E9D2 60%, #EFDCC0 100%);
  background-attachment: fixed;
}
/* ประกายระยิบเล็กๆ ทั่วพื้นหลัง */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.9) 0 1.4px, transparent 2px),
    radial-gradient(circle, rgba(255,230,180,0.8) 0 1.1px, transparent 2px);
  background-size: 120px 120px, 90px 90px;
  background-position: 10px 30px, 60px 80px;
  opacity: 0.5;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  padding: 22px 20px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---------- Brand ---------- */
.brand { margin-bottom: 14px; }
.brand-logo {
  height: 23px;
  width: auto;
  display: block;
  margin: 0 auto;
}

/* ---------- Hero ---------- */
.hero { margin: 0 0 10px; }
.title-script {
  font-size: 28px;
  font-weight: 700;
  color: var(--orange);
  font-style: italic;
  line-height: 1.1;
  margin-bottom: 6px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.title {
  font-size: 40px;
  font-weight: 800;
  color: #4A2E16;
  line-height: 1.1;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 6px rgba(120,70,20,0.18);
}
.subtitle {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(90, 58, 30, 0.75);
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.subtitle .dash {
  width: 22px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--orange));
  display: inline-block;
}
.subtitle .dash:last-child { transform: scaleX(-1); }

/* ---------- Wheel ---------- */
.wheel-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1 / 1;
  margin: 14px auto 10px;
  filter: drop-shadow(0 18px 30px rgba(120, 70, 20, 0.28));
}
#wheel, #wheelFrame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#wheel { border-radius: 50%; z-index: 1; }
#wheelFrame { z-index: 2; pointer-events: none; }

/* ดุมกลางทอง */
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  width: 17%; height: 17%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 3;
  background:
    radial-gradient(circle at 38% 32%, #FFF6D8 0%, #F2C75A 28%, #C9952F 62%, #9A6E1E 100%);
  box-shadow:
    0 3px 8px rgba(90, 55, 15, 0.45),
    inset 0 2px 3px rgba(255, 250, 220, 0.8),
    inset 0 -3px 5px rgba(120, 80, 20, 0.5);
}

/* เข็มชี้ด้านบน (หมุดทอง) */
.pointer {
  position: absolute;
  top: -2%; left: 50%;
  transform: translateX(-50%);
  width: 11%; height: 13%;
  z-index: 4;
  background: linear-gradient(160deg, #FBE9A8 0%, #D6A23A 55%, #B07C20 100%);
  border-radius: 50% 50% 50% 50% / 42% 42% 60% 60%;
  clip-path: polygon(50% 100%, 0 38%, 8% 16%, 50% 0, 92% 16%, 100% 38%);
  filter: drop-shadow(0 4px 4px rgba(90, 55, 15, 0.4));
}
.pointer::after {
  content: "";
  position: absolute;
  top: 26%; left: 50%;
  transform: translateX(-50%);
  width: 42%; height: 38%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #FFFFFF, #FFF0CC);
  box-shadow: inset 0 1px 2px rgba(120,80,20,0.3);
}

/* ---------- Stage message ---------- */
.stage-msg {
  min-height: 24px;
  margin: 10px 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--orange);
}

/* ---------- Spin button ---------- */
.spin-btn {
  margin-top: 10px;
  width: 100%;
  max-width: 340px;
  padding: 18px 24px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #F2913F 0%, #D9661E 55%, #C24E12 100%);
  border: 2px solid rgba(255, 235, 200, 0.85);
  border-radius: 999px;
  box-shadow:
    0 10px 24px rgba(200, 90, 26, 0.45),
    0 0 0 6px rgba(255, 200, 130, 0.18),
    inset 0 1px 2px rgba(255, 240, 220, 0.6);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: ctaPulse 1.8s ease-in-out infinite;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.2s;
}
.spin-spark { color: #FFE9B0; font-size: 16px; }
.spin-chevron { font-weight: 700; opacity: 0.9; }
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(200,90,26,0.45), 0 0 0 6px rgba(255,200,130,0.18), inset 0 1px 2px rgba(255,240,220,0.6); }
  50%      { box-shadow: 0 12px 30px rgba(200,90,26,0.55), 0 0 0 12px rgba(255,200,130,0.08), inset 0 1px 2px rgba(255,240,220,0.6); }
}
.spin-btn:active { transform: translateY(2px) scale(0.99); animation: none; }
.spin-btn:disabled {
  background: #C9BBA8;
  border-color: rgba(255,255,255,0.5);
  box-shadow: none;
  animation: none;
  cursor: default;
}

/* ---------- Promo ---------- */
.promo { margin-top: 32px; width: 100%; }
.promo-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--brown);
  margin-bottom: 14px;
}
.promo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.promo-item {
  background: #fff;
  border: 1.5px solid rgba(200, 90, 26, 0.18);
  border-radius: 16px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(58, 32, 14, 0.06);
}
.promo-item .qty { font-size: 14px; font-weight: 600; color: rgba(58, 32, 14, 0.7); }
.promo-item .price { font-size: 22px; font-weight: 800; color: var(--orange); }
.promo-item.highlight {
  background: linear-gradient(165deg, #FFF1E2, #FFE6CE);
  border-color: var(--orange);
  transform: scale(1.05);
}

/* ---------- Footer ---------- */
.foot {
  margin-top: 30px;
  font-size: 12px;
  color: rgba(58, 32, 14, 0.45);
}

/* ---------- Result overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 32, 14, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 50;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.win-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, #FFFFFF, var(--cream));
  border-radius: 24px;
  padding: 32px 26px 26px;
  text-align: center;
  box-shadow: var(--shadow);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.overlay.show .win-card { transform: translateY(0) scale(1); }

.overlay-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: rgba(58, 32, 14, 0.4);
  cursor: pointer;
}
.win-burst { font-size: 46px; }
.win-congrats {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 600;
  color: rgba(58, 32, 14, 0.7);
}
.win-label {
  margin: 6px 0;
  font-size: 32px;
  font-weight: 800;
  color: var(--orange);
  line-height: 1.2;
}
.win-note {
  font-size: 13px;
  font-weight: 500;
  color: rgba(58, 32, 14, 0.6);
  margin-bottom: 6px;
}
.win-claim {
  margin-top: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--brown);
}
.win-claim strong { color: var(--orange); }

.win-code {
  margin-top: 14px;
  padding: 12px 10px;
  background: #FFF1E2;
  border: 1.5px dashed var(--orange);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.win-code-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(58, 32, 14, 0.6);
}
.win-code strong {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--orange);
  font-family: 'Courier New', monospace;
}
.win-code-hint {
  font-size: 12px;
  font-weight: 500;
  color: rgba(58, 32, 14, 0.65);
}

.line-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  width: 100%;
  padding: 15px;
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
  color: #fff;
  background: #06C755;
  border-radius: 14px;
  box-shadow: 0 6px 14px rgba(6, 199, 85, 0.35);
}
.line-btn:active { transform: translateY(1px); }
.line-ico {
  background: #fff;
  color: #06C755;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.win-foot {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(58, 32, 14, 0.55);
}

@media (max-width: 360px) {
  .title { font-size: 26px; }
  .promo-item .price { font-size: 19px; }
}
