:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #16191d;
  --muted: #69717d;
  --accent: #1f6f4a;
  --accent-soft: #e3f1ea;
  --good: #1f7a4d;
  --bad: #b3261e;
  --warn: #9a6700;
  --qb: #c2410c;
  --rb: #0f766e;
  --wr: #1d4ed8;
  --te: #7e22ce;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --surface: #171a1f;
    --border: #2a2f37;
    --text: #e8eaed;
    --muted: #9aa2ad;
    --accent: #4fbf87;
    --accent-soft: #17352a;
    --good: #4fbf87;
    --bad: #f2867d;
    --warn: #e5b74d;
    --qb: #fb923c;
    --rb: #2dd4bf;
    --wr: #7aa2ff;
    --te: #c084fc;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

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

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

a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--muted);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-header nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.site-header nav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
}

.site-header nav a.active,
.site-header nav a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.player-search {
  position: relative;
  margin-left: auto;
  width: min(260px, 100%);
}

input,
select,
button {
  font: inherit;
  color: inherit;
}

input[type="search"],
input[type="text"],
select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

button {
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--accent);
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  max-height: 320px;
  overflow-y: auto;
}

.search-results li a,
.search-results li button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}

.search-results li a:hover,
.search-results li button:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -0.02em;
}

h2 {
  margin: 28px 0 10px;
  font-size: 18px;
}

.lede {
  margin: 0 0 18px;
  color: var(--muted);
}

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

.controls label {
  display: grid;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.controls select,
.controls input {
  min-width: 130px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text);
  font-size: 15px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--muted);
}

.segmented button.on {
  background: var(--accent);
  color: #fff;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: default;
}

th[data-sort] {
  cursor: pointer;
}

th[data-sort]:hover {
  color: var(--text);
}

th.text,
td.text {
  text-align: left;
}

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

tbody tr:last-child td {
  border-bottom: 0;
}

tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--border);
}

.pos {
  display: inline-block;
  min-width: 40px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: #fff;
}

.pos.QB {
  background: var(--qb);
}

.pos.RB {
  background: var(--rb);
}

.pos.WR {
  background: var(--wr);
}

.pos.TE {
  background: var(--te);
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid currentColor;
}

.tag.out {
  color: var(--bad);
}

.tag.q {
  color: var(--warn);
}

.tag.bye {
  color: var(--muted);
}

.range {
  position: relative;
  width: 110px;
  height: 8px;
  border-radius: 4px;
  background: var(--border);
}

.range span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  background: var(--accent);
  opacity: 0.55;
}

.range i {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--text);
}

.stat {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.profile-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
}

.trade {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.trade ul {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.trade li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.remove {
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 18px;
}

.verdict {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 700;
}

.good {
  color: var(--good);
}

.bad {
  color: var(--bad);
}

.notice {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  margin-bottom: 14px;
}

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 32px;
  font-size: 13px;
}

@media (max-width: 640px) {
  .player-search {
    width: 100%;
    margin-left: 0;
  }

  th,
  td {
    padding: 7px 8px;
  }

  .hide-sm {
    display: none;
  }
}
