:root {
  --gold: #ffd76a;
  --gold-deep: #f5b942;
  --red: #c0202e;
  --red-deep: #7a0d18;
  --ink: #2b0709;
  --panel: rgba(60, 6, 12, 0.55);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,210,120,.25), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(255,120,90,.22), transparent 45%),
    linear-gradient(160deg, #5a0a12 0%, #2b0709 55%, #4a0810 100%);
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.theme-redgold { /* 红金主题 */ }

/* 弹幕层 */
.danmaku-layer {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 50;
}

/* 顶部栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; gap: 16px;
  background: linear-gradient(90deg, rgba(122,13,24,.85), rgba(192,32,46,.7));
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 34px; filter: drop-shadow(0 0 6px var(--gold)); }
.brand h1 {
  font-size: 30px; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff3c4, var(--gold) 60%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 10px rgba(255,200,90,.3);
}
.round-info { text-align: center; flex: 1; }
.round-title { font-size: 24px; font-weight: 700; color: #fff; text-shadow: 0 0 12px rgba(255,210,120,.6); }
.badge {
  margin-left: 10px; font-size: 14px; padding: 3px 12px; border-radius: 999px;
  background: var(--gold); color: var(--red-deep); font-weight: 700;
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.dm-status { font-size: 14px; padding: 4px 10px; border-radius: 8px; }
.dm-status.on { background: rgba(80,220,120,.2); color: #8fffb0; border: 1px solid #4caf70; }
.dm-status.off { background: rgba(255,255,255,.12); color: #ccc; }

/* 按钮 */
button { font-family: inherit; cursor: pointer; border: none; border-radius: 10px; transition: transform .1s, filter .15s; }
button:active { transform: scale(.96); }
.btn-gold {
  background: linear-gradient(180deg, #ffe9a8, var(--gold-deep));
  color: var(--red-deep); font-weight: 800; font-size: 20px;
  padding: 12px 30px; box-shadow: 0 4px 18px rgba(255,190,80,.5);
}
.btn-red {
  background: linear-gradient(180deg, #ff5a5a, var(--red));
  color: #fff; font-weight: 800; font-size: 20px;
  padding: 12px 30px; box-shadow: 0 4px 18px rgba(220,40,40,.5);
}
.btn-ghost {
  background: rgba(255,255,255,.12); color: #fff; font-size: 15px;
  padding: 10px 18px; border: 1px solid rgba(255,215,120,.5);
}
button:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.4); }

/* 主舞台 */
.stage {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.viz { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.hint {
  position: absolute; bottom: 18%; font-size: 18px; color: rgba(255,230,180,.8);
  text-align: center; max-width: 80%;
}

/* 3D 抽奖：时空旋转 —— 黑金速度线隧道 + 透视照片墙 + 中央翻滚立方体 */
.cube-scene {
  position: absolute; inset: 0; overflow: hidden;
  perspective: 850px;
  background: #050505;
}
/* 中央金色柔光 + 立方体辉光 */
.cube-scene::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 560px; height: 560px;
  margin: -280px 0 0 -280px; z-index: 10; pointer-events: none;
  background: radial-gradient(circle, rgba(255,190,70,.35), rgba(255,180,60,.12) 45%, transparent 70%);
}
/* 金色速度线画布（叠在照片墙上方、立方体下方，对齐演示层次） */
.speed-cv { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.photo-wall { position: absolute; inset: 0; z-index: 1; }
.wall-cell {
  position: absolute; left: 0; top: 0; border-radius: 4px; overflow: hidden;
  background: #16161c; border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 2px 10px rgba(0,0,0,.55);
  transition: opacity .5s;
  will-change: transform, opacity;
}
.wall-cell .cell-ava { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .92; }
.wall-cell .cell-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 2px;
  background: rgba(0,0,0,.55); color: rgba(255,233,176,.85); font-size: 10px; font-weight: 600;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cube-scene.dim-wall .wall-cell { opacity: .1; }

.spin-cube {
  position: absolute; left: 50%; top: 50%; width: 300px; height: 300px;
  margin: -150px 0 0 -150px; transform-style: preserve-3d; z-index: 20;
  /* 注意：此处不能加 filter，filter 会拍平 preserve-3d 导致立方体变平面 */
}
.cube-face {
  position: absolute; inset: 0; border-radius: 10px; overflow: hidden;
  border: 4px solid rgba(255,240,200,.95); background: #141419;
  box-shadow: inset 0 0 36px rgba(255,200,90,.35), 0 0 26px rgba(255,210,110,.5);
}
.cube-face .face-ava { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .95; }
.cube-face.f0 { transform: rotateY(0deg) translateZ(150px); }
.cube-face.f1 { transform: rotateY(90deg) translateZ(150px); }
.cube-face.f2 { transform: rotateY(180deg) translateZ(150px); }
.cube-face.f3 { transform: rotateY(270deg) translateZ(150px); }
.cube-face.f4 { transform: rotateX(90deg) translateZ(150px); }
.cube-face.f5 { transform: rotateX(-90deg) translateZ(150px); }
.spin-cube.burst { animation: cubeBurst .9s ease-out forwards; }
@keyframes cubeBurst {
  0% { opacity: 1; }
  40% { transform: scale(1.5); opacity: 1; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* 开奖：中央中奖者大照片卡 */
.win-cards {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  display: flex; gap: 26px; z-index: 40; align-items: center; justify-content: center;
}
.win-card {
  position: relative; border-radius: 14px; overflow: hidden;
  border: 5px solid #ffd76a; background: #141419 center/cover;
  box-shadow: 0 0 60px rgba(255,210,110,.85), 0 0 150px rgba(255,180,60,.4);
  animation: cardPop .6s cubic-bezier(.2,1.5,.4,1) both;
}
.win-card .wc-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.88)); color: #ffe9b0;
  font-size: 24px; font-weight: 800; text-align: center;
}
.win-card.wc-letter { display: flex; align-items: center; justify-content: center; }
.win-card.wc-letter .wc-init {
  font-size: 88px; font-weight: 900; color: #ffd76a;
  text-shadow: 0 0 30px rgba(255,190,70,.8);
}
@keyframes cardPop { from { transform: scale(.15); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 大转盘 */
.wheel-wrap { position: relative; width: 560px; height: 560px; }
.wheel-canvas { border-radius: 50%; box-shadow: 0 0 40px rgba(255,200,90,.5); border: 8px solid var(--gold); }
.wheel-pointer {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 22px solid transparent; border-right: 22px solid transparent;
  border-top: 40px solid var(--red); filter: drop-shadow(0 0 6px #000); z-index: 5;
}

/* 砸金蛋 */
.egg-stage { display: flex; gap: 30px; flex-wrap: wrap; justify-content: center; align-items: flex-end; max-width: 92%; padding-bottom: 30px; }
.egg {
  width: 130px; height: 180px; position: relative;
  display: flex; align-items: flex-end; justify-content: center;
}
/* 未破的完整蛋壳 */
.egg-shell {
  width: 120px; height: 150px; border-radius: 50% 50% 48% 48% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 35% 30%, #fff6cf, var(--gold) 45%, var(--gold-deep) 80%);
  box-shadow: inset -10px -12px 22px rgba(150,90,0,.5), 0 0 26px rgba(255,210,90,.6);
  position: absolute; bottom: 0; left: 5px; z-index: 2;
}
.egg.shake .egg-shell { animation: eggShake .35s infinite; }
@keyframes eggShake { 0%,100%{transform:rotate(-6deg) translateY(0)} 50%{transform:rotate(6deg) translateY(-4px)} }
/* 蛋的两半（裂开后显示） */
.egg-top, .egg-bottom {
  position: absolute; left: 5px; width: 120px; height: 78px; opacity: 0; z-index: 3;
  background: radial-gradient(circle at 35% 30%, #fff6cf, var(--gold) 45%, var(--gold-deep) 82%);
  box-shadow: inset -8px -8px 14px rgba(150,90,0,.45);
}
.egg-top { bottom: 72px; border-radius: 50% 50% 0 0 / 100% 100% 0 0; transform-origin: 50% 100%; }
.egg-bottom { bottom: 0; border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.egg .shine { position: absolute; top: 14px; left: 24px; width: 22px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.8); filter: blur(2px); z-index: 1; }
/* 裂开：上壳飞起旋转、下壳轻微抖动后归位 */
.egg.cracked .egg-shell { opacity: 0; }
.egg.cracked .egg-top { opacity: 1; animation: eggTopFly .9s ease-out forwards; }
.egg.cracked .egg-bottom { opacity: 1; animation: eggBottomShake .4s ease-out; }
@keyframes eggTopFly {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(-150px) rotate(-55deg); opacity: 0; }
}
@keyframes eggBottomShake {
  0%{transform:scale(1)} 30%{transform:scale(1.08,0.92)} 100%{transform:scale(1)}
}
/* 金光迸发 */
.egg .burst {
  position: absolute; left: 50%; top: 58%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%; opacity: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(circle, #fff 0%, #ffe27a 35%, rgba(255,200,60,.6) 60%, transparent 75%);
}
.egg.cracked .burst { animation: eggBurst .8s ease-out forwards; }
@keyframes eggBurst {
  0%   { transform: scale(.2); opacity: 0; }
  25%  { transform: scale(2.4); opacity: 1; }
  100% { transform: scale(4.2); opacity: 0; }
}
/* 锤子 */
.egg .hammer {
  position: absolute; left: 50%; top: -26px; font-size: 72px; z-index: 6;
  transform: translateX(-50%) rotate(-80deg) translateY(-50px); transform-origin: 50% 90%;
  opacity: 0; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45));
}
.egg.hammer-show .hammer { animation: hammerHit .76s ease-in-out; }
@keyframes hammerHit {
  0%   { opacity: 0; transform: translateX(-50%) rotate(-80deg) translateY(-40px); }
  18%  { opacity: 1; }
  45%  { transform: translateX(-50%) rotate(8deg) translateY(0); }   /* 砸中瞬间 */
  60%  { transform: translateX(-50%) rotate(-60deg) translateY(-26px); } /* 弹起 */
  100% { opacity: 0; transform: translateX(-50%) rotate(-80deg) translateY(-40px); }
}
/* 中奖者标签 */
.egg .label {
  position: absolute; bottom: -36px; left: -10px; right: -10px; text-align: center;
  font-size: 15px; color: #fff; font-weight: 700; text-shadow: 0 0 10px #000, 0 0 4px #c0202e; min-height: 22px;
  opacity: 0; transition: opacity .4s .3s;
}
.egg.cracked .label { opacity: 1; }

/* 中奖公示 */
.winner-modal, .qr-modal {
  position: fixed; inset: 0; background: rgba(20,2,4,.78); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.winner-modal.hidden, .qr-modal.hidden { display: none; }
.winner-card, .qr-box {
  position: relative;
  background: linear-gradient(160deg, #fff7e0, #ffe2a8);
  color: var(--red-deep); border-radius: 18px; padding: 30px 40px; text-align: center;
  border: 3px solid var(--red); box-shadow: 0 0 60px rgba(255,210,90,.6); max-width: 80%;
}
.winner-head { font-size: 30px; font-weight: 900; margin-bottom: 18px; color: var(--red); }
/* 右上角关闭按钮 */
.winner-x {
  position: absolute; top: 10px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--red); background: #fff; color: var(--red);
  font-size: 18px; font-weight: 900; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
}
.winner-x:hover { background: var(--red); color: #fff; transform: scale(1.1); }
.winner-list { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 20px; max-height: 50vh; overflow: auto; }
.winner-list .w {
  background: #fff; border: 2px solid var(--gold-deep); border-radius: 12px;
  padding: 10px 18px; font-size: 20px; font-weight: 800; min-width: 120px;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.winner-list .w small { display: block; font-size: 13px; color: #888; font-weight: 600; }

.qr-box img { width: 260px; height: 260px; background: #fff; border-radius: 12px; padding: 8px; }
.qr-title { font-size: 24px; font-weight: 900; color: var(--red); margin-bottom: 12px; }
.qr-tip { font-size: 14px; color: #666; margin: 12px 0; }

/* 底部控制 */
.controlbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 28px;
  background: linear-gradient(90deg, rgba(122,13,24,.9), rgba(192,32,46,.75));
  border-top: 2px solid var(--gold); z-index: 20;
}
.round-select {
  font-size: 16px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--gold);
  background: #fff; color: var(--red-deep); font-weight: 700; min-width: 220px;
}
.people-count { margin-left: auto; font-size: 16px; color: rgba(255,235,190,.9); }

@media (max-width: 900px) {
  .sphere-scene { width: 360px; height: 360px; }
  .wheel-wrap { width: 340px; height: 340px; }
  .brand h1 { font-size: 20px; }
}
