/* Rankings page and player drawer */
.rankings-page { padding-top: 28px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.week-pick { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
select, input[type="search"] { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; height: 38px; padding: 0 10px; }
select { padding-right: 28px; }
select:hover, input[type="search"]:hover { border-color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px 10px 0 0; border-bottom: 0; }
.field { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field select { min-width: 150px; font-weight: 600; }
.search { margin-left: auto; position: relative; }
.search-list { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; width: 340px; max-width: calc(100vw - 40px); margin: 0; padding: 4px;
               list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 10px 30px rgba(14, 23, 38, .15); }
.search-list li { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.search-list li:hover, .search-list li[aria-selected="true"] { background: #eef3f9; }
.search-list li.none { display: block; color: var(--muted); cursor: default; }
.search-list .nm { font-weight: 700; color: var(--ink); }
.search-list .tm { font-size: 12px; color: var(--muted); min-width: 28px; }
.search-list .pv { font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; min-width: 40px; }
/* a row found by search flashes, then fades back to its normal color */
@keyframes flash { 0%, 40% { background-color: #ffe7a3; } }
.rank-table tbody tr.flash { animation: flash 2.4s ease-out; }
@media (prefers-reduced-motion: reduce) { .rank-table tbody tr.flash { animation-duration: 3s; animation-timing-function: steps(1, end); } }
.search input { width: 240px; }
.tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; }
.tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 5px; font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--navy); color: #fff; }

/* not ranked yet: a bar above the table; the list opens in place and scrolls inside itself */
.nr-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: var(--warn-bg);
          border: 1px solid #f2d3a2; border-bottom: 0; font-size: 14px; color: var(--warn-ink); }
.nr-bar p { margin: 0; }
.nr-toggle { flex: none; border: 1px solid #e2b877; background: #fff; color: var(--warn-ink); font-weight: 700; font-size: 13px; border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.nr-toggle:hover { border-color: var(--warn-ink); }
.legend-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-bottom: 0; }
.legend-bar .key::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -3px; border: 1px solid var(--line-2); background: #fff; }
.legend-bar .key.mine::before { background: var(--mine-bg); border-color: var(--accent); }
.legend-bar .key.taken::before { background: var(--taken-bg); border-color: var(--taken-edge); }
.rkey { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted); }
.rk-box { display: inline-block; width: 18px; height: 10px; border-radius: 2px; background: #b9e3cb; margin-left: 4px; }
.rk-med { display: inline-block; width: 2px; height: 14px; background: var(--navy); margin-left: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.table-card { border-radius: 0 0 10px 10px; overflow: hidden; }
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
                 padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.rank-table th.num { text-align: right; }
.rank-table th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.rank-table th button:hover { color: var(--ink); }
.rank-table th button.sorted { color: var(--ink); }
.rank-table th button.sorted::after { content: " ▾"; }
.rank-table th button.sorted.asc::after { content: " ▴"; }
.rank-table td { padding: 5px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rank-table tbody tr { cursor: pointer; }
.rank-table tbody tr:hover { background: #f6f9fc; }
/* league sync: your roster highlighted, other rosters solid gray, available players stay white */
.rank-table tbody tr.mine { background: var(--mine-bg); }
.rank-table tbody tr.mine:hover { background: #cdebd9; }
.rank-table tbody tr.mine td { border-bottom-color: var(--mine-line); }
.rank-table tbody tr.mine td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.rank-table tbody tr.taken { background: var(--taken-bg); }
.rank-table tbody tr.taken:hover { background: #dfe4ea; }
.rank-table tbody tr.taken td { border-bottom-color: var(--taken-line); }
.rank-table tbody tr.taken td:first-child { box-shadow: inset 4px 0 0 var(--taken-edge); }
.rank-table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 4px 0 0 var(--navy); }
.owner { font-size: 11px; font-weight: 700; color: var(--ink-2); background: #fff; border: 1px solid var(--taken-line); border-radius: 4px; padding: 0 6px;
         max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner.mine { color: var(--accent); border-color: var(--mine-line); }
.rank-table tbody tr:last-child td { border-bottom: 0; }
.c-rank { width: 48px; color: var(--muted); font-weight: 700; }
.pname { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; font-size: 15px; color: var(--ink); cursor: pointer; text-align: left; }
.pname:hover { color: var(--link); text-decoration: underline; }
/* one line per player: name, position (FLEX / SUPERFLEX only), team, tags */
.pline { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pline .team { font-size: 13px; color: var(--muted); }
.msub { display: none; }   /* phones: team, matchup and kickoff on a second line */
.c-game { font-size: 14px; white-space: nowrap; }
.c-game .ko { font-size: 13px; color: var(--muted); margin-left: 8px; }
.c-proj { width: 80px; }
.proj { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.proj-range { display: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.c-range { width: 290px; }
.range-head { display: flex; justify-content: space-between; gap: 8px; }
.range { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.range .lo { text-align: right; }
.range svg { width: 100%; height: auto; display: block; overflow: visible; }
.range .track { stroke: var(--line); stroke-width: 1; }
.range .span { fill: #b9e3cb; }
.range .med { fill: var(--navy); }
.range text { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.range text.m { fill: var(--ink); font-weight: 700; }
.range-key { cursor: help; }
.empty { padding: 28px; text-align: center; color: var(--muted); margin: 0; }

/* not ranked list (in the side panel) */
.nr-list { list-style: none; margin: 0; padding: 0; }
.nr-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 8px; border-top: 1px solid var(--line); cursor: pointer; }
.nr-list li.mine { background: var(--mine-bg); }
.nr-list li.taken { background: var(--taken-bg); }
.nr-list li:hover .pname { color: var(--link); text-decoration: underline; }
.nr-list .why { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.nr-list .rough { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nr-list .head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nr-list .team { font-size: 12px; color: var(--muted); }
.more { margin-top: 10px; }

/* ---------- drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 18, 32, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 50; background: var(--surface); overflow-y: auto;
          box-shadow: -12px 0 40px rgba(0, 0, 0, .18); outline: none; overscroll-behavior: contain; }
body.drawer-open { overflow: hidden; }
.d-head { position: sticky; top: 0; z-index: 2; background: var(--navy); color: #fff; padding: 18px 22px 16px; }
.d-head .back { border: 0; background: none; color: #a9c4e6; font-weight: 700; font-size: 13px; padding: 0; margin-bottom: 6px; cursor: pointer; }
.d-head .back:hover { color: #fff; text-decoration: underline; }
.d-head .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.d-head h2 { font-size: 22px; font-weight: 800; }
.d-head .meta { margin-top: 6px; font-size: 13px; color: #c9d5e4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.d-head .pos { background: #fff; }
.d-head .own { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 4px; background: #fff; color: var(--ink-2); }
.d-head .own.mine { background: var(--mine-bg); color: var(--accent-hover); }
.d-head .own.taken { background: var(--taken-bg); color: var(--ink-2); }
.d-head .icon-btn { color: #c9d5e4; }
.d-head .icon-btn:hover { background: var(--navy-2); color: #fff; }
.d-body { padding: 18px 22px 32px; }
.views { display: flex; gap: 4px; margin: 14px -4px -16px; }
.views button { border: 0; background: none; color: #a9bad0; font-weight: 700; font-size: 14px; padding: 10px 12px; cursor: pointer; border-bottom: 3px solid transparent; }
.views button:hover { color: #fff; }
.views button[aria-selected="true"] { color: #fff; border-bottom-color: #22c55e; }

/* this season */
.season-rank { margin: 0 0 14px; font-size: 15px; }
.season-rank .fine-inline { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.cut-toggle { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); margin: -6px 0 16px; cursor: pointer; }
.cut-toggle input { margin-top: 2px; accent-color: var(--navy); }
.season-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.season-card h3 { font-size: 14px; color: var(--ink-2); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.season-stats td:last-child { font-weight: 700; }
.pvr { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); }
.pvr-chart .pr-range { fill: #b9e3cb; }
.pvr-chart .pr-mean { stroke: var(--navy); stroke-width: 2; }
.pvr-chart .act { fill: var(--pos-TE); stroke: #fff; stroke-width: 2; }
.pvr-chart .act.cut { fill: #fff; stroke: var(--pos-TE); }
.pvr-chart .note-t { font-size: 9px; fill: var(--muted); }
.legend .lg-range::before { border-radius: 2px; width: 10px; height: 12px; border: 0; background: #b9e3cb; }
.legend .lg-proj::before { border-radius: 0; width: 12px; height: 0; border: 0; border-top: 2px solid var(--navy); vertical-align: 3px; }
.legend .lg-act::before { border-color: #fff; background: var(--pos-TE); box-shadow: 0 0 0 1px var(--pos-TE); }
.glog { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.glog th { text-align: left; color: var(--muted); font-weight: 600; padding: 5px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 11.5px; }
.glog th.num { text-align: right; }
.glog td { padding: 5px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.glog td.pts { font-weight: 800; }
.glog td.pts.up { color: var(--accent); }
.glog tr.muted-row td { color: var(--muted); }
.glog tr.cut-row td { background: #fffaf0; }
.note { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.note.warn { background: var(--warn-bg); border-color: #f2d3a2; color: var(--warn-ink); }
.tiles { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile .v { font-size: 24px; font-weight: 800; }
.tile.hero .v { font-size: 34px; color: var(--ink); }
.tile .l { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.tile .s { font-size: 11px; color: var(--muted); }

.odds-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 10px; margin-bottom: 18px; }
.odds-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.odds-card h3 { font-size: 14px; color: var(--ink-2); }
.readout { margin: 8px 0 4px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.readout .big { font-size: 40px; font-weight: 800; line-height: 1; }
.readout .txt { font-size: 15px; color: var(--ink-2); }
.readout .txt b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dir { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px; flex: none; }
.dir button { border: 0; background: transparent; padding: 5px 10px; border-radius: 5px; font-size: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.dir button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.dist { width: 100%; display: block; touch-action: none; cursor: ew-resize; user-select: none; -webkit-user-select: none; }
.dist .bar.on { fill: var(--mark); }
.dist .bar.off { fill: var(--mark-off); }
.dist .axis { stroke: var(--line-2); stroke-width: 1; }
.dist text { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.dist .thr { stroke: var(--ink); stroke-width: 2; }
.dist .thr-knob { fill: var(--ink); stroke: #fff; stroke-width: 2; }
.dist .thr-label { fill: var(--ink); font-weight: 800; font-size: 12px; }
.dist .mean-tick { stroke: var(--muted); stroke-width: 1; stroke-dasharray: none; }
.dist-range { display: block; width: 95%; margin: 2px 2.5% 0; accent-color: var(--navy); }
.dist-help { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

details.more-info { border-top: 1px solid var(--line); }
details.more-info > summary { cursor: pointer; padding: 14px 0; font-weight: 700; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.more-info > summary::-webkit-details-marker { display: none; }
details.more-info > summary::after { content: "+"; font-size: 20px; color: var(--muted); font-weight: 400; }
details.more-info[open] > summary::after { content: "−"; }
details.more-info > summary small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 8px; }
.sum-left { display: flex; align-items: baseline; flex-wrap: wrap; }

.comp { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 8px; }
.comp td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.comp td + td { padding-left: 10px; }
.comp .bar-cell { width: 34%; }
.comp svg { width: 100%; height: 10px; display: block; }
.comp .cbar { fill: var(--mark); }
.comp tr.neg .cbar { fill: #d03b3b; }
.comp tr.est td:first-child { color: var(--muted); }
.fine { font-size: 12px; color: var(--muted); margin: 6px 0 14px; }

details.stat { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
details.stat > summary { cursor: pointer; padding: 10px 12px; font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
details.stat > summary small { font-weight: 500; color: var(--muted); }
details.stat .inner { padding: 0 12px 12px; }
.chart { width: 100%; display: block; margin: 6px 0; }
.chart text { font-size: 10px; fill: var(--muted); }
.chart .axis, .chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--pos-WR); }
.chart .fit { fill: none; stroke: var(--pos-WR); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: none; stroke: var(--pos-TE); stroke-width: 2; }
.chart .pt.two { fill: var(--pos-TE); stroke: #fff; }
.chart .pt.kalshi { fill: var(--navy); stroke: #fff; }
.chart .pt.bound { fill: none; stroke: var(--navy); stroke-dasharray: 2 2; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--ink-2); margin: 2px 0 8px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 2px solid; }
.legend .lg-fit::before { border-radius: 2px; height: 3px; width: 12px; border: 0; background: var(--pos-WR); vertical-align: 2px; }
.legend .lg-two::before { border-color: var(--pos-TE); background: var(--pos-TE); }
.legend .lg-one::before { border-color: var(--pos-TE); background: transparent; }
.legend .lg-kalshi::before { border-color: var(--navy); background: var(--navy); }
.obs { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.obs th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.obs td { padding: 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.obs-wrap { overflow-x: auto; }

@media (max-width: 860px) {
  .c-range, .c-game, .rkey { display: none; }
  .legend-bar:not(:has(.key)) { display: none; }
  .proj-range { display: block; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .nr-bar { flex-wrap: wrap; }
  .pline .team { display: none; }
  .pline { flex-wrap: wrap; row-gap: 2px; white-space: normal; }
  .msub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
  .c-proj { white-space: nowrap; }
}

@media (max-width: 520px) {
  .page-head { flex-direction: column; align-items: flex-start; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 6px 4px; }
  .field { width: 100%; }
  .field select { flex: 1; }
  .rank-table td, .rank-table th { padding: 9px 8px; }
  .c-rank { width: 34px; }
  .tiles { grid-template-columns: 1fr 1fr 1fr; }
  .tile.hero .v { font-size: 28px; }
}
