:root {
  --bg-0: #080a12;
  --bg-1: #101527;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f1ea;
  --muted: #9aa3b8;
  --gold-1: #ffe7a6;
  --gold-2: #d8a94a;
  --gold-3: #a97b22;
  --radius: 18px;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  padding: 44px 20px 64px;
  color: var(--text);
  background: radial-gradient(1200px 700px at 50% -10%, #1d2440 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(520px 520px at 50% 42%, rgba(216, 169, 74, 0.14), transparent 68%),
    radial-gradient(420px 420px at 12% 8%, rgba(94, 129, 255, 0.10), transparent 70%);
}

.stage {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas:
    "head head"
    "wheel odds";
  gap: 36px 48px;
  align-items: start;
}

.head {
  grid-area: head;
  text-align: center;
  padding-top: 6px;
}

.head h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff8e2 0%, var(--gold-1) 42%, var(--gold-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.head .sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ---------- 顶部工具条 ---------- */
.toolbar {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-wrap {
  position: relative;
  display: inline-flex;
}

.lang-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  pointer-events: none;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 30px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.lang-select:hover { background: rgba(255, 255, 255, 0.09); }
.lang-select:focus-visible { outline: 2px solid var(--gold-1); outline-offset: 3px; }

.lang-select option {
  background: #11162a;
  color: var(--text);
}

.sound {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}

.sound[aria-pressed="true"] {
  color: var(--gold-1);
  border-color: rgba(255, 231, 166, 0.34);
}

/* ---------- 转盘 ---------- */
.wheel-wrap {
  grid-area: wheel;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.wheel-box {
  position: relative;
  width: clamp(280px, 74vw, 520px);
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 26px 60px rgba(0, 0, 0, 0.55));
}

#wheel {
  display: block;
  width: 100%;
  height: 100%;
}

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid var(--gold-1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
  z-index: 3;
}

.spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 27%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 4px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: #2b1d05;
  background:
    radial-gradient(circle at 34% 28%, #fff6d8 0%, var(--gold-1) 34%, var(--gold-2) 72%, #8d6418 100%);
  box-shadow:
    0 0 0 6px rgba(12, 16, 30, 0.92),
    0 0 0 8px rgba(255, 231, 166, 0.30),
    0 14px 28px rgba(0, 0, 0, 0.5),
    inset 0 -4px 10px rgba(120, 82, 12, 0.45),
    inset 0 4px 10px rgba(255, 255, 255, 0.55);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  z-index: 4;
  font-family: inherit;
}

.spin-btn .spin-main {
  font-size: clamp(13px, 2.2vw, 19px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-align: center;
}

.spin-btn .spin-sub {
  font-size: clamp(9px, 1.4vw, 12px);
  font-weight: 700;
  letter-spacing: 0.16em;
  opacity: 0.72;
  text-align: center;
}

.spin-btn:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.04); }

.spin-btn:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.97); }

.spin-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 6px;
}

.spin-btn:disabled {
  cursor: progress;
  filter: saturate(0.55) brightness(0.86);
}

.hint {
  margin: 0;
  min-height: 20px;
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: 0.03em;
  text-align: center;
}

/* ---------- 概率表 ---------- */
.odds {
  grid-area: odds;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(8px);
}

.odds h2 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold-1);
  text-transform: uppercase;
}

.odds-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.odds-list li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

.odds-list li:last-child { border-bottom: 0; }

.odds-list .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.odds-list .name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.odds-list .pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------- 结果弹窗 ---------- */
.result {
  width: min(420px, calc(100vw - 40px));
  padding: 34px 28px 26px;
  border: 1px solid rgba(255, 231, 166, 0.28);
  border-radius: 22px;
  background: linear-gradient(180deg, #1a2138 0%, #11162a 100%);
  color: var(--text);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.result::backdrop { background: rgba(4, 6, 12, 0.72); backdrop-filter: blur(3px); }

.result-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.22em;
}

.result h2 {
  margin: 0 0 10px;
  font-size: 30px;
  background: linear-gradient(180deg, #fff8e2, var(--gold-1) 55%, var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result-desc {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: #2b1d05;
  font-weight: 700;
}

.btn.primary:hover { background: linear-gradient(180deg, #fff3cf, #e5b757); }

.btn:focus-visible { outline: 2px solid var(--gold-1); outline-offset: 3px; }

/* ---------- 参与登记表单 ---------- */
.result.entry { text-align: left; }

.result.entry .result-kicker,
.result.entry h2 { text-align: center; }

.field { display: block; margin: 18px 0 6px; }

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.field input::placeholder { color: rgba(154, 163, 184, 0.65); }

.field input:focus {
  outline: 2px solid var(--gold-1);
  outline-offset: 2px;
  border-color: transparent;
}

.error {
  margin: 8px 0 0;
  color: #ff9a9a;
  font-size: 13px;
  line-height: 1.5;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  cursor: pointer;
}

.consent input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--gold-2);
}

.privacy {
  margin: 8px 0 18px;
  color: rgba(154, 163, 184, 0.72);
  font-size: 11.5px;
  line-height: 1.6;
}

.payout {
  margin: 4px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
}

.payout-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.payout code {
  display: block;
  color: var(--gold-1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  word-break: break-all;
}

.manual {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- 发放进度 ---------- */
.progress-box {
  margin: 4px 0 18px;
  text-align: left;
}

.steps {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.steps li {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
  text-align: center;
}

.steps .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.steps li.active { color: var(--text); }
.steps li.active .dot {
  background: var(--gold-1);
  box-shadow: 0 0 0 3px rgba(255, 231, 166, 0.18);
  animation: step-pulse 1.4s ease-in-out infinite;
}

.steps li.done { color: #9fe6d6; }
.steps li.done .dot { background: #43c8ad; }

.steps li.failed { color: #ff9a9a; }
.steps li.failed .dot { background: #ff7a7a; }

@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 231, 166, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(255, 231, 166, 0.06); }
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold-1));
  transition: width 0.45s ease;
}

.bar-fill.failed {
  background: linear-gradient(90deg, #c0392b, #ff7a7a);
}

.status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.txid {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  word-break: break-all;
}

.txid-label {
  margin-right: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10.5px;
}

.txid a { color: var(--gold-1); text-decoration: none; }
.txid a:hover { text-decoration: underline; }

.one-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.spin-btn.is-used {
  filter: saturate(0.4) brightness(0.82);
}

.spin-btn.is-used .spin-main {
  font-size: clamp(11px, 1.7vw, 14px);
  letter-spacing: 0.02em;
}

.demo-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid rgba(255, 120, 90, 0.5);
  border-radius: 999px;
  color: #ffb3a0;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.08em;
  vertical-align: 1px;
}

/* ---------- 彩屑 ---------- */
.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

@media (max-width: 860px) {
  body { padding-top: 62px; }
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "wheel"
      "odds";
    gap: 26px;
  }
  .odds { max-width: 520px; width: 100%; margin: 0 auto; }
}

@media (max-width: 420px) {
  .toolbar { gap: 6px; right: 10px; }
  .lang-select { padding: 7px 26px 7px 11px; font-size: 12px; }
  .sound { padding: 7px 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
