:root {
  --bg: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #162033;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.6);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --accent-cyan: #06b6d4;
  --accent-gold: #f59e0b;
  --accent-silver: #94a3b8;
  --accent-bronze: #d97706;
  --danger: #ef4444;
  --success: #10b981;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 16px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-title span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: var(--primary);
}

/* Auth Bar */
.auth-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-login {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-login:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 30px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.user-grade {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon-subtle:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* Main */
.main-content {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 64px;
}

/* Hero Section */
.hero-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.9), rgba(15, 23, 42, 0.8));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.tag-live {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 10px;
}

.hero-heading {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 520px;
}

.hero-stats {
  display: flex;
  gap: 20px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  min-width: 120px;
  text-align: center;
}

.stat-val {
  display: block;
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Tabs */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* Leaderboard Grid */
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.leader-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.leader-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

.leader-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.cat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.cat-title {
  font-size: 17px;
  font-weight: 700;
}

.cat-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Podium Items */
.podium-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.podium-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.2s;
}

.podium-item.rank-1 {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.02));
  border-color: rgba(245, 158, 11, 0.25);
}

.podium-item.rank-2 {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.1), rgba(148, 163, 184, 0.02));
  border-color: rgba(148, 163, 184, 0.2);
}

.podium-item.rank-3 {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.08), rgba(217, 119, 6, 0.02));
  border-color: rgba(217, 119, 6, 0.18);
}

.podium-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.rank-1 .rank-badge { background: var(--accent-gold); color: #000; }
.rank-2 .rank-badge { background: var(--accent-silver); color: #000; }
.rank-3 .rank-badge { background: var(--accent-bronze); color: #fff; }
.rank-4 .rank-badge, .rank-5 .rank-badge { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }

.candidate-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.podium-name {
  font-size: 14px;
  font-weight: 700;
}

.podium-grade {
  font-size: 11px;
  color: var(--text-muted);
}

.vote-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-cyan);
}

.empty-podium {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* Voting Grid */
.vote-status-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(139, 92, 246, 0.12);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.voting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.vote-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.vote-card.voted {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(17, 24, 39, 1), rgba(16, 185, 129, 0.03));
}

.vote-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.vote-current-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}

.vote-current-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.vote-current-val {
  font-weight: 700;
  color: #fff;
}

.btn-vote-action {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
}

.btn-vote-action:hover {
  background: var(--primary-hover);
}

.btn-vote-action.btn-change {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-vote-action.btn-change:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Members Grid */
.search-box input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  min-width: 280px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--border-focus);
}

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, border-color 0.2s;
}

.member-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

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

.member-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.member-name {
  font-size: 16px;
  font-weight: 700;
}

.member-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--accent-cyan);
}

.member-bio {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  min-height: 38px;
}

.member-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: auto;
}

.instagram-link {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.instagram-link:hover {
  color: #e1306c;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.vote-modal-box {
  max-width: 520px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 16px;
}

.modal-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 700;
  padding-bottom: 10px;
  cursor: pointer;
  position: relative;
}

.modal-tab-btn.active {
  color: #fff;
}

.modal-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
}

/* Forms */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.auth-form.active {
  display: flex;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--border-focus);
}

.input-prefix-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-prefix-wrap:focus-within {
  border-color: var(--border-focus);
}

.input-prefix {
  padding-left: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.input-prefix-wrap input {
  background: transparent;
  border: none;
  flex: 1;
}

.form-error {
  font-size: 13px;
  color: var(--danger);
  display: none;
  padding: 8px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.form-error.active {
  display: block;
}

.submit-btn {
  background: var(--primary);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-family: var(--font-sans);
  transition: background 0.2s;
  margin-top: 6px;
}

.submit-btn:hover {
  background: var(--primary-hover);
}

/* Candidate Picker */
.vote-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.category-icon-big {
  font-size: 36px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.vote-modal-title {
  font-size: 18px;
  font-weight: 800;
}

.vote-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.candidate-search-wrap input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 14px;
  outline: none;
}

.candidate-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.candidate-pick-item:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
}

.candidate-pick-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.01);
}

.candidate-pick-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1f2937;
  color: #fff;
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
}

.toast.toast-success { border-color: var(--success); }
.toast.toast-error { border-color: var(--danger); }

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

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: auto;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: #fff;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .nav-wrap {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 0;
  }
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-stats {
    width: 100%;
    justify-content: space-between;
  }
  .stat-box {
    flex: 1;
    min-width: 0;
    padding: 12px 8px;
  }
  .leaderboard-grid, .voting-grid {
    grid-template-columns: 1fr;
  }
}
