/* Components from spec §8.3, built on tokens.css. Mobile-first. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-family); font-size: 16px; line-height: 1.5;
  color: var(--color-text); background: var(--color-background);
}
a { color: var(--color-brand); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--color-brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.container { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }
.container.wide { max-width: 1040px; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.topbar-inner { max-width: 560px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--color-text); text-decoration: none; }
.topbar .spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* Type */
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 8px 0; }
h2 { font-size: 19px; font-weight: 700; margin: 24px 0 8px; }
h3 { font-size: 16px; font-weight: 700; margin: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--color-text-muted); }
.small { font-size: 14px; }
.meta { font-size: 13px; color: var(--color-text-muted); }
.center { text-align: center; }

/* Cards and lists */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: 16px; }
a.card:not(.row) { display: block; }
.card.dashed { border-style: dashed; border-color: #e2c26a; background: #fffbeb; }
.card + .card { margin-top: 12px; }
.list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; color: inherit; text-decoration: none; }
.list-row + .list-row { border-top: 1px solid var(--color-border); }
a.list-row:hover { background: var(--color-background); }
.chev::after { content: "›"; font-size: 22px; color: var(--color-text-muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--radius-button);
  background: var(--color-brand-solid); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--color-brand-solid-hover); }
.btn.secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-input); }
.btn.secondary:hover { background: var(--color-background); }
.btn.ghost { background: transparent; color: var(--color-brand); }
.btn.ghost:hover { background: var(--color-brand-tint); }
.btn.danger { background: var(--color-danger); }
.btn.danger:hover { background: var(--color-danger-text); }
.btn.danger-outline { background: var(--color-surface); color: var(--color-danger-text); border-color: var(--color-danger); }
.btn.danger-outline:hover { background: var(--color-danger-tint); }
.cancel-panel { margin-top: 12px; border: 1.5px solid var(--color-danger); }
.cancel-panel .cancel-title { margin: 0; font-size: 17px; letter-spacing: 0; text-transform: none; color: var(--color-danger-text); }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
button.link { background: none; border: 0; padding: 0; color: var(--color-brand); font: inherit; cursor: pointer; text-decoration: underline; }
.inline-form { display: inline; }

/* Forms */
label, .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.help { font-size: 13px; color: var(--color-text-muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=time], input[type=datetime-local], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: inherit;
  background: var(--color-surface); border: 1px solid var(--color-border-input); border-radius: 10px;
}
textarea { min-height: 96px; resize: vertical; }
input.code { font-size: 28px; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.field + .field { margin-top: 16px; }
.field.error input, .field.error select, .field.error textarea { border-color: var(--color-danger); }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--color-danger-text); font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; }
fieldset { border: 0; padding: 0; margin: 0; }
.choice-group { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--color-border-input); border-radius: 12px; background: var(--color-surface); font-weight: 400; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--color-brand); background: var(--color-brand-tint); }
.choice input { margin-top: 4px; }

/* Toggle switch: <input type=checkbox role=switch class=switch> */
input.switch { appearance: none; width: 48px; height: 28px; border-radius: 999px; background: var(--color-border-input); position: relative; cursor: pointer; flex: none; margin: 0; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s ease-out; }
input.switch:checked { background: var(--color-success); }
input.switch:checked::after { left: 23px; }

/* Pills, badges, banners */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; background: var(--color-brand-tint); color: var(--color-brand-pressed); white-space: nowrap; }
.pill.success { background: var(--color-success-tint); color: var(--color-success-text); }
.pill.warning { background: var(--color-warning-tint); color: var(--color-warning-text); }
.pill.danger { background: var(--color-danger-tint); color: var(--color-danger-text); }
.pill.neutral { background: #eef1f3; color: var(--color-text-subtle); }
.pill.ask { background: transparent; box-shadow: inset 0 0 0 1.5px var(--color-brand); color: var(--color-brand-pressed); }
.state-on { color: var(--color-success-text); font-weight: 600; }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--color-danger); color: #fff; font-size: 12px; font-weight: 700; align-items: center; justify-content: center; }
.banner { padding: 12px 14px; border-radius: 12px; font-size: 15px; background: var(--color-brand-tint); color: var(--color-brand-pressed); }
.banner.warning { background: var(--color-warning-tint); color: var(--color-warning-text); }
.banner.danger { background: var(--color-danger-tint); color: var(--color-danger-text); }
.banner.success { background: var(--color-success-tint); color: var(--color-success-text); }
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.messages li + li { margin-top: 8px; }

/* Avatars */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--color-brand-tint); color: var(--color-brand-pressed); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; overflow: hidden; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatars { display: flex; }
.avatars .avatar { border: 2px solid var(--color-surface); margin-left: -8px; }
.avatars .avatar:first-child { margin-left: 0; }

/* Spots bar (decorative; numbers always in text) */
.spots { height: 8px; border-radius: 999px; background: #e7ebee; overflow: hidden; }
.spots > span { display: block; height: 100%; background: var(--color-success); }

/* RSVP segmented control */
.rsvp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rsvp button { min-height: 48px; border-radius: 12px; border: 1px solid var(--color-border-input); background: var(--color-surface); font: inherit; font-weight: 700; cursor: pointer; color: var(--color-text); }
.rsvp button[aria-pressed="true"].going { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.rsvp button[aria-pressed="true"].maybe { background: var(--color-warning); border-color: var(--color-warning); color: #fff; }
.rsvp button[aria-pressed="true"].not_going { background: var(--color-text-subtle); border-color: var(--color-text-subtle); color: #fff; }
.rsvp button[aria-pressed="true"]::before { content: "✓ "; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin: 12px 0; overflow-x: auto; }
.tabs a { flex: 1 0 auto; text-align: center; padding: 10px 8px; color: var(--color-text-muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--color-brand); border-bottom-color: var(--color-brand); }

/* Bottom nav */
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--color-surface); border-top: 1px solid var(--color-border); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav ul { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 56px; font-size: 12px; font-weight: 600; color: var(--color-text-muted); text-decoration: none; }
.bottomnav a .icon { font-size: 20px; line-height: 1; }
.bottomnav a[aria-current="page"] { color: var(--color-brand); }
.bottomnav a[aria-current="page"] .icon { background: var(--color-brand-tint); border-radius: 999px; padding: 2px 14px; }

/* Empty state, skeleton, misc */
.empty { text-align: center; padding: 32px 16px; color: var(--color-text-muted); }
.empty .icon { font-size: 36px; }
.divider { border: 0; border-top: 1px solid var(--color-border); margin: 16px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--color-text-muted); }
.kv dd { margin: 0; }
.photo-grid { display: grid; gap: 4px; grid-template-columns: repeat(3, 1fr); border-radius: 12px; overflow: hidden; }
.photo-grid.n1 { grid-template-columns: 1fr; }
.photo-grid.n2, .photo-grid.n4 { grid-template-columns: repeat(2, 1fr); }
.photo-grid img { width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-grid.n1 img { aspect-ratio: auto; max-height: 480px; }
.qr { display: flex; justify-content: center; padding: 16px; background: #fff; border-radius: 12px; }
.qr svg { width: 240px; height: 240px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px; border-bottom: 1px solid var(--color-border); }
@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; animation: none !important; } }
@media (min-width: 900px) { .container.wide { padding-bottom: 32px; } }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpis .card { margin: 0; padding: 14px; }
.kpi { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
@media (min-width: 540px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
/* Public site */
.public-nav { gap: 16px; margin-left: 16px; }
.public-nav a { color: var(--color-text); text-decoration: none; font-weight: 600; }
@media (max-width: 640px) { .public-nav { display: none; } }
.public-footer { background: var(--color-surface); border-top: 1px solid var(--color-border); margin-top: 32px; }
.public-footer .container { padding-bottom: 32px; }
.hero { padding: 32px 0 16px; }
.hero h1 { font-size: clamp(30px, 6vw, 46px); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.disclosure { font-size: 14px; background: #f1f4f6; border-radius: 10px; padding: 10px 12px; }
.sponsored { border: 1px dashed var(--color-border-input); border-radius: 12px; padding: 12px; font-size: 14px; }
.sponsored .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-muted); }
.consent-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 16px; padding: 14px; box-shadow: 0 6px 24px rgba(16,32,39,.12); max-width: 640px; margin: 0 auto; }
#court-map { height: 360px; border-radius: 16px; border: 1px solid var(--color-border); }
.prose p { max-width: 70ch; }
/* Group label: name + color (never color alone) */
.group-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 10px 2px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-fg); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chip-fg); flex: none; }
.group-chip.sm { font-size: 12px; padding: 1px 8px 1px 6px; }
.card.grouped { border-left: 4px solid var(--chip-fg, var(--color-border)); }
.group-filter { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.group-picker { position: relative; min-width: 0; }
.group-picker > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 40px; padding: 4px 12px; border: 1px solid var(--color-border-input); border-radius: 999px; background: var(--color-surface); cursor: pointer; font-size: 14px; }
.group-picker > summary::-webkit-details-marker { display: none; }
.group-picker > summary .group-chip { min-width: 0; }
.group-picker .caret { width: 7px; height: 7px; margin: -4px 2px 0; border-right: 2px solid var(--color-text-muted); border-bottom: 2px solid var(--color-text-muted); transform: rotate(45deg); transition: transform .15s; flex: none; }
.group-picker[open] .caret { transform: rotate(-135deg); margin-top: 4px; }
.picker-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: min(320px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; box-shadow: 0 12px 32px rgba(16, 32, 39, .18); padding: 6px; }
.picker-menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 10px; color: var(--color-text); text-decoration: none; }
.picker-menu a:hover, .picker-menu a:focus-visible { background: var(--color-brand-tint); }
.picker-menu a[aria-current="true"] { font-weight: 700; }
.picker-menu .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.picker-menu .grow { min-width: 0; overflow-wrap: anywhere; }
.picker-menu .tick { color: var(--color-brand); font-weight: 800; }
.group-filter .clear { font-size: 14px; white-space: nowrap; }
@media (max-width: 420px) { .tabs a { font-size: 15px; padding: 10px 4px; } }
.grid-3 > .card + .card, .kpis > .card + .card { margin-top: 0; }
/* Matches & scores */
.match { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.match.played { border-color: #cfe5d3; }
.match-court { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); }
.match-side { display: flex; align-items: center; gap: 12px; }
.match-names { flex: 1; min-width: 0; font-weight: 600; }
.match-side.won .match-names { color: var(--color-success-text); }
.match-side.won .match-names::after { content: "  ✓"; }
input.score { width: 64px; min-height: 44px; text-align: center; font-size: 20px; font-weight: 700; padding: 6px; font-variant-numeric: tabular-nums; }
.match-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.match-ok { font-size: 13px; color: var(--color-success-text); }
.match-error { font-size: 13px; color: var(--color-danger-text); }
.round h2 { margin-top: 20px; }
table.standings td:nth-child(n+3), table.standings th:nth-child(n+3) { text-align: center; width: 44px; }
table.standings tr.leader td { font-weight: 700; }
.pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---- Polish layer ------------------------------------------------------------- */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.topbar { background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: saturate(1.6) blur(12px); backdrop-filter: saturate(1.6) blur(12px); }
.topbar .brand span { letter-spacing: -0.01em; }
h1 { letter-spacing: -0.025em; }
h2 { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); margin: 28px 0 10px; }
h2.small.muted { margin-top: 18px; }
.home-actions { margin: 4px 0 8px; }
.home-actions .btn { flex: 1 1 0; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.day-head { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); margin: 18px 0 8px; }
.card, .list, .match { border-color: var(--color-border); box-shadow: var(--shadow-card); }
a.card, a.list-row { transition: background-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
a.card:hover { box-shadow: var(--shadow-raised); }
a.card:active, a.list-row:active { transform: scale(.995); }
.list-row { padding: 14px 16px; }
.btn { transition: background-color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease); box-shadow: 0 1px 2px rgba(11, 99, 206, .25); }
.btn.secondary, .btn.ghost { box-shadow: none; }
.btn:active { transform: translateY(1px) scale(.99); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-brand); box-shadow: 0 0 0 3px rgba(11, 99, 206, .18); }
input::placeholder, textarea::placeholder { color: #8a96a3; }
.rsvp button { transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.rsvp button:not([aria-pressed="true"]):hover { border-color: var(--color-text-muted); }
.bottomnav { background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 -1px 0 rgba(16, 32, 39, .06); border-top: 0; }
.bottomnav a { transition: color .15s var(--ease); }
.bottomnav a[aria-current="page"] { color: var(--color-brand-pressed); }
.empty { padding: 36px 20px; }
.empty .icon { font-size: 40px; margin-bottom: 6px; }
.empty p { max-width: 34ch; margin: 0 auto 8px; }
.banner { border: 1px solid rgba(11, 99, 206, .12); }
.banner.warning { border-color: rgba(138, 95, 0, .18); }
.banner.danger { border-color: rgba(180, 35, 24, .18); }
.banner.success { border-color: rgba(39, 138, 55, .18); }
.page-sub { color: var(--color-text-muted); margin-top: -4px; font-size: 15px; }
.pill { letter-spacing: .01em; }
.tabs { border-bottom-color: var(--color-border); }
.tabs a { transition: color .15s var(--ease), border-color .15s var(--ease); }
details > summary { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { a.card:active, a.list-row:active, .btn:active { transform: none; } }
.match-vs { font-size: 12px; font-weight: 700; color: var(--color-text-muted); margin: -4px 0; }
/* Focused task pages: an action bar pinned to the bottom of the screen */
.sticky-actions { position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--color-background) 75%, transparent); }
.create-form { padding-bottom: 8px; }
details.notice > summary { padding: 10px 0; color: var(--color-brand); }
details.notice[open] > summary { color: var(--color-text); }
[data-private-only][hidden] { display: none; }

/* ---------- Bigger screens ----------
   900px+: a left sidebar replaces the bottom bar.
   1200px+: Home becomes three columns: you (left), feed (middle), games (right). */
.sidebar, .home-feed { display: none; }
@media (min-width: 900px) {
  .bottomnav { display: none; }
  .topbar-inner { max-width: 1360px; padding: 10px 24px; }
  .shell.has-side { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; max-width: 1360px; margin: 0 auto; padding: 0 24px; align-items: start; }
  .shell.has-side > main.container { width: 100%; max-width: 680px; margin: 0; padding: 24px 0 48px; justify-self: center; }
  .shell.has-side > main.container.wide { max-width: 1040px; }
  .sidebar { display: block; position: sticky; top: 57px; max-height: calc(100vh - 57px); overflow-y: auto; padding: 24px 4px 32px 0; }
  .side-me { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); text-decoration: none; }
  .side-me .meta { display: block; }
  .side-me:hover { border-color: var(--color-brand); }
  .side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
  .side-nav a, .side-groups a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--color-text); text-decoration: none; font-weight: 600; }
  .side-nav a:hover, .side-groups a:hover { background: var(--color-brand-tint); }
  .side-nav a[aria-current="page"], .side-groups a[aria-current="page"] { background: var(--color-brand-tint); color: var(--color-brand-pressed); }
  .side-nav .badge { margin-left: auto; }
  .side-head { margin: 24px 12px 6px; font-size: 12px; }
  .side-groups { display: flex; flex-direction: column; gap: 2px; }
  .side-groups a { font-weight: 500; font-size: 15px; }
  .side-groups .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
  .side-small { display: inline-block; margin: 6px 12px 0; font-size: 14px; }
  .side-signout { margin: 20px 12px 0; }
  .side-signout button { font-size: 14px; }
}
@media (min-width: 1200px) {
  .shell.has-side > main.container.dash { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; }
  .dash > :not(.home-feed):not(.home-games) { grid-column: 1 / -1; }
  .dash > .home-feed { display: block; order: 1; max-width: 640px; width: 100%; justify-self: center; }
  .dash > .home-games { order: 2; }
  .dash-title { margin-top: 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; text-transform: none; color: var(--color-text); }
  .side-nav .feed-link { display: none; }  /* the feed is right there on Home */
  /* three columns: the layout says what each column is, so drop the big titles */
  .dash .home-feed .dash-title, .dash .home-games .greet { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .dash .home-games .greet-sub { display: none; }
  .dash .home-feed > .meta:first-of-type { margin-top: 0; }
  .dash .home-feed, .dash .home-games { padding-top: 4px; }
}
@media (min-width: 1300px) {
  /* balance the sidebar so ordinary pages sit in the middle of the screen; Home uses the full width */
  .shell.has-side:not(:has(> main.dash)) { padding-right: 304px; }
}

/* Page-to-page navigation: a quick crossfade instead of a white flash (browsers that support
   cross-document view transitions); the top bar, sidebar and bottom bar stay put. */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.sidebar { view-transition-name: sidebar; }
.bottomnav { view-transition-name: bottomnav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .12s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Feed page on phones: the same page as Home, showing the feed column instead of the games. */
@media (max-width: 1199.98px) {
  .dash.focus-feed > .home-feed { display: block; }
  .dash.focus-feed > .home-games { display: none; }
  .focus-feed .dash-title { margin: 8px 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; text-transform: none; color: var(--color-text); }
}
@media (min-width: 1200px) { .feed-filter { display: none; } }

/* Profile pictures */
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }
.avatar-file:focus-visible + label { outline: 3px solid var(--color-brand); outline-offset: 2px; }
.avatar-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* @mentions */
.mention { font-weight: 700; text-decoration: none; color: var(--color-brand-pressed); background: var(--color-brand-tint); border-radius: 6px; padding: 0 3px; }
.mention:hover { text-decoration: underline; }
.has-mention-box { position: relative; }
.mention-box { position: absolute; left: 0; top: 100%; z-index: 30; margin: 4px 0 0; padding: 4px; list-style: none; min-width: 220px; max-width: min(320px, calc(100vw - 32px)); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; box-shadow: 0 10px 28px rgba(16, 32, 39, .18); }
.mention-box.up { top: auto; bottom: 100%; margin: 0 0 4px; }
.mention-box li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.mention-box li[aria-selected="true"], .mention-box li:hover { background: var(--color-brand-tint); }

/* Offline */
.offline-banner { margin-bottom: 12px; }
.offline-toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; max-width: 528px; margin: 0 auto; box-shadow: 0 10px 28px rgba(16, 32, 39, .2); }
@media (min-width: 900px) { .offline-toast { bottom: 24px; } }

/* ---------- Dark mode: the few colors that aren't tokens ---------- */
@media (prefers-color-scheme: dark) {
  .card.dashed { border-color: #7a6420; background: #26200e; }
  .pill.neutral { background: #263038; }
  .spots { background: #2a333a; }
  .disclosure { background: #1e252b; }
  .match.played { border-color: #2e5a37; }
  .topbar { background: rgba(23, 29, 34, .88); }
  .bottomnav { background: rgba(23, 29, 34, .94); box-shadow: 0 -1px 0 rgba(0, 0, 0, .5); }
  .banner, .banner.warning, .banner.danger, .banner.success { border-color: rgba(255, 255, 255, .08); }
  input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(122, 180, 255, .25); }
  .btn { box-shadow: none; }
  .btn.secondary:hover { background: #1f272d; }
  .rsvp button[aria-pressed="true"].going { background: var(--color-success); }
  /* Group colors are picked for light backgrounds; tint them for dark ones. */
  .group-chip { background: color-mix(in srgb, var(--chip-fg) 30%, var(--color-surface)); color: color-mix(in srgb, var(--chip-fg) 30%, #ffffff); }
  .card.grouped { border-left-color: color-mix(in srgb, var(--chip-fg, var(--color-border)) 65%, #ffffff); }
  .side-groups .dot, .picker-menu .dot { filter: brightness(2.1) saturate(1.1); }
  .mention-box, .picker-menu, .consent-banner, .offline-toast { box-shadow: 0 12px 32px rgba(0, 0, 0, .6); }
}

/* Leaderboard */
.leaderboard td, .leaderboard th { white-space: nowrap; }
.leaderboard td:nth-child(2) { white-space: normal; min-width: 110px; }
.leaderboard tr.me td { background: var(--color-brand-tint); }
.leaderboard tr.leader .meta { font-weight: 400; }

/* Games: list/calendar switch + month calendar */
.list-tools { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.list-tools .group-filter { margin: 0; }
.list-tools .cal-toggle { margin-left: auto; white-space: nowrap; }
.month { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: 8px 8px 12px; margin-top: 8px; }
.month-head { display: flex; align-items: center; justify-content: space-between; }
.month-head .btn { font-size: 24px; min-width: 44px; padding: 0; }
.month-title { margin: 0; font-size: 17px; letter-spacing: 0; text-transform: none; color: var(--color-text); }
.month-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.month-grid th { font-size: 12px; font-weight: 700; color: var(--color-text-muted); padding: 6px 0; text-align: center; }
.month-grid td { padding: 2px; text-align: center; }
.month-grid .day { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; min-height: 48px; padding: 6px 0 4px; border-radius: 12px; color: var(--color-text); text-decoration: none; font-variant-numeric: tabular-nums; }
.month-grid .day:hover { background: var(--color-brand-tint); }
.month-grid .day.out { color: var(--color-text-muted); opacity: .55; }
.month-grid .day .num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 600; font-size: 15px; }
.month-grid .day.today .num { box-shadow: inset 0 0 0 2px var(--color-brand); color: var(--color-brand); font-weight: 800; }
.month-grid .day.selected .num { background: var(--color-brand-solid); color: #fff; box-shadow: none; }
.month-grid .day.going::after { content: "✓"; position: absolute; top: 2px; right: 4px; font-size: 11px; font-weight: 800; color: var(--color-success-text); }
.dots { display: flex; gap: 3px; align-items: center; min-height: 8px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--color-text-muted)); }
.dot.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dot, var(--color-text-muted)); }
.dot.pending { opacity: .5; }
.dot.asking { background: transparent; box-shadow: inset 0 0 0 1.5px #c99a1e; border-radius: 2px; }
.dots .more { font-size: 10px; font-weight: 700; color: var(--color-text-muted); line-height: 1; }
.month-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 6px 0; border-top: 1px solid var(--color-border); margin-top: 6px; }
.month-foot .legend { display: flex; align-items: center; gap: 6px; margin: 0; }
.month-foot .legend .dot { margin-left: 6px; }
.month-foot .going-mark { margin-left: 6px; color: var(--color-success-text); font-weight: 800; }
.month-foot .jump input[type=date] { width: auto; min-height: 40px; padding: 6px 8px; }
.day-list { margin-top: 4px; }
@media (prefers-color-scheme: dark) {
  .month-grid .day.going::after { color: var(--color-success-text); }
  .month-grid .dot, .month-foot .dot { filter: brightness(1.9); }
}

/* ---- UI once-over ---- */
.ic { display: inline-block; flex: none; vertical-align: -0.2em; }
.btn .ic { margin-right: 2px; }
.btn.small .ic { vertical-align: -0.18em; }
.bottomnav a .icon { display: inline-flex; align-items: center; justify-content: center; padding: 3px 16px; border-radius: 999px; transition: background .15s var(--ease); }
.bottomnav a[aria-current="page"] .icon { padding: 3px 16px; }
.bottomnav a[aria-current="page"] .ic { stroke-width: 2.4; }
.topbar .bell { position: relative; padding: 6px 8px; color: var(--color-text); }
.topbar .bell .badge { position: absolute; top: 1px; left: 22px; min-width: 16px; height: 16px; font-size: 10.5px; padding: 0 4px; border: 2px solid var(--color-surface); box-sizing: content-box; }
.side-nav .ic { color: var(--color-text-muted); }
.side-nav a[aria-current="page"] .ic { color: inherit; }
.side-admin { display: flex; align-items: center; gap: 6px; }
.empty .icon .ic { color: var(--color-text-muted); opacity: .7; }
.field[hidden] { display: none; }

/* Game rows: when first, the game's name under it, then where/status */
.game-row .when { display: block; font-size: 16px; line-height: 1.3; }
.game-row .game-title { display: block; font-size: 14px; color: var(--color-text); line-height: 1.3; }
.game-row.is-cancelled { opacity: .62; }
.game-row.is-cancelled .when { text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: var(--color-text-muted); }
.game-row.is-cancelled:hover { opacity: .85; }

/* Group page header + actions */
.group-head h1 { display: flex; align-items: baseline; gap: 10px; margin: 0; }
.group-head h1 .dot { width: 12px; height: 12px; flex: none; position: relative; top: -3px; }
.group-head + .home-actions { margin-top: 14px; }
.group-links { margin: 10px 0 4px; }
.label-color { margin-top: 28px; color: var(--color-text-muted); }
.label-color summary { cursor: pointer; }
.dot.lg { width: 12px; height: 12px; }
.group-list .list-row { gap: 14px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .group-head .dot, :root:not([data-theme="light"]) .group-list .dot { filter: brightness(2.1) saturate(1.1); }
}
.delete-why { margin: 8px 0 0; }
.manage-list form { margin: 0; }
.manage-row { width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.manage-list form + form .manage-row, .manage-list > * + form .manage-row, .manage-list form + .list-row { border-top: 1px solid var(--color-border); }
.manage-row:hover { background: var(--color-background); }
.danger-row strong { color: var(--color-danger-text); }
.dot.planned { background: transparent; border: 1.5px dashed var(--dot, var(--color-text-muted)); box-sizing: border-box; width: 8px; height: 8px; }
.planned-row { border-style: dashed; }
.planned-row.card.grouped { border-left-style: dashed; }
