/* Tournament system styles. Reuses the shared design tokens (shared.css):
   --bg / --bg-secondary / --bg-tertiary, --text / --text-muted / --text-dim,
   --accent, --border, --win-green, --ban-red, --card-radius. Mobile floor is
   360px; everything stacks to a single column on phones. */

.t-page { max-width: 1000px; margin: 0 auto; padding: 24px; }
.t-page h1 { font-size: 1.5rem; margin: 0 0 4px; }
.t-page .t-sub { color: var(--text-muted); margin: 0 0 20px; font-size: 0.92rem; }

/* ── Status pills (reuse the event-pill look) ───────────────────────────── */
.t-pill {
  display: inline-block; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; white-space: nowrap;
}
.t-pill-draft        { background: rgba(120,130,150,0.18); color: var(--text-dim); border: 1px solid rgba(120,130,150,0.4); }
.t-pill-registration { background: rgba(74,158,92,0.16);  color: var(--win-green); border: 1px solid rgba(74,158,92,0.4); }
.t-pill-seeding,
.t-pill-running,
.t-pill-finalizing   { background: rgba(220,165,50,0.16); color: var(--accent);   border: 1px solid rgba(220,165,50,0.4); }
.t-pill-complete     { background: rgba(120,130,150,0.12); color: var(--text-muted); border: 1px solid var(--border); }
.t-pill-cancelled    { background: rgba(212,64,64,0.14);  color: var(--ban-red);  border: 1px solid rgba(212,64,64,0.4); }
.t-badge {
  display: inline-block; font-size: 0.68rem; padding: 2px 7px; border-radius: 4px;
  background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border);
}

.t-empty { color: var(--text-dim); font-style: italic; padding: 8px 0; }

/* ── My Gatherings: list of gatherings (each row = a gathering + its events) ── */
.t-glist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border);
  border-radius: var(--card-radius); overflow: hidden; }
/* Compact rows: name + meta on one line, the gathering's events on a tight
   line just beneath (small chips), slightly indented. */
.t-glist-row {
  position: relative;                 /* anchor the whole-row "stretched" link */
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-secondary);
  transition: background 0.12s;
}
.t-glist-row:last-child { border-bottom: none; }
.t-glist-row:hover { background: var(--bg-tertiary); }   /* the row is clickable → opens the gathering */
.t-glist-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.t-glist-name { font-weight: 600; font-size: 1.02rem; text-decoration: none; color: inherit; }
.t-glist-row:hover .t-glist-name { color: var(--accent); }
/* Stretch the gathering link over the entire row so clicking anywhere on the
   row background opens the gathering page; the event chips sit above it (z-index). */
.t-glist-name::after { content: ''; position: absolute; inset: 0; z-index: 0; }
.t-glist-meta { color: var(--text-muted); font-size: 0.82rem; }
.t-glist-events { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.t-glist-events > * { position: relative; z-index: 1; } /* clickable above the row link */
.t-glist-event {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; min-height: 30px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-tertiary);
  text-decoration: none; color: inherit; font-size: 0.84rem;
}
/* In the list, the add/archive line is a plain compact link, not a boxed CTA. */
.t-glist-events .t-event-empty { padding: 0; font-size: 0.82rem; }
.t-glist-events .t-event-add { border: none; border-radius: 0; padding: 0; text-align: left; }
.t-glist-event:hover { border-color: var(--accent); background: var(--bg-secondary); }
.t-event-name { flex: 1; font-weight: 500; }

/* ── Detail header + tabs ───────────────────────────────────────────────── */
/* Breadcrumb — consistent across the Event + Manage pages (each level links). */
.t-crumbs { font-size: 0.9rem; color: var(--text-muted); margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.t-crumbs a { color: var(--link); }
.t-crumb-sep { color: var(--text-dim); }
.t-crumb-cur { color: var(--text-muted); }
.t-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
.t-head h1 { margin: 0; }
.t-head-sub { color: var(--text-muted); font-size: 0.92rem; margin: 0 0 16px; }
.t-head-sub a { color: var(--link); }
/* "Manage event" button sits at the far right of the header (managers only). */
.t-head-manage { margin-left: auto; }
/* Inline navigational link in the registration status line (goes to the gathering). */
.t-reg-link { color: var(--link); white-space: nowrap; }
/* Linkable in-page tabs (Overview / Registration / Bracket). */
.t-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--border); margin: 4px 0 20px; }
.t-tab { padding: 8px 16px; white-space: nowrap; color: var(--text-muted); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 0.92rem; cursor: pointer; font-family: inherit; }
.t-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.t-tab:hover { color: var(--text); }
.t-panel-h { font-size: 1.05rem; }
/* This Event's finalized decklists (Decklists tab). */
.t-decklist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.t-decklist-row { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; }
.t-decklist-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--text); text-decoration: none; }
.t-decklist-link:hover { border-color: var(--text-muted); }
.t-decklist-place { color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 44px; }
.t-decklist-player { flex: 1; font-weight: 600; }
.t-decklist-ruler { color: var(--text-muted); font-size: 0.9rem; }
.t-decklist-partial { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Detail body / definition rows ──────────────────────────────────────── */
.t-defs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 20px; }
.t-defs dt { color: var(--text-dim); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
.t-defs dd { margin: 0; }
.t-phase { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 8px; }
.t-phase-name { font-weight: 600; }
.t-phase-meta { color: var(--text-muted); font-size: 0.85rem; }

/* ── Bracket ─────────────────────────────────────────────────────────────── */
.t-bracket-section { margin: 20px 0; }
.bk-empty { color: var(--text-muted); }
/* The Bracket tab becomes a full-height left RAIL (the queue) + a main column
   (header, tabs, tree). The rail starts at the top of the content — flush under
   the navbar — and stays pinned while the tree scrolls. Overview/Registration
   keep the calm centred 1000px page; only the bracket widens. */
.t-queue { min-width: 0; }
#t-queue { display: none; }                       /* shown only on the bracket tab */
.t-bracket-tree { min-width: 0; }
@media (min-width: 1040px) {
  /* The event page is a grid: a collapsible left rail (col 1) + the main column.
     The Bracket tab opens the rail to 330px and widens the page; transitioning
     the column width + gap + max-width slides the main content aside to make
     room for the queue (the matches to be called). */
  .t-event-page {
    display: grid;
    grid-template-columns: 0px minmax(0, 1fr);
    column-gap: 0;
    transition: grid-template-columns 300ms ease, column-gap 300ms ease, max-width 300ms ease;
  }
  .t-event-page > :not(#t-queue) { grid-column: 2; min-width: 0; }
  .t-event-page > #t-queue {
    display: block;
    grid-column: 1;
    grid-row: 1 / 999;                             /* span the full content height */
    align-self: start;
    overflow: hidden;                              /* clipped to nothing until the rail opens */
    position: sticky;
    top: calc(var(--site-header-height, 52px) + 12px);
    max-height: calc(100vh - var(--site-header-height, 52px) - 24px);
  }
  .t-event-page.is-bracket {
    grid-template-columns: 330px minmax(0, 1fr);
    column-gap: 24px;
    max-width: min(1600px, calc(100vw - 48px));    /* break out of the 1000px cap */
  }
  .t-event-page.is-bracket > #t-queue { overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) { .t-event-page { transition: none; } }
/* Phones: the rail just stacks (source order puts it above the tree). */
@media (max-width: 1039px) { .t-page.is-bracket #t-queue { display: block; margin-bottom: 20px; } }
/* Up-Next queue */
.q-list { display: flex; flex-direction: column; gap: 10px; }
.q-sect { margin: 0; }
.q-sect-h { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin: 0 0 6px; }
.q-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.q-card.bk-state-in_progress, .q-card.bk-state-ready { border-color: var(--accent); }
.q-round { font-size: 0.68rem; color: var(--text-dim); padding: 4px 10px 0; }
/* Compact the queue cards (the left rail) — tighter than the read-only tree. */
.q-card .bk-slot { padding: 5px 10px; }
.q-card .bk-foot { padding: 5px 8px; }
.q-soon { opacity: 0.65; }
.q-soon-row { display: flex; gap: 7px; padding: 4px 10px 8px; font-size: 0.9rem; align-items: center; }
.q-vs { color: var(--text-dim); font-size: 0.8rem; }
.q-done { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.q-done > summary { list-style: none; }
.q-done .q-card { background: var(--bg); }
.q-allclear { color: var(--text-muted); font-size: 0.9rem; margin: 4px 0 0; }
/* Double-elim: stacked Winners / Losers / Grand final sections, each its own
   round-column board. */
.bk-de { display: flex; flex-direction: column; gap: 22px; }
.bk-section { display: flex; flex-direction: column; gap: 8px; }
.bk-section-title { font-size: 0.95rem; font-weight: 700; margin: 0; color: var(--text);
  border-bottom: 1px solid var(--border); padding-bottom: 4px; }
/* Round-by-round columns; horizontal scroll is the intentional mobile container. */
.bk-board { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start;
  scroll-behavior: smooth; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
/* Fixed-width round columns so a match never grows to fit a long name (it
   ellipsizes instead) — keeps a 100+ player bracket from sprawling sideways. */
.bk-round { flex: 0 0 220px; width: 220px; display: flex; flex-direction: column; gap: 12px; scroll-snap-align: start; }
.bk-round-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); margin: 0 0 2px; }
.bk-match { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; position: relative; }
/* Tiny per-result edit affordance on the read-only tree (managers). */
.bk-edit-mini { position: absolute; top: 2px; right: 2px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 0.78rem; line-height: 1; padding: 1px 4px;
  border-radius: 4px; opacity: 0.45; }
.bk-edit-mini:hover { opacity: 1; color: var(--accent); background: var(--bg); }
.bk-match.bk-state-ready { border-color: var(--accent); }
.bk-slot { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 0.92rem; }
.bk-slot + .bk-slot { border-top: 1px solid var(--border); }
.bk-seed { color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 18px; font-size: 0.8rem; }
.bk-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-tbd { color: var(--text-dim); font-style: italic; }
.bk-score { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.bk-win { background: color-mix(in srgb, var(--win-green) 14%, transparent); }
.bk-win .bk-name { font-weight: 600; }
.bk-lose { opacity: 0.55; }
/* Quick-edit controls + stopwatch on actionable matches (manager). start.gg-
   style: pick game wins (or DQ) by each name, the winner is inferred, Save. */
.bk-slot { flex-wrap: wrap; }
.bk-quick { display: inline-flex; gap: 3px; margin-left: auto; }
.bk-pick { min-width: 26px; height: 26px; padding: 0 5px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); border-radius: 5px; font-size: 0.8rem; cursor: pointer;
  font-variant-numeric: tabular-nums; }
.bk-pick:hover { border-color: var(--text-muted); }
.bk-pick.selected { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }
.bk-dq-pick { color: var(--ban-red); }
.bk-dq-pick.selected { background: var(--ban-red); color: #fff; border-color: var(--ban-red); }
.bk-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 8px;
  border-top: 1px solid var(--border); }
.bk-start { border: 1px solid var(--accent); background: transparent; color: var(--accent);
  border-radius: 6px; padding: 4px 12px; cursor: pointer; font-size: 0.82rem; }
.bk-timer { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 0.85rem; }
/* The tie "advance" row appears ONLY when scores tie (JS clears [hidden]). A
   plain `display` would override the hidden attribute, so scope it to :not. */
.bk-adv { align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); }
.bk-adv:not([hidden]) { display: inline-flex; flex-basis: 100%; }
.bk-advpick { border: 1px solid var(--border); background: var(--bg); color: var(--link);
  border-radius: 5px; padding: 2px 8px; cursor: pointer; font-size: 0.8rem; }
.bk-advpick.selected { background: var(--accent); color: #000; }
.bk-save { margin-left: auto; border: none; background: var(--accent); color: #000; font-weight: 600;
  border-radius: 6px; padding: 5px 14px; cursor: pointer; font-size: 0.85rem; }
.bk-save:disabled { opacity: 0.4; cursor: default; }
.bk-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim);
  padding: 2px 8px 5px; }
.bk-foot-done { justify-content: flex-end; }
.bk-edit, .bk-reset, .bk-cancel { border: 1px solid var(--border); background: var(--bg); color: var(--text-muted);
  border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 0.78rem; }
.bk-edit:hover, .bk-cancel:hover { border-color: var(--text-muted); color: var(--text); }
.bk-reset { color: var(--ban-red); }
.bk-reset:hover { border-color: var(--ban-red); }
.t-badge-dq { background: var(--ban-red); color: #fff; }

/* ── Registration section (Event detail) ────────────────────────────────── */
.t-reg { margin: 20px 0; }
.t-reg-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.t-roster { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.t-roster-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.92rem; }
.t-roster-row.dropped { opacity: 0.5; }
/* The viewer's own row: subtle accent + a "you" badge + an edit-decklist link. */
.t-roster-row.is-me { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-secondary)); }
.t-badge-you { background: var(--accent); color: #000; }
.t-roster-deck { color: var(--link); white-space: nowrap; }
.t-roster-name { flex: 1; }
.t-seed { color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 28px; }
#t-roster li.dropped { opacity: 0.5; }

/* ── Manage dashboard ───────────────────────────────────────────────────── */
.t-manage-grid { display: grid; gap: 20px; }
.t-panel { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--card-radius); padding: 16px 18px; }
.t-panel h2 { font-size: 1.05rem; margin: 0 0 12px; }
.t-tasks { list-style: none; margin: 0; padding: 0; }
.t-tasks li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.95rem; }
.t-tasks .ok   { color: var(--win-green); }
.t-tasks .todo { color: var(--text-dim); }
.t-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
/* display:flex would otherwise beat the [hidden] attribute (e.g. the Swiss-only
   rounds field, shown/hidden as the Structure select changes). */
.t-field[hidden], .t-hint[hidden] { display: none; }
.t-field label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
/* ≥16px inputs avoid iOS zoom-on-focus; 44px min height = comfortable tap target. */
.t-field input, .t-field select {
  font-size: 16px; min-height: 44px; padding: 8px 10px; box-sizing: border-box;
  background: rgba(0,0,0,0.3); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
}
.t-field input:focus, .t-field select:focus { outline: none; border-color: var(--accent); }
.t-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.t-btn {
  min-height: 44px; padding: 8px 18px; border-radius: 6px; cursor: pointer; font-size: 0.9rem;
  background: var(--bg-tertiary); color: var(--text); border: 1px solid var(--border);
}
.t-btn:hover { border-color: var(--text-muted); }
.t-btn-primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.t-btn-danger { color: var(--ban-red); border-color: var(--ban-red); background: transparent; }
.t-btn-danger:hover { background: var(--ban-red); color: #fff; }
.t-staff-list { list-style: none; margin: 0 0 12px; padding: 0; }
.t-staff-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }

/* ── Hub: standalone "New tournament" create form ───────────────────────── */
.t-create { margin: 0 0 24px; }
.t-create > summary { display: inline-flex; align-items: center; cursor: pointer; list-style: none;
  min-height: 44px; padding: 0 16px; }
.t-create > summary::-webkit-details-marker { display: none; }
.t-create-form { margin-top: 12px; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--card-radius); background: var(--bg-secondary); max-width: 720px; }
.t-create-hint { margin: 0 0 12px; color: var(--text-muted); font-size: 0.9rem; }
.t-create-group { border: 1px solid var(--border); border-radius: var(--card-radius);
  margin: 0 0 12px; padding: 10px 12px 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.t-create-group legend { padding: 0 6px; font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.t-create-form input, .t-create-form select { font-size: 16px; } /* avoid iOS zoom-on-focus */

/* ── Gathering-page Events section ──────────────────────────────────────── */
.ev-events { margin: 24px 0; }
.ev-events h2 { font-size: 1.1rem; margin: 0 0 10px; }

@media (max-width: 640px) {
  .t-page { padding: 14px; }
  .t-defs { grid-template-columns: 1fr; gap: 2px 0; }
  .t-defs dt { margin-top: 8px; }
  .t-actions { flex-direction: column; }
  .t-btn { width: 100%; }
}

/* ── My Gatherings workspace additions ─────────────────────────────────── */
.t-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* When the create form is open it takes its own full-width row below the title +
   button, rather than squeezing beside the heading (which left the title
   floating vertically-centered against the tall form). */
.t-page-head > .t-create[open] { flex-basis: 100%; }
.t-create-row { display: flex; flex-wrap: wrap; gap: 10px; }
.t-create-row .t-field { flex: 1 1 140px; }
.t-field-wide { display: block; }
.t-field-wide input, .t-field-wide textarea, .t-field-wide select { width: 100%; box-sizing: border-box; }
.t-field textarea { font: inherit; font-size: 16px; padding: 8px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; resize: vertical; }
.t-hint { color: var(--text-muted); font-weight: 400; font-size: 0.8rem; }
.t-create-status { margin-left: 10px; color: var(--text-muted); font-size: 0.85rem; }
.t-filter { margin: 14px 0; display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-muted); }
.t-filter select { font-size: 16px; padding: 6px 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; }
.t-event-empty { display: block; padding: 8px 10px; color: var(--text-muted); font-size: 0.86rem; text-decoration: none; }
.t-event-empty:hover { color: var(--accent); }
/* "+ Add an event" gets a dashed affordance so empty cards read as actionable. */
.t-event-add { border: 1px dashed var(--border); border-radius: 6px; text-align: center; color: var(--text-dim); }
.t-event-add:hover { border-color: var(--accent); color: var(--accent); }

/* ── Manage: status stage strip ─────────────────────────────────────────── */
.t-stages { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; }
.t-stages li { font-size: 0.78rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text-dim); background: var(--bg-tertiary); }
.t-stages li.done { color: var(--text-muted); border-color: var(--text-dim); }
.t-stages li.current { color: #000; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.t-stage-caption { margin: 0 0 12px; color: var(--text-muted); font-size: 0.9rem; }
.t-stage-cancelled { margin: 0 0 12px; color: var(--ban-red); font-size: 0.9rem; }

/* ── Manage: single-line settings ───────────────────────────────────────── */
.t-settings-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.t-settings-row .t-field { margin: 0; flex: 1 1 140px; }
.t-settings-row .t-field > span { display: block; font-size: 0.72rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 3px; }
.t-settings-row input, .t-settings-row select { width: 100%; font-size: 16px; }
.t-settings-row > .t-btn { flex: 0 0 auto; }

/* ── Manage: roster sub-tabs (Roster ⇄ Seeding) ─────────────────────────── */
.t-subtabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin: 0 0 12px; }
.t-subtab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted);
  font: inherit; font-size: 0.9rem; padding: 6px 10px; cursor: pointer; min-height: 36px; }
.t-subtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.t-subpane.hidden { display: none; }

/* ── Manage: roster filters + filtered rows + paid badge ────────────────── */
.t-roster-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 0 0 10px; }
.t-roster-filters label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.3px; }
.t-roster-filters select { font-size: 0.85rem; margin-left: 4px; text-transform: none; letter-spacing: 0; }
#t-roster li.filtered-out { display: none; }
.t-roster-main { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.t-badge-paid { background: var(--win-green, #2e7d32); color: #fff; border-color: transparent; }

/* ── Manage: drag-to-seed list ──────────────────────────────────────────── */
.t-seed-list { list-style: none; margin: 0 0 12px; padding: 0; }
.t-seed-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--bg-secondary); margin-bottom: 6px; cursor: grab; }
.t-seed-list li.dragging { opacity: 0.5; border-color: var(--accent); }
.t-drag-handle { color: var(--text-dim); cursor: grab; font-size: 1rem; user-select: none; }
.t-seed-list .t-seed { min-width: 2.4em; }

/* ── Manage: "Add player" handle autocomplete ───────────────────────────── */
.t-ac-wrap { position: relative; }
.t-ac-dropdown { position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 0 0 6px 6px;
  max-height: 280px; overflow-y: auto; box-shadow: 0 6px 20px rgba(0,0,0,0.35); }
.t-ac-item { display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--border); color: var(--text);
  font: inherit; padding: 9px 12px; cursor: pointer; min-height: 40px; }
.t-ac-item:last-child { border-bottom: none; }
.t-ac-item:hover { background: var(--bg-tertiary); }
.t-ac-handle { font-weight: 600; }
.t-ac-name { color: var(--text-muted); font-size: 0.85rem; }

/* ── Gathering page: registration cart (tick events → one Register/checkout) ── */
.ev-cart { margin: 6px 0 0; }
.ev-cart-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ev-cart-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--bg-secondary); }
.ev-cart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ev-cart-pick { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.ev-cart-pick input { width: 18px; height: 18px; cursor: pointer; }
.ev-reg-name { font-weight: 600; text-decoration: none; color: inherit; }
.ev-reg-name:hover { color: var(--accent); }
.ev-reg-count { color: var(--text-muted); font-size: 0.85rem; }
.ev-cart-fee { color: var(--text); font-size: 0.85rem; font-weight: 500; }
.ev-reg-manage { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; margin-left: auto; }
.ev-reg-manage:hover { color: var(--accent); }
.ev-cart-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 14px; }
.ev-cart-total { color: var(--text); font-weight: 600; }

/* Deck submission collapses into a <details>; summary is the at-a-glance state. */
.ev-reg-deck { margin-top: 8px; }
.ev-reg-deck > summary { cursor: pointer; color: var(--text-muted); font-size: 0.86rem; padding: 4px 0; list-style: none; }
.ev-reg-deck > summary::-webkit-details-marker { display: none; }
.ev-reg-deck > summary::before { content: '▸ '; color: var(--text-dim); }
.ev-reg-deck[open] > summary::before { content: '▾ '; }
.ev-reg-deckname { color: var(--accent); font-weight: 500; }
.ev-reg-decktodo { color: var(--accent); }
.ev-reg-deck-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0 2px; }
.ev-reg-deck-body select { font-size: 16px; padding: 6px 8px; min-height: 40px;
  background: rgba(0,0,0,0.3); color: var(--text); border: 1px solid var(--border); border-radius: 4px; }
.ev-reg-deckview { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; }
.ev-reg-deckview:hover { color: var(--accent); }
.ev-reg-nodeck { margin: 8px 0 0; color: var(--text-muted); font-size: 0.86rem; }

/* ── Gathering page: create-event form, collapsed behind "+ New event" ──── */
.ev-create-details { margin-top: 16px; }
.ev-create-details > summary { display: inline-flex; align-items: center; cursor: pointer; list-style: none; min-height: 40px; padding: 0 14px; }
.ev-create-details > summary::-webkit-details-marker { display: none; }
.ev-create-event { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.ev-create-hint { flex-basis: 100%; color: var(--text-muted); font-size: 0.82rem; margin: 0; }

/* ── Deck check: clickable competitor names + the decklist overlay ── */
.bk-deck-link {
  flex: 1; min-width: 0; text-align: left; background: none; border: none;
  color: inherit; font: inherit; padding: 0; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 1px dashed transparent;
}
.bk-deck-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.dc-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-start; justify-content: center; padding: 48px 14px 14px; overflow-y: auto;
}
.dc-overlay[hidden] { display: none; }
.dc-modal {
  position: relative; width: 100%; max-width: 460px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 10px; padding: 20px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.dc-close {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.dc-close:hover { color: var(--text); }
.dc-title { margin: 0 0 2px; font-size: 1.1rem; }
.dc-meta { margin: 0 0 10px; color: var(--text-muted); font-size: 0.85rem; }
.dc-partial { margin: 0 0 10px; color: #e3b85a; font-size: 0.8rem; }
.dc-empty { color: var(--text-muted); font-size: 0.9rem; }
.dc-badge { font-size: 0.7rem; padding: 1px 7px; border-radius: 4px; vertical-align: middle; }
.dc-legal { background: rgba(80,180,120,0.16); color: #5cc98a; border: 1px solid rgba(80,180,120,0.4); }
.dc-illegal { background: rgba(212,64,64,0.16); color: #e06a6a; border: 1px solid rgba(212,64,64,0.4); }
.dc-section { margin-top: 12px; }
.dc-section-h { margin: 0 0 4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.dc-count { color: var(--text-muted); font-weight: 400; }
.dc-cards { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 18px; font-size: 0.9rem; }
.dc-cards li { break-inside: avoid; padding: 1px 0; }
.dc-cards li[data-card-code]:hover { color: var(--accent); cursor: help; }
.dc-qty { color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .dc-cards { columns: 1; } }
/* Card-image hover tooltip inside the deck-check modal (above the overlay). */
.dc-cardtip { position: fixed; z-index: 1100; pointer-events: none; }
.dc-cardtip[hidden] { display: none; }
.dc-cardtip img { display: block; width: 190px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.55); }

/* Full-width checkbox row (New Gathering form + the Settings row). flex-basis
   100% makes it take its own line inside the wrapping .t-settings-row flex. */
.t-check { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px;
  flex-basis: 100%; width: 100%; box-sizing: border-box;
  font-size: 0.85rem; color: var(--text); cursor: pointer; }
.t-check input[type="checkbox"] { width: auto; flex: 0 0 auto; margin: 0; }
.t-check span { flex: 1; }

/* Invite-only link + notify tooling on the manage page. */
.t-field-wide { flex-basis: 100%; }
.t-invite { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.t-invite-h { font-size: 0.95rem; margin: 0 0 4px; }
.t-invite-row { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.t-invite-row input { flex: 1; min-width: 220px; padding: 7px 10px; font-size: 0.9rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.t-invite-row input[readonly] { color: var(--text-muted); }

/* Swiss: standings table + round controls (shown on the Bracket tab). */
.sw-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sw-round { font-weight: 600; }
/* Swiss round clock: one shared countdown chip + manager start/extend/stop. */
.rt-wrap { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rt-clock { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.05rem;
  padding: 2px 10px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--bg-tertiary); }
.rt-clock.rt-expired { color: var(--ban-red); border-color: var(--ban-red); }
.rt-set { display: inline-flex; align-items: center; gap: 6px; }
.rt-mins { width: 4.5em; font-size: 16px; }
.rt-unit { color: var(--text-muted); font-size: 0.85rem; }
.rt-btn { min-height: 36px; }
.sw-pairings-h { font-size: 0.95rem; margin: 18px 0 8px; }
/* Compact Swiss pairings: one pairing per line (names side by side), in a single
   readable vertical list. */
.sw-pairings-grid { list-style: none; margin: 0; padding: 0; max-width: 640px; }
.pr-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 8px;
  border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.pr-table { flex: 0 0 1.8em; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.pr-name { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-name.pr-win { font-weight: 600; color: var(--win-green); }
.pr-name.pr-lose { color: var(--text-muted); }
.pr-vs { flex: 0 0 auto; color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.pr-score { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--text-muted); }
button.pr-deck { background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.pr-deck:hover { color: var(--accent); text-decoration: underline; }
.sw-standings { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sw-standings th, .sw-standings td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.sw-standings th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-dim); }
.sw-standings .sw-rank { color: var(--text-dim); font-variant-numeric: tabular-nums; width: 2.2em; }
.sw-standings .sw-player { font-weight: 500; }
.sw-standings .sw-pts { font-variant-numeric: tabular-nums; font-weight: 600; }
.sw-standings tbody tr:hover { background: var(--bg-tertiary); }

/* Records mode — the Top-8 results grid. Each slot is a row (place · player ·
   deck status · actions) with a full-width decklist form that drops below it. */
.t-cut-slots { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.t-cut-slot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--bg-secondary); }
.t-cut-place { flex: 0 0 3.5em; font-weight: 700; font-size: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.t-cut-name { flex: 1 1 180px; min-width: 0; font-size: 16px; }
/* Add-a-result row (placement · player · button). */
.t-cut-add { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.t-cut-add input[name="placement"] { flex: 0 0 4em; font-size: 16px; text-align: center; }
.t-cut-add input[name="display_name"] { flex: 1 1 180px; min-width: 0; font-size: 16px; }
.t-cut-deck { flex: 1 1 160px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.t-cut-actions { flex: 0 0 auto; display: flex; gap: 6px; }
.t-cut-actions .t-btn { min-height: 36px; }
/* The decklist form spans the whole slot row (its own line) when revealed. */
.t-cut-deckform { flex-basis: 100%; }
.t-cut-deckform[hidden] { display: none; }
.t-cut-warn { color: var(--ban-red); }
