/* Tonament brand: see docs/BRAND.md.
   Deep Navy #0B1220 · Electric Lime #A3E635 · Slate #475569 · Mist #E5E7EB · Outfit.
   Dark is the default theme; light applies when <html data-theme="light">
   (set before first paint by the snippet in index.html). */

@font-face {
  font-family: 'Outfit';
  src: url('/fonts/Outfit-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* brand constants (same in both themes) */
  --navy: #0B1220;
  --lime: #A3E635;
  --slate: #475569;
  --mist: #E5E7EB;

  /* dark theme (default) */
  --bg: #0B1220;
  --surface: #111A2E;
  --surface-2: #18233A;
  --text: #E5E7EB;
  --muted: #94A3B8;
  --border: #24314B;
  --accent: var(--lime);          /* fills: buttons, bars, dots */
  --on-accent: var(--navy);       /* text on an accent fill */
  --accent-text: var(--lime);     /* accent-coloured text on --bg/--surface */
  --accent-soft: rgba(163, 230, 53, 0.13);
  --link: var(--lime);
  --side-a: var(--lime);
  --on-side-a: var(--navy);
  --side-b: var(--slate);
  --on-side-b: #F1F5F9;
  --live: #F87171;
  --live-soft: rgba(248, 113, 113, 0.14);
  --danger: #F87171;
  --header: var(--navy);
  --header-border: #1C2740;
  --scoreboard: #070C17;
  --toast: #E5E7EB;
  --on-toast: var(--navy);
  --radius: 14px;
  --shadow: none;
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #EEF0F3;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text: var(--navy);
  --muted: var(--slate);
  --border: #D5DAE1;
  --accent-text: #3F6212;         /* lime is unreadable as text on white; use deep olive */
  --accent-soft: #ECFCCB;
  --link: var(--navy);
  --live: #B91C1C;
  --live-soft: #FDE5E5;
  --danger: #B91C1C;
  --header-border: var(--navy);
  --scoreboard: var(--navy);
  --toast: var(--navy);
  --on-toast: #FFFFFF;
  --shadow: 0 1px 2px rgba(11, 18, 32, 0.05), 0 2px 8px rgba(11, 18, 32, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-underline-offset: 2px; }
:root[data-theme='light'] a { text-decoration-thickness: 1px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5rem; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 16px; flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.eyebrow { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }

/* ---------- top bar: navy in both themes, as in the brand mockups */
.topbar { background: var(--header); border-bottom: 1px solid var(--header-border); position: sticky; top: 0; z-index: 10; color: #fff; }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 26px; width: auto; display: block; }
@media (max-width: 400px) { .brand img { height: 20px; } }
.topbar .nav-link { color: #fff; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); }

.footer { border-top: 1px solid var(--border); margin-top: 24px; }
.footer-inner { max-width: 1040px; margin: 0 auto; padding: 22px 16px 32px; display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { height: 22px; }
.footer .eyebrow { font-size: 0.68rem; }
.footer .eyebrow b { color: var(--accent-text); font-weight: 600; }

/* theme switch */
.theme-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; gap: 2px; }
.theme-switch button {
  font: inherit; font-size: 0.78rem; font-weight: 600; border: 0; background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.theme-switch button[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); }

/* ---------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 9px 16px; border-radius: 10px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  min-height: 40px;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }
:root[data-theme='light'] .btn-primary, :root[data-theme='light'] .btn-primary:hover { border-color: #65A30D; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: currentColor; background: transparent; }
.btn-small { padding: 5px 12px; min-height: 34px; font-size: 0.875rem; }
.btn-lg { padding: 12px 22px; font-size: 1.05rem; }
.icon-btn {
  font: inherit; border: 1px solid transparent; background: transparent; color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.label { font-weight: 600; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.8rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; width: 100%;
}
:root[data-theme='light'] input, :root[data-theme='light'] select, :root[data-theme='light'] textarea { background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
:root[data-theme='light'] :is(input, select, textarea, .btn, .icon-btn, a, button):focus-visible { outline-color: var(--navy); }
textarea { resize: vertical; min-height: 96px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.grid-2, .grid-3 { display: grid; gap: 12px; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.formats { display: grid; gap: 8px; }
.format-option {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.format-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.format-option input { width: auto; margin-top: 4px; accent-color: var(--lime); }
.format-option small { display: block; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; }

/* ---------- cards & lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-list { display: grid; gap: 12px; }
@media (min-width: 640px) { .card-list { grid-template-columns: 1fr 1fr; } }
.t-card { display: block; text-decoration: none; color: inherit; margin: 0; }
.t-card:hover { border-color: var(--accent); }
.t-card h3 { margin-bottom: 4px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }
.section { margin-bottom: 28px; }
.section > h2 { display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill.live { background: var(--live-soft); color: var(--live); }
.pill.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; animation: blink 1.4s infinite; }
.pill.done, .pill.completed, .pill.org { background: var(--accent-soft); color: var(--accent-text); }
.pill.league, .pill.knockout { background: rgba(71, 85, 105, 0.35); color: var(--text); }
:root[data-theme='light'] .pill.league, :root[data-theme='light'] .pill.knockout { background: #E2E8F0; color: var(--slate); }
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- home hero: navy with lime diagonals in both themes */
.hero {
  position: relative; overflow: hidden; color: #E5E7EB; border-radius: 20px; margin: 8px 0 28px;
  padding: clamp(28px, 6vw, 56px) clamp(20px, 5vw, 48px);
  background:
    var(--hero-image, none) right center / cover no-repeat,
    linear-gradient(115deg, transparent 0 74%, var(--lime) 74% 77.5%, transparent 77.5% 82%, rgba(163, 230, 53, 0.35) 82% 83%, transparent 83%),
    radial-gradient(circle at 85% 20%, #1B2740 0, var(--navy) 65%);
  border: 1px solid #1C2740;
}
.hero > * { position: relative; max-width: 34rem; }
.hero .eyebrow { color: #CBD5E1; line-height: 1.9; margin-bottom: 14px; }
.hero .eyebrow b { color: var(--lime); font-weight: 600; }
.hero h1 { font-size: clamp(2rem, 6.5vw, 3.2rem); letter-spacing: -0.02em; margin-bottom: 14px; color: #fff; }
.hero h1 .accent { color: var(--lime); }
.hero .lead { color: #CBD5E1; }
.hero .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.4); }
.hero .btn-ghost:hover { border-color: #fff; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 40em; margin-bottom: 22px; }
.features { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.features li { border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; color: #E5E7EB; background: rgba(255, 255, 255, 0.04); }
@media (max-width: 640px) {
  .hero { background:
    linear-gradient(115deg, transparent 0 86%, var(--lime) 86% 89.5%, transparent 89.5%),
    radial-gradient(circle at 85% 20%, #1B2740 0, var(--navy) 65%); }
}

/* ---------- tournament */
.t-header { margin: 8px 0 12px; }
.t-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.t-title h1 { margin: 0; }
.conn { font-size: 0.8rem; white-space: nowrap; }
.conn::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--muted); }
.conn.on::before { background: var(--lime); box-shadow: 0 0 0 3px var(--accent-soft); }
.admin-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 0.9rem;
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.banner { border-radius: var(--radius); padding: 16px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.champion {
  background: var(--navy); color: #E5E7EB; font-size: 1.2rem; font-weight: 600; justify-content: center; text-align: center;
  border: 1px solid #1C2740; box-shadow: inset 0 -4px 0 var(--lime);
}
.banner.champion strong { color: var(--lime); font-weight: 700; }
.banner.info { background: var(--surface); border: 1px solid var(--border); }
.visibility-banner .actions { margin: 0; }
.visibility .seg button { max-width: none; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; flex-basis: 100%; }
.progress > span { display: block; height: 100%; background: var(--accent); }

.entries { list-style: none; margin: 0; padding: 0; }
.entries li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.entries li:last-child { border-bottom: 0; }
.entries .seed { width: 28px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.entries .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-actions { display: flex; }
.plan { font-weight: 600; }
details > summary { cursor: pointer; font-weight: 700; }
details[open] > summary { margin-bottom: 12px; }

/* ---------- match cards */
.match-list { display: grid; gap: 10px; }
@media (min-width: 640px) { .match-list { grid-template-columns: 1fr 1fr; } }
.match-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; text-decoration: none; color: inherit;
}
.match-card:hover { border-color: var(--accent); }
.match-card.live { border-color: var(--live); }
.mc-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 0.78rem; margin-bottom: 6px; }
.mc-side { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 0; }
.mc-side.won { font-weight: 700; }
.mc-name { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-games { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.mc-games span { min-width: 1.4em; text-align: right; color: var(--muted); }
.mc-games span.gw { color: var(--text); font-weight: 700; }
.mc-games span.cur { color: var(--live); font-weight: 800; }
.serve { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--lime); flex: none; box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.25); }

/* ---------- groups */
.table-wrap { overflow-x: auto; margin: 0 -4px 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { white-space: normal; min-width: 120px; }
tr.q td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
tr.q td.name { font-weight: 600; }
.groups-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .groups-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- bracket */
.bracket-scroll { overflow-x: auto; padding-bottom: 8px; }
.bracket { display: flex; gap: 20px; min-width: max-content; }
.round { display: flex; flex-direction: column; width: 220px; }
.round h3 { color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; text-align: center; }
.round-matches { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 12px; }
.b-match {
  display: block; position: relative; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
a.b-match:hover { border-color: var(--accent); }
.b-match.live { border-color: var(--live); }
.b-match.bye { opacity: 0.6; }
.b-line { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 0.88rem; }
.b-line + .b-line { border-top: 1px solid var(--border); }
.b-line.won { font-weight: 700; background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.b-line.tbd { color: var(--muted); font-style: italic; }
.b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-score { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.b-line.won .b-score { color: var(--text); }
.b-live { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 0.6rem; font-weight: 800; color: #fff; background: #DC2626; padding: 1px 5px; border-radius: 4px; }

/* ---------- match / scoreboard (navy in both themes) */
.back { display: inline-block; margin: 4px 0 10px; text-decoration: none; font-weight: 600; }
.match-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); margin-bottom: 10px; font-size: 0.9rem; }
.scoreboard { background: var(--scoreboard); color: #F1F5F9; border: 1px solid #1C2740; border-radius: 18px; padding: 8px 0; margin-bottom: 14px; overflow: hidden; }
.sb-row { display: grid; grid-template-columns: 26px 1fr auto minmax(2.2ch, auto); align-items: center; gap: 10px; padding: 12px 18px 12px 8px; }
.sb-row + .sb-row { border-top: 1px solid #1C2740; }
.sb-row.side-a { box-shadow: inset 5px 0 0 var(--lime); }
.sb-row.side-b { box-shadow: inset 5px 0 0 #94A3B8; }
.sb-serve { display: flex; justify-content: center; }
.sb-name { font-size: clamp(1.05rem, 4vw, 1.4rem); font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.sb-row.won .sb-name { color: var(--lime); }
.flag { display: inline-block; margin-left: 8px; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; padding: 2px 7px; border-radius: 6px; background: var(--lime); color: var(--navy); vertical-align: middle; }
.sb-games { font-size: 1.2rem; font-weight: 700; color: #CBD5E1; background: #18233A; border-radius: 8px; padding: 2px 10px; font-variant-numeric: tabular-nums; }
.sb-points { font-size: clamp(2.6rem, 12vw, 4rem); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; line-height: 1; }
.sb-foot { font-size: 0.8rem; color: #94A3B8; padding: 6px 18px 4px; border-top: 1px solid #1C2740; }

.scorer { display: grid; gap: 12px; margin-bottom: 16px; }
.score-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-btn {
  font: inherit; border: 0; border-radius: 16px; cursor: pointer; padding: 16px 10px;
  min-height: min(34vh, 220px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: transform 0.06s, filter 0.06s;
}
.score-btn:active:not(:disabled) { transform: scale(0.97); filter: brightness(0.95); }
.score-btn:disabled { opacity: 0.5; }
.score-btn.side-a { background: var(--side-a); color: var(--on-side-a); }
.score-btn.side-b { background: var(--side-b); color: var(--on-side-b); }
.sbtn-plus { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.sbtn-name { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; text-align: center; }
.scorer-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-size: 0.875rem; border: 0; background: var(--surface); color: var(--text); padding: 6px 12px; cursor: pointer; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { width: 110px; padding: 6px 10px; }
.games-table td.won { font-weight: 800; }

/* ---------- toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--toast); color: var(--on-toast); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 0.92rem;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); z-index: 20; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: #B91C1C; color: #fff; }

/* ---------- accounts & team */
.nav { display: flex; align-items: center; gap: 10px; }
.nav-link { font-weight: 600; text-decoration: none; color: var(--text); font-size: 0.92rem; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--slate); color: #fff; font-weight: 700; font-size: 0.85rem; user-select: none;
}
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 30; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  padding: 6px; display: grid;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow-wrap: anywhere; }
.menu-panel > a, .menu-panel > button {
  font: inherit; text-align: left; background: none; border: 0; color: var(--text); text-decoration: none;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.menu-panel > a:hover, .menu-panel > button:hover { background: var(--surface-2); }
.menu-theme { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); margin-top: 4px; font-size: 0.85rem; color: var(--muted); }
.auth-card { max-width: 420px; margin: 24px auto; }
.members { list-style: none; margin: 0 0 14px; padding: 0; }
.members li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.members li:last-child { border-bottom: 0; }
.members .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.team-form { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .team-form { grid-template-columns: 1fr auto auto; } }
.link-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.card.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.sync { text-align: center; font-size: 0.82rem; color: var(--muted); min-height: 1.3em; }
.sync.saving { color: var(--muted); }
.sync.offline { color: var(--danger); font-weight: 700; }
.sync.saved::before { content: "✓ "; color: var(--accent-text); }

/* logo variants that swap with the theme */
:root[data-theme='light'] .on-dark { display: none; }
:root:not([data-theme='light']) .on-light { display: none; }

/* ---------- sports catalogue */
.sport-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sport-chip {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 0.9rem; font-weight: 600;
  padding: 6px 8px 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; min-height: 36px;
}
button.sport-chip:hover { border-color: var(--muted); }
.sport-chip.live { background: var(--accent); border-color: var(--accent); color: var(--on-accent); cursor: default; }
.sport-chip.voted { border-color: var(--accent); background: var(--accent-soft); }
.chip-tag {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.sport-chip.live .chip-tag { background: var(--navy); color: var(--lime); }
.chip-count { font-size: 0.78rem; font-weight: 700; color: var(--accent-text); font-variant-numeric: tabular-nums; padding-right: 4px; }

/* ---------- entries: check-in, self-entry, withdrawals */
.check {
  width: 30px; height: 30px; flex: none; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 800;
  border: 2px solid var(--border); background: transparent; color: var(--on-accent);
}
.check:hover { border-color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.saving { animation: check-saving 1s ease-in-out infinite; cursor: progress; }
@keyframes check-saving { 0% { box-shadow: 0 0 0 0 var(--accent); } 100% { box-shadow: 0 0 0 7px transparent; } }
.entries li.removing { opacity: 0.4; pointer-events: none; transition: opacity 0.15s; }
.entries li.shake { animation: row-shake 0.4s; }
@keyframes row-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .check.saving { animation: none; box-shadow: 0 0 0 3px var(--accent); } .entries li.shake { animation: none; } }
.entries li.not-here .entry-name, .entries li.out .entry-name { color: var(--muted); }
.entries li.out .entry-name { text-decoration: line-through; }
.entries .contact { display: block; font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.entries .entry-name { display: block; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.entry-tags:empty { display: none; }
.entries .entry-name { overflow-wrap: anywhere; }
.entries .row-actions .icon-btn { width: 30px; }
.pill.withdrawn { background: var(--live-soft); color: var(--live); }
.entries .confirm-btn { display: block; width: max-content; margin-top: 6px; }
.pill.waiting { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); color: var(--muted); }
tr.out td { color: var(--muted); }
.entry-card { border-left: 4px solid var(--accent); }
.check-field { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; margin-bottom: 10px; }
.check-field input { width: 18px; height: 18px; margin-top: 3px; flex: none; accent-color: var(--lime); }
.check-field small { display: block; color: var(--muted); }
.entry-settings { display: grid; gap: 6px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- static pages: pricing, contact, policies */
.doc { max-width: 820px; }
.doc h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin: 12px 0 10px; }
.doc h2 { margin-top: 28px; }
.doc h3 { margin-top: 18px; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 6px; }
.price-grid { display: grid; gap: 16px; margin: 20px 0 8px; }
@media (min-width: 700px) { .price-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .price-grid-4 { grid-template-columns: repeat(4, 1fr); } }
.price-limit { margin: 0 0 4px; }
.price-card { display: flex; flex-direction: column; gap: 6px; }
.price-card ul { flex: 1; }
.price-card.featured { border: 2px solid var(--accent); }
.price { font-size: 2.2rem; font-weight: 700; margin: 0; }
.price small { font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.biz { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
.biz dt { color: var(--muted); font-weight: 600; }
.biz dd { margin: 0; overflow-wrap: anywhere; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-legal { max-width: 1040px; margin: 0 auto; padding: 0 16px 28px; font-size: 0.78rem; color: var(--muted); }

/* ---------- Event Pass */
.upgrade-card { border: 2px solid var(--accent); }
.upgrade-card h2 { margin-bottom: 6px; }
.entry-meter { display: grid; gap: 6px; margin: 0 0 10px; }
.entry-meter .progress { height: 5px; }

/* Venue, location and dates */
fieldset.details-set { display: grid; gap: 12px; }
.stack { display: grid; gap: 8px; }
.venue-card { display: flex; gap: 12px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.venue-info { display: grid; gap: 10px; min-width: 0; }
.venue-row { display: flex; gap: 10px; align-items: flex-start; }
.venue-icon { flex: none; width: 20px; text-align: center; }
.t-card-when { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }

/* Find a tournament */
.find-bar { display: grid; gap: 10px; margin-bottom: 16px; }
.find-q { font-size: 1rem; }
.filters > summary { list-style: none; display: inline-flex; }
.filters > summary::-webkit-details-marker { display: none; }
.filter-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; align-items: end; }
.filter { display: grid; gap: 4px; min-width: 0; }
.filter select:disabled { opacity: 0.55; }
.filter-open { margin: 0; align-self: center; }
@media (min-width: 720px) {
  .filters > summary { display: none; }
  .filters[open] > summary { margin: 0; }
  .filter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Events */
.event-picker { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 4px; scrollbar-width: thin; }
.event-chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9rem;
}
.event-chip:hover { border-color: var(--accent); }
.event-chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.event-chip-count { font-variant-numeric: tabular-nums; font-size: 0.78rem; opacity: 0.75; }
.event-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.event-chip .dot.league, .event-chip .dot.knockout { background: var(--live); }
.event-chip .dot.completed { background: currentColor; opacity: 0.5; }
.event-chip.active .dot.setup { background: var(--on-accent); opacity: 0.5; }
.event-title { margin: 0 0 12px; color: var(--muted); }
.event-title strong { color: var(--text); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.quick-grid .check-field { margin-bottom: 6px; }
@media (min-width: 640px) { .quick-grid { grid-template-columns: repeat(3, 1fr); } }
.events-list .entry-name { color: var(--text); text-decoration: none; font-weight: 600; }
.events-list .entry-name:hover { text-decoration: underline; }

.t-card-events { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.event-tag { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }

.fee-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.solo-card .entries li { flex-wrap: wrap; }
.pair-with { width: auto; max-width: 11rem; padding: 6px 10px; font-size: 0.875rem; }

/* Prizes and what's included */
.prizes-card h2 { margin-top: 18px; }
.prizes-card h2:first-child { margin-top: 0; }
.prize-event { font-size: 0.95rem; margin: 12px 0 4px; }
.prize-list, .perk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.prize-list li { display: grid; grid-template-columns: 24px auto 1fr; gap: 4px 8px; align-items: baseline; }
.prize-place { font-weight: 600; }
.prize-what { text-align: right; font-weight: 700; }
.perk-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.perk-list li::before { content: '✓'; display: inline-block; width: 1.4em; font-weight: 700; color: var(--accent-text); }
.prize-row .prize-place, .prize-row .prize-custom { grid-column: 1 / 3; }
.prize-row .prize-cash { grid-column: 1; }
.prize-row .prize-reward { grid-column: 2; }
.perk-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.perk-tag { background: var(--surface); }

/* Event list builder */
.ev-rows { display: grid; gap: 10px; }
.ev-row {
  display: grid; gap: 8px 10px; grid-template-columns: 1fr 1fr auto; align-items: end;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.ev-row .ev-type { grid-column: 1 / 3; }
.ev-row .ev-remove { grid-column: 3; grid-row: 1; align-self: start; }
.ev-row .ev-age { grid-column: 1; }
.ev-row .ev-level { grid-column: 2; }
.ev-preview { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); }
.ev-row.dup { border-color: var(--danger); }
.ev-row.dup .ev-preview { color: var(--danger); }
.ev-note { color: var(--danger); margin: 0; font-size: 0.85rem; }
.ev-several { border-top: 1px solid var(--border); padding-top: 10px; }
.ev-several > summary { font-weight: 600; }
.ev-several strong { display: block; margin: 8px 0 4px; font-size: 0.9rem; }
.ev-several .quick-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
@media (min-width: 720px) {
  .ev-row { grid-template-columns: 2fr 1fr 1fr auto; }
  .ev-row .ev-type { grid-column: 1; }
  .ev-row .ev-age { grid-column: 2; }
  .ev-row .ev-level { grid-column: 3; }
  .ev-row .ev-remove { grid-column: 4; grid-row: 1; align-self: end; }
}

/* Tournament page: cover, about, photos */
.brand .brand-mark { display: none; }
body.branded .brand .brand-full { display: none; }
body.branded .brand .brand-mark { display: block; }
.t-hero { margin: 0 0 14px; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 7; background: var(--surface-2); }
.t-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-card.has-cover { padding-top: 0; overflow: hidden; }
.t-card-cover { display: block; width: calc(100% + 32px); margin: 0 -16px 12px; aspect-ratio: 16 / 7; object-fit: cover; background: var(--surface-2); }
.about-text p { margin: 0 0 8px; overflow-wrap: anywhere; }
.gallery { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery-item { padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; background: var(--surface-2); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.gallery-item:hover img { transform: scale(1.03); }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(7, 12, 23, 0.94); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 8px; }
.lb-caption { color: #E5E7EB; margin: 0; text-align: center; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; border-radius: 999px; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }

/* Organiser branding (paid) */
.org-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.org-logo { height: 44px; width: auto; max-width: 160px; object-fit: contain; }
.org-name { font-weight: 700; font-size: 1.1rem; }
.sponsors { margin: 28px 0 8px; text-align: center; }
.sponsor-logos { display: flex; flex-wrap: wrap; gap: 14px 24px; justify-content: center; align-items: center; }
.sponsor-logos img { height: 44px; width: auto; max-width: 140px; object-fit: contain; }
.powered { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 20px 0 4px; color: var(--muted); text-decoration: none; font-size: 0.8rem; letter-spacing: 0.04em; }
.powered img { height: 14px; width: auto; }

/* Page & branding panel */
.cover-preview { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; border-radius: 10px; }
.photo-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.photo-list li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; }
.photo-list li img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.photo-list li .hint { grid-column: 2; }
.photo-list li.hidden-photo img { opacity: 0.4; }
.locked { opacity: 0.95; border-style: dashed; }
.brand-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 72px; height: 72px; object-fit: contain; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.logo-preview.empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatches input[type=color] { width: 44px; height: 36px; padding: 2px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; }
.sponsor-admin { display: grid; gap: 8px; }
.sponsor-admin .sponsor-logos { justify-content: flex-start; }
.sponsor-edit { position: relative; display: inline-flex; }
.sponsor-edit .icon-btn { position: absolute; top: -10px; right: -12px; width: 26px; height: 26px; background: var(--surface); border: 1px solid var(--border); }
label.btn.disabled { opacity: 0.5; pointer-events: none; }
.uploading { margin: 0; }
