/* ============================================================
   PUBLIC STATS PAGES — the team season (team_detail.html) and the
   player page (player_detail.html), on the same Tabler skin as the
   manage pages (manage.css; layout _tabler_base.html). Only what
   Tabler has no component for: the stat strip, dense numeric tables,
   the player summary card and the team sub-tabs. Prefix ps-.
   ============================================================ */

/* wider than the manage pages: these are tables, and a 4K screen should
   show the leaders, matches and ladder side by side */
body.willow.mg-app.ps-page .content { max-width: 1880px; }
body.willow.mg-app.ps-page .tone-pos { color: var(--tblr-primary); }
body.willow.mg-app.ps-page .tone-gold { color: var(--mg-gold-ink); }
body.willow.mg-app.ps-page .card-header { min-height: 0; }
body.willow.mg-app.ps-page .card-actions { margin-left: auto; }
body.willow.mg-app.ps-page .ps-help { font-size: 11.5px; color: var(--tblr-secondary); border-bottom: 1px dotted currentColor; }
body.willow.mg-app.ps-page .stat-q { cursor: help; border-bottom: 1px dotted currentColor; }

/* header star (team .fav-toggle, player .pfav-toggle) */
body.willow.mg-app .mg-head .fav-toggle,
body.willow.mg-app .mg-head .pfav-toggle { font-size: 20px; line-height: 1; color: var(--tblr-secondary); padding: 0; }
body.willow.mg-app .mg-head .fav-toggle:hover,
body.willow.mg-app .mg-head .pfav-toggle:hover,
body.willow.mg-app .mg-head .fav-toggle.fav-active,
body.willow.mg-app .mg-head .pfav-toggle.fav-active { color: var(--mg-gold); }
body.willow.mg-app .mg-head-s a { color: inherit; }
body.willow.mg-app .mg-head-s a:hover { color: var(--tblr-primary); }

/* team sub-tabs (_team_nav.html, shared with the Pico pages): one
   scrolling line, tighter than Willow's */
body.willow.mg-app.ps-page .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -4px 0 10px; gap: 0; }
body.willow.mg-app.ps-page .tabs::-webkit-scrollbar { display: none; }
body.willow.mg-app.ps-page .tabs a { padding: 8px 12px; font-size: 13.5px; white-space: nowrap; color: var(--tblr-secondary); }
body.willow.mg-app.ps-page .tabs a:hover { color: var(--tblr-body-color); }
body.willow.mg-app.ps-page .tabs a.active { color: var(--tblr-primary); }
body.willow.mg-app.ps-page .tabs a.active::after { background: var(--tblr-primary); left: 8px; right: 8px; }

/* ---------- stat strip: equal cells, one row on desktop ---------- */
body.willow.mg-app .ps-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
body.willow.mg-app .ps-cell { display: block; padding: 8px 14px 9px; border-right: 1px solid var(--tblr-border-color); color: inherit; min-width: 0; }
body.willow.mg-app .ps-cell:last-child { border-right: 0; }
body.willow.mg-app a.ps-cell:hover { background: var(--tblr-bg-surface-secondary); }
body.willow.mg-app .ps-cell .n { font-size: 22px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
body.willow.mg-app .ps-cell .n small { font-size: 12px; font-weight: 700; margin-left: 1px; }
body.willow.mg-app .ps-cell .l { margin-top: 2px; font-family: var(--tblr-font-monospace); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--tblr-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.willow.mg-app .ps-cell .l .stat-q { border-bottom: 0; }
body.willow.mg-app .ps-cell .x { font-size: 11px; color: var(--tblr-secondary); white-space: nowrap; }

/* ---------- dense numeric tables ---------- */
body.willow.mg-app .ps-t { font-size: 13px; font-variant-numeric: tabular-nums; }
body.willow.mg-app .ps-t > :not(caption) > * > * { padding: .28rem .5rem; }
body.willow.mg-app .ps-t th { text-align: right; white-space: nowrap; font-size: 10.5px; }
body.willow.mg-app .ps-t td { text-align: right; white-space: nowrap; }
body.willow.mg-app .ps-t th.nm, body.willow.mg-app .ps-t td.nm,
body.willow.mg-app .ps-t th.l, body.willow.mg-app .ps-t td.l,
body.willow.mg-app .ps-t th.ss, body.willow.mg-app .ps-t td.ss { text-align: left; }
body.willow.mg-app .ps-t td.nm { width: 99%; max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
body.willow.mg-app .ps-t td.nm a { color: var(--tblr-body-color); }
body.willow.mg-app .ps-t tr.go { cursor: pointer; }
body.willow.mg-app .ps-t tr.go:hover td.nm a { color: var(--tblr-primary); }
body.willow.mg-app .ps-t td.big { font-weight: 800; }
body.willow.mg-app .ps-t td.r, body.willow.mg-app .ps-t td.ss, body.willow.mg-app .ps-t td.d { font-family: var(--tblr-font-monospace); font-size: 11.5px; color: var(--tblr-secondary); }
body.willow.mg-app .ps-t td.s, body.willow.mg-app .ps-t td.how { color: var(--tblr-secondary); }
body.willow.mg-app .ps-t .nsub { display: inline; margin-left: 6px; font-family: var(--tblr-font-monospace); font-size: 10px; color: var(--tblr-secondary); font-weight: 400; }
body.willow.mg-app .ps-t .res.badge { font-size: 10.5px; }
body.willow.mg-app .ps-matches tr.later > td { color: var(--tblr-secondary); }
body.willow.mg-app .ps-matches tr.later > td.nm a { color: var(--tblr-secondary); font-weight: 500; }
body.willow.mg-app .ps-ladder tr.me > td { background: var(--tblr-primary-lt); font-weight: 800; }
body.willow.mg-app .ps-ladder tr.me > td:first-child { box-shadow: inset 3px 0 0 var(--tblr-primary); }
body.willow.mg-app .ps-ladder .ladder-secondary { color: var(--tblr-secondary); }
/* batting-order matrix: narrow centred cells, the name column stays put when it scrolls */
body.willow.mg-app .ps-matrix th:not(.nm), body.willow.mg-app .ps-matrix td:not(.nm) { text-align: center; min-width: 28px; padding-left: .2rem; padding-right: .2rem; }
body.willow.mg-app .ps-matrix td.nm { width: 220px; max-width: 220px; }
/* don't stretch a 10-column grid across a wide screen: it stops reading as rows */
@media (min-width: 768px) { body.willow.mg-app .ps-matrix { width: auto; } body.willow.mg-app .ps-matrix th:not(.nm), body.willow.mg-app .ps-matrix td:not(.nm) { width: 40px; } }
body.willow.mg-app .ps-matrix td { color: var(--tblr-border-color); }
body.willow.mg-app .ps-matrix td.position-used { color: var(--tblr-primary); background: var(--tblr-primary-lt); font-weight: 800; }
body.willow.mg-app .ps-matrix td.tot { color: var(--tblr-body-color); }
body.willow.mg-app .ps-matrix .nm { position: sticky; left: 0; z-index: 1; background: var(--tblr-bg-surface); width: auto; min-width: 120px; }

/* ---------- team: last / next game ---------- */
body.willow.mg-app .ps-fx { padding: 7px 14px 8px; }
body.willow.mg-app .ps-fx + .ps-fx { border-top: 1px solid var(--tblr-border-color); }
body.willow.mg-app .ps-fx-v { font-size: 13px; line-height: 1.35; }
body.willow.mg-app .ps-fx-state { color: var(--mg-gold-ink); font-weight: 700; }
body.willow.mg-app .ps-fx-note { font-size: 12px; color: var(--tblr-secondary); background: var(--tblr-bg-surface-secondary); }
body.willow.mg-app .ps-cta .t { font-size: 13px; min-width: 12rem; }
body.willow.mg-app .staff-badge { font-size: 10px; vertical-align: 1px; }

/* ---------- player: summary card (the dark card of the manage home) ---------- */
body.willow.mg-app .ps-hero { background: var(--mg-dark); color: var(--mg-dark-ink); border-color: transparent; }
body.willow.mg-app .ps-avatar { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .12); font-weight: 900; font-size: 16px; }
body.willow.mg-app .ps-role { background: rgba(255, 255, 255, .12); color: inherit; font-family: var(--tblr-font-monospace); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
body.willow.mg-app .ps-hero .verdict { font-size: 13.5px; line-height: 1.35; color: var(--mg-dark-dim); }
body.willow.mg-app .ps-hero .verdict b { color: var(--mg-dark-ink); font-weight: 800; }
body.willow.mg-app .ps-hero-stats { display: flex; gap: 22px; margin-left: auto; }
body.willow.mg-app .ps-hero-stats .hn { font-size: 24px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
body.willow.mg-app .ps-hero-stats .hl { margin-top: 3px; font-family: var(--tblr-font-monospace); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--mg-dark-dim); }
body.willow.mg-app .ps-bar .mg-seg { margin: 0; }
body.willow.mg-app .ps-season .form-select { width: auto; min-width: 150px; }
body.willow.mg-app .ps-legend { margin-top: 4px; font-size: 11px; color: var(--tblr-secondary); }
/* willow-charts.js reads Willow's tokens; give them the card surface */
body.willow.mg-app .wspark, body.willow.mg-app .wposbars { --card: var(--tblr-bg-surface); }
body.willow.mg-app .spark { height: 84px; }

@media (max-width: 767.98px) {
  body.willow.mg-app .ps-cells { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.willow.mg-app .ps-cell { border-bottom: 1px solid var(--tblr-border-color); padding: 6px 10px 7px; }
  body.willow.mg-app .ps-cell:nth-child(3n) { border-right: 0; }
  body.willow.mg-app .ps-cell .n { font-size: 19px; }
  body.willow.mg-app .ps-t td.nm { max-width: 120px; }
  body.willow.mg-app .ps-t > :not(caption) > * > * { padding-left: .35rem; padding-right: .35rem; }
  body.willow.mg-app .ps-matrix td.nm { width: auto; min-width: 104px; }
  body.willow.mg-app .ps-ladder .ladder-secondary { display: none; }
  body.willow.mg-app .ps-hero-stats { margin-left: 0; width: 100%; justify-content: space-between; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .12); }
  body.willow.mg-app .ps-bar .mg-seg { flex: 1 1 100%; }
  body.willow.mg-app .ps-season { margin-left: 0 !important; flex: 1 1 100%; }
  body.willow.mg-app .ps-season .form-select { flex: 1; }
}
