/* Geologica, cyrillic */
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/gangstas/assets/Geologica-cyrillic.506d284e8b34fd85.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Geologica, latin */
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(/gangstas/assets/Geologica-latin.9e50335cb9e3e02e.woff2) format('woff2');
  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;
}
/* Martian Mono, cyrillic */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 75% 112.5%;
  font-display: swap;
  src: url(/gangstas/assets/MartianMono-cyrillic.cd2f63701950ebbd.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Martian Mono, latin */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 75% 112.5%;
  font-display: swap;
  src: url(/gangstas/assets/MartianMono-latin.debf9154726c626f.woff2) format('woff2');
  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;
}


/* XPRODUCT_PRELOAD_STYLE_START */
/* Same counter, canvas and reveal as the XPRODUCT homepage. */
@font-face { font-family: 'Xproduct Preload Mono'; src: url('/lab-assets/PPSupplyMono-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
.scene-preloader { font: 400 12px/1.2 'Xproduct Preload Mono', 'Courier New', monospace; letter-spacing: .1em; text-transform: uppercase; }
#scene-counter { font-size: 36px; line-height: 1.2; letter-spacing: .1em; color: hsl(0 72% 64%); }
.scene-preloader.error #scene-counter { font-size: 12px; color: inherit; }
.scene-preloader.error { flex-direction: column; gap: 28px; padding: 24px; text-align: center; }
.scene-preloader.error button, .scene-preloader.error a { font: inherit; color: inherit; text-decoration: none; }
.scene-preloader.error button { background: transparent; border: 1px solid currentColor; border-radius: 0; padding: 16px 24px; min-height: 44px; }
.scene-preloader.error :focus-visible { outline: 1px solid #f5f5f5; outline-offset: 6px; }
#scene-preloader[hidden], #scene-curtain[hidden] { display: none !important; }
/* XPRODUCT_PRELOAD_STYLE_END */

/* Инженерный пульт: 3D-вид - главное, пульт и показатели не перекрывают модель. Цифры - Martian Mono, текст - Geologica. */
:root {
  color-scheme: light;
  --bg: #edf0f3;
  --surface: #f8f9fa;
  --raised: #ffffff;
  --well: #e4e8ed;
  --stage: #000000;
  --stage-ink: #dfe5ee; --stage-ink-2: #aeb8c8;
  --ink: #151b23;
  --ink-2: #4b5563;
  --ink-3: #66707d;
  --rule: #d6dce3;
  --rule-strong: #aeb8c3;
  --track: #c4ccd6;
  --accent: #2a54c4;
  --accent-hover: #2149b0;
  --accent-ink: #ffffff;
  --accent-soft: #dfe7fa;
  --ok: #1c7a4b;
  --warn: #965a00;
  --bad: #bf352b;
  --ok-soft: #e0f1e7;
  --warn-soft: #f8ecd4;
  --bad-soft: #fae2df;
  --shadow-sm: 0 1px 2px rgb(20 28 40 / .12);
  --shadow-md: 0 2px 6px rgb(20 28 40 / .10), 0 12px 32px rgb(20 28 40 / .14);
  --font-ui: "Geologica", "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 13px;
  --fs-sm: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 21px;
  --fs-num: 15px;     /* цифры пульта */
  --fs-num-sm: 13.5px; /* цифры полосы и подписи в 3D */
  --tap: 44px;
  --panel-w: clamp(340px, 27vw, 400px);
  --gutter: 24px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1218; --surface: #121920; --raised: #1e2731; --well: #0a0f14; --stage: #000000;
    --ink: #e4e9ef; --ink-2: #a5b0bd; --ink-3: #8994a1;
    --rule: #222c37; --rule-strong: #3a4756; --track: #2f3b48;
    --accent: #89aaff; --accent-hover: #a5bfff; --accent-ink: #0a1222; --accent-soft: #1b2843;
    --ok: #4cc58b; --warn: #f0b64c; --bad: #ff7f72;
    --ok-soft: #11271c; --warn-soft: #2a2113; --bad-soft: #2d1714;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .45); --shadow-md: 0 2px 8px rgb(0 0 0 / .4), 0 14px 36px rgb(0 0 0 / .45);
  }
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1218; --surface: #121920; --raised: #1e2731; --well: #0a0f14; --stage: #000000;
  --ink: #e4e9ef; --ink-2: #a5b0bd; --ink-3: #8994a1;
  --rule: #222c37; --rule-strong: #3a4756; --track: #2f3b48;
  --accent: #89aaff; --accent-hover: #a5bfff; --accent-ink: #0a1222; --accent-soft: #1b2843;
  --ok: #4cc58b; --warn: #f0b64c; --bad: #ff7f72;
  --ok-soft: #11271c; --warn-soft: #2a2113; --bad-soft: #2d1714;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .45); --shadow-md: 0 2px 8px rgb(0 0 0 / .4), 0 14px 36px rgb(0 0 0 / .45);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 var(--fs-md)/1.5 var(--font-ui);
  font-variation-settings: "SHRP" 0, "CRSV" 0;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.num { font-family: var(--font-num); font-stretch: 87.5%; font-variant-numeric: tabular-nums; font-weight: 450; }
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- каркас */
.app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "head head" "stage panel";
}
.app.panel-closed { grid-template-columns: minmax(0, 1fr) 0; }
.app.panel-closed .panel { display: none; }

.masthead {
  grid-area: head; display: flex; align-items: stretch; gap: 28px;
  min-height: 64px; padding: 0 12px 0 20px;
  background: var(--bg); border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: none; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; stroke-width: 1.6; }
.brand-text { display: grid; line-height: 1.25; }
.brand-text strong { font-size: 17px; font-weight: 620; font-variation-settings: "SHRP" 60; letter-spacing: .005em; white-space: nowrap; }
.tabs {
  display: flex; align-items: stretch; gap: 4px; min-width: 0;
  align-self: center; margin-block: 7px; padding: 4px;
  background: var(--raised); border: 1px solid var(--rule-strong);
}
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 9px;
  padding: 0 14px; border: 0; background: none; color: var(--ink-2);
  font-size: var(--fs-md); font-weight: 500; white-space: nowrap;
  transition: background-color .15s ease-out, color .15s ease-out;
}
.tab .ic { width: 20px; height: 20px; }
.tabs .tab {
  min-height: 40px; color: var(--ink); font-weight: 600; letter-spacing: .015em;
}
.tabs .tab:hover, .dock .tab:hover { background: var(--surface); color: var(--ink); }
.tabs .tab[aria-selected="true"], .dock .tab[aria-selected="true"] {
  background: var(--ink); color: var(--bg);
}
.tabs .tab[aria-selected="true"] .ic, .dock .tab[aria-selected="true"] .ic { color: inherit; }
.tabs .tab:focus-visible, .dock .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab .l-short { display: none; }
.head-end { margin-left: auto; display: flex; align-items: center; gap: 4px; }


.icon-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap);
  border: 0; border-radius: 12px; background: transparent; color: var(--ink-2);
  transition: background-color .15s ease-out, color .15s ease-out;
}
.icon-btn:hover { background: var(--well); color: var(--ink); }
.panel-head .head-btns { display: flex; align-items: center; gap: 2px; flex: none; }

.dock { grid-area: dock; display: none; }

/* ---------- сцена */
.stage {
  grid-area: stage; position: relative; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--stage);
  container: stage / size;
}
.toolbar {
  flex: none; display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none;
}
.toolbar::-webkit-scrollbar { display: none; }
.toolbar > * { flex: none; }
.tb-gap { flex: 1 1 auto; min-width: 4px; }
.viewport { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.viewport canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.freecam-btn[aria-checked="true"] { color: var(--accent); background: var(--accent-soft); }
.nav-controls {
  position: absolute; z-index: 4; left: 10px; bottom: 10px; width: 300px; max-width: calc(100% - 20px);
  padding: 8px; border: 1px solid var(--rule-strong); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm); max-height: calc(100% - 20px); overflow-y: auto;
}
.nav-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.nav-head label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: var(--fs-xs); }
.nav-head select { color: var(--ink); background: var(--well); border: 1px solid var(--rule); border-radius: 6px; padding: 4px; font-size: var(--fs-xs); }
.nav-help { color: var(--ink-2); font-size: var(--fs-xs); }
.nav-pad { display: flex; gap: 3px; justify-content: space-between; }
.nav-pad button { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; touch-action: none; user-select: none; font-size: 12px; }
.nav-pad button[data-nav="left"], .nav-pad button[data-nav="right"], .nav-pad button[data-nav="forward"], .nav-pad button[data-nav="back"] { font-size: 20px; }
.nav-pad button.held { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.nav-hint { margin: 8px 0 0; color: var(--ink-2); font-size: 12px; line-height: 1.5; }

/* кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--rule-strong); background: var(--raised); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn .ic { width: 18px; height: 18px; }
.btn .chev { width: 16px; height: 16px; color: var(--ink-3); margin-right: -4px; }
.btn.quiet { border-color: transparent; background: var(--well); }
.btn.quiet:hover { border-color: var(--rule-strong); }
.btn.quiet b { font-weight: 600; }
.btn-icon { width: 40px; padding: 0; }
.btn[aria-expanded="true"] { border-color: var(--accent); }

/* сегменты */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px;
  padding: 3px; border-radius: 12px; background: var(--well);
}
.seg button {
  min-height: 38px; padding: 6px 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 500; line-height: 1.25;
  transition: background-color .15s ease-out, color .15s ease-out, box-shadow .15s ease-out;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] {
  background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm);
}
.seg.tb { grid-auto-columns: auto; }
.seg.tb button { white-space: nowrap; padding: 6px 10px; }
.panel .seg button { min-height: 42px; padding: 6px 8px; text-wrap: balance; }
.seg.stack { grid-auto-flow: row; }
/* вторая строка кнопки сегмента (допуски «Дром» / «Авторевю» во вкладке «Дверь»): мельче, чтобы обе кнопки были в две строки */
.seg .seg-sub { font-size: var(--fs-xs); }

/* ---------- полоса показателей */
.strip {
  position: relative; flex: none; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 24px;
  padding: 12px 16px 14px; min-height: 68px;
  background: var(--surface); border-top: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.strip.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.strip.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.strip.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.strip::-webkit-scrollbar { display: none; }
.strip:empty { display: none; }
.cell { flex: none; display: grid; gap: 3px; }
.cell-label { font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; line-height: 1.3; }
.cell-label i { font-style: normal; color: var(--ink-3); }
.cell-vals { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.v { position: relative; display: inline-flex; align-items: baseline; gap: 5px; font-family: var(--font-num); font-stretch: 75%; font-size: var(--fs-num-sm); font-weight: 450; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.35; }
.v .tag { font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; }
.st { width: 10px; height: 10px; flex: none; align-self: center; fill: currentColor; }
.v.ok .st, .ok-c { color: var(--ok); }
.v.warn .st, .warn-c { color: var(--warn); }
.v.bad .st, .bad-c { color: var(--bad); }
.v.bad { color: var(--bad); }
/* узкая сцена: первой - сводка замечаний, по нажатию - все показатели с пометками и пояснениями */
.strip-sum {
  flex: none; align-self: center; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 10px 0 12px; border-radius: 99px;
  border: 1px solid var(--rule-strong); background: var(--raised); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.strip-sum .st { width: 11px; height: 11px; }
.strip-sum.ok .st { color: var(--ok); } .strip-sum.warn .st { color: var(--warn); } .strip-sum.bad .st { color: var(--bad); }
.strip-sum .chev { width: 16px; height: 16px; color: var(--ink-3); transform: rotate(180deg); }
.strip-pop {
  position: fixed; inset: auto; margin: 0; padding: 4px 0; width: min(420px, calc(100vw - 16px));
  max-height: min(70vh, 520px); overflow-y: auto; overscroll-behavior: contain;
  border: 0; border-radius: 14px; background: var(--raised); color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / .14), 0 8px 20px rgb(0 0 0 / .16);
}
.strip-pop:not(.open) { display: none; }
.strip-pop .sp-row { display: grid; gap: 4px; padding: 10px 16px; }
.strip-pop .sp-row + .sp-row { border-top: 1px solid var(--rule); }
.strip-pop .cell-label { white-space: normal; font-size: var(--fs-sm); }
.strip-pop .cell-label i { display: inline !important; }
.strip-pop .cell-vals { flex-wrap: wrap; white-space: normal; gap: 4px 14px; }
.strip-pop .v { font-size: var(--fs-num); }
.strip-pop p { font-size: var(--fs-xs); line-height: 1.45; color: var(--ink-2); }

/* ---------- панель */
.panel {
  grid-area: panel; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--rule);
  container: panel / inline-size;
}
.panel-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 4px var(--gutter); }
.panel-head h2 { font-size: var(--fs-xl); line-height: 1.25; font-weight: 600; font-variation-settings: "SHRP" 50; }
.panel-sub { font-size: var(--fs-xs); line-height: 1.3; color: var(--ink-2); margin-top: 2px; }
.panel-body { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--gutter) calc(32px + env(safe-area-inset-bottom)); scrollbar-gutter: stable; }
/* пока модуль не запущен, полусобранный пульт и тулбар не показываем */
.app:not(.ready) .panel-body, .app:not(.ready) .toolbar > * { visibility: hidden; }
.vpanel { display: block; }
.group { padding: 18px 0 14px; }
.group + .group, .group + .more, .more + .group { margin-top: 10px; }
.group h3 { font-size: var(--fs-lg); line-height: 1.3; font-weight: 600; margin-bottom: 12px; font-variation-settings: "SHRP" 40; }
.group h4 { font-size: var(--fs-md); font-weight: 600; margin-bottom: 8px; }
.stack-12 > * + * { margin-top: 12px; }
.stack-16 > * + * { margin-top: 16px; }
.field-label { font-size: var(--fs-sm); color: var(--ink-2); margin-bottom: -4px; }
.hint { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.55; max-width: 62ch; }
.readout { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 12px 14px; border-radius: 12px; background: var(--well); }
.readout .v { font-size: var(--fs-num); }
/* сводка по сторонам: строка - сторона, столбцы - поворот, наклон, расстояние */
.readout.grid { display: grid; grid-template-columns: auto repeat(3, auto); justify-content: start; gap: 4px 18px; align-items: baseline; }
.readout.grid .th { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.3; }
.readout.grid .side { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }

/* ползунки с линейкой */
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 16px; }
.range label { font-size: var(--fs-md); line-height: 1.35; color: var(--ink); }
.range output { font-family: var(--font-num); font-stretch: 87.5%; font-variant-numeric: tabular-nums; font-size: var(--fs-num); font-weight: 500; white-space: nowrap; color: var(--ink); }
.range output .u { color: var(--ink-3); margin-left: .35em; font-weight: 400; }
.range .track { grid-column: 1 / -1; position: relative; height: 40px; margin-top: 2px; --p: 0; }
.range .ticks {
  position: absolute; left: 11px; right: 11px; top: 27px; height: 5px; pointer-events: none;
  background-image: linear-gradient(to right, var(--rule-strong) 1px, transparent 1px);
  background-size: calc((100% - 1px) / 10) 100%; background-repeat: repeat-x;
}
.range .zero { position: absolute; top: 25px; width: 1.5px; height: 9px; background: var(--ink-3); pointer-events: none; left: calc(11px + (100% - 22px) * var(--z)); }
.range input[type="range"] {
  -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 26px; margin: 0;
  background: transparent; cursor: pointer; touch-action: pan-y;
}
.range input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--accent) 0 calc(11px + (100% - 22px) * var(--p)), var(--track) 0);
}
.range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--raised); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / .25);
  transition: transform .12s ease-out;
}
.range input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
.range input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--track); }
.range input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.range input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--raised); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.range input[type="range"]:focus-visible { outline: none; }
.range input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent); }
.range input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }

/* переключатели */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--tap); cursor: pointer; font-size: var(--fs-md); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .knob { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--track); transition: background-color .15s ease-out; }
.switch .knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--raised); box-shadow: var(--shadow-sm); transition: transform .18s cubic-bezier(.2, .7, .2, 1); }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }

/* раскрывающиеся блоки */
details.more { margin-top: 18px; }
details.more > summary, details.sub > summary {
  list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer;
  min-height: 52px; padding: 8px 14px 8px 16px; border-radius: 12px; background: var(--well);
}
details.more > summary::-webkit-details-marker, details.sub > summary::-webkit-details-marker { display: none; }
details > summary .s-text { display: grid; flex: 1; line-height: 1.3; }
details > summary .s-text b { font-weight: 600; font-size: var(--fs-md); }
details > summary .s-text span { font-size: var(--fs-xs); color: var(--ink-2); }
details > summary .chev { width: 18px; height: 18px; color: var(--ink-2); transition: transform .2s ease-out; }
details[open] > summary .chev { transform: rotate(180deg); }
details.more[open] > summary { margin-bottom: 4px; }
details.sub { margin-top: 12px; }
details.sub > summary { background: transparent; border: 1px solid var(--rule); }
details.sub[open] > summary { margin-bottom: 12px; }
.more-body { padding: 4px 2px 0; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.field select { min-height: var(--tap); padding: 0 12px; border-radius: 10px; border: 1px solid var(--rule-strong); background: var(--raised); color: var(--ink); font-size: var(--fs-md); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-name { font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }

/* паспорт */
.spec { display: grid; gap: 10px; }
.spec-row { display: flex; align-items: baseline; gap: 10px; }
.spec-row dt { color: var(--ink-2); font-size: var(--fs-sm); flex: 0 1 auto; min-width: 0; }
.spec-row .lead { flex: 1 1 auto; min-width: 12px; border-bottom: 1.5px dotted var(--rule-strong); transform: translateY(-4px); }
.spec-row dd { font-family: var(--font-num); font-stretch: 87.5%; font-variant-numeric: tabular-nums; font-size: var(--fs-num); font-weight: 450; text-align: right; flex: none; white-space: nowrap; }
/* длинное значение - под термином, без отточия */
.spec-row.wrap { flex-wrap: wrap; row-gap: 2px; }
.spec-row.wrap .lead { display: none; }
.spec-row.wrap dt { flex-basis: 100%; }
.spec-row.wrap dd { flex: 1 1 100%; text-align: left; white-space: normal; }
.verdict { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: var(--fs-sm); line-height: 1.5; color: var(--ink); }
.verdict .st { width: 12px; height: 12px; margin-top: 5px; }
.verdict.ok { background: var(--ok-soft); } .verdict.ok .st { color: var(--ok); }
.verdict.warn { background: var(--warn-soft); } .verdict.warn .st { color: var(--warn); }
.verdict.bad { background: var(--bad-soft); } .verdict.bad .st { color: var(--bad); }
ul.kit { list-style: none; padding: 0; display: grid; gap: 10px; font-size: var(--fs-sm); line-height: 1.55; }
ul.kit li { position: relative; padding-left: 20px; }
ul.kit li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--rule-strong); }
ul.kit b { font-family: var(--font-num); font-stretch: 87.5%; font-weight: 500; }
/* комплект: ведомость и порядок сборки */
.kit-body h4 { font-size: var(--fs-md); font-weight: 600; margin-bottom: 10px; }
.kit-body ul.kit { gap: 8px; }
.kit-body ul.kit .q { color: var(--ink-3); white-space: nowrap; }
ol.steps { padding: 0; list-style: none; counter-reset: st; display: grid; gap: 10px; font-size: var(--fs-sm); line-height: 1.55; }
ol.steps li { counter-increment: st; display: grid; grid-template-columns: 28px 1fr; gap: 12px; }
ol.steps li::before { content: counter(st); font: 500 var(--fs-xs)/1.9 var(--font-num); color: var(--ink-3); text-align: right; }

/* легенда выносок */
ol.legend { list-style: none; padding: 0; display: grid; gap: 4px; }
ol.legend li.off { opacity: .55; }   /* выноска не показана на узкой сцене */
/* «Провод в камере»: показатели Л и П столбцами */
table.lr { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.lr th { font-weight: 600; color: var(--ink-2); text-align: right; padding: 0 0 6px 12px; }
table.lr td { padding: 6px 0 6px 12px; border-top: 1px solid var(--rule); text-align: right; white-space: nowrap; font-family: var(--font-num); font-stretch: 87.5%; font-variant-numeric: tabular-nums; }
table.lr th:first-child, table.lr td:first-child { text-align: left; padding-left: 0; }
table.lr td:first-child { color: var(--ink-2); white-space: normal; font-family: inherit; font-stretch: normal; }
ul.why { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.45; }
ol.legend li { display: grid; grid-template-columns: 28px 1fr; gap: 2px 12px; padding: 10px 10px 10px 8px; border-radius: 12px; transition: background-color .15s ease-out; cursor: pointer; }
ol.legend li:hover, ol.legend li.hl { background: var(--well); }
ol.legend li[aria-pressed="true"] { background: var(--accent-soft); }
ol.legend .n { grid-row: span 2; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 600 var(--fs-xs)/1 var(--font-num); }
ol.legend b { font-weight: 600; font-size: var(--fs-md); line-height: 1.35; }
ol.legend span { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.5; }

/* выноски на 3D (CSS2DRenderer): точка на детали, линия-выноска с полкой как на чертеже */
.co { position: absolute; width: 0; height: 0; pointer-events: none; }
.co .leader { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
.co .leader path { fill: none; stroke: var(--stage-ink-2); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.co .dot { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--stage); }
.co .lbl {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font-size: var(--fs-num-sm); font-weight: 500; line-height: 1.3; color: var(--stage-ink);
  padding: 3px 6px 4px; margin-bottom: 1px; border-radius: 6px 6px 0 0;
  background: color-mix(in srgb, var(--stage) 84%, transparent);
}
.co .lbl .n { font: 600 var(--fs-xs)/1 var(--font-num); color: var(--accent); margin-right: 7px; }
.co .lbl .num { font-size: var(--fs-xs); }
.co.badge .lbl {
  display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  background: var(--raised); box-shadow: var(--shadow-sm); text-shadow: none;
}
.co.badge .lbl .n { margin: 0; }
.co.badge .lbl .t { display: none; }
.co.hl .lbl { color: var(--accent); }
.co.hl .leader path { stroke: var(--accent); stroke-width: 1.75; }
.co.hl .dot { transform: scale(1.4); }

/* ---------- состояния вида */
.loading {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px;
  padding: 24px; text-align: center; color: var(--ink-2); font-size: var(--fs-md);
  background: var(--stage);
}
.loading .bar { width: 180px; height: 3px; border-radius: 3px; background: var(--track); overflow: hidden; position: relative; }
.loading .bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); border-radius: 3px; animation: slide 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.loading.error .bar { display: none; }
.busy {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow-md); font-size: var(--fs-sm); color: var(--ink-2); pointer-events: none;
}
.busy::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--track); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.soon {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 32px)); padding: 24px 24px 22px; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-md); display: grid; gap: 10px; justify-items: start;
}
.soon .ic { width: 28px; height: 28px; color: var(--accent); }
.soon h2 { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; }
.soon p { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.55; }
.soon .btn { margin-top: 6px; }
.toast {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: var(--fs-sm); box-shadow: var(--shadow-md); z-index: 5;
}

/* меню (popover) */
.menu {
  position: fixed; inset: auto; margin: 0; padding: 6px; min-width: 200px; max-width: min(320px, calc(100vw - 16px));
  max-height: min(70vh, 420px); overflow-y: auto;
  border: 0; border-radius: 14px; background: var(--raised); color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / .14), 0 8px 20px rgb(0 0 0 / .16);
}
.menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 8px 12px;
  border: 0; border-radius: 9px; background: none; text-align: left; font-size: var(--fs-md);
}
.menu button:hover, .menu button:focus-visible { background: var(--well); outline: none; }
.menu button .mark { width: 16px; height: 16px; flex: none; color: var(--accent); }
.menu button[aria-checked="false"] .mark { visibility: hidden; }
.menu button[aria-disabled="true"] { color: var(--ink-3); cursor: not-allowed; }
.menu button[aria-disabled="true"]:hover { background: none; }
.menu button .note { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); }
.seg button[aria-disabled="true"] { color: var(--ink-3); opacity: .6; cursor: not-allowed; }

/* ---------- тулбар: если не влезает, по очереди сворачиваются камеры, отрисовка, подпись «Панель», выгрузка,
   подписи меню камер и отрисовки, распорка (fitToolbar) */
.only-narrow { display: none !important; }
.toolbar.c-cams .cams-seg { display: none !important; }
.toolbar.c-cams .cams-menu { display: inline-flex !important; }
.toolbar.c-modes .modes-seg { display: none !important; }
.toolbar.c-modes .modes-menu { display: inline-flex !important; }
.toolbar.c-panel .btn-panel .lbl { display: none; }
.toolbar.c-panel .btn-panel { width: 44px; padding: 0; }
.toolbar.c-export .exp-wide { display: none !important; }
.toolbar.c-export .exp-menu { display: inline-flex !important; }
.toolbar.c-cams-ic .cams-menu b, .toolbar.c-cams-ic .modes-menu b { display: none; }
.toolbar.c-cams-ic .cams-menu, .toolbar.c-cams-ic .modes-menu { padding-inline: 10px; gap: 4px; }
.toolbar.c-gap0 .tb-gap { display: none; }
/* выгрузка - основное действие: если тулбар всё же прокручивается, кнопка остаётся у правого края */
.toolbar .exp-menu { position: sticky; right: 0; box-shadow: -10px 0 0 var(--surface); }
.toolbar .exp-menu.quiet-exp { background: var(--raised); color: var(--ink); border-color: var(--rule-strong); }
@container stage (max-width: 759px) {
  .toolbar { gap: 8px; padding-inline: 10px; }
  .toolbar .btn.quiet { padding-inline: 12px; }
}
@container stage (max-width: 639px) {
  .strip { flex-wrap: nowrap; }
}
@container stage (max-height: 480px) {
  .strip .cell-label i { display: none; }
  .toolbar { min-height: 52px; padding-block: 6px; }
  .strip { flex-wrap: nowrap; min-height: 0; padding: 8px 16px; gap: 10px 26px; align-items: center; }
  .cell { display: flex; align-items: baseline; gap: 10px; }
  .cell-vals { gap: 14px; }
}

/* ---------- десктоп поуже */
@media (max-width: 1239px) {
  .tab .l-full { display: none; }
  .tab .l-short { display: inline; }
  .masthead { gap: 16px; }
}
@media (max-width: 1060px) {
  .masthead .tab .ic { display: none; }
  .b-tail { display: none; }
  .tab { padding: 0 12px; }
}

/* ---------- планшет вертикально: вид сверху, пульт снизу */
@media (orientation: portrait) and (max-width: 1023px) {
  .app, .app.panel-closed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(300px, 54dvh) minmax(0, 1fr);
    grid-template-areas: "head" "stage" "panel";
  }
  .app.panel-closed .panel { display: flex; }
  .panel { border-left: 0; border-top: 1px solid var(--rule); }
  .panel-head .close-panel, .btn-panel { display: none !important; }
  .masthead { padding-top: env(safe-area-inset-top); }
}
@container panel (min-width: 640px) {
  .vpanel { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; align-items: start; }
  .vpanel > details.more, .vpanel > .wide { grid-column: 1 / -1; }
  .group + .group, .group + .more, .more + .group { margin-top: 0; }
}

/* ---------- телефон вертикально: вкладки внизу */
@media (orientation: portrait) and (max-width: 767px) {
  :root { --gutter: 20px; }
  .app, .app.panel-closed {
    grid-template-rows: minmax(240px, 46dvh) minmax(0, 1fr) auto;
    grid-template-areas: "stage" "panel" "dock";
  }
  .app.free-camera, .app.free-camera.panel-closed { grid-template-rows: minmax(300px, 60dvh) minmax(0, 1fr) auto; }
  .masthead { display: none; }
  .toolbar { padding-top: calc(8px + env(safe-area-inset-top)); }
  .dock {
    display: flex; justify-content: space-between; gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--raised); border-top: 1px solid var(--rule-strong);
  }
  .dock .dock-mark, .dock .dock-end { display: none; }
  .panel-head { padding-top: 10px; }
  .panel-head h2 { font-size: 19px; }
}
.dock .tab {
  flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px;
  min-height: 54px; padding: 4px 2px; border-radius: 0; color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.15;
}
.dock .tab .ic { width: 22px; height: 22px; }
.dock .tab .l-full { display: none; }
.dock .tab .l-short { display: inline; }

/* ---------- телефон горизонтально: рейка слева, 3D во всю высоту, пульт - выдвижная шторка справа */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --gutter: 20px; --fs-xl: 19px; }
  .app {
    grid-template-columns: auto minmax(0, 1fr) min(380px, 46vw);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "dock stage panel";
  }
  .app.panel-closed { grid-template-columns: auto minmax(0, 1fr) 0; }
  .masthead { display: none; }
  .dock {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    width: calc(76px + env(safe-area-inset-left));
    padding: 8px 6px calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
    background: var(--raised); border-right: 1px solid var(--rule-strong);
    overflow-y: auto; scrollbar-width: none;
  }
  .dock .tab { flex: 0 0 auto; min-height: 52px; }
  .dock .dock-mark { display: none; }
  .dock .dock-end { margin-top: auto; display: grid; justify-items: center; }
  .stage { padding-right: 0; }
  .app.panel-closed .stage .toolbar, .app.panel-closed .stage .strip { padding-right: calc(16px + env(safe-area-inset-right)); }
  .panel { padding-right: env(safe-area-inset-right); }
  .strip { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .panel-head { padding: 4px 6px 0 var(--gutter); }
  .panel-head h2 { font-size: 17px; }
  .panel-sub { display: none; }
}
@media (orientation: landscape) and (max-height: 560px) and (max-width: 900px) {
  .app { grid-template-columns: auto minmax(0, 1fr) min(340px, 40vw); }
}
@media (orientation: landscape) and (max-height: 560px) and (max-width: 700px) {
  .app { grid-template-columns: auto minmax(0, 1fr) min(320px, 52vw); }
}
/* низкий экран: подсказки - в две строки, полный текст по нажатию */
@media (orientation: landscape) and (max-height: 560px) {
  .panel p.hint:not(.open) { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
  .panel p.hint.clamped { position: relative; cursor: pointer; }
  .panel p.hint.clamped:not(.open)::after {
    content: "ещё ▾"; position: absolute; right: 0; bottom: 0; padding-left: 28px;
    background: linear-gradient(to right, transparent, var(--surface) 24px); color: var(--accent); font-weight: 500;
  }
}

.toolbar .is-empty { display: none !important; }
ol.legend.off li { opacity: .55; }

@media (pointer: coarse) {
  .seg button, .panel .seg button { min-height: var(--tap); }
  .strip-sum { min-height: var(--tap); }
  .btn { min-height: 44px; }
  .btn-icon { width: 44px; }
  .range .track { height: 44px; }
  /* полоса касания 44 px с тем же центром, что у дорожки (13 px): линейка и риска нуля не сдвигаются */
  .range input[type="range"] { height: 44px; top: -9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; }
  .loading .bar::after { width: 100%; transform: none; animation: pulse 1.6s ease-in-out infinite !important; }
  .busy::before { border-color: var(--accent); animation: pulse 1.6s ease-in-out infinite !important; }
}
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* v3: кнопка «Спецификация и сборка» в тулбаре - только во вкладке «Детали»; узкий тулбар - одна иконка */
.app:not([data-view="details"]) .toolbar .spec-btn { display: none !important; }
.toolbar.c-spec .spec-btn .lbl { display: none; }
.toolbar.c-spec .spec-btn { width: 44px; padding: 0; }
.app:not([data-view="acoustics"]) .toolbar .hel-btn { display: none !important; }
.toolbar.c-spec .hel-btn .lbl { display: none; }
.toolbar.c-spec .hel-btn { width: 44px; padding: 0; }
.app:not(:is([data-view="cabin"], [data-view="door"], [data-view="acoustics"])) .exterior-btn { display: none !important; }
.toolbar.c-spec .exterior-btn .lbl { display: none; }
.toolbar.c-spec .exterior-btn { width: 44px; padding: 0; }
.toolbar.c-spec .freecam-btn .lbl { display: none; }
.toolbar.c-spec .freecam-btn { width: 44px; padding: 0; }
.exterior-btn[aria-checked="true"] { color: var(--accent); background: var(--accent-soft); }
/* сводка места из fit.json в пульте «В салоне» */
.readout.fit { display: grid; grid-template-columns: auto repeat(2, auto); justify-content: start; gap: 4px 18px; align-items: baseline; }
.readout.fit .th { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.3; }
.readout.fit .k { font-size: var(--fs-xs); color: var(--ink-2); }
.badge-prov { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; font-size: var(--fs-xs); background: var(--warn-soft); color: var(--ink); vertical-align: 1px; }
/* легенда «Что внутри»: ссылка на пункт спецификации */
ol.legend .more-link { color: var(--accent); text-decoration: none; font-weight: 500; white-space: nowrap; }
ol.legend .more-link:hover { text-decoration: underline; }

/* Files use the same route, navigation and panel; the scene is hidden only here. */
.app[data-view="masha"], .app.panel-closed[data-view="masha"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "head" "panel"; }
.app[data-view="masha"] > .stage { display: none; }
.app[data-view="masha"] > .panel { display: flex; border-left: 0; background: #0a1019; }
.app[data-view="masha"] .panel-head { padding: 14px 24px; border-bottom: 1px solid var(--rule); background: var(--bg); }
.app[data-view="masha"] .panel-head .head-btns { display: none; }
.app[data-view="masha"] .panel-body { display: flex; padding: 0; overflow: hidden; scrollbar-gutter: auto; }
.app[data-view="masha"] .masha-panel { display: block; width: 100%; height: 100%; min-height: 0; }
.masha-files-frame { display: block; width: 100%; height: 100%; border: 0; }
@media (min-width: 1000px) and (max-width: 1390px) { .masthead { gap: 12px; padding-left: 12px; } .masthead .tab { padding-inline: 8px; gap: 6px; } }
@media (max-width: 999px) and (orientation: portrait) {
 .app[data-view="masha"], .app.panel-closed[data-view="masha"] { grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "panel" "dock"; }
 .app[data-view="masha"] .panel-head { padding: 12px 16px; }
}
@media (orientation: landscape) and (max-height: 560px) {
 .app[data-view="masha"], .app.panel-closed[data-view="masha"] { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "dock panel"; }
}


.tab { text-decoration: none; }
