/* ============================================================
   核聚派 · 幸运大转盘（投屏大屏版）
   设计目标：全屏不滚动、远距离可读、大屏投影高对比
   ============================================================ */

:root {
  --w-bg-0: #5c0310;
  --w-bg-1: #8e0616;
  --w-bg-2: #c00f20;
  --gold: #ffd479;
  --gold-2: #f0a92e;
  --gold-3: #a9701a;
  --gold-deep: #6b4310;
  --w-ink: #fff6e6;
  --w-ink-2: rgba(255, 246, 230, .72);
  --w-ink-3: rgba(255, 246, 230, .45);
  --w-line: rgba(255, 212, 121, .30);
  --w-panel: rgba(74, 3, 14, .42);
  --w-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body.wheel-body {
  height: 100%;
  overflow: hidden;
}

.wheel-body {
  font-family: var(--w-font);
  color: var(--w-ink);
  background: #a3081a;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ---------- 背景光效 ---------- */

.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 72% 58% at 30% 40%, rgba(255, 132, 62, .42), transparent 62%),
    radial-gradient(ellipse 62% 52% at 78% 64%, rgba(255, 198, 82, .32), transparent 66%),
    radial-gradient(circle at 50% 6%, #e51a2c 0%, #c81022 28%, #9c0819 58%, #6b0412 100%);
}

.bg-rays {
  position: fixed; inset: -30%; z-index: 0; pointer-events: none;
  opacity: .32;
  background:
    repeating-conic-gradient(from 0deg at 50% 50%,
      rgba(255, 212, 121, .16) 0deg 3deg,
      transparent 3deg 12deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,.9) 8%, transparent 46%);
  mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,.9) 8%, transparent 46%);
  animation: rays-spin 90s linear infinite;
}

@keyframes rays-spin { to { transform: rotate(360deg); } }

/* ---------- 舞台骨架 ---------- */

.stage {
  position: relative; z-index: 2;
  height: 100dvh;
  display: flex; flex-direction: column;
  gap: clamp(6px, 1.4vh, 20px);
  padding: clamp(10px, 1.6vh, 26px) clamp(14px, 2.4vw, 44px) clamp(10px, 2vh, 28px);
}

/* ---------- 顶栏 ---------- */

.stage-top {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}

.stage-brand {
  display: inline-flex; align-items: center; gap: clamp(8px, .8vw, 14px);
  color: var(--w-ink); text-decoration: none;
  font-size: clamp(15px, 1.35vw, 24px); letter-spacing: .5px;
}
.stage-brand b { font-weight: 800; color: var(--gold); }
.stage-brand i { font-style: normal; opacity: .45; margin: 0 .45em; }
.stage-logo {
  width: clamp(30px, 2.6vw, 46px); height: clamp(30px, 2.6vw, 46px);
  display: grid; place-items: center; border-radius: 30%;
  background: linear-gradient(145deg, #ffd479, #e8912a 55%, #a9631a);
  color: #43150a; font-size: clamp(15px, 1.3vw, 23px); font-weight: 900;
  box-shadow: 0 6px 22px rgba(240, 169, 46, .38), inset 0 1px 0 rgba(255,255,255,.55);
}

.stage-tools { display: flex; align-items: center; gap: clamp(6px, .7vw, 12px); flex-wrap: wrap; }

.live-pill {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .42em 1em; border-radius: 999px;
  font-size: clamp(12px, .95vw, 16px); font-weight: 600;
  color: var(--gold); background: rgba(255, 212, 121, .10);
  border: 1px solid var(--w-line);
  white-space: nowrap;
}
.live-pill::before {
  content: ''; width: .55em; height: .55em; border-radius: 50%;
  background: #46d17f; box-shadow: 0 0 10px #46d17f;
}
.live-pill[data-state="spinning"] { color: #ffb3a0; background: rgba(255, 120, 90, .12); border-color: rgba(255, 140, 110, .35); }
.live-pill[data-state="spinning"]::before { background: #ff8664; box-shadow: 0 0 10px #ff8664; animation: pulse-dot .7s ease-in-out infinite; }
.live-pill[data-state="paused"] { color: var(--w-ink-3); background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }
.live-pill[data-state="paused"]::before { background: #8d97a8; box-shadow: none; }
.live-pill[data-state="won"] { color: #ffe9a8; }
.live-pill[data-state="won"]::before { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.tool-btn {
  display: inline-flex; align-items: center; gap: .45em;
  padding: .48em 1.05em; border-radius: 999px;
  font-family: inherit; font-size: clamp(12px, .95vw, 16px); font-weight: 600;
  color: var(--w-ink-2); background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .20);
  cursor: pointer; text-decoration: none;
  transition: all .18s ease; white-space: nowrap;
}
.tool-btn:hover { color: #1a0508; background: linear-gradient(145deg, #ffd479, #eaa42c); border-color: transparent; }
.tool-btn[aria-pressed="false"] { opacity: .5; }

/* ---------- 主体两栏 ---------- */

.stage-main {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 20vw, 380px);
  gap: clamp(14px, 2vw, 40px);
  align-items: stretch;
}

.wheel-col {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(4px, .9vh, 14px);
}

.wheel-head { flex: 0 0 auto; text-align: center; }
.wheel-head h1 {
  font-size: clamp(26px, 3.6vw, 68px); font-weight: 900; letter-spacing: .04em; line-height: 1.12;
  background: linear-gradient(180deg, #fff8e6 6%, #ffd479 48%, #e08d1f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 14px rgba(255, 170, 60, .30));
}
.wheel-head p {
  margin-top: clamp(2px, .5vh, 8px);
  font-size: clamp(13px, 1.15vw, 22px); letter-spacing: .22em;
  color: var(--w-ink-2);
}

/* 转盘容器：JS 按可用空间算直径 */
.wheel-box {
  position: relative; flex: 1 1 auto; min-height: 0; width: 100%;
  display: grid; place-items: center;
}

#wheel-canvas {
  display: block;
  filter: drop-shadow(0 22px 58px rgba(48, 0, 8, .70)) drop-shadow(0 0 46px rgba(255, 190, 80, .30));
  touch-action: manipulation;
}

/* 顶部指针 */
.wheel-pointer {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, calc(-1 * var(--wheel-r, 300px)));
  width: clamp(28px, 3.4vw, 58px); height: auto; aspect-ratio: 0.86;
  transform-origin: 50% 18%;
  background: linear-gradient(180deg, #fff3cf 0%, #ffd479 34%, #e2911d 72%, #a9631a 100%);
  clip-path: polygon(50% 100%, 5% 26%, 50% 0%, 95% 26%);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .5));
  z-index: 3;
  pointer-events: none;
}
.wheel-pointer::after {
  content: ''; position: absolute; inset: 22% 30% 30%;
  border-radius: 50%; background: rgba(255, 255, 255, .5);
  filter: blur(3px);
}
.wheel-box.spinning .wheel-pointer { animation: pointer-knock .09s linear infinite; }
@keyframes pointer-knock {
  0%, 100% { transform: translate(-50%, calc(-1 * var(--wheel-r, 300px))) rotate(0deg); }
  50% { transform: translate(-50%, calc(-1 * var(--wheel-r, 300px))) rotate(-7deg); }
}

/* 中心按钮 */
.wheel-hub {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: var(--hub-size, 130px); height: var(--hub-size, 130px);
  border-radius: 50%; border: none; cursor: pointer; z-index: 4;
  display: grid; place-content: center; gap: 0;
  font-family: inherit; font-weight: 900; color: #4a1206;
  background:
    radial-gradient(circle at 35% 28%, #fff6dc 0%, #ffd479 32%, #efa32a 62%, #c0741a 100%);
  box-shadow:
    0 0 0 clamp(4px, .5vw, 9px) rgba(255, 255, 255, .92),
    0 0 0 clamp(7px, .8vw, 14px) rgba(190, 120, 30, .95),
    0 10px 30px rgba(0, 0, 0, .45),
    inset 0 -6px 14px rgba(150, 80, 10, .35);
  transition: transform .18s ease, filter .18s ease;
  animation: hub-breathe 2.6s ease-in-out infinite;
}
.wheel-hub:hover { transform: translate(-50%, -50%) scale(1.045); filter: brightness(1.06); }
.wheel-hub:active { transform: translate(-50%, -50%) scale(.97); }
.wheel-hub .hub-line1 { display: block; font-size: calc(var(--hub-size, 130px) * .30); line-height: 1.02; letter-spacing: .04em; }
.wheel-hub .hub-line2 { display: block; font-size: calc(var(--hub-size, 130px) * .235); line-height: 1.1; letter-spacing: .18em; opacity: .82; }
.wheel-hub:disabled { cursor: default; animation: none; }
.wheel-box.spinning .wheel-hub { animation: hub-pulse .55s ease-in-out infinite; }

@keyframes hub-breathe {
  0%, 100% { box-shadow: 0 0 0 clamp(4px,.5vw,9px) rgba(255,255,255,.92), 0 0 0 clamp(7px,.8vw,14px) rgba(190,120,30,.95), 0 10px 30px rgba(0,0,0,.45), 0 0 0 0 rgba(255, 200, 90, .55); }
  50% { box-shadow: 0 0 0 clamp(4px,.5vw,9px) rgba(255,255,255,.92), 0 0 0 clamp(7px,.8vw,14px) rgba(190,120,30,.95), 0 10px 34px rgba(0,0,0,.45), 0 0 0 clamp(12px,1.5vw,26px) rgba(255, 200, 90, 0); }
}
@keyframes hub-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

.wheel-mask {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(56, 2, 12, .72);
  backdrop-filter: blur(3px);
  font-size: clamp(18px, 2vw, 34px); font-weight: 800; color: #ffd479;
  letter-spacing: .1em;
}
.wheel-mask[hidden] { display: none; }

.wheel-hint {
  flex: 0 0 auto; text-align: center;
  font-size: clamp(12px, 1vw, 19px); color: var(--w-ink-3); letter-spacing: .05em;
}
.wheel-hint kbd {
  font-family: inherit; font-size: .92em; padding: .1em .5em; margin: 0 .15em;
  border-radius: 6px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2); color: var(--w-ink-2);
}

/* ---------- 右侧面板 ---------- */

.side-col {
  min-height: 0; display: flex; flex-direction: column;
  gap: clamp(8px, 1.4vh, 18px);
}

.panel {
  background: var(--w-panel);
  border: 1px solid var(--w-line);
  border-radius: clamp(12px, 1vw, 20px);
  padding: clamp(12px, 1.2vw, 22px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  display: flex; flex-direction: column; min-height: 0;
}
.panel-grow { flex: 1 1 auto; overflow: hidden; }

.panel-title {
  flex: 0 0 auto;
  font-size: clamp(13px, 1.05vw, 19px); font-weight: 700; color: var(--gold);
  letter-spacing: .12em; padding-bottom: clamp(8px, .9vh, 14px); margin-bottom: clamp(6px, .8vh, 12px);
  border-bottom: 1px solid var(--w-line);
  display: flex; align-items: center; gap: .5em;
}
.panel-title::before { content: ''; width: .22em; height: 1.05em; border-radius: 2px; background: linear-gradient(180deg, var(--gold), var(--gold-3)); }

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

.prize-item {
  display: flex; align-items: center; gap: clamp(8px, .8vw, 14px);
  padding: clamp(6px, .95vh, 14px) 0;
}
.prize-item + .prize-item { border-top: 1px dashed rgba(255, 212, 121, .14); }
.prize-dot {
  flex: 0 0 auto; width: clamp(6px, .55vw, 10px); height: clamp(30px, 3.4vh, 46px);
  border-radius: 999px; box-shadow: 0 0 14px currentColor;
}
.prize-icon { flex: 0 0 auto; font-size: clamp(19px, 1.75vw, 32px); line-height: 1; }
.prize-text { display: flex; flex-direction: column; min-width: 0; }
.prize-text b { font-size: clamp(13px, 1.1vw, 20px); font-weight: 800; color: var(--w-ink); }
.prize-text em {
  font-style: normal; font-size: clamp(11px, .9vw, 16px); color: var(--w-ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.recent-list { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.recent-list::-webkit-scrollbar { width: 6px; }
.recent-list::-webkit-scrollbar-thumb { background: rgba(255, 212, 121, .26); border-radius: 8px; }
.recent-empty { color: var(--w-ink-3); font-size: clamp(12px, .95vw, 16px); padding: .6em 0; }
.recent-item {
  display: flex; align-items: center; gap: clamp(7px, .7vw, 12px);
  padding: clamp(5px, .8vh, 11px) 0;
  animation: recent-in .35s ease both;
}
.recent-item + .recent-item { border-top: 1px solid rgba(255, 255, 255, .06); }
@keyframes recent-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.recent-icon {
  flex: 0 0 auto; width: clamp(28px, 2.3vw, 42px); height: clamp(28px, 2.3vw, 42px);
  border-radius: 10px; display: grid; place-items: center; font-size: clamp(14px, 1.2vw, 22px);
}
.recent-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.recent-text b { font-size: clamp(12px, .95vw, 17px); color: var(--w-ink); }
.recent-text em { font-style: normal; font-size: clamp(10px, .8vw, 14px); color: var(--w-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item time { flex: 0 0 auto; font-size: clamp(10px, .78vw, 13px); color: var(--w-ink-3); font-variant-numeric: tabular-nums; }

/* ---------- 中奖弹层 ---------- */

.confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

.result-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(152, 12, 28, .80), rgba(52, 1, 11, .94));
  backdrop-filter: blur(6px);
  animation: overlay-in .25s ease both;
}
.result-overlay[hidden] { display: none; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.result-card {
  position: relative;
  width: min(88vw, 660px); max-height: 92dvh; overflow: hidden;
  padding: clamp(26px, 3.4vh, 48px) clamp(24px, 3vw, 56px) clamp(22px, 2.6vh, 38px);
  border-radius: clamp(20px, 1.6vw, 34px);
  text-align: center;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 212, 121, .26), transparent 58%),
    linear-gradient(170deg, #6d0a1c 0%, #3a0410 55%, #22030a 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 212, 121, .32), inset 0 0 60px rgba(255, 160, 60, .10);
  animation: card-pop .5s cubic-bezier(.16, 1.3, .3, 1) both;
}
@keyframes card-pop { from { opacity: 0; transform: scale(.78) translateY(24px); } to { opacity: 1; transform: none; } }

.result-ribbon {
  display: inline-block; padding: .34em 1.5em; border-radius: 999px;
  font-size: clamp(13px, 1.1vw, 20px); font-weight: 800; letter-spacing: .28em;
  color: #4a1206; background: linear-gradient(145deg, #ffe9a8, #f0a92e);
  box-shadow: 0 6px 18px rgba(240, 169, 46, .35);
}
.result-card.is-thanks .result-ribbon { background: linear-gradient(145deg, #cfd6e2, #94a0b4); box-shadow: none; color: #26303f; }

.result-icon {
  font-size: clamp(56px, 8vw, 118px); line-height: 1; margin: clamp(10px, 1.6vh, 22px) 0 clamp(6px, 1vh, 14px);
  filter: drop-shadow(0 10px 24px rgba(255, 170, 60, .45));
  animation: icon-bounce .8s cubic-bezier(.2, 1.5, .4, 1) both .12s;
}
.result-card.is-thanks .result-icon { filter: none; }
@keyframes icon-bounce {
  0% { transform: scale(.3) rotate(-18deg); opacity: 0; }
  60% { transform: scale(1.14) rotate(6deg); opacity: 1; }
  100% { transform: none; }
}

.result-level {
  font-size: clamp(30px, 4.4vw, 76px); font-weight: 900; line-height: 1.1; letter-spacing: .06em;
  background: linear-gradient(180deg, #fff8e6 5%, #ffd479 50%, #de8a19 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 18px rgba(255, 170, 60, .35));
}
.result-card.is-thanks .result-level {
  background: linear-gradient(180deg, #ffffff 5%, #c9d3e2 55%, #8b98ac 100%);
  -webkit-background-clip: text; background-clip: text;
  filter: none;
}

.result-name {
  margin-top: clamp(6px, 1vh, 14px);
  font-size: clamp(18px, 1.9vw, 34px); font-weight: 700; color: var(--w-ink);
  word-break: break-all;
}
.result-tip { margin-top: clamp(8px, 1.2vh, 16px); font-size: clamp(12px, 1vw, 18px); color: var(--w-ink-3); }

.btn-again {
  margin-top: clamp(16px, 2.2vh, 32px);
  padding: clamp(11px, 1.3vh, 18px) clamp(30px, 3.4vw, 62px);
  border: none; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: clamp(16px, 1.5vw, 28px); font-weight: 900; letter-spacing: .12em;
  color: #4a1206; background: linear-gradient(145deg, #fff3cf, #ffd479 40%, #eda32b);
  box-shadow: 0 12px 30px rgba(240, 169, 46, .38), inset 0 -3px 0 rgba(150, 90, 10, .3);
  transition: transform .16s ease, filter .16s ease;
}
.btn-again:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.05); }
.btn-again:active { transform: translateY(1px) scale(.99); }

.result-hint {
  margin-top: clamp(12px, 1.6vh, 22px);
  font-size: clamp(12px, 1vw, 18px); color: var(--w-ink-3); letter-spacing: .04em;
}

/* ---------- 轻提示 ---------- */

.toast {
  position: fixed; left: 50%; bottom: clamp(24px, 5vh, 64px); transform: translateX(-50%);
  z-index: 80; padding: .7em 1.6em; border-radius: 999px;
  font-size: clamp(13px, 1.1vw, 19px); font-weight: 600; color: #4a1206;
  background: linear-gradient(145deg, #fff3cf, #ffd479);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  animation: toast-in .28s ease both;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 窄屏 / 竖屏兼容 ---------- */

@media (max-width: 1000px), (orientation: portrait) and (max-width: 1200px) {
  .stage-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .side-col { flex-direction: row; overflow-x: auto; }
  .panel { flex: 0 0 auto; min-width: 240px; }
  .panel-grow { overflow: visible; }
  .recent-list { max-height: 34vh; }
  .stage-top { justify-content: center; }
}

@media (max-height: 560px) {
  .wheel-head p, .wheel-hint { display: none; }
  .panel-grow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-rays, .wheel-hub, .wheel-box.spinning .wheel-pointer { animation: none; }
}
