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

:root {
  --bg:        #0d0b08;
  --surface:   #141210;
  --surface2:  #1d1810;
  --surface3:  #262018;
  --border:    #3c3020;
  --orange:    #c05818;
  --orange-lt: #d96c28;
  --text:      #cdc0a2;
  --muted:     #7a6e58;
  --green:     #5fa060;
  --red:       #c93838;
  --gold:      #c49030;
  --silver:    #8a9aaa;
  --bronze:    #9e6428;
  --blue:      #4a8ecc;
  --radius:    4px;
  --radius-lg: 8px;
}

html { scroll-behavior: smooth; }

/* ── Scrollbar styling ────────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 8px; height: 8px; }
::-webkit-scrollbar-track        { background: var(--bg); }
::-webkit-scrollbar-thumb        { background: var(--surface3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover  { background: var(--muted); }
::-webkit-scrollbar-corner       { background: var(--bg); }
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--surface3) var(--bg); }

body {
  font-family: 'Barlow', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  isolation: isolate;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/TMRustBanner.png') center center / cover no-repeat;
  opacity: 0.10;
  z-index: -1;
  pointer-events: none;
}

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

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 80px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,0.7), 0 1px 0 rgba(192,88,24,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 16px;
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; color: var(--text); }
.nav-brand:hover .brand-icon { filter: drop-shadow(0 0 6px var(--orange)) brightness(1.15); }
.nav-brand strong { color: var(--orange); }
.brand-icon {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(192,88,24,0.5));
  transition: filter 0.2s;
}

.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--orange); background: rgba(232,116,32,0.1); }

/* ── Page layout ──────────────────────────────────────────────────────────── */
.page-main {
  flex: 1;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}

.footer {
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  background: var(--surface);
  margin-top: auto;
}

/* ── Hero banner ──────────────────────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, var(--surface) 0%, #1a1206 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 28px;
}
.hero-offline { border-left-color: var(--red); }

.hero-server-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.seed-link { color: var(--orange); text-decoration: none; }
.seed-link:hover { text-decoration: underline; }

/* Live badge */
.live-badge { color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Inline number spans used for countUp animation */
.num { display: inline; }

.meta-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
}
.badge-online { background: rgba(61,204,138,0.15); color: var(--green); }
.badge-offline { background: rgba(239,68,68,0.15); color: var(--red); }
.err-text { color: var(--red); }

/* ── Section ──────────────────────────────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Leaderboard scope toggle (Home) ──────────────────────────────────────── */
.lb-scope-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lb-scope-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.lb-scope-btn:not(:last-child) { border-right: 1px solid var(--border); }
.lb-scope-btn:hover { color: var(--text); }
.lb-scope-btn.active { background: var(--orange); color: #fff; }

.count-badge {
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.refresh-label { font-size: 12px; color: var(--muted); }
.view-all-link { font-size: 13px; font-weight: 600; color: var(--orange-lt); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--surface2); }

.rank-cell  { color: var(--muted); font-size: 12px; width: 40px; }
.time-cell  { color: var(--green); font-weight: 600; white-space: nowrap; }
.kdr-cell   { font-weight: 700; }
.value-cell { font-weight: 700; color: var(--orange-lt); }
.player-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Rank highlights */
.rank-gold   td:first-child { color: var(--gold); }
.rank-silver td:first-child { color: var(--silver); }
.rank-bronze td:first-child { color: var(--bronze); }

/* ── Player link / avatar ─────────────────────────────────────────────────── */
.player-link { color: var(--text); font-weight: 500; }
.player-link:hover { color: var(--orange-lt); text-decoration: none; }

.avatar-pill {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-pill img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* ── Delta badges ─────────────────────────────────────────────────────────── */
.delta-pos {
  display: inline-block;
  margin-left: 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
}
.tag-new {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(232,116,32,0.2);
  color: var(--orange);
  border: 1px solid var(--orange);
}

.table-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ── Mini leaderboard grid ────────────────────────────────────────────────── */
.mini-lb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.mini-lb-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.mini-lb-title {
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 800; }
.page-subtitle { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ── Leaderboard tabs ─────────────────────────────────────────────────────── */
.tab-scroll { overflow-x: auto; margin-bottom: 16px; }
.tab-group {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: max-content;
  min-width: 100%;
}
.tab-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.tab-btn:hover { color: var(--text); background: var(--surface2); }
.tab-btn.active { color: var(--orange); background: rgba(232,116,32,0.12); }
/* Green dot on tab when an online player has session activity in that section */
.tab-btn.has-delta::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-left: 5px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.lb-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 200px;
}

.lb-extra {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
.lb-extra select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.lb-extra select:focus { outline: none; border-color: var(--orange); }

/* ── Search input ─────────────────────────────────────────────────────────── */
.search-input {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  width: 260px;
  transition: border-color 0.15s;
}
.search-input:focus { outline: none; border-color: var(--orange); }
.search-input::placeholder { color: var(--muted); }

/* ── Wipe select dropdown ─────────────────────────────────────────────────── */
.stats-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wipe-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.wipe-select:focus { outline: none; border-color: var(--orange); }
.wipe-select option { background: var(--surface2); color: var(--text); }

/* ── Players grid ─────────────────────────────────────────────────────────── */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}
.player-card:hover { border-color: var(--orange); }
.player-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.player-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.player-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.player-card-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.player-card-meta .kv { display: flex; gap: 6px; }
.player-card-meta .kv .k { color: var(--muted); }
.player-card-meta .kv .v { color: var(--text); font-weight: 500; }
.online-pip { display: inline-block; color: var(--green); font-size: 10px; margin-left: 4px; }

/* ── Profile page ─────────────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.profile-info h1 { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.online-badge { font-size: 12px; color: var(--green); font-weight: 600; }

.live-banner {
  background: rgba(61,204,138,0.08);
  border: 1px solid rgba(61,204,138,0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--green);
}
.live-dot { font-size: 10px; }
.live-deltas { display: flex; gap: 10px; color: var(--text); }
.live-deltas span { color: var(--green); font-weight: 600; }

/* ── Stat grid (profile) ──────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.stat-value { font-size: 22px; font-weight: 800; color: var(--orange-lt); }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }
.stat-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Resources bar ────────────────────────────────────────────────────────── */
.resource-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.resource-row {
  display: grid;
  grid-template-columns: 160px 1fr 90px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.resource-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resource-bar-wrap { background: var(--surface2); border-radius: 4px; height: 8px; overflow: hidden; }
.resource-bar { background: var(--orange); height: 100%; border-radius: 4px; min-width: 4px; }
.resource-amount { text-align: right; font-weight: 600; }

/* ── Breakdown tags ───────────────────────────────────────────────────────── */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 4px;
}
.breakdown-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.breakdown-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.breakdown-tag {
  display: inline-block;
  margin: 3px;
  padding: 3px 8px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
}

/* ── Section headings ─────────────────────────────────────────────────────── */
.section h2 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

/* ── States ───────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--muted);
  font-size: 14px;
}
.loading::before { content: ''; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--orange); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.api-error {
  padding: 20px 24px;
  color: var(--red);
  font-size: 13px;
  background: rgba(239,68,68,0.08);
  border-radius: var(--radius);
  margin: 16px;
}

/* ── Error page ───────────────────────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 80px 20px;
}
.error-code { font-size: 80px; font-weight: 800; color: var(--surface3); line-height: 1; }
.error-page h1 { font-size: 24px; margin: 12px 0; }
.btn-primary {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 24px;
  background: var(--orange);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}
.btn-primary:hover { background: var(--orange-lt); color: #fff; text-decoration: none; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }

/* ── Stats page ───────────────────────────────────────────────────────────── */
.stats-tab-scroll { margin-bottom: 16px; }
.stats-panel { display: block; }
.stats-panel.hidden { display: none; }
.stats-section { margin-bottom: 32px; }
.stats-section-header h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--orange);
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Sortable column headers */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  min-width: 110px;
}
.data-table th.sortable:hover {
  color: var(--text);
  background: var(--surface3);
}
.sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: var(--border);
  vertical-align: middle;
}
.sort-icon.sort-active { color: var(--orange); }

/* Sticky player column in stats tables */
.stats-table th.stats-sticky-th,
.stats-table td.stats-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}
/* Rank column — sticky body cells to match the sticky header */
.stats-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}
.stats-table tbody tr:hover td:first-child,
.stats-table tbody tr:hover td.stats-sticky {
  background: var(--surface2);
}
/* Player column offset sits after the 44px rank column */
.stats-table th.stats-sticky-th:nth-child(2),
.stats-table td.stats-sticky {
  left: 44px;
  /* Shadow only on the right-most sticky column so it separates sticky from scrolling */
  box-shadow: 2px 0 6px rgba(0,0,0,0.35);
}
.stats-table th.stats-sticky-th:first-child {
  left: 0;
  z-index: 3;
  background: var(--surface2);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .page-main { padding: 16px; }
  .hero-banner { padding: 16px; }
  .hero-meta { gap: 10px; font-size: 12px; }
  .profile-header { flex-direction: column; align-items: flex-start; }
  .section { padding: 16px; }
  .resource-row { grid-template-columns: 120px 1fr 70px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 100%; }
  /* Stats header — stack wipe selector and search on mobile */
  .stats-header-right { width: 100%; flex-direction: column; align-items: stretch; }
  .wipe-select { width: 100%; }
  /* Disable sticky columns on mobile — whole table scrolls as one unit.
     On mobile, position:sticky on td can be unreliable and causes the header
     to stick while body cells scroll, creating a misaligned look. */
  .stats-table th.stats-sticky-th,
  .stats-table td.stats-sticky,
  .stats-table td:first-child {
    position: static;
    left: auto;
    box-shadow: none;
  }
  /* Tighter table cells on small screens */
  .data-table { font-size: 12px; }
  .data-table th,
  .data-table td { padding: 6px 8px; }
}

/* ── Vote page ────────────────────────────────────────────────────────────── */

/* Error banner */
.vote-error-banner {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Countdown */
.vote-countdown-label { font-size: 12px; color: var(--muted); margin-right: 6px; }
.vote-countdown {
  font-size: 18px;
  font-weight: 800;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}
.vote-countdown.urgent { color: var(--red); animation: livePulse 1s ease-in-out infinite; }

/* User bar */
.vote-user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.vote-user-bar--guest { justify-content: space-between; }
.vote-guest-msg { font-size: 14px; color: var(--muted); }
.vote-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.vote-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vote-user-name { flex: 1; font-size: 14px; color: var(--muted); }
.vote-user-name strong { color: var(--text); }

/* Steam login button */
.btn-steam {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: #1b2838;
  border: 1px solid #4a6a8a;
  border-radius: var(--radius);
  color: #c6d4df;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-steam:hover { background: #2a3f55; border-color: #6a9ab0; color: #fff; text-decoration: none; }
.steam-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Logout button */
.btn-vote-logout {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-vote-logout:hover { background: var(--surface2); color: var(--text); }

/* Vote session info bar */
.vote-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--muted);
}
.vote-info-bar strong { color: var(--text); }
.vote-status-open { color: var(--green); font-weight: 700; font-size: 11px; letter-spacing: 0.05em; }
.vote-status-closed { color: var(--red); font-weight: 700; font-size: 11px; letter-spacing: 0.05em; }

/* CTA banners */
.vote-cta-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  border: 1px solid;
  flex-wrap: wrap;
}
.vote-cta-banner--guest {
  background: rgba(74,158,255,0.08);
  border-color: rgba(74,158,255,0.25);
}
.vote-cta-banner--open {
  background: rgba(232,116,32,0.08);
  border-color: rgba(232,116,32,0.25);
}
.vote-cta-banner--voted {
  background: rgba(61,204,138,0.08);
  border-color: rgba(61,204,138,0.25);
}
.vote-cta-icon { font-size: 28px; flex-shrink: 0; }
.vote-cta-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
  min-width: 0;
}
.vote-cta-text strong { color: var(--text); font-size: 15px; }
.vote-cta-text span   { color: var(--muted); }
.vote-cta-note        { font-size: 12px; color: var(--muted); }
.vote-cta-note strong { color: var(--text); font-size: 12px; }

/* Candidate grid */
.vote-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 330px));
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .vote-grid { grid-template-columns: repeat(2, minmax(0, 330px)); }
}
@media (max-width: 480px) {
  .vote-grid { grid-template-columns: minmax(0, 330px); }
}

/* Map card */
.vote-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}
.vote-card:hover { border-color: var(--orange); transform: translateY(-2px); }
.vote-card.voted-for { border-color: var(--green); }
.vote-card.voted-for::before {
  content: '✓ Your Vote';
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 2;
}
.vote-card.leading { border-color: var(--gold); }
.vote-card.leading::after {
  content: '🥇 Leading';
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(245,200,66,0.2);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 2;
}
/* both voted + leading */
.vote-card.voted-for.leading::before { top: 10px; }
.vote-card.voted-for.leading::after  { top: 10px; }

/* Map thumbnail */
.vote-card-thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 square — shows full map */
  overflow: hidden;
  background: var(--surface2);
  cursor: pointer;
}
.vote-card-thumb-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s;
}
.vote-card-thumb-wrap:hover img { transform: scale(1.04); }
.vote-card-thumb-wrap .zoom-hint {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.vote-card-thumb-wrap:hover .zoom-hint { opacity: 1; }

/* Card body */
.vote-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.vote-card-meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.vote-card-meta strong { color: var(--text); }

/* Vote bar */
.vote-bar-wrap {
  background: var(--surface2);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.vote-bar {
  height: 100%;
  background: var(--orange);
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 3px;
}
.vote-card.voted-for .vote-bar { background: var(--green); }
.vote-card.leading .vote-bar    { background: var(--gold); }

.vote-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.vote-count-num { font-weight: 700; color: var(--text); font-size: 14px; }

/* Vote / voted buttons */
.btn-vote {
  width: 100%;
  padding: 9px 16px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-vote:hover:not(:disabled) { background: var(--orange-lt); }
.btn-vote:disabled { opacity: 0.5; cursor: default; }
.btn-vote-cast {
  width: 100%;
  padding: 9px 16px;
  background: transparent;
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: default;
}
.btn-vote-login {
  width: 100%;
  padding: 9px 16px;
  background: #1b2838;
  border: 1px solid #4a6a8a;
  border-radius: var(--radius);
  color: #c6d4df;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: block;
  text-align: center;
  transition: background 0.15s;
}
.btn-vote-login:hover { background: #2a3f55; color: #fff; text-decoration: none; }

/* Rustmaps link */
.vote-card-links {
  display: flex;
  gap: 8px;
  font-size: 12px;
}
.vote-card-links a {
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.vote-card-links a:hover { color: var(--orange-lt); }

/* Status messages */
.vote-status-msg {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.vote-status-msg h2 { font-size: 22px; color: var(--text); margin-bottom: 8px; }
.vote-status-msg p  { font-size: 14px; margin-top: 6px; }

/* Winner card */
.vote-winner-wrap {
  background: linear-gradient(135deg, var(--surface) 0%, #1a1a0a 100%);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
}
.vote-winner-header {
  padding: 20px 24px 14px;
  text-align: center;
}
.vote-winner-header h2 { font-size: 22px; font-weight: 800; color: var(--gold); }
.vote-winner-header p  { font-size: 13px; color: var(--muted); margin-top: 6px; }
.vote-winner-img { width: 100%; display: block; }
.vote-winner-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vote-winner-meta { display: flex; gap: 16px; font-size: 13px; flex-wrap: wrap; }
.vote-winner-meta span { color: var(--muted); }
.vote-winner-meta strong { color: var(--text); }
.vote-winner-tally { font-size: 16px; font-weight: 800; color: var(--gold); }

/* Lightbox */
.vote-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 24px;
  cursor: pointer;
}
.vote-lightbox.open { display: flex; }
.vote-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  cursor: default;
}
.vote-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  background: none;
  border: none;
}

/* ── Home page vote preview ────────────────────────────────────────────────── */
.vote-open-badge {
  display: inline-block;
  background: rgba(61,204,138,0.15);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  animation: livePulse 2.5s ease-in-out infinite;
}
.vote-home-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.vote-home-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.vote-home-thumb {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  height: 90px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border-color 0.15s, transform 0.15s;
  text-decoration: none;
  display: block;
}
.vote-home-thumb:hover { border-color: var(--orange); transform: translateY(-2px); text-decoration: none; }
.vote-home-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vote-home-thumb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-align: center;
}
