/* WD Help — 3D base builder */
.b3 {
  --b-bg: #0f1013;
  --b-card: #16171c;
  --b-card2: #1d1e24;
  --b-line: rgba(255, 255, 255, 0.08);
  --b-line2: rgba(255, 255, 255, 0.16);
  --b-text: #ececf1;
  --b-dim: #a5a5b0;
  --b-mute: #74747f;
  --b-o: #f0742e;
  --b-ok: #4ade80;
  --b-bad: #f87171;
  --b-warn: #fbbf24;
  --b-mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top" "left view right";
  height: calc(100vh - 84px);
  min-height: 620px;
  margin: 12px 0 28px;
  border: 1px solid var(--b-line2);
  border-radius: 16px;
  background: var(--b-bg);
  color: var(--b-text);
  overflow: hidden;
  font-size: 14px;
}
.b3 * { box-sizing: border-box; }
.b3 [hidden] { display: none !important; }
.b3.no-left { grid-template-columns: 0 minmax(0, 1fr) 300px; }
.b3.no-right { grid-template-columns: 300px minmax(0, 1fr) 0; }
.b3.no-left.no-right { grid-template-columns: 0 minmax(0, 1fr) 0; }
.b3.no-left .b3-left, .b3.no-right .b3-right { display: none; }
.b3.is-full { height: 100vh; margin: 0; border-radius: 0; border: 0; }
.b3 button { font: inherit; color: inherit; cursor: pointer; }
.b3 kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--b-line2); border-bottom-width: 2px; border-radius: 5px; color: var(--b-dim); font: 600 10px/16px var(--b-mono); background: rgba(255, 255, 255, 0.04); }

/* top bar */
.b3-top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--b-line); background: var(--b-card); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.b3-sp { flex: 1; }
.b3-sep { width: 1px; height: 26px; background: var(--b-line2); flex: none; }
.b3-name { display: flex; flex-direction: column; align-items: flex-start; min-width: 150px; max-width: 240px; padding: 5px 12px; border: 1px solid var(--b-line2); border-radius: 10px; background: var(--b-card2); text-align: left; flex: none; }
.b3-name small { color: var(--b-mute); font: 700 10px var(--b-mono); letter-spacing: 0.16em; text-transform: uppercase; }
.b3-name small em { color: var(--b-o); font-style: normal; }
.b3-name b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.b3-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--b-line2); border-radius: 10px; background: var(--b-card2); font-weight: 700; white-space: nowrap; flex: none; }
.b3-btn:hover { border-color: var(--b-o); }
.b3-btn--hot { background: var(--b-o); border-color: var(--b-o); color: #1a0b03 !important; }
.b3-btn--sm { height: 30px; padding: 0 10px; font-size: 13px; }
.b3-btn--bad { color: var(--b-bad) !important; }
.b3-ico { width: 36px; height: 36px; border: 1px solid var(--b-line2); border-radius: 10px; background: var(--b-card2); font-size: 17px; flex: none; }
.b3-ico:disabled { opacity: 0.35; cursor: default; }
.b3-ico--sm { width: 30px; height: 30px; font-size: 14px; }
.b3-stages { display: flex; gap: 4px; flex: none; }
.b3-stages button { min-width: 34px; height: 36px; border: 1px solid var(--b-line2); border-radius: 10px; background: var(--b-card2); font: 800 14px var(--b-mono); }
.b3-stages button[aria-pressed="true"] { border-color: var(--b-o); color: var(--b-o); box-shadow: inset 0 -3px 0 var(--b-o); }

/* left */
.b3-left { grid-area: left; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--b-line); background: var(--b-card); }
.b3-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--b-line); }
.b3-tabs button { padding: 10px; border: 0; background: none; color: var(--b-dim); font: 800 12px var(--b-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.b3-tabs button i { color: var(--b-mute); font-style: normal; }
.b3-tabs button[aria-pressed="true"] { color: var(--b-o); box-shadow: inset 0 -2px 0 var(--b-o); }
.b3-search { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--b-line); }
.b3-search input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border: 1px solid var(--b-line2); border-radius: 8px; background: var(--b-bg); color: var(--b-text); font: inherit; }
.b3-search input:focus { outline: none; border-color: var(--b-o); }
.b3-list { flex: 1; overflow-y: auto; padding: 4px 0 12px; overscroll-behavior: contain; }
.b3-list h4 { display: flex; justify-content: space-between; margin: 10px 12px 4px; color: var(--b-mute); font: 800 11px var(--b-mono); letter-spacing: 0.16em; text-transform: uppercase; cursor: pointer; user-select: none; }
.b3-list h4::before { content: "▾ "; }
.b3-list h4.is-closed::before { content: "▸ "; }
.b3-list h4 i { font-style: normal; }
.b3-row { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 34px 5px 10px; border-left: 3px solid transparent; cursor: pointer; }
.b3-row:hover { background: rgba(255, 255, 255, 0.04); }
.b3-row.is-on { border-left-color: var(--b-o); background: rgba(240, 116, 46, 0.12); }
.b3-row img { width: 44px; height: 44px; border-radius: 8px; background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.25)); object-fit: contain; }
.b3-row span { min-width: 0; }
.b3-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; }
.b3-row.is-on b { color: var(--b-o); }
.b3-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--b-mute); font: 600 11px var(--b-mono); }
.b3-row em { color: var(--b-text); font: 800 14px var(--b-mono); font-style: normal; }
.b3-pin { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; background: none; color: var(--b-mute); opacity: 0.35; font-size: 13px; }
.b3-row:hover .b3-pin, .b3-pin.is-on { opacity: 1; }
.b3-pin.is-on { color: var(--b-o); }
.b3-empty { margin: 14px 12px; color: var(--b-mute); font-size: 13px; line-height: 1.5; }

/* view */
.b3-view { grid-area: view; position: relative; min-width: 0; min-height: 0; overflow: hidden; outline: none; background: #9fb3c2; touch-action: none; }
.b3-canvas { display: block; width: 100% !important; height: 100% !important; }
.b3-view[data-tool="look"] .b3-canvas { cursor: grab; }
.b3-view[data-tool="select"] .b3-canvas { cursor: default; }
.b3-view[data-tool="build"] .b3-canvas, .b3-view[data-tool="multi"] .b3-canvas { cursor: crosshair; }
.b3-tb { position: absolute; display: flex; align-items: center; gap: 0; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; background: rgba(15, 16, 19, 0.82); backdrop-filter: blur(6px); overflow: hidden; }
.b3-tb > kbd { margin: 0 8px; }
.b3-tb button { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-right: 1px solid rgba(255, 255, 255, 0.08); background: none; color: var(--b-dim); font: 800 11px var(--b-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.b3-tb button:last-child { border-right: 0; }
.b3-tb button[aria-pressed="true"] { color: var(--b-o); background: rgba(240, 116, 46, 0.14); box-shadow: inset 0 -2px 0 var(--b-o); }
.b3-tb button kbd { padding: 0 4px; font-size: 9px; line-height: 14px; }
.b3-tb--tools { left: 10px; top: 10px; }
.b3-tb--snap { left: 10px; top: 54px; }
.b3-tb--view { right: 10px; top: 10px; }
.b3-tb--br { right: 10px; bottom: 10px; }
.b3-view[data-mode="foot"] .b3-tb--tools, .b3-view[data-mode="foot"] .b3-tb--snap { display: none; }
.b3-hint { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); max-width: calc(100% - 260px); margin: 0; padding: 7px 14px; border: 1px solid rgba(240, 116, 46, 0.5); border-radius: 8px; background: rgba(15, 16, 19, 0.82); color: var(--b-text); font: 700 12px var(--b-mono); letter-spacing: 0.06em; text-transform: uppercase; text-align: center; pointer-events: none; }
.b3-toast { position: absolute; left: 50%; top: 100px; transform: translateX(-50%); margin: 0; padding: 8px 16px; border-radius: 8px; background: var(--b-o); color: #1a0b03; font-weight: 800; pointer-events: none; z-index: 5; }
.b3-fps { position: absolute; left: 10px; bottom: 10px; margin: 0; padding: 4px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); font: 600 11px var(--b-mono); color: #9fe3a6; pointer-events: none; }
.b3-cross { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; pointer-events: none; }
.b3-cross::before, .b3-cross::after { content: ""; position: absolute; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 2px #000; }
.b3-cross::before { left: 6px; top: 0; width: 2px; height: 14px; }
.b3-cross::after { top: 6px; left: 0; width: 14px; height: 2px; }
.b3-scope { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 50%, transparent 0 34vmin, #000 34.4vmin); }
.b3-scope::before { content: ""; position: absolute; left: 50%; top: 50%; width: 68vmin; height: 2px; transform: translate(-50%, -50%); background: linear-gradient(90deg, #000 0 44%, transparent 44% 56%, #000 56%); }
.b3-scope::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 68vmin; transform: translate(-50%, -50%); background: linear-gradient(180deg, #000 0 44%, transparent 44% 49%, #f0742e 49% 51%, transparent 51% 56%, #000 56%); }
.b3-lock { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; gap: 6px; padding: 18px 26px; border: 1px solid var(--b-o); border-radius: 12px; background: rgba(15, 16, 19, 0.88); text-align: center; pointer-events: none; }
.b3-lock b { color: var(--b-o); font: 800 13px var(--b-mono); letter-spacing: 0.2em; text-transform: uppercase; }
.b3-lock span { color: var(--b-dim); font-size: 13px; }
.b3-rect { position: absolute; border: 1px solid var(--b-o); background: rgba(240, 116, 46, 0.12); pointer-events: none; }
.b3-wheel { position: absolute; inset: 0; z-index: 4; background: radial-gradient(circle, rgba(10, 10, 12, 0.6), rgba(10, 10, 12, 0.25) 60%); }
.b3-wheel p { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; color: var(--b-dim); font: 700 11px var(--b-mono); text-transform: uppercase; text-align: center; max-width: 140px; }
.b3-wheel button { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92px; padding: 6px; border: 1px solid var(--b-line2); border-radius: 12px; background: rgba(22, 23, 28, 0.94); font-size: 11px; font-weight: 700; text-align: center; }
.b3-wheel button.is-on { border-color: var(--b-o); background: #2a1a10; color: var(--b-o); }

/* right */
.b3-right { grid-area: right; overflow-y: auto; border-left: 1px solid var(--b-line); background: var(--b-card); }
.b3-box { padding: 12px 12px 14px; border-bottom: 1px solid var(--b-line); }
.b3-box h3 { margin: 0 0 10px; color: var(--b-mute); font: 800 11px var(--b-mono); letter-spacing: 0.16em; text-transform: uppercase; }
.b3-box h3 span { color: var(--b-o); }
.b3-sum table { width: 100%; border-collapse: collapse; font-size: 12px; }
.b3-sum th, .b3-sum td { padding: 4px 3px; border-bottom: 1px solid var(--b-line); text-align: right; font-family: var(--b-mono); }
.b3-sum thead th { color: var(--b-mute); font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: bottom; }
.b3-sum tbody th { text-align: left; color: var(--b-dim); font-weight: 600; font-family: inherit; }
.b3-sum td b { color: var(--b-o); font-size: 15px; }
.b3-ham { margin: 10px 0 0; color: var(--b-dim); font-size: 12px; }
.b3-ham b { color: var(--b-text); }
.b3-stock { margin: 8px 0 0; color: var(--b-dim); font-size: 12px; line-height: 1.4; }
.b3-stock:empty { display: none; }
.b3-warn { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.b3-warn li { padding: 6px 9px; border-radius: 8px; background: rgba(248, 113, 113, 0.12); color: var(--b-bad); font-size: 12px; font-weight: 700; }
.b3-warn li.is-soft { background: rgba(251, 191, 36, 0.12); color: var(--b-warn); }
.b3-warn li.is-ok { background: rgba(74, 222, 128, 0.1); color: var(--b-ok); }
.b3-bill { list-style: none; margin: 10px 0 0; padding: 0; }
.b3-bill li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 0; font-size: 12px; }
.b3-bill li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b3-bill li b { font-family: var(--b-mono); }
.b3-bill img { border-radius: 5px; }
.b3-bill__veh { grid-template-columns: minmax(0, 1fr) auto !important; color: var(--b-dim); border-top: 1px solid var(--b-line); margin-top: 4px; padding-top: 6px !important; }
.b3-selhead { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; }
.b3-selhead img { border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.b3-selhead b { display: block; font-size: 14px; text-transform: uppercase; }
.b3-selhead small { display: block; color: var(--b-mute); font: 600 11px/1.5 var(--b-mono); }
.b3-selhead em { color: var(--b-bad); font-style: normal; }
.b3-selbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.b3-field { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--b-dim); font-size: 12px; }
.b3-field select, .b3-field input { flex: 1; height: 32px; padding: 0 8px; border: 1px solid var(--b-line2); border-radius: 8px; background: var(--b-bg); color: var(--b-text); font: inherit; }
.b3-field--col { flex-direction: column; align-items: stretch; font-size: 13px; }

/* modal */
.b3-modal { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 5, 8, 0.6); }
.b3-modal__card { width: min(440px, 100%); max-height: 100%; overflow-y: auto; padding: 20px 22px; border: 1px solid var(--b-line2); border-radius: 14px; background: var(--b-card); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.b3-modal__card.is-wide { width: min(860px, 100%); }
.b3-modal__card.is-small { width: min(380px, 100%); }
.b3-modal__card.is-side { position: absolute; right: 0; top: 0; bottom: 0; width: min(380px, 100%); border-radius: 0; }
.b3-modal__card h2 { margin: 0 0 14px; font-size: 18px; text-transform: uppercase; letter-spacing: 0.04em; }
.b3-modal__card h3 { margin: 18px 0 8px; color: var(--b-o); font: 800 11px var(--b-mono); letter-spacing: 0.18em; text-transform: uppercase; }
.b3-modal__btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.b3-modal__btns--left { justify-content: flex-start; margin: 0 0 14px; }
.b3-tog { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--b-line); cursor: pointer; }
.b3-tog input { margin-top: 3px; accent-color: var(--b-o); width: 16px; height: 16px; }
.b3-tog b { display: block; font-size: 13px; }
.b3-tog small { display: block; margin-top: 2px; color: var(--b-mute); font-size: 12px; line-height: 1.4; }
.b3-lbl { margin: 12px 0 6px; color: var(--b-dim); font-size: 12px; font-weight: 700; }
.b3-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.b3-seg button { flex: 1; min-width: 52px; height: 32px; padding: 0 8px; border: 1px solid var(--b-line2); border-radius: 8px; background: var(--b-card2); color: var(--b-dim); font: 700 12px var(--b-mono); }
.b3-seg button[aria-pressed="true"] { border-color: var(--b-o); color: var(--b-o); background: rgba(240, 116, 46, 0.12); }
.b3-seg--wide button { height: 38px; font-size: 13px; }
.b3-rng { display: flex; align-items: center; gap: 10px; }
.b3-rng input { flex: 1; accent-color: var(--b-o); }
.b3-rng output { min-width: 48px; text-align: right; font: 700 12px var(--b-mono); }
.b3-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 20px; }
.b3-keys h3 { margin-top: 6px !important; }
.b3-keys dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; margin: 0; font-size: 12px; align-items: center; }
.b3-keys dt { text-align: right; }
.b3-keys dd { margin: 0; color: var(--b-dim); }
.b3-sitemap { margin-top: 12px; border-radius: 10px; overflow: hidden; border: 1px solid var(--b-line2); }
.b3-sitemap:empty { display: none; }
.b3-sitemap canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.b3-plans { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.b3-plans li { display: flex; gap: 6px; }
.b3-plans li > button:first-child { flex: 1; display: flex; flex-direction: column; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--b-line2); border-radius: 10px; background: var(--b-card2); text-align: left; }
.b3-plans small { color: var(--b-mute); font: 600 11px var(--b-mono); }

/* phones and narrow screens */
@media (max-width: 1100px) {
  .b3 { grid-template-columns: 260px minmax(0, 1fr) 0; }
  .b3 .b3-right { display: none; }
}
@media (max-width: 760px) {
  .b3, .b3.no-left, .b3.no-right { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .b3-view { height: 62vh; min-height: 380px; order: 2; }
  .b3-top { order: 1; }
  .b3-left { order: 3; max-height: 50vh; border-right: 0; border-top: 1px solid var(--b-line); }
  .b3 .b3-right { display: block; order: 4; border-left: 0; }
  .b3-tb button b { font-size: 10px; }
  .b3-tb button { padding: 0 9px; height: 32px; }
  .b3-tb button kbd, .b3-tb > kbd { display: none; }
  .b3-tb--view { top: auto; bottom: 10px; right: auto; left: 10px; }
  .b3-tb--br { bottom: 10px; }
  .b3-hint { display: none; }
}

/* controls card */
.b3-help { position: absolute; left: 10px; bottom: 10px; width: 300px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; background: rgba(15, 16, 19, 0.84); backdrop-filter: blur(6px); }
.b3-help__head { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 8px 12px; border: 0; background: none; color: var(--b-o); font: 800 11px var(--b-mono); letter-spacing: 0.16em; text-transform: uppercase; }
.b3-help dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 0; padding: 0 12px 10px; font-size: 11.5px; }
.b3-help dt { color: var(--b-text); font: 700 10.5px/1.5 var(--b-mono); white-space: nowrap; }
.b3-help dd { margin: 0; color: var(--b-dim); line-height: 1.5; }
.b3-help.is-closed dl { display: none; }
.b3-help.is-closed .b3-help__head span { transform: rotate(-90deg); }
.b3-view[data-mode="foot"] .b3-help { display: none; }
.b3-fps { left: auto; right: 10px; bottom: 54px; }
/* full width page block */
.b3-wide { padding: 0 12px; }
@media (max-width: 760px) { .b3-help { width: auto; right: 10px; bottom: 54px; } .b3-help.is-closed { right: auto; } }
.b3-view:has(.b3-help:not(.is-closed)) .b3-hint { left: calc(50% + 160px); max-width: calc(100% - 640px); }
