:root {
  --bg: #0b0d17;
  --bg-2: #12152a;
  --panel: #171b33;
  --panel-2: #1f2443;
  --line: #2c3260;
  --text: #eef0ff;
  --muted: #9097c4;
  --a: #22d3ee;
  --a-deep: #0e7490;
  --b: #f472b6;
  --b-deep: #9d174d;
  --gold: #fbbf24;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bebas Neue', 'Impact', 'Arial Narrow', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 20% -10%, #1d2150 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--a); }

.muted { color: var(--muted); }

button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0.6em 1.1em;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--muted); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); border-color: transparent; }
button.go { background: linear-gradient(135deg, #16a34a, #22c55e); border-color: transparent; color: #04140a; }
button.warn { background: linear-gradient(135deg, #d97706, #f59e0b); border-color: transparent; color: #1c1002; }
button.danger { background: transparent; border-color: #7f1d1d; color: var(--danger); }
button.danger:hover:not(:disabled) { background: #3b0d0d; }
button.ghost { background: transparent; }
button.small { padding: 0.3em 0.65em; font-size: 0.85em; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55em 0.75em;
  min-width: 0;
}
input:focus { outline: 2px solid #6366f1; outline-offset: 1px; }
input[type='checkbox'] { width: 1.15em; height: 1.15em; accent-color: #8b5cf6; }

/* ---------- avatars ---------- */
.avatar { display: block; object-fit: cover; background: var(--panel-2); }
.avatar-initials { display: grid; place-items: center; color: #fff; font-family: var(--display); letter-spacing: 0.04em; container-type: inline-size; }
.avatar-initials span { font-size: 40cqw; line-height: 1; }
.avatar-empty { background: repeating-linear-gradient(45deg, var(--panel), var(--panel) 6px, var(--panel-2) 6px, var(--panel-2) 12px); }

/* ---------- bracket ---------- */
.bracket { display: flex; gap: 28px; align-items: stretch; min-width: max-content; }
.bracket-round { display: flex; flex-direction: column; width: 210px; }
.bracket-round-title { font-family: var(--display); font-size: 1.25rem; letter-spacing: 0.06em; color: var(--muted); text-align: center; margin-bottom: 8px; }
.bracket-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.bracket-match { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bracket-match.bye { opacity: 0.45; }
.bracket-match.current { border-color: var(--gold); box-shadow: 0 0 0 2px rgb(251 191 36 / 0.35), 0 0 24px rgb(251 191 36 / 0.25); }
.bracket-match.champion.crowned { border-color: var(--gold); background: linear-gradient(135deg, #3b2a05, var(--panel)); }
.bracket-slot { display: flex; align-items: center; gap: 8px; padding: 5px 8px; min-height: 36px; }
.bracket-slot + .bracket-slot { border-top: 1px solid var(--line); }
.bracket-slot.won { background: rgb(74 222 128 / 0.1); font-weight: 700; }
.bracket-slot.lost { opacity: 0.45; text-decoration: line-through; text-decoration-color: rgb(255 255 255 / 0.3); }
.bracket-avatar { width: 26px; height: 26px; border-radius: 6px; flex: none; }
.bracket-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; }
.bracket-score { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; translate: -50% 0; display: grid; gap: 8px; z-index: 1000; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 30px rgb(0 0 0 / 0.4); transition: opacity 0.4s, translate 0.4s; }
.toast-error { border-color: #7f1d1d; background: #2a0f14; }
.toast-ok { border-color: #14532d; background: #0d2416; }
.toast.hide { opacity: 0; translate: 0 8px; }
