:root {
  --bg: #0a1524;
  --surface: rgba(18, 32, 50, 0.88);
  --surface-solid: #142033;
  --line: rgba(232, 196, 122, 0.22);
  --text: #f4f1ea;
  --muted: #9aa6b5;
  --gold: #e8c47a;
  --gold-deep: #c9a052;
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body { overflow-x: hidden; }

.page-bg {
  position: fixed;
  inset: 0;
  background:
    url("/assets/bg.jpg") center top / cover no-repeat;
  z-index: 0;
}

.page-shade {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(8, 16, 28, 0.45) 0%, rgba(8, 16, 28, 0.72) 42%, rgba(8, 16, 28, 0.92) 100%);
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 430px;
  margin: 0 auto;
  padding: 32px 18px calc(40px + env(safe-area-inset-bottom));
}

/* Header */
.hero {
  text-align: center;
  margin-bottom: 18px;
}

.hero-ornament {
  width: 48px;
  height: 3px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.hero h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fff8ea;
  text-shadow: 0 2px 18px rgba(232, 196, 122, 0.25);
}

.subtitle {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.subtitle:empty { display: none; }

/* Wheel stage */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0 28px;
}

.wheel-wrap {
  position: relative;
  width: min(84vw, 320px);
  aspect-ratio: 1;
}

.wheel-glow {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 196, 122, 0.28), transparent 68%);
  filter: blur(4px);
  pointer-events: none;
}

.pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  z-index: 8;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

.pointer-body {
  display: block;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid var(--gold);
}

.wheel-outer {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  padding: 8px;
  background:
    linear-gradient(145deg, rgba(255, 236, 190, 0.55), rgba(120, 90, 40, 0.45)),
    #1a1208;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.wheel-lights {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(
      from 0deg,
      rgba(255, 240, 200, 0.95) 0deg 8deg,
      rgba(40, 28, 12, 0.9) 8deg 16deg
    );
  opacity: 0.9;
  pointer-events: none;
  z-index: 1;
  mask: radial-gradient(circle, transparent 62%, #000 63%, #000 70%, transparent 71%);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%, #000 70%, transparent 71%);
}

.wheel {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  transform: rotate(0deg);
  will-change: transform;
  background: #243447;
  box-shadow: inset 0 0 0 3px rgba(10, 16, 28, 0.35);
}

.wheel.is-spinning {
  filter: saturate(1.08);
}

.wheel-seg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15%;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.wheel-seg__name {
  max-width: 4.6em;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  color: #1a140c;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  word-break: break-all;
}

.spin-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  border: 3px solid rgba(255, 248, 230, 0.55);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  background:
    url("/assets/spin-btn.jpg") center / cover no-repeat,
    linear-gradient(145deg, #f2d79a, #c49a45);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.spin-btn__face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255, 248, 230, 0.28), rgba(20, 14, 6, 0.42));
  color: #1a140c;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.spin-btn:active { transform: scale(0.96); }
.spin-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.25) brightness(0.9);
}

.status {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Panels */
.panel {
  margin-bottom: 16px;
  padding: 16px 16px 8px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: #fff8ea;
}

.panel-tag {
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #1a140c;
  background: linear-gradient(135deg, #f0ddb0, var(--gold-deep));
}

.prize-list,
.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.prize-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.prize-item:last-child { border-bottom: none; }

.prize-swatch {
  width: 12px;
  height: 36px;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.prize-meta { flex: 1; min-width: 0; }

.prize-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.prize-desc {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.prize-rate {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: #d5dde7;
}

.recent-item:last-child { border-bottom: none; }

.recent-item time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 12px 2px;
  font-size: 13px;
  color: var(--muted);
}

/* Modal */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.62);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  width: min(100%, 340px);
  padding: 28px 22px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, #1c314c 0%, #12233a 100%);
  border: 1px solid rgba(232, 196, 122, 0.35);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
  animation: pop 0.32s cubic-bezier(0.2, 0.9, 0.2, 1);
  overflow: hidden;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #7ec8e3, #e8c47a, #e8927c, #a78bfa);
}

.modal-label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.modal-prize-chip {
  margin: 14px auto 0;
  display: inline-flex;
  max-width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(232, 196, 122, 0.12);
  border: 1px solid rgba(232, 196, 122, 0.35);
}

.modal-prize-chip span {
  font-size: 22px;
  font-weight: 750;
  color: #fff4d8;
  line-height: 1.25;
}

.modal-desc {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.modal-desc:empty { display: none; }

.modal-btn {
  margin-top: 22px;
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: #1a140c;
  background: linear-gradient(135deg, #f0ddb0, var(--gold-deep));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  max-width: 86vw;
  padding: 11px 16px;
  border-radius: 999px;
  background: rgba(12, 20, 32, 0.94);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
}

.toast[hidden] { display: none; }

.page.is-disabled .spin-btn { filter: grayscale(0.35); }
