/*
 * Газуй. Тёмная тема — не мода, а условия: экран в салоне, часто ночью,
 * яркий фон слепит водителя. Подсветка приборов янтарная: тёплый свет
 * меньше мешает глазам в темноте. Красный («Коррида», цвет ВАЗа) — только
 * для красной зоны и работающего мотора.
 */
@font-face { font-family: 'Golos Text'; src: url(../fonts/golos-cyr.woff2) format('woff2'); font-weight: 400 900; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; src: url(../fonts/golos-lat.woff2) format('woff2'); font-weight: 400 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Unbounded'; src: url(../fonts/unbounded-cyr.woff2) format('woff2'); font-weight: 200 900; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; src: url(../fonts/unbounded-lat.woff2) format('woff2'); font-weight: 200 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'DSEG7'; src: url(../fonts/dseg7.woff2) format('woff2'); font-weight: 700; font-style: italic; font-display: block; }

:root {
  --asfalt: #0F1216;      /* фон: ночной асфальт */
  --plastik: #161A20;     /* панели: пластик торпедо */
  --plastik-2: #1E242C;   /* приподнятое */
  --plastik-3: #28303A;
  --shov: #2C343E;        /* швы и границы */
  --khrom: #C9CFD6;       /* хром: вторичный текст, ободки */
  --mel: #EEF0F2;         /* основной текст */
  --tuman: #8F99A4;       /* третичный текст */
  --podsvetka: #FFB547;   /* янтарная подсветка приборов */
  --podsvetka-2: #FFD08A;
  --podsvetka-dim: rgba(255, 181, 71, .14);
  --korrida: #E5482C;     /* «Коррида»: красная зона, работающий мотор */
  --korrida-dim: rgba(229, 72, 44, .16);
  --lampa: #6BD49A;       /* контрольная лампа «всё в порядке» */
  --f-ui: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --f-digit: 'DSEG7', 'Golos Text', monospace;
  --app-h: 100vh;
  --pad: 1rem;
  --r: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-size: 16px;
}
@media (min-width: 740px) and (min-height: 560px) { :root { font-size: 17px; --pad: 1.25rem; } }
@media (min-width: 1100px) and (min-height: 700px) { :root { font-size: 19px; } }
@media (min-width: 1380px) and (min-height: 800px) { :root { font-size: 21px; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--asfalt); color: var(--mel); }
body {
  font-family: var(--f-ui);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}
::selection { background: var(--podsvetka); color: #1A1206; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-user-select: none; user-select: none; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--podsvetka); outline-offset: 3px; border-radius: 10px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
svg { display: block; }
[hidden] { display: none !important; }

/* ───────── Каркас ───────── */
.app {
  height: var(--app-h);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
}
.bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem var(--pad) .2rem;
  min-height: 3.6rem;
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--mel); text-decoration: none; margin-right: auto; border-radius: 10px; }
.brand-mark { width: 2rem; height: 2rem; color: var(--podsvetka); flex: none; }
.brand-word { font-family: var(--f-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em; }

.status {
  display: flex; align-items: center; gap: .55rem;
  min-height: 2.75rem; padding: .4rem .95rem .4rem .8rem;
  border-radius: 999px;
  background: var(--plastik);
  box-shadow: inset 0 0 0 1px var(--shov);
  color: var(--khrom);
  font-size: .9rem; font-weight: 500;
  max-width: 46vw;
  transition: color .2s, box-shadow .2s;
}
.status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lamp { width: .62rem; height: .62rem; border-radius: 50%; background: #3A424C; flex: none; transition: background .2s, box-shadow .2s; }
.status[data-tone="ok"] .lamp { background: var(--lampa); box-shadow: 0 0 10px rgba(107, 212, 154, .55); }
.status[data-tone="warn"] .lamp { background: var(--podsvetka); box-shadow: 0 0 10px rgba(255, 181, 71, .6); animation: lamp 1.2s ease-in-out infinite; }
.status[data-tone="bad"] .lamp { background: var(--korrida); box-shadow: 0 0 10px rgba(229, 72, 44, .6); }
.status[data-tone="warn"] { color: var(--podsvetka-2); }
.status[data-tone="bad"] { color: #FFB4A6; }
@keyframes lamp { 50% { opacity: .35; } }

.bar-actions { display: flex; gap: .4rem; }
.icon-btn {
  width: 2.9rem; height: 2.9rem; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--khrom);
  background: var(--plastik);
  box-shadow: inset 0 0 0 1px var(--shov);
  transition: background .15s, color .15s, transform .12s;
}
.icon-btn svg { width: 1.4rem; height: 1.4rem; }
.icon-btn:hover { background: var(--plastik-2); color: var(--mel); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[data-on="1"] { color: var(--podsvetka); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, .45); }

/* Приборная панель: альбомная — шкала слева, управление справа. */
.dash {
  --g: min(calc(var(--app-h) - 6rem), 47vw, 42rem);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(1rem, 3vw, 2.6rem);
  padding: .4rem var(--pad) var(--pad);
  min-height: 0;
}

/* ───────── Приборка ───────── */
.cluster { position: relative; width: var(--g); height: var(--g); justify-self: center; }
.gauge { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
.gauge-svg { width: 100%; height: 100%; }
.gauge text { font-variant-numeric: tabular-nums; }
.readout {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -46%);
  display: grid; justify-items: center;
  pointer-events: none;
}
.speed { position: relative; font-family: var(--f-digit); font-style: italic; font-weight: 700; font-size: calc(var(--g) * .145); line-height: 1; letter-spacing: .02em; }
.speed-ghost { color: rgba(255, 181, 71, .07); }
.speed-val { position: absolute; right: 0; top: 0; color: var(--podsvetka); text-shadow: 0 0 calc(var(--g) * .03) rgba(255, 181, 71, .45); }
.speed-unit { margin-top: calc(var(--g) * .02); font-size: calc(var(--g) * .042); color: var(--tuman); font-weight: 500; letter-spacing: .04em; }
.gear {
  margin-top: calc(var(--g) * .035);
  min-width: calc(var(--g) * .15); height: calc(var(--g) * .13);
  padding: 0 calc(var(--g) * .02);
  display: grid; place-items: center;
  border-radius: calc(var(--g) * .03);
  background: rgba(0, 0, 0, .35);
  box-shadow: inset 0 0 0 2px var(--shov);
  font-family: var(--f-display); font-weight: 800; font-size: calc(var(--g) * .075);
  color: var(--mel);
  transition: box-shadow .15s, color .15s;
}
.gear.flash { color: var(--podsvetka); box-shadow: inset 0 0 0 2px rgba(255, 181, 71, .7); }
.gear.wide { font-size: calc(var(--g) * .05); }
.rpm { margin-top: calc(var(--g) * .03); font-size: calc(var(--g) * .04); color: var(--tuman); font-variant-numeric: tabular-nums; }

.gauge[data-skin="retro"] ~ .readout .speed-val { color: var(--podsvetka); }
.gauge[data-skin="rail"] ~ .readout .speed-val { color: #A9DBFF; text-shadow: 0 0 calc(var(--g) * .03) rgba(127, 200, 255, .45); }
.gauge[data-skin="rail"] ~ .readout .speed-ghost { color: rgba(127, 200, 255, .07); }

/* Лампы переключения передач у гоночной шкалы. */
.shift-leds {
  position: absolute; left: 18%; right: 18%; top: -3.5%;
  display: flex; justify-content: space-between;
}
.shift-leds i { width: calc(var(--g) * .05); height: calc(var(--g) * .05); border-radius: 50%; background: #1C2026; box-shadow: inset 0 0 0 1px #2C343E; transition: background .05s; }
.shift-leds i.g.on { background: #43D17A; box-shadow: 0 0 12px rgba(67, 209, 122, .7); }
.shift-leds i.y.on { background: #FFB547; box-shadow: 0 0 12px rgba(255, 181, 71, .7); }
.shift-leds i.r.on { background: #FF4A2E; box-shadow: 0 0 12px rgba(255, 74, 46, .8); }
.gauge.shift-now .shift-leds i { animation: shift .14s steps(2) infinite; }
@keyframes shift { 50% { background: #1C2026; box-shadow: none; } }

/* ───────── Правая часть ───────── */
.panel { display: flex; flex-direction: column; gap: 1rem; min-width: 0; max-width: 40rem; width: 100%; justify-self: center; }

.car {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 1rem; text-align: left;
  padding: 1rem 1.1rem 1.05rem;
  border-radius: var(--r);
  background: radial-gradient(120% 90% at 50% 105%, rgba(255, 181, 71, .1), transparent 60%), var(--plastik);
  box-shadow: inset 0 0 0 1px var(--shov);
  transition: box-shadow .15s, transform .12s;
}
.car:hover { box-shadow: inset 0 0 0 1px var(--plastik-3); }
.car:active { transform: scale(.985); }
.car-art { position: relative; grid-column: 1 / -1; display: block; width: 100%; max-width: 30rem; height: clamp(6rem, calc(var(--app-h) * .21), 11.5rem); justify-self: center; }
/* Тень под колёсами: вырезанное фото без неё будто висит в воздухе. */
.car-art::after, .g-art::after, .chip-art::after {
  content: ''; position: absolute; left: 8%; right: 8%; bottom: -4%; height: 12%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, .6), transparent 75%);
  z-index: -1;
}
.car-art, .g-art, .chip-art { z-index: 0; isolation: isolate; }
.car-art svg { width: 100%; height: 100%; }
.car-text { grid-column: 1; grid-row: 2; display: grid; gap: .1rem; margin-top: .25rem; min-width: 0; }
.car-name { font-family: var(--f-display); font-weight: 700; font-size: 1.45rem; line-height: 1.15; letter-spacing: -.01em; }
.car-nick { font-size: 1.05rem; color: var(--podsvetka-2); font-weight: 500; }
.car-spec { font-size: .9rem; color: var(--tuman); }
.car-go {
  grid-column: 2; grid-row: 2; align-self: end;
  display: flex; align-items: center; gap: .2rem; white-space: nowrap;
  min-height: 2.6rem; padding: .35rem .6rem .35rem 1rem; border-radius: 999px;
  font-size: .92rem; font-weight: 600; color: var(--podsvetka-2);
  background: var(--podsvetka-dim);
  box-shadow: inset 0 0 0 1px rgba(255, 181, 71, .35);
  transition: background .15s;
}
.car:hover .car-go { background: rgba(255, 181, 71, .22); }
.car-go svg { width: 1.1rem; height: 1.1rem; }
.car-art img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }

/* Лента машин: на телефоне вместо большой карточки. */
.strip-wrap { display: none; }
.strip-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .55rem; }
.strip-title { display: grid; min-width: 0; }
.strip-name { font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; line-height: 1.2; }
.strip-nick { color: var(--podsvetka-2); font-size: .9rem; font-weight: 500; }
.strip-all { flex: none; display: flex; align-items: center; gap: .15rem; min-height: 2.6rem; padding: 0 .55rem 0 .9rem; border-radius: 999px; font-weight: 600; font-size: .88rem; color: var(--podsvetka-2); background: var(--podsvetka-dim); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, .35); }
.strip-all svg { width: 1rem; height: 1rem; }
.strip {
  display: flex; gap: .55rem; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  margin: 0 calc(var(--pad) * -1); padding: .15rem var(--pad) .4rem;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip-sep { flex: none; align-self: center; writing-mode: vertical-rl; transform: rotate(180deg); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tuman); padding: 0 .1rem; }
.chip {
  flex: none; width: 7.4rem; scroll-snap-align: center;
  display: grid; gap: .25rem; padding: .45rem .5rem .55rem; border-radius: 14px; text-align: center;
  background: var(--plastik); box-shadow: inset 0 0 0 1px var(--shov);
  transition: box-shadow .15s, background .15s, transform .1s;
}
.chip:active { transform: scale(.96); }
.chip[aria-selected="true"] { background: radial-gradient(100% 80% at 50% 100%, rgba(255, 181, 71, .16), transparent 70%), var(--plastik-2); box-shadow: inset 0 0 0 2px var(--podsvetka); }
.chip-art { position: relative; display: block; height: 3.3rem; }
.chip-art svg, .chip-art img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.chip-name { font-size: .78rem; font-weight: 600; line-height: 1.2; color: var(--khrom); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chip[aria-selected="true"] .chip-name { color: var(--mel); }

.drive { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: stretch; }

/* Кнопка пуска: хромовое кольцо, внутри — лампа. */
.ignition {
  --s: clamp(8.2rem, calc(var(--g) * .36), 11rem);
  width: var(--s); height: var(--s);
  border-radius: 50%;
  padding: calc(var(--s) * .07);
  background: linear-gradient(145deg, #F2F4F6, #6E7780 40%, #DDE1E5 62%, #50575F);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55), 0 2px 0 rgba(255, 255, 255, .06);
  transition: transform .12s var(--ease), box-shadow .25s;
  align-self: center;
}
.ign-face {
  width: 100%; height: 100%; border-radius: 50%;
  display: grid; place-content: center; justify-items: center; gap: .1rem;
  background: radial-gradient(circle at 50% 35%, #2A3038, #12151A 70%);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 0 0 calc(var(--s) * .035) rgba(255, 181, 71, .22);
  transition: box-shadow .25s;
}
.ign-label { font-family: var(--f-display); font-weight: 800; font-size: calc(var(--s) * .17); letter-spacing: .03em; text-transform: uppercase; color: var(--podsvetka); transition: color .2s; }
.ign-sub { font-size: calc(var(--s) * .09); color: var(--tuman); font-weight: 500; }
.ignition:active { transform: scale(.96); }
.app[data-state="cranking"] .ign-face { animation: crank .5s ease-in-out infinite; }
@keyframes crank { 50% { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 0 0 calc(var(--s) * .06) rgba(255, 181, 71, .55); } }
.app[data-state="on"] .ign-face { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6), inset 0 0 0 calc(var(--s) * .04) rgba(229, 72, 44, .75), 0 0 calc(var(--s) * .18) rgba(229, 72, 44, .3); }
.app[data-state="on"] .ign-label { color: #FF7A62; }

.drive-side { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.mode {
  display: grid; grid-template-columns: 1fr 1fr;
  padding: .25rem; border-radius: 14px;
  background: var(--plastik); box-shadow: inset 0 0 0 1px var(--shov);
}
.mode button { min-height: 2.8rem; padding: 0 .4rem; border-radius: 11px; font-weight: 600; font-size: .92rem; white-space: nowrap; color: var(--tuman); transition: background .18s, color .18s; }
.mode button[aria-checked="true"] { background: var(--plastik-3); color: var(--mel); box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }

.rev, .pedal {
  flex: 1; min-height: 4.4rem;
  border-radius: 16px;
  display: grid; place-content: center; justify-items: center;
  font-family: var(--f-display); font-weight: 700; font-size: 1.1rem;
  background: linear-gradient(180deg, var(--plastik-2), var(--plastik));
  box-shadow: inset 0 0 0 1px var(--shov), 0 3px 0 #0A0C0F;
  transition: transform .08s, box-shadow .08s, background .15s, opacity .2s;
  touch-action: none;
}
.rev small { font-family: var(--f-ui); font-weight: 500; font-size: .8rem; color: var(--tuman); margin-top: .15rem; }
.rev.held, .pedal.held { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--podsvetka), 0 1px 0 #0A0C0F; background: linear-gradient(180deg, #2A2418, var(--plastik)); color: var(--podsvetka-2); }
.rev:disabled { opacity: .4; cursor: default; }
.pedals { display: none; grid-template-columns: 1fr 1.35fr; gap: .7rem; flex: 1; }
.pedal { min-height: 5.2rem; }
.pedal-brake.held { box-shadow: inset 0 0 0 2px var(--korrida), 0 1px 0 #0A0C0F; background: linear-gradient(180deg, #2C1A17, var(--plastik)); color: #FFB4A6; }
.app[data-mode="test"] .pedals { display: grid; }
.app[data-mode="test"] .rev { display: none; }

.vol { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1rem; font-weight: 500; color: var(--khrom); }
.hint { margin: 0; color: var(--tuman); font-size: .92rem; min-height: 1.4em; max-width: 34rem; }

/* Ползунки: дорожка с янтарной заливкой. */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 2.6rem; background: transparent; margin: 0;
  --p: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: .55rem; border-radius: 999px;
  background: linear-gradient(90deg, var(--podsvetka) 0, var(--podsvetka) var(--p), var(--plastik-3) var(--p));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 1.8rem; height: 1.8rem; margin-top: -.62rem;
  border-radius: 50%; background: #F2F4F6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5), inset 0 -2px 0 rgba(0, 0, 0, .15);
}
input[type="range"]::-moz-range-track { height: .55rem; border-radius: 999px; background: var(--plastik-3); }
input[type="range"]::-moz-range-progress { height: .55rem; border-radius: 999px; background: var(--podsvetka); }
input[type="range"]::-moz-range-thumb { width: 1.8rem; height: 1.8rem; border: 0; border-radius: 50%; background: #F2F4F6; }

/* ───────── Листы ───────── */
.sheet {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(5, 6, 8, .62);
  opacity: 0; transition: opacity .22s var(--ease);
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.sheet.open { opacity: 1; }
.sheet-card {
  width: min(100%, 44rem);
  max-height: calc(var(--app-h) - 1.5rem);
  display: flex; flex-direction: column;
  background: var(--plastik);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .5), inset 0 0 0 1px var(--shov);
  transform: translateY(2.5rem);
  transition: transform .26s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open .sheet-card { transform: none; }
.sheet-wide { width: min(100%, 72rem); }
@media (min-width: 900px) and (min-height: 560px) {
  .sheet { align-items: center; }
  .sheet-card { border-radius: 24px; max-height: calc(var(--app-h) - 3rem); }
}
.sheet-head {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1rem .8rem 1.4rem;
  border-bottom: 1px solid var(--shov);
}
.sheet-head h2 { font-family: var(--f-display); font-size: 1.35rem; font-weight: 700; margin-right: auto; }
.sheet-head .icon-btn { order: 3; }
.sheet-body { padding: 1.1rem 1.4rem 1.6rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.tabs { display: flex; gap: .35rem; flex-wrap: wrap; order: 2; }
.tabs button {
  min-height: 2.6rem; padding: 0 1rem; border-radius: 999px;
  font-weight: 600; font-size: .92rem; color: var(--tuman);
  box-shadow: inset 0 0 0 1px var(--shov);
  transition: background .15s, color .15s;
}
.tabs button[aria-selected="true"] { background: var(--mel); color: #12151A; box-shadow: none; }
@media (max-width: 720px) {
  .sheet-head { padding-left: 1.1rem; }
  .tabs { order: 4; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .1rem; }
  .tabs button { flex: none; }
}

/* Гараж */
.garage { display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: .8rem; }
.garage-card {
  position: relative; display: grid; text-align: left;
  padding: .7rem .9rem .9rem; border-radius: 16px;
  background: radial-gradient(110% 80% at 50% 100%, rgba(255, 255, 255, .05), transparent 65%), var(--plastik-2);
  box-shadow: inset 0 0 0 1px var(--shov);
  transition: box-shadow .15s, transform .12s, background .15s;
}
.garage-card:hover { box-shadow: inset 0 0 0 1px var(--plastik-3); }
.garage-card:active { transform: scale(.98); }
.garage-card[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--podsvetka); background: radial-gradient(110% 80% at 50% 100%, rgba(255, 181, 71, .12), transparent 65%), var(--plastik-2); }
.garage-card .g-art { position: relative; display: block; height: 7.2rem; }
.garage-card .g-art svg, .garage-card .g-art img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.g-name { font-family: var(--f-display); font-weight: 700; font-size: 1.02rem; line-height: 1.2; margin-top: .2rem; }
.g-nick { color: var(--podsvetka-2); font-size: .9rem; font-weight: 500; }
.g-spec { color: var(--tuman); font-size: .8rem; margin-top: .3rem; }
.g-about { color: var(--khrom); font-size: .84rem; margin-top: .35rem; line-height: 1.4; }
.g-on { position: absolute; top: .7rem; right: .75rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #1A1206; background: var(--podsvetka); border-radius: 999px; padding: .15rem .55rem; }

/* Настройки */
.settings h3 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--tuman); font-weight: 600; margin: 1.6rem 0 .5rem; }
.settings h3:first-child { margin-top: .2rem; }
.field { display: grid; gap: .1rem; padding: .35rem 0; }
.field-name { font-weight: 500; }
.field-ends { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) 4.6rem; align-items: center; gap: .8rem; }
.field-ends i { font-style: normal; font-size: .82rem; color: var(--tuman); }
.field-ends i:last-child { text-align: right; }
.switch { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--shov); cursor: pointer; }
.switch span { display: grid; color: var(--tuman); font-size: .88rem; order: 1; }
.switch b { color: var(--mel); font-weight: 500; font-size: 1rem; }
.switch input {
  order: 2; -webkit-appearance: none; appearance: none; margin: 0;
  width: 3.4rem; height: 2rem; border-radius: 999px; background: var(--plastik-3); position: relative; cursor: pointer;
  transition: background .18s;
}
.switch input::after { content: ''; position: absolute; top: .22rem; left: .22rem; width: 1.56rem; height: 1.56rem; border-radius: 50%; background: #F2F4F6; transition: transform .2s var(--ease); box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.switch input:checked { background: var(--podsvetka); }
.switch input:checked::after { transform: translateX(1.4rem); }
.sensor-info { font-size: .88rem; color: var(--khrom); background: var(--plastik-2); border-radius: 12px; padding: .7rem .9rem; margin: .4rem 0 .7rem; font-variant-numeric: tabular-nums; }
.sensor-info div { display: flex; justify-content: space-between; gap: 1rem; }
.sensor-info span:last-child { color: var(--mel); text-align: right; }

.btn-ghost, .btn-primary { min-height: 3rem; padding: 0 1.2rem; border-radius: 14px; font-weight: 600; transition: background .15s, transform .1s; }
.btn-ghost { box-shadow: inset 0 0 0 1px var(--shov); color: var(--mel); }
.btn-ghost:hover { background: var(--plastik-2); }
.btn-primary { background: var(--podsvetka); color: #1A1206; }
.btn-primary:active, .btn-ghost:active { transform: scale(.97); }
.fine { color: var(--tuman); font-size: .82rem; margin: 1.2rem 0 0; max-width: 60ch; }

/* Авторы */
.link { color: var(--podsvetka-2); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; font-weight: 500; }
.credits { display: grid; gap: .7rem; }
.credit { display: grid; gap: .1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--shov); }
.credit span { color: var(--tuman); font-size: .88rem; }
.credit a { color: var(--khrom); text-underline-offset: 3px; }

/* Справка */
.lead { margin: 0 0 1rem; font-size: 1.05rem; color: var(--khrom); max-width: 62ch; }
.steps { margin: 0 0 1.2rem; padding-left: 1.3rem; display: grid; gap: .6rem; max-width: 64ch; }
.steps li::marker { color: var(--podsvetka); font-weight: 700; }
.steps.plain { list-style: none; padding-left: 0; }
.steps.plain li { padding-left: 1.1rem; position: relative; }
.steps.plain li::before { content: ''; position: absolute; left: 0; top: .62em; width: .4rem; height: .4rem; border-radius: 50%; background: var(--podsvetka); }
.qa { margin: 0; display: grid; gap: .25rem .2rem; max-width: 66ch; }
.qa dt { font-weight: 600; margin-top: .7rem; }
.qa dd { margin: 0; color: var(--khrom); }

/* Связка с телефоном */
.pair-code { display: flex; align-items: center; gap: 1.4rem; margin: .4rem 0 1.2rem; flex-wrap: wrap; }
.qr { width: 9.5rem; height: 9.5rem; border-radius: 14px; background: #F2F4F6; padding: .55rem; flex: none; }
.qr svg, .qr img { width: 100%; height: 100%; }
.code-label { color: var(--tuman); font-size: .9rem; }
.code { font-family: var(--f-digit); font-style: italic; font-weight: 700; font-size: 3.4rem; color: var(--podsvetka); letter-spacing: .12em; line-height: 1.15; }
.pair-state { font-weight: 500; color: var(--khrom); }
.pair-state[data-tone="ok"] { color: var(--lampa); }
.join label { display: block; font-weight: 500; margin-bottom: .4rem; }
.join-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.join input {
  width: 9rem; min-height: 3.6rem; padding: 0 1rem; border-radius: 14px; border: 0;
  background: var(--plastik-2); box-shadow: inset 0 0 0 1px var(--shov);
  font-family: var(--f-digit); font-style: italic; font-weight: 700; font-size: 2rem; letter-spacing: .14em; color: var(--podsvetka);
}
.join input::placeholder { color: rgba(255, 181, 71, .2); }
.join input:focus { box-shadow: inset 0 0 0 2px var(--podsvetka); }
.err { color: #FFB4A6; min-height: 1.4em; margin: .5rem 0 0; }
.sensor-live { display: grid; justify-items: start; gap: .3rem; }
.live-speed { font-family: var(--f-digit); font-style: italic; font-weight: 700; font-size: 4.6rem; color: var(--podsvetka); line-height: 1.1; }
.live-speed small { font-family: var(--f-ui); font-style: normal; font-weight: 500; font-size: 1rem; color: var(--tuman); margin-left: .5rem; }
.live-state { font-weight: 600; font-size: 1.1rem; }

/* Подсказка-тост */
.toast {
  position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 1rem); opacity: 0;
  max-width: min(92vw, 34rem); padding: .8rem 1.1rem;
  border-radius: 14px; background: #F2F4F6; color: #12151A; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  transition: opacity .2s, transform .25s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.unsupported { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--asfalt); display: grid; place-content: center; justify-items: center; text-align: center; padding: 2rem; gap: 1rem; }
.unsupported .brand-mark { width: 4rem; height: 4rem; }
.unsupported h1 { font-family: var(--f-display); font-size: 1.6rem; max-width: 24ch; }
.unsupported p { color: var(--khrom); max-width: 52ch; margin: 0; }

/* ───────── Раскладки ───────── */

/* Окно Теслы рядом с картой (≈773×601) и небольшие альбомные экраны. */
@media (orientation: landscape) and (max-width: 1000px) {
  .dash { --g: min(calc(var(--app-h) - 5rem), 46vw); gap: 1rem; }
  .car { padding: .7rem .9rem .8rem; }
  .car-art { max-width: 17rem; height: clamp(5rem, calc(var(--app-h) * .17), 7.5rem); }
  .car-name { font-size: 1.2rem; }
  .car-nick { font-size: .95rem; }
  .car-spec { display: none; }
  .panel { gap: .7rem; }
  .hint { display: none; }
}
/* Совсем низкие экраны: телефон боком. */
@media (orientation: landscape) and (max-height: 500px) {
  .bar { padding-top: .35rem; min-height: 3rem; }
  .brand-word { display: none; }
  .dash { --g: min(calc(var(--app-h) - 4rem), 44vw); }
  .car-art { display: none; }
  .ignition { --s: 6.4rem; }
  .rev, .pedal { min-height: 3.4rem; }
  .vol { display: none; }
}

/* Портрет: телефон, старые Model S/X с вертикальным экраном. */
@media (orientation: portrait) {
  .dash {
    --g: min(88vw, calc(var(--app-h) * .44), 40rem);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: start; align-content: start;
    gap: .9rem;
    overflow-y: auto;
  }
  .panel { max-width: 44rem; }
  .car { grid-template-columns: 7.5rem minmax(0, 1fr); align-items: center; gap: .9rem; padding: .7rem .9rem; }
  .car-art { max-width: none; }
  .car-text { margin-top: 0; }
  .car-name { font-size: 1.15rem; }
  .car-nick { font-size: .92rem; }
  .car-spec { font-size: .8rem; }
  .car { display: none; }
  .strip-wrap { display: block; }
  .status { max-width: 52vw; }
}
@media (orientation: portrait) and (min-width: 700px) {
  .dash { --g: min(86vw, calc(var(--app-h) * .5), 44rem); }
  .car { grid-template-columns: 12rem minmax(0, 1fr); }
  .car-name { font-size: 1.5rem; }
}
@media (max-width: 420px) {
  .brand-word { display: none; }
  .icon-btn { width: 2.7rem; height: 2.7rem; }
  .ignition { --s: 7.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
