/* Anytime TD board — tokens and measurements from the Claude Design handoff. */
:root {
  --bg: #f4f1ec;
  --panel: #fffdf9;
  --panel2: #faf7f2;
  --band: #efeae2;
  --hover: #f7f4ee;
  --hover2: #f2eee6;
  --ink: #221f1b;
  --ink2: #3b362e;
  --ink3: #6e675c;
  --ink4: #9b9285;
  --line1: rgba(34, 31, 27, 0.07);
  --line2: rgba(34, 31, 27, 0.11);
  --line3: rgba(34, 31, 27, 0.17);
  --line4: rgba(34, 31, 27, 0.22);
  --line5: rgba(34, 31, 27, 0.34);
  --track: rgba(34, 31, 27, 0.08);
  --pos: #3f6b52;
  --pos-hover: #2c4d3a;
  --neg: #8a4433;
  --accent: #b4573a;
  --live: #5c8a6b;
  --thumb: #cec6ba;
  --thumb-hover: #b8ae9f;
  --edge: #3f6b52;
}

:root[data-theme="dark"] {
  --bg: #141210;
  --panel: #1d1a15;
  --panel2: #191713;
  --band: #272219;
  --hover: #252118;
  --hover2: #211e17;
  --ink: #f3eee5;
  --ink2: #ddd6ca;
  --ink3: #a89f91;
  --ink4: #7e7768;
  --line1: rgba(243, 238, 229, 0.09);
  --line2: rgba(243, 238, 229, 0.13);
  --line3: rgba(243, 238, 229, 0.2);
  --line4: rgba(243, 238, 229, 0.24);
  --line5: rgba(243, 238, 229, 0.36);
  --track: rgba(243, 238, 229, 0.12);
  --pos: #84c39a;
  --pos-hover: #a3d6b3;
  --neg: #e0907a;
  --accent: #dd7b53;
  --live: #84c39a;
  --thumb: #3b352b;
  --thumb-hover: #4c4537;
  --edge: color-mix(in oklab, #3f6b52 55%, #ffffff);
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Archivo, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

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

input::placeholder {
  color: var(--ink4);
}

@keyframes softPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
::-webkit-scrollbar-track {
  background: var(--band);
}
::-webkit-scrollbar-thumb {
  background: var(--thumb);
  border-radius: 7px;
  border: 3px solid var(--band);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--thumb-hover);
}

.page {
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 70px;
}

/* ---- Header ------------------------------------------------------------- */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line2);
}

.topbar-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex: none;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.wordmark {
  font: 500 21px/1 Newsreader, Georgia, serif;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-divider {
  flex: none;
  width: 1px;
  height: 20px;
  background: var(--line2);
}

.week {
  font: 400 13px/1 Archivo, sans-serif;
  color: var(--ink3);
  white-space: nowrap;
}

.grow {
  flex: 1;
}

.live {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.live-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  animation: softPulse 3s ease-in-out infinite;
}

.live-label {
  font: 400 13px/1 Archivo, sans-serif;
  color: var(--ink3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line4);
  background: none;
  color: var(--ink2);
  cursor: pointer;
}

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

:root[data-theme="dark"] .icon-sun,
:root:not([data-theme="dark"]) .icon-moon {
  display: none;
}

/* ---- Title block -------------------------------------------------------- */
.content {
  max-width: 1500px;
  margin: 0 auto;
  padding: 30px 28px 0;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.intro-copy {
  max-width: 620px;
}

h1 {
  margin: 0;
  font: 500 32px/1.1 Newsreader, Georgia, serif;
  letter-spacing: -0.015em;
}

.stats {
  display: flex;
  gap: 30px;
  align-items: flex-end;
}

.stat-label {
  font: 400 12px/1 Archivo, sans-serif;
  color: var(--ink3);
  margin-bottom: 7px;
}

.stat-value {
  font: 500 26px/1 Newsreader, Georgia, serif;
}

.stat-value.pos {
  color: var(--pos);
}

.stat-divider {
  width: 1px;
  height: 34px;
  background: var(--line2);
}

/* ---- Card --------------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(34, 31, 27, 0.05), 0 14px 40px -28px rgba(34, 31, 27, 0.35);
}

.filters {
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line2);
}

.field {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line4);
  background: var(--panel2);
  color: var(--ink);
  outline: none;
}

.field:focus {
  border-color: var(--live);
  background: var(--panel);
}

.search {
  flex: 1 1 220px;
  max-width: 300px;
  padding: 0 13px;
  font: 400 14px/1 Archivo, sans-serif;
}

.odds-cap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.odds-cap-label,
.books-label {
  font: 400 13px/1 Archivo, sans-serif;
  color: var(--ink3);
}

.odds-cap .field {
  width: 88px;
  padding: 0 11px;
  font: 500 13.5px/1 Archivo, sans-serif;
}

.team-select {
  padding: 0 34px 0 11px;
  font: 500 13.5px/1 Archivo, sans-serif;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239b9285' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}

/* Native dropdown lists follow the page theme. */
:root {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

.reset {
  height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--ink3);
  font: 500 13px/1 Archivo, sans-serif;
  cursor: pointer;
}

.reset:hover {
  color: var(--ink);
  border-color: var(--line4);
}

.books {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line2);
  background: var(--panel2);
}

/* Collapsible Books + Positions drawer. The grid-row trick animates to the content's own height. */
.drawer-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* Open drawer: the button keeps its hover look so it reads as "on". */
.drawer-toggle[aria-expanded="true"] {
  color: var(--ink);
  border-color: var(--line4);
}

/* Dot on the Filter button while any book or position is switched off. */
.filter-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.filter-drawer {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.2s ease;
}

.filter-drawer.collapsed {
  grid-template-rows: 0fr;
}

.filter-drawer-inner {
  min-height: 0;
  overflow: hidden;
}

/* Same label width on the Books and Positions rows so their pills start in one column. */
.books .books-label {
  flex: none;
  min-width: 96px;
}

.book-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 13px 0 11px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--line2);
  background: transparent;
}

.pill input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--pos);
  cursor: pointer;
}

.pill-label {
  font: 500 13px/1 Archivo, sans-serif;
  color: var(--ink3);
}

.pill.on {
  background: var(--panel);
  border-color: var(--line4);
}

.pill.on .pill-label {
  color: var(--ink);
}

.pill:hover {
  border-color: var(--line5);
}

.book-actions {
  display: flex;
  gap: 4px;
  flex: none;
  margin-left: auto;
}

.text-btn {
  background: none;
  border: none;
  color: var(--ink3);
  font: 500 13px/1 Archivo, sans-serif;
  cursor: pointer;
  padding: 6px;
}

.text-btn:hover {
  color: var(--ink);
}

/* ---- Table -------------------------------------------------------------- */
.table-scroll {
  max-height: calc(100vh - 300px);
  min-height: 440px;
  overflow: auto;
}

.board {
  width: 100%;
  min-width: 770px;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.board th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--line3);
  padding: 8px 6px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  font: 500 12.5px/1 Archivo, sans-serif;
  color: var(--ink3);
}

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

.board th.active,
.board th:hover {
  color: var(--ink);
}

.board td {
  padding: 0 6px;
  border-bottom: 1px solid var(--line1);
}

.board tbody tr.play {
  height: 34px;
}

.board tbody.edge tr.play:hover {
  background: var(--hover);
}

.board tbody.flat tr.play {
  background: var(--panel2);
}

.board tbody.flat tr.play:hover {
  background: var(--hover2);
}

.player {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Team logo slot (placeholder until artwork lands); --h is the team hue. */
.logo-slot {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: oklch(0.9 0.045 var(--h));
  border: 1px dashed currentColor;
  font: 600 8.5px/1 Archivo, sans-serif;
  letter-spacing: 0.02em;
  color: oklch(0.4 0.08 var(--h));
}

.team-logo {
  flex: none;
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

:root[data-theme="dark"] .logo-slot {
  background: oklch(0.28 0.045 var(--h));
  color: oklch(0.82 0.07 var(--h));
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.player-name {
  font: 500 13px/1 Archivo, sans-serif;
  white-space: nowrap;
}

.player-sub,
.kickoff {
  font: 400 11px/1 Archivo, sans-serif;
  color: var(--ink3);
  white-space: nowrap;
}

.board td.matchup {
  white-space: nowrap;
}

.matchup-text {
  font: 400 12.5px/1 Archivo, sans-serif;
  color: var(--ink2);
}

.board td.proj {
  text-align: right;
  font: 400 12.5px/1 Archivo, sans-serif;
  color: var(--ink2);
}

.board td.price {
  text-align: right;
  font: 500 14px/1 Newsreader, Georgia, serif;
}

.board td.book {
  white-space: nowrap;
}

/* --book-shift is set by board.js so the Book column sits centered between its neighbors. */
.board th[data-sort="book"] .th-label {
  display: inline-block;
  transform: translateX(var(--book-shift, 0px));
}

.book-tag {
  transform: translateX(var(--book-shift, 0px));
  display: inline-flex;
  vertical-align: middle;
  align-items: center;
  gap: 6px;
  font: 400 12px/1 Archivo, sans-serif;
  color: var(--ink2);
}

.book-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: oklch(0.62 0.1 var(--h));
}

:root[data-theme="dark"] .book-dot {
  background: oklch(0.72 0.1 var(--h));
}

.board td.floor {
  text-align: right;
  font: 500 13.5px/1 Newsreader, Georgia, serif;
  color: var(--ink);
}

.board td.model {
  text-align: right;
  font: 500 12.5px/1 Archivo, sans-serif;
  color: var(--ink3);
}

.board td.implied {
  text-align: right;
  font: 400 12.5px/1 Archivo, sans-serif;
  color: var(--ink3);
}

.board td.edge-cell {
  padding: 0 10px 0 5px;
}

.board tbody.flat td.edge-cell {
  text-align: right;
}

.edge-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.edge-track {
  flex: none;
  width: 42px;
  height: 5px;
  border-radius: 4px;
  background: var(--track);
  overflow: hidden;
}

.edge-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--edge);
}

.edge-num {
  flex: none;
  white-space: nowrap;
  font: 500 14px/1 Newsreader, Georgia, serif;
  color: var(--edge);
}

.edge-num.neg {
  color: var(--neg);
}

.board td.band {
  padding: 0;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  background: var(--band);
}

.band-inner {
  padding: 8px 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.band-label {
  font: 500 13.5px/1.2 Newsreader, Georgia, serif;
  color: var(--ink);
}

.empty {
  padding: 64px 20px;
  text-align: center;
}

.empty-title {
  font: 500 18px/1.3 Newsreader, Georgia, serif;
  margin-bottom: 8px;
}

.empty-body {
  font: 400 13.5px/1.5 Archivo, sans-serif;
  color: var(--ink3);
}

.card-foot {
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line2);
  background: var(--panel2);
}

.card-foot span {
  font: 400 12.5px/1.5 Archivo, sans-serif;
  color: var(--ink3);
}

/* The handoff leaves phones out of scope; these only keep narrow screens from overflowing. */
@media (max-width: 640px) {
  .topbar-inner,
  .content {
    padding-left: 16px;
    padding-right: 16px;
  }
  .topbar-inner {
    gap: 12px;
  }
  .stats {
    gap: 18px;
    flex-wrap: wrap;
  }
}
