:root {
  --bg: #0c0a08;
  --gold: #f0c14b;
  --ink: #3a2504;
  --text: #f6f1e6;
  --muted: #b7ab96;
  --line: rgba(214, 168, 78, 0.38);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(196, 140, 40, 0.22), transparent 46%),
    #0c0a08;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 206, 110, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 206, 110, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hp { position: absolute; left: -9999px; height: 0; opacity: 0; }

.wrap { padding: 10px 12px 32px; }
.shell {
  position: relative;
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 10px 16px 14px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(42, 32, 18, 0.55), rgba(12, 10, 8, 0.2)),
    rgba(16, 13, 9, 0.92);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 236, 190, 0.08);
}

.center { display: flex; justify-content: center; }
.lang-bar { display: flex; justify-content: flex-end; margin: 0 0 2px; }
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 58%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.45);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23f0d48a' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: #f3e6c8;
  padding: 6px 28px 6px 12px;
  font-size: 13px;
  font-weight: 800;
}
.chip {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: #f3e6c8;
}
.langs button {
  min-width: 42px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.langs button.active {
  color: var(--ink);
  border-color: transparent;
  background: linear-gradient(180deg, #ffe7a6, #f0b429);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px auto 0;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.chip i {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(180deg, #8ec5ff, #6a5cff 55%, #f0c14b);
}
.eyebrow {
  margin: 8px 0 0;
  text-align: center;
  color: #e7c56a;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.headline, .coin-title, .prize-name {
  margin: 6px 0 0;
  text-align: center;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff1c4 0%, #f0c14b 42%, #c4841d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.headline { font-size: clamp(32px, 9vw, 46px); white-space: pre-line; }
.sub, .card-copy, .note, .wheel-sub, .result-kicker {
  color: var(--muted);
  text-align: center;
}
.sub { margin: 6px auto 0; max-width: 34em; font-size: 14px; line-height: 1.45; }
.banner {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.banner span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(240, 193, 75, 0.08);
  color: #f0d48a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.chev {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid #f0d48a;
}
.ticker {
  margin-top: 14px;
  padding: 10px 8px 8px;
  border-radius: 16px;
  border: 1px solid rgba(214, 168, 78, 0.28);
  background: rgba(0, 0, 0, 0.28);
}
.ticker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: #e7c56a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7dffb3;
  box-shadow: 0 0 8px #7dffb3;
}
.ticker-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.quote { text-align: center; min-width: 0; }
.quote b { display: block; font-size: 12px; letter-spacing: 0.04em; }
.quote .px { display: block; margin-top: 2px; font-size: 11px; color: #f6f1e6; }
.quote .chg { display: block; margin-top: 2px; font-size: 10px; }
.chg.up { color: #7dffb3; }
.chg.down { color: #ff8f86; }
.quote-wait { color: var(--muted); font-size: 12px; }
.visual {
  position: relative;
  margin-top: 12px;
  padding: 8px 12px 4px;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(214, 168, 78, 0.28);
  background:
    radial-gradient(circle at 50% 38%, rgba(240, 193, 75, 0.18), transparent 42%),
    linear-gradient(180deg, #14110e, #090807);
  text-align: center;
}
.coin {
  width: min(148px, 46%);
  animation: float 4.8s ease-in-out infinite;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.45));
}
.coin-kicker {
  margin-top: 4px;
  color: #d9c7a2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.28em;
}
.coin-title { font-size: clamp(32px, 9vw, 46px); margin-bottom: 4px; }
.spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f8e2a4;
  box-shadow: 0 0 10px #f0c14b;
  opacity: 0.8;
}
.info {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(214, 168, 78, 0.28);
  background: rgba(0, 0, 0, 0.28);
}
.gift {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 40%, #2a2116, #0d0b09 72%);
  border: 1px solid rgba(214, 168, 78, 0.2);
}
.gift img { width: 64px; }
.info h2 { margin: 0 0 4px; font-size: 16px; }
.info p, .card-copy { margin: 0; font-size: 13px; line-height: 1.5; text-align: left; }
.cta, .primary {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  padding: 16px 18px;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #ffe38a, #f5b942 46%, #e09a16);
  box-shadow: 0 10px 24px rgba(214, 150, 30, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.cta:active, .primary:active { transform: translateY(1px); }
.cta:disabled { opacity: 0.7; }
.start-block { margin-top: 4px; }
.start-block .wallet-hint { margin-top: 8px; text-align: center; }
.wallet { margin-top: 16px; text-align: left; }
.wallet.on {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(214, 168, 78, 0.35);
  background: rgba(240, 193, 75, 0.08);
}
.wallet-hint { margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.wallet-boost {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(214, 168, 78, 0.5);
  background: rgba(240, 193, 75, 0.12);
  color: #f6e7c2;
  font-size: 14px;
  line-height: 1.5;
}
.wallet .cta { margin-top: 10px; }
.wallet-state { display: block; color: #e7c56a; font-size: 12px; font-weight: 700; }
.wallet-addr { display: block; margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; }
.wallet-off {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: #f3e6c8;
  padding: 8px 12px;
  white-space: nowrap;
}
.wallet-line { margin: 8px 0 0; color: var(--muted); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.wallet-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.wallet-app {
  display: block;
  text-align: center;
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--ink);
  font-weight: 800;
  background: linear-gradient(180deg, #ffe38a, #f5b942 46%, #e09a16);
}
.ghost {
  width: 100%;
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px;
}
.bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #c8902a, #ffe7a6); }
.progress-label { display: flex; justify-content: space-between; margin: 14px 0 8px; color: #e7c56a; font-size: 13px; font-weight: 700; }
.q-title { margin: 8px 0 14px; font-size: 22px; line-height: 1.35; }
.hint { margin: -8px 0 12px; color: var(--muted); font-size: 13px; }
.opt {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 13px 14px;
  text-align: left;
  line-height: 1.45;
  border-radius: 14px;
  border: 1px solid rgba(214, 168, 78, 0.28);
  background: rgba(0, 0, 0, 0.28);
}
.opt[aria-pressed="true"] {
  color: var(--ink);
  border-color: transparent;
  background: linear-gradient(180deg, #ffe7a6, #e7b34a);
  font-weight: 800;
}
textarea, .field input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(214, 168, 78, 0.35);
  background: rgba(0, 0, 0, 0.35);
  padding: 14px;
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
textarea:focus, .field input:focus { border-color: #f0c14b; }
.field label { display: block; margin-bottom: 8px; font-weight: 700; }
.msg { min-height: 1.2em; margin: 8px 0 0; color: #ffb4a8; font-size: 13px; text-align: center; }
.actions { display: flex; gap: 8px; align-items: center; }
.actions .primary { width: auto; flex: 1; margin-top: 8px; }
.actions .back {
  flex: 0 0 auto;
  margin-top: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: #f3e6c8;
  padding: 16px 18px;
  white-space: nowrap;
}
.banner-note, .saved {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(240, 193, 75, 0.08);
  color: #f0d48a;
  font-size: 13px;
  text-align: center;
}
.closed { padding: 28px 8px; text-align: center; }
.prize-name { font-size: clamp(32px, 9vw, 48px); }
.result-kicker { margin-bottom: 0; letter-spacing: 0.08em; font-size: 13px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.78);
}
.modal[hidden] { display: none !important; }
.payout { margin-top: 12px; }
.payout .wallet-hint { text-align: center; }
.payout-input {
  width: 100%;
  margin-top: 8px;
  border-radius: 14px;
  border: 1px solid rgba(214, 168, 78, 0.35);
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wheel-card {
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px 16px 16px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1b160f, #0e0c09);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.wheel-stage {
  position: relative;
  width: min(100%, 340px);
  margin: 8px auto 0;
  overflow: hidden;
  contain: paint;
}
.wheel-rot {
  width: 100%;
  transform: translateZ(0) rotate(0deg);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
}
.wheel-rot.spin {
  will-change: transform;
  transition: transform 5.2s cubic-bezier(0.1, 0.7, 0.05, 1);
}
.wheel-rot canvas { display: block; width: 100%; height: auto; }
.pointer {
  position: absolute;
  z-index: 5;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 24px solid #ffe7a6;
  filter: drop-shadow(0 2px 0 #6a4a10) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.45));
}
.hub {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d2, #e0aa3a 42%, #8a5a12);
  box-shadow: 0 0 0 5px #1a140c, 0 0 0 8px #f0c14b;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d9cbb4;
  font-size: 12px;
}
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.wheel-sub, .note { font-size: 13px; line-height: 1.5; }
#confetti {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

html[dir="rtl"] .shell,
html[dir="rtl"] .modal {
  text-align: right;
}
html[dir="rtl"] .opt,
html[dir="rtl"] .row {
  flex-direction: row-reverse;
}
html[dir="rtl"] select.lang {
  direction: rtl;
}

@media (prefers-reduced-motion: reduce) {
  .coin { animation: none; }
  .wheel-rot.spin { transition-duration: 0.01ms; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
