/* One type scale for the whole app: every font-size uses one of these. */
:root { --fs-xs: .75rem; --fs-sm: .85rem; --fs-md: .92rem; --fs-base: 1rem; --fs-lg: 1.15rem; --fs-xl: 1.4rem; --fs-xxl: 1.8rem; }
:root {
  --bg: #f3f5f2; --card: #fff; --ink: #1b241d; --muted: #66706a; --line: #dde3de;
  --accent: #1f7a3f; --accent-ink: #fff; --warn: #b26a00; --danger: #b3261e; --sel: #e3f3e8;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111613; --card: #1b221d; --ink: #e8ede9; --muted: #9aa49d; --line: #2c362f; --sel: #183a24; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
main { max-width: 640px; margin: 0 auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
h1 { font-size: var(--fs-xl); margin: 8px 4px 12px; }
h2 { font-size: var(--fs-lg); margin: 0 0 8px; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }
.hidden { display: none !important; }

/* safe-area insets keep content clear of the notch / home bar when launched from the home screen */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px;
  padding: calc(10px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left));
  background: var(--accent); color: var(--accent-ink); }
/* App shell (logged in): the top bar is a fixed block and only the page under it scrolls, so the bar can never
   scroll away (iPhone could take a sticky or fixed bar with the page) */
html:has(body.shell), body.shell { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* pinned to every edge of the screen, so the page runs right to the bottom (behind the home bar) on iPhone */
/* An ordinary page exactly the height you can see (not position: fixed: iPhone's home-screen app stops drawing fixed
   layers short of the bottom, leaving a band). Home-screen app: app.js sets --app-h to the screen's own height. In
   Safari: the visible height (dvh, and app.js), never the height with its toolbars hidden — or the bottom of the page
   (the last game) sits under Safari's toolbar where it can't be scrolled to. */
body.shell { display: flex; flex-direction: column; height: 100vh; height: var(--app-h, 100dvh); }
body.shell > .topbar, body.shell > .dev-top { position: relative; flex: none; }
body.shell > .page { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
body.chart-open > .topbar, body.chart-open > .dev-top { display: none; }  /* the All chart has the whole screen */
body.shell .match, body.shell details.admin-game { scroll-margin-top: 10px; }  /* the bar is outside the scroll now */
.topbar .brand { display: flex; text-decoration: none; }
.topbar .brand img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.4); }
.topbar nav { display: flex; gap: 0; flex: 1; overflow-x: auto; }
.topbar nav a { text-decoration: none; padding: 6px 8px; border-radius: 8px; opacity: .85; white-space: nowrap; font-size: var(--fs-md); }
.topbar nav a.on { background: rgba(255,255,255,.2); opacity: 1; }
.topbar nav a.nav-admin { margin-left: auto; }
button.link { background: none; border: 0; color: inherit; font: inherit; font-size: var(--fs-sm); opacity: .85; cursor: pointer; white-space: nowrap; }

.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  margin-bottom: 12px; text-decoration: none; }
.card.ok { border-color: var(--accent); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 12px; padding-bottom: 2px; }
.tabs a { white-space: nowrap; padding: 8px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  text-decoration: none; font-size: var(--fs-md); }
.tabs a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 3.1em; padding: 3px 6px;
  border-radius: 6px; font-weight: 700; font-size: var(--fs-sm); letter-spacing: .03em; color: #fff; background: var(--c);
  text-shadow: 0 1px 1px rgba(0,0,0,.35); }

/* Team logos sit on a light tile so dark logos stay visible in dark mode. */
.tlogo { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: var(--fs-sm); letter-spacing: .03em; }
.tlogo img { width: 26px; height: 26px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px;
  box-shadow: 0 0 0 1px var(--line); }
.tlogo.away { flex-direction: row-reverse; }  /* away team: code, then logo */
.tlogo.md img { width: 40px; height: 40px; padding: 3px; }
.tlogo.lg img { width: 52px; height: 52px; padding: 4px; border-radius: 10px; }

/* Match card */
.match .meta { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-sm); color: var(--muted);
  margin-bottom: 10px; gap: 8px; }
.match .row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.match .label { font-size: var(--fs-sm); color: var(--muted); margin-right: auto; }
.match.saving { opacity: .8; }
.match.locked { opacity: .65; }
.match button { flex: 1; min-height: 44px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; font: inherit; cursor: pointer; transition: background .1s, border-color .1s; }
.match button.sel { border-color: var(--accent); background: var(--sel); font-weight: 600; }
.match button:disabled { cursor: not-allowed; }
.match .winner .team { flex: 3; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; }
.match .winner .draw { flex: 1; font-size: var(--fs-sm); }
.match .team .name { font-size: var(--fs-md); }
.match .margin .label { margin-right: 0; flex: 0 0 auto; }
.match .first button { flex: 0 0 72px; }
.lockmsg { margin: 10px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.tbc { font-size: var(--fs-xs); color: var(--warn); }

.pill { display: inline-block; font-size: var(--fs-xs); font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.pill.ok { background: var(--sel); color: var(--accent); }
.pill.draft { background: #fff1d6; color: #7a4a00; }
.pill.warn { background: #fde4e1; color: var(--danger); }

.primary { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: 10px 16px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.primary.big { width: 100%; padding: 14px; font-size: var(--fs-base); }
.danger { background: none; border: 1px solid var(--danger); color: var(--danger); border-radius: 10px; padding: 9px 14px;
  font: inherit; cursor: pointer; }

.review-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.review-row .pick { text-align: right; font-size: var(--fs-md); max-width: 55%; }
.review-row .status { margin-top: 4px; }
.teams { display: flex; align-items: center; gap: 6px; }
.confirm { margin: 16px 0; }

.card.table { display: table; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; padding: 4px 0; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table th { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.table tr.me td { background: var(--sel); }
.table tr.me.off td { background: none; }  /* your own row's highlight turned off (tap it), as your line on the graph */

.result-head { justify-content: center; gap: 14px; font-size: var(--fs-lg); }
.score { font-size: var(--fs-xl); }
.entries { list-style: none; padding: 0; margin: 10px 0 0; }
.entries li { display: grid; grid-template-columns: 5.5em 1fr 2em 6.2em; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line);
  align-items: center; }
.entries li.me { font-weight: 600; }
.entries .pts { text-align: right; font-weight: 700; }

.login { max-width: 360px; margin: 12vh auto; display: grid; gap: 12px; }
.login h1 { text-align: center; }
label { display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--muted); }
input, select { font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); }
.error { color: var(--danger); margin: 0; }

.admin-match .grid { margin: 10px 0; }
.admin-match .check { display: flex; align-items: center; gap: 6px; }
.admin-match .actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Forms & account */
.form { display: grid; gap: 12px; }
.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.wide { width: 100%; padding: 12px; }
.spaced { margin-top: 18px; }

/* Admin: invites & players */
.invite-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.link-row { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.link-row.fresh { background: var(--sel); margin: 0 -14px; padding: 10px 14px; }
.copy-row { display: flex; gap: 6px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-size: var(--fs-sm); padding: 8px; }
.copy-row .primary, .copy-row .danger { padding: 8px 12px; font-size: var(--fs-sm); }
.users { list-style: none; padding: 0; margin: 0; }
.users li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--line); }
.users li:first-child { border-top: 0; }
.users li.inactive { opacity: .6; }
.users .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* WhatsApp sharing */
.share-row { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 10px; }
.share-row .lockmsg { margin: 0 auto 0 0; }
.wa { display: inline-flex; align-items: center; gap: 6px; background: #25d366; color: #063b1c; font-weight: 600;
  font-size: var(--fs-sm); padding: 7px 12px; border-radius: 999px; text-decoration: none; }
.wa::before { content: "💬"; }
.share-card { text-align: center; }
.share-card h1 { margin: 14px 0 4px; }
.share-card .result-head { margin: 10px 0 4px; }
.crowd { margin: 18px 0; text-align: left; }
.crowd-row { display: grid; grid-template-columns: 7.5em 1fr 2em; gap: 8px; align-items: center; margin: 6px 0; font-size: var(--fs-md); }
.crowd .bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.crowd .bar span { display: block; height: 100%; background: var(--accent); }
.crowd .n { text-align: right; font-weight: 600; }
.center.primary { display: block; text-align: center; }
.wa.sm { font-size: var(--fs-xs); padding: 4px 9px; justify-self: end; }
.match button:disabled:not(.sel) { opacity: .55; }

/* Mates' picks */
.mates { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.mates summary { cursor: pointer; font-size: var(--fs-md); font-weight: 600; color: var(--accent); padding: 4px 0; }
.mates ul { list-style: none; padding: 0; margin: 6px 0 0; }
.mates li { display: grid; grid-template-columns: 6.5em 1fr auto; gap: 8px; align-items: center; padding: 7px 0;
  border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.mates .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mates-note { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); }

/* One-tap lock-in and compact locked-in cards */
.lockin-row { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; }
.lockin-row .primary { padding: 12px 20px; font-size: var(--fs-base); }
.match.compact .meta { margin-bottom: 6px; }
.match .summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.match .summary .v { color: var(--muted); font-size: var(--fs-sm); }
.match .summary .mine { margin-left: auto; font-weight: 600; font-size: var(--fs-md); }
.match { scroll-margin-top: calc(70px + env(safe-area-inset-top) + var(--dev-h, 0px)); }  /* clear the sticky top bar */
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 44px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0;
  font-size: var(--fs-lg); padding: 6px 8px; cursor: pointer; opacity: .7; }
.match .lockin-row button.primary { flex: 0 0 auto; background: var(--accent); color: var(--accent-ink); border: 0;
  font-weight: 700; min-width: 9.5em; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.two input { width: 100%; min-width: 0; }
.warn-card { border-color: var(--warn); background: #fff6e6; color: #5c3b00; }
@media (prefers-color-scheme: dark) { .warn-card { background: #3a2a0c; color: #ffe2a8; } }

/* Pick options (one row of buttons per question) */
.match .dim[data-kind]:not(.winner) { margin-top: 12px; }
.match .dim .label { display: block; font-size: var(--fs-sm); color: var(--muted); margin: 0 0 6px; }
.match .dim .row.opts { margin-top: 0; flex-wrap: wrap; }
.match .dim .row.opts button { flex: 1 1 0; min-width: 3.5em; }

/* Competition bar under the header */
.compbar { max-width: 640px; margin: 0 auto; padding: 8px 12px 0; font-size: var(--fs-sm); color: var(--muted); }
.compbar .compname { font-weight: 600; }
.compswitch { font: inherit; font-weight: 600; padding: 6px 8px; border-radius: 8px; max-width: 100%; }

/* Admin: competition settings */
.opt-row { border-top: 1px solid var(--line); padding: 10px 0; display: grid; gap: 8px; }
.opt-row.off { opacity: .55; }
.opt-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.opt-edit { display: grid; grid-template-columns: minmax(0, 2fr) 5em auto auto auto; gap: 8px; align-items: end; }
.opt-edit input { min-width: 0; width: 100%; }


/* Form grids: let fields shrink to the column instead of pushing the page wider than the phone. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); gap: 10px; align-items: end; }
.grid label, .two label { min-width: 0; }
.grid input, .grid select, .two input, .opt-edit input { width: 100%; min-width: 0; }
.grid input[type=checkbox] { width: auto; }
.grid input[type=color] { height: 42px; padding: 4px; }

.fetch-card { display: grid; gap: 8px; }
.fetch-card p { margin: 0; }
.ok-text { color: var(--accent); font-weight: 600; }

.attention { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.attention a { font-weight: 600; }
.admin-match .actions { flex-wrap: wrap; }

/* Banter */
.social { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; }
.reacts button, .verdicts button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px;
  padding: 3px 8px; font: inherit; font-size: var(--fs-sm); cursor: pointer; min-height: 30px; }
.reacts button.sel, .verdicts button.sel { border-color: var(--accent); background: var(--sel); }
.reacts button .n, .verdicts button .n { font-size: var(--fs-xs); font-weight: 700; margin-left: 2px; }
.reacts.readonly button { cursor: default; }
.verdicts { display: flex; gap: 4px; }
.verdicts button { font-size: var(--fs-xs); }
.entries li .social { padding-top: 2px; }
.callouts { list-style: none; padding: 10px 12px; margin: 10px 0 0; background: var(--sel); border-radius: 10px; display: grid; gap: 6px; font-size: var(--fs-sm); }
.callouts .e { display: inline-block; width: 1.4em; }
.talking ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; font-size: var(--fs-md); }
.talking h2 { margin-bottom: 6px; }
.joker-row { margin-top: 10px; }
.joker { width: 100%; border: 1.5px dashed var(--line); background: none; color: var(--ink); border-radius: 10px; padding: 9px; font: inherit; font-size: var(--fs-md); cursor: pointer; }
.joker.on { border-style: solid; border-color: #7a4a00; background: #fff1d6; color: #5c3b00; font-weight: 600; }
@media (prefers-color-scheme: dark) { .joker.on { background: #3a2a0c; color: #ffe2a8; } }
.joker-status { margin: 0 4px 12px; color: var(--muted); }
.about-me { margin: 8px 0 0; color: var(--muted); }
.mates li { grid-template-columns: 6.5em 1fr auto; }
.verdicts button, .reacts button { white-space: nowrap; }

/* Picks-to-make count and install helper */
.topbar nav .count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35em; height: 1.35em;
  padding: 0 4px; margin-left: 2px; border-radius: 999px; background: #e5484d; color: #fff; font-size: var(--fs-xs); font-weight: 700; }
.install-card { position: relative; border-color: var(--accent); }
.install-card h2 { margin-right: 1.5em; }
.install-card p { margin: 6px 0; }
.install-card .close { position: absolute; top: 8px; right: 10px; color: var(--muted); font-size: var(--fs-base); opacity: 1; }
.deadline p { margin: 4px 0; }
.deadline.closed { border-color: var(--accent); background: var(--sel); }
.mates li.nopick { grid-template-columns: 6.5em 1fr; opacity: .7; }
.match .meta .saved { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); opacity: 0; transition: opacity .2s; flex: 0 0 auto; white-space: nowrap; }
.match .meta .saved[hidden] { display: none; }
.match .meta .saved.show { opacity: 1; }
.copy-row .wa { padding: 8px 10px; font-size: var(--fs-sm); white-space: nowrap; }
.copy-row .wa::before { content: ""; }
.warn-text { color: var(--warn); }
#reminders .primary, #reminders .secondary { justify-self: start; }
/* Tournament picks wear the same frame as a game card: padding, outline, and the green ▸/▾ arrow. */
details.bonus, .bonus-done { padding: 10px 12px; }
details.bonus > summary { cursor: pointer; list-style: none; }
details.bonus > summary::-webkit-details-marker { display: none; }
details.bonus > summary::marker { content: ""; }
details.bonus > summary::before { content: "▸ "; color: var(--accent); font-size: var(--fs-xl); font-weight: 700; line-height: 1;
  vertical-align: -2px; }
details.bonus[open] > summary::before { content: "▾ "; }
details.bonus[open] > summary { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.bonus-q { padding: 10px 0; border-top: 1px solid var(--line); }
.bonus-q:first-of-type { margin-top: 8px; }
.bonus-q label { display: grid; gap: 6px; color: var(--ink); font-size: var(--fs-md); }
.bonus-q select { width: 100%; }
.bonus-q p { margin: 4px 0 0; }
.bonus-mine { font-weight: 600; }
.ticks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ticks .check { display: flex; align-items: center; gap: 4px; color: var(--ink); font-size: var(--fs-sm); }
.table td.pos { white-space: nowrap; }
.move { font-size: var(--fs-xs); font-weight: 700; margin-left: 3px; }
.move.up { color: var(--accent); }
.move.down { color: var(--danger); }
.scroll-x { overflow-x: auto; padding: 4px 0; }
.table.rounds th, .table.rounds td { white-space: nowrap; }
/* Invite/reset link rows: the link on its own line, buttons underneath, so it fits a phone. */
.copy-row { flex-wrap: wrap; }
.copy-row input { flex: 1 1 100%; }
.tabs { max-width: 100%; }
main { overflow-x: hidden; }

/* Player profile */
.plink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.profile h1 { margin: 0 0 10px; }
.profile .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.profile .stats div { background: var(--sel); border-radius: 10px; padding: 8px 4px; display: grid; }
.profile .stats strong { font-size: var(--fs-xl); }
.profile .stats span { font-size: var(--fs-xs); color: var(--muted); }
.profile .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.profile .actions .secondary { text-decoration: none; }
.round summary { cursor: pointer; }
.hist { border-top: 1px solid var(--line); padding: 10px 0; }
.hist-head { display: flex; align-items: center; gap: 6px; }
.hist-pts { margin-left: auto; font-weight: 700; }
.hist-lines { width: 100%; font-size: var(--fs-sm); margin-top: 6px; border-collapse: collapse; }
.hist-lines td { padding: 3px 4px 3px 0; vertical-align: top; }
.hist-lines td.res { text-align: right; white-space: nowrap; }

.match .pending p { margin: 4px 0; }

/* Feedback */
.feedback-link { text-align: center; font-size: var(--fs-sm); margin: 18px 0 4px; }
.feedback-link a { color: var(--muted); }
textarea { font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); width: 100%; }
.stars { display: flex; gap: 4px; }
.star input { position: absolute; opacity: 0; }
.star span { font-size: var(--fs-xxl); color: var(--line); cursor: pointer; }
.stars:has(.star:nth-child(1) input:checked) .star:nth-child(-n+1) span,
.stars:has(.star:nth-child(2) input:checked) .star:nth-child(-n+2) span,
.stars:has(.star:nth-child(3) input:checked) .star:nth-child(-n+3) span,
.stars:has(.star:nth-child(4) input:checked) .star:nth-child(-n+4) span,
.stars:has(.star:nth-child(5) input:checked) .star:nth-child(-n+5) span { color: #f5a623; }
.fb p { margin: 6px 0; white-space: pre-wrap; }
.fb-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.fb.done { opacity: .55; }

.match .ptlabel { display: block; font-size: var(--fs-sm); color: var(--muted); margin: 0 0 6px; }
.pts-tag { font-weight: 600; color: var(--accent); }

/* Picks list, overview */
.round-head { margin: 22px 4px 8px; font-size: var(--fs-lg); }
.round-head .small { font-weight: 400; }
.progress .primary { margin-top: 6px; }
.match.pendingcard, .match.waiting { opacity: .6; }  /* teams not known / round not open yet: greyed */
.overview h1 { margin: 0 0 4px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 12px 0; }
.profile-stats div { background: var(--sel); border-radius: 10px; padding: 8px 4px; display: grid; }
.profile-stats strong { font-size: var(--fs-xl); }
.profile-stats span { font-size: var(--fs-xs); color: var(--muted); }
.sched td { padding: 8px 4px; border-top: 1px solid var(--line); }

/* Fixed to the phone screen: no pinch / double-tap zoom, and no auto-zoom when a text box is tapped
   (iPhone zooms into inputs with text smaller than 16px). */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-x: none; }
button, a, select, label { touch-action: manipulation; }
input, select, textarea { font-size: 16px !important; }

/* Home: tournaments and R/A/G game outlines (same scheme as Centsible) */
:root { --rag-red: #c8453a; --rag-red-soft: #fbe9e7; --rag-amber: #e39b1b; --rag-amber-soft: #fdf1dc;
        --rag-green: #1f9d63; --rag-green-soft: #e3f5ec; --rag-grey: #b6bcc6; }
.tourney > summary { cursor: pointer; list-style: none; }
.tourney > summary::-webkit-details-marker { display: none; }
.tourney-head { display: grid; gap: 6px; }
.tourney-name { font-size: var(--fs-lg); font-weight: 700; }
.tourney-name::before { content: "▸ "; color: var(--muted); }
.tourney[open] .tourney-name::before { content: "▾ "; }
.rag { display: flex; flex-wrap: wrap; gap: 4px; }
.pill.rag-red { background: var(--rag-red-soft); color: var(--rag-red); }
.pill.rag-amber { background: var(--rag-amber-soft); color: #8f5a00; }
.pill.rag-grey { background: #eef0f3; color: #5d6470; }
.pill.rag-green { background: var(--rag-green-soft); color: #136b43; }
.legend { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-left: 2px; }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 3px solid; vertical-align: -1px; }
.key.red { border-color: var(--rag-red); } .key.amber { border-color: var(--rag-amber); }
.key.green { border-color: var(--rag-green); } .key.grey { border-color: var(--rag-grey); }
details.match, details.bonus, details.tourney { border-width: 2px; border-left-width: 6px; }
details.match { padding: 10px 12px; }
details.status-red { border-color: var(--rag-red); }
details.status-amber { border-color: var(--rag-amber); }
details.status-green { border-color: var(--rag-green); }
details.status-grey { border-color: var(--rag-grey); }
details.match.finished { border-color: #3b7dd8; }  /* played: result in, points awarded */
.key.blue { border-color: #3b7dd8; }
.review-row.status-amber { border-left: 6px solid var(--rag-amber); }
details.match > summary { list-style: none; cursor: pointer; }
details.match > summary::-webkit-details-marker { display: none; }
details.match > summary::marker, .tourney > summary::marker { content: ""; }
/* Every game card has the same three lines: when · where + status, the teams, then your pick (centred). */
.game-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.game-head .meta { margin-bottom: 0 !important; display: flex; gap: 8px; align-items: center; }
.game-head .meta::before { content: "▸"; flex: 0 0 auto; color: var(--accent); font-size: var(--fs-xl); font-weight: 700; line-height: 1; }
details.match[open] > .game-head .meta::before { content: "▾"; }
.game-head .meta .when { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-head .meta .state { flex: 0 0 auto; white-space: nowrap; }
.game-head .meta .state .pill { white-space: nowrap; }
.game-line { display: flex; align-items: center; justify-content: center; gap: 8px; }
.game-line.tbd { display: block; font-weight: 600; color: var(--muted); text-align: center; }
.game-head .mine { text-align: center; font-weight: 600; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }  /* one line */
.game-head .stage { text-align: center; margin-top: -4px; }
.game-line .ft { font-size: var(--fs-lg); min-width: 4.2em; text-align: center; }
.game-head .my-pts { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px; font-size: var(--fs-sm);
  background: var(--rag-green-soft); color: #136b43; font-weight: 700; }
.game-head .my-pts.zero { background: #eef0f3; color: #5d6470; }
/* Locked and played games: a light dim (with the grey outline) so they sit back, but stay easy to read. */
details.match.locked { opacity: .85; }
details.match.status-grey .game-line { opacity: 1; }
/* Points and status pills in dark mode: dark tints instead of near-white, so they don't glare. */
@media (prefers-color-scheme: dark) {
  .game-head .my-pts, .pill.rag-green { background: #1d3b2b; color: #7fd3a6; }
  .game-head .my-pts.zero, .pill.rag-grey { background: #2a312d; color: #b3bbb6; }
  .pill.rag-red { background: #3d201d; color: #f09a90; }
  .pill.rag-amber { background: #3a2c12; color: #f2c46d; }
}
.game-head .mine.empty { color: var(--muted); font-weight: 500; }
.tourney-sub { font-size: var(--fs-md); color: var(--muted); line-height: 1.45; }
.txt-red { color: var(--rag-red); font-weight: 600; } .txt-green { color: #136b43; font-weight: 600; }
details.match[open] > summary { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.commit-row { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; }
.commit-row .primary { padding: 12px 20px; font-size: var(--fs-base); }
.match .commit-row button.primary { flex: 0 0 auto; background: var(--rag-green); color: #fff; border: 0; font-weight: 700; }
.tourney .round-head { font-size: var(--fs-base); margin: 18px 2px 8px; }
.history .hist-row { padding: 8px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }

/* Everyone's picks once a game locks: fits a phone, no sideways scroll. */
.tally { margin: 8px 0 4px; color: var(--muted); }
.picktable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); table-layout: fixed; }
.picktable th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  font-weight: 600; padding: 4px 4px 4px 0; }
.picktable td { padding: 7px 4px 7px 0; border-top: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
/* Player, then Win · Spread · Tries · Pts evenly spaced and centred (headers over their values), then 💬. */
.picktable th:nth-child(1) { width: 32%; }
.picktable th:nth-child(2) { width: 15%; } .picktable th:nth-child(3) { width: 20%; }
.picktable th:nth-child(4) { width: 15%; } .picktable th.pts { width: 18%; }
.picktable thead th { font-size: .66rem; }
.picktable td.who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picktable th { letter-spacing: 0; }
.picktable th:not(:first-child), .picktable td:not(:first-child) { text-align: center; padding-left: 0; padding-right: 0; }
.picktable td.pts, .picktable th.pts { text-align: center; white-space: nowrap; }
.picktable .pts { text-align: right; font-weight: 700; padding-right: 8px; }
.picktable .who { font-weight: 600; }
.picktable tr.me td { background: var(--sel); }  /* same as your row on the Table; readable in light and dark */
.picktable tr.auto td:not(.who) { color: var(--muted); }
.picktable .c { text-align: center; }


/* Table page: league position after each round. */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); }
/* position chart: everyone a light grey line; yours green; the one you tap blue, on top */
.chart { --ln: #c7cec9; }
@media (prefers-color-scheme: dark) { .chart { --ln: #46514a; } }
.chart .pl { cursor: pointer; }
.chart .pl .hit { fill: none; stroke: transparent; stroke-width: 12; }
.chart .pl .ln { fill: none; stroke: var(--ln); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pl .dot { display: none; }
.chart .pl .ini { font-size: 8px; font-weight: 800; fill: #fff; pointer-events: none; }
.chart .pl .ring { fill: none; stroke: var(--card); stroke-width: 1.5; }
.chart .pl.me .ln { stroke: #1f9d63; stroke-width: 3; }
.chart .pl.me .dot { display: inline; fill: #1f9d63; }
.chart .pl.me .ring { stroke: #1f9d63; stroke-width: 2.5; }
.chart .pl.sel .ln { stroke: var(--sel, #2f6fd6); stroke-width: 3; }
.chart .pl.sel .dot { display: inline; fill: var(--sel, #2f6fd6); }
.chart .pl.sel .ring { stroke: var(--sel, #2f6fd6); stroke-width: 2.5; }
.chart-note { margin: 4px 0 0; }
.table-panel tr.sel td { background: rgba(47, 111, 214, .12); }
.table-panel tr.sel td:first-child { box-shadow: inset 4px 0 0 var(--sel, #2f6fd6); }  /* the colour of their line */

/* Player page (from the Table): only the games that scored. */
.back-link { display: inline-block; margin: 2px 0 10px; font-weight: 600; text-decoration: none; color: var(--accent); padding: 6px 0; }
.profile-head { display: flex; align-items: center; gap: 12px; }
.profile-who { flex: 1; min-width: 0; }
.profile-head h1 { margin: 0; font-size: var(--fs-xl); line-height: 1.15; }
.profile-hero { padding: 4px 2px 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.avatar.hero { width: 56px; height: 56px; font-size: var(--fs-xl); }
.scored-round h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-base); margin: 0 0 4px; }
.round-pts { font-size: var(--fs-md); color: #136b43; }
.scored { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 9px 0;
  border-top: 1px solid var(--line); }
.scored-game { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.scored-pick { grid-column: 1 / -1; font-size: var(--fs-sm); }
.scored-why { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--muted); }
.scored-pts { font-weight: 800; color: #136b43; font-size: var(--fs-base); }

/* Avatars: a photo, or initials on the player's own colour. The top-right one opens My settings. */
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: var(--fs-sm); letter-spacing: .02em; }
.avatar.initials { background: hsl(var(--hue) 45% 42%); color: #fff; }
.avatar.big { width: 84px; height: 84px; font-size: var(--fs-xxl); }
.me-btn { display: flex; margin-left: auto; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.55); text-decoration: none; }
.me-btn.on { box-shadow: 0 0 0 3px #fff; }
.photo-row { display: flex; gap: 16px; align-items: center; }
.photo-actions { display: grid; gap: 6px; justify-items: start; }
.photo-actions form { margin: 0; }
.file-btn { display: inline-block; cursor: pointer; }
.readonly-value { margin: -6px 0 0; font-weight: 600; word-break: break-all; }

/* Admin: game cards collapse like Home's (same three lines, arrow and R/A/G outline). */
details.admin-game { border-width: 2px; border-left-width: 6px; padding: 10px 12px; scroll-margin-top: calc(70px + env(safe-area-inset-top) + var(--dev-h, 0px)); }
details.admin-game > summary { list-style: none; cursor: pointer; }
details.admin-game > summary::-webkit-details-marker { display: none; }
details.admin-game > summary::marker { content: ""; }
details.admin-game[open] > summary { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
details.admin-game[open] > .game-head .meta::before { content: "▾"; }
.admin-game .meta { font-size: var(--fs-sm); color: var(--muted); }
.admin-game .game-line .score { font-size: var(--fs-lg); }

/* Tournament picks: once all are in, the header carries them on one line; after the lock that's all there is. */
.bonus-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bonus-lines { display: grid; gap: 0; margin-top: 8px; }
.bonus-lines[hidden] { display: none; }
.bonus-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0;
  border-top: 1px solid var(--line); font-size: var(--fs-md); }
.bl-label { color: var(--muted); }
.bl-pick { text-align: right; }
.bonus-done { display: block; border-width: 2px; border-left-width: 6px; }
.bonus-done.status-grey { border-color: var(--rag-grey); }

/* Table page: each tournament's table sits inside its collapsible panel. */
.table-panel .table { margin-top: 4px; }
.table-panel .chart { margin: 4px -10px 0; }  /* nearly the card's full width */
.history .table-panel { margin: 10px 0 0; box-shadow: none; }

/* "?" help in a tournament panel's top-right corner; opens a small pop-over. */
details.tourney { position: relative; }
.help { position: absolute; top: 12px; right: 12px; z-index: 3; }
.help > summary { list-style: none; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-md); color: var(--muted);
  border: 1.5px solid var(--line); background: var(--card); }
.help > summary::-webkit-details-marker { display: none; }
.help > summary::marker { content: ""; }
.help[open] > summary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.help-pop { position: absolute; right: 0; top: 34px; width: min(290px, 80vw); background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.help-pop p { margin: 0 0 8px; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legend-list .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border-width: 3px; border-style: solid; margin-right: 8px;
  vertical-align: -1px; }
.tourney:not([open]) .help { display: none; }
.tourney-head .tourney-name { padding-right: 36px; }  /* room for the "?" */

/* Player page: position, points and games played as three figures under the name. */
.profile-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.profile-figures div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; display: grid; gap: 2px; }
.profile-figures strong { font-size: var(--fs-xl); line-height: 1.1; }
.profile-figures span { font-size: var(--fs-xs); color: var(--muted); }
/* Open tournament panel: a clear gap between its header lines and what's inside. */
details.tourney[open] > .tourney-head { margin-bottom: 14px; }

/* Admin invite: one big WhatsApp button; the fine-tuning tucked away. */
.invite-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.wa.big { font-size: var(--fs-base); padding: 12px 18px; }
.more-options summary { cursor: pointer; color: var(--muted); margin: 6px 0; }
.more-options .invite-form { margin-top: 8px; }
/* "You're in" page after signing up */
.start h2 { margin-top: 14px; }
.start h3 { font-size: var(--fs-base); margin: 14px 0 4px; }
.start ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; font-size: var(--fs-md); }
.start p { margin: 6px 0; }

/* Scoring help inside a "?" pop-over */
.help-pop { max-height: 70vh; overflow-y: auto; }
.help-h { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px; }
.help-list { list-style: none; margin: 0; padding: 0; }
.help-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.help-list strong { text-align: right; }
.help-notes { margin: 6px 0 0; padding-left: 1.1em; display: grid; gap: 4px; }
.danger-text { color: var(--danger); }

/* Pull-to-refresh hint (Home Screen app only), sliding down under the top bar. */
.ptr { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top) + var(--dev-h, 0px)); z-index: 4; transform: translate(-50%, -44px);
  padding: 9px 18px; border-radius: 999px; background: var(--accent); border: 2px solid #fff; color: #fff;
  font-size: var(--fs-md); font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.35); opacity: 0; pointer-events: none;
  transition: opacity .15s, background .15s; white-space: nowrap; }
.ptr.show { opacity: 1; }
.ptr.ready { background: #f5a623; color: #1b241d; border-color: #fff; }  /* amber: let go now */


/* Admin: tournaments */
.t-head { margin: 4px 0 8px; }
.t-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-lg); margin: 0 0 8px; }
.tabs.sub a { font-size: var(--fs-sm); padding: 6px 12px; }
.t-row { display: grid; gap: 4px; color: inherit; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; gap: 8px; align-items: baseline; }
.checks .tick { flex: 0 0 auto; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.actions-row .secondary { text-decoration: none; }
.draft-tag { justify-self: start; font-size: var(--fs-xs); }

/* New competition: format choice */
.format { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 10px; margin: 0; }
.format legend { font-size: var(--fs-sm); color: var(--muted); padding: 0 4px; }
.format .check { align-items: flex-start; color: var(--ink); font-size: var(--fs-md); }
.format input { margin-top: 3px; }

/* Admin: who has picked so far */
.progress-card > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.progress-table td, .progress-table th { padding: 7px 6px; }
.progress-table tr.done td { color: var(--muted); }
.progress-card .wa { margin-top: 8px; }
.new-comp > summary { cursor: pointer; font-size: var(--fs-lg); }
.new-comp[open] > summary { margin-bottom: 12px; }
.format label.check { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; }
.format label.check input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; }
.install-steps { margin: 6px 0; padding-left: 1.3em; display: grid; gap: 4px; }
.install-card [data-install-now] { margin: 6px 0 4px; }

/* Player page: how each game's points came */
.scored-why .ok { color: #136b43; font-weight: 600; }
@media (prefers-color-scheme: dark) { .scored-why .ok { color: #7fd3a6; } }
/* Same as the picks table: what scored in a green pill, what missed as plain text. */
.scored-pick .hit { background: var(--rag-green-soft); color: #136b43; font-weight: 700; border-radius: 4px; padding: 0 3px; }
@media (prefers-color-scheme: dark) { .scored-pick .hit { background: #1d3b2b; color: #7fd3a6; } }
.picktable .hit { background: var(--rag-green-soft); color: #136b43; font-weight: 700; border-radius: 4px; padding: 0 3px; }
@media (prefers-color-scheme: dark) { .picktable .hit { background: #1d3b2b; color: #7fd3a6; } }
.picktable tr.me .hit { background: var(--card); box-shadow: inset 0 0 0 1.5px currentColor; }  /* stands out on your own (green) row */

/* Played game: who scored and the cards */
.scoresheet { margin: 4px 0 10px; display: grid; gap: 4px; }
.scoresheet p { margin: 0; line-height: 1.45; }
.scoresheet strong { display: inline-block; min-width: 2.8em; }
.scoresheet .sk { font-weight: 800; color: var(--muted); }

/* Press and hold a row to share it: no text selection or iPhone pop-up, and the row fills while you hold. */
[data-wa] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* the fill: a bar across the pressed panel at the held part's height, growing over the hold (HOLD_MS in app.js) */
.hold-bar { position: fixed; z-index: 50; pointer-events: none; border-radius: 10px;
  background-image: linear-gradient(90deg, rgba(37,211,102,.32), rgba(37,211,102,.32));
  background-repeat: no-repeat; background-size: 0% 100%; transition-property: background-size; transition-timing-function: linear; }
.hold-bar.go { background-size: 100% 100%; }
.share-hint { margin: 6px 0 2px; }
/* Points right-aligned so they line up; the Joker / 🔥 sits just to their left */
.picktable td.pts, .picktable th.pts { text-align: right; padding-right: 10px; }
.picktable .pts-mark { display: inline-block; min-width: 1.4em; text-align: left; font-weight: 400; }

/* Game card, locked/played: your pick as evenly spaced columns, like the picks table */
.mine-cols { display: grid; grid-template-columns: 1.4em 1fr 1fr 1.3fr 1.5fr; align-items: center; justify-items: center;
  gap: 4px; font-weight: 700; font-size: var(--fs-md); }
.mine-cols .mc-pts { justify-self: end; white-space: nowrap; }
.mine-cols .mc { white-space: nowrap; }
.mine-cols .hit { background: var(--rag-green-soft); color: #136b43; border-radius: 4px; padding: 0 4px; }
@media (prefers-color-scheme: dark) { .mine-cols .hit { background: #1d3b2b; color: #7fd3a6; } }

/* The dev copy's strip */
.dev-strip { position: sticky; top: 0; z-index: 7; background: #e39b1b; color: #1b241d; text-align: center;
  font-weight: 800; font-size: var(--fs-sm); padding: calc(4px + env(safe-area-inset-top)) 8px 4px; }
.dev-strip.prod { background: #1f9d63; color: #fff; }  /* dev matches live */
.dev-strip form { display: inline; margin: 0 0 0 6px; }
.dev-strip button { font: inherit; font-weight: 700; border: 1px solid currentColor; background: none; color: inherit;
  border-radius: 999px; padding: 0 8px; cursor: pointer; }
/* dev copy, logged in: the strip and the top bar stick as one block (the bar no longer pads for the notch) */
.dev-top { position: sticky; top: 0; z-index: 7; padding-top: env(safe-area-inset-top); background: #e39b1b; }
.dev-top:has(.dev-strip.prod) { background: #1f9d63; }
.dev-top .dev-strip { position: static; padding-top: 4px; }
.dev-top .topbar { position: static; padding-top: 10px; }
/* the strip is always one line: text shortened with … if it can't fit, the button beside it */
.dev-strip { display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.dev-strip .dev-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dev-strip form.dev-push { display: inline; flex: none; }
.dev-strip form.dev-push button { padding: 0 10px; white-space: nowrap; }
/* push to live in progress: a fill grows across a dark band (like AirKeeper's refresh strip), dark to light */
.dev-strip.pushing { background: #2a3142; padding-left: 0; padding-right: 0; }
.dev-strip .dev-progress { position: relative; display: flex; justify-content: space-between; gap: 8px; flex: 1; margin: -4px 0;
  padding: 4px 12px; background: #2a3142; color: #cfd6e4; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; text-align: left; }
.dev-strip .dev-progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; transition: width 1.8s linear;
  background: linear-gradient(90deg, #2a3142, #8796bd) 0 0/100vw 100% no-repeat; }
.dev-strip .dev-progress span { position: relative; }
.dev-strip .dev-progress .pct { color: #fff; font-weight: 800; }
/* press-and-hold list of changes not live yet: a card dropping down under the strip */
.dev-strip[data-hold-changes] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dev-strip.holding { filter: brightness(.88); }
.dev-changes { position: fixed; z-index: 8; left: 8px; right: 8px; max-width: 560px; margin: 0 auto;
  top: calc(env(safe-area-inset-top) + var(--dev-h, 30px) + 6px); max-height: 70vh; overflow: auto;
  background: var(--card, #fff); color: inherit; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.3); font-size: var(--fs-sm); }
.dev-changes-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dev-changes-x { border: 0; background: none; font-size: 1.2em; color: inherit; cursor: pointer; }
.dev-changes ol { margin: 8px 0 0; padding-left: 1.4em; }
.dev-changes li { margin: 5px 0; }
.dev-changes p { margin: 8px 0 0; }
/* table number columns: centred, tight, with small word headers (Games · Correct · Perfect · Pts / Wins) */
.table th.num, .table td.num { text-align: center; padding-left: 3px; padding-right: 3px; }
.table th.num { font-size: var(--fs-xs); line-height: 1.15; vertical-align: bottom; }
/* competition table: one line per player (first names, as elsewhere); a name too long for a small phone ends in … */
.table-panel .table th, .table-panel .table td { padding-left: 3px; padding-right: 3px; }
.table-panel .table { width: 100%; }
.table-panel .table td.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 100%; }
.table-panel .table th { vertical-align: bottom; }
/* chart heading with the "All games" button; the full-screen, sideways view of every game */
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chart-expand { font: inherit; font-size: var(--fs-sm); font-weight: 700; border: 1px solid var(--line); background: var(--card);
  color: inherit; border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.chart .divider { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-full { position: fixed; inset: 0; z-index: 30; background: var(--card); }
.chart-full-inner { position: absolute; inset: 0; display: flex; flex-direction: column; box-sizing: border-box;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
/* Held upright: ask for the phone to be turned (the chart shows once it is). Android's installed app can't turn (it's
   kept upright, manifest orientation), so there the chart is drawn sideways instead (html.no-turn, set in app.js). */
.chart-full-turn { display: none; }
@media (orientation: portrait) {
  html:not(.no-turn) .chart-full-inner { display: none; }
  html:not(.no-turn) .chart-full-turn { display: flex; position: absolute; inset: 0; flex-direction: column;
    align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px;
    font-size: var(--fs-xl); font-weight: 700; line-height: 1.4; color: var(--ink); }
  html:not(.no-turn) .chart-full-turn .big { font-size: 64px; line-height: 1; }
  html:not(.no-turn) .chart-full-turn .chart-full-x { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; }
  html.no-turn .chart-full-inner { inset: auto; top: 50%; left: 50%; width: 100vh; height: 100vw; width: 100dvh;
    transform: translate(-50%, -50%) rotate(90deg); }
}
.chart-full-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chart-full-x { font-size: 1.3em; border: 0; background: none; color: inherit; cursor: pointer; padding: 2px 8px; }
.chart-full .chart { flex: 1; min-height: 0; margin: 0; }
.chart-full .chart svg { width: 100%; height: 100%; }
.chart-head { align-items: center; margin-bottom: 4px; }
.chart-head .chart-round { font-size: var(--fs-sm); color: var(--muted); }
/* Picks: each round folds (played / not open yet start folded; the current round open) */
details.round > summary { cursor: pointer; list-style: none; }
details.round > summary::-webkit-details-marker { display: none; }
details.round > summary::before { content: "▸ "; color: var(--muted); }
details.round[open] > summary::before { content: "▾ "; }
details.round:not([open]) > summary { margin-bottom: 4px; }
details.round > summary.round-head { font-weight: 700; }
details.round > summary .round-sub { display: block; font-weight: 400; margin: 2px 0 0 1.1em; }  /* under the round name */
/* a player's page: five figures, like a table row (place · games · correct · perfect · points) */
.profile-figures.five { grid-template-columns: 1fr 1fr 1fr 1fr 1fr; gap: 6px; }
.profile-figures.five strong { font-size: var(--fs-lg); }
.profile-figures.five strong small { font-size: .6em; font-weight: 700; }
.profile-figures.five span { font-size: var(--fs-xs); line-height: 1.15; }
.tourney .profile-figures.five { margin: 4px 0 12px; }
.profile-hero.slim { border-bottom: 0; padding-bottom: 4px; margin-bottom: 8px; }
/* the parts of a pick that scored: a faint green line round each box, as well as the shading */
.scored-pick .hit, .picktable .hit, .mine-cols .hit { box-shadow: inset 0 0 0 1px rgba(31, 157, 99, .35); }
/* Upright only: on a phone held sideways, cover the app and ask for it upright — except the full-screen chart of
   every game, which is meant to be read sideways. (Android installs also keep it upright: manifest orientation.) */
.turn-upright { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  body:not(.chart-open) .turn-upright { display: flex; position: fixed; inset: 0; z-index: 50; align-items: center;
    justify-content: center; text-align: center; background: var(--bg); color: var(--ink); font-size: var(--fs-xl);
    font-weight: 700; line-height: 1.6; }
}
/* round picker above the chart: a chip per round so far, then ⤢ All */
.chart-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.chart-picker button { font: inherit; font-size: var(--fs-sm); font-weight: 700; border: 1px solid var(--line); background: var(--card);
  color: inherit; border-radius: 999px; padding: 3px 11px; cursor: pointer; white-space: nowrap; }
.chart-picker button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.round-chart .chart-round { margin: 0 0 4px; }
.chart .axis.up { opacity: .4; }           /* games still to come */
.chart .pl .tail { stroke: var(--ln); stroke-width: 1.5; stroke-dasharray: 2 4; }
.chart .pl.me .tail { stroke: #1f9d63; stroke-width: 2; }
.chart .pl.sel .tail { stroke: var(--sel, #2f6fd6); stroke-width: 2; }
.chart .tick { stroke: var(--muted); stroke-width: 1; }
.chart .tick.up { opacity: .35; }
.chart rect.col { fill: transparent; cursor: pointer; }
.chart rect.col.on { fill: rgba(47, 111, 214, .12); }
.chart-full-head .col-name { flex: 1; text-align: center; font-size: var(--fs-sm); font-weight: 700; color: #2f6fd6; }
.chart-full .chart svg { overflow: visible; }
/* a game being played: the score so far, and a red "● In play · 54'" (the outline stays grey till full time) */
.pill.live { color: #c8453a; }
.game-line .ft.live { color: var(--ink); }
/* in play: what would score if it ended now — red, with a red line round each box (green once it's final) */
.picktable.live .hit, .match[data-minute] .mine-cols .hit { background: var(--rag-red-soft); color: #a3342b;
  box-shadow: inset 0 0 0 1px rgba(200, 69, 58, .45); }
@media (prefers-color-scheme: dark) {
  .picktable.live .hit, .match[data-minute] .mine-cols .hit { background: #3d1f1c; color: #f0a39b; box-shadow: inset 0 0 0 1px rgba(240, 120, 110, .5); }
}
.picktable.live .pts { color: #c8453a; }
/* the round's Joker still to play: amber, like a part-picked game */
.pill.joker-todo { background: var(--rag-amber-soft); color: #8f5a00; font-size: var(--fs-xs); font-weight: 700; margin-left: 4px;
  vertical-align: middle; }
@media (prefers-color-scheme: dark) { .pill.joker-todo { background: #3a2a0c; color: #ffcf7a; } }
.txt-amber { color: #b26a00; font-weight: 600; }
@media (prefers-color-scheme: dark) { .txt-amber { color: #ffcf7a; } }
.tourney .tourney-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }  /* one line */
/* form guide on a game still to pick: W green, L red, D grey, latest first */
details.formguide { background: var(--bg); border-radius: 10px; padding: 6px 10px; margin: 4px 0 10px; font-size: var(--fs-sm); }
details.formguide > summary { list-style: none; cursor: pointer; }
details.formguide > summary::-webkit-details-marker { display: none; }
.formguide .fl-line { display: flex; justify-content: center; gap: 40px; }  /* room between the two teams */
.formguide .fl-title { display: none; font-weight: 700; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
.formguide[open] .fl-line { display: none; }
.formguide[open] .fl-title { display: block; margin-bottom: 4px; }
.formguide .fg { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; letter-spacing: .3em; margin-left: 4px; }
.formguide .W { color: #1f9d63; } .formguide .L { color: #c8453a; } .formguide .D { color: #8a929c; }
.formguide .fteam { display: grid; grid-template-columns: 40px repeat(5, 1fr); align-items: start; margin: 4px 0 8px; text-align: center; }
.formguide .fteam .nm { font-weight: 800; text-align: left; padding-top: 2px; }
.formguide .g .res { font-weight: 800; font-size: 1.15em; line-height: 1.2; }
.formguide .g .opp { font-size: var(--fs-xs); color: var(--muted); }
.formguide .g .sc { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
/* a small ▸ / ▾ so it's clear the form line opens and closes */
details.formguide > summary { position: relative; }
details.formguide > summary::before { content: "▸"; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: .8em; }
details.formguide[open] > summary::before { content: "▾"; top: .7em; }
details.formguide > summary .fl-title { padding-left: 1.1em; }
/* a game in play: on the chart, a dotted line from each player's real place to where they'd be if it ended now */
.chart .live-seg { stroke: #c8453a; stroke-width: 2; stroke-dasharray: 3 3; }
.chart .pl:not(.me):not(.sel) .live-seg { stroke-opacity: .45; stroke-width: 1.5; }
.chart .live-dot { fill: var(--card); stroke: #c8453a; stroke-width: 2; }
.chart .pl:not(.me):not(.sel) .live-dot { stroke-opacity: .5; }
/* the game being played, score by score: provisional, so every line is dotted */
.chart-picker .live-pick { color: #c8453a; }
.chart-picker .live-pick.on { background: #c8453a; color: #fff; border-color: #c8453a; }
.moments .chart .pl .ln { stroke-dasharray: 3 3; }
/* the in-game chart's "now": where the game is up to */
.chart .now { stroke: #c8453a; stroke-width: 1.5; stroke-dasharray: 2 3; }
.chart .now-label { font-size: 10px; font-weight: 800; fill: #c8453a; }
.chart .axis.score-mark { fill: #2f6fd6; font-weight: 700; }  /* in-game chart: when each score came */
.chart rect.col.game { cursor: pointer; }
/* labels, grid and marks let taps through to the game column behind them (tap a game's name to open it) */
.chart text.axis, .chart .tick, .chart .grid, .chart .divider, .chart .now, .chart .now-label { pointer-events: none; }
.round-chart.moments .chart .pl .ln, .game-chart-body.moments .chart .pl .ln { stroke-dasharray: 3 3; }

/* Settings: an iOS-style on/off switch, label on the left, saved as soon as it's flipped (Oldfarts) */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-row label { font-size: var(--fs-lg); font-weight: 600; color: var(--ink); margin: 0; flex: 1; cursor: pointer; }
.toggle-row + p { margin: 6px 0 0; }
.toggle { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 51px; height: 31px;
  margin: 0; border-radius: 16px; background: #e9e9ea; cursor: pointer; transition: background .25s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .25s; }
.toggle:checked { background: #34c759; }
.toggle:checked::after { transform: translateX(20px); }
.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hold a card's header (0.7 s) to share it as a picture: no text selection or iPhone pop-up */
details.match > summary.game-head, details.table-panel > summary.tourney-head { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }


/* Share menu, like iOS's long-press menu: the picture lifted over a blurred page, a "Share to WhatsApp" row under it */
.ios-menu { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) 24px calc(20px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); transition: all .22s ease; }
.ios-menu.up { background: rgba(0,0,0,.28); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.ios-lift { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 360px;
  transform: scale(.92); opacity: 0; transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .18s; }
.ios-menu.up .ios-lift { transform: none; opacity: 1; }
.ios-preview { display: flex; justify-content: center; min-height: 140px; align-items: center; }
.ios-preview img { max-width: 100%; max-height: 62vh; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); display: block; }
.ios-wait { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.5);
  border-top-color: #fff; animation: ios-spin .8s linear infinite; }
@keyframes ios-spin { to { transform: rotate(360deg); } }
.ios-rows { width: var(--pic-w, 100%); max-width: 100%; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.ios-rows .ios-row { border-radius: 0; box-shadow: none; max-width: none; }
.ios-rows .ios-row + .ios-row { border-top: .5px solid rgba(60,60,67,.3); }
.ios-row { display: flex; align-items: center; gap: 16px; width: 100%; max-width: 300px; align-self: stretch; margin: 0 auto;
  padding: 15px 20px; border: 0; border-radius: 14px; text-align: left; font: 17px -apple-system, system-ui, sans-serif;
  color: #000; background: rgba(242,242,247,.86); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.ios-row:disabled { color: rgba(0,0,0,.5); }
.ios-row .ic { display: flex; width: 22px; height: 22px; flex: none; }
.ios-row .ic svg { width: 22px; height: 22px; }
@media (prefers-color-scheme: dark) {
  .ios-row { color: #fff; background: rgba(44,44,46,.82); }
  .ios-row:disabled { color: rgba(255,255,255,.5); }
}

/* Hold a line graph on the Table (0.7 s) to share it as a picture: no iPhone "save image" pop-up or text selection */
.round-chart [data-chart], .chart-full [data-chart] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* your own line turned off: grey like everyone else's */
.chart .pl.me.off .ln, .chart .pl.me.off .tail { stroke: var(--ln); stroke-width: 1.5; }
.chart .pl.me.off .dot { display: none; }
.chart .pl.me.off .ring { stroke: var(--card); stroke-width: 1.5; }
/* no grey iPhone tap flash on the graphs */
.chart svg, .chart svg * { -webkit-tap-highlight-color: transparent; }
