/* ============================================================
   微信 H5 转盘抽奖 · 喜庆红金主题
   主色：中国红 + 鎏金；点缀：暖橙、奶油白
   ============================================================ */

:root {
  --red-deep: #7d0d13;
  --red: #b3131b;
  --red-light: #e0332c;
  --gold: #ffd76a;
  --gold-deep: #d99b23;
  --ink: #fff6e6;
  --ink-soft: rgba(255, 246, 230, 0.78);
  --line: rgba(255, 215, 106, 0.28);
}

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

/* 保证 JS 用 hidden 属性控制显隐时一定生效（.field 等类设置了 display，会盖住默认规则） */
[hidden] {
  display: none !important;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 50% 8%, #e0473a 0%, var(--red) 34%, var(--red-deep) 68%, #4d0509 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 顶部聚光 + 底部压暗，让金色标题更突出 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 58% at 50% -12%, rgba(255, 138, 96, 0.42), transparent 62%),
    radial-gradient(90% 50% at 50% 108%, rgba(60, 0, 4, 0.55), transparent 60%);
}

/* ---------- 背景装饰 ---------- */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 214, 106, 0.22), transparent 42%),
    radial-gradient(circle at 15% 90%, rgba(255, 120, 80, 0.18), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(255, 200, 120, 0.14), transparent 45%);
  z-index: 0;
}

/* 细碎金点，营造「礼花闪烁」的层次 */
.sparkles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image:
    radial-gradient(circle, rgba(255, 238, 190, 0.95) 0 1.3px, transparent 1.6px),
    radial-gradient(circle, rgba(255, 214, 140, 0.7) 0 1px, transparent 1.3px);
  background-size: 190px 190px, 270px 270px;
  background-position: 24px 48px, 110px 130px;
  animation: twinkle 7s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.26; }
  50% { opacity: 0.58; }
}

.deco-lantern {
  position: fixed;
  top: -46px;
  width: 74px;
  height: 96px;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 35% 30%, #ff8a6b, #d51b18 60%, #8d0b0d);
  box-shadow: 0 0 30px rgba(255, 120, 90, 0.45), inset -6px -8px 16px rgba(0, 0, 0, 0.28);
  opacity: 0.75;
  pointer-events: none;
  z-index: 0;
  animation: sway 5.5s ease-in-out infinite;
}

.deco-lantern::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -34px;
  width: 2px;
  height: 34px;
  background: linear-gradient(#ffd76a, rgba(255, 215, 106, 0.2));
  transform: translateX(-50%);
}

.deco-lantern::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 10px;
  height: 16px;
  background: linear-gradient(#ffd76a, #d99b23);
  transform: translateX(-50%);
  border-radius: 3px;
}

.deco-lantern.left {
  left: 8px;
}

.deco-lantern.right {
  right: 8px;
  animation-delay: 1.2s;
}

@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

/* ---------- 页面骨架 ---------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.demo-on .page {
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}

.brand {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
  color: #7d0d13;
  background: linear-gradient(145deg, #fff6dc, var(--gold) 45%, var(--gold-deep));
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(255, 224, 150, 0.5),
    0 0 20px rgba(255, 186, 90, 0.28);
  overflow: hidden;
  animation: logoGlow 4.5s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 224, 150, 0.5), 0 0 16px rgba(255, 186, 90, 0.22); }
  50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 235, 190, 0.72), 0 0 26px rgba(255, 196, 110, 0.42); }
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.company {
  font-size: clamp(12px, 3.5vw, 14.5px);
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff9ea;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.42);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subhead {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 9px;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  color: #ffe9b8;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 215, 106, 0.34);
  border-radius: 999px;
}

.sound-toggle {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 215, 106, 0.45);
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.sound-toggle.off {
  opacity: 0.45;
}

.title {
  margin: 22px 0 8px;
  font-size: clamp(22px, 6.4vw, 30px);
  font-weight: 800;
  letter-spacing: 1.2px;
  text-align: center;
  background: linear-gradient(180deg, #fff8e2 20%, var(--gold) 55%, #e9a83a 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  filter: drop-shadow(0 2px 6px rgba(255, 150, 60, 0.28));
}

.slogan {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 246, 230, 0.86);
  letter-spacing: 0.6px;
}

.slogan::after {
  content: '◆ ◆ ◆';
  display: block;
  margin-top: 10px;
  font-size: 7px;
  letter-spacing: 7px;
  color: rgba(255, 215, 106, 0.5);
  text-align: center;
}

/* ---------- 转盘 ---------- */
.wheel-stage {
  width: 100%;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.35));
}

.wheel-halo {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255, 215, 106, 0.5), rgba(255, 120, 80, 0.05), rgba(255, 215, 106, 0.5), rgba(255, 120, 80, 0.05), rgba(255, 215, 106, 0.5));
  filter: blur(10px);
  opacity: 0.55;
  animation: spinSlow 9s linear infinite;
}

/* 背景光束，让转盘像被舞台灯打亮 */
.wheel-rays {
  position: absolute;
  width: 168%;
  height: 168%;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 224, 156, 0.18) 0deg 3.2deg,
    rgba(255, 224, 156, 0) 3.2deg 17deg
  );
  -webkit-mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 0.9), transparent 76%);
  mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 0.9), transparent 76%);
  filter: blur(1.5px);
  animation: spinSlow 32s linear infinite reverse;
}

@keyframes spinSlow {
  to { transform: rotate(360deg); }
}

.wheel-canvas {
  position: relative;
  display: block;
}

.spin-btn {
  position: absolute;
  width: 27%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid #fff2cd;
  background: radial-gradient(circle at 38% 30%, #ff6a4d, #d81f18 55%, #a20c0f);
  color: #fff8e6;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 2px 6px rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, filter 0.2s ease;
  z-index: 3;
}

.spin-btn:active {
  transform: scale(0.95);
}

.spin-btn::before {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 215, 106, 0.55);
  animation: btnPulse 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes btnPulse {
  0% { transform: scale(0.9); opacity: 0.85; }
  100% { transform: scale(1.22); opacity: 0; }
}

.spin-btn:disabled::before {
  animation: none;
  opacity: 0;
}

.spin-btn-main {
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 700;
  letter-spacing: 1px;
}

.spin-btn-sub {
  font-size: clamp(9px, 2.4vw, 10px);
  opacity: 0.82;
}

.spin-btn:disabled {
  filter: grayscale(0.45) brightness(0.85);
  cursor: not-allowed;
}

.chance {
  margin-top: 14px;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff3d4;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.2));
  border: 1px solid rgba(255, 215, 106, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 14px rgba(0, 0, 0, 0.22);
}

/* ---------- 活动说明 ---------- */
.rules {
  width: 100%;
  margin-top: 22px;
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045));
  border: 1px solid rgba(255, 215, 106, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 26px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.rules h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 1.2px;
}

.rules h2::before {
  content: '';
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #fff3cd, var(--gold-deep));
  box-shadow: 0 0 8px rgba(255, 200, 90, 0.6);
}

.rules ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 9px;
  font-size: 12px;
  line-height: 1.75;
  color: rgba(255, 246, 230, 0.78);
}

.rules li {
  counter-increment: step;
  position: relative;
  padding-left: 26px;
}

.rules li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #7d0d13;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff6dc, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.footer {
  margin-top: 18px;
  text-align: center;
}

.footer-divider {
  position: relative;
  width: 132px;
  height: 1px;
  margin: 0 auto 12px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 106, 0.6), transparent);
}

.footer-divider i {
  position: absolute;
  left: 50%;
  top: -3px;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 1px;
  background: linear-gradient(145deg, #fff6dc, var(--gold-deep));
  transform: rotate(45deg);
  opacity: 0.9;
}

.footer p {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 246, 230, 0.42);
  letter-spacing: 0.3px;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(35, 0, 2, 0.68);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-mask[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 30px 20px 20px;
  border-radius: 22px;
  text-align: center;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.95), transparent 55%),
    linear-gradient(180deg, #fff9ec 0%, #ffeeda 100%);
  color: #58270f;
  border: 2px solid var(--gold);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.48), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  animation: pop 0.32s cubic-bezier(0.2, 1.3, 0.5, 1);
}

.modal-ribbon {
  position: absolute;
  left: 50%;
  top: 0;
  width: 132px;
  height: 5px;
  margin-left: -66px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(90deg, rgba(240, 185, 63, 0.4), #ffd76a, rgba(208, 145, 28, 0.5));
  box-shadow: 0 2px 8px rgba(208, 145, 28, 0.4);
}

@keyframes pop {
  from { transform: translateY(14px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-icon-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, #fffdf6, #ffedc9 58%, #f4d191);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 3px 8px rgba(255, 255, 255, 0.9), inset 0 -3px 10px rgba(206, 156, 60, 0.22), 0 10px 22px rgba(199, 146, 32, 0.28);
}

.modal-icon {
  display: block;
  width: 72px;
  height: 72px;
  animation: bounce 1.4s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.04); }
}

.modal-title {
  margin: 12px 0 6px;
  font-size: 20px;
  font-weight: 800;
  color: #b3131b;
}

.modal-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #7a4a26;
}

.modal-desc .highlight {
  color: #b3131b;
  font-weight: 700;
}

.claim-form {
  margin-top: 16px;
  text-align: left;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #7a4a26;
  margin-bottom: 5px;
}

.field-label em {
  color: #d81f18;
  font-style: normal;
  margin-left: 2px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  color: #4a2109;
  background: #fff;
  border: 1px solid #eccfa5;
  border-radius: 10px;
  resize: none;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input:focus,
.field textarea:focus {
  border-color: #e8a63a;
  box-shadow: 0 0 0 3px rgba(232, 166, 58, 0.18);
}

.field-error {
  display: block;
  min-height: 14px;
  margin-top: 3px;
  font-size: 11px;
  color: #d81f18;
}

.form-tip {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: #a3805c;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.btn {
  width: 100%;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.14s ease, opacity 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  position: relative;
  overflow: hidden;
  color: #fff8e6;
  background: linear-gradient(180deg, #ef4033, #c1131a);
  box-shadow: 0 8px 18px rgba(193, 19, 26, 0.32);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 22%, rgba(255, 255, 255, 0.34) 46%, transparent 68%);
  transform: translateX(-130%);
  animation: btnShine 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShine {
  0% { transform: translateX(-130%); }
  55%, 100% { transform: translateX(130%); }
}

.btn-ghost {
  color: #9a6a3c;
  background: transparent;
  border: 1px solid #e6cda4;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  color: #fff6e6;
  background: rgba(30, 0, 0, 0.86);
  border: 1px solid rgba(255, 215, 106, 0.35);
  animation: toastIn 0.22s ease;
}

.toast[hidden] {
  display: none;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 演示工具条 ---------- */
.demo-bar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(20, 0, 0, 0.78);
  border: 1px solid rgba(255, 215, 106, 0.35);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.demo-bar[hidden] {
  display: none;
}

.demo-label {
  font-size: 10px;
  color: var(--gold);
  padding-right: 2px;
}

.demo-bar button {
  padding: 5px 10px;
  font-family: inherit;
  font-size: 11px;
  color: #3b0a0a;
  background: linear-gradient(180deg, #ffe6a8, #f0bf58);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.demo-bar button.ghost {
  color: #ffe6a8;
  background: transparent;
  border: 1px solid rgba(255, 215, 106, 0.5);
}

/* ---------- 彩带 & 启动层 ---------- */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  letter-spacing: 1px;
  color: #ffe6a8;
  background: linear-gradient(180deg, #8d1116, #5b0609);
}

.boot[hidden] {
  display: none;
}

.boot-logo {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 224, 150, 0.5);
  animation: logoGlow 3.4s ease-in-out infinite;
}

@media (max-height: 640px) {
  .title { margin-top: 12px; }
  .rules { display: none; }
}
