/* ── Tournament browse / filter bar ───────────────────────── */

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.filter-input,
.filter-select {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Philosopher', serif;
  font-size: 14px;
  padding: 9px 12px;
}

.filter-input {
  flex: 1;
  min-width: 180px;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--border-a);
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text2);
  font-family: 'Philosopher', serif;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.filter-check input { accent-color: var(--accent); width: 15px; height: 15px; }

.prize-chip {
  color: var(--gold);
  font-size: 13px;
}

/* ── Tournament forms ─────────────────────────────────────── */
.form-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(201,80,44,0.45);
  background: rgba(201,80,44,0.12);
  color: #e8a98c;
  font-family: 'Philosopher', serif;
  font-size: 14px;
  margin-bottom: 18px;
}

.t-form { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label { font-family: 'Philosopher', serif; font-size: 14px; color: var(--text2); }
.form-opt { color: var(--text3); font-size: 12.5px; }
.form-hint { color: var(--text3); font-family: 'Philosopher', serif; font-size: 13px; margin-top: 8px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
textarea.filter-input { resize: vertical; font-family: 'Philosopher', serif; }

.add-entrant { display: flex; gap: 10px; flex-wrap: wrap; }
.add-entrant .filter-input { flex: 1; min-width: 160px; }

/* Entrants picker (custom names one-by-one + player search) */
.entrant-add { display: flex; gap: 10px; }
.entrant-add .filter-input { flex: 1; }
.entrant-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg2);
  padding: 6px;
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  max-width: 560px;
}
.entrant-result {
  text-align: left;
  background: none;
  border: none;
  color: var(--text2);
  font-family: 'Philosopher', serif;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.entrant-result:hover { background: var(--surface-h); color: var(--text); }
.entrant-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-width: 560px;
}
.entrant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.entrant-name { flex: 1; font-family: 'Philosopher', serif; color: var(--text); }
.entrant-tag {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid var(--border);
  color: var(--text3);
  background: var(--surface);
}
.entrant-tag.is-player { color: var(--accent); border-color: var(--border-a); background: var(--accent-glow); }
.entrant-tag.is-writein { color: var(--text3); }

/* Game type + inline "Count games as rated" */
.gametype-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.gametype-row .filter-select { flex: 1; min-width: 180px; }
.rated-check { white-space: nowrap; }
.rated-check.disabled { opacity: 0.45; cursor: not-allowed; }
.rated-check.disabled input { cursor: not-allowed; }

/* Entrant quick-search dropdown */
.entrant-combo { position: relative; max-width: 560px; }
.entrant-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--bg2);
  border: 1px solid var(--border-a);
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  max-height: 280px;
  overflow-y: auto;
}
.ed-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 6px 10px 4px;
}
.ed-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text2);
  font-family: 'Philosopher', serif;
  font-size: 14px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.ed-opt:hover { background: var(--surface-h); color: var(--text); }
.ed-writein { border-top: 1px solid var(--border); margin-top: 4px; color: var(--text); }
.ed-badge {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--border-a);
  background: var(--accent-glow);
  border-radius: 999px;
  padding: 2px 8px;
  flex: none;
}
.ed-badge-writein { color: var(--text3); border-color: var(--border); background: var(--surface); }
.entrant-remove {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}
.entrant-remove:hover { color: #e8a98c; background: var(--surface-h); }

/* Segmented control (e.g. game vs standalone in the create form) */
.seg {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  flex-wrap: wrap;
}
.seg-opt { position: relative; display: inline-flex; }
.seg-opt input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0;
}
.seg-opt span {
  display: block;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: 'Philosopher', serif;
  font-size: 14px;
  color: var(--text2);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.seg-opt:hover span { color: var(--text); }
.seg-opt input:checked + span {
  background: var(--accent-glow);
  color: var(--text);
  border-color: var(--border-a);
}
.seg-opt input:focus-visible + span { border-color: var(--border-a); }

/* ── Create-tournament wizard (sequential, tracked, reversible) ── */
/* Progress tracker */
.wiz-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 22px;
  padding: 0;
  max-width: 720px;
}
.wiz-step {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 116px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text3);
  font-family: 'Philosopher', serif;
  font-size: 13.5px;
  user-select: none;
}
.wiz-step.is-clickable { cursor: pointer; }
.wiz-step.is-clickable:hover { border-color: var(--border-a); color: var(--text2); }
.wiz-dot {
  width: 24px;
  height: 24px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg2);
  font-size: 12.5px;
  color: var(--text3);
}
.wiz-step.is-active { border-color: var(--border-a); color: var(--text); background: var(--accent-glow); }
.wiz-step.is-active .wiz-dot { border-color: var(--border-a); background: var(--accent); color: var(--bg); }
.wiz-step.is-done { color: var(--text2); }
.wiz-step.is-done .wiz-dot { border-color: var(--border-a); background: var(--accent-glow); color: var(--accent); }

/* Step panels */
.wiz-panel { display: flex; flex-direction: column; gap: 16px; }
.wiz-heading { font-family: 'Philosopher', serif; font-size: 19px; color: var(--text); margin: 0; font-weight: 600; }
.wiz-heading span { color: var(--text3); font-size: 13.5px; font-weight: 400; }

/* Type choice — the paramount first question, as two big cards */
.wiz-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 720px; }
.wiz-card { position: relative; display: block; cursor: pointer; }
.wiz-card input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.wiz-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}
.wiz-card:hover .wiz-card-body { border-color: var(--border-a); }
.wiz-card input:checked + .wiz-card-body { border-color: var(--border-a); background: var(--accent-glow); }
.wiz-card input:focus-visible + .wiz-card-body { border-color: var(--border-a); }
.wiz-card-emoji { font-size: 28px; line-height: 1; }
.wiz-card-title { font-family: 'Philosopher', serif; font-size: 17px; color: var(--text); }
.wiz-card-desc { font-family: 'Philosopher', serif; font-size: 13.5px; color: var(--text3); line-height: 1.5; }

/* Navigation */
.wiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  max-width: 720px;
}
.wiz-nav-right { display: flex; gap: 10px; margin-left: auto; }
.wiz-error { color: #e8a98c; font-family: 'Philosopher', serif; font-size: 13.5px; margin: 0; }

@media (max-width: 560px) {
  .wiz-choice { grid-template-columns: 1fr; }
}

/* ── Seed list (draggable) ────────────────────────────────── */
.seed-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.seed-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: grab;
}
.seed-item:hover { border-color: var(--border-a); }
.seed-grip { color: var(--text3); letter-spacing: -2px; }
.seed-num {
  width: 24px; height: 24px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent-glow); color: var(--accent);
  font-size: 12px;
}
.seed-name { flex: 1; font-family: 'Philosopher', serif; }
.seed-link { color: var(--gold); }
.seed-actions { margin-top: 10px; display: inline-flex; }

.entrant-delete-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip-del {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text2);
  font-family: 'Philosopher', serif; font-size: 12.5px;
  padding: 5px 10px; cursor: pointer;
}
.chip-del:hover { color: #e8a98c; border-color: rgba(201,80,44,0.45); }

/* ── Bracket ──────────────────────────────────────────────── */
.champion-banner {
  padding: 16px 20px; border-radius: var(--radius);
  border: 1px solid rgba(184,146,58,0.4); background: rgba(184,146,58,0.12);
  color: var(--gold); font-family: 'Philosopher', serif; font-size: 18px;
  margin-bottom: 24px;
}

/* Columns stretch to equal height so the connector geometry lines up. */
.bx-scroll { display: flex; align-items: stretch; overflow-x: auto; padding-bottom: 12px; }
.bx-round { display: flex; flex-direction: column; min-width: 232px; margin-right: 44px; }
.bx-round:last-child { margin-right: 0; }
.bx-round-label {
  font-family: 'Philosopher', serif; font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text3); text-align: center; margin-bottom: 12px;
}
.bx-cells { flex: 1; display: flex; flex-direction: column; }
.bx-cell { flex: 1; display: flex; align-items: center; position: relative; min-height: 78px; padding: 6px 0; }

.bx-match {
  width: 100%;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
}
.bx-match.ready { border-color: var(--border-a); }
.bx-match.done { opacity: 0.94; }

.bx-seat {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; font-family: 'Philosopher', serif; font-size: 14px;
  border-bottom: 1px solid var(--border); color: var(--text2);
}
.bx-seat:last-child { border-bottom: none; }
.bx-seat.win { color: var(--text); background: var(--accent-glow); }
.bx-seat.win .bx-name::after { content: ' ✓'; color: var(--accent); }
.bx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-score-inline { color: var(--accent); font-size: 13px; flex: none; }

.bx-meta {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 12px; font-size: 12px; color: var(--text3);
  border-top: 1px solid var(--border);
}

/* Inline winner pick — the whole seat row is the button */
.bx-pickform { display: flex; flex-direction: column; }
.bx-seat-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid var(--border);
  color: var(--text2); font-family: 'Philosopher', serif; font-size: 14px; padding: 9px 12px;
}
.bx-seat-btn:hover { background: var(--accent-glow); color: var(--text); }
.bx-win {
  font-size: 11px; color: var(--accent); border: 1px solid var(--border-a);
  border-radius: 999px; padding: 2px 9px; background: var(--accent-glow); flex: none;
}
.bx-seat-btn:hover .bx-win { background: var(--accent); color: var(--bg); }

.bx-score {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: 'Philosopher', serif; font-size: 12px; padding: 5px 8px; width: 100%;
}
.bx-pickform .bx-score { border-radius: 0; border-left: none; border-right: none; border-bottom: none; }
.bx-sched { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }
.bx-sched .bx-score { flex: 1; }

/* ── Connector lines (elimination trees only) ─────────────── */
.bx-tree .bx-round:not(:last-child) .bx-cell::after {
  content: ''; position: absolute; left: 100%; width: 22px;
}
/* Halving rounds: Y connector (odd cell drops down, even rises up to meet). */
.bx-tree .bx-round:not(:last-child):not(.r-straight) .bx-cell:nth-child(odd)::after {
  top: 50%; height: 50%;
  border-top: 2px solid rgba(237, 224, 200, 0.16);
  border-right: 2px solid rgba(237, 224, 200, 0.16);
}
.bx-tree .bx-round:not(:last-child):not(.r-straight) .bx-cell:nth-child(even)::after {
  bottom: 50%; height: 50%;
  border-bottom: 2px solid rgba(237, 224, 200, 0.16);
  border-right: 2px solid rgba(237, 224, 200, 0.16);
}
/* 1:1 "minor" rounds (losers bracket): straight horizontal line. */
.bx-tree .bx-round.r-straight:not(:last-child) .bx-cell::after {
  top: 50%; height: 0;
  border-top: 2px solid rgba(237, 224, 200, 0.16);
}
.bx-tree .bx-round:not(:first-child) .bx-cell::before {
  content: ''; position: absolute; right: 100%; top: 50%; width: 22px;
  border-top: 2px solid rgba(237, 224, 200, 0.16);
}

.tile.is-hidden { opacity: 0.55; }

/* ── Public tournament overview + standings ───────────────── */
.t-overview { margin-bottom: 22px; display: flex; flex-direction: column; gap: 12px; }
.t-desc {
  color: var(--text2); font-family: 'Philosopher', serif; font-size: 15px;
  line-height: 1.6; max-width: 760px; white-space: pre-line;
}
.t-facts { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.t-fact { color: var(--text3); font-family: 'Philosopher', serif; font-size: 13.5px; }

.standings-table { width: 100%; border-collapse: collapse; max-width: 560px; }
.standings-table th, .standings-table td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: 'Philosopher', serif; font-size: 14px;
}
.standings-table th {
  color: var(--text3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
.standings-table td:first-child, .standings-table th:first-child { width: 36px; color: var(--text3); }
.standings-table tbody tr:first-child td { color: var(--text); }
.standings-table tbody tr:first-child td:first-child { color: var(--gold); }

/* ── Featured tournaments block on the public title page ──── */
.featured-tournaments {
  width: 100%;
  max-width: 920px;
  margin: 28px auto 0;
  padding: 0 20px;
}
.ft-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.ft-title {
  font-family: 'Philosopher', serif; font-size: 20px; font-weight: 600; color: var(--text);
}
.ft-browse { color: var(--accent); font-family: 'Philosopher', serif; font-size: 14px; }
.ft-browse:hover { text-decoration: underline; }

/* Browse results count */
.results-count {
  color: var(--text3); font-family: 'Philosopher', serif; font-size: 13.5px;
  margin: 18px 0 4px;
}
