*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #0d1117;
    --surface:  #161b22;
    --surface2: #21262d;
    --border:   #30363d;
    --text:     #e6edf3;
    --muted:    #7d8590;
    --accent:   #388bfd;
    --green:    #1a6c38;
    --green-t:  #4ade80;
    --yellow:   #7a5c00;
    --yellow-t: #fbbf24;
    --red:      #6e1c1c;
    --red-t:    #f87171;
    --radius:   8px;
}

body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; min-height: 100vh; }

/* ── Nav ── */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-nav { max-width: 1100px; margin: 0 auto; padding: 0.75rem 1rem; display: flex; align-items: center; gap: 1.25rem; }
.nav-logo { font-size: 1.2rem; text-decoration: none; font-weight: 700; color: var(--text); }
.nav-links { display: flex; gap: 1rem; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-right { margin-left: auto; display: flex; gap: 0.75rem; align-items: center; font-size: 0.88rem; color: var(--muted); }
.nav-right a { color: var(--muted); text-decoration: none; }
.nav-right a:hover { color: var(--text); }

/* ── Page ── */
.page { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }
.page-title { font-size: 1.5rem; margin-bottom: 0.4rem; }
.page-sub { color: var(--muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.section-title { font-size: 1rem; color: var(--muted); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.card h2 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.card-meta { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.5rem; }
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }

/* ── Buttons ── */
.btn { padding: 0.45rem 1rem; border-radius: 6px; font-size: 0.88rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: var(--red); color: #fca5a5; border: 1px solid #7f1d1d; }
.btn-danger:hover { background: #7f1d1d; }
.btn-success { background: var(--green); color: var(--green-t); border: 1px solid #166534; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-group label { font-size: 0.85rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], select, textarea {
    background: var(--surface2); border: 1px solid var(--border); color: var(--text);
    padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 0.9rem; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.78rem; color: var(--muted); }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

/* ── Badges ── */
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-draft     { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.badge-open      { background: #1c3a6e22; color: #60a5fa; border: 1px solid #2563eb44; }
.badge-active    { background: #1a6c3822; color: var(--green-t); border: 1px solid var(--green); }
.badge-completed { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.badge-ko        { background: #4a1d6c22; color: #c084fc; border: 1px solid #7c3aed44; }
.badge-league    { background: #1c3a6e22; color: #60a5fa; border: 1px solid #2563eb44; }

/* ── Standings table ── */
.standings-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.standings-table th { background: var(--surface2); color: var(--muted); text-align: left; padding: 0.45rem 0.75rem; font-weight: 600; }
.standings-table td { padding: 0.45rem 0.75rem; border-top: 1px solid var(--border); }
.standings-table tr.highlight td { background: #161e2e; }
.pos-cell { font-weight: 700; color: var(--muted); width: 32px; }
.pts-cell { font-weight: 700; color: var(--accent); }

/* ── Match list ── */
.match-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.match-teams { flex: 1; font-weight: 600; }
.match-score { font-size: 1.1rem; font-weight: 700; min-width: 60px; text-align: center; color: var(--accent); }
.match-meta { font-size: 0.78rem; color: var(--muted); }
.match-status { font-size: 0.75rem; }
.status-pending   { color: var(--muted); }
.status-submitted { color: var(--yellow-t); }
.status-confirmed { color: var(--green-t); }

/* ── Bracket ── */
.bracket-wrap { overflow-x: auto; padding: 1rem 0; }
.bracket { display: flex; gap: 2rem; align-items: stretch; }
.bracket-round { display: flex; flex-direction: column; gap: 0; min-width: 180px; }
.bracket-round-title { font-size: 0.78rem; color: var(--muted); text-align: center; margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.bracket-spacer { flex: 1; }
.bracket-match { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.75rem; margin: 0.25rem 0; }
.bracket-team { font-size: 0.85rem; padding: 0.2rem 0; display: flex; justify-content: space-between; }
.bracket-team.winner { color: var(--green-t); font-weight: 700; }
.bracket-team.loser  { color: var(--muted); }
.bracket-team.tbd    { color: var(--muted); font-style: italic; }
.bracket-score { font-weight: 700; margin-left: 0.5rem; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab { padding: 0.6rem 1.1rem; font-size: 0.9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Stat grid ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1.5rem; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.stat-box .num { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat-box .lbl { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }

/* ── Login ── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 2.5rem; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 1.25rem; }
.login-box h1 { text-align: center; font-size: 1.4rem; }
.login-icon { text-align: center; font-size: 2.5rem; }
.error { color: #e84040; font-size: 0.88rem; text-align: center; }
.success { color: var(--green-t); font-size: 0.88rem; text-align: center; }

/* ── Notice ── */
.notice { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.notice-info    { background: #161e2e; border: 1px solid var(--accent); }
.notice-success { background: #1a6c3822; border: 1px solid var(--green); color: var(--green-t); }
.notice-warn    { background: #7a5c0022; border: 1px solid var(--yellow); color: var(--yellow-t); }

/* ── Empty state ── */
.empty-state { color: var(--muted); padding: 3rem 0; text-align: center; }

/* ── Footer ── */
.site-footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.82rem;
    border-top: 1px solid var(--border); margin-top: 3rem; }

/* ── Team name suggest ── */
.name-suggest { display: flex; gap: 0.5rem; }
.name-suggest input { flex: 1; }

@media (max-width: 600px) {
    .nav-links { display: none; }
    .bracket-round { min-width: 140px; }
    .form-row { flex-direction: column; }
}

/* ── Help page ── */
.help-tip { background: #161e2e; border: 1px solid var(--accent); border-radius: var(--radius); padding: 0.875rem 1rem; margin-top: 1rem; font-size: 0.9rem; }
