:root {
  --gold: #ffe033;
  --gold-hot: #ffcc00;
  --magenta: #ff2d9b;
  --purple: #7b2fff;
  --cyan: #00e8ff;
  --pink: #ff6ec7;
  --text: #fff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
  height: auto;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #0a0218;
  overflow-x: hidden;
  overflow-y: visible;
  touch-action: pan-y;
}

body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
  touch-action: none;
  overscroll-behavior: none;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 100% 55% at 50% 0%, rgba(255, 45, 155, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 45% at 0% 80%, rgba(123, 47, 255, 0.3), transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 60%, rgba(0, 232, 255, 0.18), transparent 45%),
    linear-gradient(180deg, #0a0218 0%, #1a0533 40%, #120828 100%);
}

.bg-rays {
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg at 50% 30%,
    transparent 0deg, rgba(255, 224, 51, 0.06) 20deg, transparent 40deg,
    rgba(255, 45, 155, 0.05) 80deg, transparent 100deg,
    rgba(0, 232, 255, 0.05) 140deg, transparent 160deg);
  animation: rays-spin 12s linear infinite;
}

@keyframes rays-spin {
  to { transform: rotate(360deg); }
}

.sparkle {
  position: absolute;
  border-radius: 50%;
  animation: twinkle 1.8s ease-in-out infinite;
}

.sparkle.s1 { width: 3px; height: 3px; background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.sparkle.s2 { width: 5px; height: 5px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.sparkle.s3 { width: 4px; height: 4px; background: var(--pink); box-shadow: 0 0 8px var(--pink); }

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.4); }
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 14px calc(28px + var(--safe-bottom));
}

.hero {
  text-align: center;
  margin-bottom: 16px;
}

.badge-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.badge {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transform: skewX(-8deg);
}

.badge span { display: block; transform: skewX(8deg); }

.badge-a {
  background: linear-gradient(180deg, #3d8bff, #1a4fd4);
  border: 2px solid #fff;
  color: var(--gold);
  box-shadow: 0 3px 0 #0a2060, 0 0 16px rgba(61, 139, 255, 0.5);
  animation: badge-blink 1.2s ease-in-out infinite;
}

.badge-b {
  background: linear-gradient(180deg, var(--magenta), #c01070);
  border: 2px solid var(--gold);
  color: #fff;
  box-shadow: 0 3px 0 #6a0840, 0 0 16px rgba(255, 45, 155, 0.45);
  animation: badge-blink 1.2s ease-in-out infinite 0.6s;
}

@keyframes badge-blink {
  0%, 100% { filter: brightness(1); transform: skewX(-8deg) scale(1); }
  50% { filter: brightness(1.6); transform: skewX(-8deg) scale(1.06); }
}

.title-block {
  position: relative;
  display: inline-block;
  padding: 4px 0;
}

.title-line {
  display: block;
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.08em;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
}

.title-line.flash-a {
  background: linear-gradient(180deg, #fff 0%, var(--gold) 40%, #ff9500 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-blink-a 0.85s ease-in-out infinite;
}

.title-line.flash-b {
  background: linear-gradient(180deg, var(--cyan) 0%, #fff 50%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-blink-b 0.85s ease-in-out infinite;
  margin-top: 2px;
}

@keyframes text-blink-a {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(255, 224, 51, 0.8)) drop-shadow(0 3px 0 #8a6000);
    transform: scale(1);
  }
  50% {
    opacity: 0.25;
    filter: drop-shadow(0 0 28px rgba(255, 255, 255, 1)) drop-shadow(0 0 40px rgba(255, 45, 155, 0.9));
    transform: scale(1.04);
  }
}

@keyframes text-blink-b {
  0%, 100% {
    opacity: 0.3;
    filter: drop-shadow(0 0 24px rgba(0, 232, 255, 1)) drop-shadow(0 3px 0 #004466);
    transform: scale(1.03);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(255, 110, 199, 0.9)) drop-shadow(0 3px 0 #660044);
    transform: scale(1);
  }
}

.title-block::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shine-pass 2.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shine-pass {
  0% { left: -80%; }
  45%, 100% { left: 150%; }
}

.ribbon {
  margin-top: 14px;
  display: inline-block;
  padding: 8px 22px;
  background: linear-gradient(90deg, var(--purple), var(--magenta), var(--purple));
  border: 2px solid var(--gold);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 900;
  color: var(--gold);
  transform: skewX(-5deg);
  box-shadow: 0 4px 0 #3a0860, 0 0 24px rgba(255, 45, 155, 0.4);
  animation: ribbon-pulse 1.5s ease-in-out infinite;
}

.ribbon span { display: inline-block; transform: skewX(5deg); }

@keyframes ribbon-pulse {
  0%, 100% { box-shadow: 0 4px 0 #3a0860, 0 0 20px rgba(255, 45, 155, 0.3); }
  50% { box-shadow: 0 4px 0 #3a0860, 0 0 36px rgba(255, 224, 51, 0.6); }
}

.announce {
  margin-bottom: 14px;
}

.announce-banner {
  text-align: center;
  padding: 12px 10px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 45, 155, 0.22), rgba(123, 47, 255, 0.18));
  border: 1px solid rgba(255, 224, 51, 0.35);
  box-shadow: 0 0 24px rgba(255, 45, 155, 0.15);
}

.announce-banner p {
  font-size: 12px;
  line-height: 1.65;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
}

.announce-banner p + p {
  margin-top: 6px;
}

.announce-banner p:first-child {
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), #fff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.announce-card {
  position: relative;
  padding: 14px 12px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(26, 5, 51, 0.95), rgba(8, 2, 20, 0.98));
  border: 1.5px solid rgba(0, 232, 255, 0.35);
  box-shadow: inset 0 0 20px rgba(123, 47, 255, 0.15);
}

.announce-card-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.announce-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3355;
  box-shadow: 0 0 12px #ff3355;
  animation: announce-pulse 1.2s ease-in-out infinite;
}

@keyframes announce-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.announce-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 224, 51, 0.5);
}

.announce-body p {
  font-size: 11px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.78);
  text-align: justify;
}

.announce-body p + p {
  margin-top: 8px;
}

.announce-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  justify-content: center;
}

.announce-chips span {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: var(--cyan);
  background: rgba(0, 232, 255, 0.1);
  border: 1px solid rgba(0, 232, 255, 0.35);
}

.stage {
  position: relative;
  padding: 18px 12px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(40, 8, 70, 0.95), rgba(10, 2, 24, 0.98));
  border: 2px solid rgba(255, 224, 51, 0.4);
  box-shadow:
    inset 0 0 30px rgba(123, 47, 255, 0.2),
    0 0 40px rgba(255, 45, 155, 0.15),
    0 12px 36px rgba(0, 0, 0, 0.5);
  margin-bottom: 14px;
}

.stage-glow {
  position: absolute;
  inset: -2px;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--magenta), var(--gold), var(--cyan), var(--magenta));
  background-size: 300% 100%;
  animation: border-flow 3s linear infinite;
  z-index: -1;
  opacity: 0.7;
}

@keyframes border-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.stage-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.22em;
  text-shadow: 0 0 10px rgba(0, 232, 255, 0.5);
  margin-bottom: 14px;
}

.digits {
  --digit-gap: 6px;
  /* 默认高度；精确值由 JS 按容器宽度写入，避免旧 WebView 不支持复杂 calc */
  --digit-h: 74px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--digit-gap);
  width: 100%;
  min-height: var(--digit-h);
  box-sizing: border-box;
}

.digit-slot {
  position: relative;
  width: calc(var(--digit-h) * 0.7);
  height: var(--digit-h);
  border-radius: 10px;
  flex: 0 0 calc(var(--digit-h) * 0.7);
  background: linear-gradient(180deg, #1a0830 0%, #080414 100%);
  border: 2px solid var(--gold);
  box-shadow:
    inset 0 6px 16px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(255, 224, 51, 0.2);
  overflow: hidden;
}

.digit-slot.active {
  border-color: var(--cyan);
  animation: slot-flash 0.4s ease-in-out infinite;
}

.digit-slot.done {
  border-color: var(--magenta);
  box-shadow:
    inset 0 6px 16px rgba(0, 0, 0, 0.7),
    0 0 28px rgba(255, 45, 155, 0.5);
}

@keyframes slot-flash {
  0%, 100% { box-shadow: inset 0 6px 16px rgba(0,0,0,0.7), 0 0 24px rgba(0,232,255,0.6); }
  50% { box-shadow: inset 0 6px 16px rgba(0,0,0,0.7), 0 0 40px rgba(255,224,51,0.8); }
}

.digit-window {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.digit-roll {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.digit-roll span {
  display: block;
  height: var(--digit-h);
  line-height: var(--digit-h);
  text-align: center;
  font-size: calc(var(--digit-h) * 0.52);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  background: linear-gradient(180deg, #fff 10%, var(--gold) 45%, #ff6600 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.digit-slot::before,
.digit-slot::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 28%;
  z-index: 2;
  pointer-events: none;
}

.digit-slot::before {
  top: 0;
  background: linear-gradient(180deg, rgba(8, 4, 20, 0.85), transparent);
}

.digit-slot::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(8, 4, 20, 0.85), transparent);
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 224, 51, 0.3);
  transition: all 0.25s;
}

.dot.on {
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  animation: dot-blink 0.5s ease-in-out infinite;
}

.dot.done {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.stage .result {
  text-align: center;
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 224, 51, 0.15);
}

.result-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--pink);
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(255, 110, 199, 0.5);
  min-height: 1.4em;
}

.result-box {
  position: relative;
  display: inline-block;
  margin-top: 0;
  padding: 0 20px;
  border-radius: 12px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: scale(0.92);
  transition:
    max-height 0.4s ease,
    opacity 0.35s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.35s ease,
    padding 0.35s ease;
}

.result-box.show {
  opacity: 1;
  transform: scale(1);
  max-height: 80px;
  margin-top: 6px;
  padding: 6px 20px;
}

.result-box.show .result-amount {
  animation: amount-flash 0.7s ease-in-out infinite;
}

.result-box.show::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--gold), var(--magenta), var(--cyan), var(--gold));
  background-size: 300% 100%;
  animation: border-flow 1.5s linear infinite;
  z-index: -1;
}

.result-box.show::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: rgba(20, 4, 40, 0.92);
  z-index: -1;
}

.result-amount {
  font-size: clamp(40px, 12vw, 52px);
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff 0%, var(--gold) 35%, #ff6600 70%, var(--gold-hot) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(0, 0, 0, 0.4);
}

@keyframes amount-flash {
  0%, 100% {
    filter: drop-shadow(0 0 12px rgba(255, 224, 51, 0.9)) brightness(1.2);
    transform: scale(1);
  }
  25% {
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 1)) drop-shadow(0 0 50px rgba(255, 45, 155, 0.8)) brightness(1.8);
    transform: scale(1.06);
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(0, 232, 255, 0.8)) brightness(1);
    transform: scale(0.98);
  }
  75% {
    filter: drop-shadow(0 0 28px rgba(255, 224, 51, 1)) brightness(1.6);
    transform: scale(1.04);
  }
}

.result-unit {
  font-size: 16px;
  margin-left: 4px;
  background: linear-gradient(180deg, var(--cyan), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: amount-flash 0.7s ease-in-out infinite 0.15s;
}

.cta {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #1a0533;
  background: linear-gradient(180deg, #fff 0%, var(--gold) 30%, #ff9500 100%);
  border: 3px solid #fff;
  box-shadow: 0 5px 0 #996600, 0 0 36px rgba(255, 224, 51, 0.5);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: cta-glow 2s ease-in-out infinite;
}

@keyframes cta-glow {
  0%, 100% { box-shadow: 0 5px 0 #996600, 0 0 28px rgba(255, 224, 51, 0.4); }
  50% { box-shadow: 0 5px 0 #996600, 0 0 48px rgba(255, 45, 155, 0.5); }
}

.cta::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: btn-shine 2s ease-in-out infinite;
}

@keyframes btn-shine {
  0% { left: -100%; }
  50%, 100% { left: 200%; }
}

.cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  animation: none;
}

.cta.submitted {
  color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(180deg, #4a4a5a 0%, #2a2a38 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 0 #1a1a22, 0 0 12px rgba(0, 232, 255, 0.15);
  opacity: 1;
  cursor: not-allowed;
  animation: none;
}

.cta.submitted::after {
  display: none;
}

.cta:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #996600;
}

.cta-secondary {
  width: 100%;
  margin-top: 10px;
  height: 42px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 224, 51, 0.45);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.cta-secondary:hover {
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 232, 255, 0.25);
}

.footer-note {
  margin-top: 14px;
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.65;
}

.confetti {
  position: fixed;
  pointer-events: none;
  z-index: 99;
  animation: confetti-fall 2s ease-out forwards;
}

@keyframes confetti-fall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translateY(140px) rotate(720deg) scale(0.3); }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 0, 12, 0.88);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 22px 18px 18px;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(35, 10, 60, 0.98), rgba(10, 2, 24, 0.99));
  border: 2px solid rgba(255, 224, 51, 0.45);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  transform: translateZ(0);
  will-change: auto;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.modal-icon {
  text-align: center;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 16px rgba(0, 232, 255, 0.5));
}

.modal-title {
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, var(--gold), #fff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.modal-desc {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
}

.modal-field {
  display: block;
  margin-top: 18px;
}

.modal-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.modal-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid rgba(123, 47, 255, 0.6);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0, 232, 255, 0.25);
}

.modal-input.error {
  border-color: #ff3355;
  box-shadow: 0 0 0 2px rgba(255, 51, 85, 0.28);
}

.modal-hint {
  margin-top: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
}

.modal-submit {
  width: 100%;
  margin-top: 14px;
  height: 44px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #1a0533;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  box-shadow: 0 3px 0 #553300;
  cursor: pointer;
}

.modal-submit:active {
  transform: translateY(2px);
}

.modal-submit.success {
  background: linear-gradient(180deg, #3dff9a, #00c853);
  animation: none;
  color: #042410;
}

@media (prefers-reduced-motion: reduce) {
  .bg-rays,
  .sparkle,
  .badge-a,
  .badge-b,
  .title-line,
  .ribbon,
  .stage-glow,
  .digit-slot.active,
  .dot.on,
  .result-box.show .result-amount,
  .result-unit,
  .cta,
  .cta::after,
  .announce-pulse,
  .modal-submit {
    animation: none !important;
  }
}
