/* 3D Studio (/3d-editor and its task pages). It wears Video Studio's frame
   and panels (video-studio.css): menus and Export along the top, then the
   mode and tools, then the library, the 3D view and the settings in a row,
   with the dock (timeline, UV editor) under the view when it is open. On a
   phone the library and the settings become sheets opened from tabs. */

/* ---- Start screen ---- */
.d3-new .st-new-row + .st-new-row { margin-top: 12px; }
.d3-new .st-new-row > .st-field { flex: 0 0 auto; }

/* ---- The frame ---- */
.d3-work { grid-template-rows: auto auto minmax(0, 1fr); }
.d3-body { grid-template-columns: 272px minmax(0, 1fr) 300px; }
.d3-main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.d3-work.has-dock .d3-main { grid-template-rows: minmax(140px, 1fr) minmax(190px, var(--dock-h, 38%)); }
.d3-menu { max-height: 72vh; overflow-y: auto; scrollbar-width: thin; }
.d3-menu-head { margin: 6px 10px 2px; color: var(--accent-strong); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- The tool bar ---- */
.d3-bar { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.d3-mode { width: auto; min-width: 150px; flex: none; }
.d3-tools { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.d3-tools::-webkit-scrollbar { display: none; }
.d3-tools .vs-ib { flex: none; }
.d3-tools-gap { flex: none; width: 1px; height: 22px; margin: 0 6px; background: var(--border); }
.d3-tools .vs-field { margin: 0; }
.d3-tools .seg { flex: none; }
.d3-view-btns { display: flex; align-items: center; gap: 3px; flex: none; margin-left: auto; }
.d3-ortho { min-width: 62px; }
.d3-shading .seg-btn { display: grid; place-items: center; width: 32px; padding: 4px 0; }

/* ---- The view ---- */
.d3-view { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #2b2b31; }
.d3-canvas { display: block; touch-action: none; outline: none; cursor: default; }
.d3-app[data-mode="sculpt"] .d3-canvas, .d3-app[data-mode="paint"] .d3-canvas, .d3-app[data-mode="weight"] .d3-canvas { cursor: crosshair; }
.d3-band { position: absolute; z-index: 3; border: 1px dashed rgba(255, 255, 255, 0.85); background: rgba(139, 92, 246, 0.12); pointer-events: none; }
.d3-axes { position: absolute; right: 10px; top: 10px; z-index: 2; width: 60px; height: 60px; border-radius: 50%; background: rgba(20, 17, 31, 0.35); }
.d3-axis { position: absolute; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; color: #14111f; border: 0; border-radius: 50%; font: 700 10px/1 var(--mono); cursor: pointer; }
.d3-axis:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.d3-msg { position: absolute; left: 10px; right: 84px; bottom: 8px; z-index: 2; margin: 0; pointer-events: none; }
.d3-msg:not(:empty) { justify-self: start; width: fit-content; max-width: calc(100% - 94px); padding: 6px 10px; color: var(--text); background: rgba(20, 17, 31, 0.82); border: 1px solid var(--border); border-radius: 0; }
.d3-msg[data-kind="warn"] { border-color: #e8b44f; }
.d3-msg[data-kind="ok"] { border-color: #2ec4b6; }

/* ---- The dock under the view ---- */
.d3-dock { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--surface); border-top: 1px solid var(--border); }
.d3-dock-tabs { display: flex; gap: 2px; padding: 3px 6px; }
.d3-dock-tab { padding: 3px 10px; color: var(--muted); background: none; border: 0; border-radius: 0; font: inherit; font-size: 0.74rem; cursor: pointer; }
.d3-dock-tab.is-active { color: var(--tint-text); background: var(--tint); }
.d3-dock-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.d3-dock-body { position: relative; min-height: 0; }
.d3-work:not(.has-dock) .d3-dock-body { display: none; }
.d3-dock-pane { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.d3-dock-pane[hidden] { display: none; }

/* ---- Library ---- */
.d3-lib-body { padding: 10px; overflow-y: auto; scrollbar-width: thin; }
.d3-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.d3-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; font: inherit; font-size: 0.68rem; cursor: pointer; transition: border-color 140ms ease, color 140ms ease; }
.d3-tile:hover { color: var(--text); border-color: var(--accent); }
.d3-tile:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.d3-tiles .d3-tile[data-add] { -webkit-touch-callout: none; user-select: none; }
.d3-tile-ghost { position: fixed; left: 0; top: 0; z-index: 1000; width: 72px; color: var(--text); border-color: var(--accent); opacity: 0.85; pointer-events: none; }
.d3-tile-icon { display: grid; place-items: center; color: var(--text); }

.d3-tree { margin: 0 0 8px; padding: 0; list-style: none; }
.d3-tree-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px calc(6px + var(--depth, 0) * 14px); color: var(--muted); border-radius: 0; font-size: 0.78rem; cursor: pointer; }
.d3-tree-row:hover { background: rgba(255, 255, 255, 0.04); }
.d3-tree-row.is-sel { color: var(--text); background: var(--tint); }
.d3-tree-row.is-active { box-shadow: inset 2px 0 0 #ffd060; }
.d3-tree-row.is-hidden .d3-tree-name { opacity: 0.5; }
.d3-tree-row.is-drop { box-shadow: inset 0 0 0 1px var(--accent); }
.d3-tree-row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.d3-tree-row.is-lifted { color: var(--text); background: var(--accent); opacity: 0.85; }
.d3-tree-foot.is-drop { box-shadow: inset 0 0 0 1px var(--accent); }
.d3-tree-row:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.d3-tree-icon { display: grid; place-items: center; flex: none; color: var(--accent-strong); }
.d3-tree-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d3-eye { display: grid; place-items: center; flex: none; width: 24px; height: 22px; padding: 0; color: var(--muted); background: none; border: 0; border-radius: 0; cursor: pointer; }
.d3-eye:hover { color: var(--text); }
.d3-rename { flex: 1 1 auto; min-width: 0; padding: 1px 5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--accent); border-radius: 0; font: inherit; }
.d3-tree-foot { min-height: 40px; }

.d3-swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.d3-swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; color: var(--muted); background: none; border: 1px solid transparent; border-radius: 0; font: inherit; font-size: 0.68rem; cursor: pointer; }
.d3-swatch:hover { border-color: var(--border); }
.d3-swatch.is-on { color: var(--text); border-color: var(--accent); }
.d3-swatch:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.d3-ball { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; box-shadow: 3px 3px 0 var(--edge); }
.d3-ball-new { color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border); box-shadow: none; }
.d3-swatch-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d3-makers { grid-template-columns: 1fr; }

/* ---- Settings ---- */
.d3-vec { align-items: center; }
.d3-v3s { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; flex: 1 1 auto; min-width: 0; }
.d3-v3-wrap { position: relative; display: block; min-width: 0; }
.d3-v3-ax { position: absolute; left: 6px; top: 50%; font: 700 0.6rem/1 var(--mono); transform: translateY(-50%); pointer-events: none; }
.d3-ax-x .d3-v3-ax { color: #e0606a; }
.d3-ax-y .d3-v3-ax { color: #7cc46a; }
.d3-ax-z .d3-v3-ax { color: #6a9ae6; }
.d3-v3 { width: 100%; min-width: 0; padding-left: 18px; }
.d3-row-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.d3-map .d3-map-pick { flex: 1 1 auto; min-width: 0; }
.d3-counts { margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---- Phones ---- */
@media (max-width: 760px) {
  .d3-new .st-new-row > .st-field { flex: 1 1 100%; }
  .d3-new .seg { flex-wrap: wrap; }
  .d3-work { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .d3-body { grid-template-columns: minmax(0, 1fr); }
  .d3-main { height: 100%; }
  .d3-work.has-dock .d3-main { grid-template-rows: minmax(120px, 1fr) minmax(170px, 46%); }
  .d3-bar { gap: 4px; padding: 3px 6px; overflow-x: auto; scrollbar-width: none; }
  .d3-bar::-webkit-scrollbar { display: none; }
  .d3-mode { min-width: 0; max-width: 132px; }
  .d3-tools { flex: none; overflow: visible; }
  .d3-tools .vs-ib { width: 36px; height: 36px; }
  .d3-view-btns { margin-left: 6px; }
  #d3-snap, .d3-ortho { display: none; }
  .d3-msg { right: 76px; bottom: 6px; }
  .d3-axes { width: 54px; height: 54px; }
}
.d3-input { flex: 1 1 auto; min-width: 0; padding: 5px 9px; border-radius: 0; font-size: 0.8rem; }
