/* Gladiator Gang FC — shared styles
   Two themes on one set of colour tokens:
   • dark  (default) — the club's black + blood red
   • light — cool white with royal blue and teal
   Switched by <html data-theme="dark|light"> (see theme.js). */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@400;500;600;700;800&display=swap');

/* ---------- Tokens ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0a0a;
  --bg-glow: rgba(224, 32, 43, 0.11);
  --surface: #151112;
  --surface-2: #1b1516;
  --input-bg: #100d0d;
  --line: #2b1c1d;
  --line-strong: #43292b;

  --text: #f5f1ea;
  --text-2: #d3ccc5;
  --text-3: #968d87;

  --primary: #e0202b;
  --primary-hover: #c41922;
  --primary-ink: #ffffff;
  --primary-soft: rgba(224, 32, 43, 0.15);
  --accent: #ff6a3d;

  --ok: #4fb26a;
  --ok-soft: rgba(79, 178, 106, 0.14);
  --warn: #e0a93b;
  --warn-soft: rgba(224, 169, 59, 0.14);
  --bad: #ff5a63;
  --bad-soft: rgba(255, 90, 99, 0.14);

  --header-bg: rgba(21, 17, 18, 0.86);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --focus: rgba(224, 32, 43, 0.35);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fc;
  --bg-glow: rgba(43, 89, 230, 0.10);
  --surface: #ffffff;
  --surface-2: #f6f8fd;
  --input-bg: #f7f9fe;
  --line: #e2e8f4;
  --line-strong: #cbd5ea;

  --text: #0e1a35;
  --text-2: #3b4868;
  --text-3: #66748f;

  --primary: #2b59e6;
  --primary-hover: #2147c4;
  --primary-ink: #ffffff;
  --primary-soft: rgba(43, 89, 230, 0.10);
  --accent: #0fb5a6;

  --ok: #0c9b57;
  --ok-soft: rgba(12, 155, 87, 0.11);
  --warn: #b97300;
  --warn-soft: rgba(217, 139, 6, 0.13);
  --bad: #d92b39;
  --bad-soft: rgba(217, 43, 57, 0.10);

  --header-bg: rgba(255, 255, 255, 0.90);
  --shadow: 0 14px 34px rgba(28, 52, 110, 0.10);
  --shadow-sm: 0 1px 4px rgba(28, 52, 110, 0.08);
  --focus: rgba(43, 89, 230, 0.28);
}

:root {
  /* Older inline styles and scripts still use these names. */
  --black: var(--bg);
  --black-2: var(--input-bg);
  --panel: var(--surface);
  --panel-line: var(--line);
  --chrome: var(--text-2);
  --chrome-dim: var(--text-3);
  --off-white: var(--text);
  --blood: var(--primary);
  --blood-dark: var(--primary-hover);
  --ok-dim: var(--ok-soft);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html, body { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(ellipse 900px 480px at 12% -6%, var(--bg-glow), transparent 62%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, h4 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
  color: var(--text);
}
h3 { font-weight: 700; letter-spacing: -0.01em; }

/* Scoreboard voice: the condensed face is kept for the hero and for numbers. */
.display {
  font-family: 'Anton', 'Impact', sans-serif;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1.02;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.ico-svg { display: block; flex-shrink: 0; }
i[data-icon] { display: inline-flex; font-style: normal; line-height: 0; }

/* ---------- Header ---------- */
.nav {
  position: sticky;
  top: 10px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 1100px;
  margin: 12px auto 0;
  width: calc(100% - 24px);
  padding: 9px 12px 9px 16px;
  background: var(--header-bg);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.nav .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: 'Anton', 'Impact', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text);
}

.nav .brand .crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: 0 6px 16px var(--primary-soft);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-3);
  transition: background .15s ease, color .15s ease;
}
.nav-links a .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.current { color: var(--primary); background: var(--primary-soft); }

.nav-tools { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  box-shadow: none;
  cursor: pointer;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft); }
.menu-btn { display: none; }

/* ---------- Layout ---------- */
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 32px) 90px;
}

.narrow {
  max-width: 440px;
  margin: 56px auto;
  padding: 30px clamp(20px, 5vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: calc(100% - 32px);
}

.page > h2:first-child,
.narrow > h2:first-child { letter-spacing: -0.025em; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 26px;
  margin-bottom: 18px;
}
.panel-tight { padding: 12px 12px; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.panel-title h3 { font-size: 1.05rem; color: var(--text); }
.chip-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 7px;
}

input, select {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.96rem;
  margin-bottom: 18px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--text-3); opacity: 0.8; }
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
}
input[type="file"] { padding: 9px 12px; font-size: 0.88rem; }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.field-row { display: flex; gap: 16px; }
.field-row > div { flex: 1; min-width: 0; }

.avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.avatar-row > div { flex: 1; min-width: 0; }
.avatar-preview {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-soft);
  outline: 2px solid var(--primary);
  outline-offset: 0;
  flex-shrink: 0;
}
.avatar-row label { margin-bottom: 4px; }
.avatar-row input[type="file"] { margin-bottom: 0; }
.avatar-sm {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-soft);
  flex-shrink: 0;
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: var(--primary-ink);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 18px var(--primary-soft);
  transition: background .15s ease, transform .1s ease, border-color .15s ease, color .15s ease;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

button.secondary, .btn.secondary {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text-2);
  box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}

button.danger, .btn.danger {
  background: transparent;
  border-color: var(--bad);
  color: var(--bad);
  box-shadow: none;
}
button.danger:hover, .btn.danger:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.btn-sm { padding: 8px 14px; font-size: 0.8rem; border-radius: 10px; }

/* ---------- Messages ---------- */
.msg {
  display: none;
  padding: 13px 16px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bad-soft);
  border-left: 4px solid var(--bad);
  background: var(--bad-soft);
  color: var(--text);
}
.msg.show { display: block; }
.msg.ok {
  border-color: var(--ok-soft);
  border-left-color: var(--ok);
  background: var(--ok-soft);
}

/* ---------- Lists ---------- */
.row-list { border-top: 1px solid var(--line); }
.row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
}
.row-item:last-child { border-bottom: 0; }
.row-item .name { font-weight: 700; color: var(--text); }
.row-item .meta { color: var(--text-3); font-size: 0.86rem; margin-top: 2px; }

.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--bad-soft);
  color: var(--bad);
  text-transform: capitalize;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.pending, .pill.registration { background: var(--warn-soft); color: var(--warn); }
.pill.approved, .pill.completed { background: var(--ok-soft); color: var(--ok); }
.pill.rejected, .pill.cancelled { background: var(--bad-soft); color: var(--bad); }
.pill.in_progress, .pill.awaiting_approval { background: var(--primary-soft); color: var(--primary); }
.pill.bye, .pill.member { background: var(--surface-2); color: var(--text-3); border-color: var(--line); }
.pill.admin { background: var(--primary); color: var(--primary-ink); }
.pill.admin::before { background: var(--primary-ink); }
.pill.owner { background: var(--warn); color: #1a1204; }
.pill.owner::before { background: #1a1204; }

.conflict-note {
  display: block;
  font-size: 0.78rem;
  color: var(--warn);
  margin-top: 4px;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 8px 6px;
  -webkit-overflow-scrolling: touch;
}
.panel-tight .table-wrap { border: 0; border-radius: 12px; padding: 0 4px; background: transparent; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px;
}
.table th, .table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  white-space: nowrap;
  background: var(--surface);
}
.table tr:last-child td { border-bottom: 0; }
.table th {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 700;
  background: var(--surface);
}
.table td.num, .table th.num { text-align: center; }
.table td.player { font-weight: 700; color: var(--text); }
.table td.pts { font-weight: 800; color: var(--text); }
.table tbody tr:hover td { background: var(--surface-2); }

/* Rank number as a small badge; the first three get medal tones. */
.table td.rank {
  font-family: 'Anton', 'Impact', sans-serif;
  font-size: 1rem;
  color: var(--text-3);
  width: 52px;
}
.table td.rank .rk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.table tbody tr:nth-child(1) td.rank .rk { background: #f5c542; border-color: #f5c542; color: #3a2b00; }
.table tbody tr:nth-child(2) td.rank .rk { background: #cfd6e2; border-color: #cfd6e2; color: #26314a; }
.table tbody tr:nth-child(3) td.rank .rk { background: #d9955a; border-color: #d9955a; color: #3a1c04; }

.table .who { display: inline-flex; align-items: center; gap: 10px; }
.player-link { color: inherit; text-decoration: none; }
.player-link:hover { color: var(--primary); text-decoration: underline; }

.av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* On phones, keep rank + player in view while the table scrolls sideways.
   Opt in with class="table sticky-2" (first two columns are rank + player).
   The player column is capped and truncates with an ellipsis so a long name
   or badge can never push the key stat column off screen. */
@media (max-width: 760px) {
  .table th, .table td { padding: 11px 7px; }
  .hide-m { display: none; }
  .table { min-width: 0; width: 100%; }
  .table.sticky-2 .av { display: none; }
  .table.sticky-2 th:nth-child(1), .table.sticky-2 td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 46px;
    min-width: 46px;
    padding-left: 6px;
    padding-right: 6px;
  }
  .table.sticky-2 th:nth-child(2), .table.sticky-2 td:nth-child(2) {
    position: sticky;
    left: 46px;
    z-index: 2;
    box-shadow: 6px 0 8px -6px rgba(0, 0, 0, 0.25);
    max-width: 44vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .table.sticky-2 .who {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .table.sticky-2 .who > .player-link,
  .table.sticky-2 .who > .pname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
  }
  .table.sticky-2 .who > .prov-dot { flex-shrink: 0; }
}

/* Small settled/unsettled indicator for ratings still building up sample
   size — deliberately tiny so it never competes for row width. */
.prov-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  min-width: 7px;
  border-radius: 50%;
  background: var(--text-3);
  cursor: help;
}

.muted { color: var(--text-3); }
.center { text-align: center; }
.spacer { height: 32px; }

/* ---------- Tournament cards ---------- */
.tourney-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tourney-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.tourney-card .tc-body { flex: 1; min-width: 0; }
.tourney-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tourney-card h3 { font-size: 1.08rem; }
.tourney-card .meta { color: var(--text-3); font-size: 0.87rem; margin-top: 7px; }
.tourney-card .go { color: var(--text-3); }
.tourney-card:hover .go { color: var(--primary); }

/* ---------- Bracket ---------- */
.bracket-wrap { overflow-x: auto; padding-bottom: 10px; }
.bracket { display: flex; gap: 28px; min-width: max-content; }
.bracket-round { display: flex; flex-direction: column; gap: 16px; min-width: 240px; }
.bracket-round-title {
  font-size: 0.82rem;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: 2px;
}
.match-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  box-shadow: var(--shadow-sm);
}
.match-card .slot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.9rem;
}
.match-card .slot.winner { color: var(--text); font-weight: 800; }
.match-card .slot.loser { color: var(--text-3); }
.match-card .match-status { margin-top: 8px; }
.match-card .submit-inline { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.match-card .submit-inline .field-row input { margin-bottom: 10px; }

/* ---------- Scoreboard ---------- */
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  gap: 12px;
}
.scoreboard .team { text-align: center; flex: 1; }
.scoreboard .team .crest-mini {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  margin: 0 auto 8px;
}
.scoreboard .team .name { font-size: 0.82rem; font-weight: 700; }
.scoreboard .mid {
  font-family: 'Anton', 'Impact', sans-serif;
  font-size: 1.5rem;
  color: var(--primary);
  padding: 0 10px;
}

/* ---------- Admin collapsible panels ---------- */
.tourney-admin-panel { padding: 0; overflow: hidden; }
.tourney-admin-panel > summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tourney-admin-panel > summary::-webkit-details-marker { display: none; }
.tourney-admin-panel > summary .name { font-weight: 700; font-size: 1.05rem; }
.tourney-admin-panel[open] > summary { border-bottom: 1px solid var(--line); }
.tourney-admin-panel .body { padding: 0 24px 24px; }
.tourney-admin-panel .body h4 {
  font-size: 0.86rem;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: 0;
  margin: 22px 0 8px;
}

/* ---------- Page heading (icon + title + one-line description) ---------- */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}
.page-head .chip-ico { width: 46px; height: 46px; border-radius: 14px; }
.page-head h2 { font-size: clamp(1.45rem, 4.5vw, 1.9rem); }
.page-head p { margin: 3px 0 0; color: var(--text-3); font-size: 0.93rem; }

/* ---------- Home hero ---------- */
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.accent { color: var(--primary); }

.hero { padding: 34px 0 8px; }
.hero h1 { font-size: clamp(2.7rem, 9vw, 5.2rem); }
.hero p.lead {
  color: var(--text-2);
  font-size: 1.1rem;
  max-width: 520px;
  margin: 18px 0 0;
}
.hero .cta-row { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 34px 0 8px;
}
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.tile .chip-ico { margin-bottom: 14px; }
.tile h3 { font-size: 1.02rem; margin-bottom: 4px; }
.tile p { margin: 0; color: var(--text-3); font-size: 0.9rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 34px 0 14px;
}
.section-head h2 { font-size: 1.25rem; }
.section-head a { color: var(--primary); font-weight: 700; font-size: 0.9rem; text-decoration: none; }

/* ---------- Stat tiles + form badges (dashboard) ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}
.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
}
.stat .num {
  display: block;
  font-family: 'Anton', 'Impact', sans-serif;
  font-size: 1.8rem;
  line-height: 1.1;
  color: var(--text);
}
.stat .lbl { display: block; margin-top: 4px; font-size: 0.78rem; font-weight: 600; color: var(--text-3); }
.stat.hi { background: var(--primary-soft); border-color: transparent; }
.stat.hi .num { color: var(--primary); }

.form-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.form-row .lbl { font-size: 0.82rem; font-weight: 600; color: var(--text-3); }
.form-badges { display: inline-flex; gap: 6px; }
.fb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
}
.fb.W { background: var(--ok); }
.fb.D { background: var(--warn); }
.fb.L { background: var(--bad); }

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .stat.hi { grid-column: 1 / -1; }
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 28px 20px 36px;
  color: var(--text-3);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

/* ---------- Admin + tournament tab bars (pill style) ---------- */
.admin-subnav,
.tourney-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 24px;
  border: 0;
}
.tourney-tabs { margin-top: 22px; }

.admin-subnav a,
.tourney-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.admin-subnav a:hover,
.tourney-tabs button:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-strong);
  transform: none;
}
.admin-subnav a.active,
.tourney-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

/* Search box on the admin members page */
#memberSearch { margin-bottom: 8px; }

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .nav { padding: 8px 10px 8px 14px; top: 8px; margin-top: 8px; width: calc(100% - 16px); }
  .nav .brand { font-size: 1.05rem; }
  .menu-btn { display: inline-flex; }

  /* Links collapse into a dropdown card opened by the menu button. */
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    font-size: 1rem;
  }
  .nav.open .nav-links { display: flex; }
  .nav-links a { padding: 12px 12px; gap: 14px; }
  .nav-links a .ico {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-2);
  }
  .nav-links a.current .ico { background: var(--primary); color: var(--primary-ink); }

  .page { padding: 24px 16px 70px; }
  .narrow { margin: 28px auto; }
  .panel { padding: 20px 16px; border-radius: 16px; }

  .field-row { flex-direction: column; gap: 0; }

  .row-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .row-actions { width: 100%; justify-content: flex-start; }

  .scoreboard { flex-wrap: wrap; }
  .tourney-card { padding: 16px; }
  .hero { padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
