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

:root {
    --bg: #0a0c12;
    --bg2: #0f1219;
    --surface: rgba(255,255,255,0.04);
    --surface2: rgba(255,255,255,0.07);
    --border: rgba(255,255,255,0.08);
    --text: #e4e7ef;
    --text-muted: #6b7080;
    --accent: #ef4444;
    --accent-glow: rgba(239,68,68,0.12);
    --blue: #3b82f6;
    --green: #22c55e;
    --yellow: #eab308;
    --orange: #f97316;
    --purple: #a855f7;
    --radius: 14px;
    --radius-sm: 10px;
}

html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* === NAV === */
nav { position:fixed; top:0; left:0; right:0; z-index:100; background:rgba(10,12,18,0.9); backdrop-filter:blur(16px); border-bottom:1px solid var(--border); }
.nav-inner { max-width:1200px; margin:0 auto; padding:0 16px; height:56px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.nav-logo { font-size:1.1rem; font-weight:800; color:var(--accent); text-decoration:none; white-space:nowrap; }
.nav-links { display:flex; gap:4px; overflow-x:auto; }
.nav-links a { padding:8px 12px; color:var(--text-muted); text-decoration:none; font-size:.82rem; font-weight:500; border-radius:8px; white-space:nowrap; transition:all .15s; }
.nav-links a:hover { color:var(--text); background:var(--surface); }
.nav-links a.active { color:#fff; background:var(--accent); }
.nav-right { display:flex; gap:8px; align-items:center; }
.lang-btn { padding:6px 12px; background:var(--surface); border:1px solid var(--border); border-radius:8px; color:var(--text-muted); font-size:.82rem; font-weight:600; cursor:pointer; }
.lang-btn:hover { color:var(--text); }
.nav-toggle { display:none; background:none; border:none; color:var(--text); font-size:1.2rem; cursor:pointer; }

/* === PAGES (SPA routing) === */
.page { display:none; padding-top:56px; min-height:100vh; padding-bottom:60px; }
.page.active { display:block; }

/* === HERO === */
.hero { position:relative; min-height:calc(100vh - 56px); display:flex; align-items:center; justify-content:center; text-align:center; padding:40px 20px 60px; }
.hero-bg { position:absolute; inset:0; background: radial-gradient(ellipse 50% 50% at 50% 30%, rgba(239,68,68,0.06) 0%, transparent 60%); pointer-events:none; }
.hero-content { position:relative; z-index:1; }
.hero-badge { display:inline-block; padding:6px 16px; border:1px solid var(--accent); border-radius:50px; font-size:.75rem; color:var(--accent); letter-spacing:1.5px; text-transform:uppercase; margin-bottom:20px; }
.hero h1 { font-size:clamp(2.2rem,6vw,4rem); font-weight:800; letter-spacing:-1px; margin-bottom:16px; }
.hero-sub { color:var(--text-muted); font-size:.95rem; max-width:600px; margin:0 auto 40px; }
.hero-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; max-width:700px; margin:0 auto; }
.hero-card { padding:20px 16px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); text-decoration:none; color:var(--text); text-align:center; transition:all .2s; }
.hero-card:hover { border-color:var(--accent); transform:translateY(-2px); }
.hc-icon { font-size:1.5rem; display:block; margin-bottom:8px; }
.hero-card strong { display:block; font-size:.9rem; margin-bottom:4px; }
.hero-card span { font-size:.78rem; color:var(--text-muted); }

/* === INFO BOX === */
.info-box { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:28px; margin-bottom:24px; }
.info-box h2, .info-box h3 { font-size:1.1rem; margin-bottom:16px; }
.change-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; }
.change-card { padding:20px; background:rgba(255,255,255,0.02); border:1px solid var(--border); border-radius:var(--radius-sm); }
.cc-icon { font-size:1.4rem; display:block; margin-bottom:8px; }
.change-card h3 { font-size:.92rem; margin-bottom:6px; }
.change-card p { font-size:.82rem; color:var(--text-muted); line-height:1.6; }

/* === SECTION TITLES === */
.page > .container > h1 { font-size:1.8rem; font-weight:700; margin-bottom:8px; padding-top:32px; }
.page-desc { color:var(--text-muted); font-size:.92rem; margin-bottom:32px; }

/* === WORKFLOW === */
.workflow-timeline { position:relative; padding-left:28px; }
.workflow-timeline::before { content:''; position:absolute; left:9px; top:12px; bottom:12px; width:2px; background:linear-gradient(to bottom,var(--accent),var(--blue),transparent); border-radius:2px; }
.wf-step { position:relative; margin-bottom:24px; }
.wf-num { position:absolute; left:-25px; top:18px; width:22px; height:22px; background:var(--accent); border:2px solid var(--bg); color:#fff; font-size:.7rem; font-weight:700; display:flex; align-items:center; justify-content:center; border-radius:50%; z-index:1; }
.wf-content { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px 24px; }
.wf-content h3 { font-size:1.05rem; margin-bottom:12px; }
.wf-body { font-size:.88rem; color:var(--text-muted); line-height:1.7; }
.wf-body p { margin-bottom:8px; }
.wf-body ul { margin:8px 0 8px 20px; }
.wf-body li { margin-bottom:4px; }
.wf-body strong { color:var(--text); }
.wf-tags { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.wf-tags span { padding:3px 10px; background:rgba(59,130,246,0.08); border:1px solid rgba(59,130,246,0.15); border-radius:50px; font-size:.72rem; color:var(--blue); font-weight:500; }

/* === PARAMETERS === */
.param-cat { margin-bottom:8px; }
.cat-header { width:100%; padding:16px 20px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text); font-size:1rem; font-weight:600; cursor:pointer; text-align:left; transition:all .15s; }
.cat-header:hover { background:var(--surface2); }
.cat-header.open { border-radius:var(--radius-sm) var(--radius-sm) 0 0; border-bottom-color:transparent; background:var(--surface2); }
.cat-body { display:none; border:1px solid var(--border); border-top:none; border-radius:0 0 var(--radius-sm) var(--radius-sm); padding:16px; }
.cat-body.open { display:block; }
.param-item { padding:16px; background:rgba(255,255,255,0.02); border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:10px; }
.param-item:last-child { margin-bottom:0; }
.param-item h3 { font-size:.95rem; margin-bottom:6px; }
.param-meta { display:flex; gap:12px; margin-bottom:8px; flex-wrap:wrap; }
.param-meta span { font-size:.75rem; padding:2px 8px; background:rgba(255,255,255,0.04); border-radius:4px; color:var(--text-muted); }
.param-item > p { font-size:.85rem; color:var(--text-muted); margin-bottom:8px; }
.param-detail { font-size:.84rem; color:#9ba3b4; line-height:1.7; }
.param-detail strong { color:var(--text); }

/* === TROUBLESHOOTER === */
.trouble-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:24px; }
.trouble-btn { padding:18px 10px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text); font-size:.82rem; font-weight:600; cursor:pointer; transition:all .15s; line-height:1.4; }
.trouble-btn:hover { border-color:var(--blue); background:rgba(59,130,246,0.06); }
.trouble-btn.active { border-color:var(--blue); background:rgba(59,130,246,0.1); color:var(--blue); }
.trouble-btn.os:hover { border-color:var(--accent); background:var(--accent-glow); }
.trouble-btn.os.active { border-color:var(--accent); background:var(--accent-glow); color:var(--accent); }
.trouble-btn.kerb:hover, .trouble-btn.kerb.active { border-color:var(--orange); background:rgba(249,115,22,0.08); color:var(--orange); }
.trouble-btn.wear:hover, .trouble-btn.wear.active { border-color:var(--yellow); background:rgba(234,179,8,0.08); color:var(--yellow); }

.trouble-result { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:24px; }
.trouble-result h2 { font-size:1.1rem; margin-bottom:16px; }
.trouble-fix { display:flex; align-items:flex-start; gap:14px; padding:12px; background:rgba(255,255,255,0.02); border-radius:var(--radius-sm); margin-bottom:8px; border:1px solid var(--border); }
.trouble-fix:last-child { margin-bottom:0; }
.fix-priority { width:28px; height:28px; flex-shrink:0; display:flex; align-items:center; justify-content:center; background:var(--accent-glow); border:1px solid rgba(239,68,68,0.3); border-radius:50%; color:var(--accent); font-size:.75rem; font-weight:700; }
.fix-body strong { display:block; font-size:.88rem; margin-bottom:2px; }
.fix-body p { font-size:.82rem; color:var(--text-muted); }
.fix-body .fix-dir { color:var(--green); font-weight:600; }

/* === SIMULATOR === */
.sim-layout { display:grid; grid-template-columns:320px 1fr; gap:24px; }
.sim-controls { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; max-height:calc(100vh - 140px); overflow-y:auto; }
.sim-controls h3 { font-size:.9rem; margin-bottom:16px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; }
.sim-group { margin-bottom:14px; }
.sim-group label { display:block; font-size:.78rem; color:var(--text-muted); margin-bottom:4px; }
.sim-group { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.sim-group label { flex:1 1 100%; }
.sim-slider { flex:1; -webkit-appearance:none; appearance:none; height:6px; background:rgba(255,255,255,0.1); border-radius:3px; outline:none; }
.sim-slider::-webkit-slider-thumb { -webkit-appearance:none; width:16px; height:16px; background:var(--accent); border-radius:50%; cursor:pointer; }
.sim-val { font-size:.78rem; color:var(--text); font-weight:600; min-width:60px; text-align:right; }

.sim-display { display:flex; flex-direction:column; gap:16px; }
.sim-car-view { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; text-align:center; }
.sim-car-view h3 { font-size:.85rem; color:var(--text-muted); margin-bottom:8px; }
#simCanvas { width:100%; max-width:400px; height:auto; }

.sim-meters { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.sim-meter { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.sim-meter:last-child { margin-bottom:0; }
.sim-meter label { font-size:.78rem; color:var(--text-muted); width:80px; flex-shrink:0; }
.meter-bar { flex:1; height:8px; background:rgba(255,255,255,0.06); border-radius:4px; overflow:hidden; position:relative; }
.meter-fill { height:100%; background:var(--accent); border-radius:4px; transition:width .3s, background .3s; min-width:2px; }
.meter-fill.blue { background:var(--blue); }
.meter-fill.green { background:var(--green); }
.meter-val { font-size:.78rem; font-weight:600; min-width:55px; text-align:right; }

/* === CAR TABLE === */
.car-table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:var(--radius); }
.car-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.car-table th { padding:12px 14px; background:var(--surface2); text-align:left; font-size:.78rem; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; border-bottom:1px solid var(--border); white-space:nowrap; }
.car-table td { padding:10px 14px; border-bottom:1px solid var(--border); }
.car-table tr:hover td { background:var(--surface); }

/* === FOOTER === */
footer { text-align:center; padding:24px 16px; border-top:1px solid var(--border); color:var(--text-muted); font-size:.78rem; }

/* === RESPONSIVE === */
@media (max-width:768px) {
    .nav-links { display:none; }
    .nav-links.open { display:flex; flex-direction:column; position:absolute; top:56px; left:0; right:0; background:rgba(10,12,18,.97); padding:12px; border-bottom:1px solid var(--border); gap:4px; }
    .nav-toggle { display:block; }
    .hero { min-height:auto; padding:32px 16px 48px; }
    .hero h1 { font-size:2rem; }
    .hero-cards { grid-template-columns:1fr 1fr; }
    .trouble-grid { grid-template-columns:repeat(2,1fr); }
    .sim-layout { grid-template-columns:1fr; }
    .sim-controls { max-height:none; }
    .wf-content { padding:16px; }
}

/* === PHYSICS PAGE === */
.physics-section { margin-bottom:48px; }
.physics-section h2 { font-size:1.3rem; margin-bottom:12px; }
.phys-intro { color:var(--text-muted); font-size:.88rem; margin-bottom:16px; }
.corner-phases { display:flex; gap:6px; margin-bottom:16px; flex-wrap:wrap; }
.phase-btn { padding:10px 20px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text-muted); font-size:.85rem; font-weight:600; cursor:pointer; transition:all .15s; }
.phase-btn:hover { background:var(--surface2); color:var(--text); }
.phase-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.phase-display { display:grid; grid-template-columns:1.2fr 1fr; gap:20px; align-items:start; }
.phase-canvas-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.phase-canvas-wrap canvas { width:100%; height:auto; display:block; }
.phase-info { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.phase-info h3 { font-size:1rem; margin-bottom:8px; color:var(--accent); }
.phase-info p { font-size:.85rem; color:var(--text-muted); line-height:1.7; margin-bottom:8px; }
.phase-info strong { color:var(--text); }
.phase-info .phase-params { margin-top:12px; display:flex; flex-wrap:wrap; gap:6px; }
.phase-info .phase-params span { padding:3px 10px; background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.15); border-radius:50px; font-size:.72rem; color:var(--accent); font-weight:500; }

.phys-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:16px; }
.phys-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.phys-card canvas { width:100%; height:auto; display:block; margin-bottom:12px; border-radius:8px; }
.phys-card h3 { font-size:.95rem; margin-bottom:6px; }
.phys-card p { font-size:.82rem; color:var(--text-muted); line-height:1.6; margin-bottom:8px; }
.phys-params { margin-top:8px; }
.phys-params span { font-size:.75rem; color:var(--blue); background:rgba(59,130,246,.08); padding:3px 8px; border-radius:4px; }

.chart-explanation { display:grid; grid-template-columns:1.2fr 1fr; gap:20px; align-items:start; }
.chart-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; padding:12px; }
.chart-wrap canvas { width:100%; height:auto; display:block; }
.chart-text p { font-size:.88rem; color:var(--text-muted); line-height:1.7; margin-bottom:12px; }
.chart-text strong { color:var(--text); }

/* === SETUPS PAGE === */
.setup-sources { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; margin-bottom:32px; }
.source-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.source-card h3 { font-size:.95rem; margin-bottom:6px; }
.source-card p { font-size:.82rem; color:var(--text-muted); margin-bottom:8px; }
.source-tag { font-size:.72rem; padding:3px 8px; background:rgba(34,197,94,.08); border:1px solid rgba(34,197,94,.15); border-radius:50px; color:var(--green); font-weight:500; }

.track-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:12px; }
.track-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.track-card h3 { font-size:.95rem; margin-bottom:4px; }
.track-examples { font-size:.78rem; color:var(--accent); margin-bottom:10px; }
.track-card ul { list-style:none; }
.track-card li { position:relative; padding-left:14px; font-size:.82rem; color:var(--text-muted); margin-bottom:4px; line-height:1.5; }
.track-card li::before { content:'▸'; position:absolute; left:0; color:var(--blue); }

.setup-car-select { margin-bottom:16px; }
.setup-car-select select { padding:12px 16px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text); font-size:.9rem; width:100%; max-width:350px; cursor:pointer; }
.setup-car-select select option { background:var(--bg); }
.baseline-table-wrap { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; overflow-x:auto; }
.baseline-table-wrap h3 { margin-bottom:12px; font-size:.95rem; }
.baseline-note { font-size:.82rem; color:var(--text-muted); margin-top:12px; padding:10px; background:rgba(239,68,68,.05); border:1px solid rgba(239,68,68,.1); border-radius:var(--radius-sm); }
.pressure-table { overflow-x:auto; }
.pressure-table .car-table { max-width:400px; }

@media (max-width:768px) {
    .phase-display { grid-template-columns:1fr; }
    .chart-explanation { grid-template-columns:1fr; }
    .phys-grid { grid-template-columns:1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,.1); border-radius:3px; }
