:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c2230;
  --border: #2a3240;
  --text: #e7ecf3;
  --muted: #8b96a7;
  --accent: #f0b429;
  --accent-2: #d49016;
  --good: #2ea043;
  --bad: #cf3a3a;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03), 0 4px 14px rgba(0,0,0,0.25);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(14,17,22,0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
  font-size: 18px;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.site-header nav a {
  margin-left: 18px;
  color: var(--muted);
  font-weight: 500;
}
.site-header nav a[aria-current="page"],
.site-header nav a:hover { color: var(--text); text-decoration: none; }

.hero { padding: 36px 0 8px; }
.hero h1 { font-size: 32px; margin: 0 0 8px; }
.lede { color: var(--muted); margin: 0 0 16px; max-width: 720px; }
.muted { color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 20px; }

.field { display: flex; flex-direction: column; margin: 12px 0; }
.field label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color 0.12s ease;
}
.field input:focus { border-color: var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.btn-primary, .btn-ghost {
  display: inline-block;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s ease, transform 0.05s ease;
}
.btn-primary {
  background: var(--accent);
  color: #1a1300;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--panel-2); }
.bracket-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.form-status { min-height: 1.4em; margin: 12px 0 0; font-size: 14px; }
.form-status.ok { color: var(--good); }
.form-status.err { color: var(--bad); }

.steps { padding-left: 20px; }
.steps li { margin: 6px 0; color: var(--muted); }
.steps strong { color: var(--text); }

.signup-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: tlist;
}
.signup-list li {
  counter-increment: tlist;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.signup-list li::before {
  content: counter(tlist);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1300;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

/* Bracket layout */
.bracket {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.round {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}
.round-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.round-r1 .matches { display: flex; flex-direction: column; gap: 8px; }
.round-qf .matches { display: flex; flex-direction: column; justify-content: space-around; height: 100%; gap: 16px; }
.round-sf .matches { display: flex; flex-direction: column; justify-content: space-around; height: 100%; gap: 40px; }
.round-f  .matches { display: flex; flex-direction: column; justify-content: center; height: 100%; }

.match {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.match-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.match-meta .format-tag {
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  cursor: pointer;
  user-select: none;
  border-top: 1px solid var(--border);
  font-size: 14px;
  gap: 8px;
}
.slot:first-of-type { border-top: none; }
.slot:hover:not(.disabled):not(.empty) { background: rgba(240,180,41,0.08); }
.slot.winner { background: rgba(46,160,67,0.12); color: var(--text); }
.slot.winner .team-name::before {
  content: "✓ ";
  color: var(--good);
  font-weight: 700;
}
.slot.loser { color: var(--muted); text-decoration: line-through; }
.slot.empty { color: var(--muted); font-style: italic; cursor: default; }
.slot.disabled { cursor: not-allowed; opacity: 0.7; }
.slot .team-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .score {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  min-width: 22px;
  text-align: right;
}

.site-footer {
  margin-top: 40px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 880px) {
  .bracket { grid-template-columns: repeat(4, minmax(200px, 1fr)); }
}
