:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #b23a48;
  --accent-soft: #fdecef;
  --win: #1f8a4c;
  --loss: #c0392b;
  --draw: #8a8a1f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1480px; margin: 0 auto; padding: 0 16px; }

/* ---- top bar and menu ------------------------------------------------------ */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 54px; }
.brand { font-weight: 700; color: var(--text); font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.menu { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.menu ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.menu a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--text); font-weight: 500; white-space: nowrap; }
.menu a:hover { background: #eef0f3; text-decoration: none; }
.menu a.active { background: var(--accent); color: #fff; }
.menu-toggle, .menu-btn, .menu-current { display: none; }
/* season: badge (current / earlier / other group) + an icon dropdown with the seasons */
.seasonbadge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; white-space: nowrap; margin-left: -8px; }
.seasonbadge.cur { background: #e3f3e9; color: #1f6f40; }
.seasonbadge.old { background: #fdf0d8; color: #8a5a00; }
.seasonpick { position: relative; margin-left: -10px; }
.seasonpick summary { list-style: none; cursor: pointer; width: 26px; height: 26px; border-radius: 6px; display: flex;
  align-items: center; justify-content: center; color: var(--muted); border: 1px solid var(--line); font-size: 12px; }
.seasonpick summary::-webkit-details-marker { display: none; }
.seasonpick summary:hover, .seasonpick[open] summary { background: #eef0f3; color: var(--text); }
.seasonpick ul { position: absolute; top: 32px; left: 0; z-index: 10; list-style: none; margin: 0; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 260px; }
.seasonpick a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text); white-space: nowrap; }
.seasonpick a:hover { background: #eef0f3; text-decoration: none; }
.seasonpick a.active { background: var(--accent); color: #fff; } .seasonpick a.active .muted { color: #fde; }
@media (max-width: 1100px) { .brand-text { display: none; } .seasonbadge { margin-left: -10px; } .topbar .wrap { gap: 12px; } }
/* account: login link or name + logout */
.account { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.account form { margin: 0; }
.account a, button.link { color: var(--accent); background: none; border: 0; padding: 4px 2px; font: inherit; cursor: pointer; }
.account a.active { font-weight: 700; }
.accountmenu { position: relative; }
.accountmenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 5px; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-weight: 600; }
.accountmenu summary::-webkit-details-marker { display: none; }
.accountmenu summary:hover, .accountmenu[open] summary { background: #eef0f3; }
.accountmenu .caret { font-size: 10px; color: var(--muted); }
.accountmenu .busy { color: var(--accent); font-size: 18px; line-height: 0; }
.accountmenu .who { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.accountpanel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 230px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.accountpanel .acc-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: normal; }
.accountpanel form { margin: 0; }
.accountpanel a, .accountpanel button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 6px;
  color: var(--text); background: none; border: 0; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.accountpanel a:hover, .accountpanel button:hover:not([disabled]) { background: #eef0f3; text-decoration: none; }
.accountpanel a.active { color: var(--accent); font-weight: 600; }
.accountpanel button[disabled] { color: var(--muted); cursor: progress; }
.accountpanel button small { color: var(--muted); font-size: 11px; margin-left: auto; padding-left: 10px; }
.accountpanel button.tinted { background: #fdecef; color: var(--accent); font-weight: 600; }
.accountpanel button.tinted:hover { background: #fbdde3; }
.accountpanel .acc-sep { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.card.narrow { max-width: 560px; }
.loginform { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.loginform input, .adminform input[type=email] { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; min-width: 240px; }
button.primary, .loginform button { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 16px; font-weight: 600; cursor: pointer; }
nav.rounds .half-sep { align-self: center; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin: 0 4px; }

/* ---- narrow screens -------------------------------------------------------- */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .wrap { padding: 0 10px; }
  .topbar .wrap { gap: 8px; min-height: 50px; }
  .brand { font-size: 15px; }
  .brand-text { display: none; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px;
              border: 1px solid var(--line); border-radius: 8px; font-size: 20px; cursor: pointer; user-select: none; }
  .menu-current { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu ul { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--card);
             border-bottom: 1px solid var(--line); box-shadow: 0 10px 24px rgba(0,0,0,.10); flex-direction: column;
             gap: 2px; padding: 8px 10px 10px; }
  .menu-toggle:checked ~ ul { display: flex; }
  .menu a { padding: 10px 12px; }
  .seasonbadge { font-size: 10px; padding: 2px 5px; margin-left: -4px; }
  .seasonpick { margin-left: -4px; }
  .seasonpick ul { position: fixed; left: 8px; right: 8px; top: 50px; min-width: 0; }
  .accountmenu summary { padding: 5px 7px; }
  .accountmenu .who { max-width: 70px; }
  .loginform input, .adminform input[type=email] { min-width: 0; width: 100%; }
  h1 { font-size: 20px; margin: 14px 0 10px; }
  h1 small, h2 small { display: block; margin: 2px 0 0; }
  .big { font-size: 22px; }
  .card { padding: 12px; overflow-x: auto; }
  th, td { padding: 5px 5px; font-size: 13px; }
  td.venue { font-size: 12px; }
  .hide-m { display: none !important; }
  .form .pill { width: 24px; height: 24px; line-height: 22px; font-size: 11px; }
  nav.rounds a { min-width: 28px; padding: 4px 6px; }
  /* team match list: one stacked block per match (date / home – score – away / venue), no sideways scroll */
  table.matchlist { width: 100%; }
  table.matchlist thead { display: none; }
  table.matchlist tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "date date date" "home score away" "venue venue venue"; column-gap: 10px; row-gap: 2px;
    padding: 8px 6px; border-bottom: 1px solid var(--line); }
  table.matchlist tbody td { padding: 0; border: 0; font-size: 14px; }
  table.matchlist td.c-date { grid-area: date; font-size: 12px; color: var(--muted); white-space: normal; }
  table.matchlist td.c-date br { display: none; }
  table.matchlist td.c-date small { margin-left: 6px; }
  table.matchlist td.c-time { display: none; }
  table.matchlist .m-only { display: inline; }
  table.matchlist td.c-home { grid-area: home; text-align: right; overflow-wrap: anywhere; }
  table.matchlist td.c-score { grid-area: score; text-align: center; align-self: center; }
  table.matchlist td.c-away { grid-area: away; text-align: left; overflow-wrap: anywhere; }
  table.matchlist td.c-venue { grid-area: venue; font-size: 12px; text-align: center; }
  table.matchlist td.c-venue:empty { display: none; }
  table.matchlist tbody tr > td[colspan] { grid-column: 1 / -1; }
}
.m-only { display: none; }

h1 { font-size: 24px; margin: 22px 0 14px; }
h1 small, h2 small { font-size: 60%; font-weight: 400; margin-left: 8px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.big { font-size: 26px; font-weight: 700; margin: 4px 0 8px; }
.nowrap { white-space: nowrap; }
code, pre { background: #eef0f3; border-radius: 4px; padding: 2px 5px; font-size: 90%; }

.grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }

.banner { padding: 10px 14px; border-radius: 8px; margin: 14px 0; }
.banner.info { background: #e8f1fb; color: #1d4e89; }
.banner.error { background: #fdecef; color: #8a1c2b; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.team, th.team { text-align: left; }
td.team.right, th.team.right { text-align: right; }
td.team.me a { font-weight: 700; color: var(--text); }
td.score { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
td.score a { color: inherit; }   /* result colour comes from the row (res-Gy/V/D), not the link */
td.venue { text-align: left; color: var(--muted); font-size: 13px; }
tr.mine { background: var(--accent-soft); }
tr.mine td.team a { font-weight: 700; color: var(--text); }
tr.res-Gy td.score { color: var(--win); }
tr.res-V td.score { color: var(--loss); }
tr.res-D td.score { color: var(--draw); }
.win { color: var(--win); }
.loss { color: var(--loss); }
table.compact td, table.compact th { padding: 4px 6px; }

.badge { display: inline-block; background: #eef0f3; color: var(--muted); border-radius: 4px; padding: 0 6px; font-size: 11px; }
.badge.warn { background: #fff4d6; color: #7a5a00; }

.form .pill { display: inline-block; width: 26px; height: 26px; line-height: 24px; text-align: center; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; margin: 0 3px 3px 0; }
.pill.Gy { background: var(--win); } .pill.V { background: var(--loss); } .pill.D { background: var(--draw); }

tr.teammate { background: #f7f3e8; }
.chance { display: inline-block; min-width: 42px; padding: 1px 6px; border-radius: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chance.good { background: #e3f4ea; color: var(--win); }
.chance.even { background: #f3f0d9; color: #6b6b14; }
.chance.bad { background: #fbe5e2; color: var(--loss); }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
h1 .score { margin: 0 12px; font-variant-numeric: tabular-nums; }
table.gridtable th, table.gridtable td { padding: 8px 10px; }
table.gridtable td.cell { font-weight: 600; font-variant-numeric: tabular-nums; }
table.gridtable td.cell.home { background: #fdecec; color: #8a1c1c; }
table.gridtable td.cell.away { background: #e8edfb; color: #1c3a8a; }
table.gridtable td.cell.mecell { outline: 2px solid var(--accent); outline-offset: -2px; }

nav.rounds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
nav.rounds a { display: inline-block; min-width: 32px; text-align: center; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
nav.rounds a.current { border-color: var(--accent); }
nav.rounds a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
nav.rounds .disabled { display: inline-block; min-width: 32px; text-align: center; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--line); }
nav.matchnav { margin-bottom: 10px; }
nav.matchnav a, nav.matchnav .disabled { min-width: 28px; padding: 3px 6px; font-size: 13px; }

footer { margin: 24px auto 32px; font-size: 13px; }

/* ---- match page: played grid and heat-map ---------------------------------- */
table.gridtable td.cell.won { background: #dff3e6; color: #176b3c; }
table.gridtable td.cell.lost { background: #fbe3e0; color: #8a1c1c; }
table.gridtable td.cell.wo { opacity: .55; font-weight: 400; }
table.gridtable th .rowteam { color: var(--text); font-size: 13px; text-transform: none; letter-spacing: 0; }
table.gridtable .mecol { border-left: 3px solid var(--accent); border-right: 3px solid var(--accent); }
table.gridtable tr.merow td { border-top: 3px solid var(--accent); border-bottom: 3px solid var(--accent); }
table.gridtable tr.merow td.team a { font-weight: 700; color: var(--text); }
table.gridtable th.mecol a { font-weight: 700; color: var(--text); }
table.heat td.cell { padding: 0; min-width: 56px; }
table.heat td.cell a.pct { display: block; padding: 10px 8px; color: inherit; font-weight: 700; font-variant-numeric: tabular-nums; }
table.heat td.cell a.pct:hover { text-decoration: none; outline: 2px solid var(--text); outline-offset: -2px; }
table.heat td.cell a.pct.sel { outline: 3px solid var(--text); outline-offset: -3px; }
table.heat th { white-space: normal; }
.legend { display: inline-block; padding: 0 6px; border-radius: 4px; }
.legend.won { background: #dff3e6; color: #176b3c; } .legend.lost { background: #fbe3e0; color: #8a1c1c; }
#compare h3 { font-size: 14px; margin: 10px 0 6px; color: var(--muted); }
table.cmp th.team { text-transform: none; font-size: 13px; letter-spacing: 0; }
table.cmp td { font-size: 14px; }
table.cmp .form .pill { width: 22px; height: 22px; line-height: 20px; font-size: 10px; }
.draw { color: var(--draw); }
td.score-pair a { font-weight: 600; font-variant-numeric: tabular-nums; }
.grid.members { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .grid.members { grid-template-columns: 1fr; } }
/* team page match list: row tinted by the team's outcome, score numbers coloured like on the overview */
table.teamres tr.res-Gy { background: #f1faf4; } table.teamres tr.res-V { background: #fdf3f2; } table.teamres tr.res-D { background: #fbfaee; }
table.teamres tr.res-Gy td.score, table.teamres tr.res-V td.score, table.teamres tr.res-D td.score { color: inherit; }
a.btn { display: inline-block; background: var(--accent-soft); color: var(--accent); border: 1px solid #f3c9d0; border-radius: 8px; padding: 5px 12px; font-weight: 600; }
a.btn:hover { background: var(--accent); color: #fff; text-decoration: none; }
.star { color: #c99a06; font-size: 12px; }

/* set-score chips in the compare panel: score + count, green for wins, red for losses */
.setdist { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.setchip { font-size: 11px; padding: 1px 5px; border-radius: 8px; white-space: nowrap; }
.setchip b { margin-left: 4px; }
.setchip.w { background: #e3f3e9; color: #14663a; } .setchip.l { background: #fbe6e3; color: #8e2418; }
table.kv th.team { white-space: nowrap; vertical-align: top; }
table.kv td { white-space: normal; } table.kv th { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* recent-form trend badge */
.trend { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.trend.up { background: #e3f3e9; color: #14663a; } .trend.down { background: #fbe6e3; color: #8e2418; } .trend.steady { background: #eef0f3; color: #555; }

.grid.tight { gap: 16px; align-items: start; }
table.common td { text-align: left; }
/* played-match grid: a result opens the comparison panel */
table.gridtable td.cell a.cmp-open { display: block; color: inherit; }
table.gridtable td.cell a.cmp-open:hover { text-decoration: none; outline: 2px solid var(--text); outline-offset: 2px; }
table.gridtable td.cell a.cmp-open.sel { outline: 3px solid var(--text); outline-offset: 2px; }
/* player page: comparison picker */
.cmppick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cmppick select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font: inherit; min-width: 260px; max-width: 100%; }

/* availability (point 10) */
.availbox { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 4px 0 8px; }
.avail-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.avail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.avail-actions a.btn { padding: 7px 14px; }
.avail-count { font-size: 12px; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.avail-count[title] { cursor: help; }
.avail-count b { margin-left: 3px; }
/* the phone ⓘ with the names: anchored to its right edge, so it opens towards the box */
details.availinfo { align-self: center; margin-left: 2px; }
details.rowinfo.availinfo > summary { font-size: 16px; padding: 0 6px; }
details.rowinfo.availinfo > div { left: auto; right: 0; min-width: 220px; max-width: min(300px, calc(100vw - 48px)); }
details.availinfo p, .avail-names p { margin: 2px 0; }
.avail-names { font-size: 14px; }
.card:has(details.availinfo[open]) { overflow: visible; }   /* phones: .card scrolls sideways, which would clip it */
.avail-label.yes { color: #14663a; } .avail-label.maybe { color: #8a5a00; } .avail-label.no { color: #8e2418; }
.avail-count.yes { background: #e3f3e9; color: #14663a; } .avail-count.no { background: #fbe6e3; color: #8e2418; }
.avail-count.maybe { background: #fdf0d8; color: #8a5a00; } .avail-count.none { background: #eef0f3; color: #555; }
.hscroll { overflow-x: auto; }
.accessgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.accessgrid fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 8px; margin: 0; }
.accessgrid legend { font-weight: 600; padding: 0 4px; }
label.check { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.admin-jump { flex-wrap: wrap; margin: 0 0 10px; }
.tabbar { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 12px; }
.tabbar .tab { background: none; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; padding: 7px 12px;
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer; margin-bottom: -1px; text-align: left; }
.tabbar .tab small { display: block; font-weight: 400; font-size: 11px; }
.tabbar .tab:hover { background: #eef0f3; }
.tabbar .tab.active { background: var(--card); border-color: var(--line); color: var(--accent); }
.tabpanel h3 { margin: 4px 0 8px; }
/* match page forecast: one panel per scenario */
.fcpanel p { margin: 6px 0; }
.fc-score .big-num { font-size: 20px; font-variant-numeric: tabular-nums; }
.fc-chances { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0; max-width: 520px; }
.fc-chances > div { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.fc-chances > div:nth-child(2) { align-items: center; } .fc-chances > div:nth-child(3) { align-items: flex-end; }
.fc-chances small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-score .fc-range { display: block; font-size: 13px; }
details.explain summary { cursor: pointer; color: var(--accent); font-size: 13px; margin-top: 6px; }
.card[id], .tabpanel { scroll-margin-top: 70px; }
details.collapsible > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::before { content: "▸"; color: var(--muted); font-size: 14px; width: 12px; }
details.collapsible[open] > summary::before { content: "▾"; }
details.collapsible > summary h2 { margin: 0; }
details.collapsible[open] > summary { margin-bottom: 10px; }
.adminform input[type=text] { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; min-width: 180px; }
ol.plainlist { list-style: none; margin: 4px 0; padding: 0; } ol.plainlist li { padding: 3px 0; }
ol.plainlist b { display: inline-block; width: 18px; color: var(--muted); }
.availgrid select { border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px; font: inherit; }
.availgrid select.avail-yes { color: var(--win); } .availgrid select.avail-no { color: var(--loss); }
.availgrid th { white-space: normal; min-width: 90px; }
.availform { margin: 0; } .availform label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.availform select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-weight: 400; }
@media (max-width: 760px) { .availform select { font-size: 16px; min-height: 40px; } .avail-actions a.btn { padding: 10px 16px; } }
.avail { font-size: 11px; font-weight: 700; margin-left: 2px; }
.avail.yes { color: #1f8a4c; } .avail.no { color: #c0392b; } .avail.maybe { color: #b07800; }
/* a member who said "no": greyed in the heat-map */
table.heat tr.unavail td, table.heat td.cell.unavail, table.heat th.unavail { filter: grayscale(0.85); opacity: 0.55; }

/* slots (8A) */
.slotshare { display: inline-block; height: 8px; background: var(--accent); opacity: .55; border-radius: 4px; margin-left: 6px; vertical-align: middle; max-width: 100px; }
.slotbar { letter-spacing: .02em; }

/* career (9C) and half-season split */
.rivals { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.rival { font-size: 13px; padding: 3px 10px; border-radius: 12px; }
.rival.bad { background: #fbe6e3; } .rival.good { background: #e3f3e9; }
.halves { font-size: 13px; margin-top: -6px; }
.help { cursor: help; }
/* phone-only popover next to a name: the columns that do not fit */
details.rowinfo { position: relative; vertical-align: middle; margin-left: 4px; }   /* shown on phones only (.m-only) */
details.rowinfo > summary { list-style: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 0 4px; }
details.rowinfo > summary::-webkit-details-marker { display: none; }
details.rowinfo > div { position: absolute; left: -40px; top: calc(100% + 4px); z-index: 20; min-width: 210px; padding: 8px 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
  font-size: 13px; line-height: 1.5; white-space: normal; text-align: left; color: var(--text); }
/* 9A projection: place-probability strip, one cell per place (darker = likelier) */
table.projection td { white-space: nowrap; }
/* wide screens: scroll sideways if needed; phones show few enough columns to fit, and must not
   clip the ⓘ popover */
@media (min-width: 761px) { .projwrap { overflow-x: auto; } }
.pstrip { display: inline-flex; gap: 1px; vertical-align: middle; }
.pstrip i { display: inline-block; width: 9px; height: 16px; border-radius: 2px;
  background: color-mix(in srgb, #3d6aa8 var(--p), #eef1f5); box-shadow: inset 0 -2px 0 transparent; }
.pstrip i.up { box-shadow: inset 0 -3px 0 #2e9e5b; }
.pstrip i.down { box-shadow: inset 0 -3px 0 #c0392b; }
.pstrip i.now { outline: 1.5px solid var(--text); outline-offset: -1px; }
.pstrip.small i { width: 7px; height: 12px; }
/* 9A team forecast */
.fc-head { margin-bottom: 4px; }
p.sos { margin-top: 0; font-size: 13px; }
table.remaining tr.inferred td { font-style: italic; }
@media (min-width: 761px) { .remaining-wrap { max-height: 300px; overflow-y: auto; } }
table.remaining .chance-cell { display: inline-block; min-width: 38px; text-align: center; border-radius: 6px; padding: 1px 4px; font-weight: 600; }
.badge.key { background: #fff3cd; color: #7a5a00; border: 1px solid #f0d58a; font-style: normal; }
.xpline { margin: -4px 0 6px; font-size: 14px; }
.fc-line { margin: 4px 0; font-size: 14px; }
.stakes { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 6px; font-size: 14px; }
.stakes p { margin: 3px 0; }
small.xp { color: var(--muted); font-size: 11px; }
.rankpick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.rankpick .tab { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font: inherit; cursor: pointer; }
.rankpick .tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rankpick select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; max-width: 100%; }

/* the evening (8B): playing order */
table.evening tr.sep td { padding: 0; height: 6px; border: 0; }
table.evening tr.wo td { opacity: .55; }
table.evening td.team.win a { font-weight: 700; }

/* live scoresheet */
.badge.live { background: #c0392b; color: #fff; }
table.live tr.differs td { background: #fdf3f2; }
table.live td { vertical-align: top; }
.liveedit summary { cursor: pointer; list-style: none; font-size: 16px; padding: 0 6px; }
.liveedit summary::-webkit-details-marker { display: none; }
.liveedit[open] { position: relative; }
.liveedit form { position: absolute; right: 0; z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.15); min-width: 320px; }
.liveedit select, .lineupform select, .subform select { border: 1px solid var(--line); border-radius: 6px; padding: 4px; font: inherit; max-width: 100%; }
table.setform td, table.setform th { padding: 2px 4px; }
.slotpick { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.slotpick b { width: 16px; }
.liveadmin { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-start; margin-top: 8px; }
.liveadmin details summary { cursor: pointer; color: var(--accent); }
.livesum { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; background: #fafbfc; }
.livesum p { margin: 4px 0; }
.livesum-score { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0 6px; }
.liveadmin .sublist { flex-basis: 100%; order: 99; border-top: 1px solid var(--line); padding-top: 6px; }   /* below the buttons */
button.setclear { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
button.setclear:hover { background: #eef0f3; color: var(--loss); }
.subform { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
form.inline { display: block; margin: 2px 0; }
button.link.danger { color: var(--loss); }
.popuphead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
button.closepop:not(.link) { border: 0; background: #eef0f3; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 14px; line-height: 1; flex: none; }
button.closepop:not(.link):hover { background: var(--line); }

/* the evening as the printed scoresheet (_sheet.html): plain, no colours. Each cell: the set
   points on the left, the set score on the right split by a slant (home bottom-left, away
   top-right, as on the paper form), the single's number in the corner. */
.sheetwrap { max-width: 760px; margin: 0 auto; }
.sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 10px; }
table.sheet { border-collapse: collapse; width: 100%; max-width: 760px; table-layout: fixed; }   /* equal columns, an empty place too */
table.sheet th, table.sheet td { border: 1px solid #9aa1ab; vertical-align: top; text-transform: none; letter-spacing: 0; }
table.sheet thead th { width: 21%; }
table.sheet thead th.corner { width: 16%; }
table.sheet th.corner { position: relative; height: 44px; background:
  linear-gradient(to top right, transparent calc(50% - 1px), #9aa1ab, transparent calc(50% + 1px)); }
table.sheet th.corner .c-away { position: absolute; top: 3px; right: 5px; font-size: 10px; }
table.sheet th.corner .c-home { position: absolute; bottom: 3px; left: 5px; font-size: 10px; }
table.sheet th.who { text-align: left; color: var(--text); font-size: 16px; font-weight: 600; padding: 3px 5px;
  overflow-wrap: anywhere; line-height: 1.25; }
table.sheet .letter { display: block; font-size: 10px; color: var(--muted); text-align: center; }
table.sheet .pname { display: block; text-align: center; }
table.sheet .pname.none, table.sheet .none-cell { font-size: 32px; font-weight: 300; line-height: 1; color: var(--muted); text-align: center; }
table.sheet small.csere { display: block; font-weight: 400; font-size: 10px; color: var(--muted); border-top: 1px dotted #c3c8cf;
  margin-top: 2px; padding-top: 1px; }
table.sheet td.scell { position: relative; height: 52px; padding: 3px 4px 12px; }
table.sheet .cellbox { display: flex; justify-content: space-between; align-items: flex-start; gap: 3px; }
table.sheet .sets { display: flex; flex-direction: column; font-size: 10px; line-height: 1.2; font-variant-numeric: tabular-nums;
  color: #444; text-align: left; }
table.sheet .slant { position: relative; flex: none; width: 50px; height: 50px; margin-left: auto; font-size: 26px; font-weight: 600;
  font-variant-numeric: tabular-nums; background:
  linear-gradient(to top right, transparent calc(50% - .75px), #555, transparent calc(50% + .75px)); }
table.sheet .slant .h { position: absolute; left: 1px; bottom: -2px; }
table.sheet .slant .a { position: absolute; right: 1px; top: -3px; }
table.sheet .going { font-size: 10px; color: var(--muted); margin-left: auto; }
table.sheet .none-cell { display: block; line-height: 34px; }
table.sheet .seq { position: absolute; right: 3px; bottom: 1px; font-size: 9px; color: var(--muted); }
.sheet-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin: 12px 0 6px; font-size: 14px; }
.sheet-foot .sheet-total { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .sheet-foot { grid-template-columns: 1fr; font-size: 13px; }
  table.sheet thead th.corner { width: 18%; }
  table.sheet thead th { width: 20.5%; }
  table.sheet th.who { font-size: 12px; padding: 3px 4px; }
  table.sheet td.scell { padding: 2px 3px 11px; }
  table.sheet .slant { width: 50px; height: 50px; font-size: 24px; }
  table.sheet .none-cell { line-height: 30px; }
}

/* match page on phones: header, forecast, heat-map / grid, live scoresheet */
.winpick { display: flex; gap: 4px; }
.winpick label { flex: 1; cursor: pointer; }
.winpick input { position: absolute; opacity: 0; pointer-events: none; }
.winpick span { display: block; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.winpick input:checked + span { background: var(--win); border-color: var(--win); color: #fff; font-weight: 600; }
.winpick input:focus-visible + span { outline: 2px solid var(--accent); }
@media (max-width: 760px) {
  .d-only { display: none !important; }
  .m-only { display: inline; }
  h1.matchhead { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
    font-size: 18px; }
  h1.matchhead a:first-child { text-align: right; }
  h1.matchhead .score { margin: 0; font-size: 22px; }
  /* heat-map and played grid: short names, the name column stays while the table scrolls */
  table.gridtable th, table.gridtable td { padding: 6px 5px; font-size: 13px; }
  table.gridtable th:first-child, table.gridtable td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1;
    box-shadow: 1px 0 0 var(--line); }
  table.gridtable thead th:first-child small { display: none; }
  table.gridtable thead th:first-child br { display: none; }
  table.heat td.cell { min-width: 44px; }
  table.heat td.cell a.pct { padding: 9px 4px; }
  /* live scoresheet: one block per single, the edit button always in reach */
  table.live > thead { display: none; }
  table.live > tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 8px; row-gap: 2px;
    grid-template-areas: "seq run edit" "home score away"; padding: 8px 2px; border-bottom: 1px solid var(--line); align-items: center; }
  table.live > tbody > tr.sep { display: block; padding: 0; height: 6px; border: 0; background: #eef0f3; }
  table.live > tbody > tr > td { padding: 0; border: 0; font-size: 15px; }
  table.live .l-seq { grid-area: seq; font-size: 13px; font-weight: 600; text-align: left; justify-self: start; padding-left: 5px; }
  table.live .l-run { grid-area: run; text-align: center; font-size: 12px; }
  table.live .l-edit { grid-area: edit; justify-self: end; }
  table.live .l-home { grid-area: home; text-align: right; overflow-wrap: anywhere; }
  table.live .l-score { grid-area: score; text-align: center; white-space: normal; font-size: 16px; }
  table.live .l-score small { display: block; font-size: 11px; }
  table.live .l-score br { display: none; }
  table.live .l-away { grid-area: away; overflow-wrap: anywhere; }
  table.live > tbody > tr.mine { background: var(--accent-soft); }
  #live .liveedit summary { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid var(--accent);
    border-radius: 18px; color: var(--accent); font-size: 14px; font-weight: 600; }
  #live tr.mine .liveedit summary { background: var(--accent); color: #fff; }
  /* the entry form: a bottom sheet with big targets; 16px text keeps iOS from zooming in */
  #live .liveedit form { position: fixed; left: 0; right: 0; top: auto; bottom: 0; min-width: 0; max-height: 88vh; overflow: auto;
    border-radius: 16px 16px 0 0; padding: 14px 14px 18px; box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
  #live .liveedit select { font-size: 16px; padding: 8px 6px; min-height: 40px; }
  #live .winpick span { padding: 10px 6px; font-size: 15px; }
  #live table.setform td { padding: 4px 3px; }
  #live table.setform td:first-child { width: 24px; }
  .popfoot { position: sticky; bottom: -18px; background: var(--card); padding: 10px 0 4px; margin: 0; }
  .popfoot button.primary { width: 60%; padding: 12px; font-size: 16px; }
  #live button.closepop:not(.link) { width: 36px; height: 36px; font-size: 16px; }
  body.popopen { overflow: hidden; }
  #live .lineupform select { font-size: 16px; padding: 8px 6px; flex: 1; }
  /* team page: one block per team match (round · date, position / home – score – away / venue, points) */
  table.teamres thead { display: none; }
  table.teamres tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 8px; row-gap: 2px;
    grid-template-areas: "date date pos" "home score away" "venue venue pts"; padding: 8px 6px; border-bottom: 1px solid var(--line); }
  table.teamres td { padding: 0; border: 0; }
  table.teamres .t-round { display: none; }
  table.teamres .t-date { grid-area: date; font-size: 12px; color: var(--muted); white-space: normal; }
  table.teamres .t-pos { grid-area: pos; text-align: right; font-size: 12px; }
  table.teamres .t-home { grid-area: home; text-align: right; overflow-wrap: anywhere; }
  table.teamres .t-score { grid-area: score; text-align: center; align-self: center; }
  table.teamres .t-away { grid-area: away; overflow-wrap: anywhere; }
  table.teamres .t-venue { grid-area: venue; font-size: 12px; }
  table.teamres .t-pts { grid-area: pts; text-align: right; font-size: 12px; }
  /* tables with phone-only cells */
  th.m-only, td.m-only { display: table-cell; }
  small.m-sub { display: block; color: var(--muted); font-size: 11px; }
  /* the ⓘ popover on a name: on the name's line, a little apart from it */
  details.rowinfo { display: inline-block; margin-left: 8px; }
  details.rowinfo > summary { display: inline; padding: 0 2px; }
  table.standings th, table.standings td { padding: 5px 3px; }
  table.standings th { letter-spacing: 0; font-size: 10px; }
  .card { padding: 12px; }   /* the base rule comes after the first phone block */
  /* wide tables scroll sideways in their own box (.hscroll); the name column stays in view */
  .hscroll table.compact > thead > tr:first-child > th:first-child,
  .hscroll table.compact > tbody > tr > td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card);
    box-shadow: 1px 0 0 var(--line); }
  .hscroll table.compact > tbody > tr.mine > td:first-child { background: var(--accent-soft); }
  .hscroll table.compact > tbody > tr.teammate > td:first-child { background: #f7f3e8; }
  /* charts with a side legend get it underneath, and the room for it */
  .legend-m { height: 520px !important; }
  .legend-m.many { height: 600px !important; }
  /* player page matches: round · date, team match / opponent and set score / opponent's team */
  table.playerres thead { display: none; }
  table.playerres tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 1px;
    grid-template-areas: "round date tie" "opp opp score" "team team score"; padding: 8px 4px; border-bottom: 1px solid var(--line); }
  table.playerres td { padding: 0; border: 0; text-align: left; }
  table.playerres .p-round { grid-area: round; font-size: 12px; }
  table.playerres .p-date { grid-area: date; font-size: 12px; color: var(--muted); }
  table.playerres .p-tie { grid-area: tie; font-size: 12px; text-align: right; }
  table.playerres .p-opp { grid-area: opp; font-size: 15px; font-weight: 600; }
  table.playerres .p-team { grid-area: team; font-size: 12px; }
  table.playerres .p-team a { color: var(--muted); }
  table.playerres .p-score { grid-area: score; align-self: center; justify-self: end; font-size: 17px; }
  /* admin: one block per member (name and flags / e-mail address) or guest */
  table.adminform thead { display: none; }
  table.adminform tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 12px; row-gap: 6px;
    align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); }
  table.adminform td { padding: 0; border: 0; position: static !important; background: none !important; box-shadow: none !important; }
  table.adminform td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  table.adminform td:empty { display: none; }
  table.adminform input[type=email], table.adminform input[type=text] { width: 100%; min-width: 0; font-size: 16px; }
  table.adminform label.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
  table.adminform label.flag input { width: 18px; height: 18px; }
}
