:root {
  --bg:      #0d1117;
  --panel:   #161b22;
  --border:  #30363d;
  --fg:      #e6edf3;
  --muted:   #8b949e;
  --accent:  #58a6ff;
  --bad:     #f85149;
  --good:    #3fb950;
  --warn:    #d29922;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.page { max-width: 480px; margin: 0 auto; padding: 24px 16px 64px; }
.page-wide { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }

/* ─── Header ─────────────────────────────────────────────────────────────── */
header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
header.site-header .brand { display: flex; align-items: center; text-decoration: none; }
header.site-header .brand .brand-logo { height: 65px; width: auto; display: block; }
header.site-header .header-right { display: flex; align-items: center; gap: 12px; }
.points-badge {
  background: var(--panel);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
  display: none; /* shown by JS when logged in */
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

/* ─── Form ───────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
label { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  padding: 8px 12px;
  font-size: 15px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}
input:focus { border-color: var(--accent); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-outline  { background: transparent; border: 1px solid var(--border); color: var(--fg); }
.btn-good     { background: var(--good);  color: #fff; }
.btn-bad      { background: var(--bad);   color: #fff; }
.btn-muted    { background: var(--panel); border: 1px solid var(--border); color: var(--muted); }
.btn-block    { width: 100%; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.alert-error   { background: #21050d; border: 1px solid var(--bad);  color: var(--bad);  }
.alert-success { background: #051a0a; border: 1px solid var(--good); color: var(--good); }

/* ─── Genre chips ────────────────────────────────────────────────────────── */
.genre-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.genre-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.genre-chip:hover, .genre-chip.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Candidate card ─────────────────────────────────────────────────────── */
.candidate-card {
  text-align: center;
  padding: 28px 24px 20px;
}
.candidate-cover {
  width: 160px;
  height: 160px;
  border-radius: 8px;
  object-fit: cover;
  margin: 0 auto 16px;
  display: block;
  background: var(--border);
}
.candidate-cover.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--muted);
}
.candidate-title  { font-size: 18px; font-weight: 700; }
.candidate-artist { font-size: 14px; color: var(--muted); margin-top: 4px; }
.candidate-genre  { font-size: 12px; color: var(--accent); margin-top: 6px; }

/* ─── Progress ring ──────────────────────────────────────────────────────── */
.ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
}
.ring-svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--bad); }
.ring-fill  { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .3s linear; }

/* ─── Vote buttons ───────────────────────────────────────────────────────── */
.vote-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.vote-row .btn { flex: 1; }

/* ─── Leaderboard table ──────────────────────────────────────────────────── */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th, .lb-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.lb-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-rank  { color: var(--muted); width: 40px; }
.lb-pts   { font-weight: 700; color: var(--accent); text-align: right; }

/* ─── Misc helpers ───────────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: 13px; }
h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
nav.auth-links { display: flex; gap: 16px; font-size: 14px; }

/* ─── Hamburger menu ─────────────────────────────────────────────────────── */
.hamburger-btn {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: var(--fg); padding: 4px 6px; line-height: 1;
}
.hamburger-menu {
  display: none; position: fixed; top: 52px; right: 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; z-index: 9999; min-width: 190px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.hamburger-menu a {
  display: block; padding: 12px 20px; font-size: 15px;
  color: var(--fg); border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.hamburger-menu a:last-child { border-bottom: none; }
.hamburger-menu a:hover { background: var(--bg); }
.hamburger-menu.open { display: block; }

/* ─── Toast notification ─────────────────────────────────────────────────── */
.toast {
  position: fixed; top: 88px; left: 50%; transform: translateX(-50%);
  background: var(--good); color: #fff; padding: 10px 24px;
  border-radius: 999px; font-weight: 600; font-size: 15px;
  z-index: 9998; pointer-events: none; opacity: 0;
  transition: opacity .25s;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 8000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; width: 100%; max-width: 420px;
  margin: 16px;
}
.modal-box h2 { margin-bottom: 16px; }

/* ─── Rank badge ─────────────────────────────────────────────────────────── */
.rank-badge {
  font-size: 12px; color: var(--muted); margin-right: 4px;
}

/* ─── Leaderboard responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .lb-joined, .lb-share-col { display: none; }
  .lb-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lb-table .lb-name img { width: 16px; height: 12px; }
}
