/* ════════════════════════════════════════════════════════════════════════
   TARP STUDIO — Dark Studio shell. Premium gear-brand, cinematic.
   Tokens mirror the app's design system (carbon / amber / teal).
   ════════════════════════════════════════════════════════════════════════ */
:root {
  --bg: #0b0f14;
  --bg-deep: #070a0e;
  --surface: #111827;
  --surface-raised: #18202b;
  --glass: rgba(20, 27, 36, 0.72);
  --glass-line: rgba(255, 255, 255, 0.08);
  --border: #273241;
  --border-soft: rgba(255, 255, 255, 0.06);

  --text-primary: #eef1f4;
  --text-secondary: #9ca8b6;
  --text-muted: #67727f;

  --amber: #f6a73b;
  --amber-deep: #d98712;
  --teal: #2fd4c0;
  --teal-deep: #14b8a6;

  --shadow-soft: 0 18px 48px -16px rgba(0, 0, 0, 0.7);
  --shadow-glass: 0 8px 28px -10px rgba(0, 0, 0, 0.6);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

.studio {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── top app bar ─────────────────────────────────────────────────────────*/
.appbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 60px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.6), rgba(11, 15, 20, 0.2));
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.brand__mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1.5px solid var(--amber);
  border-radius: 8px;
  color: var(--amber);
  position: relative;
  flex: none;
}
.brand__mark svg { width: 17px; height: 17px; }
.brand__name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.16em;
}
.brand__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 1px;
}

/* direction switcher (meta-control for comparing layout directions) */
.dirswitch {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}
.dirswitch__btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.dirswitch__btn b {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  transition: color 0.18s;
}
.dirswitch__btn:hover { color: var(--text-primary); }
.dirswitch__btn[data-active] {
  background: var(--surface-raised);
  color: var(--text-primary);
  box-shadow: var(--shadow-glass);
}
.dirswitch__btn[data-active] b { color: var(--amber); }

.appbar__right {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.langswitch,
.unitswitch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.22);
}
.langswitch__btn,
.unitswitch__btn {
  min-width: 29px;
  padding: 6px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: 600 10px/1 var(--font-mono);
  cursor: pointer;
}
.langswitch__btn:hover,
.unitswitch__btn:hover { color: var(--text-primary); }
.langswitch__btn[data-active],
.unitswitch__btn[data-active] { background: var(--surface-raised); color: var(--amber); }
.modeswitch {
  display: flex;
  padding: 4px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}
.modeswitch__btn {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border: none; background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12.5px; font-weight: 500;
  border-radius: 7px; cursor: pointer;
  transition: 0.18s;
}
.modeswitch__btn svg { width: 15px; height: 15px; }
.modeswitch__btn[data-active] {
  background: var(--amber);
  color: #1a1206;
  font-weight: 600;
}
.iconbtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text-secondary);
  border-radius: 10px; cursor: pointer;
  transition: 0.18s;
}
.iconbtn:hover { color: var(--text-primary); border-color: var(--glass-line); }
.iconbtn svg { width: 16px; height: 16px; }
.sharebtn {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  justify-content: center;
  border: 1px solid rgba(47, 212, 192, 0.32);
  border-radius: 10px;
  background: rgba(47, 212, 192, 0.07);
  color: var(--teal);
  font: 600 12px/1 var(--font-display);
  cursor: pointer;
  transition: 0.18s;
}
.appbar > .sharebtn {
  grid-column: 3;
  justify-self: end;
}
.sharebtn:hover { border-color: var(--teal); background: rgba(47, 212, 192, 0.13); }
.sharebtn svg { width: 16px; height: 16px; flex: none; }
.sharetoast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(47, 212, 192, 0.38);
  border-radius: 10px;
  background: rgba(10, 14, 19, 0.96);
  color: var(--text-primary);
  font: 600 12px/1.4 var(--font-display);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.sharetoast[data-show] { opacity: 1; transform: translate(-50%, 0); }

/* ── preset carousel ─────────────────────────────────────────────────────*/
.carousel {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 104px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(13, 18, 25, 0.55), rgba(11, 15, 20, 0.15));
  z-index: 35;
}
.carousel__nav {
  flex: none;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text-secondary);
  border-radius: 10px; cursor: pointer;
  transition: 0.16s;
}
.carousel__nav:hover { color: var(--text-primary); border-color: var(--glass-line); background: rgba(0,0,0,0.45); }
.carousel__nav svg { width: 18px; height: 18px; }
.carousel__track {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 14px 2px;
  flex: 1;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.carousel__track::-webkit-scrollbar { display: none; }
/* keep cards centred as a group, but let them push apart and scroll when they overflow */
.carousel__track > :first-child { margin-left: auto; }
.carousel__track > :last-child { margin-right: auto; }
.pcard {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px 11px 12px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(24, 32, 43, 0.55), rgba(17, 24, 39, 0.4));
  border-radius: 13px;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
  font-family: var(--font-display);
  text-align: left;
}
.pcard:hover { transform: translateY(-2px); border-color: var(--glass-line); }
.pcard__art {
  flex: none;
  width: 56px; height: 40px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-soft);
}
.pcard__art svg { width: 56px; height: 40px; overflow: visible; }
.pcard__shape {
  fill: rgba(47, 212, 192, 0.14);
  stroke: var(--teal);
  stroke-width: 1.4;
  stroke-linejoin: round;
  transition: fill 0.2s, stroke 0.2s;
}
.pcard__meta { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.pcard__name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.pcard__code {
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--text-muted);
}
.pcard__shape--winter { stroke: #7fb4ff; fill: rgba(127, 180, 255, 0.12); }
.pcard[data-active] .pcard__shape--winter { stroke: var(--amber); fill: rgba(246, 167, 59, 0.16); }
.pcard__shape--pagoda { stroke: #74d6ff; fill: rgba(116, 214, 255, 0.13); }
.pcard[data-active] .pcard__shape--pagoda { stroke: var(--amber); fill: rgba(246, 167, 59, 0.16); }

/* honest provenance badges */
.badges {
  display: flex; flex-wrap: wrap; gap: 6px;
  /* ФИКС высоты под максимум бейджей (3 ряда) — строки ниже не сдвигаются */
  height: 80px; align-content: flex-start; overflow: hidden;
}
.badge {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
}
.badge--cat { color: var(--amber); border-color: rgba(246, 167, 59, 0.4); background: rgba(246, 167, 59, 0.08); }
.badge--real { color: var(--teal); border-color: rgba(47, 212, 192, 0.36); background: rgba(47, 212, 192, 0.07); }
.badge--est {
  color: var(--text-muted);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.18);
}
.pcard[data-active] {
  border-color: rgba(246, 167, 59, 0.6);
  background: linear-gradient(180deg, rgba(246, 167, 59, 0.13), rgba(246, 167, 59, 0.03));
  box-shadow: 0 8px 26px -12px rgba(246, 167, 59, 0.45);
}
.pcard[data-active] .pcard__shape { fill: rgba(246, 167, 59, 0.16); stroke: var(--amber); }
.pcard[data-active] .pcard__code { color: var(--amber); }

/* ── stage root ──────────────────────────────────────────────────────────*/
.stageroot {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(120% 95% at 50% 8%, rgba(246, 167, 59, 0.07), transparent 55%),
    radial-gradient(80% 70% at 78% 92%, rgba(47, 212, 192, 0.06), transparent 60%),
    linear-gradient(180deg, #0c1016, #070a0e 80%);
}

.dir-mount { position: absolute; inset: 0; }

/* the live engine canvases live here, moved between slots */
.engine-holder { position: absolute; left: -9999px; top: -9999px; }
.site-footer {
  flex: 0 0 52px;
  min-height: 52px;
  display: grid;
  /* Equal outer tracks keep the project name at the physical page centre,
     while the creator mark and footer actions never overlap it. */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 0 14px 0 18px;
  border-top: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(10, 14, 19, 0.96), rgba(6, 9, 13, 0.99));
  color: var(--text-muted);
  z-index: 45;
}
.site-footer__creator {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  border-radius: 7px;
  outline: none;
}
.site-footer__creator:focus-visible {
  box-shadow: 0 0 0 2px rgba(246, 167, 59, 0.58);
}
.site-footer__creator img {
  display: block;
  width: auto;
  height: 34px;
  object-fit: contain;
  object-position: left center;
}
.site-footer__copy {
  min-width: 0;
  max-width: 100%;
  justify-self: center;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 500 9.5px/1.2 var(--font-mono);
  letter-spacing: 0.07em;
  text-align: center;
  white-space: nowrap;
}
.site-footer__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-width: 0;
  white-space: nowrap;
}
.site-footer a,
.site-footer button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  font: 500 9.5px/1.2 var(--font-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.site-footer a:hover,
.site-footer button:hover { color: var(--amber); }
.build-version {
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(231, 237, 243, 0.58);
  font: 600 10px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aboutmodal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: visible;
  opacity: 1;
  transition: opacity 160ms ease, visibility 0s;
}
.aboutmodal[aria-hidden="true"] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}
.aboutmodal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(2, 5, 8, 0.78);
  backdrop-filter: blur(8px);
  cursor: default;
}
.aboutmodal__dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 48px));
  overflow-y: auto;
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 24, 32, 0.99), rgba(9, 13, 18, 0.99));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.6);
}
.aboutmodal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.aboutmodal__eyebrow {
  margin-bottom: 6px;
  color: var(--amber);
  font: 600 9.5px/1 var(--font-mono);
  letter-spacing: 0.2em;
}
.aboutmodal__head h2 { margin: 0; font-size: 24px; line-height: 1.1; }
.aboutmodal__body { display: grid; gap: 14px; padding: 22px; color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.aboutmodal__body p { margin: 0; }
.aboutmodal__lead { color: var(--text-primary); font-size: 16px; font-weight: 600; }
body[data-about-open] { overflow: hidden; }

.viewport-slot { position: relative; width: 100%; height: 100%; }
.viewport-slot canvas { display: block; width: 100%; height: 100%; }
.minimap-slot { position: relative; width: 100%; height: 100%; }
.minimap-slot canvas { display: block; }
.scene-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-align: center;
  text-transform: uppercase;
  background:
    radial-gradient(70% 70% at 50% 40%, rgba(47, 212, 192, 0.08), transparent 70%),
    rgba(7, 10, 14, 0.74);
  z-index: 4;
}

/* cinematic vignette overlay on the stage */
.vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 180px 30px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

/* ── shared atoms ────────────────────────────────────────────────────────*/
.overline {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--shadow-glass);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
}
.chip--amber { color: var(--amber); border-color: rgba(246, 167, 59, 0.32); background: rgba(246, 167, 59, 0.08); }
.chip--teal { color: var(--teal); border-color: rgba(47, 212, 192, 0.3); background: rgba(47, 212, 192, 0.07); }

/* metric atom */
.metric { display: flex; flex-direction: column; gap: 3px; }
.metric__label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.metric__dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.metric__dot--const { background: var(--amber); }
.metric__dot--live { background: var(--teal); }
.metric__value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 4px;
}
.metric__value b { font-weight: 700; }
.metric__unit {
  font-family: var(--font-mono);
  font-size: 0.5em; font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* pitch button */
.pitch {
  position: relative;
  display: flex; flex-direction: column; gap: 5px;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(24, 32, 43, 0.7), rgba(17, 24, 39, 0.5));
  border-radius: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  font-family: var(--font-display);
}
.pitch:hover { border-color: var(--glass-line); transform: translateY(-1px); }
.pitch__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pitch__name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.pitch__icon { width: 19px; height: 19px; color: var(--text-muted); transition: color 0.2s; }
.pitch__tag {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.14em;
  padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
}
.pitch__desc { font-size: 11.5px; line-height: 1.45; color: var(--text-muted); }
.pitch[data-active] {
  border-color: rgba(246, 167, 59, 0.55);
  background: linear-gradient(180deg, rgba(246, 167, 59, 0.12), rgba(246, 167, 59, 0.03));
}
.pitch[data-active] .pitch__icon { color: var(--amber); }
.pitch[data-active] .pitch__tag { color: var(--amber); border-color: rgba(246, 167, 59, 0.4); }
.pitch[data-active]::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 3px; background: var(--amber);
}

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 20px;
  border: none; border-radius: 12px;
  font-family: var(--font-display);
  font-size: 13.5px; font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: 0.18s;
}
.cta svg { width: 16px; height: 16px; }
.cta--primary { background: var(--amber); color: #1a1206; }
.cta--primary:hover { background: #ffb84d; box-shadow: 0 10px 30px -8px rgba(246, 167, 59, 0.5); }
.cta--ghost { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); border: 1px solid var(--glass-line); }
.cta--ghost:hover { background: rgba(255, 255, 255, 0.08); }

.preset-hero__name {
  font-size: 21px; font-weight: 700; letter-spacing: -0.01em;
  line-height: 1.15;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preset-hero__tagline {
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.5;
  /* ФИКС высоты: ровно 3 строки — блок не «дышит» при смене пресета */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  overflow: hidden; height: calc(12.5px * 1.5 * 3);
}

/* mini-map frame */
.mapframe { position: relative; overflow: hidden; width: 100%; height: 100%; }
/* map panels sit over the bright 3D tarp — keep them solid so backdrop blur
   doesn't smear amber through the translucent header */
.dir-a__map .mapframe,
.rail-map .mapframe,
.dir-c__map .mapframe {
  background: #0b1016;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: rgba(47, 212, 192, 0.18);
}
.dir-a__map .minimap-slot,
.dir-c__map .minimap-slot {
  position: absolute; top: 40px; left: 12px; right: 12px; bottom: 12px;
}
.mapframe__head {
  position: absolute; top: 12px; left: 14px; right: 14px;
  display: flex; align-items: center; justify-content: space-between;
  z-index: 2; pointer-events: none;
}
.mapframe__corner {
  position: absolute; width: 12px; height: 12px;
  border: 1px solid rgba(47, 212, 192, 0.4);
}
.mapframe__corner--tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.mapframe__corner--tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.mapframe__corner--bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.mapframe__corner--br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

/* ════════ DIRECTION A — Витрина (showroom) ══════════════════════════════ */
.dir-a .viewport-slot { position: absolute; inset: 0; }
.dir-a__overline {
  position: absolute; top: 26px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  z-index: 10; text-align: center; pointer-events: none;
}
.dir-a__title { font-size: 17px; font-weight: 600; letter-spacing: 0.04em; }
.dir-a__chips { display: flex; gap: 8px; pointer-events: auto; }
.dir-a__metrics {
  position: absolute; left: 28px; bottom: 28px; z-index: 10;
  display: flex; flex-direction: column; gap: 1px;
  padding: 18px 20px; min-width: 210px;
}
.dir-a__metrics .metric { padding: 11px 0; }
.dir-a__metrics .metric + .metric { border-top: 1px solid var(--border-soft); }
.dir-a__metrics .metric__value { font-size: 27px; }
.dir-a__map {
  position: absolute; right: 28px; bottom: 28px; z-index: 10;
  width: 250px; height: 230px;
}

.dir-a__dock {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; gap: 12px;
  padding: 12px;
}
.dir-a__dock .pitch { width: 178px; }

/* ════════ DIRECTION B — Пульт (console) ═════════════════════════════════ */
.dir-b { display: grid; grid-template-columns: 336px 1fr 336px; height: 100%; }
.dir-b__rail {
  background: linear-gradient(180deg, rgba(13, 18, 25, 0.6), rgba(8, 11, 15, 0.3));
  padding: 22px;
  display: flex; flex-direction: column; gap: 20px;
  overflow-y: auto;
  z-index: 10;
}
.dir-b__rail--left { border-right: 1px solid var(--border-soft); }
.dir-b__rail--right { border-left: 1px solid var(--border-soft); }

/* studio-styled scrollbars for the scrollable side panels */
.dir-b__rail,
.dir-c__card,
.builddrawer {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.dir-b__rail::-webkit-scrollbar,
.dir-c__card::-webkit-scrollbar,
.builddrawer::-webkit-scrollbar { width: 8px; }
.dir-b__rail::-webkit-scrollbar-track,
.dir-c__card::-webkit-scrollbar-track,
.builddrawer::-webkit-scrollbar-track { background: transparent; }
.dir-b__rail::-webkit-scrollbar-thumb,
.dir-c__card::-webkit-scrollbar-thumb,
.builddrawer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.dir-b__rail::-webkit-scrollbar-thumb:hover,
.dir-c__card::-webkit-scrollbar-thumb:hover,
.builddrawer::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
  background-clip: padding-box;
}
.dir-b__stage { position: relative; }
.dir-b__stage .viewport-slot { position: absolute; inset: 0; }
.rail-foot {
  margin-top: auto;
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-top: 18px; border-top: 1px solid var(--border-soft);
}
.rail-map {
  margin-top: auto;
  position: relative;
  min-height: 240px;
  flex: 1;
}
.rail-map .mapframe { position: absolute; inset: 0; }
.rail-map .minimap-slot { position: absolute; top: 40px; left: 12px; right: 12px; bottom: 12px; }
.rail-hero {
  display: flex; flex-direction: column; gap: 12px;
  padding-bottom: 20px; border-bottom: 1px solid var(--border-soft);
}
.readout { display: flex; flex-direction: column; }
.readout__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft);
}
.readout__row .metric__value { font-size: 19px; }
.readout__row [data-spec-material] { white-space: nowrap; font-size: 14px; }
.rail-section-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: -4px;
}
.dir-b__pitches { display: flex; flex-direction: column; gap: 9px; }
.rail-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(47, 212, 192, 0.22);
  border-radius: 10px;
  background: rgba(4, 13, 17, 0.54);
  color: var(--text-secondary);
  font: 600 10px/1.2 var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.rail-toggle:hover { border-color: rgba(47, 212, 192, 0.46); color: var(--text-primary); }
.rail-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}
.hammock-options {
  display: grid;
  gap: 2px;
  padding: 12px 0 4px;
  border-bottom: 1px solid var(--border-soft);
}
.hammock-options .rail-toggle { border-color: transparent; background: transparent; padding: 5px 0; }
.hammock-options .slider--hammock { padding: 7px 0 9px; border: 0; }

/* door control — segmented toggle, shown only for presets with doors */
.doorctl { display: flex; flex-direction: column; gap: 9px; }
.doorctl[hidden] { display: none; }
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
}
.seg__btn {
  padding: 9px 10px;
  border: none; background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12.5px; font-weight: 500;
  border-radius: 8px; cursor: pointer;
  transition: 0.16s;
}
.seg__btn:hover { color: var(--text-primary); }
.seg__btn[data-active] {
  background: var(--amber);
  color: #1a1206; font-weight: 600;
}
.doorctl__note {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.04em;
  color: var(--text-muted);
}


/* ════════ DIRECTION C — Карточка (product card) ═════════════════════════ */
.dir-c { display: grid; grid-template-columns: 1fr 400px; height: 100%; }
.dir-c__stage { position: relative; }
.dir-c__stage .viewport-slot { position: absolute; inset: 0; }
.dir-c__card {
  border-left: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(15, 21, 29, 0.72), rgba(9, 12, 17, 0.5));
  padding: 26px;
  display: flex; flex-direction: column; gap: 22px;
  overflow-y: auto; z-index: 10;
}
.dir-c__hero { display: flex; flex-direction: column; gap: 13px; }
.dir-c__metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: 14px; overflow: hidden;
}
.dir-c__metrics .metric {
  padding: 16px 16px; background: rgba(17, 24, 39, 0.5);
}
.dir-c__metrics .metric__value { font-size: 24px; }
.dir-c__pitches { display: flex; flex-direction: column; gap: 9px; }
.dir-c__map {
  position: absolute; left: 26px; bottom: 26px; z-index: 10;
  width: 240px; height: 220px;
}

.dir-c__actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
}

/* ── build / edit drawer ─────────────────────────────────────────────────*/
.builddrawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 400px;
  transform: translateX(110%);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 30;
  border-left: 1px solid var(--glass-line);
  background: rgba(10, 14, 19, 0.97);
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  padding: 24px;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
  box-shadow: -28px 0 60px -22px rgba(0, 0, 0, 0.85);
}
.builddrawer[data-open] { transform: translateX(0); }
.builddrawer__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.builddrawer__title { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.pointeditor {
  display: grid;
  gap: 9px;
  margin: 2px 0 14px;
  padding: 12px;
  border: 1px solid rgba(47, 212, 192, 0.22);
  border-radius: 13px;
  background: rgba(4, 13, 17, 0.72);
}
.pointeditor__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pointeditor__head .overline { color: var(--teal); }
.pointeditor__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pointeditor__expand {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(47, 212, 192, 0.3);
  border-radius: 5px;
  background: rgba(47, 212, 192, 0.06);
  color: var(--teal);
  font: 600 15px/1 var(--font-mono);
  cursor: pointer;
}
.pointeditor__expand:hover { border-color: var(--teal); background: rgba(47, 212, 192, 0.12); }
.pointeditor__symmetry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--text-secondary);
  font: 600 10px/1.2 var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.pointeditor__symmetry input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--amber);
  cursor: pointer;
}
.pointeditor__resetall,
.pointeditor__reset {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: 600 9px/1.2 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.pointeditor__resetall:hover,
.pointeditor__reset:hover { color: var(--amber); }
.pointeditor__resetall:disabled,
.pointeditor__reset:disabled { opacity: 0.35; cursor: default; }
.pointeditor__canvas {
  display: block;
  width: 100%;
  height: 230px;
  border: 1px solid rgba(120, 150, 170, 0.14);
  border-radius: 10px;
  background: rgba(0, 5, 8, 0.72);
  cursor: crosshair;
  touch-action: none;
}
.pointeditor__hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.pointeditor__manual {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}
.pointeditor__manual[hidden] { display: none; }
.pointeditor__manual > strong {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pointeditor__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.pointeditor__fields label {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 7px 7px 17px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #111821;
  color: var(--teal);
  font: 600 10px/1 var(--font-mono);
}
.pointeditor__fields input {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: 500 11px/1 var(--font-mono);
  text-align: right;
  appearance: textfield;
}
.pointeditor__fields input::-webkit-inner-spin-button { appearance: none; }
.pointeditor__fields em {
  position: absolute;
  right: 7px;
  bottom: 5px;
  color: var(--text-muted);
  font: normal 8px/1 var(--font-mono);
}
.pointeditor__segments {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}
.pointeditor__segments[hidden] { display: none; }
.pointeditor__segments-title {
  color: var(--text-muted);
  font: 600 8.5px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pointeditor__segment-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.pointeditor__segment-fields label {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 7px 7px 17px;
  border: 1px solid rgba(246, 167, 59, 0.24);
  border-radius: 8px;
  background: rgba(246, 167, 59, 0.045);
  color: var(--amber);
  font: 600 9px/1 var(--font-mono);
}
.pointeditor__segment-fields span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pointeditor__segment-fields input {
  min-width: 0;
  width: 68px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: 500 11px/1 var(--font-mono);
  text-align: right;
  appearance: textfield;
}
.pointeditor__segment-fields input::-webkit-inner-spin-button { appearance: none; }
.pointeditor__segment-fields em {
  position: absolute;
  right: 7px;
  bottom: 5px;
  color: var(--text-muted);
  font: normal 8px/1 var(--font-mono);
}
.pointeditor__dimension {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid rgba(246, 167, 59, 0.3);
  border-radius: 9px;
  background: rgba(246, 167, 59, 0.055);
}
.pointeditor__dimension[hidden] { display: none; }
.pointeditor__dimension-title {
  color: var(--amber);
  font: 600 8.5px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pointeditor__dimension label {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 9px;
  padding-bottom: 13px;
}
.pointeditor__dimension label > span {
  overflow: hidden;
  color: var(--text-secondary);
  font: 600 11px/1.2 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pointeditor__dimension input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: 600 13px/1 var(--font-mono);
  text-align: right;
  appearance: textfield;
}
.pointeditor__dimension input::-webkit-inner-spin-button { appearance: none; }
.pointeditor__dimension em {
  position: absolute;
  right: 0;
  bottom: 0;
  color: var(--text-muted);
  font: normal 8px/1 var(--font-mono);
}
.pointeditor__reset { justify-self: end; }

.patternmodal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 28px;
  visibility: visible;
  opacity: 1;
  transition: opacity 160ms ease, visibility 0s;
}
.patternmodal[aria-hidden="true"] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}
.patternmodal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 5, 8, 0.78);
  backdrop-filter: blur(8px);
  cursor: default;
}
.patternmodal__dialog {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1060px, 100%);
  height: min(860px, calc(100vh - 28px));
  overflow: hidden;
  border: 1px solid rgba(47, 212, 192, 0.34);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 24, 32, 0.99), rgba(7, 12, 17, 0.99));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
}
.patternmodal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.patternmodal__head h2 { margin: 0; font-size: 22px; line-height: 1.1; }
.patternmodal__content {
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
  padding: 18px 22px 22px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(47, 212, 192, 0.48) rgba(5, 13, 18, 0.72);
}
.patternmodal__content::-webkit-scrollbar { width: 8px; }
.patternmodal__content::-webkit-scrollbar-track { background: rgba(5, 13, 18, 0.72); }
.patternmodal__content::-webkit-scrollbar-thumb {
  border: 2px solid rgba(5, 13, 18, 0.72);
  border-radius: 8px;
  background: rgba(47, 212, 192, 0.48);
}
.patternmodal__content .pointeditor {
  min-height: 0;
  height: auto;
  box-sizing: border-box;
  margin: 0;
  grid-template-rows: none;
}
.patternmodal__content .pointeditor__canvas {
  min-height: 0;
  height: clamp(240px, calc(100vh - 500px), 400px);
}
.patternmodal__content .pointeditor__expand { display: none; }
body[data-pattern-open] { overflow: hidden; }
.slider { display: flex; flex-direction: column; gap: 9px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.slider__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.slider__label { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.slider__val {
  font-family: var(--font-mono); font-size: 12.5px; flex: none;
  color: var(--amber); font-variant-numeric: tabular-nums;
}
.slider__range { position: relative; display: block; }
.slider__touch { display: none; }          /* на десктопе тянем нативный ползунок */
.mobile-edit-close { display: none; }      /* только в полноэкранном редакторе */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px; border-radius: 3px;
  background: var(--border); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px;
  border-radius: 50%; background: var(--amber);
  border: 2px solid #1a1206; cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--amber); border: 2px solid #1a1206; cursor: grab;
}
.build-note {
  margin-top: 12px; padding: 12px;
  border: 1px solid var(--border-soft); border-radius: 11px;
  font-size: 11.5px; line-height: 1.55; color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
}
.material-picker {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.material-picker__label { font-size: 12.5px; color: var(--text-secondary); }
.material-picker__select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: #111821;
  color: var(--text-primary);
  font: 500 12px/1.3 var(--font-display);
}
.material-picker__hint { color: var(--text-muted); font-size: 10.5px; line-height: 1.45; }
.build-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(246, 167, 59, 0.28);
  border-radius: 10px;
  background: rgba(246, 167, 59, 0.06);
  color: var(--amber);
  font: 600 12px/1 var(--font-display);
  cursor: pointer;
}
.build-reset:hover { border-color: rgba(246, 167, 59, 0.55); background: rgba(246, 167, 59, 0.1); }
.build-reset svg { width: 15px; height: 15px; }

/* hint pill bottom-center */
.orbit-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-muted);
  z-index: 5; pointer-events: none; opacity: 0.7;
  display: flex; align-items: center; gap: 8px;
}
.dir-a .orbit-hint, .dir-b .dir-b__stage .orbit-hint { display: flex; }

/* Оверлей-кнопка дверей поверх 3D-сцены */
.doorbtn {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 11px;
  background: var(--glass); border: 1px solid var(--glass-line);
  color: var(--text-primary); font: 600 12px/1 var(--font-display);
  cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-glass);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.doorbtn:hover { border-color: var(--teal); }
.doorbtn[data-active] { border-color: var(--teal-deep); color: var(--teal); }
.doorbtn[hidden] { display: none; }
.doorbtn .doorbtn__icon { display: inline-flex; }
.doorbtn svg { width: 17px; height: 17px; }

/* Кнопка автоповорота — иконка-оверлей слева сверху */
.stagebtn {
  position: absolute; top: 14px; left: 14px; z-index: 6;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--glass); border: 1px solid var(--glass-line);
  color: var(--text-secondary); cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-glass);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.stagebtn:hover { color: var(--text-primary); border-color: var(--teal); }
.stagebtn[data-active] { color: var(--teal); border-color: var(--teal-deep); }
.stagebtn svg { width: 18px; height: 18px; }
.stagebtn--measure { left: 60px; }
.measurehud {
  position: absolute;
  top: 62px;
  left: 14px;
  z-index: 8;
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 11px;
  background: rgba(7, 10, 14, 0.86);
  color: var(--text-secondary);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(12px);
}
.measurehud[hidden] { display: none; }
.measurehud__title { color: var(--text-muted); font: 600 9px/1.2 var(--font-mono); letter-spacing: 0.15em; text-transform: uppercase; }
.measurehud strong { color: var(--amber); font: 600 15px/1.3 var(--font-mono); }
.measurehud [data-measure-hint] { max-width: 260px; font-size: 10.5px; line-height: 1.4; }
.mobile-viewtoggle,
.mobile-plan { display: none; }
.stage-pitchbar { display: none; }

@media (max-width: 1180px) {
  .sharebtn span { display: none; }
  .sharebtn { width: 38px; padding: 0; justify-content: center; }
  .dir-c { grid-template-columns: 1fr 340px; }
  .dir-b { grid-template-columns: 296px 1fr 296px; }
}

@media (max-width: 760px) {
  .appbar {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 60px;
    padding: 8px 10px;
    gap: 8px;
  }
  .appbar > * { min-width: 0; max-width: 100%; }
  .brand {
    justify-content: center;
  }
  .appbar__right {
    grid-column: 1;
    grid-row: 2;
    justify-content: center;
    width: 100%;
  }
  .appbar > .sharebtn {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
  }
  .brand__mark { width: 28px; height: 28px; border-radius: 7px; }
  .brand__name { font-size: 13px; letter-spacing: 0.12em; }
  .brand__sub { display: none; }
  .dirswitch {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .dirswitch::-webkit-scrollbar { display: none; }
  .dirswitch__btn {
    flex: 1;
    justify-content: center;
    min-width: 0;
    padding: 7px 8px;
    font-size: 12px;
  }
  .appbar__right { gap: 6px; }
  .langswitch,
  .unitswitch { padding: 2px; }
  .langswitch__btn,
  .unitswitch__btn { min-width: 26px; padding: 6px 3px; }
  .modeswitch__btn {
    padding: 7px 9px;
    font-size: 12px;
  }
  .modeswitch__btn svg { width: 14px; height: 14px; }
  .iconbtn { width: 34px; height: 34px; border-radius: 9px; }
  .sharebtn { width: 34px; height: 34px; border-radius: 9px; }

  .carousel {
    height: 92px;
    padding: 0 8px;
    gap: 6px;
  }
  .carousel__nav { display: none; }
  .carousel__track {
    gap: 8px;
    padding: 12px 2px;
    -webkit-mask-image: linear-gradient(90deg, #000, #000 calc(100% - 18px), transparent);
    mask-image: linear-gradient(90deg, #000, #000 calc(100% - 18px), transparent);
  }
  .carousel__track > :first-child { margin-left: 0; }
  .carousel__track > :last-child { margin-right: 0; }
  .pcard {
    width: min(270px, 78vw);
    padding: 9px 10px;
    gap: 9px;
    border-radius: 10px;
  }
  .pcard__art { width: 48px; height: 34px; }
  .pcard__art svg { width: 48px; height: 34px; }
  .pcard__name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stageroot,
  .dir-mount { overflow: hidden; }
  .mobile-viewtoggle {
    position: absolute;
    top: 10px;
    left: 50%;
    z-index: 46;
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--glass-line);
    border-radius: 10px;
    background: rgba(7, 10, 14, 0.82);
    transform: translateX(-50%);
    backdrop-filter: blur(10px);
  }
  .mobile-viewtoggle button {
    min-width: 54px;
    padding: 7px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font: 600 11px/1 var(--font-display);
  }
  .mobile-viewtoggle button[data-active] { background: var(--amber); color: #1a1206; }
  .mobile-plan {
    position: absolute;
    inset: 0;
    z-index: 44;
    place-items: center;
    padding: 64px 16px 24px;
    background: #080c11;
  }
  .studio[data-mobile-plan] .mobile-plan { display: grid; }
  .studio[data-mobile-plan] .dir-mount { visibility: hidden; }
  .mobile-plan canvas { width: 100% !important; height: 100% !important; display: block; }
  .mobile-plan__label {
    position: absolute;
    top: 52px;
    left: 16px;
    color: var(--teal);
    font: 600 10px/1 var(--font-mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .dir-b {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 45vh) auto auto;
    height: 100%;
    overflow-y: auto;
  }
  .dir-b__stage {
    grid-column: 1;
    grid-row: 1;
    min-height: 280px;
  }
  .dir-b__rail {
    grid-column: 1;
    padding: 16px;
    gap: 16px;
    overflow: visible;
  }
  .dir-b__rail--left {
    grid-row: 2;
    border-right: 0;
    border-top: 1px solid var(--border-soft);
  }
  .dir-b__rail--right {
    grid-row: 3;
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    padding-bottom: 44px;
    padding-bottom: calc(16px + max(28px, env(safe-area-inset-bottom)));
  }
  .rail-map {
    flex: none;
    min-height: 220px;
    margin-top: 0;
    margin-bottom: 28px;
    margin-bottom: max(28px, env(safe-area-inset-bottom));
  }
  .pitch {
    padding: 12px 13px;
    border-radius: 11px;
  }
  .pitch__name { font-size: 14px; }
  .readout__row .metric__value { font-size: 17px; }

  .dir-c {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 46vh) auto;
    height: 100%;
    overflow-y: auto;
  }
  .dir-c__stage {
    grid-row: 1;
    min-height: 300px;
  }
  .dir-c__card {
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    padding: 18px;
    overflow: visible;
  }
  .dir-c__map {
    left: 14px;
    bottom: 42px;
    bottom: calc(14px + max(28px, env(safe-area-inset-bottom)));
    width: 190px;
    height: 168px;
  }

  .orbit-hint {
    left: 50%;
    bottom: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    max-width: 170px;
    gap: 5px;
    font-size: 8.5px;
    letter-spacing: 0.08em;
    line-height: 1.2;
    opacity: 0.52;
    white-space: nowrap;
  }
  .orbit-hint svg {
    width: 13px;
    height: 13px;
  }
  .stage-pitchbar {
    position: absolute;
    left: 10px;
    bottom: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 7;
    display: flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--glass-line);
    border-radius: 12px;
    background: rgba(7, 10, 14, 0.68);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-glass);
  }
  .stage-pitchbar__btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
  }
  .stage-pitchbar__btn[data-active] {
    color: #1a1206;
    background: var(--amber);
    border-color: rgba(246, 167, 59, 0.7);
  }
  .stage-pitchbar__btn svg {
    width: 17px;
    height: 17px;
  }

  .dir-a { min-height: 100%; }
  .dir-a__overline { top: 16px; width: calc(100% - 24px); }
  .dir-a__metrics {
    left: 12px;
    right: 12px;
    bottom: 12px;
    min-width: 0;
    padding: 12px 14px;
  }
  .dir-a__metrics .metric { padding: 7px 0; }
  .dir-a__metrics .metric__value { font-size: 22px; }
  .dir-a__dock {
    left: 12px;
    right: 12px;
    bottom: 170px;
    transform: none;
    overflow-x: auto;
  }
  .dir-a__dock .pitch {
    flex: 0 0 150px;
    width: 150px;
  }
  .dir-a__map { display: none; }

  .builddrawer {
    position: fixed;
    width: 100vw;
    padding: 18px;
    z-index: 70;
  }
  .site-footer {
    flex-basis: 42px;
    min-height: 42px;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 0 10px;
  }
  .site-footer__creator { height: 34px; }
  .site-footer__creator img { height: 31px; }
  .site-footer__copy {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8.5px;
    letter-spacing: 0.04em;
    text-align: center;
    white-space: normal;
  }
  .site-footer__meta { display: none; }
  .aboutmodal { align-items: end; padding: 10px; }
  .aboutmodal__dialog { max-height: calc(100vh - 20px); border-radius: 14px; }
  .aboutmodal__head { padding: 18px 18px 14px; }
  .aboutmodal__body { padding: 18px; font-size: 13px; }
  .patternmodal { padding: 10px; }
  .patternmodal__dialog { width: 100%; height: calc(100vh - 20px); border-radius: 14px; }
  .patternmodal__head { padding: 17px 18px 14px; }
  .patternmodal__head h2 { font-size: 18px; }
  .patternmodal__content { padding: 12px; }
  .patternmodal__content .pointeditor { padding: 10px; }
  .patternmodal__content .pointeditor__canvas {
    min-height: 0;
    height: clamp(220px, 35vh, 320px);
  }

  /* Полноэкранный редактор: на телефоне «Сборка» занимает весь экран, поэтому
     шторка становится страницей, а в шапке остаётся только выход из неё. */
  .studio[data-mobile-edit] #carouselmount,
  .studio[data-mobile-edit] .dirswitch,
  .studio[data-mobile-edit] .mobile-viewtoggle { display: none; }
  .studio[data-mobile-edit] .mobile-edit-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: none;
    border: 1px solid var(--glass-line);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-primary);
  }
  .studio[data-mobile-edit] .mobile-edit-close svg { width: 18px; height: 18px; }
  .studio[data-mobile-edit] .builddrawer {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }
  .studio[data-mobile-edit] .build-note { display: none; }
  .studio[data-mobile-edit] .slider { gap: 2px; padding: 8px 0 5px; }
  .studio[data-mobile-edit] .slider__top { align-items: center; gap: 10px; }
  .studio[data-mobile-edit] .slider__label { white-space: normal; font-size: 12px; line-height: 1.25; }
  /* Трек инертен, ползунок под палец: прозрачный слой сверху решает, что это —
     вертикальная прокрутка листа или горизонтальное перетаскивание. */
  .studio[data-mobile-edit] input[type="range"] {
    height: 44px;
    margin: 0;
    background: linear-gradient(var(--border), var(--border)) center / 100% 3px no-repeat;
    pointer-events: none;
  }
  .studio[data-mobile-edit] .slider__touch {
    position: absolute;
    inset: 0;
    display: block;
    touch-action: pan-y;
  }
  .studio[data-mobile-edit] input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
  .studio[data-mobile-edit] input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; }
}

@media (max-width: 420px) {
  .appbar__right { gap: 4px; }
  .modeswitch__btn { padding-inline: 5px; font-size: 11px; }
}
