/* =========================================================
   Design tokens — matches tatermetrics.com / mlb / nfl pages
   ========================================================= */
:root {
  /* Brand */
  --color-primary: #1e5fa8;
  --color-primary-dark: #154480;
  --color-primary-light: #dbeafe;

  /* Surfaces */
  --color-bg: #f3f4f6;
  --color-surface: #ffffff;
  --color-header-bg: #1a2e4a;
  --color-banner-bg: #2e4a7a;
  --color-banner-text: #b5d4f4;

  /* Text */
  --color-text: #1f2937;
  --color-heading: #111827;
  --color-muted: #6b7280;

  /* Form / border */
  --color-border: #d1d5db;
  --color-input-bg: #ffffff;

  /* Table */
  --color-table-head-bg: #f9fafb;
  --color-table-row-hover: #f0f4ff;

  /* Status */
  --color-error: #dc2626;
  --color-green-bg: #dcfce7;
  --color-green-text: #166534;
  --color-amber-bg: #fef3c7;
  --color-amber-text: #92400e;
  --color-red-bg: #fee2e2;
  --color-red-text: #991b1b;

  /* NIL comparison bars */
  --color-bar-a: #1e5fa8;
  --color-bar-b: #d97706;

  /* Betting-odds comparison bars — washed-out echoes of the NIL blue/orange,
     so the odds bar reads as "the same idea, quieter" rather than a clashing
     new palette */
  --color-odds-a: #8fa8c6;
  --color-odds-b: #d3a874;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a, button {
  touch-action: manipulation;
}

/* =========================================================
   Header
   ========================================================= */
.header {
  background: var(--color-header-bg);
  color: #fff;
}

.headerInner {
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brandBtn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  margin-left: -0.6rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}

.brandBtn:link, .brandBtn:visited, .brandBtn:hover, .brandBtn:active {
  color: #fff;
  text-decoration: none;
}

.brandBtn:hover, .brandBtn:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.brandIcon {
  font-size: 1.5rem;
  color: #fbbf24;
  flex-shrink: 0;
}

.brandLogo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

.brandName {
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  color: #fff;
}

.headerDivider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.titleIcon {
  font-size: 1.6rem;
  color: #fbbf24;
  flex-shrink: 0;
}

.titleLogo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: contain;
}

.titleBlock {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.title {
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   Main / intro
   ========================================================= */
.main {
  max-width: 1150px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  flex: 1;
}

.introCard {
  margin-bottom: 1.25rem;
}

.introTitle {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 0.4rem;
}

.introText {
  color: var(--color-muted);
  font-size: 0.88rem;
  max-width: 760px;
}

.introText + .introText {
  margin-top: 0.5rem;
}

/* =========================================================
   Controls
   ========================================================= */
.controlsBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.tabPillGroup {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tabPill {
  padding: 0.4rem 0.9rem;
  font-size: 0.83rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  color: var(--color-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.tabPill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tabPill.active {
  background: var(--color-banner-bg);
  border-color: var(--color-banner-bg);
  color: #fff;
}

/* =========================================================
   Team search
   ========================================================= */
.searchBar {
  position: relative;
  margin-bottom: 1rem;
  max-width: 320px;
}

.searchIcon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.teamSearchInput {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.1rem;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
}

.teamSearchInput:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.teamSearchInput::-webkit-search-cancel-button {
  cursor: pointer;
}

/* =========================================================
   Live score status bar
   ========================================================= */
.liveBar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  color: var(--color-muted);
}

.liveDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
  transition: background 0.2s;
}

.liveDot.isFetching {
  background: #f59e0b;
  animation: liveDotPulse 1s ease-in-out infinite;
}

@keyframes liveDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.liveRefreshBtn {
  margin-left: auto;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.liveRefreshBtn:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.liveRefreshBtn:disabled { opacity: 0.55; cursor: default; }

/* =========================================================
   Week selector
   ========================================================= */
.weekBar {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

.weekPill {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.weekPill .weekPillSub {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.weekPill:hover {
  border-color: var(--color-primary);
}

.weekPill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.weekPill.active .weekPillSub {
  color: rgba(255, 255, 255, 0.75);
}

.weekPill.isCurrent:not(.active) {
  border-color: var(--color-primary);
}

.weekPill.isLive:not(.active) {
  border-color: #dc2626;
}

.weekPill.isLive .weekPillSub {
  color: #dc2626;
  font-weight: 700;
}

.weekPill.active.isLive .weekPillSub {
  color: #fecaca;
}

/* =========================================================
   Game cards
   ========================================================= */
.gamesList {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
}

.gameCard {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  padding: 0.9rem 1.1rem;
}

.gameMeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.72rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.gameMeta .gameVenue {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.matchupGrid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.matchupSide {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.matchupSide.sideB {
  text-align: right;
  align-items: flex-end;
}

.matchupTeamRow {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.matchupSide.sideB .matchupTeamRow {
  flex-direction: row-reverse;
}

.matchupTeamName {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-heading);
}

.matchupRankBadge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  flex-shrink: 0;
}

.matchupScore {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-heading);
  min-width: 2.5rem;
  text-align: center;
}

.matchupScore .scoreSep {
  color: var(--color-muted);
  font-weight: 400;
  font-size: 0.9rem;
  padding: 0 0.15rem;
}

.matchupAt {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-muted);
  text-align: center;
}

.resultPill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  margin-top: 0.1rem;
}

.resultPill.win { background: var(--color-green-bg); color: var(--color-green-text); }
.resultPill.loss { background: var(--color-red-bg); color: var(--color-red-text); }
.resultPill.live {
  background: var(--color-amber-bg);
  color: var(--color-amber-text);
  animation: liveDotPulse 1.6s ease-in-out infinite;
}

.nilValueLabel {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.matchupSide.sideB .nilValueLabel {
  flex-direction: row-reverse;
}

.nilValueAmount {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.nilValueCaption {
  font-size: 0.66rem;
  color: var(--color-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nilValueLabel.untracked {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
  font-style: italic;
  opacity: 0.7;
}

/* Comparison bar beneath each matchup */
.nilCompare {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--color-border);
}

.nilCompareBar {
  display: flex;
  align-items: center;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--color-table-head-bg);
}

.nilCompareBar .barA,
.nilCompareBar .barB {
  height: 100%;
}

.nilCompareBar .barA { background: var(--color-bar-a); }
.nilCompareBar .barB { background: var(--color-bar-b); }

.nilCompareLabels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  font-weight: 800;
}

.nilCompareLabels .labelA { color: var(--color-bar-a); }
.nilCompareLabels .labelB { color: var(--color-bar-b); }

/* Betting-odds comparison bar beneath the NIL one — same layout, own colorscheme */
.oddsCompare {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--color-border);
}

.oddsCompareBar {
  display: flex;
  align-items: center;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--color-table-head-bg);
}

.oddsCompareBar .barC,
.oddsCompareBar .barD {
  height: 100%;
}

.oddsCompareBar .barC { background: var(--color-odds-a); }
.oddsCompareBar .barD { background: var(--color-odds-b); }

.oddsCompareLabels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  font-weight: 800;
}

.oddsCompareLabels .labelC { color: var(--color-odds-a); }
.oddsCompareLabels .labelD { color: var(--color-odds-b); }

.oddsCompareCaption {
  font-size: 0.62rem;
  color: var(--color-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.noGamesNote {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* =========================================================
   Table (NIL rankings)
   ========================================================= */
.tableCard {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

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

table.qbTable {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
}

table.qbTable th,
table.qbTable td {
  padding: 0.5rem 0.65rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

table.qbTable thead th {
  background: var(--color-table-head-bg);
  color: var(--color-muted);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--color-border);
  position: sticky;
  top: 0;
}

table.qbTable thead th[data-key] {
  cursor: pointer;
  user-select: none;
}

table.qbTable thead th[data-key]:hover { color: var(--color-primary); }

table.qbTable thead th.sorted { color: var(--color-primary); }

table.qbTable thead th .sortArrow {
  display: inline-block;
  font-size: 0.6rem;
  margin-left: 0.2rem;
  opacity: 0.35;
  width: 0.7em;
}

table.qbTable thead th.sorted .sortArrow { opacity: 1; }

table.qbTable tbody tr:hover { background: var(--color-table-row-hover); }

table.qbTable td.rankCell,
table.qbTable th.rankCell {
  text-align: center;
  color: var(--color-muted);
  font-weight: 700;
  width: 2.5rem;
}

table.qbTable td.nameCell,
table.qbTable th.nameCell {
  text-align: left;
  font-weight: 700;
  color: var(--color-heading);
  position: sticky;
  left: 0;
  background: var(--color-surface);
}

table.qbTable tbody tr:hover td.nameCell { background: var(--color-table-row-hover); }

table.qbTable .teamTag {
  font-weight: 600;
  color: var(--color-muted);
  font-size: 0.75rem;
  margin-left: 0.3rem;
}

table.qbTable .teamTag.liveTag {
  color: var(--color-amber-text);
  font-weight: 700;
}

.nilBarCell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

.nilBarTrack {
  width: 90px;
  height: 8px;
  border-radius: 4px;
  background: var(--color-table-head-bg);
  overflow: hidden;
  flex-shrink: 0;
}

.nilBarFill {
  height: 100%;
  background: var(--color-bar-a);
  border-radius: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
}

.pillConf { background: var(--color-primary-light); color: var(--color-primary-dark); }
.pillConf.conf-sec { background: #e0d4f7; color: #4c1d95; }
.pillConf.conf-big-ten { background: #d9e8f5; color: #1e3a5f; }
.pillConf.conf-big-12 { background: #fde8d4; color: #9a3412; }
.pillConf.conf-acc { background: #fce8ef; color: #9d174d; }
.pillConf.conf-pac-12 { background: #d4f0ea; color: #0f5d4e; }
.pillConf.conf-american { background: #fdf3c7; color: #78350f; }
.pillUp { background: var(--color-green-bg); color: var(--color-green-text); }
.pillDown { background: var(--color-red-bg); color: var(--color-red-text); }
.pillFlat { background: var(--color-table-head-bg); color: var(--color-muted); }

/* =========================================================
   Footnotes / methodology
   ========================================================= */
.footnoteCard {
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  padding: 1rem 1.2rem;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  color: var(--color-muted);
}

.footnoteCard h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 0.5rem;
}

.footnoteCard p { margin-bottom: 0.5rem; }
.footnoteCard p:last-child { margin-bottom: 0; }
.footnoteCard a { color: var(--color-primary); }

/* =========================================================
   Footer
   ========================================================= */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-wrap: wrap;
  text-align: center;
}

.footerLink {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.footerLink:hover { text-decoration: underline; }

.sep { color: var(--color-border); }

@media (max-width: 640px) {
  .title { font-size: 0.95rem; }
  .subtitle { display: none; }
  .brandName { display: none; }
  .main { padding: 1.25rem 0.85rem 2rem; }
  table.qbTable { font-size: 0.78rem; }
  table.qbTable th, table.qbTable td { padding: 0.4rem 0.45rem; }
  .matchupTeamName { font-size: 0.88rem; }
  .matchupScore { font-size: 1.05rem; }
  .nilValueAmount { font-size: 1.1rem; }
  .nilCompareLabels { font-size: 0.75rem; }
  .oddsCompareLabels { font-size: 0.75rem; }
  .nilBarTrack { width: 50px; }
}
