:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --text: #111827;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono",
    Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2);
  }
}

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

html {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

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

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

/* Layout */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-header {
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

/* Navigation */
nav.main-nav {
  display: flex;
  gap: 0.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

nav.main-nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

nav.main-nav a:hover {
  background: var(--bg-secondary);
  color: var(--text);
  text-decoration: none;
}

nav.main-nav a.active {
  background: var(--accent);
  color: #fff;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  border-bottom: 2px solid var(--border);
}

th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:hover {
  color: var(--text);
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-secondary);
}

/* Score pills */
.score {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.score-high {
  background: #dcfce7;
  color: #166534;
}

.score-mid {
  background: #fef3c7;
  color: #92400e;
}

.score-low {
  background: #fecaca;
  color: #991b1b;
}

@media (prefers-color-scheme: dark) {
  .score-high {
    background: #064e3b;
    color: #6ee7b7;
  }
  .score-mid {
    background: #78350f;
    color: #fcd34d;
  }
  .score-low {
    background: #7f1d1d;
    color: #fca5a5;
  }
}

/* Weight selector */
.weight-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.weight-selector button,
.weight-selector label {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.weight-selector button:hover,
.weight-selector label:hover {
  border-color: var(--accent);
  color: var(--text);
}

.weight-selector button.active,
.weight-selector label.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Placeholder */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem;
}

/* Rank column */
.rank {
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.rank-1 {
  color: #ca8a04;
}
.rank-2 {
  color: #9ca3af;
}
.rank-3 {
  color: #b45309;
}

/* Table overflow — always allow horizontal scroll */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  th,
  td {
    padding: 0.5rem 0.75rem;
  }
}
