/* Sharq United statistics. Layout from the 2026 prototype; colours match the
   club crest and the scorer (navy, gold, ball red). System fonts only. */
:root {
  --bg: #F5F4EF;
  --surface: #FFFFFF;
  --ink: #17202E;
  --muted: #5B6474;
  --line: #D9D6CC;
  --accent: #1B2A4A;
  --soft: #ECEEF4;
  --red: #A62B2B;
  --gold: #C99A2E;
  --band: #121D33;
  --band-ink: #F4F2EA;
  --band-muted: #AEB6C8;
  --focus: #1B2A4A;
  --body: "Barlow", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --c1: #2E62C9; --c2: #B8860B; --grid: #E7E4DB;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1422; --surface: #152033; --ink: #E9ECF3; --muted: #9AA4B8; --line: #26324A;
    --accent: #D9B45A; --soft: #1C2A43; --red: #E27670; --band: #0A1020; --band-ink: #EEF1F7;
    --band-muted: #9AA4B8; --focus: #D9B45A; color-scheme: dark;
    --c1: #5B86E5; --c2: #B8891F; --grid: #223049;
  }
}
:root[data-theme="dark"] {
  --c1: #5B86E5; --c2: #B8891F; --grid: #223049;
  --bg: #0D1422; --surface: #152033; --ink: #E9ECF3; --muted: #9AA4B8; --line: #26324A;
  --accent: #D9B45A; --soft: #1C2A43; --red: #E27670; --band: #0A1020; --band-ink: #EEF1F7;
  --band-muted: #9AA4B8; --focus: #D9B45A; color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { background: var(--band); color: var(--band-ink); padding-top: env(safe-area-inset-top, 0px); }
.top .wrap { display: flex; align-items: center; gap: 14px; padding-top: 14px; padding-bottom: 14px; }
.crest { flex: none; width: 52px; height: 52px; border-radius: 50%; background: #fff; object-fit: cover; }
.titles { flex: 1; min-width: 0; }
.top h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .01em; line-height: 1.05; }
.top p { margin: 2px 0 0; color: var(--band-muted); font-size: 14px; }
.toplinks { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.toplinks a { color: var(--band-ink); text-decoration: none; border: 1px solid rgba(255,255,255,.3); border-radius: 20px; padding: 6px 12px; font-size: 14px; }

/* Sign-in / messages */
.gate { padding-top: 28px; padding-bottom: 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; max-width: 460px; margin: 0 auto; }
.card h2 { margin: 0 0 8px; font-family: var(--display); font-size: 28px; }
.card p { color: var(--muted); margin: 0 0 14px; }
.card label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.card input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.btn { background: var(--accent); color: var(--surface); border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
.msg { color: var(--red); font-size: 14px; }

/* Leaders */
.board { background: var(--band); color: var(--band-ink); }
.board .wrap { display: grid; grid-template-columns: 1fr 1fr; padding-top: 4px; padding-bottom: 20px; }
.lead { padding: 14px 0; min-width: 0; border-top: 1px solid rgba(255,255,255,.14); }
.lead:nth-child(-n+2) { border-top: 0; }
.lead .what { color: var(--band-muted); font-size: 14px; }
.lead .num { font-family: var(--display); font-weight: 700; font-size: 52px; line-height: 1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; color: var(--gold); }
.lead .num small { font-size: 20px; font-weight: 600; color: var(--band-muted); margin-left: 6px; }
.lead .who { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.lead .sub { color: var(--band-muted); font-size: 13px; margin-top: 2px; }
.lead button.who { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: rgba(255,255,255,.3); text-underline-offset: 3px; }
@media (max-width: 779px) {
  .lead { padding-right: 10px; }
  .lead .num { font-size: 36px; }
  .lead .num small { font-size: 15px; margin-left: 4px; }
  .lead .who { font-size: 16px; }
  .top h1 { font-size: 22px; }
  .crest { width: 44px; height: 44px; }
  .toplinks a { padding: 5px 10px; font-size: 13px; }
}
@media (min-width: 780px) {
  .board .wrap { grid-template-columns: repeat(4, 1fr); padding-top: 14px; }
  .lead { border-top: 0; padding: 6px 20px; border-left: 1px solid rgba(255,255,255,.14); }
  .lead:first-child { border-left: 0; padding-left: 0; }
}

/* Filters */
.controls { padding: 18px 0 6px; }
.controls .wrap { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 14px; color: var(--muted); }
.field select, .field input { height: 44px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; width: 100%; min-width: 0; }
@media (min-width: 780px) { .controls .wrap { grid-template-columns: 180px 160px 1fr 1fr; } }

/* Tabs + summary */
.tabbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 14px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; }
.tab { background: none; border: 0; cursor: pointer; padding: 10px 14px; margin-bottom: -1px; font-family: var(--display); font-weight: 600; font-size: 21px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
.summary { color: var(--muted); font-size: 14px; padding: 0 0 10px; }

/* Tables */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-top: 0; }
table { border-collapse: collapse; width: 100%; min-width: 640px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { width: 44px; color: var(--muted); }
th:nth-child(2), td:nth-child(2) { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
thead th { font-weight: 500; font-size: 14px; color: var(--muted); padding: 0; }
thead th button { width: 100%; background: none; border: 0; cursor: pointer; padding: 12px; color: inherit; text-align: inherit; font-weight: 500; font-size: 14px; }
thead th:nth-child(2) button { text-align: left; }
thead th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 10px; }
thead th[aria-sort="descending"] button::after { content: " ▼"; font-size: 10px; }
thead th[aria-sort] { color: var(--ink); }
td.sorted { background: var(--soft); }
tbody tr:hover td { background: var(--soft); }
.pname, .mlink { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.pname:hover, .mlink:hover { text-decoration-color: var(--accent); }
.legend { color: var(--muted); font-size: 13px; padding: 10px 0 28px; max-width: 90ch; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-top: 0; }
table.matches td:nth-child(2) { position: static; }
table.matches td.res { text-align: left; white-space: normal; min-width: 200px; }
table.matches td.teams { text-align: left; white-space: normal; }

/* Dialog: player profile / scorecard */
dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(6, 10, 20, .6); }
/* The pop-up is a column that always fits the visible screen: the heading stays put and only the body scrolls. 100dvh is the
   height you can actually see on a phone (100vh includes the part behind the browser bars, which hid the top of the heading). */
dialog[open] { display: flex; flex-direction: column; overflow: hidden; max-height: calc(100vh - 32px); max-height: calc(100dvh - 24px); }
dialog[open] .dhead { flex: none; }
dialog[open] .dbody { flex: 1 1 auto; min-height: 0; max-height: none; }
.dhead { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 18px 20px 12px; }
.dhead h2 { margin: 0; font-family: var(--display); font-size: 32px; line-height: 1.05; }
.dhead p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.x { flex: none; width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 20px; line-height: 1; }
.dbody { padding: 0 20px 20px; overflow-y: auto; max-height: calc(100vh - 140px); }
.career { display: flex; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 6px 0 12px; }
.career div { padding: 10px 18px 10px 0; margin-right: 18px; }
.career b { display: block; font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.career span { color: var(--muted); font-size: 13px; }
.dbody h3 { font-family: var(--display); font-size: 20px; margin: 18px 0 6px; }
.dbody .scroll { border: 1px solid var(--line); }
.dbody table { min-width: 460px; }
.dbody th:first-child, .dbody td:first-child { text-align: left; width: auto; color: inherit; position: sticky; left: 0; background: var(--surface); }
.dbody th:nth-child(2), .dbody td:nth-child(2) { position: static; text-align: right; }
.dbody td.how { text-align: left; color: var(--muted); white-space: normal; }
.hd { display: block; padding: 12px; font-weight: 500; font-size: 14px; }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 8px 0; overflow-x: auto; }
.bars div { flex: 1 0 34px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; font-size: 11px; color: var(--muted); }
.bars i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars b { color: var(--ink); font-weight: 600; }

/* Initials badge (players have no photos) */
.avatar { display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; margin-right: .45em; vertical-align: middle;
  font: 700 .72em var(--body); letter-spacing: .02em; color: #fff; background: hsl(var(--h) 45% 38%); flex: none; text-decoration: none; }
.dhead h2 .avatar { font-size: 17px; width: 42px; height: 42px; margin-right: 10px; }
.lead button.who .avatar { font-size: 13px; width: 28px; height: 28px; }

/* Records */
.records { display: grid; grid-template-columns: 1fr; gap: 14px; padding-top: 14px; }
@media (min-width: 780px) { .records { grid-template-columns: 1fr 1fr; } .rec.wide { grid-column: 1 / -1; } }
.rec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.rec h3 { margin: 0 0 8px; font-family: var(--display); font-size: 21px; }
.rec ol { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.rec li { counter-increment: r; display: grid; grid-template-columns: 22px 64px minmax(0, 1fr); column-gap: 8px; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--line); }
.rec li:first-child { border-top: 0; }
.rec li::before { content: counter(r); color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.rec .rv { font: 700 22px var(--display); font-variant-numeric: tabular-nums; }
.rec .rw { min-width: 0; overflow-wrap: anywhere; }
.rec .rd { grid-column: 3; color: var(--muted); font-size: 13px; }
.rec .rdate { font-weight: 500; color: var(--muted); }
.rec table.champs { min-width: 0; }
.rec table.champs td, .rec table.champs th { text-align: left; }
.rec table.champs td:first-child, .rec table.champs th:first-child { width: 70px; color: var(--ink); position: static; }
.rec table.champs td:nth-child(2) { position: static; }
.rec .rn { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }

/* Milestones */
.miles { margin: 0; padding-left: 18px; }
.miles li { padding: 2px 0; }
.bars.w i { background: var(--c2); }

/* Match charts */
.clegend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.clegend span { display: inline-flex; align-items: center; gap: 6px; }
.clegend i { width: 12px; height: 12px; border-radius: 3px; }
.clegend i.c1 { background: var(--c1); } .clegend i.c2 { background: var(--c2); }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .base { stroke: var(--muted); stroke-width: 1; }
svg.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--body); font-variant-numeric: tabular-nums; }
svg.chart path.c1 { fill: var(--c1); } svg.chart path.c2 { fill: var(--c2); }
svg.chart path:hover { opacity: .8; }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .line.c1 { stroke: var(--c1); } svg.chart .line.c2 { stroke: var(--c2); }
svg.chart .wk { stroke: var(--surface); stroke-width: 2; }
svg.chart .wk.c1 { fill: var(--c1); } svg.chart .wk.c2 { fill: var(--c2); }
svg.chart .hit { fill: transparent; }
.ctable { margin-top: 8px; font-size: 14px; }
.ctable summary { cursor: pointer; color: var(--muted); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 13px; padding: 5px 9px; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); max-width: 260px; }

/* Match scorecard: fits a phone (dismissal under the name), one tab per innings */
.inn-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; }
.inn-tab { flex: 0 0 auto; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 14px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.inn-tab.on { border-color: var(--c1); color: var(--c1); }
.inn-panel[hidden] { display: none; }
.dbody .sc { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dbody table.sc-table { min-width: 0; font-size: 14px; }
.dbody table.sc-table th, .dbody table.sc-table td { padding: 8px 5px; position: static; vertical-align: top; text-align: right; white-space: nowrap; color: inherit; width: auto; }
.dbody table.sc-table th:first-child, .dbody table.sc-table td:first-child { text-align: left; white-space: normal; width: 100%; padding-left: 12px; }
.dbody table.sc-table th:last-child, .dbody table.sc-table td:last-child { padding-right: 12px; }
.dbody table.sc-table th { background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; }
.dbody table.sc-table td.r { font-weight: 700; }
.dbody table.sc-table .bh { font-size: 12px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.dbody .sc-line { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 14px; }
.dbody .sc-line b { margin-left: auto; }
.dbody .sc-line small { color: var(--muted); font-size: 12px; }
.dbody .sc-line.total { font-weight: 700; border-bottom: 1px solid var(--line); }
.dbody .sc-note { color: var(--muted); font-size: 13px; margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.dbody .sc-note b { color: var(--ink); }
@media (max-width: 380px) { .dbody table.sc-table { font-size: 13px; } .dbody table.sc-table th, .dbody table.sc-table td { padding: 7px 3px; } }
@media (max-width: 500px) { dialog { width: calc(100vw - 12px); } .dbody { padding: 0 8px 16px; } .dhead { padding: 14px 12px 10px; } }

/* Copyright footer */
.site-foot { text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.7; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); margin-top: 24px; }
.site-foot a { color: inherit; }

/* ---- match filter, match picker and the printable report ---- */
@media (min-width: 780px) { .controls .wrap { grid-template-columns: 180px 160px 1fr 1fr; } .controls .wrap .field:nth-child(5) { grid-column: span 2; } }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.pk-list { display: flex; flex-direction: column; gap: 6px; }
.pk-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--surface); }
.pk-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.pk-row small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
#pkDone { width: 100%; margin-top: 12px; }

#report { background: #DAD8CF; padding-bottom: 8px; }
.rp-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; background: #121D33; color: #F4F2EA; }
.rp-bar label { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; font-size: 15px; }
.rp-bar input { width: 20px; height: 20px; accent-color: #C99A2E; }
.rp-actions { margin-left: auto; display: flex; gap: 8px; }
.rp-bar .btn { background: #C99A2E; color: #121D33; }
.rp-bar .btn.ghost { background: transparent; color: #F4F2EA; border-color: #F4F2EA; }
.rp-paper { background: #fff; color: #17202E; max-width: 820px; margin: 16px auto 32px; padding: 28px 30px; box-shadow: 0 2px 14px rgba(0,0,0,.25); font-size: 14px; }
.rp-head { display: flex; gap: 16px; align-items: center; border-bottom: 3px solid #C99A2E; padding-bottom: 12px; margin-bottom: 4px; }
.rp-head img { width: 64px; height: 64px; object-fit: contain; }
.rp-head h1 { margin: 0; font-family: var(--display); font-size: 26px; color: #121D33; line-height: 1.1; }
.rp-title { margin: 2px 0 0; font-family: var(--display); font-size: 24px; font-weight: 700; color: #8A5A00; }
.rp-sub { margin: 2px 0 0; color: #5B6474; }
.rp-paper h2 { font-family: var(--display); font-size: 20px; color: #121D33; margin: 20px 0 6px; border-bottom: 1px solid #D9D6CC; padding-bottom: 3px; }
.rp-t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rp-t th { text-align: right; background: #ECEEF4; color: #5B6474; font-size: 12px; text-transform: uppercase; padding: 5px 6px; }
.rp-t td { text-align: right; padding: 5px 6px; border-bottom: 1px solid #ECE9E0; vertical-align: top; }
.rp-t th:first-child, .rp-t td:first-child { text-align: left; }
.rp-t tr { break-inside: avoid; }
.rp-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rp-box { border: 1px solid #D9D6CC; border-radius: 6px; padding: 8px 10px; break-inside: avoid; }
.rp-box h3 { margin: 0 0 4px; font-family: var(--display); font-size: 16px; color: #8A5A00; }
.rp-lead { display: flex; flex-direction: column; margin-bottom: 4px; } .rp-lead span { color: #5B6474; font-size: 12.5px; }
.rp-foot { margin-top: 22px; padding-top: 8px; border-top: 1px solid #D9D6CC; text-align: center; color: #5B6474; font-size: 12px; }
.rp-empty { padding: 24px 0; color: #5B6474; }
@media (max-width: 640px) { .rp-paper { margin: 0; padding: 16px; box-shadow: none; } .rp-boxes { grid-template-columns: 1fr; } .rp-t { font-size: 12.5px; } }
@media print {
  @page { size: A4; margin: 12mm; }
  body.reporting > *:not(#report) { display: none !important; }
  body.reporting { background: #fff; }
  #report { background: #fff; padding: 0; }
  .rp-bar { display: none; }
  .rp-paper { margin: 0; padding: 0; max-width: none; box-shadow: none; }
  .rp-paper h2 { break-after: avoid; }
}
.rp-t.res th, .rp-t.res td { text-align: left; }
.rp-t.res small { display: block; color: #5B6474; font-size: 12.5px; margin-top: 2px; font-weight: 400; }
.rp-t.res td, .rp-t.res th { white-space: normal; overflow-wrap: anywhere; }
/* the report is its own page: undo the statistics tables' sticky columns, minimum width and no-wrap */
.rp-paper .rp-t { min-width: 0; }
.rp-paper .rp-t th, .rp-paper .rp-t td { position: static; width: auto; background: none; white-space: normal; padding: 5px 6px; font-weight: 400; }
.rp-paper .rp-t th { background: #ECEEF4; color: #5B6474; font-size: 12px; font-weight: 600; }
.rp-paper .rp-t td:first-child, .rp-paper .rp-t td:nth-child(2) { color: #17202E; }
.rp-paper .rp-t th:nth-child(2), .rp-paper .rp-t td:nth-child(2) { text-align: right; }
.rp-paper .rp-t th:first-child, .rp-paper .rp-t td:first-child { text-align: left; }
.rp-paper .rp-t.res th, .rp-paper .rp-t.res td { text-align: left; }
.rp-paper .rp-t td { white-space: nowrap; }
.rp-paper .rp-t td:first-child, .rp-paper .rp-t.res td { white-space: normal; }
.pom { display: block; color: var(--accent); font-size: 12.5px; font-weight: 600; margin-top: 2px; white-space: normal; }
.rp-award { margin: 8px 0 0; padding: 8px 10px; background: #FBF3DD; border-left: 4px solid #C99A2E; font-size: 14px; }
.rp-note { margin: 14px 0 0; color: #5B6474; font-size: 12px; }

/* ---- balanced teams (teams.html) ---- */
.tm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 16px 0; }
.tm-card h2 { margin: 0 0 6px; font-family: var(--display); font-size: 26px; }
.tm-hint { color: var(--muted); margin: 0 0 10px; font-size: 14px; }
.tm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 10px 0; }
.tm-list { border-top: 1px solid var(--line); }
.tm-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tm-row input { width: 20px; height: 20px; }
.tm-row.tm-off { opacity: .55; }
.tm-num { grid-column: 2; color: var(--muted); font-size: 13px; }
.tm-tags { grid-column: 3; grid-row: 1 / 3; display: flex; gap: 6px; }
.tm-chip { border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 14px; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.tm-chip.tm-on { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.tm-name em { color: var(--muted); font-style: normal; font-size: 13px; }
.tm-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tm-team h3 { margin: 0 0 6px; font-family: var(--display); font-size: 22px; }
.tm-team h3 small { color: var(--muted); font-size: 14px; }
.tm-p { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 6px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; padding: 4px 6px; }
.tm-p.tm-pick { outline: 3px solid #C99A2E; }
.tm-pn { background: none; border: 0; text-align: left; color: var(--ink); font: inherit; padding: 4px 0; cursor: pointer; }
.tm-pn small { display: block; color: var(--muted); font-size: 12px; }
.tm-flags i { font-style: normal; font-size: 11px; background: var(--line); border-radius: 3px; padding: 1px 4px; margin-right: 3px; }
.tm-btns { grid-column: 2; grid-row: 1; display: flex; gap: 6px; align-items: center; }
.tm-swap { background: var(--accent); color: var(--surface); border: 0; border-radius: 12px; font-size: 12px; padding: 4px 10px; cursor: pointer; }
.tm-swap.tm-on { background: #C99A2E; color: #121D33; }
.tm-lock { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 12px; font-size: 12px; padding: 2px 8px; cursor: pointer; }
.tm-lock.tm-on { background: #C99A2E; color: #121D33; border-color: #C99A2E; }
.tm-sub { margin: 16px 0 6px; font-family: var(--display); font-size: 20px; }
.tm-t { width: 100%; min-width: 0; border-collapse: collapse; font-size: 14px; }
.tm-t th, .tm-t td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.tm-t th:first-child { text-align: left; font-weight: 600; }
.tm-good { color: #1F7A4A; } .tm-bad { color: #A62B2B; font-weight: 700; }
.tm-msg { color: #A62B2B; }
@media (max-width: 560px) { .tm-teams { grid-template-columns: 1fr; } }

/* the one-page printout of the teams: hidden on screen, the only thing printed */
#tpSheet { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body.teaming > *:not(#teams), #teams > .tm-card { display: none !important; }
  body.teaming, body.teaming #teams { background: #fff !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  #tpSheet { display: block; color: #17202E; font: 10.5pt Arial, Helvetica, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tp-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid #C99A2E; padding-bottom: 8px; }
  .tp-head img { width: 62px; height: 62px; object-fit: contain; }
  .tp-head h1 { margin: 0; font-size: 20pt; color: #0E1A2F; } .tp-head p { margin: 2px 0 0; color: #555; }
  .tp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
  #tpSheet h2 { margin: 0 0 4px; font-size: 14pt; color: #0E1A2F; background: #F1E8CF; padding: 5px 8px; border-radius: 4px; }
  #tpSheet h2 small { font-size: 9pt; color: #555; font-weight: 400; margin-left: 8px; }
  #tpSheet table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; }
  #tpSheet th:nth-child(2), #tpSheet td:nth-child(2) { position: static; }
  #tpSheet th:nth-child(1), #tpSheet td:nth-child(1) { width: 8%; } #tpSheet th:nth-child(3), #tpSheet td:nth-child(3) { width: 10%; } #tpSheet th:nth-child(4), #tpSheet td:nth-child(4) { width: 10%; } #tpSheet th:nth-child(5), #tpSheet td:nth-child(5) { width: 12%; } #tpSheet th:nth-child(6), #tpSheet td:nth-child(6) { width: 11%; } #tpSheet th:nth-child(7), #tpSheet td:nth-child(7) { width: 13%; }
  #tpSheet .tp-bal table { table-layout: auto; }
  #tpSheet td.tp-n { overflow: hidden; text-overflow: ellipsis; }
  #tpSheet th, #tpSheet td { padding: 5px 3px; text-align: right; border-bottom: 1px solid #E3DFD2; }
  #tpSheet th { font-size: 7.5pt; letter-spacing: -0.2px; color: #666; text-transform: uppercase; }
  #tpSheet .tp-n { text-align: left; } .tp-b { font-weight: 600; white-space: nowrap; font-size: 9pt; } .tp-k { color: #888; text-align: left !important; width: 30px; } .tp-t { text-align: left !important; width: 52px; }
  #tpSheet i { font-style: normal; font-size: 8pt; font-weight: 700; border-radius: 3px; padding: 1px 4px; margin-right: 2px; color: #fff; }
  .tp-B { background: #1F5A3D; } .tp-F { background: #C99A2E; } .tp-K { background: #0E1A2F; }
  .tp-bal { margin: 14px auto 0; width: 62%; } .tp-bal h3 { margin: 0 0 4px; font-size: 12pt; color: #0E1A2F; }
  #tpSheet .tp-bal tbody th { text-align: left; text-transform: none; font-size: 10pt; color: #17202E; font-weight: 600; }
  .tp-note { margin-top: 10px; font-size: 8pt; color: #777; text-align: center; }
}

.tm-save { display: grid; gap: 6px; border: 2px solid #C99A2E; border-radius: 8px; padding: 12px; margin: 14px 0 6px; background: rgba(201,154,46,.08); }
.tm-save > span { color: var(--muted); font-size: 14px; } .tm-save .btn { justify-self: start; } .tm-saved { font-weight: 600; color: var(--ink) !important; }

/* how a batter gets out (player profile) */
.dis-bars { display: grid; gap: 6px; margin: 8px 0 14px; }
.dis-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.dis-row i { display: block; height: 14px; border-radius: 3px; background: var(--accent); min-width: 3px; }
.dis-row.dis-no i { background: #1F7A4A; }
.dis-row b small, .dis-box li small { color: var(--muted); font-weight: 400; }
.dis-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 8px; }
.dis-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.dis-box h4 { margin: 0 0 4px; font-size: 14px; color: var(--muted); font-weight: 500; }
.dis-box ol { margin: 0; padding-left: 20px; } .dis-box li { padding: 2px 0; font-size: 14px; }
.dis-box li .pname { font: inherit; }

.pv { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 0 0 12px; }
.pv button { background: transparent; border: 0; padding: 7px 18px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.pv button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }

/* leaders tab */
.lead-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 12px; }
.lead-pick label { color: var(--muted); font-size: 14px; }
.lead-pick select { height: 44px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; max-width: 100%; font: inherit; }
table.leaders { min-width: 0; } table.leaders td.lead-sub { text-align: left; white-space: normal; color: var(--muted); font-size: 14px; }
table.leaders td:nth-child(2) { position: static; } table.leaders td:nth-child(3) b { font-size: 17px; }

/* Player photos: a real picture in place of the initials badge, and the administrators' photo page */
.avatar.ph { background: #d9dde4; overflow: hidden; padding: 0; }
.avatar.ph img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
table .avatar { width: 26px; height: 26px; font-size: 11px; margin-right: 8px; }
.tm-name .avatar { width: 28px; height: 28px; font-size: 11px; margin-right: 8px; }
.ph-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.ph-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: inherit; font: 600 14px var(--body); cursor: pointer; }
.ph-main { background: var(--navy, #0E1A2F); color: #fff; border-color: transparent; }
.ph-rm { color: #b3261e; }
.ph-search { flex: 1 1 160px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font: 15px var(--body); }
.ph-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ph-big .avatar { width: 56px; height: 56px; font-size: 18px; margin: 0; }
.ph-name { flex: 1 1 140px; font-weight: 600; }
.ph-name small { display: block; font-weight: 400; color: #666; font-size: 12px; }
.ph-msg { font-weight: 600; min-height: 1.2em; }

/* Adjusting a player photo: centre the face, zoom, preview */
.ph-modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 14, 28, .72); display: grid; place-items: center; padding: 16px; overflow: auto; }
.ph-dlg { background: var(--surface, #fff); color: inherit; border-radius: 12px; padding: 18px; width: min(360px, 100%); max-height: 100%; overflow: auto; }
.ph-dlg h3 { margin: 0 0 4px; font-family: var(--display); font-size: 22px; }
.ph-stage { display: grid; place-items: center; margin: 10px 0; }
.ph-stage canvas { width: 280px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; touch-action: none; cursor: grab; border: 3px solid var(--line); background: #fff; }
.ph-zoom, .ph-chk { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
.ph-zoom input { flex: 1; }
.ph-prev { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; font-size: 12px; color: #666; }
.ph-prev canvas { border-radius: 50%; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Player profile: a larger photo to the right of the name; tap it for the full view */
.dhead .dtitle { min-width: 0; flex: 1; }
.dside { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
#pPic:empty { display: none; }
.ppic { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: zoom-in; color: inherit; font: inherit; }
.ppic img { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 2px 10px rgba(14, 26, 47, .35); background: #d9dde4; }
.ppic small { font-size: 12px; color: var(--accent, #1a4fa0); }
.ppic.nopic { cursor: default; }
.ppic.nopic .avatar { width: 96px; height: 96px; font-size: 32px; margin: 0; }
@media (max-width: 500px) { .ppic img { width: 100px; height: 100px; } .ppic.nopic .avatar { width: 80px; height: 80px; font-size: 26px; } }
.ph-light { position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 28, .82); display: grid; place-items: center; cursor: zoom-out; padding: 16px; }
.ph-light figure { margin: 0; text-align: center; color: #fff; }
.ph-light img { width: min(86vw, 480px); height: min(86vw, 480px); border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: 0 10px 34px rgba(0, 0, 0, .55); background: #d9dde4; }
.ph-light figcaption { margin-top: 14px; font: 600 20px var(--body); }
.ph-light small { display: block; margin-top: 4px; font-weight: 400; font-size: 14px; opacity: .8; }

/* Balanced teams: saved versions and the "marked In since" box */
.tm-saved-card .tm-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#tmPlan { flex: 1 1 260px; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: 15px var(--body); background: var(--surface); color: inherit; max-width: 100%; }
.tm-changes { margin: 10px 0; padding: 10px 14px; border: 1px solid #e3c36a; background: #fff8e1; border-radius: 8px; color: #3a2e07; }
.tm-changes p { margin: 6px 0; }
.tm-changes .btn { margin-top: 6px; }
@media (prefers-color-scheme: dark) { .tm-changes { background: #3a3114; border-color: #8a7330; color: #f3e7bd; } }

/* Photo quality guide: green sharp, amber a little soft, red small */
.ph-q { margin: 6px 0; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.35; }
.ph-q small { opacity: .8; }
.ph-q-g.ph-q, .ph-q.ph-q-g { background: #e5f4ea; color: #145a2c; }
.ph-q-a.ph-q, .ph-q.ph-q-a { background: #fff4d6; color: #6b4a00; }
.ph-q-r.ph-q, .ph-q.ph-q-r { background: #fde7e4; color: #8c1d12; }
.ph-ql { display: block; font-weight: 600; margin-top: 2px; }
.ph-ql.ph-q-g { color: #1b7a3a; } .ph-ql.ph-q-a { color: #8a5a00; } .ph-ql.ph-q-r { color: #b3261e; }
@media (prefers-color-scheme: dark) { .ph-q.ph-q-g { background: #173a24; color: #bfe8cb; } .ph-q.ph-q-a { background: #3a3014; color: #f3e1a8; } .ph-q.ph-q-r { background: #44201c; color: #f6c2bb; }
  .ph-ql.ph-q-g { color: #7fd09a; } .ph-ql.ph-q-a { color: #e6c36b; } .ph-ql.ph-q-r { color: #f19a90; } }
