:root {
  --bg: #0f1216;
  --bg-elevated: #171b21;
  --bg-hover: #1f2530;
  --border: #2a3038;
  --text: #eef1f5;
  --text-dim: #9aa4b2;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.15);
  --qb: #f87171;
  --rb: #4ade80;
  --wr: #60a5fa;
  --te: #fbbf24;
  --k: #a78bfa;
  --def: #2dd4bf;
  --fanduel: #1493ff;
  --draftkings: #53d337;
  --draftkings-ink: #04140a;
  --radius: 10px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --bg-elevated: #ffffff;
    --bg-hover: #eef1f5;
    --border: #dde1e6;
    --text: #14181f;
    --text-dim: #5b6472;
    --accent: #16a34a;
    --accent-dim: rgba(22, 163, 74, 0.12);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

header.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

h1 {
  font-size: 1.6rem;
  margin: 0;
  letter-spacing: -0.02em;
}

h1 span { color: var(--accent); }

.subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 4px 0 24px;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: center;
}

.search {
  flex: 1 1 220px;
  position: relative;
}

.search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
}

.pos-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pos-btn {
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pos-btn:hover { background: var(--bg-hover); color: var(--text); }

.pos-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.count {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

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

thead th.sorted { color: var(--accent); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

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

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

td {
  padding: 11px 14px;
  font-size: 0.92rem;
}

td.rank {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  width: 50px;
}

td.name { font-weight: 600; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.QB { background: rgba(248, 113, 113, 0.15); color: var(--qb); }
.badge.RB { background: rgba(74, 222, 128, 0.15); color: var(--rb); }
.badge.WR { background: rgba(96, 165, 250, 0.15); color: var(--wr); }
.badge.TE { background: rgba(251, 191, 36, 0.15); color: var(--te); }
.badge.K { background: rgba(167, 139, 250, 0.15); color: var(--k); }
.badge.DEF { background: rgba(45, 212, 191, 0.15); color: var(--def); }

td.team { color: var(--text-dim); font-variant-numeric: tabular-nums; }
td.tier { color: var(--text-dim); font-size: 0.85rem; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

footer {
  margin-top: 24px;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-align: center;
}

.sponsored {
  background: linear-gradient(135deg, rgba(20, 147, 255, 0.14), rgba(20, 147, 255, 0.02));
  border: 1px solid rgba(20, 147, 255, 0.35);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.sponsored .ad-label {
  flex-basis: 100%;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 2px;
}

.sponsored .fd-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--fanduel);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  flex: 0 0 auto;
}

.sponsored .body { flex: 1 1 220px; }
.sponsored .body h4 { margin: 0 0 4px; font-size: 0.98rem; color: var(--text); }
.sponsored .body p { margin: 0; color: var(--text-dim); font-size: 0.84rem; line-height: 1.4; }

.btn-fanduel {
  background: var(--fanduel);
  color: #fff;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}

.btn-fanduel:hover { background: #0f7fe0; }

.sponsored.dk {
  background: linear-gradient(135deg, rgba(83, 211, 55, 0.16), rgba(83, 211, 55, 0.02));
  border-color: rgba(83, 211, 55, 0.4);
}

.sponsored .dk-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--draftkings);
  color: var(--draftkings-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  flex: 0 0 auto;
}

.btn-draftkings {
  background: var(--draftkings);
  color: var(--draftkings-ink);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}

.btn-draftkings:hover { background: #46bd2c; }

.sponsored .fine-print {
  flex-basis: 100%;
  color: var(--text-dim);
  font-size: 0.68rem;
  line-height: 1.4;
  margin-top: 2px;
}

@media (max-width: 640px) {
  td.tier { display: none; }
  th[data-key="tier"] { display: none; }
}
