/*
 * Visual language borrows from ESPN's scoreboard so it reads as familiar:
 * light ground, white cards, hairline rules, one red accent, small uppercase
 * labels, right-aligned tabular scores with the leader in bold.
 *
 * Everything decorative is deliberately absent. Colour carries exactly one
 * meaning — red means "happening now / pay attention" — and hierarchy comes
 * from type weight and whitespace instead of fills, borders and badges.
 */

:root {
  --bg: #0b0b0d;
  --surface: #141519;
  --line: #26272c;
  --line-soft: #1d1e22;
  --text: #f0f1f3;
  --muted: #9096a0;
  --faint: #676c75;
  --accent: #ff4137; /* the one colour, used only for "happening now" */
  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 700; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }

/*
 * Navigation between boards, not a control over one. The board you are on is
 * marked with a rule rather than a larger size, because changing the size moves
 * every other item when you switch.
 *
 * Wide: the wordmark and every board in a row. Narrow: the mark alone, and the
 * boards behind a button — nine of them scrolling sideways meant the one you
 * were on could sit off the edge of the screen.
 */
.sports { display: flex; align-items: center; gap: 4px; min-width: 0; position: relative; }

.home { display: inline-flex; align-items: center; padding: 4px 14px 4px 0; }
.logo-full, .logo-mark { height: 17px; width: auto; display: block; }
.logo-mark { display: none; }

.menu-toggle {
  display: none;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 9px;
}
.menu-toggle .caret { color: var(--faint); font-size: 9px; }
.menu-toggle[aria-expanded='true'] { border-color: var(--faint); }

.menu-list { display: flex; align-items: center; gap: 4px; min-width: 0; }

.sport {
  padding: 5px 8px 4px;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.sport:hover { color: var(--muted); }
.sport.on { color: var(--text); border-bottom-color: var(--accent); }

@media (max-width: 860px) {
  .logo-full { display: none; }
  .logo-mark { display: block; }
  .menu-toggle { display: inline-flex; }
  .menu-list {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px;
    min-width: 190px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  }
  .menu-list.open { display: flex; }
  .menu-list .sport {
    padding: 9px 10px;
    border-bottom: none;
    border-left: 2px solid transparent;
    border-radius: 4px;
    font-size: 14px;
  }
  .menu-list .sport.on { border-left-color: var(--accent); background: var(--line-soft); }
}

/* Board context, at the head of the games it describes. Empty for sports with
   no week to speak of, and then it takes up no room at all. */
.board-meta {
  margin: -6px 0 18px;
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.board-meta:empty { display: none; }

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.dot.live { background: var(--accent); }
.dot.stale, .dot.error { background: var(--faint); }

/* ---------- the front door ---------- */

.wordmark { font-size: 16px; letter-spacing: -0.01em; }
.boards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.board {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.board:hover { border-color: var(--faint); }
.board-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.board-live {
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  text-align: right;
  align-self: center;
}
.board.hot .board-live { color: var(--accent); }
.board-label { color: var(--muted); font-size: 12px; }
.board-detail {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 12px;
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- layout ---------- */

main { padding: 24px; max-width: 1440px; margin: 0 auto; }
.section { margin-bottom: 34px; }
.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.section-title.collapsible { cursor: pointer; user-select: none; }
.section-title.collapsible:hover { color: var(--muted); }
.caret { font-size: 9px; transition: transform 0.15s; display: inline-block; }
.caret.open { transform: rotate(90deg); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
}
.grid.collapsed { display: none; }
.hidden { display: none !important; }
.empty { color: var(--muted); padding: 4px 0 12px; }

/* ---------- game card ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px 8px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.clock {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.clock.pre, .clock.post { color: var(--muted); font-weight: 600; }

.head-right { display: flex; align-items: center; gap: 10px; }

.net {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.04em;
}
.net.national { color: var(--muted); font-weight: 600; }

/* The tournament, and whether it is one of the four that matter most. */
.tourney {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.02em;
  max-width: 15ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tourney.major { color: var(--accent); font-weight: 600; }
.frow .tourney { max-width: 13ch; }

.star {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 13px;
  line-height: 1;
  padding: 0;
}
.star:hover { color: var(--muted); }
.star.on { color: var(--accent); }

/* team rows */

.team { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.team img { width: 22px; height: 22px; object-fit: contain; flex: none; }
.rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  min-width: 18px;
  font-variant-numeric: tabular-nums;
}
.tname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 14px;
}
.team.trailing .tname { font-weight: 400; color: var(--muted); }
.team.trailing .pts { font-weight: 400; color: var(--muted); }
.team.trailing .setgames { color: var(--faint); }
.rec { color: var(--faint); font-size: 11px; font-weight: 400; margin-left: 6px; }
.poss { color: var(--accent); font-size: 9px; vertical-align: 2px; }
/* Tennis: one column per set, the set in play picked out. */
.setgames {
  font-size: 17px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: right;
}
.setgames.current { color: var(--text); font-weight: 700; }
#hero .setgames { font-size: 26px; min-width: 32px; }

.pts {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: right;
}
.pts.flash { animation: flash 1.6s ease-out; }
@keyframes flash {
  0% { color: var(--accent); }
  100% { color: inherit; }
}

.situation {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Links out to ESPN look exactly like the text they replace; underline on hover. */
a.clock:hover, a.fteams:hover { text-decoration: underline; }

/* footer: the one badge a card can carry, when it applies */

.foot {
  border-top: 1px solid var(--line-soft);
  margin-top: 8px;
  padding-top: 6px;
}
.tag {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  font-size: 10px;
  color: var(--accent);
}

/* ---------- top pick ---------- */

#hero .card { padding: 14px 18px 10px; }
#hero .pts { font-size: 30px; min-width: 46px; }
#hero .team img { width: 30px; height: 30px; }
#hero .tname { font-size: 17px; }
#hero .clock { font-size: 13px; }

/* ---------- hero detail: three columns of Gamecast facts ---------- */

.hero-detail {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1.6fr) minmax(220px, 1fr);
  gap: 14px 28px;
  border-top: 1px solid var(--line-soft);
  margin-top: 10px;
  padding-top: 12px;
}
.hero-col { min-width: 0; }
.hero-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 600;
  margin: 0 0 8px;
}

.linescore {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.linescore th, .linescore td { padding: 2px 9px 2px 0; text-align: right; }
.linescore th { color: var(--faint); font-weight: 600; font-size: 10px; }
.linescore td.abbr { text-align: left; color: var(--muted); font-weight: 600; padding-right: 14px; }
.linescore td { color: var(--muted); }
.linescore .total { color: var(--text); font-weight: 700; padding-left: 8px; border-left: 1px solid var(--line-soft); }

.winprob {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.wp-team { white-space: nowrap; min-width: 58px; }
.wp-team:last-child { text-align: right; }
.wp-track {
  flex: 1;
  display: flex;
  justify-content: space-between;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.wp-fill { height: 100%; transition: width 0.6s ease; }
.wp-fill.away { background: var(--faint); }
.wp-fill.home { background: var(--muted); }

.play { margin: 0; font-size: 13px; color: var(--text); line-height: 1.45; }
.drive, .timeouts { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.leader {
  display: grid;
  grid-template-columns: 24px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.leader:last-child { border-bottom: none; }
.leader-cat {
  grid-row: 1 / span 2;
  align-self: start;
  font-size: 9px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 3px;
}
.leader-who { color: var(--text); font-weight: 600; }
.leader-team { color: var(--faint); font-weight: 400; font-size: 11px; }
.leader-line { color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .hero-detail { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- finished games: one dense line each ---------- */

.final-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 0 26px;
}
.final-list.collapsed { display: none; }

.frow {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.fteams {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}
.fteams b { color: var(--text); font-weight: 600; }
.fnet { color: var(--faint); font-size: 11px; white-space: nowrap; }

.show-all {
  margin-top: 14px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  padding: 7px 14px;
  font-size: 13px;
}
.show-all:hover { color: var(--text); border-color: var(--faint); }

/* ---------- my games strip ---------- */



.follow-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.mini {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.mini .mclock { color: var(--accent); font-size: 11px; font-weight: 700; }
.mini .mscore { font-weight: 600; }
.mini .mnet { color: var(--faint); font-size: 11px; }
.mini button { background: none; border: none; color: var(--faint); padding: 0; font-size: 12px; }
.mini button:hover { color: var(--text); }


@media (max-width: 700px) {
  .topbar, main { padding-left: 14px; padding-right: 14px; }
  .grid { grid-template-columns: 1fr; }
  /* The nav and the clock earn the width; the word "Updated" does not. */
  .status-word { display: none; }
  .topbar { gap: 10px; }
}
