:root {
  --navy: #0D1B33;
  --navy-2: #13294B;
  --navy-3: #1B3660;
  --blue: #4B9CD3;
  --orange: #F47B20;
  --emerald: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --slate-100: #f1f5f9;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --line: rgba(75, 156, 211, 0.2);
  --line-soft: rgba(255, 255, 255, 0.05);
  /* RES-564: one color per Round 1 group (A-E), reused for team-code
     color-coding on bracket screens — see team-color.js. */
  --group-a: var(--blue);
  --group-b: var(--orange);
  --group-c: var(--emerald);
  --group-d: #a78bfa;
  --group-e: #f472b6;
}

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

html, body { background: var(--navy); }
::-webkit-scrollbar { display: none; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--slate-100);
  min-height: 100vh;
}

.font-condensed { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; }

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}
.icon.filled { fill: currentColor; stroke: none; }

.m-loading, .m-error {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--slate-400);
  font-size: 16px;
  text-align: center;
}
.m-error { color: var(--red); }

/* ---- sticky header + tabs ---- */
.m-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  padding: 16px 16px 12px;
}
.m-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.m-brand { display: flex; align-items: center; gap: 8px; }
.m-logo {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}
.m-brand-name { font-weight: 800; font-size: 15px; letter-spacing: 0.02em; color: #fff; }
.m-clock { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--slate-400); }
.m-clock .icon { color: var(--orange); }

.m-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.m-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--navy-3);
  color: var(--slate-400);
  border: none;
  cursor: pointer;
}
.m-tab.active { background: var(--blue); color: #fff; }

.m-filter {
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--navy-2);
  color: var(--slate-100);
  font-size: 13px;
}
.m-filter::placeholder { color: var(--slate-500); }

.m-content { padding-top: 12px; padding-bottom: 32px; }
.m-section { margin-bottom: 20px; }
.m-section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate-400);
  margin-bottom: 8px;
  padding: 0 16px;
}
.m-section-label.live { color: var(--orange); }
.m-section-label .hint { font-size: 10px; color: var(--slate-500); text-transform: none; letter-spacing: normal; margin-left: auto; font-weight: 500; }

.live-dot { position: relative; width: 8px; height: 8px; flex-shrink: 0; }
.live-dot::before, .live-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--orange); }
.live-dot::before { animation: live-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite; opacity: 0.75; }
@keyframes live-ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

.m-card {
  margin: 0 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--navy-2);
}
.m-live-card {
  margin: 0 16px 8px;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--orange);
  background: rgba(244, 123, 32, 0.08);
}
.m-live-card .team-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.m-live-card .team-row .team-id { color: var(--blue); font-weight: 700; margin-right: 6px; }
.m-live-card .team-row .team-name { font-size: 15px; font-weight: 600; color: #fff; }
.m-live-card .team-row .score { font-weight: 800; font-size: 22px; color: #fff; font-variant-numeric: tabular-nums; margin-left: 8px; }

.m-standings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.m-standings-row:last-child { border-bottom: none; }
.m-standings-row.bubble { background: rgba(251, 191, 36, 0.1); }
.m-standings-row.cutoff { border-bottom: 2px solid var(--orange); }
.m-standings-row .rank { font-weight: 800; font-size: 15px; width: 20px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.m-standings-row .rank.in { color: var(--blue); }
.m-standings-row .rank.out { color: var(--slate-500); }
.m-standings-row .move { width: 26px; flex-shrink: 0; display: flex; align-items: center; gap: 1px; font-weight: 700; font-size: 12px; }
.move.up { color: var(--emerald); }
.move.down { color: var(--red); }
.move.none { color: var(--slate-500); }
.m-standings-row .team-info { min-width: 0; flex: 1; }
.m-standings-row .team-id { color: var(--blue); font-weight: 700; font-size: 12px; margin-right: 4px; }
.m-standings-row .team-name { font-size: 14px; color: var(--slate-100); }
.pending-badge {
  margin-left: 6px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 4px;
  padding: 1px 4px;
}
.m-standings-row .wl { font-size: 12px; color: var(--slate-400); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.m-standings-row .pf, .m-standings-row .pa { font-size: 11px; color: var(--slate-400); font-variant-numeric: tabular-nums; width: 22px; text-align: right; flex-shrink: 0; }
.m-standings-row .diff { font-size: 12px; font-weight: 600; width: 36px; text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.diff-pos { color: var(--emerald); }
.diff-neg { color: var(--red); }

/* RES-561: mirrors tv.css's eliminated styling — struck through, dimmed,
   grouped below a labeled divider rather than interleaved by rank. */
.m-standings-row.eliminated { opacity: 0.55; }
.m-standings-row.eliminated .rank { color: var(--slate-500); }
.m-standings-row.eliminated .team-name,
.m-standings-row.eliminated .team-id { text-decoration: line-through; }
.m-standings-row.eliminated .move { visibility: hidden; }
.m-standings-eliminated-divider {
  margin: 4px 0 0;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  border-top: 1px solid var(--line);
}

.m-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.m-row:last-child { border-bottom: none; }
.m-row .team { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row .team.right { text-align: right; }
.m-row .team .team-id { color: var(--blue); font-weight: 700; margin-right: 4px; }
.m-row .time { font-size: 10px; color: var(--slate-500); margin: 0 8px; flex-shrink: 0; }
.m-row .score { font-size: 12px; color: var(--slate-400); font-variant-numeric: tabular-nums; margin: 0 8px; flex-shrink: 0; }
.m-row .winner { color: #fff; font-weight: 600; }
.m-row .loser { color: var(--slate-500); }

.m-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--slate-400); padding: 4px 16px 12px; }
.m-legend .swatch { display: inline-block; width: 12px; height: 2px; background: var(--orange); }
.m-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: rgba(251, 191, 36, 0.4); margin-left: 8px; }
.m-col-hint { flex-basis: 100%; font-size: 11px; letter-spacing: 0.03em; opacity: 0.7; }

.m-time-disclaimer { font-size: 11px; font-style: italic; color: var(--slate-500); text-align: center; padding: 8px 16px 0; }

/* ---- bracket tab (post-Round-1) ---- */
.m-bracket-round { font-size: 12px; font-weight: 700; color: var(--orange); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 16px 8px; }
/* RES-569: one section per physical court (A-E), matching tv.js's
   bracket-court-col grouping — see mobile.js's bracketCourtSectionHtml. */
.m-bracket-court-section { margin-bottom: 4px; }
.m-bracket-court-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  padding: 4px 16px;
}
.m-bracket-game {
  margin: 0 16px 10px;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--navy-2);
}
.m-bracket-game.status-live { border-color: var(--orange); background: rgba(244, 123, 32, 0.08); }
.m-bracket-status { display: flex; align-items: center; justify-content: space-between; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; color: var(--slate-400); }
.m-bracket-status.status-live { color: var(--orange); }
.m-bracket-status.status-completed { color: var(--emerald); }
.m-bracket-meta { display: flex; align-items: center; gap: 6px; }
.m-bracket-court { color: var(--slate-400); font-weight: 600; letter-spacing: 0.03em; }
.m-bracket-time { color: var(--slate-400); font-weight: 600; font-variant-numeric: tabular-nums; }
.m-bracket-team { display: flex; align-items: center; justify-content: space-between; padding: 2px 0; font-size: 14px; }
.m-bracket-team .team-id { color: var(--blue); font-weight: 700; margin-right: 6px; }
/* RES-565: "C3 #1" — the seed sits right after the team code, visually
   subordinate to it (smaller, muted) rather than competing for attention. */
.team-seed { color: var(--slate-400); font-weight: 600; font-size: 0.85em; }

/* RES-564: overrides the default team-id blue on bracket rows only — see
   team-color.js's teamColorClass and bracketTeamRowHtml. */
.team-color-a .team-id { color: var(--group-a); }
.team-color-b .team-id { color: var(--group-b); }
.team-color-c .team-id { color: var(--group-c); }
.team-color-d .team-id { color: var(--group-d); }
.team-color-e .team-id { color: var(--group-e); }
.m-bracket-team .score { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.m-bracket-team.tbd { color: var(--slate-500); font-style: italic; }

/* ---- schedule tab (landing tab, RES-570 follow-up) — one row per game
   number, one column per court (A-E), so play order reads left-to-right,
   top-to-bottom. Wider than the viewport by design (5 courts' worth of
   matchups) — scrolls horizontally in its own container rather than
   cramming/truncating team names, with Game/Time pinned so a viewer never
   loses track of which row they're looking at while scrolling sideways. */
.m-sched-scroll { overflow-x: auto; padding: 0 16px 4px; -webkit-overflow-scrolling: touch; }
.m-sched-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.m-sched-table th, .m-sched-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.m-sched-table thead th {
  background: var(--navy-2);
  color: var(--slate-400);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
}
.m-sched-game, .m-sched-time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--slate-400); position: sticky; background: var(--navy); }
.m-sched-game { left: 0; text-align: center; font-weight: 700; color: var(--slate-100); }
.m-sched-time { left: 32px; }
.m-sched-cell { min-width: 118px; background: var(--navy-2); }
.m-sched-cell.status-live { background: rgba(244, 123, 32, 0.12); border-color: var(--orange); }
.m-sched-cell.status-completed { background: rgba(52, 211, 153, 0.08); }
.m-sched-cell-empty { color: var(--slate-500); text-align: center; }
.m-sched-team { font-size: 12px; line-height: 1.4; }
.m-sched-team .team-id { color: var(--blue); font-weight: 700; margin-right: 4px; }
.m-sched-score { margin-top: 2px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.m-sched-cell.status-live .m-sched-score { color: var(--orange); }
.m-empty { color: var(--slate-400); font-size: 14px; padding: 24px 16px; text-align: center; }
