/* ====================================================================
 * style.css — 简约高档风（暖白底 + 香槟金 + 克制的红）
 * 设计目标：克制、留白充足、对比清晰、适合投屏；大标题用衬线提升质感。
 * ================================================================== */

:root {
  --bg: #f3f1ec;
  --bg-2: #ece7dc;
  --card: #ffffff;
  --ink: #1d1b18;          /* 近黑暖墨 */
  --ink-soft: #6f6a62;     /* 次级文字 */
  --line: #e6e0d4;         /* 细描边 */
  --gold: #b08642;         /* 香槟金（主点缀） */
  --gold-dark: #8a6730;
  --gold-soft: #f4ecdb;
  --crimson: #b5302a;      /* 克制的红（中奖/喜庆） */
  --crimson-dark: #8f231e;
  --shadow: 0 8px 26px rgba(40, 33, 20, 0.08);
  --shadow-sm: 0 3px 12px rgba(40, 33, 20, 0.06);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif SC",
    Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(120% 120% at 50% 0%, #faf8f3 0%, #efe9dd 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ---------------- 顶部导航 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 30px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--ink);
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

.nav-btn.active {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---------------- 容器与面板 ---------------- */
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.view-title {
  font-size: 26px;
  font-weight: 800;
  margin: 4px 0 22px;
  letter-spacing: 0.5px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 24px;
}

.panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h3::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: var(--gold);
}

.danger-panel {
  border-color: #ecd9d6;
}
.danger-panel h3 {
  color: var(--crimson);
}
.danger-panel h3::before {
  background: var(--crimson);
}

/* ---------------- 表单 ---------------- */
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

textarea {
  resize: vertical;
  min-height: 56px;
}

.award-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}

.award-form label:nth-child(2),
.award-form label:nth-child(3),
.award-form .form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}

.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.btn.primary:hover {
  background: var(--gold-dark);
  color: #fff;
}

.btn.danger {
  background: var(--crimson);
  border-color: var(--crimson);
  color: #fff;
}

.btn.danger:hover {
  filter: brightness(0.95);
  color: #fff;
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  margin: 0 14px 0 0;
}

.radio input {
  width: auto;
  margin: 0;
}

/* ---------------- 上传区 ---------------- */
.upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.upload-row input[type="file"] {
  flex: 1 1 240px;
}

.hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 8px 0 0;
  line-height: 1.6;
}

/* ---------------- 表格 ---------------- */
.atable,
.ptable,
.rtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin-top: 10px;
}

.atable th,
.ptable th,
.rtable th {
  text-align: left;
  padding: 12px 10px;
  background: #faf8f3;
  color: var(--ink-soft);
  font-weight: 700;
  border-bottom: 2px solid var(--line);
}

.atable td,
.ptable td,
.rtable td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ptable input,
.ptable .edit-name,
.ptable .edit-note {
  margin: 0;
  padding: 7px 9px;
  font-size: 14px;
}

.design {
  font-size: 22px;
  text-align: center;
}

.empty-hint {
  color: var(--ink-soft);
  font-size: 15px;
  padding: 14px 4px;
}

/* 状态徽标 */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge.active {
  background: var(--gold-soft);
  color: var(--gold-dark);
}

.badge.won {
  background: #f7ebe9;
  color: var(--crimson-dark);
}

/* ---------------- 抽奖大屏 ---------------- */
.draw-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
}

.draw-select-label {
  flex: 1 1 280px;
  margin: 0;
}

.draw-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.stage {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  min-height: 46vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  overflow: hidden;
}

.draw-display {
  width: 100%;
  text-align: center;
}

.draw-placeholder {
  font-size: 30px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 1px;
}

.roll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.roll-name {
  font-size: 56px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  opacity: 0.85;
}

.winners {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.winners.slow .winner-name {
  color: var(--crimson);
  transform: scale(1.02);
}

.winner-name {
  font-size: 64px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 2px;
  font-family: var(--serif);
}

/* 恭喜横幅 — 克制红金，衬线提升质感 */
.congrats {
  animation: pop 0.4s ease;
  text-align: center;
  padding: 30px 46px;
  border-radius: 26px;
  background: linear-gradient(135deg, #8f231e 0%, #b5302a 50%, #c89b4a 100%);
  box-shadow: 0 20px 48px rgba(143, 35, 30, 0.32), inset 0 0 0 2px rgba(232, 207, 148, 0.55);
  color: #fff;
  max-width: 92%;
}

.congrat-title {
  font-size: 50px;
  font-weight: 800;
  font-family: var(--serif);
  color: #f3e3bf;
  letter-spacing: 1px;
}

.congrat-design {
  font-size: 72px;
  margin: 6px 0;
}

.congrat-award {
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  margin: 6px 0;
}

.congrat-names {
  font-size: 62px;
  font-weight: 900;
  font-family: var(--serif);
  color: #fff;
  margin-top: 10px;
  letter-spacing: 3px;
  text-shadow: 0 4px 16px rgba(80, 10, 10, 0.4);
}

/* 中奖者名字下方的生日祝贺（金，衬线，轻微呼吸） */
.congrat-birthday {
  margin-top: 16px;
  font-size: 40px;
  font-weight: 800;
  font-family: var(--serif);
  line-height: 1.35;
  color: #f3e3bf;
  text-shadow: 0 2px 0 #8a6730, 0 6px 14px rgba(60, 8, 8, 0.45);
  animation: birthdayPulse 1.6s ease-in-out infinite;
}

@keyframes birthdayPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes pop {
  0% { transform: scale(0.82); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 抽奖底部 */
.draw-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 26px;
}

.draw-btn {
  font-size: 22px;
  font-weight: 700;
  padding: 17px 54px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border: none;
  color: #fff;
  box-shadow: 0 12px 26px rgba(138, 103, 48, 0.3);
  cursor: pointer;
  letter-spacing: 2px;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
}

.draw-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(138, 103, 48, 0.38);
}

.draw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.draw-timer {
  font-size: 19px;
  font-weight: 700;
  color: var(--crimson);
  min-width: 160px;
}

.draw-empty {
  margin: 18px 0;
  padding: 18px 22px;
  background: #fbf5f3;
  border: 1px solid #f0ddd7;
  border-radius: 14px;
  color: var(--crimson-dark);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.draw-empty a {
  color: var(--gold-dark);
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------------- 记录筛选 ---------------- */
.record-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.record-filters label {
  margin: 0;
  flex: 1 1 160px;
}

.record-filters .btn {
  flex: 0 0 auto;
}

/* ---------------- 全屏彩带画布 ---------------- */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* ---------------- 中奖庆祝覆盖层（犀牛跑动 + 横幅） ---------------- */
.celebration-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 9990;
}

.rhino {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  filter: drop-shadow(0 10px 12px rgba(40, 33, 20, 0.16));
}

.rhino svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: bottom center;
  animation: rhinoSquash 0.5s ease-in-out infinite;
}

@keyframes rhinoSquash {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50% { transform: scaleY(0.94) scaleX(1.04); }
}

/* 左上角生日横幅 — 深红底 + 金字，克制高级 */
.birthday-banner {
  position: fixed;
  top: 72px;
  left: 18px;
  z-index: 10001;
  pointer-events: none;
  max-width: 80vw;
  padding: 12px 22px;
  font-size: 21px;
  font-weight: 800;
  font-family: var(--serif);
  letter-spacing: 0.5px;
  color: #f3e3bf;
  background: linear-gradient(135deg, #8f231e, #b5302a);
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(143, 35, 30, 0.36), inset 0 0 0 2px rgba(232, 207, 148, 0.6);
  animation: bannerPop 0.45s ease;
}

/* 底部居中小组祝福 */
.group-message {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  pointer-events: none;
  padding: 10px 22px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(40, 33, 20, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.8);
  animation: bannerPopCenter 0.5s ease 0.1s both;
}

@keyframes bannerPop {
  0% { transform: translateY(-10px) scale(0.85); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
/* 底部居中祝福：keyframes 里必须保留 translateX(-50%)，否则弹入动画会覆盖居中 */
@keyframes bannerPopCenter {
  0% { transform: translateX(-50%) translateY(-10px) scale(0.85); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

/* ---------------- 已中奖名单 ==================== */
.won-board {
  margin-top: 22px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.won-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.won-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.won-empty {
  font-size: 15px;
  color: var(--ink-soft);
  font-weight: 600;
}

.won-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold-dark);
  font-size: 15px;
  font-weight: 700;
  border: 1px solid #e7d8b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
  user-select: none;
}

/* 可点击：悬停提示“可退回奖池”，名字加删除线、✕ 变红 */
.won-tag:hover {
  background: #f7ebe9;
  border-color: #e6c3bd;
  color: var(--crimson-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(181, 48, 42, 0.15);
}

.won-tag:hover .won-award,
.won-tag:hover .won-del {
  color: var(--crimson-dark);
}

.won-tag:active {
  transform: translateY(0);
}

.won-del {
  margin-left: 4px;
  font-size: 12px;
  opacity: 0.45;
  line-height: 1;
}

.won-tag:hover .won-del {
  opacity: 1;
}

.won-symbol {
  font-size: 17px;
  line-height: 1;
}

.won-award {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
}

/* ---------------- 横向滚动带（左右跑马灯） ==================== */
.roll-stage-h {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 18px;
}

/* 高级“滚轮”质感：白底细描边，内阴影营造凹陷感 */
.roll-window-h {
  position: relative;
  width: 660px;
  max-width: 100%;
  height: 200px;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #faf8f3);
  border: 1px solid var(--line);
  box-shadow: inset 0 2px 10px rgba(40, 33, 20, 0.06), var(--shadow);
}

/* 左右渐隐遮罩 */
.roll-window-h::before,
.roll-window-h::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  pointer-events: none;
  z-index: 4;
}
.roll-window-h::before {
  left: 0;
  background: linear-gradient(to right, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
}
.roll-window-h::after {
  right: 0;
  background: linear-gradient(to left, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
}

.roll-strip-h {
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 100%;
  will-change: transform;
}

.roll-item-h {
  flex: 0 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--serif);
  color: var(--ink);
  letter-spacing: 3px;
  white-space: nowrap;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.roll-item-h.is-winner {
  color: var(--crimson);
  opacity: 1;
  transform: scale(1.08);
  text-shadow: 0 6px 18px rgba(181, 48, 42, 0.22);
}

/* 中奖框：双金线 + 小金三角，克制点出“中奖位” */
.roll-highlight-h {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 220px;
  transform: translateX(-50%);
  pointer-events: none;
  border-left: 2px solid var(--gold);
  border-right: 2px solid var(--gold);
  background: rgba(176, 134, 66, 0.06);
  box-shadow: inset 0 0 0 1px rgba(176, 134, 66, 0.18);
  z-index: 5;
}

.roll-highlight-h::before,
.roll-highlight-h::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
}
.roll-highlight-h::before {
  top: 10px;
  border-bottom: 13px solid var(--gold);
}
.roll-highlight-h::after {
  bottom: 10px;
  border-top: 13px solid var(--gold);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 720px) {
  .award-form {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .nav {
    justify-content: center;
  }
  .roll-name {
    font-size: 40px;
  }
  .winner-name,
  .congrat-names {
    font-size: 44px;
  }
  .congrat-title {
    font-size: 36px;
  }
  .draw-btn {
    font-size: 20px;
    padding: 14px 40px;
  }
}
