:root {
  --bg: #080b18;
  --surface: rgba(20, 26, 48, 0.84);
  --border: rgba(148, 163, 184, 0.16);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-2: #ec4899;
  --gold: #fbbf24;
  --cyan: #22d3ee;
  --green: #10b981;
  --red: #f43f5e;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(99, 102, 241, 0.34), transparent 70%),
    radial-gradient(ellipse 60% 35% at 85% 15%, rgba(236, 72, 153, 0.2), transparent 65%),
    radial-gradient(ellipse 60% 40% at 15% 85%, rgba(34, 211, 238, 0.12), transparent 70%);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 18px 16px 118px;
}

.hidden {
  display: none !important;
}

.hero-header {
  text-align: center;
  padding: 10px 4px 16px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

.pulse-dot.pending {
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.6);
}

.pulse-dot.closed {
  background: var(--red);
  animation: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(120deg, #ffffff 10%, #c7d2fe 55%, #f9a8d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.round-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(236, 72, 153, 0.14));
  border: 1px solid rgba(129, 140, 248, 0.3);
  font-size: 13px;
}

.round-name {
  font-weight: 700;
  color: #e0e7ff;
}

.round-meta {
  font-size: 12px;
  color: var(--cyan);
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.info-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 14px;
  text-align: center;
}

.rule-text {
  font-size: 13px;
  color: #cbd5e1;
}

.verify-card {
  background: linear-gradient(135deg, rgba(30, 41, 82, 0.9), rgba(20, 26, 48, 0.92));
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.verify-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #e0e7ff;
  margin-bottom: 8px;
}

.verify-input-wrap input {
  width: 100%;
  background: rgba(8, 11, 24, 0.85);
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.verify-input-wrap input:focus {
  border-color: var(--cyan);
}

.verify-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.qr-token-banner {
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  text-align: center;
  font-weight: 600;
}

.qr-token-banner.ok {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.qr-token-banner.warn {
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.38);
  color: #fda4af;
}

.receipt-card {
  background: linear-gradient(155deg, rgba(16, 185, 129, 0.16), rgba(20, 26, 48, 0.92));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 20px;
  padding: 24px 18px;
  text-align: center;
  margin-bottom: 18px;
}

.receipt-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.35);
}

.receipt-card h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.receipt-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.receipt-picks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.receipt-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 11, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
}

.receipt-footer {
  font-size: 12px;
  color: #a7f3d0;
}

.state-notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 18px;
  text-align: center;
  margin-bottom: 18px;
}

.notice-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.state-notice h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.state-notice p {
  font-size: 13px;
  color: var(--text-muted);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #cbd5e1;
}

.selection-counter {
  font-size: 12px;
  color: var(--cyan);
  font-weight: 600;
}

.contestant-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
}

@media (min-width: 580px) {
  .contestant-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.contestant-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.contestant-card:active {
  transform: scale(0.985);
}

.contestant-card.selected {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.26), rgba(236, 72, 153, 0.16));
  border-color: #818cf8;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.45), 0 10px 24px rgba(99, 102, 241, 0.2);
}

.contestant-card.disabled {
  opacity: 0.62;
  cursor: default;
}

.contestant-card.voted-badge-card {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.1);
}

.avatar-circle {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.num-chip {
  position: absolute;
  top: -6px;
  left: -6px;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 7px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-name-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.card-name {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-dept {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-song {
  font-size: 13px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-indicator {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.4);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: transparent;
  transition: all 0.18s ease;
}

.contestant-card.selected .select-indicator {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.45);
}

.contestant-card.voted-badge-card .select-indicator {
  background: var(--green);
  border-color: transparent;
  color: #fff;
}

.skeleton-card {
  height: 78px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.5) 25%, rgba(51, 65, 85, 0.5) 50%, rgba(30, 41, 59, 0.5) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.final-standings {
  margin-top: 22px;
}

.standings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.standing-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.standing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.standing-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

.rank-badge.r1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1e1b4b; }
.rank-badge.r2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #0f172a; }
.rank-badge.r3 { background: linear-gradient(135deg, #fb923c, #b45309); color: #fff; }

.standing-score {
  font-size: 15px;
  font-weight: 800;
  color: var(--cyan);
}

.standing-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
}

.standing-bar-aud {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.standing-bar-judge {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #f97316);
}

.standing-sub {
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(11, 15, 32, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bottom-summary {
  flex: 1;
  min-width: 0;
}

.bottom-count {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.bottom-rule {
  font-size: 12px;
  color: var(--text-muted);
}

.submit-btn {
  padding: 12px 26px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
  transition: opacity 0.2s, transform 0.15s;
}

.submit-btn:disabled {
  opacity: 0.35;
  box-shadow: none;
  cursor: not-allowed;
}

.submit-btn:not(:disabled):active {
  transform: scale(0.97);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 6, 16, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: #131a34;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  padding: 22px 18px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.modal-sheet h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.confirm-picks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.confirm-pick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 11, 24, 0.65);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

.btn-secondary, .btn-primary {
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.5;
}

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 88vw;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.toast.error {
  border-color: rgba(244, 63, 94, 0.55);
  color: #fecdd3;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.55);
  color: #a7f3d0;
}
