/* Phone first. Bigger screens get two panes and the tabs move to the header (see the 900px block at the end). */
:root {
  --bg: #0c0e0d;
  --panel: #161918;
  --panel-2: #1f2321;
  --line: #262a28;
  --ink: #eef0ec;
  --muted: #a4aba6;
  --faint: #7d847f;
  --green: #3bd17f;
  --green-ink: #04140b;
  --red: #e5484d;
  --amber: #e0b23a;
  --void: #8a7a4a;
  --pink: #f27ba8;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wrap: 1312px;
  --gut: 16px;
  --head: 52px;
  --tab: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* buttons the script hasn't switched on yet stay out of sight */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--font);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabbar { padding-bottom: calc(var(--tab) + var(--safe-b)); }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--green); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.1; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.page { flex: 1 0 auto; display: flex; flex-direction: column; }
main { flex: 1; }
.more-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.note-tests { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gut)); margin: 0 auto; padding: 0 var(--gut); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--green); color: var(--green-ink); padding: 8px 12px; z-index: 30; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
p.small + p.small { margin-top: 8px; }
.fix-form + p.small { margin-top: 12px; }
.crest { display: block; object-fit: contain; flex: none; }

/* ---------- header ---------- */
.nav { background: #090b0a; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); }
.nav-in { display: flex; align-items: center; gap: 16px; height: var(--head); }
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; white-space: nowrap; min-width: 0; }
.brand:hover { color: var(--ink); }
.mark { width: 33px; height: 26px; flex: none; fill: var(--green); }
.brand-name { font-weight: 800; font-stretch: 62%; font-size: 24px; text-transform: uppercase; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { display: none; font-size: 12px; line-height: 1.15; color: var(--muted); font-weight: 500; }
.nav-links { display: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav-right .who, .nav-right .nav-owner { display: none; }
.nav-right a { text-decoration: none; font-weight: 600; }
.nav-right a[aria-current] { color: var(--green); }
.nav-admin { background: var(--panel-2); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--green); }

/* ---------- bottom tab bar (phones) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(9, 11, 10, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--faint); font-size: 12px; font-weight: 600; }
.tabbar a[aria-current] { color: var(--green); }
.tabbar a, .nav-links a { position: relative; }
.tab-count { position: absolute; top: 4px; left: 50%; margin-left: 5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; font-style: normal; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-more circle { fill: currentColor; stroke: none; }

/* ---------- buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--green); color: var(--green-ink); border: 0; border-radius: 999px; padding: 11px 22px; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; }
.btn:hover { background: #5be096; color: var(--green-ink); }
.btn[disabled] { background: var(--panel-2); color: var(--muted); cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px #4a514d; padding: 8px 18px; font-size: 14px; }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.yp-acts .btn-ghost { padding: 11px 22px; font-size: 15px; }
.joined-list { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; }
.joined-list summary { color: var(--muted); }
.joined-list summary b { color: var(--ink); }
.joined-list summary::after { content: ' · show'; color: var(--green); }
.joined-list[open] summary::after { content: ''; }
.joined-list p { margin-top: 6px; color: var(--muted); line-height: 1.5; }
.joined-list + .small { margin-top: 10px; }
.btn-sm { display: inline-flex; align-items: center; background: var(--panel-2); border: 1px solid #343a37; border-radius: 8px; padding: 7px 11px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-sm:hover { border-color: var(--muted); color: var(--ink); }
.btn-sm.danger { color: #ff8a8d; }
.btn-sm[disabled] { opacity: .5; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select, select { background: #0f1211; border: 1px solid #343a37; border-radius: 8px; padding: 10px 12px; color: var(--ink); font-size: 16px; }
select { padding: 7px 8px; font-size: 14px; }
.field input:focus, .field select:focus { border-color: var(--green); outline: none; }
.form-error { background: #2d1416; color: #ffb3b5; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.row-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 8px; }
.row-form .field { flex: 1; min-width: 180px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.stack-form .field { align-self: stretch; }

/* ---------- strip: gameweek, deadline, live ---------- */
.strip { background: #0f1f17; border-bottom: 1px solid #1b3527; }
.strip-in { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
.strip p { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; font-size: 13px; min-width: 0; }
.strip b { font-weight: 800; font-stretch: 75%; font-size: 16px; text-transform: uppercase; letter-spacing: .01em; color: var(--green); }
.strip span { color: #d9ddd8; }
.cd { display: flex; gap: 4px; flex: none; }
.cd-unit { display: flex; align-items: baseline; gap: 1px; }
.cd-unit b { background: var(--green); color: var(--green-ink); border-radius: 5px; padding: 2px 5px 1px; font-size: 16px; font-stretch: 62%; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 26px; text-align: center; }
.cd-unit i { font-style: normal; font-weight: 700; font-size: 12px; color: var(--green); }
.live { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; color: var(--green); flex: none; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.flash { font-size: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); background: #13261b; }
.flash-error { background: #2d1416; }

/* ---------- shared blocks ---------- */
.tab-head { padding-top: 18px; padding-bottom: 12px; }
.wk-h1 { font-weight: 800; font-stretch: 62%; font-size: 40px; text-transform: uppercase; line-height: .92; letter-spacing: -.005em; }
.wk-meta { color: var(--muted); font-size: 14px; margin-top: 6px; }
.wk-meta a { color: var(--ink); }
.panel { background: var(--panel); border-radius: 14px; padding: 16px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { font-size: 17px; font-weight: 700; }
.sub-h { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 16px 0 4px; }
.panel-head span { color: var(--muted); font-size: 13px; }
.panel-note { color: var(--muted); font-size: 13px; margin-top: 12px; }
.panel-note a { color: var(--green); }
.sect { padding-bottom: 28px; }
.sect-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.sect-head h2 { font-size: 22px; font-weight: 800; font-stretch: 75%; }
.sect-head p { color: var(--muted); font-size: 14px; }
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; background: var(--green); }
.side-label { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.side-names { font-size: 14px; color: #d3d7d2; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
.names-more summary::after { content: ' Show all'; color: var(--green); }
.names-more[open] summary::after { content: ''; }
.two-pane { display: grid; gap: 14px; padding-bottom: 28px; align-items: start; }

/* ---------- pick tab ---------- */
.pick-layout { display: grid; gap: 14px; grid-template-areas: 'card' 'fx'; padding-bottom: 28px; }
.pl-card { grid-area: card; }
.pl-card:empty { display: none; }
.pl-fixtures { grid-area: fx; min-width: 0; }
.pl-side { display: none; grid-area: side; }

.your-pick { background: var(--panel); border-radius: 14px; padding: 14px 16px; box-shadow: inset 0 0 0 1.5px #2c322f; }
.your-pick.yp-set, .your-pick.yp-win { box-shadow: inset 0 0 0 2px var(--green); }
.your-pick.yp-todo { box-shadow: inset 0 0 0 2px var(--amber); }
.your-pick.yp-lose { box-shadow: inset 0 0 0 2px var(--red); }
.yp-label { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.yp-row { display: flex; align-items: center; gap: 12px; }
.yp-team { font-weight: 800; font-stretch: 62%; font-size: 30px; line-height: .95; text-transform: uppercase; }
.yp-none { color: var(--amber); }
.yp-text { font-size: 14px; margin-top: 4px; color: #d6d9d5; }
.yp-acts { display: flex; align-items: center; gap: 16px; margin-top: 12px; font-size: 14px; }
.yp-out .yp-label { color: #ff8a8d; }

.fx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fx-head h2 { font-size: 20px; font-weight: 800; font-stretch: 75%; }
.fx-head p { color: var(--muted); font-size: 13px; }
.fx-day { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.fx-foot { color: var(--faint); font-size: 12px; margin-top: 10px; }
.pick-fixtures { display: flex; flex-direction: column; gap: 6px; }
.fx-pick { display: grid; grid-template-columns: minmax(0, 1fr) 50px minmax(0, 1fr); align-items: stretch; gap: 6px; }
.fx-mid { align-self: center; justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 1px; font-variant-numeric: tabular-nums; }
.fx-mid b { font-size: 14px; font-weight: 700; }
.fx-mid small { font-size: 11px; font-weight: 600; color: var(--muted); }
.fx-mid small.on { color: var(--green); }
.team-opt { display: flex; align-items: center; gap: 8px; min-height: 48px; background: var(--panel); border-radius: 10px; padding: 7px 10px; cursor: pointer; border: 1.5px solid transparent; position: relative; min-width: 0; }
.team-opt input { position: absolute; opacity: 0; pointer-events: none; }
.team-opt .crest { width: 24px; height: 24px; }
.t-txt { display: flex; flex-direction: column; min-width: 0; }
.t-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-note { font-size: 11px; color: var(--muted); white-space: nowrap; }
.t-count { font-weight: 800; font-stretch: 62%; font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.team-a .t-count { margin-left: auto; }
.team-h { flex-direction: row-reverse; text-align: right; }
.team-h .t-count { margin-right: auto; }
.team-opt:not(.is-static):hover { border-color: #3d4440; }
.team-opt:has(input:checked), .team-opt.is-mine { border-color: var(--green); background: #12231a; }
.team-opt:has(input:checked) .t-note, .team-opt.is-mine .t-note { color: var(--green); }
.team-opt:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.team-opt.is-static { cursor: default; }
.team-opt.is-won .t-count { color: var(--green); }
.team-opt.is-lost .t-count { color: #ff8a8d; }
.team-opt.is-off { cursor: not-allowed; background: transparent; border-color: var(--line); }
.team-opt.is-off .crest { opacity: .3; filter: grayscale(1); }
.team-opt.is-off .t-name { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--faint); }
.pick-bar { position: sticky; bottom: calc(var(--tab) + var(--safe-b)); z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 10px 0; background: var(--bg); border-top: 1px solid var(--line); font-size: 14px; }
.pick-bar p { color: var(--muted); min-width: 0; }
.pick-bar b { color: var(--ink); }

.clubs-panel .club-grid { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 6px; }
.club-grid li { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; }
.club-grid .is-used { color: var(--faint); }
.club-grid .is-used .crest { opacity: .25; filter: grayscale(1); }
.feed ul { list-style: none; }
.feed li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed time { color: var(--muted); white-space: nowrap; font-size: 13px; }

/* ---------- picks tab ---------- */
.pick-rows { list-style: none; }
.pick-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.pick-row:first-child { border-top: 0; padding-top: 0; }
.pick-team { display: flex; flex-direction: column; min-width: 0; }
.pick-team b { font-weight: 700; font-size: 15px; }
.pick-team span { font-size: 13px; color: var(--muted); }
.pick-team em { font-style: normal; }
.pick-share { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; }
.pick-share b { font-weight: 800; font-stretch: 62%; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.pick-share span { color: var(--muted); font-size: 13px; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.r-win .pick-team em, .r-win .pick-share b { color: var(--green); }
.r-lose .pick-team em, .r-lose .pick-share b { color: #ff8a8d; }

/* ---------- players tab ---------- */
.pl-head { display: flex; flex-direction: column; gap: 12px; }
.pl-stats { display: flex; gap: 24px; }
.pl-stats.wide { display: none; }
.pl-stats dt { color: var(--muted); font-size: 13px; }
.pl-stats dd { margin: 2px 0 0; font-weight: 800; font-stretch: 62%; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.pl-stats dd small { font-size: 18px; color: var(--muted); font-weight: 700; }
.ros-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button b { font-weight: 700; margin-left: 4px; }
.seg button[aria-selected="true"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px #343a37; }
.find { flex: 1; min-width: 150px; }
.find input { width: 100%; background: var(--panel); border: 1px solid transparent; border-radius: 999px; padding: 8px 14px; font-size: 15px; }
.find input:focus { border-color: var(--green); outline: none; }
.panel .find input { background: var(--bg); border-color: var(--line); }
.rosters { display: grid; gap: 14px; align-items: start; }
.js .rosters[data-show="in"] .roster-out, .js .rosters[data-show="out"] .roster-in { display: none; }
.js [data-rosters].is-finding .rosters .roster { display: block; }
.ros-list { list-style: none; }
.ros-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.ros-row:first-child { border-top: 0; padding-top: 0; }
.ros-row[hidden] { display: none; }
.ros-who { display: flex; flex-direction: column; min-width: 0; }
.ros-who b { font-weight: 600; font-size: 15px; }
.ros-who span { font-size: 12px; color: var(--muted); }
.ros-row.is-out .ros-who b { color: #cdd1cc; }
.ros-picks { display: flex; gap: 4px; flex: none; align-items: center; }
.ros-picks .sq:not(:nth-last-child(-n+4)) { display: none; }
.ros-none { color: var(--muted); font-size: 14px; }
.js .roster:not(.is-open) .ros-row.more { display: none; }
.js [data-rosters].is-finding .ros-row.more:not([hidden]) { display: flex; }
.ros-gw { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 6px; border-top: 1px solid var(--line); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ros-gw:first-child { border-top: 0; padding-top: 0; }
.ros-gw b { font-weight: 700; color: var(--ink); }
.ros-gw + .ros-row { border-top: 0; padding-top: 4px; }
.ros-gw[hidden], .js .roster:not(.is-open) .ros-gw.more { display: none; }
.js [data-rosters].is-finding .ros-gw.more:not([hidden]) { display: flex; }
.js [data-rosters].is-finding .ros-toggle { display: none; }
.ros-toggle { display: none; width: 100%; margin-top: 10px; padding: 10px; border: 1px solid #343a37; border-radius: 10px; background: transparent; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; align-items: center; justify-content: center; gap: 8px; }
.js .ros-toggle { display: flex; }
.ros-toggle i { font-style: normal; transition: transform .2s; }
.roster.is-open .ros-toggle i { transform: rotate(180deg); }
.ros-note { color: var(--faint); font-size: 12px; margin-top: 10px; }
.sq { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 54px; height: 36px; border-radius: 6px; position: relative; line-height: 1.05; }
.sq b { font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.sq small { font-size: 11px; font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.sq.sq-sm { width: 42px; height: 30px; border-radius: 5px; }
.sq.sq-sm b { font-size: 11px; }
.sq.sq-sm small { font-size: 10px; }
.sq.r-win { background: var(--green); color: var(--green-ink); }
.sq.r-lose { background: var(--red); color: #fff; }
.sq.r-pending { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px #6b736e; }
.sq.r-void { background: var(--void); color: #fff; }
.sq-wait { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px #343a37; }
.auto { position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); color: var(--bg); font-style: normal; font-size: 9px; font-weight: 800; display: grid; place-items: center; }
.sq-more { flex: none; height: 30px; min-width: 34px; padding: 0 7px; border: 1px solid #343a37; border-radius: 5px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.sq-more:hover { color: var(--ink); border-color: #6b736e; }
.sq-more .m-wide, .sq-more .m-less { display: none; }
.ros-picks.all { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; min-width: 0; }
.ros-row .ros-picks.all .sq { display: inline-flex; }
.ros-picks.all .sq-more span { display: none; }
.ros-picks.all .sq-more .m-less { display: inline; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 12px; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .sq { width: 22px; height: 16px; border-radius: 4px; }
.auto-key { position: static; flex: none; margin: 0 3px 0 2px; }
.past details summary { display: flex; }
.past-list { list-style: none; border-top: 1px solid var(--line); }
.past-list li { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.past-list a { font-weight: 700; }
.past-list span { color: var(--muted); }

/* ---------- chat ---------- */
.chat-app { display: flex; flex-direction: column; height: calc(100dvh - var(--head) - var(--tab) - var(--safe-b) - env(safe-area-inset-top, 0px)); width: 100%; max-width: 820px; margin: 0 auto; }
.chat-top { padding: 12px var(--gut) 8px; border-bottom: 1px solid var(--line); }
.chat-top h1 { font-size: 20px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; }
.chat-top p { color: var(--muted); font-size: 12px; }
.msgs { flex: 1; overflow-y: auto; list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 12px var(--gut); overscroll-behavior: contain; }
.msgs > :first-child { margin-top: auto; }
.msg { background: var(--panel); border-radius: 14px; padding: 9px 13px; max-width: 85%; align-self: flex-start; }
.msg.is-mine { align-self: flex-end; background: #12261a; }
.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.msg-meta b { color: var(--ink); font-size: 13px; }
.msg-meta .inline { margin-left: auto; opacity: .7; }
.msg-meta .btn-sm { padding: 1px 7px; font-size: 11px; }
.msg-body { margin-top: 2px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-empty { color: var(--muted); align-self: center; margin-top: 30%; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding: 8px var(--gut) 10px; border-top: 1px solid var(--line); background: var(--bg); }
.chat-form textarea { background: var(--panel); border: 1px solid #343a37; border-radius: 20px; padding: 9px 14px; color: var(--ink); resize: none; min-height: 40px; max-height: 120px; font-size: 16px; }
.chat-form textarea:focus { border-color: var(--green); outline: none; }
.chat-form .btn { padding: 9px 18px; }
.is-bare .foot { display: none; }

/* ---------- more, rules, account ---------- */
.more { padding-top: 18px; padding-bottom: 28px; }
.more .wk-h1 { margin-bottom: 14px; }
.more-h { font-size: 13px; color: var(--muted); font-weight: 600; margin: 22px 0 8px; }
.more-list { list-style: none; background: var(--panel); border-radius: 14px; overflow: hidden; }
.more-list li + li { border-top: 1px solid var(--line); }
.more-list a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; min-height: 54px; }
.more-list a span { font-weight: 600; flex: 1; }
.more-list a small { color: var(--muted); font-size: 13px; }
.more-list a i { font-style: normal; color: var(--faint); font-size: 20px; }
.more-app { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.more-app div { display: flex; flex-direction: column; gap: 2px; }
.more-app span { font-weight: 600; }
.more-app small { color: var(--muted); font-size: 13px; }
.more-note { color: var(--muted); font-size: 14px; margin-top: 18px; }
.more-out { margin-top: 22px; }
.rules { padding-top: 18px; padding-bottom: 28px; max-width: 860px; }
.rules-intro { font-size: 16px; line-height: 1.45; margin: 10px 0 16px; color: #d6d9d5; }
.rule-sec { background: var(--panel); border-radius: 14px; margin-bottom: 8px; }
.rule-sec summary { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-weight: 700; font-size: 16px; }
.rule-sec summary::after { content: '+'; color: var(--muted); font-size: 20px; font-weight: 400; }
.rule-sec[open] summary::after { content: '–'; }
.rule-sec ol { padding: 0 16px 14px 34px; display: flex; flex-direction: column; gap: 8px; color: #d6d9d5; font-size: 15px; }
.rule-sec ol li::marker { color: var(--muted); }
.glance { border-collapse: collapse; width: calc(100% - 32px); margin: 0 16px 10px; font-size: 14px; }
.glance th, .glance td { text-align: left; padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.glance th { font-weight: 500; color: var(--muted); padding-right: 12px; width: 48%; }
.glance td { font-weight: 600; }
.rules-small { color: var(--muted); font-size: 13px; margin-top: 14px; }
.account { padding-top: 18px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 14px; }
.account .wk-meta { margin-top: 0; }

/* ---------- sign in, join, invites ---------- */
.auth { flex: 1; display: grid; place-items: start center; padding-top: 24px; padding-bottom: 32px; }
.auth-box { width: 100%; max-width: 440px; padding: 24px 18px; }
.auth-box h1 { font-size: 28px; font-weight: 800; font-stretch: 75%; margin-bottom: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn, .auth-form a.btn { width: 100%; margin-top: 4px; padding: 13px 22px; }
.auth-alt { font-size: 14px; color: var(--muted); margin-top: 16px; }
.auth-alt a { color: var(--ink); }
.auth-note { font-size: 14px; color: #d6d9d5; background: #13261b; border-radius: 8px; padding: 10px 12px; }
.invite-what { font-size: 17px; margin: 10px 0 18px; color: #d6d9d5; }
.invite-what b { color: var(--ink); }

/* ---------- front page ---------- */
.landing { padding-top: 26px; padding-bottom: 32px; display: grid; gap: 22px; align-items: start; }
.landing .wk-h1 { font-size: 46px; }
.landing-lead { font-size: 17px; line-height: 1.45; max-width: 40em; margin-top: 12px; color: #d6d9d5; }
.landing-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.landing-note { color: var(--muted); font-size: 14px; margin-top: 18px; }
.landing-note a { color: var(--green); }
.landing-preview .fx-pick { grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr); }
.landing-preview .team-opt { padding: 6px 4px; background: transparent; }
.landing-preview .t-name { white-space: normal; line-height: 1.15; font-size: 13px; hyphens: auto; text-overflow: clip; }
.lobby-cards { list-style: none; display: grid; gap: 10px; margin-top: 18px; }
.lobby-card { display: flex; flex-direction: column; background: var(--panel); border-radius: 14px; border: 1.5px solid transparent; }
.lobby-card:hover { border-color: #3d4440; }
.lc-main { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 10px; text-decoration: none; color: inherit; }
.lc-main:hover { color: inherit; }
.lc-name { font-weight: 800; font-stretch: 62%; font-size: 28px; line-height: 1; text-transform: uppercase; margin-bottom: 2px; }
.lc-line { color: var(--muted); font-size: 13px; }
.lc-pot { font-size: 14px; color: var(--muted); margin-top: 4px; }
.lc-pot b { color: var(--ink); font-size: 18px; font-weight: 800; }
.lc-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 0 18px 14px; }
.lc-foot .btn-sm { margin-left: auto; }
.lc-foot .inline + .btn-sm, .lc-foot .inline { margin-left: auto; }
.lc-tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.lc-tag.is-todo { background: #3a2f12; color: #f0c75a; }
.lc-tag.is-good { background: #12301f; color: var(--green); }
.lc-tag.is-admin { background: #1d2a3a; color: #8fc1ff; }
.lc-tag.is-out { background: #3a1719; color: #ff8a8d; }
.lc-tag.is-chat { background: var(--red); color: #fff; }
.btn-sm.is-join { background: var(--green); color: var(--green-ink); border-color: transparent; }
.lc-create { margin-top: 16px; }
.landing-in .landing-copy { max-width: 760px; }

/* ---------- admin ---------- */
.admin { padding-top: 18px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 12px; }
.admin p { font-size: 14px; }
.subtabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gut)); padding: 2px var(--gut); }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { flex: none; padding: 7px 13px; border-radius: 999px; background: var(--panel); text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.subtabs a[aria-current] { background: var(--green); color: var(--green-ink); }
.subtabs a b { background: var(--amber); color: #241a02; border-radius: 999px; padding: 0 6px; margin-left: 4px; font-size: 12px; }
.find-admin { display: block; margin-bottom: 10px; }
.adm-cards { list-style: none; display: flex; flex-direction: column; }
.adm-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--head) + 12px); }
.adm-card:first-child { border-top: 0; padding-top: 0; }
.adm-card[hidden], .invite-list li[hidden] { display: none; }
.adm-card summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; min-width: 0; }
.adm-card summary::-webkit-details-marker { display: none; }
.adm-card summary b { font-size: 15px; }
.adm-card summary small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-card.is-out summary b { color: var(--muted); font-weight: 600; }
.adm-card details[open] summary b { color: var(--green); }
.adm-more { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.adm-more > small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.btn-sm.is-paid { color: var(--green); border-color: transparent; background: #12231a; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-grid { display: grid; gap: 12px; align-items: start; }
.admin-sync { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-sync p { flex-basis: 100%; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 9px 10px 9px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.admin-table thead th { font-size: 12px; color: var(--muted); font-weight: 600; border-top: 0; }
.admin-table tbody th small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.invite-list { list-style: none; }
.invite-list li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.invite-list li:first-child { border-top: 0; }
.invite-list li > span { flex: 1; min-width: 160px; }
.invite-list small { color: var(--muted); }
.invite-list em { font-style: normal; font-size: 12px; color: var(--green); }
.log { list-style: none; font-size: 13px; max-height: 360px; overflow: auto; }
.log li { display: grid; gap: 0; padding: 6px 0; border-top: 1px solid var(--line); }
.log time { color: var(--muted); }
.copy input { width: 100%; margin-top: 8px; background: #0f1211; border: 1px solid var(--green); border-radius: 8px; padding: 10px; font-size: 14px; }
.copy.is-new { box-shadow: inset 0 0 0 2px var(--green); }
.copy.is-new p { font-weight: 600; }
.mini-link { width: 200px; max-width: 100%; background: #0f1211; border: 1px solid #343a37; border-radius: 6px; padding: 5px 8px; font-size: 12px; color: var(--muted); }
details.del { display: inline-block; }
details.del summary { display: inline-flex; }
details.del[open] summary { display: none; }
details.del input { width: 150px; background: #0f1211; border: 1px solid #5a2d2f; border-radius: 6px; padding: 5px 8px; font-size: 13px; }
.note-block { background: var(--panel); border-radius: 14px; padding: 18px; }
.note-block a { color: var(--green); }

/* ---------- footer (bigger screens only inside a lobby) ---------- */
.foot { border-top: 1px solid var(--line); background: #090b0a; color: var(--muted); font-size: 14px; }
.has-tabbar .foot { display: none; }
.foot-in { display: grid; gap: 18px; padding-top: 28px; padding-bottom: 32px; }
.foot-main p:not(.foot-name) { color: #cfd3ce; max-width: 40ch; }
.foot a { color: var(--ink); }
.foot-in p + p { margin-top: 8px; }
.foot-name { color: var(--ink); font-weight: 800; font-stretch: 62%; font-size: 22px; text-transform: uppercase; }

/* ---------- bigger screens ---------- */
/* Lobby pages on a phone work like an app: the header and the tab bar stay where they are and only the page
   between them scrolls, so the bounce at the end of a page can't shift the tab bar. The page is sized to the
   window, not pinned with position: fixed: an iPhone home-screen app gives fixed layouts an area shorter than
   the screen by the status bar (812 of 874 points on an iPhone 17 Pro), which left the bar high. */
@media (max-width: 899px) {
  body.has-tabbar { position: relative; height: 100vh; height: 100dvh; min-height: 0; padding-bottom: 0; overflow: hidden; }
  /* A home-screen app has no browser bars, so the large viewport is the whole screen. There iOS starts 100dvh
     off short by the status bar and only corrects it later, so the bar sat high on every fresh page. This was
     measured with the see-through status bar (black-translucent, in views.mjs), which iPhone fixes at install:
     with an opaque one the app is shorter and 100lvh overshoots, so keep the two together. */
  @media (display-mode: standalone) { body.has-tabbar { height: 100lvh; } }
  body.has-tabbar .page { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
  body.has-tabbar .nav { position: static; }
  body.has-tabbar .tabbar { position: static; flex: none; }
  body.has-tabbar .pick-bar { bottom: 0; }
  body.is-bare .page { overflow: hidden; }
  body.is-bare main { display: flex; flex-direction: column; min-height: 0; }
  body.is-bare .chat-app { height: auto; flex: 1; min-height: 0; }
}

@media (min-width: 900px) {
  .phone { display: none; }
  .pl-stats.wide { display: flex; }
  :root { --gut: 40px; --head: 64px; --tab: 0px; }
  body.has-tabbar { padding-bottom: 0; }
  .tabbar { display: none; }
  .has-tabbar .foot { display: block; }
  .is-bare .foot { display: none; }
  .brand-name { font-size: 28px; }
  .brand-sub { display: block; }
  .mark { width: 35px; height: 28px; }
  .nav-in { gap: 32px; }
  .nav-links { display: flex; gap: 24px; height: 100%; }
  .nav-links a { display: flex; align-items: center; gap: 7px; text-decoration: none; font-weight: 600; color: #c9cdc9; border-bottom: 3px solid transparent; padding-top: 3px; }
  .nav-links .ico { width: 18px; height: 18px; }
  .nav-links a[aria-current] { color: var(--ink); border-bottom-color: var(--green); }
  .nav-links .tab-count { position: static; margin-left: 0; }
  .nav-right .who, .nav-right .nav-owner { display: inline; }
  .nav-right .who { color: var(--muted); }
  .nav-admin { background: none; padding: 0; font-size: 14px; }
  .strip-in { min-height: 48px; }
  .strip p { font-size: 15px; gap: 4px 14px; }
  .strip b { font-size: 18px; }
  .cd-unit b { font-size: 19px; min-width: 32px; padding: 3px 6px 2px; }
  .tab-head { padding-top: 32px; padding-bottom: 20px; }
  .wk-h1 { font-size: 72px; }
  .panel { padding: 20px 22px; border-radius: 18px; }
  .pick-layout { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: 'fx card' 'fx side'; grid-template-rows: auto 1fr; column-gap: 28px; row-gap: 14px; align-items: start; padding-bottom: 48px; }
  .pl-side { display: flex; flex-direction: column; gap: 14px; }
  .yp-team { font-size: 38px; }
  .fx-head h2 { font-size: 26px; }
  .fx-pick { grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); gap: 8px; }
  .team-opt { min-height: 58px; padding: 9px 14px; gap: 12px; }
  .team-opt .crest { width: 32px; height: 32px; }
  .t-name { font-size: 16px; }
  .t-note { font-size: 12px; }
  .t-count { font-size: 28px; }
  .pick-bar { bottom: 0; }
  .two-pane { grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; padding-bottom: 48px; }
  .pl-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .pl-stats { gap: 40px; }
  .pl-stats dd { font-size: 48px; }
  .seg { display: none; }
  .ros-tools .find { max-width: 320px; }
  .rosters { grid-template-columns: 1fr 1fr; gap: 16px; }
  .js .rosters[data-show] .roster { display: block; }
  .ros-picks .sq:not(:nth-last-child(-n+4)) { display: inline-flex; }
  .ros-picks .sq.old, .sq-more.phone-only, .sq-more .m-phone { display: none; }
  .sq-more .m-wide { display: inline; }
  .sq.sq-sm { width: 46px; height: 32px; }
  .sq.sq-sm b { font-size: 12px; }
  .chat-app { height: calc(100dvh - var(--head) - 24px); }
  .msg { max-width: 70%; }
  .more, .rules, .account, .admin { padding-top: 32px; }
  .more { max-width: 760px; }
  .landing { grid-template-columns: minmax(0, 1fr) 460px; gap: 48px; padding-top: 56px; padding-bottom: 72px; }
  .landing .wk-h1 { font-size: 80px; }
  .landing-lead { font-size: 19px; }
  .lobby-cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
  .landing:has(.lobby-cards) { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr 1fr; }
  .subtabs { margin: 0; padding: 2px 0; }
  .log li { grid-template-columns: 140px 1fr; gap: 12px; }
  .past-list li { grid-template-columns: 120px 180px 1fr; gap: 16px; }
  .auth { place-items: center; padding-top: 48px; padding-bottom: 64px; }
  .auth-box { padding: 30px 28px; }
  .foot-in { grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-top: 36px; padding-bottom: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .live i { animation: none; }
}

/* ---------- charity, sharing, managing a lobby ---------- */
.charity { color: var(--pink); font-size: 12px; font-weight: 600; white-space: nowrap; }
p.charity { margin-top: 4px; white-space: normal; }
/* The charity share under a pot: an ordinary size and weight, so the prize leads. */
.charity.pot-charity { display: block; margin-top: 4px; font-size: 13px; font-weight: 500; white-space: normal; }
/* The Pick tab's header, in the Players page's stat style. The pot column takes the rest of the row so its charity line can run on. */
.pick-stats { margin-top: 12px; }
.pick-stats dd a { color: inherit; text-decoration: none; }
.pick-pot { flex: 1; min-width: 0; }
.share { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.share .btn-sm { padding: 6px 10px; }
.btn-sm.is-copied { color: var(--green); border-color: var(--green); }
.pill { font-style: normal; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); margin-left: 4px; white-space: nowrap; }
.pill.is-good { background: #12301f; color: var(--green); }
.pill.is-todo { background: #3a2f12; color: #f0c75a; }
.invite-list em.pill { font-size: 11px; color: var(--muted); }
.invite-list em.pill.is-good { color: var(--green); }
.invite-list em.pill.is-todo { color: #f0c75a; }
.link-row { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.link-row input { flex: 1; margin-top: 0; min-width: 0; }
.lobby-link { margin-bottom: 12px; }
.stack-form textarea { align-self: stretch; background: #0f1211; border: 1px solid #343a37; border-radius: 8px; padding: 10px 12px; color: var(--ink); font: inherit; font-size: 15px; resize: vertical; }
.stack-form textarea:focus { border-color: var(--green); outline: none; }
.field textarea { width: 100%; }
.playing-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 10px 12px; margin-bottom: 10px; border-radius: 10px; background: var(--panel-2); }
.playing-form p { flex-basis: 100%; }
.js .playing-form[data-autosubmit] button { display: none; }
.charity-set { border: 0; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 12px; align-self: stretch; }
.charity-fields { display: flex; flex-direction: column; gap: 12px; padding-left: 28px; }
.charity-set:not(:has(input[data-charity-on]:checked)) .charity-fields { display: none; }
.seg-radio { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-radio label { display: flex; gap: 6px; align-items: center; padding: 8px 12px; border-radius: 8px; background: #0f1211; border: 1px solid #343a37; color: var(--ink); font-size: 14px; cursor: pointer; }
.seg-radio label:has(input:checked) { border-color: var(--green); }
.seg-radio input { accent-color: var(--green); }
.charity-preview { font-size: 14px; color: var(--ink); }
.charity-preview:empty { display: none; }
.danger-zone { border: 1px solid #3a1719; }
.fix-form .field { max-width: 420px; }
.row-acts { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-left: auto; }
