/* ============ 基础 ============ */
:root {
  --bg-0: #070a17;
  --bg-1: #0b1022;
  --gold: #ffd700;
  --gold-soft: #ffe9a8;
  --gold-deep: #e8a33d;
  --text: #f2f4ff;
  --text-dim: rgba(242, 244, 255, 0.58);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.11);
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

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

html { scrollbar-color: rgba(255, 215, 0, 0.35) rgba(255, 255, 255, 0.04); }

body {
  min-height: 100vh;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--text);
  background: var(--bg-0);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

::selection { background: rgba(255, 215, 0, 0.35); color: #fff; }

/* ============ 背景层 ============ */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(106, 17, 203, 0.28), transparent 60%),
    radial-gradient(1000px 700px at 0% 110%, rgba(37, 117, 252, 0.24), transparent 60%),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-0) 55%, #0d0a1c 100%);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 20%, transparent 75%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.blob-a { width: 560px; height: 560px; top: -180px; left: -120px; background: #7b2ff7; animation: drift-a 22s ease-in-out infinite alternate; }
.blob-b { width: 480px; height: 480px; top: 22%; right: -160px; background: #2f6df7; animation: drift-b 26s ease-in-out infinite alternate; }
.blob-c { width: 420px; height: 420px; bottom: -140px; left: 32%; background: #c98a1b; opacity: 0.28; animation: drift-c 30s ease-in-out infinite alternate; }

@keyframes drift-a { to { transform: translate(90px, 70px) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-100px, -60px) scale(0.9); } }
@keyframes drift-c { to { transform: translate(60px, -90px) scale(1.2); } }

/* 特效画布 */
#fx { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

/* ============ 顶栏 ============ */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 22px 28px 8px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-badge {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #3a2505;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 8px 26px rgba(255, 200, 60, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #fff6d8, var(--gold) 45%, #ffb64d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text p {
  font-size: 10px;
  letter-spacing: 5px;
  color: var(--text-dim);
  margin-top: 3px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ============ 按钮 ============ */
.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}
.icon-btn:hover { background: var(--glass-strong); transform: translateY(-2px); }
.icon-btn.small { width: 32px; height: 32px; font-size: 13px; }

.ghost-btn {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}
.ghost-btn:hover { color: var(--text); border-color: rgba(255, 215, 0, 0.45); }

.mini-btn {
  padding: 7px 13px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s ease;
}
.mini-btn:hover { background: var(--glass-strong); border-color: rgba(255, 215, 0, 0.45); }
.mini-btn.danger:hover { border-color: rgba(255, 107, 107, 0.7); color: #ff8f8f; }
.mini-btn.block { width: 100%; padding: 10px; margin-top: 12px; border-style: dashed; }
.mini-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.roll-btn {
  min-width: 220px;
  padding: 17px 42px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 8px;
  text-indent: 8px;
  color: #3a2505;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff0b8, var(--gold) 42%, #f0a93a);
  box-shadow: 0 12px 36px rgba(255, 200, 60, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.roll-btn:hover { transform: translateY(-3px); box-shadow: 0 18px 46px rgba(255, 200, 60, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.7); }
.roll-btn:active { transform: translateY(0) scale(0.98); }
.roll-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.roll-btn.small-btn { min-width: 0; padding: 10px 30px; font-size: 15px; letter-spacing: 4px; text-indent: 4px; }

.roll-btn.rolling { animation: pulse-glow 1.1s ease-in-out infinite; }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 12px 36px rgba(255, 200, 60, 0.35); }
  50% { box-shadow: 0 12px 52px rgba(255, 200, 60, 0.75); }
}

/* ============ 布局 ============ */
.layout {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 320px;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px 28px 60px;
  align-items: start;
}

.panel {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 4px;
}

.card {
  background: linear-gradient(165deg, var(--glass-strong), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold-soft);
}
.head-actions { display: flex; gap: 8px; }

.chip {
  padding: 4px 11px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.chip-gold { color: var(--gold); border-color: rgba(255, 215, 0, 0.35); background: rgba(255, 215, 0, 0.08); }

/* ============ 奖项卡片 ============ */
.prize-list { display: flex; flex-wrap: wrap; gap: 10px; }

.prize-card {
  --pc: #ffd700;
  position: relative;
  flex: 1 1 130px;
  min-width: 128px;
  padding: 13px 12px 11px;
  text-align: center;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  overflow: hidden;
}
.prize-card:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-2px); }
.prize-card.active {
  border-color: var(--pc);
  background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 16%, transparent), rgba(255, 255, 255, 0.04));
  box-shadow: 0 0 30px -8px var(--pc), inset 0 0 22px -16px var(--pc);
}
.prize-card.done { opacity: 0.42; cursor: default; }
.prize-card.done:hover { transform: none; }

.prize-icon { font-size: 24px; line-height: 1; }
.prize-name { display: block; margin-top: 7px; font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.prize-count { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-dim); }
.prize-remain {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #201304;
  background: linear-gradient(135deg, #ffe9a8, var(--gold));
  border-radius: 999px;
  padding: 0 5px;
}
.prize-done-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #9be8c7;
  background: rgba(36, 173, 113, 0.18);
  border: 1px solid rgba(84, 227, 162, 0.4);
}

/* ============ 人员 ============ */
.people-tools { display: flex; flex-direction: column; gap: 10px; }
.quick-add { display: flex; gap: 8px; }
.quick-add input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease;
}
.quick-add input:focus { border-color: rgba(255, 215, 0, 0.55); }

.people-tools textarea {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease;
}
.people-tools textarea:focus { border-color: rgba(255, 215, 0, 0.55); }
.people-tools textarea::placeholder, .quick-add input::placeholder { color: rgba(242, 244, 255, 0.32); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  max-height: 230px;
  overflow-y: auto;
  padding: 2px 2px 6px;
}
.people-list:empty::after {
  content: "暂无参与人员";
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 14px 0;
}

.name-chip {
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  transition: all 0.2s ease;
}
.name-chip:hover { border-color: rgba(255, 215, 0, 0.4); }
.name-chip.won {
  color: rgba(255, 215, 0, 0.8);
  border-color: rgba(255, 215, 0, 0.3);
  background: rgba(255, 215, 0, 0.06);
  text-decoration: line-through;
  opacity: 0.55;
}

/* ============ 舞台 ============ */
.stage-wrap { min-width: 0; }

.stage-glass {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  min-height: min(66vh, 620px);
  padding: 40px 30px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 55%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.stage-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 42% at 50% 0%, rgba(255, 215, 0, 0.12), transparent 70%);
  pointer-events: none;
}

.halo {
  position: absolute;
  width: 520px;
  height: 520px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 12%, rgba(255, 215, 0, 0.16) 18%, transparent 28% 55%, rgba(255, 215, 0, 0.1) 62%, transparent 70%);
  filter: blur(14px);
  animation: halo-spin 26s linear infinite;
  pointer-events: none;
}
@keyframes halo-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.stage-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.stage-prize-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 5px;
  padding: 8px 22px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: var(--gold-soft);
  box-shadow: 0 0 24px -8px rgba(255, 215, 0, 0.7);
}
.stage-remain { font-size: 13px; color: var(--text-dim); letter-spacing: 1px; }

.name-display {
  position: relative;
  z-index: 1;
  max-width: 92%;
  min-height: 1.5em;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: clamp(3.2rem, 8.5vw, 7.2rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  color: rgba(242, 244, 255, 0.92);
  text-shadow: 0 6px 40px rgba(0, 0, 0, 0.55);
  word-break: break-all;
  line-height: 1.25;
  transition: color 0.3s ease;
  user-select: none;
}
.name-display.idle { color: rgba(242, 244, 255, 0.34); font-size: clamp(1.6rem, 3.5vw, 2.6rem); letter-spacing: 0.2em; }
.name-display.rolling { animation: name-jitter 0.16s linear infinite; }
@keyframes name-jitter {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.008); }
  100% { transform: translateY(0) scale(1); }
}
.name-display.is-winner {
  background: linear-gradient(180deg, #fff8dc 8%, var(--gold) 48%, #f0a93a 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.6));
  animation: winner-pop 0.7s cubic-bezier(0.2, 1.6, 0.35, 1);
}
@keyframes winner-pop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.win-banner {
  position: relative;
  z-index: 1;
  margin-top: -12px;
  font-size: 15px;
  letter-spacing: 8px;
  color: var(--gold-soft);
  text-shadow: 0 0 18px rgba(255, 215, 0, 0.7);
  animation: banner-in 0.8s ease;
}
@keyframes banner-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

.stage-actions { position: relative; z-index: 1; margin-top: 6px; }

.stage-stats {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.stage-stats b { color: var(--gold); font-size: 15px; margin-left: 2px; }
.stage-stats i { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }

.stage-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: rgba(242, 244, 255, 0.34);
  letter-spacing: 1px;
}

/* ============ 中奖名单 ============ */
.card-winners { display: flex; flex-direction: column; }

.winners-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 560px;
  overflow-y: auto;
  padding: 2px 2px 8px;
}
.winners-list:empty::after {
  content: "还没有中奖者，抽起来吧 ✨";
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: center;
  padding: 30px 0;
}

.winner-group { display: flex; flex-direction: column; gap: 8px; }
.winner-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
}
.winner-group-title .wg-count { font-size: 11px; font-weight: 400; color: var(--text-dim); }
.winner-group-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.winner-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.winner-chips .name-chip { animation: chip-in 0.4s ease both; }
@keyframes chip-in { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }

/* ============ 弹窗 / Toast ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 6, 16, 0.68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-in 0.25s ease;
}
.modal-card {
  width: min(640px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  background: linear-gradient(170deg, rgba(23, 28, 54, 0.96), rgba(13, 15, 32, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  animation: modal-in 0.3s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 17px; letter-spacing: 3px; color: var(--gold-soft); }

.prize-editor { display: flex; flex-direction: column; gap: 10px; }
.prize-edit-row {
  display: grid;
  grid-template-columns: 46px 1fr 76px 58px 34px;
  gap: 8px;
  align-items: center;
}
.prize-edit-row input[type="text"] {
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
}
.prize-edit-row input[type="text"]:focus { border-color: rgba(255, 215, 0, 0.5); }
.prize-edit-row input[type="number"] {
  width: 100%;
  padding: 9px 8px;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  text-align: center;
}
.prize-edit-row input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.prize-edit-row .del-prize {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--text-dim);
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.25);
  border-radius: 9px;
  transition: all 0.2s ease;
}
.prize-edit-row .del-prize:hover { color: #ff8f8f; background: rgba(255, 107, 107, 0.16); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 200;
  transform: translate(-50%, -80px);
  padding: 11px 24px;
  font-size: 13.5px;
  letter-spacing: 1px;
  color: var(--text);
  background: rgba(18, 22, 44, 0.92);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 999px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  transition: transform 0.4s cubic-bezier(0.2, 1.3, 0.4, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ============ 页脚 ============ */
.footer {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 8px 0 26px;
  font-size: 12px;
  letter-spacing: 4px;
  color: rgba(255, 215, 0, 0.4);
}

/* ============ 滚动条 ============ */
.panel::-webkit-scrollbar, .people-list::-webkit-scrollbar, .winners-list::-webkit-scrollbar,
.modal-card::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb, .people-list::-webkit-scrollbar-thumb,
.winners-list::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.25);
  border-radius: 999px;
}

/* ============ 响应式 ============ */
@media (max-width: 1220px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; overflow: visible; }
  .stage-glass { min-height: 52vh; }
  .winners-list { max-height: 300px; }
}

@media (max-width: 640px) {
  .topbar { padding: 16px 16px 6px; }
  .brand-badge { width: 40px; height: 40px; font-size: 18px; }
  .brand-text h1 { font-size: 17px; letter-spacing: 1px; }
  .layout { padding: 14px 14px 50px; gap: 14px; }
  .stage-glass { min-height: 46vh; padding: 28px 16px; gap: 20px; }
  .stage-stats { flex-wrap: wrap; justify-content: center; gap: 10px; }
  .roll-btn { min-width: 0; width: 88%; }
  .prize-edit-row { grid-template-columns: 40px 1fr 64px 50px 32px; }
}
