/* ============================================
   全局重置与基础
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --gold: #f5a623;
  --gold-dark: #d4881a;
  --red: #e53935;
  --red-dark: #b71c1c;
  --green: #2e7d32;
  --radius: 20px;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #1a0a00;
}

/* ============================================
   页面切换
   ============================================ */
.page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 16px 40px;
  position: relative;
  overflow: hidden;
}

.page.hidden { display: none; }

/* ============================================
   顶部导航栏（页面1、2公用）
   ============================================ */
.topbar {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 10px;
  position: relative;
  z-index: 2;
}

.topbar-logo {
  font-size: 15px;
  font-weight: 700;
  color: #ffd180;
  letter-spacing: 0.3px;
}

.topbar-safe {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ============================================
   页面1：抽奖入口
   ============================================ */
#page-entry {
  background: linear-gradient(160deg, #7b1a00 0%, #1a0a00 60%);
}

.confetti-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  opacity: 0;
  animation: confettiFall linear infinite;
}

@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.entry-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: linear-gradient(145deg, #fff9f0, #fff3dc);
  border-radius: var(--radius);
  padding: 24px 20px 28px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 0 2px rgba(245,166,35,0.3);
  text-align: center;
}

.badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 30px;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.badge.pulse {
  animation: pulseBadge 1.5s ease-in-out infinite;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229,57,53,0.5); }
  50%       { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(229,57,53,0); }
}

.trophy {
  font-size: 58px;
  margin-bottom: 6px;
  animation: trophyBounce 2s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.entry-title {
  font-size: 30px;
  font-weight: 800;
  color: var(--red-dark);
  margin-bottom: 6px;
}

.entry-sub {
  font-size: 14px;
  color: #555;
  margin-bottom: 6px;
  line-height: 1.6;
}

.entry-desc {
  font-size: 15px;
  color: #333;
  margin-bottom: 14px;
  line-height: 1.8;
}

.highlight {
  color: var(--red);
  font-weight: 800;
  font-size: 20px;
}

/* 中奖滚动条 */
.winners-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(229,57,53,0.06);
  border: 1px solid rgba(229,57,53,0.15);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

.winners-label {
  font-size: 10px;
  color: var(--red);
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  background: rgba(229,57,53,0.1);
  border-radius: 4px;
  padding: 2px 6px;
}

.winners-scroll {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  height: 18px;
}

.winners-scroll span {
  position: absolute;
  left: 0;
  white-space: nowrap;
  font-size: 11px;
  color: #555;
  animation: scrollUp 12s linear infinite;
  opacity: 0;
}

.winners-scroll span:nth-child(1) { animation-delay: 0s; }
.winners-scroll span:nth-child(2) { animation-delay: 2.4s; }
.winners-scroll span:nth-child(3) { animation-delay: 4.8s; }
.winners-scroll span:nth-child(4) { animation-delay: 7.2s; }
.winners-scroll span:nth-child(5) { animation-delay: 9.6s; }

@keyframes scrollUp {
  0%        { transform: translateY(20px); opacity: 0; }
  8%, 25%   { transform: translateY(0);   opacity: 1; }
  33%, 100% { transform: translateY(-20px); opacity: 0; }
}

/* 倒计时 */
.countdown-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff0e6;
  border: 1.5px solid #f5a623;
  border-radius: 10px;
  padding: 8px 18px;
  margin-bottom: 16px;
}

.countdown-label {
  font-size: 13px;
  color: #888;
}

.countdown-timer {
  font-size: 22px;
  font-weight: 800;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

/* 主按钮 */
.btn-main {
  position: relative;
  width: 100%;
  height: 56px;
  background: linear-gradient(135deg, #ff6b35, #e53935 50%, #c62828);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(229,57,53,0.5);
  transition: transform 0.15s;
}

.btn-main:active { transform: scale(0.97); }

.btn-shine {
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: rgba(255,255,255,0.3);
  transform: skewX(-20deg);
  animation: shineSweep 2.5s ease-in-out infinite;
}

@keyframes shineSweep {
  0%   { left: -60%; opacity: 0; }
  20%  { opacity: 1; }
  50%  { left: 130%; opacity: 0; }
  100% { left: 130%; opacity: 0; }
}

/* 信任行 */
.trust-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 8px;
}

.trust-item {
  font-size: 12px;
  color: #888;
}

.tips {
  font-size: 12px;
  color: #bbb;
  line-height: 1.5;
}

/* ============================================
   页面2：转盘
   ============================================ */
#page-wheel {
  background: linear-gradient(160deg, #6a0000 0%, #1a0a00 60%);
  padding-top: 0;
}

.wheel-header {
  width: 100%;
  max-width: 400px;
  text-align: center;
  padding: 16px 0 16px;
}

.wheel-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.wheel-title {
  font-size: 18px;
  font-weight: 800;
  color: #ffd180;
}

.wheel-remain {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.08);
  padding: 3px 10px;
  border-radius: 20px;
}

.wheel-tip {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
}

.wheel-wrap {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 0 auto;
}

#wheelCanvas {
  border-radius: 50%;
  box-shadow: 0 0 0 6px #f5a623, 0 0 0 10px #c8781a, 0 12px 40px rgba(0,0,0,0.5);
  display: block;
}

.wheel-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px #f5a623, 0 4px 16px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.btn-spin {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b35, #e53935);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(229,57,53,0.4);
  transition: transform 0.15s;
}

.btn-spin:active  { transform: scale(0.95); }
.btn-spin:disabled { opacity: 0.6; cursor: not-allowed; }

.wheel-pointer {
  position: absolute;
  top: -20px; left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  color: var(--red);
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.wheel-desc {
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  margin-top: 20px;
  text-align: center;
}

.wheel-footer-tip {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  margin-top: 8px;
  text-align: center;
  padding: 0 20px;
}

/* ============================================
   页面3：中奖结果（微信红包风格）
   ============================================ */
#page-result {
  background: #c0392b;
  justify-content: center;
  padding-top: 0;
}

.result-wrap {
  text-align: center;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  justify-content: center;
}

.result-firework {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── 红包整体 ── */
.hongbao-wrap {
  position: relative;
  z-index: 1;
  width: 280px;
}

/* ── 未拆开的红包 ── */
.hongbao-sealed {
  width: 280px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
  cursor: pointer;
  animation: hbEntrance 0.5s cubic-bezier(0.34, 1.4, 0.64, 1);
  user-select: none;
}

@keyframes hbEntrance {
  0%   { transform: scale(0.5) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

.hb-top {
  background: linear-gradient(160deg, #e74c3c 0%, #c0392b 100%);
  padding: 36px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* 顶部半圆装饰（红包口） */
.hb-top::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px; height: 20px;
  background: #a93226;
  border-radius: 0 0 40px 40px;
}

.hb-coin {
  font-size: 56px;
  margin-bottom: 10px;
  animation: coinSpin 3s ease-in-out infinite;
}

@keyframes coinSpin {
  0%, 100% { transform: rotateY(0deg); }
  50%       { transform: rotateY(20deg) scale(1.05); }
}

.hb-title {
  font-size: 26px;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  margin-bottom: 4px;
}

.hb-sub {
  font-size: 14px;
  color: rgba(255,220,100,0.8);
  letter-spacing: 3px;
}

.hb-bottom {
  background: linear-gradient(135deg, #e8a020, #d4881a);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 底部波浪分隔 */
.hb-bottom::before {
  content: '';
  position: absolute;
  top: -12px; left: 0;
  width: 100%; height: 12px;
  background: linear-gradient(135deg, #e8a020, #d4881a);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.hb-from {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

.hb-open-hint {
  position: absolute;
  bottom: -36px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  animation: hintPulse 1.5s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) translateY(0); }
  50%       { opacity: 1;   transform: translateX(-50%) translateY(-3px); }
}

/* ── 拆开后的红包 ── */
.hongbao-opened {
  width: 280px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
  animation: openBounce 0.45s cubic-bezier(0.34, 1.5, 0.64, 1);
}

@keyframes openBounce {
  0%   { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1);    opacity: 1; }
}

.hb-open-top {
  background: linear-gradient(160deg, #b03020 0%, #922218 100%);
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hb-open-coin {
  font-size: 40px;
  margin-bottom: 8px;
}

.hb-open-label {
  font-size: 13px;
  color: rgba(255,220,120,0.8);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.hb-open-amount {
  font-size: 62px;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: -2px;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
  margin-bottom: 4px;
}

.hb-open-desc {
  font-size: 13px;
  color: rgba(255,220,120,0.7);
  letter-spacing: 2px;
}

.hb-open-divider {
  height: 1px;
  background: rgba(255,255,255,0.12);
}

.hb-open-bottom {
  background: #fff;
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hb-tips {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  margin-bottom: 4px;
}

.hb-tips span {
  font-size: 12px;
  color: #999;
  text-align: center;
  line-height: 1.6;
}

.btn-claim {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  border: none;
  border-radius: 25px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(192,57,43,0.4);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s;
}

.btn-claim::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
  animation: claimShine 2s ease-in-out infinite;
}

@keyframes claimShine {
  0%        { transform: translateX(-100%); }
  50%, 100% { transform: translateX(200%); }
}

.btn-claim:active { transform: scale(0.97); }

.claim-note {
  font-size: 14px;
  color: #888;
  font-weight: 600;
  text-align: center;
}

/* 红包外的倒计时（始终可见） */
.claim-note-outside {
  position: relative;
  z-index: 1;
  margin-top: 28px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.35);
  background: rgba(0,0,0,0.25);
  border-radius: 12px;
  padding: 12px 18px;
  width: 280px;
  box-sizing: border-box;
}

.claim-invalid {
  color: #ff5252;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: #ff5252;
}

#claimTimer {
  font-size: 18px;
  font-weight: 800;
  color: #ffd740;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   领取弹窗
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 40px;
  animation: slideUp 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-title {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 13px;
  color: #999;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  height: 46px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 15px;
  color: #1a1a1a;
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus {
  border-color: #f5a623;
  background: #fff;
}

.form-error {
  font-size: 13px;
  color: var(--red);
  background: #ffebee;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.form-error.hidden { display: none; }

.btn-submit {
  position: relative;
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, #ff6b35, #e53935);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(229,57,53,0.4);
  transition: transform 0.15s;
  margin-bottom: 10px;
}

.btn-submit:active { transform: scale(0.97); }

.btn-submit-shine {
  position: absolute;
  top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: rgba(255,255,255,0.25);
  transform: skewX(-20deg);
  animation: shineSweep 2s ease-in-out infinite;
}

.modal-note {
  text-align: center;
  font-size: 11px;
  color: #bbb;
}

/* ============================================
   页面4：揭示真相
   ============================================ */
#page-truth {
  background: #f5f5f5;
  padding-top: 20px;
  justify-content: flex-start;
  overflow-y: auto;
}

.truth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--radius);
  padding: 26px 20px 30px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}

.truth-icon {
  font-size: 44px;
  text-align: center;
  margin-bottom: 4px;
}

.truth-title {
  font-size: 26px;
  font-weight: 800;
  color: #e53935;
  text-align: center;
  margin-bottom: 18px;
}

.truth-highlight {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a1a;
  text-align: center;
  margin-bottom: 14px;
  padding: 12px;
  background: #fff8e1;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
}

.truth-body p {
  font-size: 15px;
  color: #444;
  line-height: 1.75;
  margin-bottom: 16px;
}

.reveal-section {
  margin-bottom: 16px;
}

.reveal-title {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #333 !important;
  margin-bottom: 8px !important;
}

.truth-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.truth-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.truth-item.danger {
  background: #ffebee;
  color: #c62828;
}

.t-icon {
  font-size: 14px;
  font-weight: 900;
  flex-shrink: 0;
  margin-top: 1px;
}

.warning-box {
  background: #fff3e0;
  border: 1.5px solid #ff9800;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.warning-title {
  font-size: 14px;
  font-weight: 700;
  color: #e65100;
  margin-bottom: 8px;
}

.warning-box ul {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.warning-box ul li {
  font-size: 13px;
  color: #555;
  line-height: 1.6;
}

.truth-footer {
  font-size: 14px;
  color: #1a1a1a;
  font-weight: 700;
  background: #e8f5e9;
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  margin-bottom: 4px !important;
  line-height: 1.6;
}

.btn-back {
  width: 100%;
  height: 50px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 18px;
  transition: background 0.2s, transform 0.15s;
}

.btn-back:active { transform: scale(0.97); background: #333; }

.share-hint {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin-top: 12px;
  line-height: 1.6;
}

/* ============================================
   烟花粒子
   ============================================ */
.spark {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkFly linear forwards;
}

@keyframes sparkFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 360px) {
  .entry-title   { font-size: 26px; }
  .prize-amount  { font-size: 42px; }
  #wheelCanvas   { width: 280px; height: 280px; }
  .wheel-wrap    { width: 280px; height: 280px; }
}
