:root {
  --bg: #0d0d0d;
  --card-bg: #1a1a1a;
  --surface2: #141414;
  --text: #e8e2d6;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --border: #2a2a2a;
  --gold: #c9a84c;
  --gold-light: #e8cc7a;
  --gold-dim: #7a5e28;
  --gold-track: #3a2f16;
  --positive: #22c55e;
  --negative: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ---------- header ---------- */

.site-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-name {
  display: inline-block;
  font-family: "Cormorant Garamond", serif;
  font-size: 52px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
}

.brand-name span {
  color: var(--gold);
}

.brand-rule {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 16px auto 0;
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

.page-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--gold);
  margin-top: 22px;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 22%;
  opacity: 0.9;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.social-icon:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.social-icon.instagram { background: #e1306c; }
.social-icon.x { background: #000000; }
.social-icon.youtube { background: #ff0000; }
.social-icon.facebook { background: #0866ff; }
.social-icon.tiktok { background: #000000; }
.social-icon.twitch { background: #9146ff; }
.social-icon.kick { background: #53fc19; }
.social-icon.discord { background: #5865f2; }

.social-icon img {
  width: 18px;
  height: 18px;
  display: block;
}

/* ---------- shared card ---------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

section + section {
  margin-top: 22px;
}

.card-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  color: var(--gold-light);
  margin-bottom: 16px;
}

.card-title small {
  font-size: 12px;
  font-family: inherit;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 8px;
  letter-spacing: 0.04em;
}

.row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.row > .card {
  flex: 1;
  min-width: 300px;
  padding: 20px 16px;
}

/* Below this, two side-by-side cards would get squeezed toward their
   min-width — which is exactly what forces the breakdown tables into
   horizontal scroll. Stack to full-width single column instead. */
@media (max-width: 760px) {
  .row > .card {
    flex-basis: 100%;
  }
}

/* ---------- filters ---------- */

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.filter-group label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s ease;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--gold-dim);
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
}

.btn-sm:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.btn-export {
  background: var(--gold-dim);
  border-color: var(--gold-dim);
  color: #16130a;
  font-weight: 700;
}

.btn-export:hover {
  border-color: var(--gold);
  color: #16130a;
}

.btn-showmore {
  border-color: var(--gold-dim);
  color: var(--gold);
}

#result-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ---------- summary stats ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 8px;
}

.stat-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  min-width: 0;
}

.stat-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-value.positive { color: var(--positive); }
.stat-value.negative { color: var(--negative); }
.stat-value.neutral { color: var(--text-muted); }
.stat-value.gold { color: var(--gold-light); }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

.positive { color: var(--positive); }
.negative { color: var(--negative); }
.neutral { color: var(--text-muted); }

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
}

.breakdown-table,
table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.breakdown-table th,
table.results th {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 7px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.results th { text-align: left; cursor: pointer; user-select: none; }
table.results th:hover { color: var(--gold); }
.breakdown-table th.sortable { cursor: pointer; user-select: none; }
.breakdown-table th.sortable:hover { color: var(--gold); }

.breakdown-table th:first-child,
table.results th:first-child { text-align: left; }

.breakdown-table td,
table.results td {
  padding: 7px 10px;
  border-bottom: 1px solid #161616;
  text-align: right;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.breakdown-table td:first-child,
table.results td:first-child { text-align: left; }

.breakdown-table tr:last-child td,
table.results tr:last-child td { border-bottom: none; }

.breakdown-table tr:hover td,
table.results tr:hover td { background: rgba(201, 168, 76, 0.05); }

th.sorted-asc::after  { content: ' \25B2'; color: var(--gold); }
th.sorted-desc::after { content: ' \25BC'; color: var(--gold); }

.name-link {
  color: var(--text);
  cursor: pointer;
  transition: color 0.15s;
}
.name-link:hover { color: var(--gold-light); text-decoration: underline; text-underline-offset: 3px; }

.rank-num {
  font-family: "Cormorant Garamond", serif;
  font-size: 16px;
  color: var(--gold-dim);
  min-width: 22px;
  display: inline-block;
}

.top5-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.top5-table td { padding: 8px 10px; border-bottom: 1px solid #161616; font-variant-numeric: tabular-nums; }
.top5-table tr:last-child td { border-bottom: none; }
.top5-table tr:hover td { background: rgba(201, 168, 76, 0.05); }
.top5-name { color: var(--text); cursor: pointer; font-size: 13px; line-height: 1.3; }
.top5-name:hover { color: var(--gold-light); }
.top5-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.running-total-pos { color: var(--positive); }
.running-total-neg { color: var(--negative); }

.col-date { color: var(--text-muted); white-space: nowrap; }
.col-site { font-size: 11px; color: var(--gold-dim); }
.col-num  { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rebuy-badge { font-size: 10px; color: var(--gold-dim); margin-left: 4px; letter-spacing: 0.02em; }

/* Compact variant for the By Stake / By Site tables, which live in a
   half-width card and have the least room to spare. */
.compact-table th,
.compact-table td {
  padding: 5px 3px;
}
.compact-table th {
  font-size: 8.5px;
  letter-spacing: 0.01em;
}
.compact-table td {
  font-size: 11px;
}
.compact-table td:first-child {
  font-size: 12px;
}

.empty-msg { text-align: center; color: var(--text-muted); padding: 24px; font-size: 13px; }
.load-err  { text-align: center; color: var(--negative); padding: 16px; font-size: 13px; }

/* ---------- responsive ---------- */

@media (max-width: 520px) {
  .brand-name { font-size: 40px; }
}
