:root {
  --paper: #f7f5f0;
  --ink: #1b1a17;
  --muted: #5e5a53;
  --line: #ddd6c8;
  --link: #1d4e89;
  --good: #1e4d3a;
  --bad: #8d3d32;
  color-scheme: light;
  font-family: "Source Serif 4", Georgia, "Iowan Old Style", serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
a[aria-current="page"] { color: var(--ink); font-weight: 650; text-decoration: none; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.wrap.wide { width: min(1280px, calc(100% - 24px)); }

.table-scroll { overflow-x: auto; }

.history { min-width: 1100px; font-size: 0.84rem; }
.programs { min-width: 1080px; font-size: 0.86rem; }
.history td.rank { text-align: left; }
.history td.rank .rank-mark { color: var(--ink); }
.history td.result .result { font-weight: 500; color: var(--muted); }
.history td.result .result.won { color: var(--good); font-weight: 650; }
.history td.result .result.conf { color: var(--muted); font-weight: 500; margin-left: 0.45em; }
td.faint { color: var(--muted); }
.rank-line {
  display: inline-grid;
  grid-template-columns: 2.5em 2.2em;
  column-gap: 0.3em;
  align-items: baseline;
}
.rank-line .place { text-align: right; }
td.num .rank-line small.chg {
  display: block;
  width: auto;
  margin-left: 0;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
td.num small.chg.up { color: var(--good); }
td.num small.chg.down { color: var(--bad); }

#matches { padding-left: 18px; }
#matches li { margin: 6px 0; }

#site { padding-top: 18px; }

.brand-row {
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
}

.brand {
  color: var(--ink);
  font-weight: 650;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.primary { display: flex; align-items: baseline; gap: 14px; }
.primary a { font-size: 1.05rem; }

select.year {
  font: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--ink);
  background-color: transparent;
  border: 0;
  margin: 0;
  padding: 0 14px 0 0;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231b1a17' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 10px 6px;
}

.search { margin-left: auto; position: relative; }
.search input {
  border: 1px solid var(--line);
  background: white;
  border-radius: 4px;
  padding: 4px 8px;
  width: 180px;
}

.suggest {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  width: 320px;
  padding: 4px 0;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(27, 26, 23, 0.08);
}

.suggest a {
  display: flex;
  gap: 0.5em;
  align-items: baseline;
  padding: 5px 10px;
  color: var(--ink);
}

.suggest a:hover,
.suggest a[aria-selected="true"] {
  background: #f3f0e8;
  text-decoration: none;
}

.suggest .place {
  flex: none;
  width: 2.4em;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.suggest .team {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest small { margin-left: auto; white-space: nowrap; }
.suggest .empty { margin: 0; padding: 6px 10px; color: var(--muted); }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
  font-size: 0.95rem;
}

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

h1 {
  font-size: 2rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 22px 0 4px;
}

.dateline, .lede, .status {
  margin: 0 0 14px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--ink);
}

thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: white;
}

th small {
  display: block;
  margin: 1px 0 0;
  letter-spacing: 0.03em;
  font-size: 0.68rem;
  font-weight: 500;
}

td {
  height: 32px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

.num { text-align: right; }
th.num { text-align: right; }

.team { font-weight: 650; }
td small, .sub {
  display: inline;
  margin-left: 0.4em;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

td.team small {
  display: block;
  margin-left: 0;
  font-size: 0.75rem;
}

.good { background: rgba(22, 92, 58, 0.1); }
.bad { background: rgba(148, 58, 46, 0.1); }

tbody tr:hover td {
  background-image: linear-gradient(rgba(27, 26, 23, 0.045), rgba(27, 26, 23, 0.045));
}

.lv-1a { color: #1d4e89; }
.lv-1aa { color: #1e4d3a; }
.lv-dii { color: #8a5a12; }
.lv-diii { color: #5c4d73; }
.lv-naia { color: #3d5c56; }
a.lv-1a[aria-current="page"] { color: #1d4e89; font-weight: 650; }
a.lv-1aa[aria-current="page"] { color: #1e4d3a; font-weight: 650; }
a.lv-dii[aria-current="page"] { color: #8a5a12; font-weight: 650; }
.rank-mark small.lv-1a, .postseason small.lv-1a { color: #1d4e89; font-weight: 650; }
.rank-mark small.lv-1aa, .postseason small.lv-1aa { color: #1e4d3a; font-weight: 650; }
.rank-mark small.lv-dii, .postseason small.lv-dii { color: #8a5a12; font-weight: 650; }
.rank-mark small.lv-diii, .postseason small.lv-diii { color: #5c4d73; font-weight: 650; }
.rank-mark small.lv-naia, .postseason small.lv-naia { color: #3d5c56; font-weight: 650; }
.rank-mark small.division {
  color: var(--muted);
  font-weight: 500;
}
.division-rank {
  color: var(--muted);
  font-size: 0.55em;
  font-weight: 500;
  letter-spacing: 0;
  margin-right: 0.35em;
}
th.division, td.division { text-align: center; }
td.division { font-weight: 650; }
td.division.lv-1a { background: #d4e3f4; }
td.division.lv-1aa { background: #d3eadb; }
td.division.lv-dii { background: #f3e3c4; }
th.away, td.away { text-align: right; }
td.away .rank-mark { margin-left: 0.55em; }
td.home .rank-mark { margin-right: 0.55em; }
td.away .team, td .team { font-weight: 650; }
th.score, td.score { text-align: center; }
td.pick small { display: block; margin-left: 0; }

.band { text-align: center; color: var(--ink); }

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.section { margin: 8px 0 28px; min-width: 0; overflow-x: auto; }
.section h2 {
  font-size: 1.25rem;
  margin: 0 0 8px;
}

.rank-mark {
  display: inline-grid;
  grid-template-columns: 2.7em 1.8em;
  column-gap: 0.28em;
  align-items: baseline;
  justify-items: end;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: baseline;
}
.rank-mark.labeled { grid-template-columns: 2.7em 1.8em 3em; }
.rank-mark small.level { justify-self: start; }
td.rank {
  color: var(--ink);
  text-align: right;
}
td.rank .rank-mark small,
.opp .rank-mark small,
.rank-mark small {
  display: block;
  margin-left: 0;
  font-size: 0.72rem;
}
.opp .rank-mark { margin-right: 0.55em; }

.scouting { font-size: 0.9rem; }
.scouting td:first-child { color: var(--ink); }
tr.here td { background: #f3f0e8; }

tr.total td {
  border-top: 2px solid var(--ink);
  font-weight: 650;
}
tr.total td.label {
  color: var(--muted);
  font-weight: 500;
}

tr.event td {
  height: 34px;
  text-align: center;
  font-weight: 650;
  background: #f3f0e8;
  border-bottom: 1px solid var(--line);
}

tr.projected td {
  height: auto;
  padding: 8px;
  text-align: center;
  white-space: normal;
  color: var(--muted);
}

.scouting .group td {
  height: 26px;
  background: #f3f0e8;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 650;
}

.choices { display: flex; gap: 12px; margin: 0 0 8px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.foot {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 28px;
}

@media (max-width: 800px) {
  .team-grid { grid-template-columns: 1fr; }
  .search { margin-left: 0; }
}
