/* Slate 3D Scene Review & Full-Body Pose Editor (CSP style-src 'self' safe) */
* { box-sizing: border-box; }
html, body.s3d-body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: #111214; color: #e2e4e9; font: 13px/1.4 "Segoe UI", system-ui, -apple-system, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: #22252d; border: 1px solid #353944; border-radius: 5px; padding: 4px 9px; cursor: pointer; }
button:hover:not(:disabled) { background: #2d313c; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: #3b7be0; border-color: #4c9bff; color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #4a89eb; }
select, input[type="number"] { background: #101216; border: 1px solid #343843; color: #e8ecf4; border-radius: 5px; padding: 3px 6px; }
a { color: #8ab8ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

.s3d-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.s3d-loading { margin: auto; color: #9ea5b4; font-size: 14px; padding: 24px; }
.s3d-error { margin: auto; max-width: 460px; background: #26181a; border: 1px solid #6b2d35; color: #ffb3bc; border-radius: 8px; padding: 16px 20px; }

/* Header */
.s3d-top { display: flex; align-items: center; gap: 10px; padding: 6px 12px; min-height: 44px; background: #14161a; border-bottom: 1px solid #2a2d34; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.s3d-back { font-weight: 700; color: #e6ebf5; padding: 3px 8px; border-radius: 5px; background: #20232b; border: 1px solid #313540; white-space: nowrap; }
.s3d-back:hover { text-decoration: none; background: #2b2f3a; }
.s3d-crumb { font-weight: 600; white-space: nowrap; }
.s3d-sub { color: #949ba9; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.s3d-status { font-size: 11px; color: #90d8a8; padding: 2px 8px; border-radius: 10px; background: rgba(63,191,127,.14); white-space: nowrap; }
.s3d-top .grow { flex: 1; }

/* Main workspace grid */
.s3d-grid { flex: 1; display: grid; grid-template-columns: 1fr 364px; min-height: 0; overflow: hidden; }
.s3d-grid.nopanel { grid-template-columns: 1fr 0; }
.s3d-grid.nopanel .s3d-side { display: none; }

.s3d-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0e0f10; }
.s3d-viewport { position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; place-items: center; background: #101216; user-select: none; }
.s3d-stage { position: relative; background: #131519; border-radius: 4px; overflow: hidden; box-shadow: 0 10px 38px rgba(0,0,0,.6); }
.s3d-stage canvas.s3d-gl { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.s3d-stage canvas.s3d-gl:active { cursor: grabbing; }
.s3d-stage canvas.s3d-gl[data-cursor="move"] { cursor: move; }
.s3d-stage canvas.s3d-gl[data-cursor="pointer"] { cursor: pointer; }
.s3d-stage[data-mode="draw"] canvas.s3d-gl { cursor: default; }
.s3d-stage canvas.s3d-cmp-cv { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.s3d-stage canvas.rv-draw-cv { z-index: 4; }

/* Floating traditional 3D Gizmo Mini-Bar (Maya / Unreal / Blender style) */
.s3d-gizmobar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 7px; background: rgba(16, 18, 23, .9); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 6px 20px rgba(0, 0, 0, .55); backdrop-filter: blur(6px); white-space: nowrap; }
.s3d-gizmobar button { font-size: 11.5px; padding: 3px 7px; border-radius: 5px; background: #1e222b; border: 1px solid #303645; color: #c7cedc; display: inline-flex; align-items: center; gap: 4px; }
.s3d-gizmobar button:hover:not(:disabled) { background: #2a303d; color: #fff; }
.s3d-gizmobar button.on { background: #274472; border-color: #4c9bff; color: #fff; font-weight: 600; }
.s3d-gizmobar kbd { font: 10px/1 ui-monospace, Consolas, monospace; padding: 1px 4px; border-radius: 3px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.15); color: #9ea7ba; }
.s3d-gizmobar button.on kbd { color: #d6e7ff; border-color: rgba(255,255,255,.3); }
.s3d-gsep { width: 1px; height: 18px; background: rgba(255,255,255,.13); margin: 0 2px; }
.s3d-gtarget { font: 600 11.5px/1.2 ui-monospace, Consolas, monospace; color: #ffcb70; padding: 2px 6px; border-radius: 4px; background: rgba(255, 176, 32, .12); border: 1px solid rgba(255, 176, 32, .28); }
.s3d-drag-hud { position: absolute; top: 48px; left: 50%; transform: translateX(-50%); z-index: 9; font: 700 12px/1.2 ui-monospace, Consolas, monospace; padding: 4px 10px; border-radius: 5px; background: rgba(20, 22, 28, .92); border: 1px solid #ffea55; color: #fff299; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.55); }

/* Wipe handle in 3D compare */
.s3d-wipebar { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; left: 50%; cursor: ew-resize; z-index: 7; box-shadow: 0 0 8px rgba(0,0,0,.8); touch-action: none; }
.s3d-wipebar::after { content: "⟷"; position: absolute; top: 50%; left: -14px; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-size: 13px; font-weight: 700; box-shadow: 0 2px 10px rgba(0,0,0,.6); }
.s3d-vtag { position: absolute; top: 42px; z-index: 6; font-size: 12px; font-weight: 600; background: rgba(14,15,18,.84); color: #eef2f8; padding: 3px 9px; border-radius: 5px; border: 1px solid rgba(255,255,255,.15); pointer-events: none; }
.s3d-vtag-l { left: 12px; }
.s3d-vtag-r { right: 12px; }

/* Sidebar with Pose + Notes tabs */
.s3d-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #191b20; border-left: 1px solid #2a2d34; overflow: hidden; }
.s3d-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #2a2d34; background: #14161a; }
.s3d-tab { border: 0; border-radius: 0; background: transparent; color: #8f96a6; padding: 9px 10px; font-size: 12px; font-weight: 600; border-bottom: 2px solid transparent; }
.s3d-tab:hover { color: #e2e5ed; background: #1c1f26; }
.s3d-tab.on { color: #fff; border-bottom-color: #4c9bff; background: #191b20; }

.s3d-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.s3d-scroll { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 11px; min-height: 0; }

/* Pose Inspector sections */
.s3d-sec { background: #13151a; border: 1px solid #262933; border-radius: 8px; padding: 9px 10px; display: grid; gap: 8px; }
.s3d-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.s3d-sec-head h4 { margin: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: #9ea6b8; }
.s3d-delta { font: 11px ui-monospace, Consolas, monospace; color: #ffcb70; background: rgba(255,176,32,.14); padding: 1px 6px; border-radius: 4px; }

.s3d-pinlist { display: grid; gap: 5px; }
.s3d-pinrow { display: flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 6px; background: #1a1d24; border: 1px solid #2d313d; cursor: pointer; }
.s3d-pinrow.sel { border-color: #4c9bff; background: #1c283b; }
.s3d-pindot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.s3d-pindot.s0 { background: #38d6ff; }
.s3d-pindot.s1 { background: #ffaa44; }
.s3d-pindot.s2 { background: #d885ff; }
.s3d-pinrow .grow { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s3d-pinmeta { font: 11px ui-monospace, Consolas, monospace; color: #9da4b4; }

.s3d-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.s3d-row label.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #c4cad6; cursor: pointer; }
.s3d-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.s3d-jchip { font-size: 11px; padding: 3px 7px; border-radius: 5px; background: #1f222a; border: 1px solid #303542; color: #bfc6d4; }
.s3d-jchip:hover { color: #fff; border-color: #4b5266; }
.s3d-jchip.on { background: #263b5c; border-color: #4c9bff; color: #fff; font-weight: 600; }

.s3d-slider-row { display: grid; grid-template-columns: 56px 1fr 44px; align-items: center; gap: 6px; font-size: 11.5px; color: #b7becd; }
.s3d-slider-row input[type="range"] { width: 100%; accent-color: #ffaa44; }
.s3d-slider-row.ax-x input[type="range"] { accent-color: #ff6060; }
.s3d-slider-row.ax-y input[type="range"] { accent-color: #53d67a; }
.s3d-slider-row.ax-z input[type="range"] { accent-color: #5aa8ff; }
.s3d-slider-row output { font: 11px ui-monospace, Consolas, monospace; text-align: right; color: #dfe4ee; }

.s3d-bone-sel { width: 100%; font-size: 12px; }
.s3d-hint { font-size: 11px; color: #8c93a3; line-height: 1.4; }
.s3d-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.s3d-actions-grid button { font-size: 11.5px; padding: 4px 6px; }

/* Note thumbnails in 3D notes tab */
.s3d-nthumb { position: relative; width: 92px; height: 52px; border-radius: 4px; overflow: hidden; background: #0e1014; border: 1px solid #2e323d; flex: 0 0 auto; }
.s3d-nthumb canvas { display: block; width: 100%; height: 100%; }

@media (max-width: 960px) {
  .s3d-grid { grid-template-columns: 1fr; grid-template-rows: 1fr 46vh; }
  .s3d-grid.nopanel { grid-template-rows: 1fr 0; }
  .s3d-side { border-left: 0; border-top: 1px solid #2a2d34; }
}
