@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap');

:root {
  --bg: #14161b;
  --surface: #1c1f26;
  --surface-2: #23262f;
  --border: #2a2e38;
  --text: #d2d7e0;
  --muted: #97a1b0;
  --accent: #b23a3a;
  --accent-rgb: 178, 58, 58;
  --accent-strong: color-mix(in srgb, var(--accent), #000 24%);
  --accent-soft: color-mix(in srgb, var(--accent), #fff 28%);
  --accent-tint: rgba(var(--accent-rgb), 0.14);
  --accent-tint-2: rgba(var(--accent-rgb), 0.30);
  --green: #4fa07d;
  --yellow: #c9a24e;
  --orange: #c8964a;
  --red: #e0645c;
  --radius: 12px;
  --cx: 24px; --cy: 24px;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --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: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1400px; margin: 0 auto; padding: 0 var(--cx) var(--cy); }

/* Top bar */
.topbar {
  display: flex; justify-content: flex-start; align-items: center;
  gap: 20px; flex-wrap: wrap;
  margin: 0 calc(50% - 50vw) 22px;
  padding: 15px max(var(--cx), calc(50vw - 700px + var(--cx)));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; letter-spacing: -0.01em; line-height: 1.05; margin: 0; }
.brand .ball { font-size: 0; width: 42px; height: 42px; flex: none; border-radius: 12px; background-image: url('/img/fanclones-logo.png'); background-size: contain; background-position: center; background-repeat: no-repeat; }
.brand .tag { color: var(--muted); font-size: 0.66rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; letter-spacing: 0.14em; margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.nav-toggle { display: none; width: 42px; height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); cursor: pointer; align-items: center; justify-content: center; flex-direction: column; gap: 4px; padding: 0; flex: none; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.topbar.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topbar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.topbar.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.user-chip { display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 5px 14px 5px 5px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-tint); border: 1px solid var(--accent-tint-2);
  display: grid; place-items: center; font-weight: 700; color: var(--accent-soft); flex: none; font-size: 0.82rem;
}
.user-chip .name { font-weight: 600; line-height: 1.1; font-size: 0.9rem; }
.user-chip .team { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* 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: #fff; }
.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(var(--accent-rgb),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(var(--accent-rgb),0.18); }
.field .check-inline { display: flex; flex-direction: row; align-items: center; gap: 9px; cursor: pointer; color: var(--text); font-weight: 600; font-size: 0.9rem; }
.field .check-inline input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; accent-color: var(--accent); cursor: pointer; }
.field .check-inline .muted { font-weight: 400; }
.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; text-align: center; }
.rhead-left, .rhead-right { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.fp-totals { display: inline-flex; gap: 6px; }
.fp-total { font-size: 0.72rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.fp-total b { color: var(--accent); }
.shot-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 3px 5px; display: inline-flex; align-items: center; vertical-align: middle; border-radius: 6px; }
.shot-btn:hover { color: var(--accent); background: var(--surface-2); }
.shot-btn:disabled { opacity: 0.5; cursor: default; }
/* Screenshot roster card (rendered off-screen, captured to PNG) */
.shot-card { background: #14161b; color: #d2d7e0; font-family: system-ui, -apple-system, sans-serif; padding: 22px 24px; box-sizing: border-box; }
.shot-card .shot-title { font-size: 23px; font-weight: 800; letter-spacing: -0.01em; }
.shot-card .shot-sub { font-size: 13px; color: #878d9b; margin-top: 2px; }
.shot-card .shot-meta { font-size: 12px; color: #d96b6b; margin-top: 7px; font-weight: 700; }
.shot-card .shot-group { margin-top: 15px; }
.shot-card .shot-glabel { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #878d9b; border-bottom: 1px solid #2a2e38; padding-bottom: 5px; margin-bottom: 4px; }
.shot-card .shot-row { display: grid; grid-template-columns: 30px 1fr 46px 78px; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.shot-card .shot-pos { font-size: 10px; font-weight: 800; color: #878d9b; }
.shot-card .shot-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot-card .shot-team { color: #878d9b; font-size: 12px; }
.shot-card .shot-sal { text-align: right; font-weight: 700; color: #d96b6b; }
.shot-card .shot-foot { margin-top: 18px; font-size: 11px; color: #5b6270; text-align: center; letter-spacing: 0.02em; }
.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); }
.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: #fff; }

/* 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; position: relative; overflow: hidden; }
.player-pic-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface-2); }
.starter-star { position: absolute; top: -3px; left: -3px; z-index: 3; color: #ffcc33; font-size: 0.72rem; line-height: 1; text-shadow: 0 0 3px rgba(0,0,0,0.95), 0 1px 1px rgba(0,0,0,0.85); pointer-events: none; }
.starter-star.silver { color: #c4ccd6; }
.player-pic:has(.starter-star) { overflow: visible; }
.player-pic:has(.starter-star) .player-pic-img { border-radius: 50%; }
.player-pic-img.is-logo { object-fit: contain; padding: 4px; background: transparent; }
.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); }
.inj.PUP { background: rgba(150,120,220,0.18); color: #c4b1f0; }
.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(var(--accent-rgb),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: #fff; }
.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; }
.modal-x { position: sticky; top: 0; margin: 0 0 -30px auto; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; z-index: 5; flex: none; }
.modal-x:hover { background: var(--border); color: var(--accent); }

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(var(--accent-rgb),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(var(--accent-rgb),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(var(--accent-rgb),0.07); }
.standings .rank { color: var(--muted); font-weight: 700; width: 36px; }
.standings .team-name { font-weight: 600; }
.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(var(--accent-rgb),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-sub .dsal { color: var(--accent); font-weight: 600; }
.detail-bio { margin-top: 4px; color: var(--muted); font-size: 0.82rem; }
.season-tabs-wrap { text-align: center; margin: 16px 0 4px; }
.season-tabs { display: inline-flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; margin: 0; }
.season-tab { background: transparent; border: none; color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 600; padding: 6px 14px; border-radius: 7px; cursor: pointer; }
.season-tab:hover { color: var(--text); }
.season-tab.active { background: var(--accent); color: #fff; }
.season-tab.active:hover { color: #fff; }
.season-tab-yr { opacity: 0.7; font-weight: 500; }
.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); }
.tag-bye { font-size: 0.68rem; font-weight: 700; color: var(--muted); }
.row-bye td { opacity: 0.75; }
.row-current { background: rgba(var(--accent-rgb),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(var(--accent-rgb),.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:#fff; font-weight:600; }
.main-grid.roster-only { grid-template-columns: 1fr; }
.main-grid.roster-only #availablePanel { display:none; }

/* ---- Team header (league title + trades + rules + mode toggle) ---- */
.team-header { display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.team-header-main { flex:1; min-width:0; }
.team-header-title-row { display: flex; align-items: center; gap: 8px; }
.btn-rename { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.95rem; padding: 2px 6px; border-radius: 6px; line-height: 1; }
.btn-rename:hover { color: var(--accent); background: var(--surface-2); }

/* League tab bar (team page + league-scoped pages) — segmented control style */
.league-tabs { display: inline-flex; flex-wrap: wrap; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.league-tabs .lt { padding: 8px 16px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; white-space: nowrap; cursor: pointer; background: var(--surface); }
.league-tabs .lt + .lt { border-left: 1px solid var(--border); }
.league-tabs .lt:not(.active):hover { color: var(--text); }
.league-tabs .lt.active { background: var(--accent); color: #fff; }
.trades-badge { display: inline-block; font-size: 0.72rem; font-weight: 700; color: var(--muted); margin-left: 10px; padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; vertical-align: middle; white-space: nowrap; }
@media (max-width: 760px) { .league-tabs .lt { padding: 7px 12px; font-size: 0.85rem; } }
.team-header-title { font-size:1.15rem; font-weight:700; }
.team-header-league { font-size:0.85rem; }
.team-header-trades { font-size:0.85rem; }

/* ---- 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; }
.lineup-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.lineup-head h2 { margin: 0; }
#lineupBody td.statline { padding-left: 8px; margin-top: 0; line-height: 1.5; vertical-align: middle; }
#lineupBody .mu-team { display: block; }
#lineupBody .mu-sub { display: block; font-size: 0.85em; margin-top: 1px; }
#lineupBody td.pts { text-align: center; }

/* ---- 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; }
/* Open-slot placeholders have an empty move control — drop its circle outline so
   it doesn't look like a stray dot next to the avatar, but keep the width so
   filled and open rows still line up. */
.rmove.off:empty { border-color:transparent; opacity:1; }
.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:#fff; 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(var(--accent-rgb),0.18), rgba(var(--accent-rgb),0.10)); color:var(--accent-soft); margin:0 calc(50% - 50vw) 0; padding:11px max(var(--cx), calc(50vw - 700px + var(--cx))); font-size:0.92rem; line-height:1.4; text-align:center; }

/* ===== 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='%2397a1b0' 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(var(--accent-rgb),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(var(--accent-rgb),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; }

/* Always-visible scrollbar on horizontally-scrolling containers so it's obvious
   you can scroll on mobile (where overlay scrollbars stay hidden until swiped).
   Swipe/drag scrolling still works exactly as before. */
.table-scroll, .tscroll, .standings-wrap, .offense-scroll, #playersList { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.table-scroll::-webkit-scrollbar,
.tscroll::-webkit-scrollbar,
.standings-wrap::-webkit-scrollbar,
.offense-scroll::-webkit-scrollbar,
#playersList::-webkit-scrollbar { -webkit-appearance: none; height: 9px; width: 9px; }
.table-scroll::-webkit-scrollbar-thumb,
.tscroll::-webkit-scrollbar-thumb,
.standings-wrap::-webkit-scrollbar-thumb,
.offense-scroll::-webkit-scrollbar-thumb,
#playersList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: none; }

/* On mobile, force a persistent, grabbable page scrollbar (and on every scroll
   area) so there's always a visible way to scroll if swiping doesn't work. */
@media (max-width: 760px) {
  html { overflow-y: scroll; }
  ::-webkit-scrollbar { -webkit-appearance: none; width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: none; }
}

/* 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; }
.inj-tag.pup { background: rgba(150,120,220,0.22); color: #c4b1f0; }
/* 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-injury { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.player-injury .news-injury { display:flex; align-items:center; gap:7px; color: var(--text); font-size:0.9rem; }
.player-injury .inj { display:inline; }
.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; }

/* Flat solid backdrop — the gridiron glow/yard-line treatment was removed so the
   home page matches every other page's single-color background. */
.home-field {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: var(--bg);
}
.home-field::before, .home-field::after { content: none; }

.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; }
.home-logo { display: block; width: 100%; max-width: 260px; height: auto; }
.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-logo { max-width: 190px; margin: 0 auto; }
  .home-sub { margin-left: auto; margin-right: auto; }
  .home-feats { max-width: 430px; margin: 0 auto; }
  .home-auth { justify-self: center; }
}
@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); }
.missing-row { align-items: center; gap: 10px; justify-content: space-between; }
.missing-row .mr-name { flex: 1 1 150px; min-width: 140px; }
.missing-row .mr-inputs { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.missing-row .mr-inputs input { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.85rem; }
.missing-row .mr-sal { width: 92px; }
.missing-row .mr-proj { width: 66px; }
.missing-row.added .mr-name b { opacity: 0.55; }
.mr-done { color: var(--green); font-weight: 600; font-size: 0.85rem; }

/* ============ 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:#fff; }
.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.wk-click, table.stats td.wk-score { cursor: pointer; border-radius: 6px; transition: color .12s ease, background .12s ease; }
table.standings td.wk-score.wk-click:hover, table.stats td.wk-score:hover { color: var(--accent); background: rgba(var(--accent-rgb),0.14); font-weight: 700; }
table.wk-lineup { width: 100%; border-collapse: collapse; table-layout: fixed; }
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; }
.final-score { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.final-score.W { color: var(--green); }
.final-score.L { color: var(--red); }

/* ============ 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(var(--accent-rgb),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:#fff; 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.72rem; font-variant-numeric: tabular-nums; }
td.live-game .game-clock { display:block; font-size:0.62rem; 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; }
table.live-table { width: 100%; }
#liveDetailPanel table th, #liveDetailBody td { text-align: center; }
#liveDetailPanel table th:nth-child(2), #liveDetailPanel table th.statline-col,
#liveDetailBody td.clickable, #liveDetailBody td.statline { text-align: left; }

/* 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; }

/* ---- Depth charts page ---- */
.depth-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.depth-toolbar input { flex: 1 1 240px; min-width: 180px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font: inherit; }
.depth-toolbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.18); }
.depth-league { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font: inherit; max-width: 240px; }
.depth-league:focus { outline: none; border-color: var(--accent); }
.depth-note { margin: 0 0 16px; font-size: 0.82rem; }
.depth-updated { margin-left: auto; font-size: 0.78rem; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }

.depth-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
/* Players view: starter cards with hover-salary */
.pv-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); align-items: start; }
.pv-body { padding: 4px 14px 8px; }
.pv-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pv-row:last-child { border-bottom: none; }
.pv-pos { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.pv-name { position: relative; font-size: 0.9rem; color: var(--text); width: max-content; }
.pv-name.is-clickable { cursor: pointer; }
.pv-name.is-clickable:hover { color: var(--accent); }
.pv-name[data-sal]:hover::after { content: attr(data-sal); position: absolute; left: 0; top: 100%; margin-top: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 0.78rem; font-weight: 700; color: var(--accent); white-space: nowrap; z-index: 20; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
/* Last row (e.g. the kicker) — flip the tooltip above so the card doesn't clip it. */
.pv-row:last-child .pv-name[data-sal]:hover::after { top: auto; bottom: 100%; margin-top: 0; margin-bottom: 4px; }
.pv-team-abbr { font-size: 0.72rem; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.pv-logo { width: 16px; height: 16px; object-fit: contain; flex: 0 0 auto; }
.pv-name .pv-logo { vertical-align: -3px; margin-right: 5px; }
.pv-name .inj-tag { margin-left: 6px; vertical-align: 1px; }
.pos-card .pv-row { grid-template-columns: 62px 1fr; }
.pos-card .depth-team-head { border-left: 0; }
.pos-card .depth-team-abbr { font-size: 0.72rem; }

.depth-team { background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.depth-team-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.depth-team-id { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.depth-logo { width: 26px; height: 26px; object-fit: contain; flex: none; }
.depth-team-name { font-weight: 700; font-size: 1.02rem; color: var(--text); letter-spacing: -0.01em; }
.depth-team-abbr { font-size: 0.72rem; font-weight: 700; letter-spacing: .08em; color: var(--accent); }

.depth-team-body { padding: 0; }
.depth-row { display: grid; grid-template-columns: 46px 1fr; align-items: start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.depth-row:last-child { border-bottom: none; }
.depth-pos { justify-self: start; margin-top: 3px; }
.depth-players { display: flex; flex-wrap: wrap; gap: 7px; }

.depth-player { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2); border-radius: 8px; padding: 5px 11px; font-size: 0.86rem; line-height: 1.4; color: var(--text); transition: background .12s ease; position: relative; }
.depth-player[data-sal]:hover::after { content: attr(data-sal); position: absolute; left: 50%; transform: translateX(-50%); bottom: 100%; margin-bottom: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 0.75rem; font-weight: 700; color: var(--accent); white-space: nowrap; z-index: 20; box-shadow: 0 6px 18px rgba(0,0,0,.45); pointer-events: none; }
.depth-player.is-clickable { cursor: pointer; }
.depth-player.is-clickable:hover { background: #1b3c60; }
.depth-player.is-clickable .depth-name { text-decoration: underline; text-decoration-color: rgba(var(--accent-rgb),0.4); text-underline-offset: 2px; }
.depth-player.is-starter { background: rgba(var(--accent-rgb),0.15); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb),0.5); }
.depth-player.is-starter .depth-name { color: var(--accent-soft); font-weight: 600; }
.depth-num { font-size: 0.7rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.depth-name { color: var(--text); }
.depth-inj { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.depth-inj.out { background: var(--red); }
.depth-inj.doubt { background: var(--orange); }
.depth-inj.quest { background: var(--yellow); }
.depth-empty { color: var(--muted); font-size: 0.86rem; }

/* Available players header + hide-free-agents toggle */
.avail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.avail-head h2 { margin: 0; display: flex; align-items: center; }
.fa-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); cursor: pointer; user-select: none; }
.fa-toggle input { cursor: pointer; }

/* ---- Blog ---- */
.blog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.post-list { display: flex; flex-direction: column; }
.post-item { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border); text-decoration: none; }
.post-item:last-child { border-bottom: none; }
.post-item:hover .post-item-title { color: var(--accent); }
.post-item-title { color: var(--text); font-weight: 600; font-size: 1.05rem; }
.post-item-date { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.post-back { color: var(--muted); text-decoration: none; font-size: 0.85rem; display: inline-block; margin-bottom: 14px; }
.post-back:hover { color: var(--accent); }
.post-title { margin: 0 0 6px; color: var(--text); font-size: 1.9rem; text-align: center; }
.post-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 20px; text-align: center; }
.post-draft { font-size: 0.7rem; background: var(--surface-2); color: var(--accent-soft); padding: 2px 7px; border-radius: 5px; vertical-align: middle; border: 1px solid var(--border); font-weight: 600; }
.blog-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.blog-row:last-child { border-bottom: none; }
.blog-row-title { color: var(--text); font-weight: 600; }

/* Rendered markdown */
.prose { color: var(--text); line-height: 1.7; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--text); margin: 1.3em 0 0.5em; line-height: 1.25; }
.prose h1 { font-size: 1.6rem; }
.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.15rem; }
.prose h4 { font-size: 1rem; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose ul, .prose ol { margin: 0 0 1em 1.4em; padding: 0; }
.prose li { margin: 0.25em 0; }
.prose blockquote { margin: 0 0 1em; padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--muted); }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 0.9em; font-family: 'Courier New', monospace; }
.prose pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; margin: 0 0 1em; }
.prose pre code { background: none; padding: 0; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; margin: 0.5em 0; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

/* ---- Rich text editor (blog) ---- */
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; }
.rte-toolbar select { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; font-size: 0.82rem; }
.rte-btn { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; font-size: 0.85rem; cursor: pointer; line-height: 1; }
.rte-btn:hover { border-color: var(--accent); color: var(--accent); }
.rte-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.rte-color { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.rte-src-toggle { font-family: 'Courier New', monospace; }
.rte-editor { min-height: 260px; max-height: 520px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 8px 8px; padding: 14px 16px; outline: none; }
.rte-editor:focus { border-color: var(--accent); }
.rte-editor:empty::before { content: 'Write your post here…'; color: var(--muted); }
.rte-source { border-radius: 0 0 8px 8px !important; font-family: 'Courier New', monospace; font-size: 0.85rem; }

/* ---- Responsive / mobile ---- */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 760px) {
  :root { --cx: 12px; --cy: 14px; }

  /* Header: brand + hamburger; the menu collapses behind the toggle */
  .topbar { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
  .brand h1 { font-size: 1.2rem; }
  .nav-toggle { display: inline-flex; }
  .nav-links, .topbar-actions { display: none; width: 100%; order: 3; flex-direction: column; align-items: stretch; gap: 4px; margin-left: 0; }
  .topbar.nav-open .nav-links, .topbar.nav-open .topbar-actions { display: flex; }
  .nav-links { gap: 2px; overflow: visible; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
  .nav-links a { padding: 11px 12px; font-size: 0.95rem; }
  .topbar-actions .btn { width: 100%; text-align: center; }
  .user-chip { padding: 6px 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

  .panel { padding: 15px 13px; }
  .panel h2 { font-size: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px; }

  /* Wide data tables scroll inside their panel instead of the whole page */
  #lineupBody, #liveDetailBody, .tscroll, .roster-group { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tscroll table, #lineupBody > table, table.standings, table.stats { min-width: 520px; }
  .roster-group table { min-width: 460px; }

  /* Nothing may push the page wider than the screen — a single wide child used
     to rescale the whole page ("everything looks zoomed out"). Wide content now
     lives in its own horizontal scroller, so clipping the page edge is safe. */
  html, body { overflow-x: hidden; }

  /* iOS Safari zooms in on any focused input under 16px and never zooms back —
     that's the "stuck zoomed in" feeling. Force 16px on form controls on phones. */
  input, select, textarea { font-size: 16px; }

  /* Roster rows: shrink the fixed name column so the stat metrics start sooner
     and less horizontal scrolling is needed to read them. */
  .rrow .rinfo { flex-basis: 148px; width: 148px; }

  /* Add / edit player (and other) modals: use nearly the full screen, keep the
     Save / Cancel buttons full-width and easy to tap. */
  .modal-backdrop { padding: 10px; }
  .modal { padding: 16px 14px; max-height: 92vh; }
  .modal-actions { margin-top: 16px; }
  .modal-actions .btn { flex: 1; text-align: center; justify-content: center; }
}

/* Available-players list on phones. Columns are reordered in app.js to
   Player · Add · Salary · Points · Game. The table scrolls BOTH ways inside its
   box — vertically through the list, horizontally to reveal the Game column that
   sits off the right edge — each with a visible scrollbar. Its height is capped
   so the rest of the page still scrolls past it. */
@media (max-width: 760px) {
  #availablePanel .table-scroll {
    overflow: auto;                 /* both axes scroll inside the box */
    max-height: 58vh;               /* leaves room to scroll the page around it */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  #availablePanel .table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
  #availablePanel .table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
  #availablePanel .table-scroll::-webkit-scrollbar-track { background: transparent; }

  /* Fixed column widths (border-box) so rows align and the table is wider than
     the screen — that's what creates the horizontal scroll. Sum ≈ 440px. */
  #availablePanel table { table-layout: fixed; min-width: 440px; }
  #availablePanel th, #availablePanel td { padding: 8px 6px; font-size: 0.8rem; }
  #availablePanel th { font-size: 0.66rem; letter-spacing: .02em; }
  #availablePanel td:nth-child(1), #availablePanel th:nth-child(1) { width: 160px; }  /* Player  */
  #availablePanel td:nth-child(2), #availablePanel th:nth-child(2) { width: 54px; }   /* Add     */
  #availablePanel td:nth-child(3), #availablePanel th:nth-child(3) { width: 78px; }   /* Salary  */
  #availablePanel td:nth-child(4), #availablePanel th:nth-child(4) { width: 52px; }   /* Points  */
  #availablePanel td:nth-child(5), #availablePanel th:nth-child(5) { width: 96px; }   /* Game    */
  /* Push the Add button to the right of its column so it sits snug against Salary. */
  #availablePanel td:nth-child(2) { text-align: right; padding-left: 0; padding-right: 6px; }

  /* Flex children default to min-width:auto, which let long team names (e.g. DST)
     spill past the column into the Add button. Pin to 0 so names wrap in place. */
  #availablePanel .player-cell { gap: 7px; min-width: 0; }
  #availablePanel .player-meta { min-width: 0; }
  #availablePanel .player-pic { width: 26px; height: 26px; }
  #availablePanel .player-meta .nm { font-size: 0.82rem; line-height: 1.15; overflow-wrap: anywhere; }
  #availablePanel .player-meta .sub { font-size: 0.68rem; gap: 4px; }
  #availablePanel .pos { padding: 1px 5px; font-size: 0.64rem; }

  /* Keep the opponent, hide the kickoff time to keep the Game column compact. */
  #availablePanel .matchup-cell .mc-kick { display: none; }
  #availablePanel .matchup-cell .mc-opp { font-size: 0.78rem; }

  #availablePanel td.ctr, #availablePanel th.ctr { white-space: nowrap; }
  #availablePanel .btn-sm { padding: 5px 9px; font-size: 0.74rem; }
}

/* Trade-mode roster ("Your roster" on the Add/Trade page) on phones. Mirrors the
   available table above it: compact rows, reordered to Player · Actions · Salary ·
   Bye · Game (done in app.js), with each position table scrolling horizontally on
   its own so the page still scrolls vertically. */
@media (max-width: 760px) {
  /* Don't box the roster vertically — let the page scroll; tables scroll sideways. */
  #rosterGroups.scroll-roster { max-height: none; overflow: visible; padding-right: 0; }
  #rosterGroups .roster-group {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: var(--accent-strong) var(--surface-2);
  }
  #rosterGroups .roster-group::-webkit-scrollbar { height: 6px; }
  #rosterGroups .roster-group::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 999px; }
  #rosterGroups .roster-group::-webkit-scrollbar-thumb { background: var(--accent-strong); border-radius: 999px; }

  /* Fixed widths (sum 434px) → wider than the screen, so Game scrolls into view. */
  #rosterGroups .roster-group table { min-width: 452px; width: 452px; table-layout: fixed; }
  #rosterGroups th, #rosterGroups td { padding: 8px 6px; font-size: 0.8rem; }
  #rosterGroups .roster-group h3 { font-size: 0.72rem; }

  /* Player names wrap in place instead of spilling into the next column. */
  #rosterGroups .player-cell { gap: 7px; min-width: 0; }
  #rosterGroups .player-meta { min-width: 0; }
  #rosterGroups .player-pic { width: 26px; height: 26px; }
  #rosterGroups .player-meta .nm { font-size: 0.82rem; line-height: 1.15; overflow-wrap: anywhere; }
  #rosterGroups .player-meta .sub { font-size: 0.68rem; }
  #rosterGroups .pos { padding: 1px 5px; font-size: 0.64rem; }

  /* Compact action buttons, right-aligned so they sit next to Salary. */
  #rosterGroups .row-actions { gap: 10px; justify-content: flex-end; }
  #rosterGroups .row-actions .act-move { min-width: 0; padding: 4px 7px; font-size: 0.66rem; }
  #rosterGroups .row-actions .act-x { padding: 4px 8px; font-size: 0.72rem; }

  /* Keep the opponent, drop the kickoff time in the Game column. */
  #rosterGroups .mc-kick { display: none; }
  #rosterGroups .mc-opp { font-size: 0.78rem; }
}

/* ===== Add / Trade players page — mobile layout ===== */
@media (max-width: 760px) {
  /* --- Team header: compact rows instead of one squeezed line ---
     Row 1: [← Leagues] ....... [Trades] [Rules]
     Row 2: league title + subtitle (full width, no longer squeezed)
     Row 3: [ Roster | Add / Trade players ] full-width toggle */
  .team-header { gap: 8px 10px; margin-bottom: 12px; }
  .team-header #backToHub { order: 1; padding: 5px 11px; }
  .team-header-trades { order: 2; margin-left: auto; font-size: 0.8rem; }
  .team-header #teamRulesLink { order: 3; padding: 5px 11px; }
  .team-header-main { order: 4; flex-basis: 100%; }
  .team-header-title { font-size: 1rem; line-height: 1.2; }
  .team-header-league { font-size: 0.78rem; margin-top: 1px; }
  .team-header .seg { order: 5; flex-basis: 100%; }
  .team-header .seg .chip { flex: 1; text-align: center; padding: 8px 6px; }

  /* --- Available panel: tighter heading + spacing --- */
  #availablePanel .avail-head { margin-bottom: 10px; }
  #availablePanel .avail-head h2 { font-size: 1.05rem; }
  #availablePanel .fa-toggle { font-size: 0.8rem; }
  .search-row { gap: 8px; margin-bottom: 10px; }

  /* --- Position filter: one horizontally-scrolling row with a visible bar --- */
  .avail-filter-row { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 12px; }
  #positionChips {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    min-width: 0; max-width: 100%;      /* let it shrink to the panel so overflow scrolls */
    gap: 6px; margin-bottom: 0; padding-bottom: 7px;
    scrollbar-width: thin; scrollbar-color: var(--accent-strong) var(--surface-2);
  }
  #positionChips::-webkit-scrollbar { height: 6px; }
  #positionChips::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 999px; }
  #positionChips::-webkit-scrollbar-thumb { background: var(--accent-strong); border-radius: 999px; }
  #positionChips .chip { flex: 0 0 auto; padding: 5px 12px; font-size: 0.8rem; }
  .avail-statbar { margin-bottom: 0; }

  /* --- Roster panel: compact meters + header --- */
  .panel h2 { font-size: 1.05rem; }
  .meters { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
  .meter { padding: 8px 9px; }
  .meter .label { font-size: 0.6rem; }
  .meter .value { font-size: 0.95rem; }
  .meters-bar { margin: 0 0 14px; }
  .roster-group { margin-bottom: 14px; }
  .roster-group h3 { font-size: 0.78rem; margin-bottom: 6px; }

  /* Roster-mode rows ("Roster" tab): keep the ✕ · player · PPG · SALARY order but
     shrink everything so rows are dense and the name fits on one line. */
  .rrow { padding: 5px 2px; gap: 6px; }
  .rrow .rmove { width: 22px; height: 22px; font-size: 0.8rem; }
  .rrow .player-pic { width: 28px; height: 28px; }
  .rrow .rinfo { flex-basis: 156px; width: 156px; }
  .rrow .rinfo .nm { font-size: 0.82rem; line-height: 1.15; }
  .rrow .rinfo .sub { font-size: 0.65rem; line-height: 1.2; }
  .rrow .rinfo .pos { padding: 1px 5px; font-size: 0.62rem; }
  .rrow .statbox { width: 52px; padding: 0 2px; }
  .rrow .statbox .sv { font-size: 0.8rem; }
  .rrow .statbox .sl { font-size: 0.52rem; }
}

@media (max-width: 460px) {
  .brand .tag { display: none; }
  :root { --cx: 10px; --cy: 12px; }
  .brand h1 { font-size: 1.1rem; }
  .meters { grid-template-columns: repeat(3, 1fr); }
}

.depth-rookie { color: var(--accent); font-size: 0.78em; font-weight: 700; margin-left: 3px; vertical-align: baseline; }

/* NFL nav dropdown */
.nav-dd { position: relative; display: inline-flex; }
.nav-dd::after { content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 14px; }
.nav-dd-btn { background: none; border: none; font: inherit; cursor: pointer; padding: 0; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.nav-dd-btn:hover, .nav-dd.open .nav-dd-btn { color: var(--text); }
.nav-dd-menu { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px; min-width: 168px; display: none; flex-direction: column; gap: 2px; z-index: 60; box-shadow: 0 12px 34px rgba(0,0,0,.45); }
.nav-dd:hover .nav-dd-menu, .nav-dd.open .nav-dd-menu { display: flex; }
.nav-dd-menu a { padding: 9px 12px; border-radius: 7px; white-space: nowrap; color: var(--muted); }
.nav-dd-menu a:hover { background: var(--surface); color: var(--accent); }

/* Leagues mega-nav: the top item is a link (to the hub) that also opens a menu
   of your leagues on hover; each league opens a submenu of its views. */
.nav-dd-link { padding: 8px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 3px; }
.nav-dd-link:hover, .nav-dd-leagues:hover .nav-dd-link { color: var(--text); background: var(--surface-2); }
.nav-dd-link.active { color: var(--accent); background: rgba(var(--accent-rgb),0.1); }
.nav-dd-leagues .lg-menu { left: 0; transform: none; }
.lg-item { position: relative; }
.lg-name { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 12px; border-radius: 7px; color: var(--muted); white-space: nowrap; cursor: default; }
.lg-item:hover > .lg-name { background: var(--surface); color: var(--accent); }
.lg-caret { opacity: 0.6; }
.lg-submenu { position: absolute; top: -7px; left: 100%; margin-left: 5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px; min-width: 184px; display: none; flex-direction: column; gap: 2px; z-index: 61; box-shadow: 0 12px 34px rgba(0,0,0,.45); }
.lg-item:hover > .lg-submenu { display: flex; }
.lg-submenu a { padding: 9px 12px; border-radius: 7px; color: var(--muted); white-space: nowrap; text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.lg-submenu a:hover { background: var(--surface); color: var(--accent); }
.lg-empty { padding: 9px 12px; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

@media (max-width: 760px) {
  .nav-dd { width: 100%; flex-direction: column; align-items: stretch; }
  .nav-dd::after { display: none; }
  .nav-dd-btn { padding: 11px 12px; width: 100%; justify-content: flex-start; font-size: 0.95rem; }
  .nav-dd-menu { position: static; transform: none; display: flex; margin: 0 0 4px 14px; border: none; box-shadow: none; background: none; padding: 0; min-width: 0; }
  .nav-dd-menu a { padding: 9px 12px; }
  .nav-dd-link { width: 100%; padding: 11px 12px; font-size: 0.95rem; }
  .lg-submenu { position: static; display: flex; margin: 0 0 4px 14px; border: none; box-shadow: none; background: none; padding: 0; min-width: 0; }
  .lg-caret { display: none; }
  .lg-name { font-weight: 700; color: var(--text); }
}

/* NFL standings + schedule */
.nfl-conf { margin-bottom: 26px; }
.nfl-conf-title { font-size: 1.15rem; color: var(--text); margin: 0 0 14px; border-bottom: 2px solid var(--accent); padding-bottom: 6px; }
.nfl-div { margin-bottom: 18px; }
.nfl-div-title { color: var(--accent-soft); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.nfl-standings-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tscroll .nfl-standings-table { min-width: 900px; }
.nfl-standings-table th:not(.tm), .nfl-standings-table td:not(.tm) { width: 54px; }
.nfl-standings-table th, .nfl-standings-table td { padding: 9px 10px; text-align: center; font-size: 0.9rem; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.nfl-standings-table th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .03em; }
.nfl-standings-table th.tm, .nfl-standings-table td.tm { text-align: left; }
.nfl-team-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.nfl-standings-table tbody tr:hover { background: var(--surface-2); }
.nfl-team { display: inline-flex; align-items: center; gap: 10px; }
.nfl-logo { width: 26px; height: 26px; object-fit: contain; flex: none; }
.nfl-team-name { font-weight: 600; color: var(--text); }
.nfl-standings-table td.pos { color: #5bbf7b; }
.nfl-standings-table td.neg { color: #e5766b; }
.sched-week-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sched-modebar { display: inline-flex; margin-bottom: 14px; }

/* By-team schedule view: 3 cards across on desktop, 1 on phones. */
.team-sched-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.team-sched-single { max-width: 460px; }
.ts-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.ts-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; border-bottom: 1px solid var(--border); background: var(--surface); }
.ts-team-logo { width: 24px; height: 24px; object-fit: contain; flex: 0 0 auto; }
.ts-rows { padding: 2px 0; }
.ts-row { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 8px; padding: 5px 12px; font-size: 0.85rem; }
.ts-row + .ts-row { border-top: 1px solid var(--border); }
.ts-wk { color: var(--muted); font-size: 0.76rem; }
.ts-opp { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ts-logo { width: 18px; height: 18px; object-fit: contain; flex: 0 0 auto; }
.ts-bye .ts-opp { color: var(--muted); font-style: italic; }
.ts-when { color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.ts-result { font-weight: 600; font-size: 0.82rem; white-space: nowrap; }
.ts-result.w { color: var(--green); }
.ts-result.l { color: var(--muted); }
@media (max-width: 900px) { .team-sched-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .team-sched-grid { grid-template-columns: 1fr; } }

/* Strength of schedule */
.sos-weeks-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.sos-weeks-label { font-weight: 600; color: var(--muted); font-size: 0.9rem; margin-right: 4px; }
.sos-weeks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.sos-wk-chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.sos-wk-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sos-wk-chip.pk-done { border-color: var(--green); color: var(--green); }
/* Jordy's Guesses pick'em */
.pk-list { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.pk-game { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.pk-side { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 0.9rem; cursor: pointer; width: 100%; text-align: left; }
.pk-side:not(:disabled):hover { border-color: var(--accent); }
.pk-side.win { background: var(--accent); border-color: var(--accent); color: #fff; }
.pk-side:disabled { cursor: default; }
.pk-logo { width: 24px; height: 24px; object-fit: contain; flex: 0 0 auto; }
.pk-at { color: var(--muted); font-size: 0.8rem; }
/* Picks standings grouped by conference/division */
.std-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 28px; align-items: start; }
.std-conf h3 { font-size: 1rem; margin: 0 0 10px; color: var(--accent); letter-spacing: 0.03em; }
.std-div { margin-bottom: 16px; }
.std-div h4 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 4px; }
.std-table { width: 100%; table-layout: fixed; }
.std-table td { padding: 6px 8px; }
.std-table td.ctr { width: 58px; }
.std-table .sos-logo { width: 20px; height: 20px; }
@media (max-width: 760px) { .std-grid { grid-template-columns: 1fr; gap: 0 0; } }
/* Playoff field */
.po-table { width: 100%; table-layout: fixed; margin-bottom: 12px; }
.po-table td { padding: 6px 8px; }
.po-table .po-seed { width: 26px; text-align: center; font-weight: 700; color: var(--muted); }
.po-table tr.po-one .po-seed { color: var(--accent); }
.po-table .sos-logo { width: 20px; height: 20px; }
.po-table td.ctr { width: 50px; }
.po-table .po-tag { width: 118px; font-size: 0.74rem; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.po-round { border-top: 1px solid var(--border); padding-top: 10px; }
.po-round h4 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 6px; }
.po-game { font-size: 0.9rem; padding: 4px 0; }
.po-game b { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.po-at { color: var(--muted); font-size: 0.78rem; margin: 0 3px; }
.po-bye { color: var(--muted); }
@media (max-width: 640px) { .pk-side { padding: 9px 10px; font-size: 0.82rem; gap: 6px; } .pk-logo { width: 20px; height: 20px; } }
.sos-table { width: 100%; border-collapse: collapse; }
.sos-table th, .sos-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.sos-table th { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.sos-table .sos-rank { width: 34px; color: var(--muted); font-weight: 700; }
.sos-table th.ctr, .sos-table td.ctr, .sos-table th.sos-rank, .sos-table td.sos-rank { text-align: center; }
.sos-team { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.sos-logo { width: 22px; height: 22px; object-fit: contain; flex: 0 0 auto; }
.sos-val { font-weight: 700; color: var(--accent); white-space: nowrap; }
.sos-detail { font-size: 0.82rem; line-height: 1.7; }
.sos-opp { display: inline-flex; align-items: center; gap: 4px; margin: 0 10px 2px 0; white-space: nowrap; }
.sos-opp-logo { width: 15px; height: 15px; object-fit: contain; }
.sos-table th.sos-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.sos-table th.sos-sort:hover { color: var(--accent); }

/* Admin: team win projections grid */
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 20px; }
.proj-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.proj-team { flex: 1; min-width: 0; font-weight: 600; font-size: 0.9rem; }
.proj-in { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 0.8rem; }
.proj-in input { width: 58px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
@media (max-width: 760px) { .proj-grid { grid-template-columns: 1fr; } }
.sched-game { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.sched-game:last-child { border-bottom: none; }
.sched-teams { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; max-width: 340px; }
.sched-team { display: flex; align-items: center; gap: 9px; }
.sched-logo { width: 24px; height: 24px; object-fit: contain; flex: none; }
.sched-tname { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-score { margin-left: auto; padding-left: 10px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.sched-score.win { color: var(--text); }
.sched-info { white-space: nowrap; text-align: right; }
.sched-when { color: var(--muted); font-size: 0.85rem; }
.sched-final { color: var(--accent-soft); font-weight: 600; font-size: 0.85rem; }

.season-select, #schWeek { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; cursor: pointer; }

.post-live { font-size: 0.7rem; background: rgba(91,191,123,0.15); color: #5bbf7b; padding: 2px 7px; border-radius: 5px; vertical-align: middle; font-weight: 600; border: 1px solid rgba(91,191,123,0.35); }


/* Admin Teams — submission history columns (stacked rosters, 3 per row) */
.team-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.team-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.team-col.editable { border-color: var(--accent); }
.team-col-head { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.team-col-title { font-weight: 700; color: var(--text); font-size: 0.9rem; }
.team-col-date { color: var(--muted); font-size: 0.78rem; }
.team-col-body { display: flex; flex-direction: column; gap: 4px; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; background: var(--surface); }
.team-row.missing { outline: 1px solid #e5766b; }
.team-row-slot { flex: 0 0 44px; font-size: 0.58rem; text-transform: uppercase; letter-spacing: .02em; color: var(--accent-soft); font-weight: 700; text-align: center; line-height: 1.1; }
.team-row .player-cell { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.team-row .team-row-pic { width: 30px; height: 30px; font-size: 0.7rem; flex: none; }
.team-row .player-meta { min-width: 0; }
.team-row .nm { font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.team-row .sub { font-size: 0.7rem; }
.team-row-id { flex: 0 0 auto; }
.team-row-idinput { width: 56px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 5px; color: var(--text); text-align: center; font-size: 0.8rem; }
@media (max-width: 900px) { .team-cards { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px) { .team-cards { grid-template-columns: 1fr; } }

.team-group { margin-bottom: 6px; }
.team-group-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-soft); font-weight: 700; margin: 8px 0 3px; }
.team-group:first-child .team-group-label { margin-top: 0; }
