/* ============================================================
   League Hub — broadcast scoreboard aesthetic
   ============================================================ */

:root {
  --bg:        #0a0e14;
  --bg-2:      #0e141d;
  --surface:   #141b26;
  --surface-2: #1a2331;
  --line:      #25303f;
  --line-soft: #1c2531;
  --text:      #e8edf4;
  --text-dim:  #9aa7b8;
  --text-mute: #61708492;
  --muted:     #6b7888;
  --accent:    #ffb020;   /* broadcast amber */
  --accent-2:  #2fd07a;   /* field green */
  --live:      #ff3b4e;
  --win:       #3ad07a;
  --loss:      #ff5a6a;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 8px 28px rgba(0,0,0,.45);
  --mono: "Saira Condensed", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #16202e 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* subtle broadcast scanline texture */
.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    to bottom, rgba(255,255,255,.014) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; opacity: .5;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: #1a1300; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, #0c121b 0%, #0b1018 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { color: var(--live); font-size: 13px; line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255,59,78,.7)); }
.brand-text {
  font-family: var(--mono); font-weight: 800; font-size: 22px;
  letter-spacing: .06em; color: #fff;
}
.brand-accent { color: var(--accent); }

.league-picker select {
  font-family: var(--mono); font-weight: 600; letter-spacing: .03em;
  font-size: 15px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 12px; cursor: pointer; max-width: 60vw;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239aa7b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 30px;
}
.league-picker select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Tabs ---------- */
.tabs {
  max-width: 1180px; margin: 0 auto;
  display: flex; gap: 2px; padding: 0 12px;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  font-family: var(--mono); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; font-size: 14px;
  color: var(--text-dim);
  padding: 11px 15px; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.tabs a:hover { color: var(--text); }
.tabs a.active {
  color: var(--accent); border-bottom-color: var(--accent);
}

/* ---------- Layout ---------- */
main {
  max-width: 1180px; width: 100%; margin: 0 auto;
  padding: 22px 18px 40px; flex: 1;
}
.footer {
  border-top: 1px solid var(--line-soft);
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 16px; letter-spacing: .02em;
}

.loading, .empty {
  text-align: center; color: var(--text-dim);
  padding: 60px 20px; font-family: var(--mono); letter-spacing: .03em;
}

/* section heading */
.sec-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 4px 0 16px;
}
.sec-head h2 {
  font-family: var(--mono); font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; font-size: 24px; margin: 0; color: #fff;
}
.sec-head .sub { color: var(--muted); font-size: 13px; letter-spacing: .02em; }
.bar-accent { width: 4px; height: 22px; background: var(--accent); border-radius: 2px;
  display: inline-block; transform: translateY(3px); }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.card-pad { padding: 16px 18px; }

/* stat tiles (overview) */
.tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; position: relative; overflow: hidden;
}
.tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.tile .num {
  font-family: var(--mono); font-weight: 800; font-size: 34px; line-height: 1;
  color: #fff; font-variant-numeric: tabular-nums;
}
.tile .lbl {
  text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px;
  color: var(--text-dim); margin-top: 7px; font-weight: 600;
}

/* ---------- Scoreboard cards ---------- */
.scores-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.game {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 0; position: relative;
}
.game-row {
  display: grid; grid-template-columns: 6px 30px 1fr auto;
  align-items: center; gap: 11px; padding: 10px 15px;
}
.game-row + .game-row { border-top: 1px solid var(--line-soft); }
.g-bar { width: 6px; height: 26px; border-radius: 3px; background: #444; }
.g-abbr {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  color: var(--text-dim); letter-spacing: .03em;
}
.g-name {
  font-weight: 600; font-size: 14.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-score {
  font-family: var(--mono); font-weight: 800; font-size: 24px;
  font-variant-numeric: tabular-nums; color: #fff; min-width: 32px; text-align: right;
}
.game.played .winner .g-score { color: var(--accent); }
.game.played .winner .g-name { color: #fff; }
.game .loser .g-name, .game .loser .g-abbr { color: var(--muted); }
.game .loser .g-score { color: var(--text-dim); }
.game-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 15px 9px; border-top: 1px solid var(--line-soft);
}
.chip-final {
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.chip-sched { color: var(--accent-2); }
.chip-gotw {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #1a1300; background: var(--accent);
  padding: 2px 7px; border-radius: 3px;
}

/* week selector pills */
.week-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.week-pill {
  font-family: var(--mono); font-weight: 600; font-size: 13.5px; letter-spacing: .03em;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
  padding: 7px 13px; border-radius: 20px; cursor: pointer;
  transition: all .12s;
}
.week-pill:hover { color: var(--text); border-color: #36465a; }
.week-pill.active { background: var(--accent); border-color: var(--accent); color: #1a1300; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  font-family: var(--mono); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; font-size: 12px; color: var(--text-dim);
  text-align: right; padding: 11px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
thead th.tl, tbody td.tl { text-align: left; }
thead th:hover { color: var(--text); }
thead th.sorted { color: var(--accent); }
thead th .arr { font-size: 9px; margin-left: 3px; opacity: .8; }
tbody td {
  text-align: right; padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
tbody tr:hover td { background: rgba(255,255,255,.022); }
tbody tr:last-child td { border-bottom: none; }
.rank-cell { color: var(--muted); font-family: var(--mono); font-weight: 700; width: 34px; }

/* team cell */
.team-cell { display: flex; align-items: center; gap: 10px; }
.team-cell .dot { width: 9px; height: 22px; border-radius: 3px; flex: none; }
.team-cell .tc-abbr { font-family: var(--mono); font-weight: 700; color: var(--text-dim);
  font-size: 12.5px; width: 34px; }
.team-cell .tc-name { font-weight: 600; }

/* OVR + dev badges */
.ovr {
  font-family: var(--mono); font-weight: 800; font-size: 15px;
  padding: 1px 8px; border-radius: 5px; display: inline-block; min-width: 34px;
  font-variant-numeric: tabular-nums;
}
.ovr-elite { background: rgba(255,176,32,.16); color: #ffc456; }
.ovr-good  { background: rgba(47,208,122,.14); color: #57dd96; }
.ovr-avg   { background: rgba(154,167,184,.12); color: #b6c2d2; }
.ovr-low   { background: rgba(120,135,155,.08); color: var(--muted); }

.dev {
  font-family: var(--mono); font-weight: 700; font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px; display: inline-block;
}
.dev-0 { background: #1d2632; color: var(--muted); }
.dev-1 { background: rgba(90,170,255,.16); color: #7db8ff; }       /* star */
.dev-2 { background: rgba(186,120,255,.16); color: #c79bff; }      /* superstar */
.dev-3 { background: rgba(255,176,32,.18); color: var(--accent); } /* x-factor */

/* standings division blocks */
.division { margin-bottom: 22px; }
.division-name {
  font-family: var(--mono); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; font-size: 14px; color: var(--accent-2);
  padding: 0 2px 9px; display: flex; align-items: center; gap: 8px;
}
.streak-w { color: var(--win); font-weight: 700; }
.streak-l { color: var(--loss); font-weight: 700; }

/* controls row (roster) */
.controls {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center;
}
.controls input[type=text], .controls select {
  font-family: var(--body); font-size: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: var(--radius-sm);
}
.controls input[type=text] { min-width: 200px; flex: 1; }
.controls input::placeholder { color: var(--muted); }
.controls input:focus, .controls select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.controls .count { color: var(--muted); font-size: 13px; font-family: var(--mono);
  letter-spacing: .03em; margin-left: auto; }

/* team grid cards */
.team-grid { grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); }
.team-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; cursor: pointer; overflow: hidden;
  transition: border-color .12s, transform .12s;
}
.team-card:hover { border-color: #3a4b60; transform: translateY(-2px); }
.team-card .tc-top { height: 5px; }
.team-card .tc-body { padding: 14px 16px; display: flex; align-items: center; gap: 13px; }
.team-card .tc-ovr {
  font-family: var(--mono); font-weight: 800; font-size: 30px; color: #fff;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.team-card .tc-meta .nm { font-family: var(--mono); font-weight: 700; font-size: 18px;
  letter-spacing: .02em; color: #fff; }
.team-card .tc-meta .dv { color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; margin-top: 2px; }

/* leaders sub-tabs */
.subtabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.subtab {
  font-family: var(--mono); font-weight: 600; font-size: 13.5px; letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; transition: all .12s;
}
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--surface-2); color: var(--accent); border-color: #3a4b60; }

/* export/status page */
.url-box {
  background: #060a0f; border: 1px dashed var(--accent);
  border-radius: var(--radius); padding: 14px 16px; margin: 6px 0 4px;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  flex-wrap: wrap;
}
.url-box code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px;
  color: var(--accent); word-break: break-all;
}
.btn {
  font-family: var(--mono); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  font-size: 13px; background: var(--accent); color: #1a1300; border: none;
  padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: #3a4b60; }
.btn-danger { background: transparent; color: var(--loss); border: 1px solid #4a2530; }
.btn-danger:hover { background: rgba(255,90,106,.1); }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: s; position: relative; padding: 8px 0 8px 38px;
  color: var(--text-dim); font-size: 14px; line-height: 1.55;
}
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 7px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.steps code, .inline-code {
  font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  background: #060a0f; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; color: var(--accent-2);
}

.log-type {
  font-family: var(--mono); font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; padding: 2px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-dim);
}

.note { color: var(--muted); font-size: 13px; line-height: 1.6; }
.note strong { color: var(--text-dim); }

/* empty state inside views */
.empty-card {
  text-align: center; padding: 40px 24px;
}
.empty-card h3 { font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em;
  color: var(--text); font-size: 20px; margin: 0 0 10px; }
.empty-card p { color: var(--text-dim); max-width: 460px; margin: 0 auto 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .brand-text { font-size: 19px; }
  .sec-head h2 { font-size: 21px; }
  main { padding: 16px 12px 32px; }
  .tile .num { font-size: 28px; }
  tbody td, thead th { padding: 9px 9px; font-size: 13px; }
  .controls .count { width: 100%; margin: 4px 0 0; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .scanlines { display: none; }
}
