:root {
  --bg: #090b0e;
  --panel: linear-gradient(165deg, rgba(19, 23, 29, 0.80) 0%, rgba(11, 14, 18, 0.74) 100%);
  --panel-solid: #11151b;
  --surface: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);

  --text: #eef2f6;
  --text-soft: #b8c2ce;
  --muted: #7f8b99;

  /* Инженерная палитра УАЗ / ЗМЗ PRO */
  --uaz: #2fb375;
  --uaz-soft: rgba(47, 179, 117, 0.16);
  --uaz-line: rgba(47, 179, 117, 0.45);
  --amber: #f0a429;
  --amber-soft: rgba(240, 164, 41, 0.16);
  --fire: #ff5e2b;
  --fire-soft: rgba(255, 94, 43, 0.18);
  --fire-line: rgba(255, 94, 43, 0.52);

  /* Цвета тактов 4-тактного цикла */
  --intake: #3b8ef0;
  --compression: #7bc1ff;
  --power: #ff6b26;
  --exhaust: #857a6f;

  --radius: 12px;
  --radius-sm: 8px;
  font-family: "Inter", "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; }

#viewport { position: fixed; inset: 0; }
#viewport canvas { display: block; outline: none; }
#labels { position: fixed; inset: 0; pointer-events: none; }

/* ---------------- Boot overlay ---------------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(47, 179, 117, 0.11) 0%, rgba(9, 11, 14, 0) 48%),
    radial-gradient(circle at 50% 50%, #12161c 0%, #090b0e 75%);
  z-index: 30;
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.65s;
}
.boot.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 36px;
}
.boot-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.boot-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--uaz);
  text-transform: uppercase;
}
.boot-title {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--text);
}
.boot-title span {
  font-weight: 400;
  color: var(--text-soft);
  margin-left: 6px;
}
.boot-bar {
  width: 220px;
  height: 2px;
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.boot-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  background: linear-gradient(90deg, transparent, var(--uaz), var(--amber), transparent);
  animation: bootSlide 1.4s ease-in-out infinite;
}
@keyframes bootSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(310%); }
}
.boot-step {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

/* ---------------- UI shell & glass cards ---------------- */
.ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
}
.ui.hidden { opacity: 0; }
.ui.hidden * { pointer-events: none !important; }
.ui > * { pointer-events: auto; }
.ui::before, .ui::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}
.ui::before {
  top: 0;
  height: 118px;
  background: linear-gradient(rgba(7, 9, 12, 0.62), rgba(7, 9, 12, 0));
}
.ui::after {
  bottom: 0;
  height: 156px;
  background: linear-gradient(rgba(7, 9, 12, 0), rgba(7, 9, 12, 0.72));
}

.card {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--highlight);
}

/* ---------------- Top-left Brand Header ---------------- */
.title {
  position: absolute;
  top: 18px;
  left: 22px;
  pointer-events: auto;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}
.title-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 3px;
}
.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--uaz);
  box-shadow: 0 0 8px var(--uaz);
}
.title-main {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.15;
}
.title-main em {
  font-style: normal;
  color: var(--muted);
  margin: 0 4px;
}
.title-main span {
  color: var(--uaz);
  font-weight: 700;
}
.title-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.link {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 2px 10px;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.link:hover {
  color: #fff;
  border-color: var(--uaz-line);
  background: var(--uaz-soft);
}

/* ---------------- Part Inspector Card ---------------- */
.info {
  position: absolute;
  top: 96px;
  left: 22px;
  width: 320px;
  padding: 13px 16px 14px;
  border-left: 2px solid var(--uaz);
}
.info.hidden { display: none; }
.info-kicker {
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.15em;
  color: var(--uaz);
  margin-bottom: 4px;
}
.info-name {
  font-weight: 650;
  font-size: 14.5px;
  padding-right: 22px;
  color: var(--text);
}
.info-desc {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.48;
  color: var(--text-soft);
}
.info-live {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.info-live:empty { display: none; }
.close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.close:hover { color: #fff; }

/* ---------------- Right Telemetry Stack ---------------- */
.hud-right {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 266px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.hud-right > * { pointer-events: auto; }

.gauges {
  padding: 11px 13px 11px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 4px;
}
.panel-badge {
  color: var(--uaz);
  letter-spacing: 0.08em;
}
#tach {
  width: 202px;
  height: 202px;
  display: block;
  margin: 0 auto;
}

/* ВСХ Dyno Curve */
.dyno-wrap {
  margin-top: 2px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.dyno-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}
.dyno-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.dyno-leg i {
  display: inline-block;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  margin-right: -3px;
}
.dyno-leg .sw-t { background: var(--uaz); }
.dyno-leg .sw-p { background: var(--amber); }
#dyno-curve {
  width: 100%;
  height: 76px;
  display: block;
  border-radius: 6px;
  background: rgba(5, 7, 10, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Telemetry Readouts */
.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  margin-top: 7px;
}
.readouts div {
  position: relative;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}
.readouts label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.readouts b {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.25;
}
.readouts i {
  position: absolute;
  right: 0;
  bottom: 2px;
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
}

/* 4-Cylinder Phase Strip */
.cyls {
  padding: 10px 13px 11px;
}
.cyl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  color: var(--muted);
}
#crank-angle {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.cyl-cells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.cell {
  height: 40px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  place-content: center;
  text-align: center;
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  transition: background 0.09s linear, border-color 0.09s linear;
}
.cell span {
  position: relative;
  z-index: 2;
  line-height: 1.1;
}
.cell small {
  display: block;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.88;
  margin-top: 2px;
}
.cell.intake {
  background: color-mix(in srgb, var(--intake) 46%, #0d1218);
  border-color: color-mix(in srgb, var(--intake) 55%, transparent);
}
.cell.compression {
  background: color-mix(in srgb, var(--compression) 34%, #0d1218);
  border-color: color-mix(in srgb, var(--compression) 46%, transparent);
}
.cell.power {
  background: color-mix(in srgb, var(--power) 56%, #140d0a);
  border-color: color-mix(in srgb, var(--power) 70%, transparent);
}
.cell.exhaust {
  background: color-mix(in srgb, var(--exhaust) 44%, #101113);
  border-color: color-mix(in srgb, var(--exhaust) 48%, transparent);
}
.cell .flash {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle, rgba(255, 248, 214, 0.92) 0%, rgba(255, 148, 38, 0.68) 46%, rgba(255, 80, 20, 0) 78%);
  opacity: 0;
}
.cyl-legend {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.lg {
  font-size: 9.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lg::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--c);
}
.lg.intake { --c: var(--intake); }
.lg.compression { --c: var(--compression); }
.lg.power { --c: var(--power); }
.lg.exhaust { --c: var(--exhaust); }

/* ---------------- Bottom Configurator Dock ---------------- */
.dock {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  max-width: calc(100vw - 28px);
}
.dock-row {
  display: flex;
  gap: 7px;
  align-items: stretch;
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--highlight);
  padding: 6px 7px;
  max-width: 100%;
}

/* Primary action buttons */
.start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 108px;
  border: 1px solid var(--uaz-line);
  background: var(--uaz-soft);
  border-radius: var(--radius-sm);
  padding: 0 15px;
  font-weight: 650;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  transition: background 0.18s, border-color 0.18s, filter 0.18s;
}
.start .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--uaz);
  box-shadow: 0 0 10px var(--uaz);
  transition: background 0.2s, box-shadow 0.2s;
}
.start.running {
  border-color: var(--fire-line);
  background: var(--fire-soft);
}
.start.running .dot {
  background: var(--fire);
  box-shadow: 0 0 10px var(--fire);
}
.start:disabled { opacity: 0.38; cursor: not-allowed; }
.start:hover:not(:disabled) { filter: brightness(1.18); }

.rev, .demo, .more {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0 13px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.rev:hover, .demo:hover, .more:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
}
.rev.on {
  background: var(--fire);
  border-color: var(--fire);
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 94, 43, 0.35);
}
.demo.on {
  background: var(--uaz-soft);
  border-color: var(--uaz-line);
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--uaz);
}
.more { display: none; }

/* Precision sliders */
.slider {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 172px;
  padding: 2px 8px;
}
.slider label {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.slider label b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: none;
  cursor: pointer;
  margin: 2px 0 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--uaz) var(--p, 0%), rgba(255, 255, 255, 0.14) var(--p, 0%));
}
.slider.throttle input[type=range]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--uaz) 0%, var(--amber) calc(var(--p, 0%) * 0.72), var(--fire) var(--p, 0%), rgba(255, 255, 255, 0.14) var(--p, 0%));
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f5f7fa;
  border: 2px solid #161b22;
  margin-top: -5px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
  transition: transform 0.12s ease;
}
input[type=range]:hover:not(:disabled)::-webkit-slider-thumb {
  transform: scale(1.12);
}
input[type=range]::-moz-range-track {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
}
input[type=range]::-moz-range-progress {
  height: 3px;
  border-radius: 3px;
  background: var(--uaz);
}
input[type=range]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f5f7fa;
  border: 2px solid #161b22;
}
input[type=range]:disabled {
  opacity: 0.34;
  cursor: default;
}

/* Segmented Configurator Groups */
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}
.seg button {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 6px 9.5px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}
.seg button:last-child { border-right: 0; }
.seg button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.seg button.on {
  background: rgba(47, 179, 117, 0.14);
  color: #fff;
  box-shadow: inset 0 -2px 0 var(--uaz);
}
#tg-explode.on {
  background: var(--amber-soft);
  box-shadow: inset 0 -2px 0 var(--amber);
}
.seg button:disabled { opacity: 0.38; cursor: not-allowed; }

.sound {
  align-items: center;
  padding-right: 9px;
}
.seg button.attn {
  color: #fff;
  background: var(--amber-soft);
  box-shadow: inset 0 -2px 0 var(--amber);
}
.sound input {
  width: 68px;
  margin-left: 7px;
}

/* ---------------- Help Footer & Toast ---------------- */
.help {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #707c89;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.help b {
  color: #a9b5c2;
  font-weight: 600;
}

.toast {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  background: rgba(15, 19, 25, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--uaz);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
  pointer-events: none;
}

/* ---------------- 3D Callout Labels ---------------- */
.label3d { position: relative; transform: translate(0, 0); pointer-events: none; }
.label3d .tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f3f6f9;
  background: rgba(10, 13, 17, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 2px solid var(--uaz);
  padding: 3px 8px;
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.label3d .pin {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(47, 179, 117, 0.85);
}
.label3d .lead {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 10px;
  height: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.55);
}

/* ---------------- Specs Dialog ---------------- */
.specs {
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72);
}
.specs::backdrop {
  background: rgba(4, 6, 9, 0.68);
  backdrop-filter: blur(6px);
}
.specs-kicker {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.18em;
  color: var(--uaz);
  margin-bottom: 4px;
}
.specs h2 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 650;
}
.specs h3 {
  margin: 18px 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.specs table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.specs td {
  padding: 6.5px 6px;
  border-bottom: 1px solid var(--line);
}
.specs td:first-child { color: var(--text-soft); }
.specs td:nth-child(2) { color: var(--text); font-weight: 500; }
.specs td:last-child {
  color: var(--muted);
  text-align: right;
  font-size: 11.5px;
  white-space: nowrap;
}
.specs a { color: #7ac7ff; text-decoration: none; }
.specs a:hover { text-decoration: underline; color: #b5e0ff; }
.specs ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.65;
}
.specs .note {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
}
.specs form {
  position: absolute;
  right: 12px;
  top: 10px;
}

.fatal {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  background: #2f1010;
  border: 1px solid #b83c3c;
  color: #ffdede;
  padding: 12px 14px;
  border-radius: 9px;
  font: 12px/1.45 Consolas, monospace;
  white-space: pre-wrap;
  z-index: 60;
}
.fatal.hidden { display: none; }

/* ---------------- Medium screens ---------------- */
@media (max-width: 1320px) {
  .dock-row.secondary { flex-wrap: wrap; justify-content: center; }
  .slider { width: 145px; }
}
@media (max-width: 1120px) {
  .cyls { display: none; }
  .hud-right { width: 242px; }
  #tach { width: 182px; height: 182px; }
  .slider { width: 130px; }
  .help span:last-child { display: none; }
}

/* ---------------- Mobile & Short viewports ---------------- */
@media (max-width: 760px), (max-height: 540px) {
  .ui::before { height: 74px; }
  .ui::after { height: 124px; }
  .title {
    top: calc(8px + env(safe-area-inset-top));
    left: calc(12px + env(safe-area-inset-left));
    max-width: calc(100vw - 146px);
  }
  .title-eyebrow { display: none; }
  .title-main { font-size: 15px; }
  .title-sub { font-size: 10.5px; gap: 5px; }
  .link { font-size: 10px; padding: 1px 8px; }

  .hud-right {
    top: calc(8px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    width: 118px;
  }
  .gauges { padding: 6px 8px; }
  .panel-head, .dyno-wrap, .cyls { display: none; }
  #tach { width: 98px; height: 98px; }
  .readouts { grid-template-columns: 1fr; gap: 2px; margin-top: 3px; }
  .readouts div:nth-child(n+3) { display: none; }
  .readouts div { padding-top: 2px; }
  .readouts label { font-size: 8.5px; }
  .readouts b { font-size: 13px; }
  .readouts i { font-size: 9px; }

  .info {
    top: calc(62px + env(safe-area-inset-top));
    left: 8px;
    right: 134px;
    width: auto;
    max-height: 36vh;
    overflow-y: auto;
    padding: 10px 12px;
  }
  .info-name { font-size: 13px; }
  .info-desc, .info-live { font-size: 11.5px; }
  .toast {
    top: auto;
    bottom: calc(78px + env(safe-area-inset-bottom));
    max-width: 86vw;
    font-size: 12px;
    text-align: center;
  }
  .help { display: none; }
  .label3d .tag { font-size: 10px; padding: 2px 6px; }

  .dock {
    left: calc(8px + env(safe-area-inset-left));
    right: calc(8px + env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    transform: none;
    max-width: none;
    align-items: stretch;
    gap: 6px;
  }
  .dock-row { flex-wrap: wrap; padding: 6px; gap: 6px; }
  .start { min-width: 0; padding: 0 12px; min-height: 40px; font-size: 11.5px; }
  .rev, .demo, .more { min-height: 40px; padding: 0 10px; font-size: 11.5px; }
  .more { display: inline-flex; align-items: center; }
  .slider.throttle { flex: 1 1 100px; width: auto; min-width: 88px; }
  .dock .opt, .dock-row.secondary { display: none; }
  .dock.expanded .opt { display: flex; flex: 1 1 135px; width: auto; }
  .dock.expanded .dock-row.secondary { display: flex; max-height: 40vh; overflow-y: auto; }
  .seg { flex-wrap: wrap; }
  .seg button { padding: 8px 9px; font-size: 11.5px; }
  .sound input { width: 66px; }
}

@media (max-height: 540px) {
  .hud-right { width: 106px; }
  #tach { width: 86px; height: 86px; }
  .readouts div:nth-child(n+2) { display: none; }
  .dock.expanded .dock-row.secondary { max-height: 46vh; }
}

/* ---------------- Full-Vehicle Configurator Additions ---------------- */
.title-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #a9bdb3;
  margin-bottom: 3px;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--uaz);
  box-shadow: 0 0 8px var(--uaz);
}
.paint-bar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  padding: 5px 9px;
  background: rgba(13, 17, 16, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.paint-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: var(--sw);
  cursor: pointer;
  padding: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.swatch:hover {
  transform: scale(1.14);
  border-color: #fff;
}
.swatch.on {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--uaz), 0 0 10px rgba(47, 179, 117, 0.55);
  transform: scale(1.1);
}
.hood-btn {
  margin-left: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 600;
  color: #cdd8d3;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.hood-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.hood-btn.on {
  background: rgba(47, 179, 117, 0.2);
  border-color: rgba(47, 179, 117, 0.6);
  color: #e9fff4;
}
.info { top: 132px !important; }
.gear-seg button { padding: 6px 8px; min-width: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.panel-code b { color: var(--uaz); font-weight: 700; }
