:root {
  --bg-page: #fff8ee;
  --bg-card: rgba(255, 255, 255, 0.88);
  --gold-1: #fff6d6;
  --gold-2: #f59e0b;
  --gold-3: #d97706;
  --coral: #ff4b6e;
  --orange: #ff7b29;
  --text-main: #2d1622;
  --text-muted: #7a5a68;
  --border-warm: rgba(245, 158, 11, 0.32);
  --danger: #e11d48;
  --radius-xl: 24px;
  --radius-lg: 16px;
}

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

html, body {
  width: 100%;
  min-height: 100dvh;
  background: linear-gradient(160deg, #fffdf7 0%, #fff3e0 48%, #ffe8ef 100%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fullscreen particle canvas */
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Shockwave flash */
.shockwave-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  background: radial-gradient(circle at center, #ffffff 0%, #fff3b0 38%, rgba(255, 123, 41, 0.55) 70%, transparent 100%);
}

.shockwave-flash.active {
  animation: flashBoom 0.72s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes flashBoom {
  0% { opacity: 0; transform: scale(0.4); }
  25% { opacity: 0.96; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* Ambient bright sunlit blobs */
.aurora-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.55;
  animation: blobFloat 14s ease-in-out infinite alternate;
}

.blob-1 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, #ffd166, transparent 70%);
  top: -110px;
  left: -80px;
}

.blob-2 {
  width: 330px;
  height: 330px;
  background: radial-gradient(circle, #ff9ebb, transparent 70%);
  bottom: -90px;
  right: -90px;
  animation-delay: -5s;
}

.blob-3 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, #ffb703, transparent 70%);
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.22;
  animation-delay: -9s;
}

@keyframes blobFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(22px, -24px) scale(1.12); }
}

/* Top bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
  max-width: 480px;
  margin: 0 auto;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(245, 158, 11, 0.28);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  letter-spacing: 0.3px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  animation: pulseDot 1.8s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.38); opacity: 0.65; }
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  color: var(--text-main);
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.icon-btn:active {
  transform: scale(0.92);
}

/* Main shell */
.app-shell {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(68px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stage {
  display: none;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  animation: stageIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.stage.active {
  display: flex;
}

@keyframes stageIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Hero header */
.hero-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.emblem-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.emblem-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(255, 123, 41, 0.55);
  animation: spinSlow 14s linear infinite;
}

.emblem-core {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5f6d, #ff8c42, #ffc371);
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(255, 107, 74, 0.38);
}

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

.gold-title {
  font-size: clamp(24px, 6.8vw, 32px);
  font-weight: 800;
  line-height: 1.24;
  background: linear-gradient(135deg, #e11d48 0%, #ea580c 52%, #d97706 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Prize showcase ticker */
.prize-showcase {
  width: 100%;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 18px;
  padding: 12px 0 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.08);
  overflow: hidden;
}

.showcase-label {
  padding: 0 14px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #c2410c;
  letter-spacing: 0.5px;
}

.prize-track-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 14px;
}

.prize-track-wrap::-webkit-scrollbar {
  display: none;
}

.prize-track {
  display: flex;
  gap: 10px;
  width: max-content;
}

.prize-chip {
  min-width: 128px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(155deg, #fffaf0, #fff1f5);
  border: 1px solid rgba(251, 146, 60, 0.28);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.prize-chip.sold-out {
  opacity: 0.48;
  filter: grayscale(0.5);
}

.prize-chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.prize-chip-icon {
  font-size: 20px;
}

.prize-chip-level {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 75, 110, 0.12);
  color: #e11d48;
}

.prize-chip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 122px;
}

.prize-chip-qty {
  font-size: 11px;
  color: var(--text-muted);
}

/* Bright Glass Card */
.glass-card {
  background: var(--bg-card);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-xl);
  padding: 24px 20px 20px;
  backdrop-filter: blur(20px);
  box-shadow:
    0 18px 42px rgba(234, 88, 12, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.04);
}

.glass-card.shake {
  animation: cardShake 0.46s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes cardShake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #9a3412;
  margin-bottom: 10px;
  letter-spacing: 0.4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.input-icon {
  position: absolute;
  left: 15px;
  font-size: 18px;
  opacity: 0.72;
  pointer-events: none;
}

#name-input {
  width: 100%;
  height: 54px;
  padding: 0 16px 0 46px;
  border-radius: 14px;
  border: 1.5px solid #fed7aa;
  background: #ffffff;
  color: var(--text-main);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

#name-input::placeholder {
  color: #b49aa6;
}

#name-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.16);
}

.error-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* Primary CTA Button */
.cta-btn {
  position: relative;
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff4b6e 0%, #ff7b29 52%, #f59e0b 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 12px 26px rgba(255, 95, 75, 0.36);
  transition: transform 0.18s, box-shadow 0.18s, opacity 0.2s;
}

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

.cta-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -120%;
  width: 70%;
  height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.48), transparent);
  animation: btnShimmer 2.8s ease-in-out infinite;
}

@keyframes btnShimmer {
  0% { left: -120%; }
  45%, 100% { left: 160%; }
}

.entry-tip {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: #a68a96;
}

/* ================= STAGE 2: BRIGHT DRAWING REACTOR ================= */
.drawing-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 10px 0;
}

.participant-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(249, 115, 22, 0.3);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.12);
  font-size: 14px;
  color: #7c2d12;
}

.participant-badge strong {
  color: #e11d48;
  font-size: 16px;
}

.reactor-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  display: grid;
  place-items: center;
  perspective: 900px;
}

.pulse-wave {
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(245, 158, 11, 0.65);
  animation: pulseExpand 1.6s cubic-bezier(0.1, 0.6, 0.3, 1) infinite;
}

.wave-2 { animation-delay: 0.53s; border-color: rgba(255, 75, 110, 0.55); }
.wave-3 { animation-delay: 1.06s; border-color: rgba(255, 123, 41, 0.55); }

@keyframes pulseExpand {
  0% { transform: scale(0.75); opacity: 0.9; }
  100% { transform: scale(1.42); opacity: 0; }
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 3.5px solid transparent;
}

.orbit-1 {
  width: 236px;
  height: 236px;
  border-top-color: #f59e0b;
  border-right-color: #ff7b29;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.35);
  animation: orbitSpin1 1.1s linear infinite;
}

.orbit-2 {
  width: 204px;
  height: 204px;
  border-bottom-color: #ff4b6e;
  border-left-color: #ec4899;
  box-shadow: 0 0 18px rgba(255, 75, 110, 0.32);
  animation: orbitSpin2 0.85s linear infinite;
}

.orbit-3 {
  width: 174px;
  height: 174px;
  border-top-color: #10b981;
  border-left-color: #0ea5e9;
  animation: orbitSpin3 0.7s linear infinite;
}

@keyframes orbitSpin1 {
  0% { transform: rotateX(55deg) rotateY(18deg) rotateZ(0deg); }
  100% { transform: rotateX(55deg) rotateY(18deg) rotateZ(360deg); }
}

@keyframes orbitSpin2 {
  0% { transform: rotateX(-50deg) rotateY(32deg) rotateZ(360deg); }
  100% { transform: rotateX(-50deg) rotateY(32deg) rotateZ(0deg); }
}

@keyframes orbitSpin3 {
  0% { transform: rotateX(30deg) rotateY(-55deg) rotateZ(0deg); }
  100% { transform: rotateX(30deg) rotateY(-55deg) rotateZ(360deg); }
}

.reactor-core {
  position: relative;
  width: 146px;
  height: 146px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #fff7db 62%, #ffe0a3 100%);
  border: 2.5px solid #f59e0b;
  box-shadow:
    0 14px 36px rgba(245, 158, 11, 0.36),
    inset 0 0 20px rgba(255, 123, 41, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  animation: coreBreathe 0.45s ease-in-out infinite alternate;
}

@keyframes coreBreathe {
  from { transform: scale(0.96); }
  to { transform: scale(1.05); }
}

.reel-icon {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(245, 158, 11, 0.35));
}

.reel-text {
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
  max-width: 118px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-wrap {
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.25);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff4b6e, #ff7b29, #f59e0b);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
  transition: width 0.12s linear;
}

.drawing-status {
  font-size: 14px;
  font-weight: 600;
  color: #b45309;
  letter-spacing: 0.4px;
}

/* ================= STAGE 3: BRIGHT RESULT CARDS ================= */
.result-card {
  position: relative;
  border-radius: 26px;
  padding: 26px 20px 22px;
  overflow: hidden;
  text-align: center;
  animation: popReveal 0.6s cubic-bezier(0.22, 1.25, 0.36, 1) forwards;
}

@keyframes popReveal {
  0% { opacity: 0; transform: scale(0.75) translateY(24px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.win-card {
  background: linear-gradient(170deg, #ffffff 0%, #fffaf0 58%, #fff0f4 100%);
  border: 2px solid #f59e0b;
  box-shadow:
    0 22px 54px rgba(245, 158, 11, 0.24),
    0 8px 24px rgba(255, 75, 110, 0.12);
}

.sunburst {
  position: absolute;
  top: -70px;
  left: 50%;
  width: 360px;
  height: 360px;
  margin-left: -180px;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(251, 191, 36, 0.16) 0deg 15deg,
    transparent 15deg 30deg
  );
  border-radius: 50%;
  animation: spinSlow 24s linear infinite;
  pointer-events: none;
}

.result-badge {
  position: relative;
  display: inline-block;
  padding: 6px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.win-badge {
  background: linear-gradient(90deg, #ff4b6e, #ff7b29, #f59e0b);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(255, 95, 75, 0.35);
}

.lose-badge {
  background: #fff3e6;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.already-note {
  position: relative;
  font-size: 12px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 14px;
}

.prize-hero {
  position: relative;
  padding: 10px 0 6px;
}

.win-icon {
  font-size: 68px;
  line-height: 1.1;
  filter: drop-shadow(0 8px 18px rgba(245, 158, 11, 0.35));
  animation: floatIcon 2.4s ease-in-out infinite alternate;
}

@keyframes floatIcon {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-6px) scale(1.06); }
}

.win-level {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 14px;
  border-radius: 999px;
  background: rgba(255, 75, 110, 0.12);
  border: 1px solid rgba(255, 75, 110, 0.32);
  color: #e11d48;
  font-size: 13px;
  font-weight: 700;
}

.win-prize-name {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #be123c, #ea580c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.25;
}

/* Ticket divider */
.ticket-divider {
  position: relative;
  display: flex;
  align-items: center;
  margin: 20px -20px 16px;
  height: 20px;
}

.ticket-divider .notch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff2e8;
  flex-shrink: 0;
}

.ticket-divider .notch.left { margin-left: -10px; }
.ticket-divider .notch.right { margin-right: -10px; }

.ticket-divider .dashed-line {
  flex: 1;
  border-top: 1.5px dashed rgba(245, 158, 11, 0.42);
  margin: 0 8px;
}

.ticket-meta {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 247, 237, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.meta-label {
  color: var(--text-muted);
}

.meta-value {
  font-weight: 700;
  color: var(--text-main);
}

.code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #c2410c;
  letter-spacing: 1px;
  background: #ffedd5;
  border: 1px solid #fdba74;
  padding: 3px 10px;
  border-radius: 8px;
}

.claim-tip {
  position: relative;
  margin-top: 14px;
  font-size: 12px;
  color: #b45309;
  font-weight: 500;
}

/* Lose card */
.lose-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(251, 146, 60, 0.25);
  box-shadow: 0 18px 44px rgba(234, 88, 12, 0.1);
}

.lose-hero {
  padding: 14px 4px 10px;
}

.lose-icon {
  font-size: 62px;
  margin-bottom: 12px;
  animation: floatIcon 3s ease-in-out infinite alternate;
}

.lose-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.lose-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
}

.lose-desc strong {
  color: #e11d48;
}

.lose-meta {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f3e8e2;
  font-size: 12px;
  color: #9e828f;
}

/* Result actions */
.result-actions {
  display: flex;
  gap: 12px;
}

.secondary-btn {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  border: 1.5px solid #fed7aa;
  background: rgba(255, 255, 255, 0.92);
  color: #9a3412;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  transition: background 0.2s, transform 0.15s;
}

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

.small-cta {
  flex: 1;
  height: 48px;
  font-size: 15px;
}
