:root {
    --bg-base: #0a0c10;
    --bg-surface: #11151f;
    --bg-surface-alt: #161c2a;
    --border: #222b3d;
    --border-bright: #323e59;
    --gold: #facc15;
    --gold-glow: rgba(250, 204, 21, 0.25);
    --accent-red: #e10600;
    --text-main: #f3f5f9;
    --text-muted: #8491a5;
    --text-dim: #505c70;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* CONTENT CONTAINER RESTORED TO CENTERED WIDTH */
.container {
    max-width: 1240px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1.5rem;
}

/* FULL-WIDTH HEADBAR STRETCHING TO EDGES */
nav {
    background: rgba(17, 21, 31, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 75px;
    width: 100%;
    max-width: 100%;
    padding: 0 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
    cursor: pointer;
}

.logo-img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.logo-text span {
    color: var(--gold);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-item {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-item:hover, .nav-item.active {
    color: #fff;
    background: var(--bg-surface-alt);
    border-color: var(--border-bright);
}

.auth-block {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.2s ease;
}

.btn-steam {
    background: #171a21;
    color: #c5c3c0;
    border: 1px solid #2a475e;
}

.btn-steam:hover {
    background: #2a475e;
    color: #fff;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), #ca8a04);
    color: #000;
    box-shadow: 0 0 15px var(--gold-glow);
}

.btn-gold:hover {
    filter: brightness(1.1);
}

.page {
    display: none;
    padding: 2rem 0;
}

.page.active {
    display: block;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    text-align: left;
    font-size: 0.9rem;
}

th {
    padding: 0.75rem 1rem;
    color: var(--text-dim);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.75rem 1rem;
    background: rgba(22, 28, 42, 0.45);
    border-top: 1px solid rgba(34, 43, 61, 0.5);
    border-bottom: 1px solid rgba(34, 43, 61, 0.5);
    vertical-align: middle;
}

tr td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-left: 1px solid rgba(34, 43, 61, 0.5);
}

tr td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-right: 1px solid rgba(34, 43, 61, 0.5);
}

tr:hover td {
    background: var(--bg-surface-alt);
    border-color: var(--border-bright);
}

/* ==========================================================
   CHIPS & BADGES
   ========================================================== */
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.chip-pos-1 { background: rgba(234, 179, 8, 0.18) !important; color: #facc15 !important; border: 1px solid #eab308 !important; box-shadow: 0 0 10px rgba(234, 179, 8, 0.25); font-weight: 800; }
.chip-pos-2 { background: rgba(203, 213, 225, 0.15) !important; color: #e2e8f0 !important; border: 1px solid #94a3b8 !important; font-weight: 800; }
.chip-pos-3 { background: rgba(217, 119, 6, 0.18) !important; color: #fb923c !important; border: 1px solid #ea580c !important; font-weight: 800; }
.chip-pos-other { background: rgba(255, 255, 255, 0.06) !important; color: #ffffff !important; border: 1px solid rgba(255, 255, 255, 0.2) !important; font-weight: 800; }

.chip-driver {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.3px;
}
.chip-driver:hover {
    background: rgba(250, 204, 21, 0.15);
    border-color: #facc15;
    color: #facc15 !important;
}

.chip-team { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.12); color: #ffffff !important; }
.chip-team-empty { color: var(--text-dim) !important; border-color: transparent; background: transparent; }

.chip-races { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.15); color: #ffffff !important; font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.chip-wins { background: rgba(234, 179, 8, 0.15); border: 1px solid rgba(234, 179, 8, 0.4); color: #facc15 !important; font-family: 'JetBrains Mono', monospace; font-weight: 800; }
.chip-podiums { background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(34, 197, 94, 0.4); color: #22c55e !important; font-family: 'JetBrains Mono', monospace; font-weight: 800; }
.chip-points { background: rgba(234, 179, 8, 0.15); border: 1px solid rgba(234, 179, 8, 0.45); color: #facc15 !important; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.chip-time { background: rgba(250, 204, 21, 0.1); border: 1px solid rgba(250, 204, 21, 0.35); color: #facc15 !important; font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.chip-car { background: rgba(129, 140, 248, 0.1); border: 1px solid rgba(129, 140, 248, 0.3); color: #c7d2fe; }
.chip-track { background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.35); color: #38bdf8; font-weight: 800; }
.chip-official { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.35); color: #10b981; font-weight: 800; letter-spacing: 1px; }

.chip-status-online { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.35); color: #10b981; font-weight: 800; }
.chip-status-offline { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.35); color: #ef4444; font-weight: 800; }

/* ACCORDIONS */
.race-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s ease;
}
.race-card:hover { border-color: var(--border-bright); }
.race-accordion-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; cursor: pointer; user-select: none; background: var(--bg-surface); transition: background-color 0.2s ease; }
.race-accordion-header:hover { background: var(--bg-surface-alt); }
.race-header-info { display: flex; flex-direction: column; gap: 0.25rem; }
.race-header-meta { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.chevron-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; transition: transform 0.25s ease, background-color 0.2s ease; }
.race-card.open .chevron-icon { transform: rotate(180deg); background: rgba(250, 204, 21, 0.15); color: var(--gold); border-color: var(--gold); }
.race-accordion-body { display: none; padding: 0 1.5rem 1.5rem 1.5rem; border-top: 1px solid var(--border); background: rgba(10, 12, 16, 0.4); }
.race-card.open .race-accordion-body { display: block; }

/* PROFILE VIEW */
.profile-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2rem; }
.profile-avatar { width: 64px !important; height: 64px !important; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; box-shadow: 0 0 14px var(--gold-glow); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-box { background: var(--bg-surface-alt); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; text-align: center; }
.stat-val { font-size: 1.75rem; font-weight: 900; color: #fff; margin-top: 0.25rem; font-family: 'JetBrains Mono', monospace; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }

.filter-bar { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.input-dark { background: var(--bg-surface-alt); border: 1px solid var(--border); color: #fff; padding: 0.6rem 1rem; border-radius: 6px; font-size: 0.9rem; outline: none; }
.input-dark:focus { border-color: var(--gold); }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--text-muted); }
.form-group input, .form-group textarea { width: 100%; }

footer { margin-top: auto; border-top: 1px solid var(--border); padding: 2rem 0; background: var(--bg-surface); font-size: 0.85rem; color: var(--text-muted); text-align: center; }