:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --line: #262c34;
  --text: #e9edf1;
  --muted: #8a94a0;
  --accent: #e4572e;
  --ok: #3bb273;
  --warn: #f0a202;
  --bad: #d7263d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding: 0 16px 32px;
  max-width: 1400px;
  margin-inline: auto;
}

button { font: inherit; color: inherit; cursor: pointer; }

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.brand { font-weight: 800; font-size: 22px; letter-spacing: .5px; }
.brand span { color: var(--accent); }

.source {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}
.source button {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  color: var(--muted);
}
.source button[aria-checked="true"] { background: var(--accent); color: #fff; }

.status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.cockpit {
  display: grid;
  grid-template-columns: minmax(280px, 460px) 1fr;
  gap: 24px;
  align-items: center;
}
@media (max-width: 760px) { .cockpit { grid-template-columns: 1fr; } }

.gauge { position: relative; width: 100%; max-width: 460px; aspect-ratio: 1; margin-inline: auto; }
.gauge svg { width: 100%; height: 100%; }
.gauge path { fill: none; stroke-width: 16; stroke-linecap: round; }
.gauge .track { stroke: var(--line); }
.gauge .redzone { stroke: rgba(215, 38, 61, .45); stroke-linecap: butt; }
.gauge .fill { stroke: var(--accent); transition: stroke .2s; }
.gauge.limiter .fill { stroke: var(--bad); }

.readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.speed { font-size: clamp(56px, 12vw, 110px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.speed small { font-size: 18px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.rpm { color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 6px; }
.gear {
  margin-top: 14px;
  min-width: 56px;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 2px 12px;
}
.vu { position: absolute; left: 30%; right: 30%; bottom: 6%; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.vu i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s; }

.controls { display: flex; flex-direction: column; gap: 18px; }

.start {
  width: 100%;
  padding: 26px;
  font-size: 26px;
  font-weight: 800;
  border: 0;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 30px rgba(228, 87, 46, .35);
}
.start.running { background: var(--panel); border: 2px solid var(--accent); color: var(--accent); box-shadow: none; }
.start:disabled { opacity: .6; }
.hint { color: var(--muted); font-size: 14px; }
.hint.error { color: var(--bad); }

.demo { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.pedals { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.pedal {
  padding: 30px 0;
  font-size: 22px;
  font-weight: 700;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #1b2027;
  user-select: none;
  touch-action: none;
}
.pedal.gas.active { background: var(--ok); border-color: var(--ok); color: #fff; }
.pedal.brake.active { background: var(--bad); border-color: var(--bad); color: #fff; }
.phase { color: var(--warn); min-height: 1.4em; }
.kbd { color: var(--muted); font-size: 13px; }

.sliders { display: grid; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.sliders label { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.sliders input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); height: 28px; }
.switch { display: flex !important; align-items: center; gap: 10px; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }

.library h2 { font-size: 18px; margin: 32px 0 12px; }
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.profile {
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.profile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c); }
.profile strong { font-size: 17px; }
.profile span { color: var(--muted); font-size: 14px; }
.profile em { font-style: normal; font-size: 12px; color: var(--muted); }
.profile[aria-pressed="true"] { border-color: var(--c); background: #191e24; }

.diag { margin-top: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.diag summary { cursor: pointer; color: var(--muted); }
.diag dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 12px 0 0; font-size: 14px; }
.diag dt { color: var(--muted); }
.diag dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-word; }

footer { margin-top: 28px; color: var(--muted); font-size: 13px; }

