/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 高端配色方案 */
  --color-primary: #1e40af;        /* 宝石蓝 */
  --color-primary-dark: #1e3a8a;   /* 深蓝 */
  --color-primary-light: #3b82f6;  /* 亮蓝 */
  --color-accent: #f59e0b;          /* 香槟金 */
  --color-accent-light: #fbbf24;    /* 浅金 */
  --color-accent-glow: #fcd34d;     /* 金色光晕 */
  --color-success: #10b981;         /* 翡翠绿 */
  --color-danger: #ef4444;          /* 优雅红 */

  /* 玻璃态效果 */
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-bg-strong: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);

  /* 深色玻璃态 */
  --glass-dark: rgba(30, 41, 59, 0.7);
  --glass-dark-border: rgba(148, 163, 184, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  /* 背景图片 - 使用相对路径 */
  background: url('../bg.png') no-repeat center center fixed;
  background-size: cover;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== Toast 提示 ==================== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff;
  color: #333;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  z-index: 10000;
  font-size: 16px;
  font-weight: bold;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  border-left: 4px solid #28a745;
}

.toast.error {
  border-left: 4px solid #dc3545;
}

/* ==================== 参与页面样式 ==================== */
.join-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.join-card {
  background: var(--glass-dark);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 24px;
  padding: 40px 30px;
  box-shadow: var(--glass-shadow),
              0 0 60px rgba(251, 191, 36, 0.15);
  max-width: 400px;
  width: 100%;
  border: 1px solid var(--glass-dark-border);
}

.join-card h1 {
  text-align: center;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 30px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 1px;
  filter: drop-shadow(0 2px 8px rgba(251, 191, 36, 0.3));
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 16px;
  color: white;
  transition: all 0.3s ease;
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1),
              0 0 20px rgba(251, 191, 36, 0.2);
}

.submit-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  color: #1e293b;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3),
              0 0 40px rgba(251, 191, 36, 0.1);
  position: relative;
  overflow: hidden;
}

.submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.submit-btn:hover::before {
  left: 100%;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(251, 191, 36, 0.4),
              0 0 60px rgba(251, 191, 36, 0.2);
}

.submit-btn:active {
  transform: translateY(0);
}

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

.success-message {
  text-align: center;
}

.success-icon {
  font-size: 60px;
  margin-bottom: 20px;
}

.success-message h2 {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  font-weight: 700;
}

.phone-display {
  background: rgba(251, 191, 36, 0.1);
  backdrop-filter: blur(10px);
  padding: 15px;
  border-radius: 12px;
  font-size: 24px;
  color: var(--color-accent-glow);
  font-weight: 700;
  margin: 20px 0;
  border: 1px solid var(--color-accent);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.2);
  letter-spacing: 2px;
}

.success-message p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
}

.error-message {
  color: #f44336;
  font-size: 14px;
  margin-top: 10px;
  text-align: center;
}

/* ==================== 大屏页面样式 ==================== */
.screen-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  height: 100vh;
  /* 确保全屏高度 */
  overflow: hidden;
  /* 防止内容溢出 */
  color: white;
  text-align: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
  /* 背景透明，使用body的背景图片 */
  background: transparent;
}

#waitingSection, #rollingSection {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.screen-title {
  font-size: 56px;
  font-weight: 700;
  margin-bottom: 25px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 20px rgba(251, 191, 36, 0.4));
  letter-spacing: 3px;
}

.qr-section {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding: 35px;
  border-radius: 24px;
  margin-bottom: 30px;
  box-shadow: var(--glass-shadow),
              0 0 50px rgba(251, 191, 36, 0.2);
  border: 1px solid var(--glass-border);
}

#qrcode {
  margin-bottom: 20px;
  width: 185px;
  height: 185px;
}

#qrcode img {
  width: 185px !important;
  height: 185px !important;
  display: block;
}

#qrcode2 {
  width: 185px;
  height: 185px;
}

#qrcode2 img {
  width: 185px !important;
  height: 185px !important;
  display: block;
}

.qr-url {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 18px;
  margin-top: 15px;
  font-weight: 600;
  letter-spacing: 1px;
}

.participant-count {
  font-size: 24px;
  margin-top: 20px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 10px rgba(251, 191, 36, 0.3);
  letter-spacing: 1px;
}

/* 滚动区域布局 */
.rolling-layout {
  display: flex;
  align-items: flex-start;
  /* 顶部对齐 */
  justify-content: center;
  /* 居中对齐 */
  gap: 60px;
  /* 减小间距 */
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* 滚动阶段的二维码区域 */
.qr-section-rolling {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding: 30px;
  border-radius: 24px;
  box-shadow: var(--glass-shadow),
              0 0 50px rgba(251, 191, 36, 0.2);
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
  text-align: center;
}

/* 滚动号码区域 */
.rolling-area {
  flex-shrink: 0;
  /* 不压缩，保持内容宽度 */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  /* 标题和号码之间的间距 */
  min-width: 500px;
  /* 保证即使没有号码也有固定宽度 */
}

.rolling-title {
  font-size: 32px;
  animation: pulse 2s infinite;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.4));
  white-space: nowrap;
  margin: 0;
  font-weight: 600;
  letter-spacing: 2px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.rolling-numbers {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.rolling-number {
  font-size: 28px;
  font-weight: 600;
  font-family: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
  background: var(--glass-dark);
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  padding: 16px 40px;
  border-radius: 16px;
  min-width: 350px;
  text-align: center;
  letter-spacing: 3px;
  border: 1px solid var(--glass-dark-border);
  box-shadow: var(--glass-shadow),
              0 0 40px rgba(251, 191, 36, 0.15);
  color: var(--color-accent-glow);
  transition: all 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 倒计时样式 */
.countdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.1s ease-in-out;
}

.countdown-overlay.show {
  opacity: 1;
  visibility: visible;
}

.countdown-number {
  font-size: 200px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: countdownPop 1s;
  filter: drop-shadow(0 0 60px rgba(251, 191, 36, 0.6))
          drop-shadow(0 0 100px rgba(251, 191, 36, 0.4));
}

@keyframes countdownPop {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 中奖结果样式 */
.result-area {
  position: relative;
  z-index: 10;
}

.result-title {
  font-size: 60px;
  margin-bottom: 60px;
  animation: fadeInDown 1s;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 40px rgba(251, 191, 36, 0.5));
  font-weight: 700;
  letter-spacing: 4px;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.winner-item {
  font-size: 40px;
  font-weight: 600;
  font-family: 'SF Mono', 'Monaco', 'Consolas', 'Courier New', monospace;
  background: var(--glass-dark);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding: 24px 60px;
  border-radius: 20px;
  width: 550px;
  text-align: center;
  letter-spacing: 4px;
  animation: fadeInUp 0.8s;
  animation-fill-mode: both;
  border: 1px solid var(--glass-dark-border);
  box-shadow: var(--glass-shadow),
              0 0 50px rgba(251, 191, 36, 0.2);
  color: var(--color-accent-glow);
}

.winner-item:nth-child(1) { animation-delay: 0.2s; }
.winner-item:nth-child(2) { animation-delay: 0.4s; }
.winner-item:nth-child(3) { animation-delay: 0.6s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 烟花和红包雨画布 */
#fireworks-canvas,
#hongbao-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* 弹幕容器 */
.danmaku-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 20px;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  background: var(--glass-dark);
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  border-radius: 24px;
  border: 1px solid var(--glass-dark-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: danmaku-move 8s linear;
  animation-fill-mode: forwards;
}

@keyframes danmaku-move {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-100%);
  }
}

/* ==================== 管理后台样式 ==================== */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.admin-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  margin-bottom: 30px;
}

.admin-card h1 {
  color: #333;
  margin-bottom: 30px;
  font-size: 32px;
}

.admin-card h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 24px;
  border-bottom: 2px solid #ff0844;
  padding-bottom: 10px;
}

.login-form {
  max-width: 400px;
  margin: 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-item {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(252, 211, 77, 0.2) 100%);
  backdrop-filter: blur(10px);
  color: white;
  padding: 20px;
  border-radius: 16px;
  text-align: center;
  border: 1px solid rgba(251, 191, 36, 0.3);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.15);
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 36px;
  font-weight: bold;
}

.draw-button {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  color: #1e293b;
  border: none;
  border-radius: 16px;
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 20px 0;
  box-shadow: 0 6px 30px rgba(251, 191, 36, 0.4),
              0 0 60px rgba(251, 191, 36, 0.2);
}

.draw-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 40px rgba(251, 191, 36, 0.5),
              0 0 80px rgba(251, 191, 36, 0.3);
}

.draw-button:active {
  transform: translateY(0);
}

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

.status-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: bold;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-drawn {
  background: #d4edda;
  color: #155724;
}

.winners-table {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
}

.winner-row {
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  margin-bottom: 10px;
  border-radius: 12px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-left: 3px solid var(--color-accent);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.winner-rank {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-accent-glow);
  min-width: 60px;
}

.reset-button {
  background: #dc3545;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

.reset-button:hover {
  background: #c82333;
}

.participants-list {
  max-height: 400px;
  overflow-y: auto;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 10px;
}

.participant-row {
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  margin-bottom: 8px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
}

.participant-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(251, 191, 36, 0.2);
}

.participant-phone {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.participant-time {
  color: rgba(255, 255, 255, 0.5);
}

/* 切换开关样式 */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #28a745;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

/* 响应式 */
@media (max-width: 768px) {
  .screen-title {
    font-size: 36px;
  }

  .rolling-number {
    font-size: 32px;
    padding: 15px 40px;
    min-width: 300px;
  }

  .result-title {
    font-size: 48px;
  }

  .winner-item {
    font-size: 36px;
    padding: 20px 40px;
    min-width: 300px;
  }

  .countdown-number {
    font-size: 200px;
  }
}
