:root {
    --bg: #0e0f13;
    --bg-elev: #16181f;
    --bg-card: #1b1e27;
    --bg-row: #181b23;
    --bg-row-alt: #1d212b;
    --border: #272b36;
    --text: #e7e9ee;
    --text-dim: #9aa0ad;
    --text-faint: #6b7280;
    --accent: #7c5cff;
    --accent-2: #56d4c5;
    --gold: #f5c451;
    --silver: #c7ccd6;
    --bronze: #cd853f;
    --green: #3fb96b;
    --red: #e0556b;
    --amber: #e0a13a;
    --radius: 12px;
    --radius-sm: 8px;
    font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Inter, system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ===== Header ===== */
.site-header {
    background: rgba(16, 17, 23, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { font-size: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-sub { color: var(--text-dim); font-size: 0.78rem; }

.main-nav { display: flex; gap: 4px; }
.nav-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { color: var(--text); background: var(--bg-elev); }
.nav-btn.active { color: var(--text); background: var(--bg-card); }
.nav-cta {
    background: var(--accent);
    color: #fff;
}
.nav-cta:hover { background: #6a4ae6; color: #fff; }
.nav-cta.active { background: #6a4ae6; color: #fff; }

/* ===== Hero ===== */
.hero {
    background:
        radial-gradient(1200px 400px at 50% -120px, rgba(124, 92, 255, 0.25), transparent 70%),
        linear-gradient(180deg, var(--bg-elev), var(--bg));
    border-bottom: 1px solid var(--border);
    padding: 48px 20px 36px;
}
.hero-inner { max-width: 1080px; margin: 0 auto; text-align: center; }
.hero-badge {
    display: inline-block;
    background: rgba(124, 92, 255, 0.15);
    color: var(--accent-2);
    border: 1px solid rgba(124, 92, 255, 0.35);
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.hero-title {
    font-size: clamp(1.9rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(120deg, #fff, #b9aaff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-desc { color: var(--text-dim); margin-top: 10px; font-size: 1.05rem; }
.hero-meta {
    display: flex;
    justify-content: center;
    gap: 36px;
    margin-top: 28px;
    flex-wrap: wrap;
}
.hero-stat { display: flex; flex-direction: column; align-items: center; }
.hero-stat-val { font-size: 1.6rem; font-weight: 800; }
.hero-stat-label { color: var(--text-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== Layout ===== */
.container {
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px 60px;
    flex: 1;
}
.tab-panel { display: none; animation: fade 0.25s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { font-size: 1.5rem; font-weight: 700; }
.panel-head.sub { margin-bottom: 14px; }
.panel-head h3 { font-size: 1.1rem; font-weight: 700; }
.panel-sub { color: var(--text-dim); font-size: 0.9rem; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

/* ===== Leaderboard table ===== */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table thead th {
    text-align: left;
    color: var(--text-faint);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elev);
}
.col-rank { width: 64px; text-align: center !important; }
.col-time { width: 130px; }
.col-status { width: 120px; }
.col-proof { width: 80px; }
.col-date { width: 130px; }

.lb-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
.lb-table tbody tr:last-child { border-bottom: none; }
.lb-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.lb-table tbody tr:hover { background: #222633; }
.lb-table td { padding: 13px 16px; font-size: 0.92rem; vertical-align: middle; }

.rank-cell { text-align: center; font-weight: 800; font-size: 1rem; color: var(--text-dim); }
.rank-1 .rank-cell { color: var(--gold); }
.rank-2 .rank-cell { color: var(--silver); }
.rank-3 .rank-cell { color: var(--bronze); }
.medal { font-size: 1.1rem; }

.player-cell { display: flex; align-items: center; gap: 10px; }
.player-head {
    width: 28px; height: 28px;
    border-radius: 6px;
    background: var(--bg-elev);
    image-rendering: pixelated;
    flex-shrink: 0;
}
.player-name { font-weight: 600; }

.time-cell { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.98rem; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    border: 1px solid transparent;
}
.status-accepted { color: var(--green); background: rgba(63, 185, 107, 0.12); border-color: rgba(63, 185, 107, 0.3); }
.status-pending  { color: var(--amber); background: rgba(224, 161, 58, 0.12); border-color: rgba(224, 161, 58, 0.3); }
.status-rejected { color: var(--red);   background: rgba(224, 85, 107, 0.12); border-color: rgba(224, 85, 107, 0.3); }

.proof-link { color: var(--accent-2); text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.proof-link:hover { text-decoration: underline; }
.proof-none { color: var(--text-faint); }

.date-cell { color: var(--text-dim); font-size: 0.85rem; }
.lb-empty { text-align: center; color: var(--text-faint); padding: 40px !important; }

/* ===== Rules ===== */
.rules-intro { color: var(--text-dim); margin-bottom: 16px; }
.rules-list { list-style: none; counter-reset: rule; }
.rules-list li {
    counter-increment: rule;
    position: relative;
    padding: 12px 0 12px 44px;
    border-bottom: 1px solid var(--border);
}
.rules-list li:last-child { border-bottom: none; }
.rules-list li::before {
    content: counter(rule);
    position: absolute;
    left: 0; top: 10px;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(124, 92, 255, 0.15);
    color: var(--accent-2);
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.85rem;
}

/* ===== Forms ===== */
.form-card { max-width: 560px; }
.form-intro { color: var(--text-dim); margin-bottom: 20px; font-size: 0.95rem; }
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.field-floor { max-width: 120px; }
.field-label { font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.field-hint { font-size: 0.74rem; color: var(--text-faint); }
.field input, .field select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; align-self: flex-start; }
.btn-primary:hover { background: #6a4ae6; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-discord {
    background: #5865F2;
    color: #fff;
    align-self: flex-start;
    gap: 8px;
}
.btn-discord:hover { background: #4752c4; }
.btn-discord:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-discord .discord-logo { font-size: 1.05em; line-height: 1; }

.field-hint { font-size: 0.8rem; color: var(--text-faint); }

.form-msg { font-size: 0.88rem; min-height: 1.2em; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--red); }

/* ===== Chips ===== */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 12px 5px 6px;
    font-size: 0.85rem;
    font-weight: 600;
}
.chip img { width: 20px; height: 20px; border-radius: 4px; image-rendering: pixelated; }
.chip-empty { color: var(--text-faint); }
.chip-verified { border-color: rgba(88, 101, 242, 0.55); }
.chip-check { color: #5865F2; font-weight: 800; font-size: 0.85em; }

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.footer-dot { opacity: 0.5; }

/* ===== Bracket ===== */
.bracket-scroll {
    overflow-x: auto;
    /* Break out of the narrow 1080px content column to use the full screen width */
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    padding: 8px 32px 16px;
}
.bracket {
    display: flex;
    gap: 32px;
    align-items: stretch;
    min-width: min-content;
    max-width: 1700px;
    margin: 0 auto;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 220px;
    max-width: 360px;
}
.round-title {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    padding-bottom: 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.round-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    gap: 14px;
}
.match {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
}
.slot + .slot { border-top: 1px solid var(--border); }
.slot-head {
    width: 22px; height: 22px;
    border-radius: 4px;
    flex-shrink: 0;
    background: var(--bg-elev);
}
.slot-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.slot-seed {
    font-size: 0.72rem;
    color: var(--text-faint);
    font-weight: 600;
}
.slot-empty .slot-name { color: var(--text-faint); }
.slot-win {
    background: linear-gradient(90deg, rgba(124, 92, 255, 0.16), transparent);
}
.slot-win .slot-name { font-weight: 700; }
.slot-win::after {
    content: '\2713';
    color: var(--accent-2);
    font-weight: 700;
    margin-left: 4px;
}
.slot-lose { opacity: 0.5; }
.slot-lose .slot-name { text-decoration: line-through; }

.champion-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, rgba(245, 196, 81, 0.16), rgba(245, 196, 81, 0.02));
    border: 1px solid rgba(245, 196, 81, 0.4);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 18px;
    font-size: 1.1rem;
}
.champion-trophy { font-size: 1.5rem; }
.champion-head { width: 32px; height: 32px; border-radius: 6px; }
.champion-text strong { color: var(--gold); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
    .header-inner { height: auto; flex-direction: column; padding: 12px 16px; gap: 10px; }
    .main-nav { width: 100%; justify-content: center; flex-wrap: wrap; }
    .hero-meta { gap: 22px; }
    .col-date, .col-status { display: none; }
    .field-row { flex-direction: column; }
    .field-floor { max-width: none; }
}
