/* ==========================================================
   Scoreboard — styles
   Edit the tokens in :root to retheme the whole app.
   ========================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Surfaces */
  --bg:          #0f1115;
  --surface:     #171a21;
  --surface-2:   #1f232c;
  --border:      #2a2f3a;

  /* Text */
  --text:        #e6e8ec;
  --text-muted:  #8b93a3;

  /* Accents */
  --accent:      #4f8cff;
  --live:        #ff4d4f;
  --win:         #ffffff;
  --rank:        #f5b942;

  /* League tags */
  --cfb:         #2fbf71;
  --nfl:         #e8743b;
  --mlb:         #4f8cff;

  /* Shape & spacing */
  --radius:      10px;
  --radius-sm:   6px;
  --gap:         12px;
  --pad:         16px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.4;
}

button,
input { font: inherit; color: inherit; }

/* ---------- 3. Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 12px var(--pad);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.updated {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- 4. Toolbars ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap);
  padding: 10px var(--pad) 0;
}

.datebar {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ---------- 5. Controls ---------- */
.btn,
.input {
  height: 34px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.btn { cursor: pointer; }
.btn:hover { border-color: var(--accent); }

.btn--icon {
  width: 34px;
  padding: 0;
  font-size: 1.1rem;
}

.btn--icon.is-spinning { animation: spin 0.8s linear infinite; }

.input { color-scheme: dark; }
.input--search { margin-left: auto; min-width: 180px; }

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Segmented button group */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.seg button {
  padding: 7px 14px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--text-muted);
}

.seg button + button { border-left: 1px solid var(--border); }
.seg button.is-active { background: var(--accent); color: #fff; }

/* ---------- 6. Board & sections ---------- */
.board { padding: var(--pad); }

.section { margin-bottom: 28px; }

.section__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 var(--gap);
  font-size: 1.05rem;
}

.section__count {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
}

/* ---------- 7. Game card ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
}

.card--live { border-left-color: var(--live); }

.card__status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card--live .card__state { color: var(--live); font-weight: 600; }
.card--live .card__state::before { content: "● "; animation: pulse 1.4s infinite; }

.tag {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0f1115;
}

.tag--cfb { background: var(--cfb); }
.tag--nfl { background: var(--nfl); }
.tag--mlb { background: var(--mlb); }

/* Team rows */
.team {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 5px;
}

.team__logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.team__name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 1.0rem;
  letter-spacing: .05rem;
  font-weight: 800;
}

.team__rank {
  margin-right: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--rank);
}

.team__record {
  margin-left: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.team__poss { margin-left: 4px; color: var(--rank); }

.team__score {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.team--winner .team__name,
.team--winner .team__score { color: var(--win); font-weight: 700; }

/* Betting odds strip */
.odds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.odds__item b {
  margin-right: 3px;
  font-weight: 600;
  color: var(--text-muted);
}

.odds__note {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Footer line: situation, TV, venue */
.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card__situation { color: var(--text); }

/* ---------- 8. States ---------- */
.empty,
.error {
  padding: 40px var(--pad);
  text-align: center;
  color: var(--text-muted);
}

.error { color: var(--live); }

.foot {
  padding: 20px var(--pad) 30px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- 9. Animations ---------- */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- 10. Small screens ---------- */
@media (max-width: 640px) {
  .datebar,
  .input--search { margin-left: 0; }

  .input--search { flex: 1; }
  .grid { grid-template-columns: 1fr; }
}
