/* App shell and the four tabs (Matchup, Team, Players, League). Uses tokens.css. */
body { padding-bottom: 84px; }
.sr { position: absolute; left: -9999px; }
.appbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.appbar-in { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-3); padding-bottom: var(--space-3); }
.league-pill { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.sample-banner { background: color-mix(in srgb, var(--accent) 16%, var(--bg)); color: var(--text); font-size: 0.8rem; text-align: center; padding: 6px 0; }
.app-foot { padding: var(--space-4) 0 var(--space-5); font-size: 0.8rem; }

/* Tabs: bottom bar on phones, inline on desktop */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tabs-in { display: grid; grid-template-columns: repeat(4, 1fr); }
.tabs a { display: grid; justify-items: center; gap: 2px; padding: 10px 4px 8px; color: var(--text-muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; min-height: 56px; }
.tabs a[aria-current="page"] { color: var(--primary); }
.tabs a[aria-current="page"] svg { stroke-width: 2.4; }

.view { padding-top: var(--space-4); padding-bottom: var(--space-5); }
.section-h { font-size: 1rem; margin: var(--space-5) 0 var(--space-2); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.weekbar { display: flex; align-items: center; justify-content: space-between; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.3rem; cursor: pointer; }

/* Matchup */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-3); align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin: var(--space-3) 0; }
.scoreboard .side { display: grid; gap: 2px; }
.scoreboard .right { text-align: right; }
.tname { font-family: var(--font-heading); font-weight: 700; }
.owner { font-size: 0.8rem; }
.big { font-family: var(--font-heading); font-size: 2.4rem; font-weight: 700; line-height: 1.1; }
.big.lead { color: var(--primary); }
.vs { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.slots { border-top: 1px solid var(--border); }
.slot-row { display: grid; grid-template-columns: 1fr 38px 1fr; gap: var(--space-2); align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.slot-row .slot-tag { justify-self: center; padding: 2px 4px; min-width: 0; width: 100%; font-size: 0.65rem; }
.slot-tag { background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); border-radius: 999px; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; min-width: 40px; text-align: center; }
.pl { display: grid; grid-template-columns: 1fr auto; column-gap: var(--space-2); align-items: center; min-height: 44px; }
.pl.right { text-align: right; grid-template-columns: auto 1fr; }
.pl.right .pl-pts { grid-column: 1; grid-row: 1 / span 3; align-self: center; }
.pl.right .pl-name, .pl.right .pl-meta, .pl.right .pl-line { grid-column: 2; }
.pl-name { font-weight: 600; font-size: 0.86rem; line-height: 1.2; }
.pl-meta, .pl-line { font-size: 0.7rem; line-height: 1.3; }
.pl .pl-name, .pl .pl-meta, .pl .pl-line { min-width: 0; overflow-wrap: anywhere; }
.pl-pts { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; }
/* Status dot replaces the old boxed/bordered player card: same colors as the legend below */
.pl-name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--border); vertical-align: middle; }
.pl.st-final .pl-name::before { background: var(--positive); }
.pl.st-live .pl-name::before { background: var(--accent); }
.pl.right .pl-name::before { content: none; }
.pl.right .pl-name::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; background: var(--border); vertical-align: middle; }
.pl.right.st-final .pl-name::after { background: var(--positive); }
.pl.right.st-live .pl-name::after { background: var(--accent); }
.legend { font-size: 0.8rem; display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.chip-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; background: var(--border); }
.chip-dot.final { background: var(--positive); }
.chip-dot.live { background: var(--accent); }

/* Team */
.tlist { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--border); }
.trow { display: grid; grid-template-columns: 44px 1fr 72px 76px; gap: var(--space-3); align-items: center; padding: 10px 4px; min-height: 56px; border-bottom: 1px solid var(--border); }
.tinfo { display: grid; min-width: 0; }
.games { font-family: var(--font-heading); font-weight: 700; text-align: right; }
.games small { color: var(--text-muted); font-family: var(--font-body); font-weight: 400; }
.mini { background: transparent; color: var(--primary); border: 1px solid var(--primary); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 0.8rem; font-weight: 600; min-height: 36px; cursor: pointer; }
.mini.add { background: var(--primary); color: var(--on-primary); }
.mini.ghost { color: var(--text-muted); border-color: var(--border); display: inline-grid; place-items: center; cursor: default; }
.lock { text-align: center; }
.trow .mini { justify-self: end; }

/* Players */
.search { width: 100%; min-height: 48px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin: var(--space-3) 0; }
.chips { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.chip { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px; min-height: 40px; font: inherit; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.grow { flex: 1; }
.sortlbl { font-size: 0.8rem; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--border); }
.prow { display: grid; grid-template-columns: 1fr 52px 56px auto; gap: var(--space-3); align-items: center; padding: 10px 4px; min-height: 56px; border-bottom: 1px solid var(--border); }
.prow[hidden], .empty[hidden] { display: none; }
.fp { display: grid; text-align: right; line-height: 1.2; }
.fp small { font-size: 0.65rem; }

/* League */
.invite-row { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.invite-row code { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem; }
.stand { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.stand th, .stand td { padding: 10px 12px; text-align: left; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.stand th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stand .num { text-align: right; }
.stand tr.me td { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); font-weight: 600; }
.stand tr:last-child td { border-bottom: 0; }
.games-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--border); font-size: 0.9rem; }
.g-team.right { text-align: right; }
.g-team.lead { font-weight: 700; color: var(--primary); }
.g-score { font-family: var(--font-heading); font-weight: 700; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--border); }
.feed li { padding: 10px 4px; font-size: 0.9rem; border-bottom: 1px solid var(--border); }
.feed .when { display: block; font-size: 0.75rem; }

@media (min-width: 800px) {
  body { padding-bottom: 0; }
  .tabs { position: static; border: 0; background: transparent; padding: 0; }
  .tabs-in { display: flex; gap: var(--space-2); }
  .tabs a { grid-auto-flow: column; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; font-size: 0.95rem; border-bottom: 3px solid transparent; }
  .tabs a[aria-current="page"] { border-bottom-color: var(--primary); }
  .view { max-width: 760px; }
}

/* Help tips: a "?" that explains things on hover, focus or tap */
.help { position: relative; display: inline-block; vertical-align: middle; margin-left: 4px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.help-btn { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid var(--text-muted); background: transparent; color: var(--text-muted); font: inherit; font-size: 0.72rem; font-weight: 700; line-height: 1; cursor: help; display: inline-grid; place-items: center; }
.help-btn:hover, .help.open .help-btn { color: var(--primary); border-color: var(--primary); }
.help-tip { display: none; white-space: normal; position: absolute; z-index: 20; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(260px, 78vw); background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.82rem; line-height: 1.45; box-shadow: 0 10px 30px rgba(0,0,0,0.35); text-align: left; }
.help:hover .help-tip, .help:focus-within .help-tip, .help.open .help-tip { display: block; }
.help.right .help-tip { left: auto; right: -8px; transform: none; }
.section-h .help, .legend .help { margin-left: 6px; }

/* Avatars (team photo placeholder) and rival matchups */
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--primary) 22%, var(--surface-2)); color: var(--text); font-family: var(--font-heading); font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; border: 1px solid var(--border); }
.scoreboard .right .avatar { justify-self: end; }
a.icon-btn { display: inline-grid; place-items: center; text-decoration: none; }
.icon-btn.ghost { border-color: transparent; background: transparent; }

/* Matchup: bench and links */
.pl a.pl-name, .tinfo a.pl-name { color: var(--text); text-decoration: none; }
.pl a.pl-name:hover, .tinfo a.pl-name:hover { color: var(--primary); text-decoration: underline; }
.flag { grid-column: 1; font-size: 0.66rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.pl.right .flag { grid-column: 2; }
.slots.bench .pl { opacity: 0.92; }
.bench-sum { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin: var(--space-2) 2px 0; font-size: 0.85rem; color: var(--text-muted); }
.bench-sum strong { font-family: var(--font-heading); font-size: 1.05rem; color: var(--text); }

/* Team: column header and games count */
.thead { display: grid; grid-template-columns: 44px 1fr 72px 76px; gap: var(--space-3); padding: 0 4px var(--space-2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; align-items: center; }
.thead .games-h { text-align: center; white-space: nowrap; }
.games { text-align: center; font-family: var(--font-heading); font-weight: 700; }
.trow.empty-slot { min-height: 44px; }

/* Players: sort bar, reasons and tags */
.sortbar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-3); }
.chip.small { min-height: 34px; padding: 4px 14px; font-size: 0.85rem; }
.chip-wrap { display: inline-flex; align-items: center; }
.why { font-size: 0.74rem; color: var(--accent); }
.tag { display: inline-block; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; margin-right: 6px; }
.tag.hot { background: var(--accent); color: #1a0a05; }

/* Player page */
.crumb { margin: var(--space-2) 0; font-size: 0.9rem; }
.pcard { display: flex; gap: var(--space-4); align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.jersey { flex: none; width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-family: var(--font-heading); font-weight: 800; font-size: 1.6rem; }
.pname { font-size: 1.5rem; margin: 0; }
.pmeta { margin: 2px 0 6px; }
.owner-pill { display: inline-block; margin: 0; font-size: 0.78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.owner-pill.mine { border-color: var(--primary); color: var(--primary); }
.rankline { margin: var(--space-3) 0 0; font-size: 0.9rem; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: var(--space-3) 0 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.statgrid div { padding: 10px 6px; text-align: center; border-left: 1px solid var(--border); }
.statgrid div:first-child { border-left: 0; }
.statgrid dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.statgrid dd { margin: 2px 0 0; font-family: var(--font-heading); font-weight: 700; font-size: 1.2rem; }
.weeks, .log { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--border); }
.weeks li { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); padding: 10px 4px; border-bottom: 1px solid var(--border); }
.weeks .wk small { margin-left: 6px; }
.weeks .wk-line { font-size: 0.78rem; grid-column: 1; }
.weeks .wk-fp { grid-column: 2; grid-row: 1 / span 2; font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; align-self: center; text-align: right; }
.weeks .wbar { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.weeks .wbar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.log li { display: grid; grid-template-columns: 64px 64px 1fr auto; gap: var(--space-3); align-items: center; padding: 10px 4px; font-size: 0.88rem; border-bottom: 1px solid var(--border); }
.log .logline { font-size: 0.8rem; }
.card.soon { border-style: dashed; }
.card.soon p { margin: 0 0 var(--space-2); }

/* League matchup rows are links: one line per team, scores on the right */
.games-list li { border-bottom: 1px solid var(--border); }
.games-list a { display: grid; grid-template-columns: 1fr auto 24px; gap: 2px var(--space-3); align-items: center; padding: 12px 4px; color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
.games-list a:hover { background: var(--surface-2); }
.games-list .chev { grid-column: 3; grid-row: 1 / span 2; color: var(--text-muted); font-size: 1.4rem; text-align: right; }
.games-list .g-team, .games-list .g-score { font-size: 0.95rem; }
.g-score { text-align: right; min-width: 3ch; }
.g-score.lead { color: var(--primary); }

.draft-cta { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); border: 1px solid var(--primary); border-radius: var(--radius); padding: var(--space-4); color: var(--text); text-decoration: none; margin-bottom: var(--space-2); }
.draft-cta .muted { display: block; font-size: 0.85rem; }
.draft-cta .chev { font-size: 1.6rem; color: var(--primary); }
