:root {
    --bg: #090d12;
    --panel: #111821;
    --panel-2: #151e28;
    --line: rgba(255, 255, 255, .09);
    --muted: #8995a3;
    --text: #f2f5f8;
    --red: #ed3944;
    --blue: #45a7ff;
    --green: #42d18d;
    --amber: #f2b84b;
    --radius: 18px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 75% -10%, rgba(38, 91, 137, .24), transparent 34rem),
        linear-gradient(135deg, rgba(255,255,255,.02) 25%, transparent 25%) 0 0 / 34px 34px,
        var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    min-height: 78px;
    padding: 0 3vw;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2.5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(9, 13, 18, .88);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.brand b { display: block; font-size: 1.05rem; }
.brand small { display: block; color: var(--muted); font-size: .61rem; letter-spacing: .15em; margin-top: .12rem; }
.brand-flag { width: 42px; height: 42px; padding: 8px; display: flex; gap: 3px; transform: skew(-8deg); background: var(--red); }
.brand-flag i { flex: 1; background: #fff; }
.brand-flag i:nth-child(2) { opacity: .55; }
.brand-flag i:nth-child(3) { opacity: .2; }
.main-nav { display: flex; align-items: stretch; justify-content: center; height: 78px; }
.main-nav a, .main-nav .nav-future {
    display: flex;
    align-items: center;
    padding: 0 .82rem;
    color: #9ca7b3;
    font-size: .78rem;
    font-weight: 750;
    letter-spacing: .045em;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.main-nav a:hover { color: #fff; }
.main-nav a.active { color: #fff; border-bottom-color: var(--red); background: linear-gradient(0deg, rgba(237,57,68,.1), transparent 70%); }
.main-nav .nav-future { opacity: .35; cursor: not-allowed; }
.driver-chip { display: flex; align-items: center; gap: .65rem; min-width: 155px; }
.driver-chip span:not(.status-dot) { display: flex; flex-direction: column; }
.driver-chip small { color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; }
.driver-chip b { font-size: .82rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.language-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); }
.language-switch form { display: flex; }
.language-switch button { min-width: 34px; height: 28px; padding: 0 .55rem; border: 0; border-radius: 999px; color: #77838f; background: transparent; cursor: pointer; font-size: .65rem; font-weight: 850; letter-spacing: .08em; }
.language-switch button:hover { color: #fff; }
.language-switch button.active { color: #fff; background: var(--red); box-shadow: 0 5px 18px rgba(237,57,68,.25); }
.nav-toggle { display: none; }

.main-content { width: min(1480px, 94vw); margin: 0 auto; flex: 1; padding: 3rem 0 4rem; }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.4rem 3vw; color: #677381; border-top: 1px solid var(--line); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.page-heading h1 { margin: .35rem 0 .5rem; font-size: clamp(2rem, 4vw, 4.2rem); line-height: .98; letter-spacing: -.055em; max-width: 900px; }
.page-heading p { margin: 0; color: var(--muted); max-width: 720px; }
.eyebrow { color: var(--red); font-size: .7rem; font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.cycle-badge, .zone-legend { color: #b8c1ca; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
.cycle-badge span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: .45rem; }
.zone-legend span { display: inline-block; width: 9px; height: 9px; margin: 0 .35rem 0 .8rem; }
.zone-legend .promote { background: var(--green); }
.zone-legend .relegate { background: var(--red); }

.metric-grid { display: grid; grid-template-columns: 1.45fr repeat(3, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.metric-card { min-height: 136px; padding: 1.25rem; position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.015)); }
.metric-card::after { content: ""; position: absolute; width: 90px; height: 4px; left: 1.25rem; bottom: 0; background: #44515d; }
.metric-card.accent-red::after { background: var(--red); }
.metric-card.accent-blue::after { background: var(--blue); }
.metric-card > span { display: block; color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.metric-card > strong { display: block; margin: 1rem 0 .35rem; font-size: clamp(1.45rem, 2vw, 2rem); letter-spacing: -.035em; }
.metric-card small, .metric-card time { color: #8996a3; font-size: .75rem; }

.dashboard-stage, .driver-page-grid, .car-development-grid { display: grid; grid-template-columns: minmax(320px, 410px) 1fr; gap: 1.4rem; align-items: stretch; }
.driver-card-column { min-width: 0; }
.driver-set-card { --tier: #b9c2ca; min-height: 620px; padding: 1.7rem; border-radius: 28px; position: relative; overflow: hidden; display: flex; flex-direction: column; isolation: isolate; background: linear-gradient(155deg, color-mix(in srgb, var(--tier) 44%, #202731), #0b1016 52%, color-mix(in srgb, var(--tier) 28%, #10161d)); border: 2px solid color-mix(in srgb, var(--tier) 64%, transparent); box-shadow: 0 24px 70px rgba(0,0,0,.4), inset 0 0 0 6px rgba(0,0,0,.22); }
.driver-set-card::before, .driver-set-card::after { content: ""; position: absolute; inset: 12px; border: 1px solid color-mix(in srgb, var(--tier) 45%, transparent); border-radius: 20px; z-index: -1; }
.driver-set-card::after { inset: auto -20% 35% -20%; height: 120px; transform: rotate(-8deg); border: 0; border-top: 2px solid color-mix(in srgb, var(--tier) 60%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--tier) 35%, transparent); border-radius: 0; background: rgba(0,0,0,.12); }
.tier-bronze { --tier: #b46b47; }
.tier-silver { --tier: #bbc5ce; }
.tier-gold { --tier: #e7bd4f; }
.tier-platinum { --tier: #62b9d3; }
.tier-elite { --tier: #d65cff; }
.card-sheen { position: absolute; inset: 0; z-index: -2; background: radial-gradient(circle at 60% 20%, color-mix(in srgb, var(--tier) 28%, transparent), transparent 42%), linear-gradient(115deg, transparent 35%, rgba(255,255,255,.09) 46%, transparent 56%); }
.driver-card-head { display: flex; align-items: flex-start; justify-content: space-between; text-transform: uppercase; }
.driver-card-head div { display: flex; flex-direction: column; }
.driver-card-head span { color: rgba(255,255,255,.66); font-size: .65rem; font-weight: 800; letter-spacing: .15em; }
.driver-card-head strong { font-size: 4.5rem; letter-spacing: -.08em; line-height: .9; text-shadow: 0 5px 20px rgba(0,0,0,.4); }
.driver-card-head .card-tier { padding: .45rem .65rem; color: #fff; border: 1px solid color-mix(in srgb, var(--tier) 62%, transparent); background: rgba(0,0,0,.2); }
.driver-portrait-wrap { flex: 1; min-height: 260px; position: relative; display: flex; align-items: end; justify-content: center; margin: -.5rem -1rem 0; overflow: hidden; }
.portrait-halo { position: absolute; width: 270px; height: 270px; border-radius: 50%; bottom: -10px; background: radial-gradient(circle, color-mix(in srgb, var(--tier) 45%, transparent), transparent 68%); filter: blur(3px); }
.driver-portrait { width: min(88%, 310px); aspect-ratio: 1; object-fit: cover; object-position: center; border-radius: 50% 50% 12% 12%; filter: saturate(.9) contrast(1.06); mask-image: linear-gradient(#000 82%, transparent); }
.driver-identity { text-align: center; margin-top: -.35rem; position: relative; }
.driver-identity h2 { margin: 0; font-size: 1.65rem; text-transform: uppercase; letter-spacing: .025em; }
.driver-identity p { margin: .25rem 0 .9rem; color: color-mix(in srgb, var(--tier) 80%, #fff); font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.driver-card-attributes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: color-mix(in srgb, var(--tier) 30%, transparent); border-top: 1px solid color-mix(in srgb, var(--tier) 30%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--tier) 30%, transparent); }
.driver-card-attributes span { display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .7rem .3rem; background: rgba(5,8,12,.64); }
.driver-card-attributes b { color: #9fa9b3; font-size: .62rem; }
.driver-card-attributes strong { font-size: 1.12rem; }
.driver-card-footer { display: flex; justify-content: space-between; padding-top: .9rem; color: rgba(255,255,255,.62); font-size: .58rem; letter-spacing: .16em; text-transform: uppercase; }

.operations-column { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.resource-strip { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.resource-strip div { padding: 1.15rem 1.3rem; border-right: 1px solid var(--line); }
.resource-strip div:last-child { border: 0; }
.resource-strip span, .points-wallet span { display: block; color: var(--muted); font-size: .63rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.resource-strip strong { display: block; margin: .35rem 0; font-size: 2.1rem; }
.resource-strip small { color: #6f7b87; font-size: .7rem; }
.car-panel { min-height: 245px; padding: 1.6rem; display: grid; grid-template-columns: minmax(260px, .9fr) minmax(340px, 1.35fr); align-items: center; gap: 1rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 80% 50%, rgba(69,167,255,.13), transparent 40%), var(--panel); }
.panel-copy h2 { margin: .3rem 0 .6rem; font-size: 1.8rem; }
.panel-copy p, .operations-card p { color: var(--muted); line-height: 1.55; font-size: .84rem; }
.text-link { color: #fff; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.text-link span { color: var(--red); margin-left: .3rem; }
.car-visual { position: relative; display: grid; place-items: center; min-width: 0; overflow: hidden; isolation: isolate; }
.car-visual::before { content: ""; position: absolute; inset: 24% 8% 14%; z-index: -1; border-radius: 50%; background: radial-gradient(ellipse, rgba(69,167,255,.22), rgba(237,57,68,.09) 48%, transparent 72%); filter: blur(16px); }
.car-visual img { position: absolute; top: 50%; left: 50%; width: 100%; max-width: none; height: auto; transform: translate(-50%, -50%); filter: drop-shadow(0 22px 25px rgba(0,0,0,.6)); }
.car-visual-dashboard { height: 225px; }
.car-visual-dashboard img { width: 90%; }
.operations-grid { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.operations-card { min-height: 155px; padding: 1.3rem; position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,.012)); }
.operations-card h3 { margin: .1rem 0 .45rem; }
.card-index { position: absolute; right: 1rem; top: .8rem; color: rgba(255,255,255,.08); font-size: 2.4rem; font-weight: 900; }
.locked-card { opacity: .62; }
.locked-label, .max-label { display: inline-flex; padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 5px; color: #84909c; font-size: .58rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.points-wallet { min-width: 190px; padding: 1rem 1.2rem; border: 1px solid rgba(237,57,68,.35); border-radius: 12px; background: rgba(237,57,68,.06); }
.points-wallet strong { display: block; margin-top: .25rem; font-size: 2.1rem; }
.notice { margin: -1rem 0 1.5rem; padding: .9rem 1rem; border-radius: 9px; font-size: .83rem; }
.notice.success { border: 1px solid rgba(66,209,141,.35); background: rgba(66,209,141,.08); color: #8ee8b8; }
.notice.error { border: 1px solid rgba(237,57,68,.4); background: rgba(237,57,68,.08); color: #ff9da3; }
.attribute-panel { padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.panel-title { display: flex; justify-content: space-between; align-items: start; margin-bottom: 1rem; }
.panel-title h2 { margin: .25rem 0 0; }
.panel-title > span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
.attribute-list { display: flex; flex-direction: column; }
.attribute-row { min-height: 64px; display: grid; grid-template-columns: 150px 48px 1fr 116px; gap: 1rem; align-items: center; border-top: 1px solid var(--line); }
.attribute-name { display: flex; align-items: center; gap: .8rem; }
.attribute-name b { width: 34px; color: var(--red); font-size: .68rem; letter-spacing: .08em; }
.attribute-name span { font-size: .82rem; font-weight: 700; }
.attribute-value { font-size: 1.35rem; font-weight: 850; }
.attribute-progress { height: 5px; overflow: hidden; background: rgba(255,255,255,.07); }
.attribute-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), #ff737b); box-shadow: 0 0 12px rgba(237,57,68,.4); }
.upgrade-button { width: 116px; min-height: 38px; border: 1px solid rgba(237,57,68,.45); color: #fff; background: rgba(237,57,68,.12); cursor: pointer; font-weight: 850; }
.upgrade-button small { display: block; color: #dba3a6; font-size: .55rem; }
.upgrade-button:hover:not(:disabled) { background: var(--red); }
.upgrade-button:disabled { opacity: .35; cursor: not-allowed; }
.panel-note { color: #687480; font-size: .72rem; line-height: 1.5; margin: 1.2rem 0 0; }

.car-development-grid { grid-template-columns: 1fr 1fr; }
.car-hero-panel { min-height: 585px; padding: 1.6rem; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 50% 45%, rgba(69,167,255,.16), transparent 42%), var(--panel); }
.car-rating span, .homologation-note span { color: var(--muted); font-size: .64rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.car-rating strong { display: block; font-size: 4.8rem; line-height: 1; }
.car-rating small { color: #71808e; }
.car-visual-detail { height: 315px; margin: -.5rem 0; }
.car-visual-detail img { width: 90%; }
.homologation-note { padding: 1rem; border-left: 3px solid var(--blue); background: rgba(69,167,255,.05); }
.homologation-note p { margin: .35rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.car-row { grid-template-columns: 150px 48px 1fr 116px; }
.car-row .attribute-name b { color: var(--blue); }
.car-row .attribute-progress i { background: linear-gradient(90deg, #267cc5, var(--blue)); box-shadow: 0 0 12px rgba(69,167,255,.4); }

.standings-panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.standings-table-wrap { overflow-x: auto; }
.standings-table { width: 100%; border-collapse: collapse; }
.standings-table th { padding: 1rem 1.2rem; text-align: left; color: #74808c; background: rgba(0,0,0,.17); font-size: .62rem; text-transform: uppercase; letter-spacing: .14em; }
.standings-table th:nth-child(n+3), .standings-table td:nth-child(n+3) { text-align: right; }
.standings-table td { padding: .9rem 1.2rem; border-top: 1px solid var(--line); font-size: .84rem; }
.standings-table tr { position: relative; }
.standings-table tr.promotion-row { background: linear-gradient(90deg, rgba(66,209,141,.09), transparent 25%); }
.standings-table tr.relegation-row { background: linear-gradient(90deg, rgba(237,57,68,.09), transparent 25%); }
.standings-table tr.current-driver-row { box-shadow: inset 3px 0 var(--blue); background-color: rgba(69,167,255,.06); }
.position-number { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; background: rgba(255,255,255,.05); font-weight: 850; }
.ai-label { display: inline-block; margin-left: .6rem; padding: .18rem .35rem; border: 1px solid var(--line); color: #7f8b97; font-size: .52rem; letter-spacing: .1em; }
.empty-state { padding: 5rem 2rem; text-align: center; }
.empty-state > span { color: var(--red); font-size: .68rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.empty-state h2 { margin: .6rem 0; font-size: 2rem; }
.empty-state p { margin: 0 auto; max-width: 610px; color: var(--muted); line-height: 1.6; }

.access-page { min-height: 68vh; display: grid; place-items: center; }
.access-panel { width: min(650px, 100%); padding: clamp(2rem, 6vw, 4rem); border: 1px solid var(--line); border-top: 3px solid var(--red); border-radius: var(--radius); background: var(--panel); text-align: center; }
.access-panel h1 { margin: .7rem 0 1rem; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1; letter-spacing: -.05em; }
.access-panel p { color: var(--muted); line-height: 1.7; }
.primary-button { display: inline-flex; margin-top: 1.2rem; padding: .9rem 1.2rem; color: #fff; background: var(--red); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }

@media (max-width: 1180px) {
    .topbar { grid-template-columns: auto 1fr auto; gap: 1rem; }
    .main-nav a, .main-nav .nav-future { padding: 0 .48rem; font-size: .68rem; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-stage, .driver-page-grid { grid-template-columns: 350px 1fr; }
    .attribute-row, .car-row { grid-template-columns: 125px 42px 1fr 105px; gap: .65rem; }
    .upgrade-button { width: 105px; }
}

@media (max-width: 900px) {
    .topbar { display: flex; justify-content: space-between; flex-wrap: wrap; padding: .8rem 3vw; }
    .nav-toggle { display: block; border: 1px solid var(--line); padding: .55rem .75rem; color: #fff; background: transparent; }
    .main-nav { display: none; order: 4; width: 100%; height: auto; flex-direction: column; align-items: stretch; }
    .main-nav.open { display: flex; }
    .main-nav a, .main-nav .nav-future { min-height: 42px; border: 0; border-left: 2px solid transparent; }
    .main-nav a.active { border-left-color: var(--red); }
    .driver-chip { display: none; }
    .topbar-actions { margin-left: auto; }
    .dashboard-stage, .driver-page-grid, .car-development-grid { grid-template-columns: 1fr; }
    .driver-card-column { max-width: 420px; width: 100%; margin: auto; }
    .driver-set-card { min-height: 600px; }
    .car-hero-panel { min-height: 500px; }
}

@media (max-width: 620px) {
    .main-content { width: 92vw; padding-top: 2rem; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .dashboard-heading { margin-bottom: 1.4rem; }
    .metric-grid, .resource-strip, .operations-grid { grid-template-columns: 1fr; }
    .resource-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
    .car-panel { grid-template-columns: 1fr; }
    .car-visual-dashboard { height: min(58vw, 255px); }
    .attribute-row, .car-row { grid-template-columns: 94px 38px 1fr; padding: .7rem 0; }
    .attribute-row form, .attribute-row > .locked-label, .attribute-row > .max-label { grid-column: 1 / -1; }
    .upgrade-button { width: 100%; }
    .attribute-name { gap: .35rem; }
    .attribute-name b { width: 30px; }
    .attribute-name span { font-size: .72rem; }
    .driver-set-card { min-height: 560px; padding: 1.25rem; }
    .driver-card-head strong { font-size: 3.6rem; }
    .driver-portrait-wrap { min-height: 230px; }
    footer { flex-direction: column; }
}
