:root{
  --bg: #0A0E14;
  --panel: #141922;
  --panel-raised: #1B222D;
  --line: #262E3B;
  --accent: #37E17E;
  --accent-dim: #1C6B45;
  --accent-soft: rgba(55,225,126,0.12);
  --chalk: #F3F5F8;
  --chalk-dim: #8891A1;
  --gold: #FFB74D;
  --danger: #FF5C5C;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  font-size: 16px;
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }
body{
  background: var(--bg);
  color: var(--chalk);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  padding-bottom: 70px;
}

.hidden{ display:none !important; }
a{ color: var(--accent); }

/* ---------- Header ---------- */
.scoreboard{
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top:0; z-index: 20;
}
.scoreboard-inner{
  max-width: 1100px; margin: 0 auto;
  display:flex; align-items:center; justify-content:space-between;
  gap: 18px; padding: 16px 20px;
  flex-wrap: wrap;
}
.brand{ display:flex; align-items:center; gap: 10px; line-height:1; }
.brand-wordmark{
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--chalk);
}
.brand-wordmark::before{
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 9px;
  box-shadow: 0 0 8px var(--accent);
}
.brand-league{
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--chalk-dim);
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
  min-height: 1em;
}

.week-picker, .identity-block{ display:flex; align-items:center; }

/* ---------- Layout shells ---------- */
main{ max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

.panel{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px;
  max-width: 440px;
  margin: 20px auto;
}
.panel-title{
  font-weight: 800;
  font-size: 1.5rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.panel-sub{ color: var(--chalk-dim); margin: 0 0 22px; line-height:1.5; font-size:0.94rem; }

.section-block{
  background: var(--panel); border:1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}

.field-label{
  display:block; font-size:0.78rem; font-weight: 600;
  color: var(--chalk-dim); margin: 16px 0 7px;
}
.field-hint{
  font-size: 0.8rem; color: var(--chalk-dim); margin: 4px 0 0; line-height:1.4;
}
.col-title{ font-weight:700; font-size:1.05rem; margin: 4px 0 12px; letter-spacing: -0.01em; }

.text-input{
  width: 100%;
  background: #0D1219;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--chalk);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
}
.text-input:focus{ outline: 2px solid var(--accent); outline-offset: 1px; }
.text-input.small{ padding: 7px 11px; font-size: 0.85rem; }

.manager-row{ display:flex; align-items:center; gap:8px; flex-wrap: wrap; }
.row-actions{ display:flex; gap:10px; margin-top:10px; }

.btn{
  font-family:'Inter', sans-serif;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.06s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active{ transform: scale(0.97); }
.btn.primary{ background: var(--accent); color: #06150D; }
.btn.primary:hover{ background: #4FEB92; }
.btn.ghost{ background: var(--panel-raised); border: 1px solid var(--line); color: var(--chalk); }
.btn.ghost:hover{ border-color: var(--accent); color: var(--accent); }
.btn.ghost.small{ padding: 6px 14px; font-size: 0.8rem; }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; }

/* ---------- Auth screens ---------- */
.auth-panel{ max-width: 400px; margin: 40px auto; }
.auth-panel .text-input{ width: 100%; margin-bottom: 4px; }
.auth-switch{ margin-top: 16px; font-size: 0.85rem; color: var(--chalk-dim); }
.auth-switch a{ color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ---------- My Leagues landing list ---------- */
.league-row{
  display:flex; align-items:center; justify-content:space-between;
  padding: 16px 18px; background: var(--panel-raised); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 10px; text-decoration:none; color: inherit;
  transition: border-color 0.15s ease;
}
.league-row:hover{ border-color: var(--accent); }
.league-row-name{ font-weight: 700; }
.league-row-role{
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: var(--radius-pill);
}

/* ---------- League tabs ---------- */
.league-tabs{
  display:flex; gap: 4px; margin-bottom: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 4px; width: fit-content; max-width: 100%; overflow-x: auto;
}
.league-tab{
  background:none; border:none; color: var(--chalk-dim);
  font-family: 'Inter', sans-serif; font-weight: 700;
  font-size: 0.88rem; padding: 9px 18px; cursor:pointer;
  border-radius: var(--radius-pill); white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.league-tab.active{ color: #06150D; background: var(--accent); }
.league-tab:not(.active):hover{ color: var(--chalk); }
.tab-panel.hidden{ display:none; }

/* ---------- Player avatars ---------- */
.player-avatar{
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--panel-raised); border: 1px solid var(--line);
  object-fit: cover; object-position: top center;
}
.player-avatar-fallback{
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-weight: 800; font-size: 0.8rem;
}

/* ---------- My Team: roster rows ---------- */
.roster-row{
  display:flex; align-items:center; gap: 12px; padding: 10px 12px;
  background: var(--panel-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px;
}
.roster-row .slot-tag{
  width: 38px; flex: none; text-align:center; font-size: 0.68rem; font-weight: 700;
  color: var(--chalk-dim); background: var(--panel); border-radius: 6px; padding: 4px 0;
}
.roster-row-player{ flex: 1; min-width: 0; }
.roster-row-name{ font-weight: 700; font-size: 0.92rem; }
.roster-row-meta{ font-size: 0.74rem; color: var(--chalk-dim); margin-top: 1px; }
.roster-row-pts{ text-align:right; font-size: 0.85rem; width: 90px; flex: none; font-variant-numeric: tabular-nums; }
.roster-row-pts .actual{ font-weight:800; color: var(--chalk); }
.roster-row-pts .proj{ color: var(--chalk-dim); font-size: 0.72rem; }
.roster-row-actions{ flex: none; display:flex; gap: 6px; align-items: center; }

.slot-group-label{
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.slot-picker-row{ display:flex; align-items:center; gap: 8px; margin-bottom: 6px; }
.slot-picker-row select{ flex: 1; }

.injury-badge{
  display:inline-block; font-size: 0.62rem; font-weight:800; padding: 2px 7px; border-radius: var(--radius-pill);
  margin-left: 6px; letter-spacing: 0.02em;
}
.injury-badge.Q{ background:rgba(255,183,77,0.15); color:var(--gold); }
.injury-badge.D{ background:rgba(255,140,66,0.15); color:#ff9d4d; }
.injury-badge.O, .injury-badge.IR{ background:rgba(255,92,92,0.15); color:var(--danger); }

.opp-rank{ font-size: 0.7rem; font-weight: 600; padding: 0 4px; border-radius: 3px; }
.opp-rank.easy{ color: var(--accent); }
.opp-rank.hard{ color: var(--danger); }

/* ---------- Scoreboard (weekly matchup cards) ---------- */
.scoreboard-list{ display:flex; flex-direction:column; gap: 10px; }
.matchup-card{
  background: var(--panel-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.matchup-card.bye{ opacity: 0.7; font-size: 0.88rem; color: var(--chalk-dim); }
.matchup-sides{ display:flex; align-items:center; justify-content:space-between; gap: 10px; }
.matchup-side{ flex: 1; display:flex; flex-direction:column; gap: 2px; }
.matchup-side.away{ text-align: right; }
.matchup-name{ font-weight: 700; font-size: 0.95rem; }
.matchup-score{ font-size: 1.7rem; font-weight:800; color: var(--chalk); font-variant-numeric: tabular-nums; }
.matchup-side.winner .matchup-score{ color: var(--accent); }
.matchup-side.winner .matchup-name{ color: var(--accent); }
.matchup-vs{ color: var(--chalk-dim); font-size: 0.72rem; font-weight: 700; padding: 3px 10px; background: var(--panel); border-radius: var(--radius-pill); }

.matchup-detail{ margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; display:none; }
.matchup-card.expanded .matchup-detail{ display:grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.player-line{ display:flex; justify-content:space-between; font-size:0.82rem; padding: 3px 0; color: var(--chalk-dim); }
.player-line .pts{ color: var(--chalk); font-variant-numeric: tabular-nums; }
.expand-toggle{
  background:none; border:none; color: var(--chalk-dim); font-size: 0.75rem; font-weight: 600;
  cursor:pointer; padding: 10px 0 0; width: 100%; text-align:center;
}
.expand-toggle:hover{ color: var(--accent); }

/* ---------- Standings ---------- */
.standings-table{ width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.standings-table th{
  text-align:left; color: var(--chalk-dim); font-weight:700; font-size: 0.7rem;
  padding: 8px; border-bottom: 1px solid var(--line);
}
.standings-table th:not(:first-child), .standings-table td:not(:first-child){ text-align:center; }
.standings-table td{ padding: 10px 8px; border-bottom: 1px solid var(--line); }
.standings-table td:first-child{ font-weight:700; }
.standings-table .pf{ font-variant-numeric: tabular-nums; color: var(--chalk-dim); }

/* ---------- Matchup tab ---------- */
.matchup-total-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.matchup-total-side{ text-align:center; flex: 1; }
.matchup-total-name{ font-weight:700; margin-bottom: 4px; }
.matchup-total-score{ font-size: 2.2rem; font-weight:800; font-variant-numeric: tabular-nums; }
.matchup-total-proj{ font-size: 0.75rem; color: var(--chalk-dim); }
.winprob-bar{
  height: 8px; border-radius: var(--radius-pill); background: var(--danger); overflow:hidden; margin: 14px 0 6px;
}
.winprob-fill{ height:100%; background: var(--accent); }
.winprob-label{ font-size: 0.75rem; color: var(--chalk-dim); text-align:center; margin-bottom: 18px; }

.pos-compare-row{
  display:grid; grid-template-columns: 1fr 56px 1fr; align-items:center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.85rem;
}
.pos-compare-side{ display:flex; justify-content:space-between; gap: 8px; }
.pos-compare-slot{ text-align:center; color: var(--chalk-dim); font-size: 0.68rem; font-weight: 700; }

/* ---------- Transaction log ---------- */
.transaction-row{
  padding: 10px; border-bottom: 1px solid var(--line); font-size: 0.82rem;
  display:flex; justify-content:space-between; gap: 10px;
}
.transaction-row-time{ color: var(--chalk-dim); font-size: 0.72rem; white-space:nowrap; }

/* ---------- Commissioner ---------- */
.team-switcher{
  display:flex; align-items:center; gap: 10px; padding: 12px 16px;
  background: var(--accent-soft); border: 1px solid var(--accent-dim); border-radius: var(--radius);
}
.slot-editor{ display:flex; flex-direction:column; gap: 8px; margin-top: 6px; }
.slot-editor-row{ display:flex; align-items:center; gap: 8px; }
.slot-editor-row input.slot-name{ width: 90px; }
.slot-editor-row input.slot-count{ width: 60px; }
.scoring-editor{
  display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px; margin-top: 6px;
}
.scoring-editor-row{ display:flex; align-items:center; gap: 8px; font-size: 0.82rem; }
.scoring-editor-row label{ flex:1; color: var(--chalk-dim); }
.scoring-editor-row input{ width: 70px; }
