:root {
  --bg: #0a1628;
  --surface: #0f2238;
  --surface-2: #15304d;
  --border: #1e3a5f;
  --text: #e8eef7;
  --muted: #97a8c4;
  --accent: #d4a574;
  --accent-strong: #bd8b54;
  --accent-soft: #e8c896;
  --green: #5fbf8a;
  --yellow: #e8c896;
  --orange: #d98c3f;
  --red: #e3553f;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,0.5);
  font-synthesis: none;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(212,165,116,0.12), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
.brand .ball { font-size: 1.6rem; }
.brand .tag { color: var(--muted); font-size: 0.85rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: grid; place-items: center; font-weight: 700; color: #15233a;
}
.user-chip .name { font-weight: 600; line-height: 1.1; }
.user-chip .team { color: var(--muted); font-size: 0.8rem; }

/* Buttons */
button { font: inherit; cursor: pointer; border: none; border-radius: 8px; transition: all .15s ease; }
.btn { padding: 10px 16px; font-weight: 600; }
.btn-primary { background: var(--accent); color: #15233a; }
.btn-primary:hover { background: var(--accent-soft); }
.btn-primary:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(212,165,116,0.08); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(255,69,58,0.4); }
.btn-danger:hover { background: rgba(255,69,58,0.12); }
.btn-remove { background: transparent; color: var(--orange); border: 1px solid rgba(217,140,63,0.5); font-weight: 700; }
.btn-remove:hover { background: rgba(217,140,63,0.16); color: #f0a85a; }
.btn-sm { padding: 6px 10px; font-size: 0.85rem; }

/* Cards / panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }

/* Auth */
.auth-wrap { max-width: 400px; margin: 8vh auto 0; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.auth-card h2 { text-align: center; margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field input, .field select {
  padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,165,116,0.18); }
.auth-toggle { text-align: center; margin-top: 14px; font-size: 0.9rem; color: var(--muted); }
.auth-toggle a { color: var(--accent); cursor: pointer; }
.hint { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 12px; }

/* Layout */
.main-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
/* Grid items default to min-width:auto, so a wide table inside would force the
   track past its fr ratio (the "panel keeps getting wider" bug). Pin to 0 so the
   columns hold their ratio and inner .table-scroll scrolls instead. */
.main-grid > * { min-width: 0; }
@media (max-width: 980px) { .main-grid { grid-template-columns: 1fr; } }

/* Salary + roster meters */
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
@media (max-width: 760px) { .meters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.meter { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.meter .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.meter .value { font-size: 1.35rem; font-weight: 700; }
.meter .value.warn { color: var(--red); }
.bar { height: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.bar > span.over { background: var(--red); }
.meters-bar { margin: 0 0 18px; }

/* Search + filters */
.search-row { display: flex; gap: 10px; margin-bottom: 14px; }
.search-row input { flex: 1; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; }
.search-row input:focus { outline: none; border-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.avail-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.avail-filter-row .chips { margin-bottom: 0; }
.avail-filter-row .avail-statbar { margin-bottom: 0; }
.avail-statbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.fppg-select { padding: 6px 30px 6px 13px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--surface-2); color: var(--text); border: 1px solid transparent; cursor: pointer; font-family: inherit; -webkit-appearance: none; 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='%2397a3b8' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.fppg-select:hover { color: var(--text); }
.fppg-select:focus { outline: none; border-color: var(--accent); }
.avail-statbar input { width: 64px; padding: 6px 8px; text-align: center; background: var(--surface-2); border: 1px solid transparent; border-radius: 999px; color: var(--text); font: inherit; font-size: 0.85rem; display: none; }
.chip { padding: 6px 13px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--surface-2); color: var(--muted); cursor: pointer; border: 1px solid transparent; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); color: #15233a; }

/* Tables */
.table-scroll { max-height: 460px; overflow-y: auto; border-radius: 8px; }
/* Keep the (sortable) column headers visible while the list scrolls. */
.table-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: inset 0 -1px 0 var(--border); }
/* On desktop, give the roster its own scroll area in Add/Trade mode so it
   lines up with the Available list instead of running off the page. */
@media (min-width: 981px) {
  #rosterGroups.scroll-roster { max-height: 520px; overflow-y: auto; padding-right: 6px; }
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--surface); z-index: 1; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-style: italic; }

.player-cell { display: flex; align-items: center; gap: 10px; }
.player-pic { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--accent); flex: none; }
.player-meta { display: flex; flex-direction: column; }
.player-meta .nm { font-weight: 600; }
.player-meta .sub { font-size: 0.78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }

.pos { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; }
.pos.QB { background: rgba(255,149,0,0.16); color: var(--orange); }
.pos.RB { background: rgba(120,165,225,0.16); color: #8fb6e8; }
.pos.WR { background: rgba(255,69,58,0.16); color: var(--red); }
.pos.TE { background: rgba(175,82,222,0.18); color: #c77dff; }
.pos.K  { background: rgba(52,199,89,0.16); color: var(--green); }
.pos.DST{ background: rgba(255,204,0,0.16); color: var(--yellow); }
.pos.FLEX{ background: rgba(138,150,170,0.16); color: var(--muted); }

.inj { font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.inj.Healthy { display: none; }
.inj.Questionable { background: rgba(255,204,0,0.16); color: var(--yellow); }
.inj.Doubtful { background: rgba(255,149,0,0.16); color: var(--orange); }
.inj.Out, .inj.IR { background: rgba(255,69,58,0.16); color: var(--red); }
.bye { font-size: 0.7rem; color: var(--muted); }

.pts { font-weight: 700; color: var(--accent); }
.salary-txt { font-variant-numeric: tabular-nums; }

.roster-group { margin-bottom: 18px; }
/* Every position group is its own table; a fixed layout + identical colgroup
   keep the matchup / bye / salary / pts / action columns aligned across groups. */
.roster-group table { width: 100%; table-layout: fixed; }
.roster-group td.salary-txt, .roster-group td.ppg { text-align: center; }
.roster-group h3 { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; justify-content: space-between; }
.slot-count { font-weight: 600; }
.slot-count.met { color: var(--green); }

.submit-bar { margin-top: 16px; }
#pendingTrades { background: rgba(212,165,116,0.12); border: 1px solid var(--accent); color: var(--text); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 0.85rem; line-height: 1.35; }
#pendingTrades strong { color: var(--accent); }
.submit-bar .btn-primary { width: 100%; padding: 14px; font-size: 1.05rem; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 13px 20px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); transform: translateX(120%); transition: transform .3s ease; z-index: 100; max-width: 340px; }
.toast.show { transform: translateX(0); }
.toast.success { background: var(--green); color: #06210f; }
.toast.error { background: var(--red); color: #2a0707; }

/* Admin */
.admin-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-nav .chip.active { background: var(--accent); color: #15233a; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
/* Inside a toolbar, form controls sit on one centered line — no stacked-field
   bottom margin, and selects/inputs/buttons share a consistent height. */
.toolbar .field { margin-bottom: 0; flex-direction: row; align-items: center; }
.toolbar .field, .toolbar select, .toolbar input, .toolbar .btn { margin-bottom: 0; align-self: center; }
.toolbar select, .toolbar input[type=text], .toolbar input[type=number], .toolbar .btn { min-height: 40px; box-sizing: border-box; }
.toolbar .btn { display: inline-flex; align-items: center; }
.toolbar input[type=text] { flex: 1; min-width: 160px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.section { display: none; }
.section.active { display: block; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; place-items: center; z-index: 50; padding: 20px; }
.modal-backdrop.show { display: grid; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal h3 { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

a.link { color: var(--accent); text-decoration: none; font-weight: 600; }
a.link:hover { text-decoration: underline; }
.row-actions { display: flex; gap: 6px; }
.muted { color: var(--muted); }

/* ---- Clock banner ---- */
.clock-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(212,165,116,0.12), transparent);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; font-size: 0.9rem;
}
.clock-banner .wk { font-weight: 700; color: var(--accent); }
.clock-banner .now { color: var(--muted); }
.clock-banner .sim-tag { font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: rgba(255,204,0,0.16); color: var(--yellow); }

/* ---- Nav links ---- */
.nav-links { display: flex; gap: 6px; }
.nav-links a { padding: 8px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--accent); background: rgba(212,165,116,0.1); }

/* ---- Lock + clickable players ---- */
.lock { font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: rgba(255,69,58,0.14); color: var(--red); }
.clickable { cursor: pointer; }
.clickable:hover .nm { color: var(--accent); text-decoration: underline; }
tr.locked-row { opacity: 0.78; }

/* ---- Standings ---- */
.standings-wrap { overflow-x: auto; }
.standings { width: 100%; border-collapse: collapse; }
.standings th, .standings td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.standings th:first-child, .standings td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.standings th.cur, .standings td.cur { background: rgba(212,165,116,0.07); }
.standings .rank { color: var(--muted); font-weight: 700; width: 36px; }
.standings .team-name { font-weight: 600; cursor: pointer; }
.standings .team-name:hover { color: var(--accent); }
.standings .total { font-weight: 800; color: var(--accent); font-size: 1.05rem; }
.standings tr:hover td { background: rgba(255,255,255,0.02); }
.standings tr:hover td.cur { background: rgba(212,165,116,0.1); }
.podium-1 .rank { color: #ffd24c; }
.podium-2 .rank { color: #cfd6e2; }
.podium-3 .rank { color: #d98a4a; }

/* ---- Player detail modal ---- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.detail-head .player-pic { width: 52px; height: 52px; font-size: 1.1rem; }
.detail-head h3 { font-size: 1.3rem; margin: 0; }
.detail-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.detail-now { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
.detail-now .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.detail-section { margin-top: 18px; }
.detail-section h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.detail-section table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.detail-section th, .detail-section td { padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: right; }
.detail-section th:first-child, .detail-section td:first-child { text-align: left; }
.detail-section th { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; }
.tag-played { font-size: 0.68rem; font-weight: 700; color: var(--green); }
.tag-upcoming { font-size: 0.68rem; font-weight: 700; color: var(--muted); }
.tag-live { font-size: 0.68rem; font-weight: 700; color: var(--orange); }
.row-current { background: rgba(212,165,116,0.06); }

/* ---- Schedule admin ---- */
.game-list table { width: 100%; border-collapse: collapse; }
.kickoff { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; }
input[type="datetime-local"], input[type="number"].sm { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 9px 10px; font: inherit; }
.clock-form { max-width: 520px; }
.clock-current { background: var(--surface-2); border-radius: 10px; padding: 14px; margin-bottom: 18px; font-size: 0.95rem; }
.clock-current strong { color: var(--accent); }
.switch-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; }

/* ---- Empty starting-slot placeholders ---- */
.placeholder-row td { color: var(--muted); }
.player-pic.ph { background: transparent; border: 2px dashed #2d5480; color: var(--muted); font-size: 0.68rem; font-weight: 700; }
.placeholder-row .nm { color: var(--muted); font-weight: 500; }
.placeholder-row .sub { color: #5d6b82; }

/* ---- Leagues hub ---- */
.list-item { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 4px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.list-item:last-child { border-bottom:none; }
.list-item .li-main { display:flex; flex-direction:column; gap:2px; }
.list-item .li-title { font-weight:600; }
.list-item .li-sub { color:var(--muted); font-size:0.82rem; }
.li-actions { display:flex; gap:8px; align-items:center; }
.status-badge { font-size:0.7rem; font-weight:700; padding:2px 9px; border-radius:999px; }
.status-badge.active { background:rgba(52,199,89,.16); color:var(--green); }
.status-badge.pending { background:rgba(255,204,0,.16); color:var(--yellow); }
.status-badge.rejected { background:rgba(255,69,58,.16); color:var(--red); }
.empty-note { color:var(--muted); padding:14px 4px; font-style:italic; }

/* ---- Select control ---- */
.ff-select { min-width: 200px; }

/* ---- Trade screen ---- */
.trade-bar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:12px 16px; }
.trade-bar .trade-pick strong { margin-left:6px; }
.trade-arrow { color:var(--muted); font-weight:700; }
tr.sel-out td, tr.sel-in td { background:rgba(212,165,116,.18); }
tr.sel-out td:first-child, tr.sel-in td:first-child { box-shadow:inset 3px 0 0 var(--accent,#3b82f6); }

/* ---- League roster slot grid (admin) ---- */
.slot-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(110px, 1fr)); gap:10px; }
.slot-grid .field label { font-size:0.78rem; }
.slot-grid .field input { width:100%; }

/* ---- Per-game + stats ---- */
.ppg { color: var(--accent-soft); font-weight: 600; }
.players-tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.players-tabs .chip { cursor:pointer; }
table.stats th { cursor:pointer; white-space:nowrap; }
table.stats th.sortable:hover { color:var(--accent); }
table.stats td.num, table.stats th.num { text-align:center; }

/* ---- Roster / Trade segmented toggle ---- */
.seg { display:inline-flex; background:var(--surface-2); border:1px solid var(--border); border-radius:9px; padding:3px; gap:3px; }
.seg .chip { padding:6px 12px; border-radius:7px; font-size:0.85rem; cursor:pointer; color:var(--muted); border:none; background:transparent; }
.seg .chip.active { background:var(--accent); color:#15233a; font-weight:600; }
.main-grid.roster-only { grid-template-columns: 1fr; }
.main-grid.roster-only #availablePanel { display:none; }

/* ---- Per-game stat line under roster players ---- */
.statline { color: var(--muted); font-size: 0.74rem; margin-top: 3px; padding-left: 46px; line-height: 1.3; }

/* ---- Roster-page row layout (lineup management) ---- */
.rrow { display:flex; align-items:center; gap:10px; padding:8px 4px; border-top:1px solid var(--border); }
.rrow .rinfo { flex:0 0 230px; width:230px; }
.rrow .rinfo .nm { font-weight:600; font-size:0.95rem; }
.rrow .rinfo .sub { font-size:0.78rem; color:var(--muted); }
.rrow .rinfo .sub .sal { color:var(--accent); font-weight:600; }
.rmetrics { display:flex; align-items:flex-start; gap:0; }
.statbox { width:66px; flex-shrink:0; text-align:center; padding:0 3px; border-left:1px solid var(--border); }
.statbox:first-child { border-left:none; }
.statbox .sv { color:var(--accent-soft); font-weight:700; font-size:0.95rem; display:block; line-height:1.2; }
.statbox .sl { color:var(--muted); font-size:0.56rem; letter-spacing:0.3px; line-height:1.05; display:block; margin-top:1px; }
.rmove { width:26px; height:26px; border-radius:50%; display:grid; place-items:center; font-size:0.95rem; font-weight:700; flex-shrink:0; border:1px solid var(--border); background:transparent; cursor:pointer; line-height:1; padding:0; }
.rmove.bench { color:var(--orange); border-color:rgba(217,140,63,0.55); }
.rmove.bench:hover { background:rgba(217,140,63,0.16); }
.rmove.start { color:var(--green); border-color:rgba(95,191,138,0.55); }
.rmove.start:hover { background:rgba(95,191,138,0.16); }
.rmove.off { opacity:0.3; cursor:default; }
.offense-scroll { overflow-x:auto; padding-bottom:8px; }
.offense-inner { width:max-content; min-width:100%; }

/* ---- Standings leader badge ---- */
.leader-badge { display:inline-block; margin-left:8px; background:var(--accent); color:#15233a; font-size:0.6rem; font-weight:700; letter-spacing:0.5px; padding:2px 7px; border-radius:999px; vertical-align:middle; }

/* ---- Site notice banner (set in Admin) ---- */
.site-notice { background:linear-gradient(180deg, rgba(212,165,116,0.18), rgba(212,165,116,0.10)); border:1px solid rgba(212,165,116,0.5); color:var(--accent-soft); border-radius:10px; padding:11px 16px; margin:14px 0 0; font-size:0.92rem; line-height:1.4; }

/* ===== Dark-theme native form controls + scrollbars ===== */
:root { color-scheme: dark; }

select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-color: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 32px 9px 12px; font: inherit; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2397a8c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5l3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,165,116,0.18); }
.field select { padding: 11px 32px 11px 12px; }
select option, select optgroup { background: var(--surface); color: var(--text); }

textarea {
  background-color: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font: inherit; width: 100%; box-sizing: border-box;
  resize: vertical; min-height: 64px;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,165,116,0.18); }

input[type="file"] { color: var(--muted); font-size: 0.9rem; max-width: 100%; }
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 14px; margin-right: 12px; cursor: pointer; font: inherit;
}
input[type="file"]::file-selector-button:hover { background: var(--surface); border-color: var(--accent); }

/* Fill in any otherwise-unstyled text inputs */
input[type="text"], input[type="number"], input[type="password"], input[type="search"],
input[type="email"], input[type="date"], input[type="time"], input[type="datetime-local"] {
  background-color: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font: inherit;
}

/* Themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
::-webkit-scrollbar-corner { background: transparent; }

/* Trade screen: fixed, evenly-aligned columns so headers and rows line up. */
.trade-drop { table-layout: fixed; width: 100%; }
.trade-add { width: 100%; }
.trade-drop th:nth-child(1), .trade-drop td:nth-child(1) { width: 46%; }
.trade-drop th:nth-child(2), .trade-drop td:nth-child(2) { width: 18%; }
.trade-drop th:nth-child(3), .trade-drop td:nth-child(3) { width: 18%; text-align: right; }
.trade-drop th:nth-child(4), .trade-drop td:nth-child(4) { width: 18%; text-align: right; }
.trade-drop td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Auto-generated league rules page ===== */
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .rules-grid { grid-template-columns: 1fr; } }
.rules-card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--accent); }
.rules-card h4 { margin: 12px 0 6px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rules-table { width: 100%; border-collapse: collapse; }
.rules-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.rules-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.rules-table td.num { text-align: right; font-weight: 600; white-space: nowrap; }
.rules-table tr:last-child td { border-bottom: none; }
.rules-table tr.rules-sub td { color: var(--accent); font-weight: 700; border-top: 1px solid var(--border); }
.rules-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .rules-cols { grid-template-columns: 1fr; } }

/* Short injury tags */
.inj-tag { font-size: 0.68rem; font-weight: 800; padding: 1px 6px; border-radius: 4px; letter-spacing: 0.03em; }
.inj-tag.qst { background: rgba(232,200,150,0.18); color: var(--yellow); }
.inj-tag.dbt { background: rgba(217,140,63,0.18); color: var(--orange); }
.inj-tag.out { background: rgba(227,85,63,0.18); color: var(--red); }
.inj-tag.ir { background: rgba(227,85,63,0.38); color: #fff; }
/* Centered table cells + sortable headers */
td.ctr, th.ctr { text-align: center; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }

/* v3: player news on the detail card */
.player-news { background: rgba(212,175,55,0.06); border:1px solid rgba(212,175,55,0.25); border-radius:10px; padding:12px 14px; }
.player-news .news-headline { font-weight:700; color: var(--text); margin-bottom:4px; }
.player-news .news-body { color: var(--muted); font-size:0.92rem; line-height:1.45; }
.player-news .news-injury { margin-top:8px; color: var(--accent); font-size:0.88rem; }
.player-news .news-link { display:inline-block; margin-top:8px; color: var(--accent); font-size:0.86rem; font-weight:600; text-decoration:none; }
.player-news .news-link:hover { color: var(--accent-soft); text-decoration:underline; }
.player-news .news-expand { margin-top:6px; }
.player-news .news-expand > summary { cursor:pointer; color: var(--accent); font-size:0.86rem; font-weight:600; list-style:none; display:inline-block; }
.player-news .news-expand > summary::-webkit-details-marker { display:none; }
.player-news .news-expand > summary::after { content:' ▾'; font-size:0.75rem; }
.player-news .news-expand[open] > summary::after { content:' ▴'; }
.player-news .news-expand[open] > summary { margin-bottom:6px; }
.player-news .news-source { margin-top:8px; font-size:0.82rem; }
.player-news .news-source a { color: var(--accent); text-decoration:none; }
.player-news .news-source a:hover { text-decoration:underline; }

/* v3: live tracking page */
.live-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.live-badge { display:inline-flex; align-items:center; gap:6px; font-size:0.82rem; padding:4px 10px; border-radius:999px; background:rgba(40,167,69,0.15); color:#5fd07a; border:1px solid rgba(40,167,69,0.3); }
.live-badge.sim { background:rgba(212,175,55,0.12); color:var(--accent); border-color:rgba(212,175,55,0.3); }
.live-badge.off { background:rgba(120,120,120,0.15); color:var(--muted); border-color:rgba(120,120,120,0.3); }
.live-dot { width:8px; height:8px; border-radius:50%; background:currentColor; animation:livepulse 1.4s infinite; }
@keyframes livepulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.live-table td .gl { color:var(--muted); font-size:0.8rem; }
.live-status { font-size:0.78rem; color:var(--muted); }

/* v3: stacked + centered matchup (opponent over date/time) in Add / Trade tables */
.matchup-cell { display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1.25; gap:1px; }
.matchup-cell .mc-opp { white-space:nowrap; }
.matchup-cell .mc-kick { font-size:0.78rem; white-space:nowrap; }

/* v3: salary as a white stat box; let metrics wrap when there are many boxes */
.statbox-white .sv { color:#fff; }
.rmetrics { flex-wrap:wrap; row-gap:6px; justify-content:flex-end; }
.statbox-white { min-width:72px; }

/* v3: player match report */
.match-block { border:1px solid var(--border); border-radius:10px; padding:12px 14px; max-height:340px; overflow:auto; }
.match-head { color:var(--accent); font-weight:600; font-size:0.9rem; margin-bottom:8px; }
.match-group { margin-bottom:10px; }
.match-pos { font-weight:700; font-size:0.82rem; letter-spacing:0.5px; color:var(--muted); margin:6px 0 3px; }
.match-item { font-size:0.9rem; padding:2px 0; }

/* v3: center the Bye column in the trade-mode roster table */
td.bye { text-align: center; }

/* v5: pin table headers inside the player card while the body scrolls */
.modal table { border-collapse: collapse; }
.modal table thead th {
  position: sticky;
  top: -1px;
  background: var(--surface);
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--border);
}

/* v9: wide per-week breakdown tables (offense) scroll horizontally inside the card */
.table-scroll { overflow-x: auto; }
.table-scroll > table { width: 100%; }
.table-scroll table { white-space: nowrap; }

/* ============ Home / sign-in (v15) ============ */
.home { position: relative; min-height: 100vh; overflow: hidden; }

/* Signature: a gridiron at dusk — faint yard lines + the two hash-mark rows,
   lit by the brand's gold glow with a cool green wash rising from the turf. */
.home-field {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 540px at 84% -12%, rgba(212,165,116,0.17), transparent 60%),
    radial-gradient(900px 560px at 4% 116%, rgba(95,191,138,0.08), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 85px, rgba(232,200,150,0.055) 85px 86px),
    var(--bg);
}
.home-field::before, .home-field::after {
  content: ''; position: absolute; left: 0; right: 0; height: 16px; opacity: .55;
  background: repeating-linear-gradient(90deg, rgba(232,200,150,0.13) 0 2px, transparent 2px 28px);
}
.home-field::before { top: 39%; }
.home-field::after  { top: 61%; }

.home-inner {
  position: relative; z-index: 1; box-sizing: border-box;
  min-height: calc(100vh - 62px); max-width: 1060px; margin: 0 auto;
  padding: clamp(28px, 6vh, 72px) 24px;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.home-hero { max-width: 560px; }
.brand-lg { gap: 12px; margin-bottom: 22px; }
.brand-lg .ball { font-size: 2rem; }
.brand-lg .brand-name { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.72rem; font-weight: 700; color: var(--accent); margin-bottom: 14px; }
.home-title { font-size: clamp(2.3rem, 5.2vw, 3.6rem); line-height: 1.04; font-weight: 800; letter-spacing: -0.035em; margin-bottom: 18px; }
.home-title em { font-style: italic; color: var(--accent); font-weight: 800; }
.home-sub { color: var(--muted); font-size: 1.02rem; line-height: 1.6; max-width: 46ch; margin-bottom: 26px; }
.home-feats { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 11px 18px; padding: 0; margin: 0; }
.home-feats li { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; color: var(--text); }
.home-feats .fi { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 0.95rem; flex-shrink: 0; }

.home-auth { width: 100%; max-width: 400px; justify-self: end; }
.home-foot { position: relative; z-index: 1; text-align: center; padding: 16px 24px 26px; color: var(--muted); font-size: 0.8rem; }

/* Entrance — quiet, and disabled for reduced-motion */
.home-hero, .home-auth { animation: homeRise .5s cubic-bezier(.2,.7,.2,1) both; }
.home-auth { animation-delay: .07s; }
@keyframes homeRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 880px) {
  .home-inner { grid-template-columns: 1fr; gap: 30px; min-height: 0; padding-top: 7vh; }
  .home-hero { max-width: none; text-align: center; margin: 0 auto; }
  .brand-lg { justify-content: center; }
  .home-sub { margin-left: auto; margin-right: auto; }
  .home-feats { max-width: 430px; margin: 0 auto; }
  .home-auth { justify-self: center; }
  .home-field::before { top: 34%; } .home-field::after { top: 66%; }
}
@media (max-width: 460px) { .home-feats { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .home-hero, .home-auth { animation: none; } }

/* ============ News sync report (admin, v16) ============ */
.news-report { margin-top:10px; border:1px solid var(--border); border-radius:8px; background: var(--surface-2); }
.news-report summary { cursor:pointer; padding:9px 12px; font-weight:600; color: var(--text); }
.news-report.unmatched summary { color: var(--orange); }
.news-report .news-rows { padding:4px 12px 10px; max-height:320px; overflow-y:auto; }
.news-row { padding:6px 0; border-top:1px solid var(--border); font-size:0.9rem; display:flex; gap:8px; flex-wrap:wrap; }
.news-row b { color: var(--text); }
.news-row .muted { color: var(--muted); }

/* ============ Player News spreadsheet editor (admin, v19) ============ */
.news-grid { width:100%; border-collapse:collapse; font-size:0.85rem; }
.news-grid thead th { position:sticky; top:0; background: var(--surface-2); color: var(--muted);
  text-align:left; font-weight:600; padding:8px 6px; border-bottom:1px solid var(--border); z-index:1; white-space:nowrap; }
.news-grid td { padding:2px 4px; border-bottom:1px solid var(--border); vertical-align:middle; }
.news-grid td input { width:100%; box-sizing:border-box; background:transparent; border:1px solid transparent;
  border-radius:6px; padding:6px 7px; color: var(--text); font-size:0.85rem; }
.news-grid td input:hover { border-color: var(--border); }
.news-grid td input:focus { outline:none; border-color: var(--accent); background: var(--surface); }
.news-grid td:nth-child(1) { min-width:150px; } /* name */
.news-grid td:nth-child(2), .news-grid td:nth-child(3) { width:62px; } /* team, pos */
.news-grid td:nth-child(4) { min-width:220px; } /* headline */
.news-grid td:nth-child(5) { min-width:280px; } /* body */
.news-grid td:nth-child(6) { min-width:130px; } /* source */
.news-grid td:nth-child(7) { width:120px; } /* date */
.news-grid .news-del { background:transparent; border:none; color: var(--muted); cursor:pointer; font-size:0.95rem; padding:4px 6px; border-radius:6px; }
.news-grid .news-del:hover { color: var(--red, #e3553f); background: rgba(227,85,63,0.12); }

.np-overlay { position:fixed; inset:0; background:rgba(4,10,20,0.6); display:flex; align-items:center; justify-content:center; z-index:1000; padding:20px; }
.np-box { background: var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px 22px; width:100%; max-width:680px; box-shadow:0 20px 60px rgba(0,0,0,0.5); }

/* ============ Players page toolbar (v22) ============ */
.players-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.players-toolbar select { padding:8px 30px 8px 11px; }
.players-toolbar label { font-size:0.85rem; }

/* ============ Players page Stats/Fantasy-pts toggle (v25) ============ */
.seg { display:inline-flex; border:1px solid var(--border); border-radius:9px; overflow:hidden; }
.seg-btn { background:transparent; border:none; color:var(--muted); padding:8px 14px; font-size:0.85rem; font-weight:600; cursor:pointer; }
.seg-btn + .seg-btn { border-left:1px solid var(--border); }
.seg-btn.active { background:var(--accent); color:#06222f; }
.seg-btn:not(.active):hover { color:var(--text); background:var(--surface); }

/* ============ Players page sortable column header (v26) ============ */
#playersList { overflow-x: auto; }
.rrow.rhead { border-top: none; padding-top: 0; padding-bottom: 4px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.rrow.rhead .statbox { padding-top: 5px; padding-bottom: 5px; }
.hcol { font-size: 0.62rem; letter-spacing: 0.5px; color: var(--muted); white-space: nowrap; }
.sortcol { cursor: pointer; user-select: none; }
.sortcol .sl, .sortcol .hcol { white-space: nowrap; }
.sortcol:hover .sl, .sortcol:hover .hcol { color: var(--text); }
.sortcol.on .sl, .sortcol.on .hcol { color: var(--accent); font-weight: 700; }

/* ============ Players page dense table (v27) ============ */
#playersList { overflow: visible; }
.players-head h3 { margin: 4px 0 8px; font-size: 0.95rem; color: var(--text); }
.players-head .slot-count { color: var(--muted); font-weight: 500; }
table.stats.compact { width: 100%; border-collapse: collapse; }
table.stats.compact th, table.stats.compact td { padding: 6px 9px; font-size: 0.83rem; border-bottom: 1px solid var(--border); }
table.stats.compact thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted);
  font-size: 0.64rem; letter-spacing: 0.4px; text-transform: uppercase; }
table.stats.compact thead th.on { color: var(--accent); }
table.stats.compact tbody tr { cursor: pointer; }
table.stats.compact tbody tr:hover td { background: var(--surface-2); }
table.stats.compact .pcell { white-space: nowrap; }
table.stats.compact .pname { font-weight: 600; color: var(--text); }
table.stats.compact .psub { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 1px; }
table.stats.compact td.num { text-align: center; font-variant-numeric: tabular-nums; color: var(--text); }
table.stats.compact th.num { text-align: center; }
table.stats.compact th:first-child, table.stats.compact td.pcell { text-align: left; }

/* ============ Standings: clickable week scores + week lineup (v35) ============ */
table.standings td.wk-score, table.stats td.wk-score { cursor: pointer; border-radius: 6px; transition: color .12s ease, background .12s ease; }
table.standings td.wk-score:hover, table.stats td.wk-score:hover { color: var(--accent); background: rgba(212,165,116,0.14); font-weight: 700; }
table.wk-lineup { width: 100%; border-collapse: collapse; }
table.wk-lineup th { text-align: left; color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.4px; padding: 4px 8px; border-bottom: 1px solid var(--border); }
table.wk-lineup th:last-child, table.wk-lineup td.pts { text-align: right; }
table.wk-lineup td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.wk-lineup td.wk-slot { font-weight: 700; color: var(--muted); font-size: 0.78rem; width: 52px; }
table.wk-lineup td.pts { font-variant-numeric: tabular-nums; font-weight: 600; }
table.wk-lineup tfoot td { border-top: 2px solid var(--border); border-bottom: none; font-weight: 700; }

/* DNP tag in the standings week lineup (v37) */
.dnp-tag { display:inline-block; font-size:0.66rem; font-weight:700; letter-spacing:0.3px; color: var(--muted); border:1px solid var(--border); border-radius:999px; padding:1px 7px; }

/* ============ Live team board (v38) ============ */
table.live-table th.num, table.live-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
table.live-table .th-sub { font-weight: 400; font-size: 0.62rem; letter-spacing: 0.3px; color: var(--muted); text-transform: uppercase; }
table.live-table tr.wk-score-row { cursor: pointer; transition: background .12s ease; }
table.live-table tr.wk-score-row:hover { background: rgba(212,165,116,0.10); }
table.live-table td.live-week { color: var(--accent); font-weight: 600; }
table.live-table td.total strong { font-size: 1.02rem; }
.lock-chip { display:inline-block; font-size:0.62rem; font-weight:700; letter-spacing:0.3px; color:#06222f; background: var(--accent); border-radius:999px; padding:1px 7px; margin-left:6px; vertical-align:middle; }
/* live detail stat line */
td.statline { white-space: normal; }
.sl-chip { display:inline-block; font-size:0.72rem; color: var(--text); background: var(--surface-2, rgba(255,255,255,0.04)); border:1px solid var(--border); border-radius:6px; padding:1px 7px; margin:1px 3px 1px 0; font-variant-numeric: tabular-nums; }
.sl-chip b { color: var(--accent); font-weight: 700; }
.live-status { font-size:0.74rem; color: var(--muted); }

/* live board: muted "no lineup" chip (v39) */
.lock-chip.muted-chip { background: transparent; color: var(--muted); border: 1px solid var(--border); }

/* live detail: per-player game score + clock (v40) */
td.live-game { white-space: nowrap; }
td.live-game .game-score { display:block; font-size:0.8rem; font-variant-numeric: tabular-nums; }
td.live-game .game-clock { display:block; font-size:0.68rem; color: var(--muted); }
td.live-game .game-clock.final { color: var(--green); font-weight:600; }

/* Live page: center the circled columns; keep Player left (v41) */
table.live-table th, table.live-table td { text-align: center; }
table.live-table th:nth-child(2), table.live-table td.team-name { text-align: left; }
#liveDetailPanel table th, #liveDetailBody td { text-align: center; }
#liveDetailPanel table th:nth-child(2), #liveDetailBody td.clickable { text-align: left; }
#liveDetailBody td.live-game .game-score,
#liveDetailBody td.live-game .game-clock { text-align: center; }
#liveDetailBody td.statline { text-align: center; }

/* Roster + Add/Trade tables: center every column except the player name (v43) */
#rosterGroups table th, #rosterGroups table td { text-align: center; }
#rosterGroups table th:first-child,
#rosterGroups table td:first-child,
#rosterGroups table td.clickable { text-align: left; }
#availableHead th, #availableBody td { text-align: center; }
#availableHead th:first-child, #availableBody td.clickable { text-align: left; }

/* Trade-mode roster: locked players show a faded x where the Bench/✕ live (v45) */
.row-actions.locked-actions { justify-content: flex-start; }
/* v46: equal-width move slot so "Locked" sits under Bench and the faded ✕ under ✕ */
.row-actions .act-move { min-width: 62px; text-align: center; }
.act-locked { opacity: 0.6; color: var(--orange); cursor: default; }
.act-faded { opacity: 0.35; cursor: default; pointer-events: none; }


/* Admin: live tracker sources + schedule (v49) */
.live-admin-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.live-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.live-toggle input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.live-toggle input:disabled { cursor: not-allowed; opacity: .5; }
.live-window { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.live-window select, .live-window input[type="time"] { padding: 7px 10px; }
.live-window .lw-day { min-width: 120px; }
