:root {
  color-scheme: light;
  --ground: #f8fafc;
  --surface: #fff;
  --ink: #0f172a;
  --muted: #526071;
  --border: #d9e0e6;
  --accent: #0f766e;
  --accent-dark: #07554e;
  --selection: #e5f5f0;
  --error: #991b1b;
  font-family: "Avenir Next", "Aptos", "Helvetica Neue", sans-serif;
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); }
[hidden] { display: none !important; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 2.7rem); line-height: 1.17; letter-spacing: -.045em; }
h2 { font-size: 1.13rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.35; }
.muted { color: var(--muted); }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.frame { width: min(100% - 2rem, 58rem); margin-inline: auto; }
.masthead { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 3.75rem; gap: 1rem; }
.topbar nav, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .9rem; }
.topbar nav { font-size: .91rem; }
.topbar nav a, .topbar button { color: var(--ink); }
.wordmark { color: var(--ink); display: inline-flex; align-items: center; gap: .5rem; font-size: 1.14rem; font-weight: 800; text-decoration: none; }
.mark { display: grid; place-items: center; width: 1.8rem; aspect-ratio: 1; border-radius: .3rem; background: var(--accent-dark); color: white; font-weight: 800; font-style: italic; }
.content { padding-block: 2.1rem 3rem; }
.page-heading { display: grid; gap: .38rem; margin-bottom: 1.35rem; }
.section { margin-block: 2.2rem; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .65rem; }
.section-heading:not(:first-child) { margin-top: 1.5rem; }
.board { background: var(--surface); border: 1px solid var(--border); border-radius: .55rem; }
.pool-row { padding: 1rem 1.18rem; display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .75rem; }
.pool-row + .pool-row { border-top: 1px solid var(--border); }
.pool-row h3 { font-size: 1.07rem; }
.pool-row p { margin-top: .23rem; }
button, .button { font: inherit; font-weight: 650; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
.primary, .secondary { padding: .45rem .85rem; min-height: 2.55rem; border: 1px solid transparent; border-radius: .36rem; }
.primary { background: var(--accent-dark); color: #fff; }
.primary:hover, .primary:focus-visible { background: #053c37; }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.secondary:hover { border-color: var(--accent); }
.topbar .standings-button { min-height: 2.15rem; padding: .24rem .65rem; }
.topbar .standings-button[aria-current="page"] { border-color: var(--accent); background: var(--selection); }
.quiet { border: 0; background: none; padding: .18rem .1rem; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.page-tabs { display: flex; flex-wrap: wrap; gap: .2rem 1.3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; }
.page-tabs a { padding: .45rem .05rem .6rem; color: var(--muted); text-decoration: none; }
.page-tabs a:hover { color: var(--accent-dark); text-decoration: underline; }
.page-tabs [aria-current] { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--accent); }
.message, .empty { background: var(--surface); border: 1px solid var(--border); padding: .8rem 1rem; border-radius: .4rem; margin-bottom: 1rem; }
.message.success { color: var(--accent-dark); border-color: #8fbab4; }
.message.error, .errorlist { color: var(--error); }
.auth-panel { width: min(100%, 29rem); margin-inline: auto; padding: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: .55rem; }
.auth-panel > p, .stack { margin-block: .85rem; }
.stack { display: grid; gap: .85rem; align-items: start; }
.stack p { display: grid; gap: .3rem; }
.stack label { font-weight: 650; }
.stack button { justify-self: start; }
input:not([type=radio], [type=hidden]), select { max-width: 100%; border: 1px solid var(--border); border-radius: .3rem; background: var(--surface); color: var(--ink); font: inherit; padding: .3rem .45rem; }
.stack input, .link-input { width: 100%; }
.panel { padding: .9rem 1rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); }
tbody th { font-weight: 650; }
tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
thead, .current-player { background: #edf3f4; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 37rem) {
  .frame { width: calc(100% - 1.15rem); }
  .content { padding-top: 1.35rem; }
  th, td { padding: .45rem .55rem; }
}

body:has(.picksheet-editor) .frame { width: min(calc(100% - 2rem), 66rem); }
.picksheet-help { margin-bottom: .75rem; }
.confidence-layout { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(12rem, 1fr); grid-template-areas: "games ranks"; align-items: start; gap: .75rem; }
.confidence-ledger { grid-area: ranks; position: sticky; top: .5rem; z-index: 2; max-height: calc(100dvh - 4rem); overflow: auto; }
.confidence-ledger h2 { padding: .5rem .62rem; font-size: 1rem; }
.confidence-ranks { list-style: none; padding: 0; margin: 0; }
.confidence-rank { display: grid; grid-template-columns: 1.65rem minmax(0, 1fr) auto; gap: .3rem; align-items: start; min-height: 2rem; padding: .26rem .48rem; border-top: 1px solid var(--border); font-size: .86rem; }
.confidence-rank .rank-number { color: var(--accent-dark); font-weight: 750; font-variant-numeric: tabular-nums; }
.rank-pick { min-width: 0; overflow-wrap: anywhere; }
.rank-matchup { display: block; font-size: .74rem; line-height: 1.2; }
.rank-locked { font-size: .71rem; }
.confidence-empty { padding: .25rem .62rem .55rem; }
.picksheet-games { grid-area: games; }
.picksheet-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.picksheet-table thead th:first-child { width: 34%; border-radius: .45rem 0 0 0; }
.confidence-layout .picksheet-table thead th:first-child { width: 29%; }
.confidence-layout .picksheet-table thead th:nth-child(2) { width: 44%; }
.picksheet-table thead th:last-child { border-radius: 0 .45rem 0 0; }
.picksheet-table td, .picksheet-table th { padding: .55rem .48rem; vertical-align: top; font-size: .88rem; overflow-wrap: anywhere; }
.picksheet-table tbody tr:has([data-confidence-open][aria-expanded="true"]) { background: #f2f7f5; }
.picksheet-time { display: block; margin-top: .12rem; font-size: .75rem; font-weight: 500; }
.picksheet-teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .32rem; }
.picksheet-team, .picksheet-opponent { display: flex; justify-content: space-between; align-items: center; gap: .35rem; padding: .35rem .42rem; min-height: 2.35rem; text-align: left; line-height: 1.25; }
.picksheet-team[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-dark); background: var(--selection); }
.upset-progress { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .48rem .62rem; margin-bottom: .55rem; font-size: .88rem; }
.picksheet-clear { margin-top: .14rem; font-size: .73rem; }
.confidence-rank-toggle { min-width: 3rem; min-height: 2.15rem; justify-content: space-between; gap: .32rem; padding: .24rem .4rem; font-variant-numeric: tabular-nums; }
.confidence-rank-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-dark); }
.confidence-rank-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(1.62rem, 1fr)); gap: .2rem; margin-top: .35rem; max-height: 14rem; overflow-y: auto; padding: .12rem; }
.confidence-rank-options button { position: relative; min-height: 1.85rem; padding: .1rem; border: 1px solid var(--border); border-radius: .27rem; background: var(--surface); color: var(--ink); font-size: .8rem; font-variant-numeric: tabular-nums; }
.confidence-rank-options button:focus-visible { outline-offset: -2px; }
.confidence-rank-options button:hover:not(:disabled) { border-color: var(--accent); }
.confidence-rank-options button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-dark); background: var(--selection); }
.confidence-rank-options .confidence-rank-used { border-color: #cfbd9c; background: #f5ecda; }
.confidence-rank-used::after { content: ""; position: absolute; width: .26rem; height: .26rem; top: .14rem; right: .14rem; border-radius: 50%; background: #805e29; }
.confidence-rank-options button:disabled { background: #edf0f2; color: var(--muted); text-decoration: line-through; }
.confidence-rank-note { font-size: .7rem; line-height: 1.25; margin-top: .18rem; }
.picksheet-status { position: sticky; bottom: 0; z-index: 3; min-height: 2.4rem; padding: .42rem .64rem; border: 1px solid var(--border); border-radius: .35rem; background: var(--surface); color: var(--accent-dark); font-size: .88rem; }
.picksheet-status:empty { display: none; }
.picksheet-status.picksheet-error { color: var(--error); }
.picksheet-tiebreak { padding: .7rem .75rem; margin-top: .75rem; }
.picksheet-tiebreak h2 { margin-bottom: .32rem; }
.picksheet-tiebreak form { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.picksheet-tiebreak input { width: 4.5rem; }

@media (max-width: 43rem) {
  .standings-table th, .standings-table td { padding-inline: .35rem; font-size: .85rem; }
  .standings-table tbody th { overflow-wrap: anywhere; }
  body:has(.picksheet-editor) .frame { width: calc(100% - 1.2rem); }
  .confidence-layout { grid-template-columns: 1fr; grid-template-areas: "ranks" "games"; gap: .55rem; }
  .confidence-ledger { top: 0; max-height: 34dvh; }
  .confidence-ledger h2 { padding-block: .33rem; }
  .confidence-ranks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .confidence-rank:nth-child(even) { border-left: 1px solid var(--border); }
  .confidence-rank { min-height: 1.68rem; grid-template-columns: 1.2rem minmax(0, 1fr) auto; gap: .2rem; padding: .17rem .3rem; font-size: .75rem; }
  .rank-matchup { display: none; }
  .rank-locked { font-size: .64rem; }
  .picksheet-table td, .picksheet-table th { padding-inline: .35rem; }
  .confidence-layout .picksheet-table thead th:nth-child(2) { width: 39%; }
}
@media (max-width: 29rem) {
  .picksheet-teams { grid-template-columns: 1fr; }
  .picksheet-team { min-height: 2.2rem; }
}
