:root {
  --bg: #0d0f14; --panel: #161a23; --panel2: #1e2330; --line: #2a3140;
  --text: #eef1f6; --muted: #8b94a7; --accent: #ff6a2b; --accent2: #ffb347;
  --good: #3ddc84; --bad: #ff4d4d; --red: #ff3b3b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
body { padding-bottom: 40px; }
a { color: var(--accent2); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 22px; margin-top: 36px; }
h3 { font-size: 16px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; max-width: 1100px; margin: 0 auto; }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: .5px; }
.badge { background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.chips { display: flex; gap: 8px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted); }
.chip.on { color: var(--good); border-color: var(--good); }
.chip.warn { color: var(--accent2); border-color: var(--accent2); }
.chip.bad { color: var(--bad); border-color: var(--bad); }

.app { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: grid; gap: 16px; }
@media (min-width: 900px) {
  .app { grid-template-columns: 1fr 1fr; grid-template-areas: "hero hero" "dash controls" "pro pro" "sliders sliders"; }
  .hero { grid-area: hero; } .dash { grid-area: dash; } .controls { grid-area: controls; } .pro-line { grid-area: pro; } .sliders { grid-area: sliders; }
}

.hero { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px; }
.hero-emoji { font-size: 56px; line-height: 1; }
.hero-text { flex: 1; min-width: 0; }
.hero h1 { font-size: 26px; }
.hero p { color: var(--muted); margin: 0; }

.dash { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.speed { display: flex; align-items: baseline; gap: 12px; }
.speed-value { font-size: 84px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.unit { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 6px 10px; font-size: 16px; cursor: pointer; }
.tach-track { position: relative; height: 22px; background: var(--panel2); border-radius: 11px; overflow: hidden; }
.tach-red { position: absolute; right: 0; top: 0; bottom: 0; width: 8%; background: rgba(255,59,59,.35); }
.tach-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent) 70%, var(--red)); border-radius: 11px; transition: width 60ms linear; }
.tach-row { display: flex; justify-content: space-between; color: var(--muted); font-variant-numeric: tabular-nums; }
.tach-row b { color: var(--text); font-size: 20px; }
.throttle { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.throttle-fill { height: 100%; width: 0; background: var(--good); transition: width 60ms linear; }

.controls { display: flex; flex-direction: column; gap: 12px; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 12px; padding: 12px 18px; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary.stop { background: var(--panel2); border-color: var(--line); color: var(--text); }
.btn.accent { background: var(--accent2); border-color: var(--accent2); color: #1a1200; }
.btn.ghost { background: transparent; }
.btn.big { font-size: 22px; padding: 20px; border-radius: 16px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn.mode.active { border-color: var(--accent2); color: var(--accent2); }
.pedals { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.pedal { height: 96px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font-size: 22px; font-weight: 700; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none; }
.pedal small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.pedal.gas { border-color: var(--good); }
.pedal.brake { border-color: var(--bad); }
.pedal.rev { border-color: var(--accent); height: 72px; }
.pedal:active, .pedal.down { background: var(--line); }
.status { color: var(--muted); min-height: 1.4em; margin: 0; }

.pro-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.pro-line > span:first-child { flex: 1; min-width: 200px; font-weight: 600; }
.pro-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.sliders label { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 10px; }
.sliders label.check { grid-template-columns: auto 1fr; grid-column: 1 / -1; color: var(--muted); }
.sliders label.check input { width: 18px; height: 18px; }
.sliders .diag { grid-column: 1 / -1; white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: 12px; margin: 0; }
.sliders output { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 32px; accent-color: var(--accent); }

.info { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.info ol { padding-left: 20px; }
.info li { margin: 6px 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.grid3 > div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.sound-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.sound-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.sound-list .e { font-size: 24px; }
.sound-list .n { font-weight: 600; }
.sound-list .t { color: var(--muted); font-size: 13px; }
.sound-list .p { margin-left: auto; }
details { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
.foot { max-width: 1100px; margin: 30px auto 0; padding: 0 16px; color: var(--muted); font-size: 14px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; }
.modal-card.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; padding: 4px 8px; }
.cars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.car-card { text-align: left; background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; color: var(--text); }
.car-card.active { border-color: var(--accent); }
.car-card .e { font-size: 34px; }
.car-card .n { font-weight: 700; margin-top: 4px; }
.car-card .t { color: var(--muted); font-size: 13px; }
.pro-tag { display: inline-block; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.qr-wrap { display: flex; justify-content: center; margin: 12px 0; }
.qr { background: #fff; padding: 12px; border-radius: 12px; min-width: 120px; min-height: 120px; display: flex; align-items: center; justify-content: center; color: #000; }
.qr img, .qr canvas, .qr svg { display: block; width: 220px; height: 220px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input { flex: 1; min-width: 160px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px; font-size: 18px; letter-spacing: 2px; text-transform: uppercase; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.code { font-size: 44px; font-weight: 800; letter-spacing: 8px; text-align: center; padding: 16px; background: var(--panel2); border-radius: 12px; margin: 12px 0; font-variant-numeric: tabular-nums; }
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; z-index: 10; }
