/* ========================================
   投票主页面样式
   ======================================== */

:root {
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --primary-light: #A29BFE;
  --bg: #F8F7FF;
  --card-bg: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --text-lighter: #B2BEC3;
  --border: #DFE6E9;
  --success: #00B894;
  --danger: #E17055;
  --gold: #FDCB6E;
  --gold-dark: #F39C12;
  --shadow: 0 2px 16px rgba(108, 92, 231, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 90px;
  -webkit-font-smoothing: antialiased;
}

/* ====== 头部 ====== */
.page-header {
  background: linear-gradient(135deg, var(--primary), #a29bfe);
  color: #fff;
  text-align: center;
  padding: 36px 20px 28px;
  position: relative;
  overflow: hidden;
}

.header-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.15) 0%, transparent 60%);
}

.vote-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  position: relative;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.vote-subtitle {
  font-size: 14px;
  margin-top: 8px;
  opacity: 0.9;
  position: relative;
}

/* ====== 规则栏 ====== */
.rule-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-light);
  flex-wrap: wrap;
}

.rule-bar.vote-done {
  background: #FFF3E0;
  color: #EF6C00;
}

.rule-icon { font-size: 16px; }

.rule-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.rule-bar.vote-done .rule-badge {
  background: #EF6C00;
}

/* ====== 选手列表 ====== */
.candidate-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-hint {
  text-align: center;
  color: var(--text-lighter);
  padding: 60px 20px;
  font-size: 15px;
}

/* ====== 选手卡片 ====== */
.candidate-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.candidate-card:active {
  transform: scale(0.985);
}

.candidate-card.selected {
  border-color: var(--primary);
  background: #F8F7FF;
}

.card-rank {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-lighter);
  min-width: 32px;
  text-align: center;
}

.candidate-card:nth-child(1) .card-rank { color: var(--gold-dark); font-size: 22px; }
.candidate-card:nth-child(2) .card-rank { color: #B2BEC3; font-size: 20px; }
.candidate-card:nth-child(3) .card-rank { color: #CD853F; font-size: 18px; }

/* 头像区 */
.card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.card-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.card-avatar-placeholder {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.play-icon {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
}

.candidate-card:hover .play-icon,
.candidate-card:active .play-icon {
  opacity: 1;
}

/* 信息区 */
.card-info {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-team {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.card-votes {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 4px;
}

/* 进度条 */
.progress-bar {
  height: 5px;
  background: #F0F0F0;
  border-radius: 10px;
  margin-top: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* 勾选按钮 */
.card-check {
  flex-shrink: 0;
}

.check-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.candidate-card.selected .check-circle {
  border-color: var(--primary);
  background: var(--primary);
}

.candidate-card.selected .check-circle::after {
  content: '✓';
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

/* ====== 底部栏 ====== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 14px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  z-index: 100;
}

.selected-hint {
  font-size: 14px;
  color: var(--text-light);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-vote {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-vote:active:not(:disabled) {
  transform: scale(0.95);
  background: var(--primary-dark);
}

.btn-vote:disabled {
  background: #DFE6E9;
  color: #B2BEC3;
  cursor: not-allowed;
}

.btn-vote.voted {
  animation: votePop 0.6s ease;
}

@keyframes votePop {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); background: var(--success); }
  100% { transform: scale(1); }
}

/* ====== 弹窗通用 ====== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ====== Vlog 弹窗 ====== */
.vlog-modal {
  background: #000;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: slideUp 0.35s ease;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.vlog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #1a1a2e;
  color: #fff;
}

.vlog-name {
  font-size: 16px;
  font-weight: 700;
}

.vlog-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.vlog-body {
  background: #000;
}

.vlog-body video {
  width: 100%;
  display: block;
  max-height: 60vh;
  object-fit: contain;
}

/* ====== 成功弹窗 ====== */
.success-modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 36px 28px 28px;
  text-align: center;
  width: 100%;
  max-width: 340px;
  animation: slideUp 0.35s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.success-icon {
  font-size: 56px;
  margin-bottom: 8px;
}

.success-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.success-candidate {
  font-size: 15px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.5;
}

.success-tip {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* 分享按钮 */
.share-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-share {
  flex: 1;
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.btn-share:active {
  background: var(--bg);
  border-color: var(--primary);
  transform: scale(0.96);
}

.share-icon {
  font-size: 24px;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 15px;
  cursor: pointer;
  padding: 8px 20px;
}

.btn-close-modal:active {
  color: var(--text);
}

/* ====== Toast ====== */
.app-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0,0,0,0.78);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.app-toast.warn {
  background: rgba(239, 108, 0, 0.9);
}

/* ====== 分享引导遮罩 ====== */
.share-guide {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 12px 20px;
}

.guide-content {
  background: #fff;
  padding: 14px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  position: relative;
}

.guide-content::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 30px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #fff;
}
