/* ── Luxury dark: onyx + champagne gold ── */
[data-theme="dark"] {
  --bg: #0a0908;
  --bg-accent: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(201, 169, 98, 0.08), transparent 55%);
  --surface: #141210;
  --surface2: #1e1b18;
  --surface-elevated: #252119;
  --text: #f5f0e8;
  --muted: #a89f92;
  --accent: #c9a962;
  --accent2: #e8d5a3;
  --accent-soft: rgba(201, 169, 98, 0.14);
  --accent-glow: rgba(201, 169, 98, 0.35);
  --border: rgba(201, 169, 98, 0.16);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
  --header-bg: linear-gradient(165deg, #1a1714 0%, #0a0908 100%);
  --title-gradient: linear-gradient(135deg, #e8d5a3 0%, #c9a962 45%, #a8863a 100%);
  --tag-bg: rgba(201, 169, 98, 0.12);
  --tag-text: #e8d5a3;
  --badge-bg: rgba(201, 169, 98, 0.18);
  --badge-text: #e8d5a3;
  --highlight-bg: rgba(167, 139, 250, 0.1);
  --highlight-text: #d4c4f0;
  --row-hover: rgba(201, 169, 98, 0.06);
  --btn-hover: rgba(201, 169, 98, 0.12);
  --chart-legend: #a89f92;
  --chart-grid: rgba(201, 169, 98, 0.12);
  --chart-labels: #c9c0b5;
  --chart-ticks: #6b6560;
  --chart-1-bg: rgba(212, 175, 55, 0.28);
  --chart-1-border: #d4af37;
  --chart-2-bg: rgba(34, 211, 238, 0.22);
  --chart-2-border: #22d3ee;
  --chart-3-bg: rgba(244, 114, 182, 0.22);
  --chart-3-border: #f472b6;
  --chart-4-bg: rgba(129, 140, 248, 0.22);
  --chart-4-border: #818cf8;
  --chart-5-bg: rgba(52, 211, 153, 0.22);
  --chart-5-border: #34d399;
  --chart-6-bg: rgba(251, 146, 60, 0.22);
  --chart-6-border: #fb923c;
  --select-arrow: #a89f92;
}

/* ── Luxury light: ivory + bronze ── */
[data-theme="light"] {
  --bg: #f8f5f0;
  --bg-accent: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(154, 123, 79, 0.07), transparent 60%);
  --surface: #ffffff;
  --surface2: #f0ebe3;
  --surface-elevated: #faf8f5;
  --text: #1a1612;
  --muted: #6b635a;
  --accent: #8b6914;
  --accent2: #b8943f;
  --accent-soft: rgba(139, 105, 20, 0.1);
  --accent-glow: rgba(139, 105, 20, 0.25);
  --border: rgba(139, 105, 20, 0.18);
  --border-subtle: rgba(26, 22, 18, 0.06);
  --shadow: 0 12px 36px rgba(26, 22, 18, 0.08);
  --shadow-soft: 0 4px 16px rgba(26, 22, 18, 0.05);
  --header-bg: linear-gradient(165deg, #ffffff 0%, #f0ebe3 100%);
  --title-gradient: linear-gradient(135deg, #6b4f1d 0%, #8b6914 40%, #b8943f 100%);
  --tag-bg: rgba(139, 105, 20, 0.1);
  --tag-text: #6b4f1d;
  --badge-bg: rgba(139, 105, 20, 0.12);
  --badge-text: #8b6914;
  --highlight-bg: rgba(139, 105, 20, 0.08);
  --highlight-text: #5c4520;
  --row-hover: rgba(139, 105, 20, 0.05);
  --btn-hover: rgba(139, 105, 20, 0.08);
  --chart-legend: #6b635a;
  --chart-grid: rgba(139, 105, 20, 0.15);
  --chart-labels: #4a433c;
  --chart-ticks: #9a9288;
  --chart-1-bg: rgba(139, 105, 20, 0.25);
  --chart-1-border: #8b6914;
  --chart-2-bg: rgba(8, 145, 178, 0.2);
  --chart-2-border: #0891b2;
  --chart-3-bg: rgba(190, 24, 93, 0.18);
  --chart-3-border: #be185d;
  --chart-4-bg: rgba(109, 40, 217, 0.18);
  --chart-4-border: #6d28d9;
  --chart-5-bg: rgba(5, 150, 105, 0.2);
  --chart-5-border: #059669;
  --chart-6-bg: rgba(234, 88, 12, 0.2);
  --chart-6-border: #ea580c;
  --select-arrow: #6b635a;
}

:root {
  --radius: 14px;
  --radius-sm: 10px;
  --font-display: "Cormorant Garamond", "Georgia", serif;
  --font-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --transition: 0.22s ease;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark light;
}

[data-theme="dark"] { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  background-image: var(--bg-accent);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  transition: background-color var(--transition), color var(--transition);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
}

/* ── Header ── */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 1.35rem 0 1.1rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-soft);
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.header-brand {
  flex: 1;
  min-width: 0;
}

.site-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--muted);
  margin: 0.35rem 0 1rem;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-soft);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

[data-theme="dark"] .theme-toggle-icon::before { content: "☀"; }
[data-theme="light"] .theme-toggle-icon::before { content: "☾"; }

.nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.nav-link.active,
.nav-link:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-soft);
}

/* ── Panels & inputs ── */
.filters,
.compare-picker,
.compare-summary,
.compare-overlay,
.compare-table-wrap,
.card,
.compare-card {
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.filters,
.compare-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.filters label,
.compare-picker label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 160px;
}

select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Browse cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.15rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-glow);
  box-shadow: var(--shadow);
}

.card img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}

.card-body {
  padding: 1rem 1.1rem 1.15rem;
}

.card-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-meta {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.65rem;
}

/* ── Radar ── */
.radar-wrap {
  position: relative;
  width: 100%;
  flex-shrink: 0;
}

.radar-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.radar-wrap--card {
  height: 200px;
  margin: 0.35rem 0 0.65rem;
}

.radar-wrap--compare {
  height: 240px;
  margin: 0;
}

.radar-wrap--overlay {
  height: 340px;
  margin: 0.5rem 0 0;
}

.muted-inline { color: var(--muted); font-weight: 400; }
.summary-meta { color: var(--muted); margin: 0; }

.section-label {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}

.compare-overlay {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem 1.35rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-soft);
}

.section-hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.section-label--table {
  padding: 1rem 1rem 0;
  margin: 0;
}

.h2h-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.h2h-pickers label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 0;
}

.h2h-pickers select {
  width: 100%;
  max-width: 100%;
}

.overlay-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  padding: 1rem;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px dashed var(--border);
}

.entry-count-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--badge-text);
  background: var(--badge-bg);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.btn-link {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-link:hover {
  background: var(--btn-hover);
  border-color: var(--accent);
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

#compare-all-wrap { margin-top: 1.5rem; }
#compare-all-wrap > .section-label,
#compare-all-wrap > .section-hint { margin-left: 0; }
#compare-by-user-wrap .section-hint {
  padding: 0 1rem 0.75rem;
  margin: 0;
}

.highlights-cell {
  text-align: left !important;
  font-size: 0.82rem;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-table .highlights-cell[title] { cursor: help; }

.avg-badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.highlight-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.highlight-tag {
  font-size: 0.73rem;
  background: var(--highlight-bg);
  color: var(--highlight-text);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border-subtle);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem;
  font-size: 0.95rem;
}

.hidden { display: none !important; }

.compare-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-soft);
}

.compare-summary h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.compare-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  background: var(--surface);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.9rem;
}

.compare-table th,
.compare-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.compare-table thead th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.compare-table tbody tr:hover {
  background: var(--row-hover);
}

.compare-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.15rem;
  align-items: stretch;
}

.compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  min-height: 400px;
  box-shadow: var(--shadow-soft);
}

.compare-card-header {
  flex-shrink: 0;
  min-height: 2.75rem;
  margin-bottom: 0.65rem;
}

.compare-card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.highlight-list--clamp {
  flex-shrink: 0;
  min-height: 1.75rem;
  max-height: 3.6rem;
  overflow: hidden;
}

.compare-card .card-actions { margin-top: auto; }

.user-cell {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.rank-tab {
  color: var(--muted);
  padding: 0.42rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.rank-tab.active,
.rank-tab:hover {
  color: var(--accent);
  border-color: var(--border);
  background: var(--accent-soft);
}

.rank-hint {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rank-item {
  display: grid;
  grid-template-columns: auto 88px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.rank-position {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  padding-top: 0.35rem;
  min-width: 2.5rem;
}

.rank-thumb {
  width: 88px;
  height: 110px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface2);
}

.rank-body {
  min-width: 0;
}

.rank-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
}

.rank-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.rank-key {
  color: var(--muted);
  font-size: 0.85rem;
}

.rank-stat {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.radar-wrap--rank {
  height: 180px;
  max-width: 280px;
  margin-bottom: 0.65rem;
}

.rank-link {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
}

.rank-link:hover {
  text-decoration: underline;
}

.bar-wrap--logger {
  height: 72px;
  max-width: 320px;
  margin-bottom: 0.65rem;
}

.rank-item--user {
  grid-template-columns: auto 88px 1fr;
}

.rank-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

@media (max-width: 600px) {
  .header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: flex-end;
    padding-top: 0;
  }

  .site-header h1 {
    font-size: 1.75rem;
  }

  .filters label,
  .compare-picker label {
    min-width: 100%;
  }

  .h2h-pickers {
    grid-template-columns: 1fr;
  }

  .rank-item {
    grid-template-columns: auto 72px 1fr;
    gap: 0.75rem;
    padding: 0.9rem;
  }

  .rank-thumb {
    width: 72px;
    height: 90px;
  }

  .rank-position {
    font-size: 1.35rem;
  }

  .rank-avatar {
    width: 72px;
    height: 72px;
    font-size: 1.65rem;
  }
}
