:root {
  --bg: #0f0f12;
  --surface: #17171c;
  --surface2: #1e1e26;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent: #e8f542;
  --accent2: #42f5a7;
  --accent3: #f54285;
  --text: #f0f0f2;
  --muted: #7a7a8a;
  --danger: #f54242;
  --radius: 10px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}
html.light {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #f0f1f4;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --accent: #2563eb;
  --accent2: #059669;
  --accent3: #db2777;
  --text: #111827;
  --muted: #6b7280;
  --danger: #dc2626;
}
html.light .tag-yellow { background: rgba(37,99,235,0.1); color: #1d4ed8; }
html.light .tag-green { background: rgba(5,150,105,0.1); color: #047857; }
html.light .tag-red { background: rgba(220,38,38,0.1); color: #b91c1c; }
html.light .tag-blue { background: rgba(37,99,235,0.08); color: #1d4ed8; }
html.light .nav-item.active { background: rgba(37,99,235,0.08); color: var(--accent); }
html.light .btn-primary { background: var(--accent); color: #fff; }
html.light .btn-primary:hover { background: #1d4ed8; }
html.light .btn-secondary:hover { background: #e3e6ec; color: var(--text); border-color: var(--accent); }
html.light .btn-selected { background: rgba(37,99,235,0.1); color: var(--accent); border-color: rgba(37,99,235,0.3); }
html.light .btn-accent2 { background: rgba(5,150,105,0.1); color: var(--accent2); border-color: rgba(5,150,105,0.2); }
html.light .btn-accent2:hover { background: rgba(5,150,105,0.2); }
html.light .sidebar-logo .mark { color: var(--accent); }
html.light .alert-error { background: rgba(220,38,38,0.07); border-color: rgba(220,38,38,0.2); color: #b91c1c; }
html.light .alert-success { background: rgba(5,150,105,0.07); border-color: rgba(5,150,105,0.2); color: #047857; }
html.light .stat-badge .val { color: var(--accent); }
html.light .text-accent { color: var(--accent); }
html.light .standings-row.rank-1 td:first-child { color: var(--accent); }
html.light .standings-row.rank-2 td:first-child { color: var(--accent2); }
html.light input:focus, html.light select:focus, html.light textarea:focus { border-color: var(--accent); }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); min-height: 100vh; display: flex; }
#sidebar { width: 220px; min-height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100; }
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo .mark { font-family: var(--font-head); font-weight: 800; font-size: 18px; letter-spacing: -0.5px; color: var(--accent); }
.sidebar-logo .sub { font-size: 10px; color: var(--muted); font-family: var(--font-mono); letter-spacing: 0.08em; margin-top: 2px; }
.sidebar-nav { padding: 12px 8px; flex: 1; overflow-y: auto; }
.nav-section-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); padding: 8px 12px 4px; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 400; color: var(--muted); transition: all 0.15s; margin-bottom: 1px; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(232,245,66,0.1); color: var(--accent); font-weight: 500; }
.nav-item .icon { font-size: 15px; width: 18px; text-align: center; }
#main { margin-left: 220px; flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 28px; gap: 16px; position: sticky; top: 0; background: var(--bg); z-index: 50; }
.topbar-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; }
/* "?" beside the page title: help for the page you are on */
.help-btn { box-sizing: border-box; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; margin-left: -6px; border-radius: 50%; border: 1px solid var(--border2);
  background: var(--surface); color: var(--muted); font: 600 14px/1 var(--font-body); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s; }
.help-btn:hover, .help-btn:focus-visible { color: var(--accent); border-color: var(--accent); background: var(--surface2); outline: none; }
.modal.modal-help { width: 620px; }
.help-body { font-size: 13px; line-height: 1.65; }
.help-body p { margin-bottom: 12px; }
.help-body h4 { font-family: var(--font-head); font-size: 13px; margin: 4px 0 6px; }
.help-body ul { padding-left: 18px; margin-bottom: 12px; }
.help-body li { margin-bottom: 6px; }
.help-body .help-more { color: var(--muted); margin: 8px 0 0; }
.content { padding: 28px; flex: 1; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.card-title { font-family: var(--font-head); font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
/* the wide dialogs (club, class): more fields per row; .span-2 takes two columns */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }
.form-section { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border); padding-bottom: 5px; margin: 10px 0 12px; }
.grid-4, .grid-5 { align-items: end; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-bottom: 12px; }
@media (max-width: 760px) {
  .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat-badge { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.stat-badge .val { font-family: var(--font-mono); font-size: 26px; font-weight: 500; color: var(--accent); line-height: 1; }
.stat-badge .lbl { font-size: 11px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.06em; }
button, .btn { cursor: pointer; border: none; font-family: var(--font-body); font-size: 13px; font-weight: 500; border-radius: 7px; padding: 8px 16px; transition: all 0.15s; }
button:disabled, .btn:disabled { cursor: not-allowed; opacity: 0.45; filter: grayscale(0.6); }
.btn-primary { background: var(--accent); color: #0f0f12; }
.btn-primary:hover { background: #f0ff50; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { background: #2a2a35; border-color: var(--accent); }
.btn-selected { background: rgba(232,245,66,0.15); color: var(--accent); border: 1px solid rgba(232,245,66,0.3); }
.btn-danger { background: rgba(245,66,66,0.15); color: var(--danger); border: 1px solid rgba(245,66,66,0.2); }
.btn-danger:hover { background: rgba(245,66,66,0.25); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }
.btn-accent2 { background: rgba(66,245,167,0.15); color: var(--accent2); border: 1px solid rgba(66,245,167,0.2); }
.btn-accent2:hover { background: rgba(66,245,167,0.25); }
.btn-sm { padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); }
input, select, textarea { width: 100%; background: var(--surface2); border: 1px solid var(--border2); border-radius: 7px; color: var(--text); font-family: var(--font-body); font-size: 13px; padding: 9px 12px; transition: border-color 0.15s; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface2); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 8px 12px; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.data-table .num { font-family: var(--font-mono); }
.select-search { margin-bottom: 6px; font-size: 12.5px; }
.club-tag { color: var(--muted); font-size: 11.5px; font-weight: 400; white-space: nowrap; }
.match-no { font-family: var(--font-mono); font-size: 11px; color: var(--muted); background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.match-find { display: flex; gap: 6px; align-items: center; } .match-find input { width: 110px; font-size: 12px; }
.results-standings { margin-bottom: 14px; }
.results-show { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.table-select { width: auto; min-width: 58px; padding: 4px 8px; font-size: 12px; }
.match-located { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.club-thumb { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; margin-right: 8px; border-radius: 4px; background: #fff; }
.logo-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-edit input[type=file] { width: auto; flex: 1; min-width: 0; }
.logo-edit img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sortable[data-dir]::after { content: ' ▲'; font-size: 9px; } th.sortable[data-dir="desc"]::after { content: ' ▼'; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.player-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.player-link:hover { color: var(--accent); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-family: var(--font-mono); }
.tag-green { background: rgba(66,245,167,0.12); color: var(--accent2); }
.tag-yellow { background: rgba(232,245,66,0.12); color: var(--accent); }
.tag-red { background: rgba(245,66,66,0.12); color: var(--danger); }
.tag-blue { background: rgba(66,142,245,0.12); color: #6ab0f5; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 16px; font-size: 13px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; transition: all 0.15s; background: none; border-radius: 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border2); border-radius: 14px; padding: 24px; width: 520px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
.modal-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.page { display: none; }
.page.active { display: block; }
.match-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; margin-bottom: 10px; }
.match-players { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.match-player { flex: 1; font-weight: 500; font-size: 13px; }
.match-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.match-vs { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }
.empty-state .icon { font-size: 32px; margin-bottom: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--muted); }
.text-mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 12px; }
.alert { padding: 10px 14px; border-radius: 7px; font-size: 12px; margin-bottom: 12px; }
.alert-error { background: rgba(245,66,66,0.1); border: 1px solid rgba(245,66,66,0.2); color: #f88; }
.alert-success { background: rgba(66,245,167,0.1); border: 1px solid rgba(66,245,167,0.2); color: var(--accent2); }
.standings-row.rank-1 td:first-child { color: var(--accent); }
.standings-row.rank-2 td:first-child { color: var(--accent2); }

/* ── Quick-add inline panel ── */
.field-with-action { display: flex; gap: 6px; align-items: flex-start; }
.field-with-action select,
.field-with-action input { flex: 1; min-width: 0; }
.btn-quickadd {
  flex-shrink: 0;
  width: 34px; height: 34px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 0;
  line-height: 1;
}
.btn-quickadd:hover { color: var(--accent); border-color: var(--accent); background: var(--surface2); }
html.light .btn-quickadd:hover { color: var(--accent); border-color: var(--accent); }
.quickadd-panel {
  display: none;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 9px;
  padding: 14px;
  margin-top: 8px;
}
.quickadd-panel.open { display: block; }
.quickadd-panel-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quickadd-panel-title button {
  background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 0; line-height: 1;
}
.quickadd-panel-title button:hover { color: var(--text); }
/* ── Auth screens ── */
.auth-overlay { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 300; align-items: center; justify-content: center; padding: 16px; }
.auth-overlay.open { display: flex; }
.auth-card { background: var(--surface); border: 1px solid var(--border2); border-radius: 14px; padding: 28px; width: 400px; max-width: 100%; }
.auth-card .mark { font-family: var(--font-head); font-weight: 800; font-size: 20px; color: var(--accent); margin-bottom: 4px; }
.auth-card .intro { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.6; }
.auth-card form { display: none; }
.auth-card form.active { display: block; }
.auth-card .btn-primary { width: 100%; padding: 10px; margin-top: 6px; }
.user-chip { font-size: 12px; color: var(--muted); white-space: nowrap; }
.user-chip strong { color: var(--text); font-weight: 500; }
.quickadd-success {
  font-size: 12px;
  color: var(--accent2);
  margin-top: 6px;
  display: none;
}

/* Groups page: the group's matches, folded away by default */
.group-matches { margin-top: 10px; }
.group-matches summary { cursor: pointer; padding: 4px 0; user-select: none; }
.group-matches table { margin-top: 6px; }

/* Registration dialog: search and add on the left, the class's entries on the right */
.modal.modal-wide { width: 880px; }
.reg-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .reg-columns { grid-template-columns: 1fr; } }
.reg-list { background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px; height: 330px; overflow-y: auto; }
.reg-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.reg-row:last-child { border-bottom: 0; }
.reg-row .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-row.add { cursor: pointer; } .reg-row.add:hover, .reg-row.hl { background: var(--accent-soft, rgba(232,245,66,.1)); }
.reg-row.done { opacity: .55; cursor: default; }
.reg-list .note { padding: 10px; color: var(--muted); font-size: 12px; }
.reg-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); text-transform: none; letter-spacing: 0; }
.reg-check input { width: auto; }
#reg-pending .alert { margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; }

/* Knockout tree on the Knockout page: the print layout in the theme's colours; wide brackets scroll sideways */
.bracket-view { overflow-x: auto; padding-bottom: 6px; }
.bracket-view .bk { --bk-fg: var(--text); --bk-bg: var(--surface2); --bk-muted: var(--muted); --bk-soft: var(--border); --bk-line: var(--border2);
  --bk-gap: 28px; font-size: 12px; min-width: max-content; }
.bracket-view .bk-col { width: 300px; flex: none; }
.bracket-view .bk-head > div { width: 300px; flex: none; font-size: 13px; font-family: var(--font-head); border-bottom-color: var(--border2); }
.bracket-view .bk-m { border-radius: 7px; overflow: visible; }
.bracket-view .bk-m .meta { font-size: 10.5px; padding: 3px 8px; font-family: var(--font-mono); }
.bracket-view .bk-m .n small { font-size: 10.5px; }
.bracket-view .bk-m .win { color: var(--accent); }
.bracket-view .bk-m.click { cursor: pointer; transition: border-color .15s; }
.bracket-view .bk-m.click:hover { border-color: var(--accent); }
.bracket-view .bk-champ { border-radius: 9px; border-color: var(--accent); padding: 10px; }
.bracket-view .bk-champ strong { font-size: 15px; color: var(--accent); }
.bracket-view .bk-note { font-size: 11.5px; }
/* on screen: wide rounds (the tree scrolls sideways), whole names with the club below, and each set's points */
.bracket-view .bk-m .ss { display: none; }
.bracket-view .bk-m .row { white-space: normal; align-items: center; gap: 8px; padding: 5px 8px; }
.bracket-view .bk-m .n { flex: 1; min-width: 0; overflow: visible; overflow-wrap: anywhere; line-height: 1.3; }
.bracket-view .bk-m .n small { display: block; }
.bracket-view .bk-m .pts { display: flex; gap: 2px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.bracket-view .bk-m .pts i { font-style: normal; width: 19px; text-align: center; }
.bracket-view .bk-m .pts i.w { color: var(--text); font-weight: 600; }
.bracket-view .bk-m .sets { min-width: 14px; text-align: right; font-size: 13px; }

/* ── Topbar tools, menu button ── */
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.comp-picker { position: relative; }
#competition-selector { width: 240px; font-size: 12px; padding: 6px 10px; text-overflow: ellipsis; }
.comp-list { position: absolute; top: calc(100% + 4px); right: 0; width: 340px; max-width: calc(100vw - 32px); max-height: min(420px, 65vh);
  overflow-y: auto; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  z-index: 60; padding: 4px 0; }
.comp-list .cl-group { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 3px; }
.comp-list .cl-item { padding: 6px 12px; cursor: pointer; line-height: 1.3; }
.comp-list .cl-item .cl-name { font-size: 13px; }
.comp-list .cl-item .cl-meta { font-size: 11.5px; color: var(--muted); }
.comp-list .cl-item.active { background: var(--surface2); }
.comp-list .cl-item.current .cl-name { font-weight: 600; color: var(--accent); }
.comp-list .cl-empty { padding: 10px 12px; color: var(--muted); font-size: 12.5px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; flex: none; width: 38px; height: 38px; padding: 0; margin-left: -6px; font-size: 20px; line-height: 1;
  background: transparent; color: var(--text); border: 1px solid var(--border2); border-radius: 8px; }
.menu-backdrop { display: none; }
.set-input { width: 60px; text-align: center; }

/* ── Small screens (tablet, phone): the menu slides in from ☰, the topbar's buttons sit at the bottom of the menu ── */
@media (max-width: 900px) {
  #sidebar { min-height: 0; height: 100%; height: 100dvh; width: 270px; max-width: 85vw; transform: translateX(-100%);
    transition: transform .2s ease; z-index: 150; box-shadow: none; }
  body.menu-open #sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  body.menu-open .menu-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 140; }
  .sidebar-nav { flex: 1 1 auto; min-height: 0; }
  .sidebar-footer { flex: none; border-top: 1px solid var(--border); padding: 12px; }
  .sidebar-footer .topbar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .sidebar-footer .topbar-actions .btn { width: 100%; padding: 9px 10px; }
  .sidebar-footer .user-chip { grid-column: 1 / -1; order: -1; padding: 2px 4px 4px; white-space: normal; }
  #main { margin-left: 0; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: 8px 16px; gap: 8px 12px; }
  .topbar-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .help-btn { margin-left: 0; }
  .topbar-tools { margin-left: 0; flex-basis: 100%; }
  .comp-picker, #competition-selector { width: 100%; }
  .comp-list { left: 0; width: auto; max-width: none; }
  .content { padding: 16px; }
  /* 16px stops phones from zooming in when a field gets focus */
  input, select, textarea { font-size: 16px; }
  #competition-selector { font-size: 16px; padding: 8px 10px; }
}
@media (min-width: 901px) { .sidebar-footer { display: none; } }

/* ── Phone ── */
@media (max-width: 640px) {
  .card { padding: 14px; }
  /* page toolbars: the pickers take the whole width, the buttons wrap below */
  .card-header > .flex { flex-wrap: wrap; width: 100%; }
  .card-header select, .card > .flex > select { width: 100% !important; flex: 1 1 100%; font-size: 16px !important; }
  .flex, .flex-between, .match-located { flex-wrap: wrap; gap: 8px; }
  .match-players { flex-wrap: wrap; gap: 6px 10px; }
  .match-player { min-width: 0; }
  .match-actions { flex: 1 1 100%; margin-left: 0; flex-wrap: wrap; }
  .match-actions .btn-secondary { margin-left: auto; }
  .match-find { flex: 1 1 100%; } .match-find input { flex: 1; width: auto; font-size: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; } .tab { white-space: nowrap; }
  /* dialogs fill the screen, the buttons stay at the bottom */
  .modal-overlay { align-items: stretch; }
  .modal, .modal.modal-wide, .modal.modal-help { width: 100%; max-width: none; max-height: none; height: 100%; height: 100dvh;
    border-radius: 0; border: 0; padding: 16px; }
  .modal-footer { position: sticky; bottom: -16px; margin: 20px -16px -16px; padding: 12px 16px; background: var(--surface); flex-wrap: wrap; }
  .modal-close { font-size: 26px; padding: 4px 8px; margin-right: -8px; }
  .set-input { width: 72px; height: 44px; font-size: 20px; }
  .reg-list { height: 260px; }
  /* lists: each row a card with the column headings beside the values */
  .data-table:not(.scroll-sm) thead { display: none; }
  .data-table:not(.scroll-sm), .data-table:not(.scroll-sm) tbody { display: block; width: 100%; }
  .data-table:not(.scroll-sm) tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px;
    border: 1px solid var(--border2); border-radius: 9px; padding: 10px 12px; margin-bottom: 10px; }
  .data-table:not(.scroll-sm) tr:hover td { background: none; }
  .data-table:not(.scroll-sm) td { border: 0; padding: 0; text-align: left !important; white-space: normal !important; min-width: 0; overflow-wrap: anywhere; }
  .data-table:not(.scroll-sm) td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 1px;
    font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* the first column names the row: the card's title, across the card */
  .data-table:not(.scroll-sm) td:first-child { grid-column: 1 / -1; font-weight: 500; font-size: 14px; }
  .data-table:not(.scroll-sm) td:first-child::before { display: none; }
  .data-table:not(.scroll-sm) td[data-blank] { display: none; }
  /* the cell without a heading holds the row's buttons, across the card */
  .data-table:not(.scroll-sm) td:not([data-label]) { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
  .data-table:not(.scroll-sm) td:not([data-label]) > * { margin: 0 !important; }
  /* standings and places keep their columns and scroll sideways */
  .data-table.scroll-sm { display: block; overflow-x: auto; white-space: nowrap; }
  .data-table.scroll-sm th, .data-table.scroll-sm td { padding: 8px 8px; }
}

/* fingers need bigger targets than a mouse */
@media (pointer: coarse) {
  .btn-sm { padding: 8px 12px; }
  .nav-item { padding: 12px; }
  .help-btn { width: 32px; height: 32px; }
}
