:root {
  color-scheme: dark;
  --ink: #e6edf5;
  --muted: #9aa9ba;
  --line: #243244;
  --panel: #111a26;
  --page: #0a1018;
  --topbar: #0d1520;
  --control: #0d1621;
  --control-line: #344255;
  --thead: #162231;
  --hover: #142131;
  --accent: #38bdf8;
  --accent-ink: #082f49;
  --gold: #f2c94c;
  --danger: #fda4af;
  --verified-bg: #123b35;
  --verified-ink: #a7f3d0;
  --unverified-bg: #481724;
  --unverified-ink: #fecdd3;
}

[data-theme="light"] {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #657282;
  --line: #d7dee7;
  --panel: #ffffff;
  --page: #f4f7fa;
  --topbar: #ffffff;
  --control: #ffffff;
  --control-line: #b9c3cf;
  --thead: #eef4f5;
  --hover: #f7faf9;
  --accent: #0f766e;
  --accent-ink: #073b36;
  --gold: #b7791f;
  --danger: #9f1239;
  --verified-bg: #dff6ef;
  --verified-ink: #073b36;
  --unverified-bg: #ffe5eb;
  --unverified-ink: #9f1239;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.source-meta span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.22);
}

.theme-icon {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.36);
}

[data-theme="light"] .theme-icon {
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
}

main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px clamp(12px, 3vw, 32px) 48px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary div {
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary span,
label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.summary strong {
  font-size: 1.75rem;
  line-height: 1.1;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--control-line);
  border-radius: 6px;
  background: var(--control);
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.board {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--thead);
  color: var(--ink);
  font-size: 0.75rem;
  text-transform: uppercase;
}

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

.place {
  color: var(--gold);
  font-weight: 800;
}

.rsn {
  font-weight: 800;
}

.rank-icon {
  display: block;
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.verified {
  background: var(--verified-bg);
  color: var(--verified-ink);
}

.unverified {
  background: var(--unverified-bg);
  color: var(--unverified-ink);
}

.empty {
  margin: 0;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-meta {
    justify-content: flex-start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .summary,
  .controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .summary,
  .controls {
    grid-template-columns: 1fr;
  }

  .summary div {
    min-height: 76px;
  }
}
