/*
 * 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: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
/* The mark sits on the name's baseline and takes the bar's quiet colour: it is
   the brand, not a live signal, so it does not get the red. */
.mark { width: 18px; height: 18px; flex: none; color: var(--muted); align-self: center; margin-right: -2px; }
.topbar h1 { font-size: 16px; letter-spacing: -0.01em; }
.sub {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.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); }

/* ---------- 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; }

.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); }
.rec { color: var(--faint); font-size: 11px; font-weight: 400; margin-left: 6px; }
.poss { color: var(--accent); font-size: 9px; vertical-align: 2px; }
.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: 640px) {
  .topbar, main { padding-left: 14px; padding-right: 14px; }
  .grid { grid-template-columns: 1fr; }
}
