:root {
  --bg: #131a22;
  --panel: #1b2430;
  --panel-2: #232f3d;
  --line: #2f3d4d;
  --text: #f3f5f7;
  --muted: #94a3b5;
  --green: #3ddc6a;
  --green-dk: #1f9c47;
  --gold: #f2b632;
  --gold-dk: #b8811a;
  --red: #ff5a5f;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.45; }
body { margin: 0; }
a { color: var(--green); }
h1, h2, h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.01em; line-height: 1; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); font-weight: 800; }
h2 { font-size: 2rem; font-weight: 700; margin-top: 1.6rem; }
h3 { font-size: 1.4rem; font-weight: 700; margin-top: 1.4rem; color: var(--gold); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 1rem; }
[hidden] { display: none !important; }

/* top bar */
.topbar { background: #0e141b; border-bottom: 3px solid var(--green); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: stretch; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: var(--display); font-weight: 800; font-size: 1.05rem; line-height: 0.95; text-transform: uppercase; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(var(--gold) 0 50%, var(--green) 50% 100%); box-shadow: inset 0 0 0 4px #0e141b, 0 0 0 2px var(--gold); }
.tabs { display: flex; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: flex; align-items: center; padding: 0 16px; color: var(--muted); text-decoration: none; font-family: var(--display); font-size: 1.15rem; font-weight: 700; text-transform: uppercase; border-bottom: 3px solid transparent; margin-bottom: -3px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--gold); }
.status { align-self: center; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.status.err { color: var(--red); }

/* layout bits */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: center; margin: 0.4rem 0 0.8rem; flex-wrap: wrap; }
.scroll { overflow-x: auto; }
select, input[type=text], input:not([type]) { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; font: inherit; }
select:focus, input:focus, button:focus { outline: 2px solid var(--green); outline-offset: 1px; }
button { background: var(--green); color: #07200f; border: 0; border-radius: 4px; padding: 9px 16px; font-family: var(--display); font-size: 1.05rem; font-weight: 700; text-transform: uppercase; cursor: pointer; }
button:hover { background: #5fe886; }
.controls { display: flex; flex-wrap: wrap; gap: 18px 28px; background: var(--panel); border-left: 4px solid var(--gold); padding: 14px 18px; margin: 0 0 1.2rem; }
.controls label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); min-width: 160px; }
.controls output { color: var(--gold); font-family: var(--display); font-size: 1.2rem; font-weight: 700; }
input[type=range] { accent-color: var(--green); width: 100%; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tbl th { text-align: left; font-family: var(--display); font-size: 0.95rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.me td { background: rgba(61, 220, 106, 0.08); }
.tbl tr.top td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.tbl .pos { display: inline-block; min-width: 30px; text-align: center; font-family: var(--display); font-weight: 700; font-size: 0.85rem; border-radius: 3px; padding: 1px 4px; color: #07200f; }
.pos-QB { background: #f28c3d; } .pos-RB { background: var(--green); } .pos-WR { background: #4fa3ff; } .pos-TE { background: #c58cff; } .pos-K { background: #ddd; } .pos-DEF { background: #999; } .pos-PICK { background: var(--gold); }
.team-cell { display: flex; align-items: center; gap: 8px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); object-fit: cover; flex: none; }
.small { color: var(--muted); font-size: 0.8rem; }
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }

/* hero / matchups */
.hero { padding: 24px 0 8px; }
.hero-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.hero-sub { color: var(--muted); }
.matchups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.mu { background: var(--panel); border-top: 3px solid var(--line); padding: 10px 12px; }
.mu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.mu-row.lead { border-top-color: var(--green); }
.mu-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mu-row .pts { font-family: var(--display); font-size: 1.5rem; font-weight: 800; }
.mu-row.lead .pts { color: var(--green); }
.mu-proj { font-size: 0.75rem; color: var(--muted); display: flex; justify-content: space-between; margin-top: 4px; }

/* roster view */
.roster-group { margin: 0.6rem 0; }
.roster-group h4 { margin: 0 0 4px; font-family: var(--display); text-transform: uppercase; color: var(--muted); font-size: 0.95rem; }
.player { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.player .meta { color: var(--muted); font-size: 0.8rem; }
.player .proj { font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.player.starter .name::after { content: " • starting"; color: var(--green); font-size: 0.75rem; }

/* start-sit */
.ss-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .ss-grid { grid-template-columns: 1fr; } }
.ss-total { font-family: var(--display); font-size: 1.3rem; font-weight: 700; margin: 4px 0 8px; }
.ss-total b { color: var(--green); }
.swap { background: var(--panel); border-left: 4px solid var(--gold); padding: 10px 14px; margin: 8px 0; }
.swap b { color: var(--gold); }
.ok { background: var(--panel); border-left: 4px solid var(--green); padding: 10px 14px; margin: 8px 0; }
.slot { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.slot .slot-name { font-family: var(--display); font-weight: 700; color: var(--muted); }
.slot.diff { background: rgba(242, 182, 50, 0.08); }
.slot .num { font-variant-numeric: tabular-nums; }

/* dynasty */
.chart { background: var(--panel); padding: 12px; overflow-x: auto; }
.chart svg { display: block; min-width: 640px; width: 100%; height: auto; }
.trade { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-side select { width: 100%; }
.asset-list { max-height: 360px; overflow-y: auto; margin-top: 6px; border: 1px solid var(--line); }
.asset { display: grid; grid-template-columns: 20px 34px 1fr auto; gap: 8px; align-items: center; padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 0.85rem; cursor: pointer; }
.asset:hover { background: var(--panel-2); }
.asset input { accent-color: var(--gold); margin: 0; }
.asset .v { font-variant-numeric: tabular-nums; color: var(--gold); }
.trade-verdict { margin-top: 12px; background: var(--panel); padding: 12px 16px; border-left: 4px solid var(--gold); }
.trade-verdict .big { font-family: var(--display); font-size: 1.6rem; font-weight: 800; text-transform: uppercase; }
.trade-verdict .meter { height: 10px; background: var(--panel-2); border-radius: 5px; position: relative; margin: 8px 0; }
.trade-verdict .meter i { position: absolute; top: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); transform: translateX(-50%); }

/* trophy case */
.case { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.shelf { background: linear-gradient(180deg, #1f2a37 0%, #16202a 100%); border-top: 4px solid var(--gold-dk); padding: 14px 16px 18px; position: relative; }
.shelf::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: linear-gradient(180deg, #3b2d12, #6b4f17); }
.shelf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.shelf-head .avatar { width: 36px; height: 36px; }
.shelf-head .tn { font-family: var(--display); font-weight: 700; font-size: 1.3rem; line-height: 1; text-transform: uppercase; }
.shelf-head .on { color: var(--muted); font-size: 0.8rem; }
.trophies { display: flex; flex-wrap: wrap; gap: 6px 10px; min-height: 92px; align-items: flex-end; }
.trophy { display: flex; flex-direction: column; align-items: center; width: 64px; }
.trophy svg { width: 52px; height: 64px; }
.trophy .yr { font-family: var(--display); font-weight: 800; font-size: 0.95rem; color: var(--gold); margin-top: 2px; }
.trophy.silver .yr { color: #c9d1da; }
.trophy .lbl { font-size: 0.65rem; color: var(--muted); text-align: center; line-height: 1.1; }
.shelf .none { color: var(--muted); font-size: 0.85rem; align-self: center; }
.shelf.champ-count { }
.count { margin-left: auto; font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--gold); }

/* chat */
.chat { max-width: 760px; }
.chat-log { background: var(--panel); height: 60vh; min-height: 320px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 80%; background: var(--panel-2); padding: 8px 12px; border-radius: 10px 10px 10px 2px; }
.msg.mine { align-self: flex-end; background: var(--green-dk); border-radius: 10px 10px 2px 10px; }
.msg .who { font-family: var(--display); font-weight: 700; font-size: 0.85rem; color: var(--gold); text-transform: uppercase; }
.msg.mine .who { color: #d9ffe3; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg .t { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.msg.mine .t { color: #bfeecb; }
.chat-form { display: grid; grid-template-columns: 170px 1fr auto; gap: 8px; margin-top: 8px; }
@media (max-width: 600px) { .chat-form { grid-template-columns: 1fr; } }
.empty { color: var(--muted); text-align: center; margin: auto; }
.foot { color: var(--muted); font-size: 0.8rem; padding: 40px 20px; max-width: 1240px; }

@media (prefers-reduced-motion: no-preference) {
  .panel { animation: fade 0.18s ease-out; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
