:root {
  --bg: #07090c;
  --panel: #0f1419;
  --line: #1e2833;
  --text: #e8eef5;
  --muted: #8b9aab;
  --accent: #3d8bfd;
  --watch: #1a7f4b;
  --watch-bg: #0d2a1a;
  --cant: #b33a3a;
  --cant-bg: #2a1010;
  --partial: #b8860b;
  --partial-bg: #2a2208;
  --bye: #4a5563;
  --bye-bg: #1a1e24;
  --unknown: #6b7280;
  --unknown-bg: #161a20;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}
body { line-height: 1.45; }

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 18px 48px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #c60c30, #005bbb 55%, #fff 100%);
  box-shadow: 0 0 0 1px #1e2833;
}
h1 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.meta { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.header-side { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}
.pill.muted { color: var(--muted); }

.banner {
  background: #121820;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.affiliates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.aff {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
}
.aff b { color: var(--accent); margin-right: 6px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
  font-size: 0.86rem;
}
.matrix th, .matrix td {
  border-bottom: 1px solid var(--line);
  padding: 10px 10px;
  vertical-align: top;
  text-align: left;
}
.matrix th {
  background: #0c1117;
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
.matrix th.prod { min-width: 150px; }
.week-cell { white-space: nowrap; width: 140px; }
.week-num { font-weight: 700; color: var(--text); }
.week-date, .week-net { color: var(--muted); font-size: 0.78rem; }
.matchup { font-weight: 600; }

.cell {
  border-radius: 8px;
  padding: 8px 9px;
  border: 1px solid transparent;
  min-height: 54px;
}
.cell .status {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.cell .how {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.92;
}
.cell.watch { background: var(--watch-bg); border-color: #1f5c3a; }
.cell.watch .status { color: #3dd68c; }
.cell.cant { background: var(--cant-bg); border-color: #6b2a2a; }
.cell.cant .status { color: #f07178; }
.cell.partial { background: var(--partial-bg); border-color: #6b5410; }
.cell.partial .status { color: #e6c35c; }
.cell.bye { background: var(--bye-bg); border-color: #2d3640; }
.cell.bye .status { color: #9aa5b1; }
.cell.unknown { background: var(--unknown-bg); border-color: #2a313a; }
.cell.unknown .status { color: #a0a8b4; }

.loading { color: var(--muted); padding: 24px !important; text-align: center; }

.counts {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.count-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.count-card h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}
.count-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.82rem; }
.count-row span b { font-weight: 700; }
.c-watch { color: #3dd68c; }
.c-cant { color: #f07178; }
.c-partial { color: #e6c35c; }
.c-bye, .c-unknown { color: var(--muted); }

.sources {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}
.sources ul { margin: 8px 0; padding-left: 18px; }
.fine { margin: 8px 0 0; font-size: 0.78rem; opacity: 0.85; }

@media (max-width: 720px) {
  h1 { font-size: 1.15rem; }
  .matrix { font-size: 0.8rem; }
}

.pill.oom {
  background: #2a1010;
  border-color: #6b2a2a;
  color: #f07178;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}
.pill.oom.hidden,
.hidden { display: none !important; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.field.grow { flex: 1 1 220px; min-width: 180px; }
.field input,
.field select {
  appearance: none;
  background: #0c1117;
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 110px;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: #2d4a73;
  box-shadow: 0 0 0 2px rgba(61, 139, 253, 0.25);
}
.run-btn {
  appearance: none;
  border: none;
  background: #1a2740;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 0 1px #2d4a73;
  height: 40px;
}
.run-btn:hover { background: #223556; }
.example-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: #2d4a73; }
.chip.active {
  background: #1a2740;
  color: var(--text);
  border-color: #2d4a73;
  font-weight: 600;
}

/* Clickable count tiles */
.count-tile {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  user-select: none;
}
.count-tile.clickable {
  cursor: pointer;
  border-color: var(--line);
  background: #0c1117;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.count-tile.clickable:hover {
  border-color: #3a4a5c;
  background: #141b24;
}
.count-tile.clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.count-tile.active {
  box-shadow: 0 0 0 1px var(--accent);
  border-color: #3d8bfd;
  background: #132033;
}
.count-tile.disabled {
  opacity: 0.55;
  cursor: default;
}
.count-tile b { font-weight: 700; }

/* Drilldown panel */
.drilldown {
  margin-top: 14px;
}
.drilldown.hidden { display: none !important; }
.drill-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.drill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.drill-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.drill-close {
  appearance: none;
  border: 1px solid var(--line);
  background: #0c1117;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.drill-close:hover {
  color: var(--text);
  border-color: #3a4a5c;
}
.drill-section { margin-top: 12px; }
.drill-section h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}
.drill-buckets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.drill-buckets li {
  background: #0c1117;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 0.88rem;
}
.bucket-label { font-weight: 600; color: var(--text); }
.bucket-count { color: var(--muted); font-size: 0.82rem; }
.bucket-block {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.bucket-head {
  background: #0c1117;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--line);
}
.drill-games {
  list-style: none;
  margin: 0;
  padding: 0;
}
.drill-games li {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}
.drill-games li:last-child { border-bottom: none; }
.dg-week {
  flex: 0 0 42px;
  font-weight: 700;
  color: var(--accent);
}
.dg-matchup { font-weight: 600; }
.dg-net { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.dg-why { color: var(--text); opacity: 0.88; font-size: 0.8rem; margin-top: 4px; }
.drill-empty { color: var(--muted); font-size: 0.88rem; margin: 0; }

.bucket-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.bucket-kind {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7eb8ff;
  background: rgba(126, 184, 255, 0.12);
  border: 1px solid rgba(126, 184, 255, 0.28);
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 600;
}
.bucket-item.kind-streamer .bucket-label {
  color: #cfe6ff;
}
.bucket-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
