:root {
  --red-deep: #8b0000;
  --red-mid: #c00000;
  --red-bright: #e60012;
  --red-glow: #ff3b4a;
  --gold: #ffd700;
  --gold-dark: #c9a227;
  --cream: #fff8e7;
  --cream-alt: #ffe9a8;
  --banner: #fff3c4;
  --text-red: #b71c1c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body.spinning-page {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", "Microsoft YaHei", sans-serif;
  color: #fff;
  background: radial-gradient(ellipse at 50% 0%, #d62828 0%, #9b0a0a 45%, #5c0000 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Background atmosphere ===== */
.spin-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.spin-bg__rays {
  position: absolute;
  inset: -20%;
  background:
    repeating-conic-gradient(
      from 0deg at 50% 40%,
      rgba(255, 220, 120, 0.07) 0deg 8deg,
      transparent 8deg 16deg
    );
  animation: rays-spin 40s linear infinite;
  opacity: 0.7;
}

.spin-bg__sparkles {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 200, 0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 12%, rgba(255, 255, 255, 0.5) 0 1.5px, transparent 3px),
    radial-gradient(circle at 88% 42%, rgba(255, 230, 150, 0.45) 0 2px, transparent 3px),
    radial-gradient(circle at 18% 68%, rgba(255, 255, 255, 0.4) 0 1.5px, transparent 3px),
    radial-gradient(circle at 62% 78%, rgba(255, 220, 100, 0.5) 0 2px, transparent 3px),
    radial-gradient(circle at 40% 28%, rgba(255, 255, 255, 0.35) 0 1px, transparent 2px),
    radial-gradient(circle at 55% 55%, rgba(255, 240, 180, 0.4) 0 1.5px, transparent 3px);
  animation: sparkle 3.5s ease-in-out infinite alternate;
}

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

@keyframes sparkle {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* ===== Layout ===== */
.spin-page {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  text-align: center;
}

.spin-brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 10px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.spin-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 7.5vw, 36px);
  font-weight: 900;
  line-height: 1.25;
  color: #ffffff;
  -webkit-text-stroke: 1px rgba(201, 162, 39, 0.65);
  text-shadow:
    0 2px 0 rgba(160, 110, 0, 0.55),
    0 4px 12px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.02em;
}

.spin-desc {
  margin: 0 auto 14px;
  max-width: 420px;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.spin-banner {
  display: inline-block;
  margin: 0 auto 22px;
  padding: 10px 18px;
  max-width: 100%;
  background: linear-gradient(180deg, #fff8d6 0%, var(--banner) 100%);
  border-radius: 12px;
  border: 2px solid rgba(201, 162, 39, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  color: var(--text-red);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

/* ===== Wheel ===== */
.wheel-wrap {
  position: relative;
  width: min(86vw, 340px);
  margin: 0 auto 28px;
  aspect-ratio: 1;
}

.wheel-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #ff6b6b 0%, #e60012 32%, #a00010 68%, #5a0008 100%);
  box-shadow:
    0 0 0 3px #f0c14a,
    0 0 0 6px #7a0000,
    0 14px 32px rgba(0, 0, 0, 0.5),
    inset 0 2px 8px rgba(255, 255, 255, 0.25),
    inset 0 -8px 20px rgba(0, 0, 0, 0.35);
}

.wheel-leds {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.wheel-leds span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #ffe9a0 40%, #ffcc00 100%);
  box-shadow: 0 0 8px 2px rgba(255, 240, 150, 0.85);
  transform: rotate(var(--a)) translateY(calc(min(43vw, 170px) * -1 + 12px));
  animation: led-blink 1.2s ease-in-out infinite;
  animation-delay: var(--d);
}

@keyframes led-blink {
  0%, 100% { opacity: 1; filter: brightness(1.2); }
  50% { opacity: 0.45; filter: brightness(0.7); }
}

.wheel-canvas-box {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.2);
}

#wheelCanvas {
  display: block;
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0) rotate(0deg);
  transform-origin: 50% 50%;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 旋转期间降低背景动画负担 */
body.is-spinning .spin-bg__rays,
body.is-spinning .spin-bg__sparkles,
body.is-spinning .wheel-leds span {
  animation-play-state: paused;
}

body.is-spinning .wheel-go {
  animation: none;
}

.wheel-pointer {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: 0;
  height: 0;
  margin-left: -13px;
  margin-top: -72px;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-bottom: 30px solid #e60012;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.wheel-pointer::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a95, #c00000);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.wheel-go {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  width: 86px;
  height: 86px;
  margin: -43px 0 0 -43px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 35% 28%, #ff7a88 0%, var(--red-bright) 42%, #9a0010 78%, #5a0008 100%);
  box-shadow:
    0 0 0 5px #fff3c4,
    0 0 0 8px #c9a227,
    0 6px 18px rgba(0, 0, 0, 0.4),
    inset 0 -6px 12px rgba(0, 0, 0, 0.25),
    inset 0 6px 10px rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 0 10px rgba(255, 220, 100, 0.6);
  transition: transform 0.15s ease;
  animation: go-pulse 1.8s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.wheel-go:hover:not(:disabled) {
  transform: scale(1.05);
}

.wheel-go:active:not(:disabled) {
  transform: scale(0.96);
}

.wheel-go:disabled {
  cursor: not-allowed;
  opacity: 0.85;
  animation: none;
}

@keyframes go-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 5px #fff3c4,
      0 0 0 8px #c9a227,
      0 6px 18px rgba(0, 0, 0, 0.4),
      0 0 18px rgba(255, 80, 80, 0.55),
      inset 0 -6px 12px rgba(0, 0, 0, 0.25),
      inset 0 6px 10px rgba(255, 255, 255, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 5px #fff8d6,
      0 0 0 9px #ffd700,
      0 8px 22px rgba(0, 0, 0, 0.45),
      0 0 28px rgba(255, 120, 80, 0.85),
      inset 0 -6px 12px rgba(0, 0, 0, 0.25),
      inset 0 6px 10px rgba(255, 255, 255, 0.3);
  }
}

/* ===== Promo + prize list ===== */
.spin-promo {
  margin: 0 auto 16px;
  max-width: 420px;
  font-size: 12px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.prize-box {
  margin: 0 auto;
  max-width: 420px;
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, rgba(120, 0, 0, 0.55), rgba(70, 0, 0, 0.7));
  border: 2px solid rgba(255, 215, 100, 0.65);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  text-align: left;
}

.prize-box__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.prize-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.prize-list li {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.95);
}

.prize-list li:last-child {
  margin-bottom: 0;
}

.prize-list__tier {
  flex-shrink: 0;
  font-weight: 800;
  color: var(--gold);
  min-width: 3.2em;
}

.prize-list__desc {
  flex: 1;
}

/* ===== Result modal ===== */
.spin-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(40, 0, 0, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.spin-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.spin-modal__panel {
  width: min(90vw, 340px);
  padding: 28px 22px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff8e7 0%, #ffe9b0 100%);
  border: 3px solid var(--gold);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
  transform: scale(0.88) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.spin-modal.is-open .spin-modal__panel {
  transform: scale(1) translateY(0);
}

.spin-modal__label {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-red);
}

.spin-modal__tier {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 900;
  color: var(--red-bright);
  text-shadow: 0 1px 0 rgba(255, 215, 0, 0.5);
}

.spin-modal__name {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #5c2b00;
}

.spin-modal__img {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  object-fit: contain;
}

.spin-modal__btn {
  display: inline-block;
  min-width: 140px;
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff4d5e, #c00000);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(160, 0, 0, 0.35);
}

.spin-modal__btn:hover {
  filter: brightness(1.08);
}

.spin-modal__btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.spin-modal__btn--ghost {
  margin-top: 10px;
  background: transparent;
  color: var(--text-red);
  box-shadow: none;
  border: 1px solid rgba(183, 28, 28, 0.35);
}

.spin-phone-form {
  margin-top: 4px;
}

.spin-phone-input {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 2px solid rgba(201, 162, 39, 0.65);
  border-radius: 10px;
  background: #fff;
  color: #333;
  font-size: 16px;
  text-align: center;
  outline: none;
}

.spin-phone-input:focus {
  border-color: var(--red-bright);
  box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.12);
}

.spin-phone-error {
  margin: 0 0 10px;
  color: #c62828;
  font-size: 13px;
  font-weight: 700;
}

.spin-chance {
  margin: 10px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

@media (min-width: 480px) {
  .spin-page {
    padding-top: 28px;
  }

  .wheel-go {
    width: 96px;
    height: 96px;
    margin: -48px 0 0 -48px;
    font-size: 32px;
  }

  .wheel-pointer {
    margin-top: -80px;
  }
}
