/* ====== CSS Variables ====== */
:root {
  --bg: #08080f;
  --bg-secondary: #0e0e18;
  --bg-card: rgba(255, 255, 255, 0.025);
  --bg-card-hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.06);
  --border-active: rgba(255, 255, 255, 0.12);
  --text: #e4e2df;
  --text-secondary: #8b8b8b;
  --text-muted: #5c5c5c;
  --gold: #f0c060;
  --gold-dim: #9a7b30;
  --gold-bg: rgba(240, 192, 96, 0.08);
  --red: #e05050;
  --red-bg: rgba(224, 80, 80, 0.08);
  --green: #50c878;
  --green-bg: rgba(80, 200, 120, 0.08);
  --primary: #f0c060;
  --primary-hover: #f5d080;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== Reset & Base ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====== Navbar ====== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8, 8, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 0 20px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}

.nav-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; }
.nav-logo:hover { text-decoration: none; }
.logo-icon { font-size: 1.4rem; }
.logo-text { background: linear-gradient(135deg, var(--gold), #e8a840); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.nav-actions { display: flex; gap: 8px; align-items: center; }
.nav-user { font-size: 0.88rem; color: var(--text); font-weight: 500; }
.nav-votes { font-size: 0.82rem; color: var(--gold); background: var(--gold-bg); padding: 3px 10px; border-radius: 20px; }

/* ====== Buttons ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  transition: all var(--transition); position: relative; overflow: hidden;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #d4a030, #c08020);
  color: #1a1a0a;
}
.btn-primary:hover { background: linear-gradient(135deg, #e0b040, #d09030); box-shadow: 0 4px 20px rgba(192, 144, 48, 0.3); }

.btn-outline {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--border-active); color: var(--text); background: rgba(255,255,255,0.03); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; border-radius: 6px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: 10px; }
.btn-full { width: 100%; }

.btn-vote {
  width: 36px; height: 36px; padding: 0; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 1.1rem; cursor: pointer;
  transition: all var(--transition);
}
.btn-vote:hover { border-color: var(--border-active); background: rgba(255,255,255,0.05); }
.btn-vote.active-up { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.btn-vote.active-down { background: var(--red-bg); border-color: var(--red); color: var(--red); }

/* ====== Hero ====== */
.hero {
  position: relative; padding: 80px 20px 60px; text-align: center; overflow: hidden;
}

.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(240, 192, 96, 0.06), transparent),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(200, 120, 40, 0.04), transparent),
    radial-gradient(ellipse 40% 40% at 80% 80%, rgba(200, 120, 40, 0.04), transparent);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }

.hero-title { margin-bottom: 16px; }

.title-line-1 {
  display: block; font-size: 1.2rem; font-weight: 500;
  color: var(--gold); letter-spacing: 0.3em; text-transform: uppercase; margin-bottom: 4px;
}
.title-line-2 {
  display: block; font-size: 3.2rem; font-weight: 900;
  background: linear-gradient(135deg, #f0d080 0%, #d09030 50%, #f0c060 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: 0.05em;
}

.hero-subtitle { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 40px; }

.hero-stats { display: flex; align-items: center; justify-content: center; gap: 32px; }

.stat-item { text-align: center; }
.stat-num { display: block; font-size: 2rem; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* ====== Main Content ====== */
.main { padding: 0 20px 60px; }
.container { max-width: 800px; margin: 0 auto; }

/* ====== Tabs ====== */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; background: var(--bg-secondary); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }

.tab {
  flex: 1; padding: 10px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-secondary); cursor: pointer;
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { background: rgba(255,255,255,0.06); color: var(--text); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ====== Sort Bar ====== */
.sort-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.sort-label { color: var(--text-secondary); font-size: 0.85rem; }
.sort-btn {
  padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  font-family: inherit; font-size: 0.82rem; transition: all var(--transition);
}
.sort-btn:hover { border-color: var(--border-active); color: var(--text); }
.sort-btn.active { background: var(--gold-bg); border-color: var(--gold-dim); color: var(--gold); }

/* ====== Podium (Top 3) ====== */
.podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 12px; margin-bottom: 28px; align-items: end; }
.podium:empty { display: none; }

.podium-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 16px; text-align: center;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.podium-card:hover { background: var(--bg-card-hover); transform: translateY(-2px); }

.podium-rank {
  font-size: 2rem; margin-bottom: 4px;
  width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

.podium-card.rank-1 { order: 2; padding-top: 28px; border-color: rgba(255, 215, 0, 0.2); }
.podium-card.rank-1 .podium-rank { background: rgba(255, 215, 0, 0.15); font-size: 2.2rem; }

.podium-card.rank-2 { order: 1; }
.podium-card.rank-2 .podium-rank { background: rgba(192, 192, 192, 0.1); }

.podium-card.rank-3 { order: 3; }
.podium-card.rank-3 .podium-rank { background: rgba(205, 127, 50, 0.1); }

.podium-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-desc { font-size: 0.8rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 10px; }
.podium-score {
  display: inline-block; padding: 3px 14px; border-radius: 20px;
  font-size: 0.85rem; font-weight: 700;
  background: var(--gold-bg); color: var(--gold);
}

/* ====== Entry Cards ====== */
.leaderboard-list { display: flex; flex-direction: column; gap: 10px; }

.entry-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  transition: all var(--transition);
  animation: slideUp 0.4s ease backwards;
}
.entry-card:hover { background: var(--bg-card-hover); border-color: var(--border-active); }

.entry-rank-num {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700; flex-shrink: 0;
  background: rgba(255,255,255,0.03); color: var(--text-secondary);
}

.entry-info { flex: 1; min-width: 0; }
.entry-name { font-weight: 700; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-desc { font-size: 0.85rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.entry-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; display: flex; gap: 12px; }

.entry-score-display {
  font-weight: 700; font-size: 1rem; min-width: 36px; text-align: center;
  color: var(--gold);
}

.entry-votes {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}

/* ====== Empty State ====== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); }

/* ====== Load More ====== */
.load-more { text-align: center; padding: 24px 0; }
.load-more.hidden { display: none; }

/* ====== Submit Card ====== */
.submit-card, .submit-login-hint {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
}
.submit-login-hint { text-align: center; display: none; }
.submit-login-hint .hint-icon { font-size: 3rem; margin-bottom: 16px; }
.submit-login-hint h3 { margin-bottom: 8px; }
.submit-login-hint p { color: var(--text-secondary); margin-bottom: 20px; }
.hint-actions { display: flex; gap: 10px; justify-content: center; }

.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 24px; }

.submit-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.88rem; font-weight: 500; color: var(--text-secondary); }
.required { color: var(--red); }

.form-group input,
.form-group textarea,
.form-group select {
  font-family: inherit; font-size: 0.95rem; padding: 12px 14px;
  border-radius: 8px; border: 1px solid var(--border);
  background: rgba(0,0,0,0.2); color: var(--text);
  transition: border-color var(--transition); outline: none; resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--gold-dim); }

.form-group select { cursor: pointer; }
.form-group select option { background: var(--bg-secondary); color: var(--text); }

/* ====== Modal ====== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }

.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 400px;
  position: relative; box-shadow: var(--shadow);
  animation: scaleIn 0.2s ease;
}

.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: var(--text-secondary);
  font-size: 1.5rem; cursor: pointer; padding: 4px 8px; line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 24px; text-align: center; }

.modal form { display: flex; flex-direction: column; gap: 16px; }

.modal-switch { text-align: center; font-size: 0.88rem; color: var(--text-secondary); margin-top: 16px; }

/* ====== Toast ====== */
.toast-container {
  position: fixed; top: 72px; right: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 12px 20px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 500; box-shadow: var(--shadow);
  animation: slideInRight 0.3s ease;
  max-width: 360px;
}
.toast.success { background: #0d2818; border: 1px solid #1a5c30; color: #50c878; }
.toast.error { background: #280d0d; border: 1px solid #5c1a1a; color: #e05050; }
.toast.info { background: #0d1828; border: 1px solid #1a305c; color: #5090e0; }

/* ====== Footer ====== */
.footer { text-align: center; padding: 40px 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; }
.footer-sub { font-size: 0.78rem; margin-top: 4px; }

/* ====== Animations ====== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ====== Responsive ====== */
@media (max-width: 640px) {
  .title-line-2 { font-size: 2.2rem; }
  .hero { padding: 48px 16px 36px; }
  .hero-stats { gap: 20px; }
  .stat-num { font-size: 1.5rem; }
  .podium { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .podium-card { padding: 14px 10px; }
  .podium-card.rank-1 { padding-top: 20px; }
  .podium-rank { width: 36px; height: 36px; font-size: 1.5rem; }
  .podium-card.rank-1 .podium-rank { font-size: 1.6rem; }
  .podium-name { font-size: 0.9rem; }
  .podium-desc { font-size: 0.72rem; }
  .entry-card { padding: 12px 14px; gap: 10px; }
  .submit-card, .submit-login-hint { padding: 20px; }
  .modal { margin: 0 16px; padding: 24px; }
  .logo-text { display: none; }
}
