/* Shared 3D editor styles: fabrication rules first, component rules last so component styles win conflicts. */

/* Source: fabrication-3d.php */
* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
            overflow: hidden;
            background:
                radial-gradient(circle at top left, rgba(74, 152, 255, 0.12), transparent 36%),
                radial-gradient(circle at bottom right, rgba(210, 143, 76, 0.12), transparent 28%),
                linear-gradient(180deg, #0d1218 0%, #101820 100%);
            color: #e7f0f8;
            min-height: 100vh;
            min-height: 100svh;
        }

        body.component-3d-panel-mode-fixed-length-piece .component3d-panel--hide-in-piece-mode {
            display: none !important;
        }

        .component3d-panel--show-in-piece-mode {
            display: none;
        }

        .component3d-panel--show-in-embed {
            display: none;
        }

        body.component-3d-panel-mode-fixed-length-piece .component3d-panel--show-in-piece-mode {
            display: block;
        }

        body.component-3d-embed-mode .component3d-panel--show-in-embed {
            display: block;
        }

        body.component-3d-panel-mode-fixed-length-piece.component-3d-audience-public .component3d-panel--hide-in-public-piece-mode {
            display: none !important;
        }

        body.component-3d-embed-mode .component3d-panel--hide-in-embed {
            display: none !important;
        }

        body.component-3d-embed-mode.component-3d-audience-public .component3d-panel--hide-in-public-embed {
            display: none !important;
        }

        body.component-3d-panel-mode-fixed-length-piece .sidebar-header-3d {
            display: none !important;
        }

        body.component-3d-panel-mode-fixed-length-piece .sidebar-body {
            padding-top: 0;
        }

        body.component-3d-panel-mode-fixed-length-piece #app-shell:not(.component3d-shell--stacked) {
            display: flex;
            flex-direction: row;
            align-items: stretch;
            width: 100%;
        }

        body.component-3d-panel-mode-fixed-length-piece #app-shell:not(.component3d-shell--stacked) .sidebar-3d {
            flex: 0 0 auto;
            width: var(--sidebar-width, 50%);
            min-width: 320px;
            max-width: calc(100% - var(--desktop-min-viewport-width, 600px) - 10px);
        }

        body.component-3d-panel-mode-fixed-length-piece #app-shell:not(.component3d-shell--stacked) #sidebar-resizer {
            display: block !important;
            width: 10px;
            flex: 0 0 10px;
            border: 0;
        }

        body.component-3d-panel-mode-fixed-length-piece #app-shell:not(.component3d-shell--stacked) .viewport-shell {
            flex: 1 1 auto;
            width: auto;
            min-width: var(--desktop-min-viewport-width, 600px);
        }

        body.component-3d-panel-mode-fixed-length-piece .sidebar-3d,
        body.component-3d-panel-mode-fixed-length-piece .viewport-shell {
            min-width: 0;
        }

        body.component-3d-panel-mode-fixed-length-piece.component3d-shell--stacked #sidebar-resizer,
        body.component-3d-panel-mode-fixed-length-piece #app-shell.component3d-shell--stacked #sidebar-resizer {
            display: none !important;
            width: 0;
            border: 0;
        }

        .component3d-piece-actions-panel {
            margin-bottom: 14px;
        }

        .component3d-piece-actions {
            grid-template-columns: 1fr 1fr;
        }

        .component3d-piece-actions button {
            min-height: 40px;
        }

        body.component-3d-panel-mode-fixed-length-preview #app-shell {
            display: grid;
            grid-template-columns: 1fr;
            width: 100%;
            min-height: 100vh;
            min-height: 100svh;
            height: 100vh;
            height: 100svh;
        }

        body.component-3d-panel-mode-fixed-length-preview .sidebar-3d,
        body.component-3d-panel-mode-fixed-length-preview #sidebar-resizer,
        body.component-3d-panel-mode-fixed-length-preview #animation-toolbar,
        body.component-3d-panel-mode-fixed-length-preview .viewport-metrics,
        body.component-3d-panel-mode-fixed-length-preview .viewport-display-toggle,
        body.component-3d-panel-mode-fixed-length-preview .viewport-overlay {
            display: none !important;
        }

        body.component-3d-panel-mode-fixed-length-preview .viewport-shell,
        body.component-3d-panel-mode-fixed-length-preview #canvas-container {
            min-height: 100vh;
            min-height: 100svh;
            height: 100vh;
            height: 100svh;
        }

        #container {
            --sidebar-width: 400px;
            --desktop-min-viewport-width: 600px;
            --toolbar-height: 56px;
            --desktop-floating-controls-gap: 30px;
            --mobile-manual-entry-offset: 0px;
            --mobile-toolbar-height: 56px;
            --mobile-floating-controls-gap: 30px;
            --mobile-floating-controls-stagger: 10px;
            --mobile-sidebar-handle-width: 19px;
            --mobile-sidebar-handle-peek: 14px;
            --mobile-sidebar-handle-open-shift: 0px;
            --bg: #0f141b;
            --bg-elevated: #18212b;
            --bg-panel: rgba(20, 29, 39, 0.96);
            --bg-panel-alt: rgba(26, 38, 50, 0.92);
            --border: #324355;
            --border-soft: rgba(126, 154, 184, 0.22);
            --text: #e7f0f8;
            --text-soft: #a8bacb;
            --accent: #79b7ff;
            --accent-strong: #4a98ff;
            --accent-warm: #d28f4c;
            --danger: #ff7f7f;
            --success: #7fd5ab;
            --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
            --radius: 16px;
            display: flex;
            flex-direction: row;
            position: relative;
            width: 100%;
            min-height: 100vh;
            min-height: 100svh;
            height: 100vh;
            height: 100svh;
            overflow: hidden;
        }

        #canvas-container {
            flex: 1;
            min-width: 0;
            min-height: 0;
            height: 100%;
            position: relative;
            overflow: hidden;
        }

        #animation-toolbar {
            --toolbar-option-control-height: 32px;
            position: absolute;
            top: 18px;
            left: 18px;
            right: 18px;
            min-width: 200px;
            z-index: 130;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 10px;
            pointer-events: none;
        }

        .toolbar-tab-row {
            display: flex;
            align-items: center;
            gap: 10px;
            width: 100%;
            min-width: 0;
            padding: 10px;
            border-radius: 18px;
            border: 1px solid rgba(121, 183, 255, 0.16);
            background: rgba(14, 21, 29, 0.84);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
            backdrop-filter: blur(10px);
            pointer-events: auto;
        }

        .toolbar-tab-list {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1 1 auto;
            min-width: 0;
            overflow-x: auto;
            overflow-y: hidden;
            scrollbar-width: thin;
        }

        .toolbar-quick-actions {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            flex: 0 0 auto;
            margin-left: auto;
        }

        .toolbar-quick-actions .toolbar-btn {
            min-width: 72px;
        }

        .toolbar-tab-list::-webkit-scrollbar,
        .toolbar-panel::-webkit-scrollbar {
            height: 6px;
        }

        .toolbar-tab-list::-webkit-scrollbar-thumb,
        .toolbar-panel::-webkit-scrollbar-thumb {
            background: rgba(127, 158, 192, 0.65);
            border-radius: 999px;
        }

        .toolbar-tab {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
            min-height: 40px;
            padding: 10px 14px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            border-radius: 12px;
            background: rgba(35, 52, 68, 0.7);
            color: var(--text);
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.04em;
            white-space: nowrap;
            user-select: none;
            cursor: pointer;
            box-shadow: none;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
        }

        .toolbar-tab.section-gap-before {
            margin-left: 18px;
        }

        .toolbar-tab:hover {
            background: rgba(55, 77, 98, 0.82);
            color: var(--text);
            transform: translateY(-1px);
        }

        .toolbar-tab.active {
            background: linear-gradient(180deg, #e1a262, #c77e39);
            border-color: transparent;
            color: #1b0f04;
        }

        .toolbar-tab:focus-visible {
            outline: 1px solid rgba(128, 214, 255, 0.7);
            outline-offset: 2px;
        }

        .toolbar-panel-row {
            display: none;
            width: 100%;
            min-width: 0;
            align-items: center;
            gap: 10px;
            padding: 10px;
            border-radius: 18px;
            border: 1px solid rgba(121, 183, 255, 0.16);
            background: rgba(14, 21, 29, 0.84);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
            backdrop-filter: blur(10px);
            pointer-events: auto;
        }

        .toolbar-panel-row.has-active-panel {
            display: flex;
        }

        .toolbar-panel {
            display: none;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            width: 100%;
            min-width: 0;
            padding: 0;
            border: none;
            border-radius: 0;
            background: transparent;
            box-shadow: none;
            overflow-x: auto;
            overflow-y: hidden;
            scrollbar-width: thin;
        }

        .toolbar-panel.active {
            display: flex;
        }

        .toolbar-check {
            display: inline-flex;
            align-items: center;
            min-height: var(--toolbar-option-control-height);
            gap: 6px;
            font-size: 11px;
            color: var(--text-soft);
            white-space: nowrap;
            margin: 0;
        }

        .toolbar-check input[type="checkbox"] {
            width: 14px;
            height: 14px;
        }

        .toolbar-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 40px;
            padding: 10px 14px;
            font-size: 12px;
            line-height: 1.15;
            border-radius: 12px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            background: rgba(35, 52, 68, 0.7);
            color: var(--text);
            font-weight: 700;
            letter-spacing: 0.04em;
            box-shadow: none;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
        }
        .toolbar-label-desktop {
            display: inline;
        }

        .toolbar-label-mobile {
            display: none;
        }

        #animation-toolbar .toolbar-panel button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: var(--toolbar-option-control-height);
            white-space: nowrap;
        }

        #animation-toolbar .toolbar-btn,
        #animation-toolbar .toolbar-tab,
        #animation-toolbar .toolbar-check,
        #animation-toolbar .toolbar-check input,
        #animation-toolbar .toolbar-color,
        #animation-toolbar .toolbar-range,
        #animation-toolbar .toolbar-input {
            cursor: pointer;
        }

        .toolbar-color {
            width: 34px !important;
            height: var(--toolbar-option-control-height) !important;
            border-radius: 10px !important;
            padding: 0 !important;
        }

        .toolbar-range {
            width: 88px;
            height: 5px;
        }

        .toolbar-value {
            font-size: 11px;
            min-width: 30px;
            text-align: right;
            color: var(--accent);
            font-weight: 600;
        }

        #controls {
            width: var(--sidebar-width);
            flex-shrink: 0;
            height: 100%;
            position: relative;
            display: flex;
            flex-direction: column;
            background: linear-gradient(180deg, rgba(16, 23, 31, 0.98), rgba(22, 33, 44, 0.98));
            padding: 0;
            overflow: hidden;
            overflow-x: hidden;
            z-index: 120;
            border-right: 1px solid var(--border);
            box-shadow: var(--shadow);
        }

        .sidebar-header-3d {
            flex: 0 0 auto;
            padding: 24px 24px 18px;
            border-bottom: 1px solid var(--border-soft);
            background: linear-gradient(180deg, rgba(30, 45, 60, 0.75), rgba(18, 27, 36, 0.2));
        }

        .sidebar-body-3d {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 22px 24px;
        }

        #mobile-sidebar-handle {
            display: none;
        }

        #mobile-sidebar-handle {
            border: none;
            cursor: pointer;
        }

        #mobile-sidebar-handle:focus-visible {
            outline: 2px solid #7eb5ff;
            outline-offset: 2px;
        }

        .mobile-sidebar-handle__grip {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
        }

        .mobile-sidebar-handle__grip span {
            width: 8px;
            height: 2px;
            border-radius: 999px;
            background: rgba(179, 210, 239, 0.95);
        }

        .mobile-sidebar-handle__label {
            writing-mode: vertical-rl;
            transform: rotate(180deg);
            font-size: 8px;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: #dcecff;
        }

        #sidebar-resizer {
            position: relative;
            width: 10px;
            flex: 0 0 10px;
            height: 100%;
            cursor: col-resize;
            background: linear-gradient(180deg, rgba(26, 34, 44, 0.95), rgba(18, 24, 32, 0.95));
            border-right: 1px solid #263240;
            border-left: 1px solid #10161d;
            z-index: 121;
        }

        #sidebar-resizer::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 3px;
            height: 56px;
            border-radius: 2px;
            transform: translate(-50%, -50%);
            background: linear-gradient(180deg, #7f9ec0 0%, #4f6b86 100%);
            opacity: 0.85;
        }

        #sidebar-resizer:hover::before,
        #sidebar-resizer:focus-visible::before {
            background: linear-gradient(180deg, #9bc8ff 0%, #6e9fd4 100%);
            opacity: 1;
        }

        #sidebar-resizer:focus-visible {
            outline: 2px solid #7eb5ff;
            outline-offset: -2px;
        }

        #controls-backdrop {
            display: none;
        }

        #mobile-manual-entry-sheet {
            display: none;
        }

        .mobile-manual-entry-sheet__dialog {
            width: min(380px, 100%);
            margin: 0 auto;
            border-radius: 14px;
            border: 1px solid rgba(79, 108, 137, 0.82);
            background: linear-gradient(180deg, rgba(18, 29, 42, 0.98), rgba(11, 18, 28, 0.98));
            box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
            padding: 12px;
            pointer-events: auto;
        }

        .mobile-manual-entry-sheet__controls {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: 8px;
            align-items: end;
        }

        .mobile-manual-entry-sheet__field {
            display: flex;
            flex-direction: column;
            gap: 5px;
            min-width: 0;
        }

        .mobile-manual-entry-sheet__field-row {
            display: grid;
            grid-template-columns: auto minmax(0, 1fr) auto;
            gap: 8px;
            align-items: center;
        }

        .mobile-manual-entry-sheet__label {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: #9dbad3;
        }

        .mobile-manual-entry-sheet__stepper {
            width: 46px;
            height: 46px;
            padding: 0;
            border-radius: 12px;
            font-size: 22px;
            line-height: 1;
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
        }

        .mobile-manual-entry-sheet__stepper.is-pressed {
            transform: translateY(1px);
            box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.28);
        }

        .mobile-manual-entry-sheet__input {
            width: 100%;
            height: 46px;
            padding: 10px 12px;
            border: 1px solid rgba(94, 125, 157, 0.75);
            border-radius: 12px;
            background: rgba(23, 35, 50, 0.96);
            color: #f3f8ff;
            font-size: 16px;
            font-weight: 700;
            text-align: center;
            pointer-events: none;
            user-select: none;
            caret-color: transparent;
        }

        .mobile-manual-entry-sheet__input:focus {
            outline: none;
            border-color: rgba(132, 199, 255, 0.95);
            box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
        }

        #container.sidebar-resizing,
        #container.sidebar-resizing * {
            cursor: col-resize !important;
            user-select: none !important;
        }

        .sidebar-header-3d h2 {
            margin: 0;
            font-size: 26px;
            letter-spacing: 0.02em;
            color: var(--text);
        }

        .sidebar-guide-link {
            display: inline-flex;
            align-items: center;
            align-self: flex-start;
            min-height: 34px;
            margin: 12px 0 16px;
            padding: 0 12px;
            border-radius: 999px;
            border: 1px solid rgba(121, 183, 255, 0.22);
            background: rgba(35, 52, 68, 0.42);
            color: var(--accent);
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-decoration: none;
            text-transform: uppercase;
        }

        .sidebar-guide-link:hover {
            color: var(--text);
            background: rgba(55, 77, 98, 0.7);
            border-color: rgba(121, 183, 255, 0.34);
        }

        .control-group {
            margin-bottom: 18px;
            padding: 16px;
            border: 1px solid var(--border-soft);
            border-radius: var(--radius);
            background: linear-gradient(180deg, rgba(23, 34, 44, 0.96), rgba(17, 25, 33, 0.96));
        }

        .control-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--text-soft);
        }

        .button-group {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 10px;
        }

        .button-group.single {
            grid-template-columns: 1fr;
        }

        button {
            padding: 10px 15px;
            background: linear-gradient(180deg, var(--accent), var(--accent-strong));
            border: 1px solid transparent;
            border-radius: 12px;
            color: #08131f;
            cursor: pointer;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.04em;
            transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
        }

        button:hover {
            background: linear-gradient(180deg, #8fc4ff, #5ba5ff);
            transform: translateY(-1px);
            box-shadow: 0 10px 22px rgba(74, 152, 255, 0.18);
        }

        button:active {
            background: linear-gradient(180deg, #6aaffe, #3d89ea);
            transform: translateY(0);
        }

        button.secondary {
            background: rgba(35, 52, 68, 0.52);
            border-color: rgba(122, 146, 170, 0.18);
            color: var(--text);
        }

        button.secondary:hover {
            background: rgba(55, 77, 98, 0.82);
        }

        button.warm {
            background: linear-gradient(180deg, #e1a262, #c77e39);
            color: #1b0f04;
        }

        button.warm:hover {
            background: linear-gradient(180deg, #e7ab6f, #cf8844);
        }

        input[type="file"] {
            width: 100%;
            padding: 8px;
            background: #2a2a2a;
            border: 1px solid #444444;
            border-radius: 4px;
            color: white;
            font-size: 13px;
        }

        input[type="file"]::file-selector-button {
            padding: 6px 12px;
            background: #4a9eff;
            border: none;
            border-radius: 4px;
            color: white;
            cursor: pointer;
            margin-right: 10px;
        }

        input[type="file"]::file-selector-button:hover {
            background: #3a8eef;
        }

        #info {
            position: absolute;
            bottom: 20px;
            left: 20px;
            background: rgba(30, 30, 30, 0.95);
            padding: 15px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            z-index: 100;
            font-size: 13px;
            color: #aaaaaa;
            pointer-events: none;
        }

        #info .info-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 8px;
        }

        #info .info-title {
            color: #4a9eff;
            font-weight: 700;
        }

        #info .info-help-btn {
            width: 30px;
            height: 30px;
            padding: 0;
            border-radius: 999px;
            border: 1px solid #3d4f63;
            background: #223142;
            color: #dbe9f8;
            font-size: 18px;
            font-weight: 700;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            pointer-events: auto;
            cursor: pointer;
            transition: background-color 0.2s ease, border-color 0.2s ease;
        }

        #info .info-help-btn:hover {
            background: #2a3b4f;
            border-color: #547196;
        }

        #info .info-help-btn:focus-visible {
            outline: 2px solid rgba(96, 239, 166, 0.55);
            outline-offset: 2px;
        }

        #info .info-tip-group {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        #info .info-item {
            margin-bottom: 0;
        }

        #info .info-item:last-child {
            margin-bottom: 0;
        }

        #info .info-tip-group--mobile {
            display: none;
        }

        #info strong {
            color: #4a9eff;
        }

        #mode-help-content .guide-content {
            gap: 14px;
        }

        #mode-help-content .guide-content p {
            color: #cfdceb;
        }

        #mode-help-content .guide-content ul {
            list-style: disc;
        }

        #toggle-coordinate-space {
            position: absolute;
            top: calc(var(--toolbar-height) + var(--desktop-floating-controls-gap));
            left: 20px;
            z-index: 101;
            display: inline-flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 2px;
            min-width: 152px;
            padding: 10px 14px;
            border-radius: 12px;
            border: 1px solid rgba(128, 214, 255, 0.24);
            background: rgba(21, 33, 45, 0.94);
            color: #eef6ff;
            cursor: pointer;
            box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
            backdrop-filter: blur(8px);
            text-align: left;
            transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
        }

        #toggle-coordinate-space:hover {
            background: rgba(28, 42, 56, 0.97);
            border-color: rgba(128, 214, 255, 0.44);
            transform: translateY(-1px);
        }

        #toggle-coordinate-space:focus-visible {
            outline: 2px solid rgba(128, 214, 255, 0.78);
            outline-offset: 2px;
        }

        #toggle-coordinate-space.active {
            background: rgba(27, 78, 56, 0.96);
            border-color: rgba(96, 239, 166, 0.52);
        }

        #toggle-coordinate-space:disabled {
            opacity: 0.68;
            cursor: not-allowed;
            transform: none;
        }

        #toggle-coordinate-space [data-coordinate-space-label] {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: rgba(207, 226, 244, 0.78);
        }

        #toggle-coordinate-space [data-coordinate-space-value] {
            font-size: 15px;
            font-weight: 700;
            line-height: 1.2;
            color: #ffffff;
        }

        .toolbar-rotate-btn,
        .toolbar-translate-btn,
        .toolbar-camera-view-btn {
            min-width: 68px;
            padding: 5px 8px;
            background: #223143;
            border: 1px solid rgba(178, 207, 235, 0.24);
            color: #e3efff;
            box-shadow: none;
        }

        .toolbar-rotate-btn:hover,
        .toolbar-translate-btn:hover,
        .toolbar-camera-view-btn:hover {
            background: #2a3c50;
        }

        .toolbar-rotate-btn.active,
        .toolbar-translate-btn.active,
        .toolbar-camera-view-btn.active {
            background: linear-gradient(180deg, #e1a262, #c77e39);
            border-color: transparent;
            color: #1b0f04;
        }

        .toolbar-panel[data-toolbar-section="camera"] > .toolbar-btn {
            flex: 0 0 68px;
            width: 68px;
            min-width: 68px;
        }

        .toolbar-camera-btn {
            min-width: 80px;
            padding: 5px 8px;
            background: #223143;
            border: 1px solid rgba(178, 207, 235, 0.24);
            color: #e3efff;
            box-shadow: none;
        }

        .toolbar-camera-btn:hover {
            background: #2a3c50;
        }

        .toolbar-camera-btn.active {
            background: linear-gradient(180deg, #e1a262, #c77e39);
            border-color: transparent;
            color: #1b0f04;
        }

        .viewer-display-popover {
            position: absolute;
            top: calc(var(--toolbar-height) + var(--desktop-floating-controls-gap));
            right: 20px;
            z-index: 145;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 10px;
        }

        .viewer-display-popover__toggle {
            width: 42px;
            height: 42px;
            border: 1px solid rgba(178, 207, 235, 0.3);
            border-radius: 12px;
            background: linear-gradient(180deg, rgba(20, 31, 44, 0.96), rgba(13, 21, 31, 0.94));
            box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
        }

        .viewer-display-popover__toggle:hover {
            background: linear-gradient(180deg, rgba(28, 43, 60, 0.98), rgba(18, 29, 41, 0.96));
            border-color: rgba(178, 207, 235, 0.5);
            transform: translateY(-1px);
        }

        .viewer-display-popover__toggle[aria-expanded="true"] {
            border-color: rgba(96, 239, 166, 0.5);
            background: linear-gradient(180deg, rgba(27, 58, 43, 0.98), rgba(16, 35, 27, 0.96));
        }

        .viewer-display-popover__icon {
            position: relative;
            width: 18px;
            height: 14px;
            display: inline-block;
        }

        .viewer-display-popover__icon-line {
            position: absolute;
            left: 0;
            width: 100%;
            height: 2px;
            border-radius: 999px;
            background: #e5f1ff;
        }

        .viewer-display-popover__icon-line:nth-child(1) {
            top: 1px;
        }

        .viewer-display-popover__icon-line:nth-child(2) {
            top: 6px;
        }

        .viewer-display-popover__icon-line:nth-child(3) {
            top: 11px;
        }

        .viewer-display-popover__panel {
            min-width: 164px;
            padding: 10px;
            border: 1px solid rgba(178, 207, 235, 0.26);
            border-radius: 14px;
            background: linear-gradient(180deg, rgba(16, 24, 34, 0.97), rgba(10, 17, 24, 0.95));
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.32);
            display: flex;
            flex-direction: column;
            gap: 8px;
            backdrop-filter: blur(10px);
        }

        .viewer-display-popover__panel .toolbar-btn {
            width: 100%;
            min-width: 0;
            justify-content: flex-start;
        }

        .rotate-value-control,
        .translate-value-control,
        .measure-value-control {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-top: 0;
        }

        .rotate-value-control,
        .translate-value-control {
            flex: 1 1 220px;
            min-width: 0;
            max-width: 100%;
        }

        .rotate-value-control > .toolbar-input,
        .translate-value-control > .toolbar-input {
            flex: 1 1 100px;
            min-width: 100px;
        }

        .rotate-value-control > .toolbar-btn,
        .translate-value-control > .toolbar-btn {
            flex: 0 0 auto;
        }

        .mobile-move-axis-legend {
            display: inline-flex;
            flex: 0 0 auto;
            align-items: center;
            gap: 8px;
            min-width: 0;
            margin-left: 12px;
            padding: 0;
        }

        .mobile-move-axis-legend.hidden {
            display: none;
        }

        .mobile-move-axis-legend__label {
            flex: 0 0 auto;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: rgba(207, 226, 244, 0.8);
            white-space: nowrap;
        }

        .mobile-move-axis-legend__buttons {
            display: inline-flex;
            flex: 0 0 auto;
            align-items: center;
            gap: 8px;
            min-width: 0;
        }

        .mobile-move-axis-btn {
            display: inline-flex;
            position: relative;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            min-width: 32px;
            min-height: 32px;
            padding: 0;
            background: rgba(34, 49, 67, 0.72);
            border: 1px solid rgba(178, 207, 235, 0.24);
            border-radius: 999px;
            color: #e3efff;
            box-shadow: none;
            flex: 0 0 auto;
            overflow: hidden;
        }

        .mobile-move-axis-btn:hover {
            background: #2a3c50;
        }

        .mobile-move-axis-btn[data-axis-mode="x"],
        .mobile-move-axis-btn[data-dimension-axis-mode="x"] {
            background: rgba(255, 107, 107, 0.16);
            border-color: rgba(255, 107, 107, 0.4);
            color: #ffb3b3;
        }

        .mobile-move-axis-btn[data-axis-mode="y"],
        .mobile-move-axis-btn[data-dimension-axis-mode="y"] {
            background: rgba(103, 213, 138, 0.16);
            border-color: rgba(103, 213, 138, 0.4);
            color: #b6f0c9;
        }

        .mobile-move-axis-btn[data-axis-mode="z"],
        .mobile-move-axis-btn[data-dimension-axis-mode="z"] {
            background: rgba(99, 169, 255, 0.16);
            border-color: rgba(99, 169, 255, 0.42);
            color: #b8d8ff;
        }

        .mobile-move-axis-btn[data-axis-mode="x"]:hover,
        .mobile-move-axis-btn[data-dimension-axis-mode="x"]:hover {
            background: rgba(255, 107, 107, 0.24);
        }

        .mobile-move-axis-btn[data-axis-mode="y"]:hover,
        .mobile-move-axis-btn[data-dimension-axis-mode="y"]:hover {
            background: rgba(103, 213, 138, 0.24);
        }

        .mobile-move-axis-btn[data-axis-mode="z"]:hover,
        .mobile-move-axis-btn[data-dimension-axis-mode="z"]:hover {
            background: rgba(99, 169, 255, 0.24);
        }

        .mobile-move-axis-btn.active {
            background: linear-gradient(180deg, #79b7ff, #4f8fe1);
            border-color: transparent;
            color: #08131f;
            box-shadow: none;
        }

        .mobile-move-axis-btn:disabled {
            opacity: 0.5;
        }

        .mobile-move-axis-btn__swatch {
            position: absolute;
            inset: 3px;
            border-radius: 999px;
            background: rgba(222, 232, 244, 0.72);
            opacity: 0.22;
        }

        .mobile-move-axis-btn__swatch.axis-x {
            background: #ff6b6b;
        }

        .mobile-move-axis-btn__swatch.axis-y {
            background: #67d58a;
        }

        .mobile-move-axis-btn__swatch.axis-z {
            background: #63a9ff;
        }

        .mobile-move-axis-btn__label {
            position: relative;
            z-index: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 11px;
            font-weight: 700;
        }

        #toolbar-panel-move.toolbar-panel.active,
        #toolbar-panel-dimension.toolbar-panel.active {
            flex-wrap: nowrap;
            align-items: center;
        }

        #toolbar-panel-move.toolbar-panel.active > .toolbar-btn,
        #toolbar-panel-move.toolbar-panel.active > .toolbar-axis-group {
            flex: 0 0 auto;
        }

        .rotate-value-control.hidden,
        .translate-value-control.hidden,
        .measure-value-control.hidden {
            display: none;
        }

        .toolbar-input {
            flex: 1;
            min-width: 100px;
            min-height: var(--toolbar-option-control-height);
            padding: 5px 10px;
            background: rgba(17, 27, 37, 0.92);
            border: 1px solid rgba(122, 146, 170, 0.28);
            color: var(--text);
            font-size: 13px;
            font-weight: 600;
            border-radius: 10px;
        }

        .toolbar-input:focus {
            outline: none;
            border-color: rgba(121, 183, 255, 0.75);
            box-shadow: 0 0 0 3px rgba(74, 152, 255, 0.18);
        }

        #loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(30, 30, 30, 0.95);
            padding: 30px 50px;
            border-radius: 8px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            text-align: center;
            display: none;
            z-index: 200;
        }

        #loading.active {
            display: block;
        }

        .spinner {
            border: 4px solid #333;
            border-top: 4px solid #4a9eff;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 0 auto 15px;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(360deg);
            }
        }

        .hidden {
            display: none !important;
        }

        input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
            accent-color: #4a9eff;
        }

        .checkbox-label {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            font-size: 13px;
            margin-bottom: 8px;
        }

        input[type="color"] {
            width: 100%;
            height: 40px;
            border: 1px solid #444444;
            border-radius: 4px;
            background: #2a2a2a;
            cursor: pointer;
        }

        input[type="range"] {
            width: 100%;
            height: 6px;
            border-radius: 3px;
            background: #444444;
            outline: none;
            -webkit-appearance: none;
            appearance: none;
        }

        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #4a9eff;
            cursor: pointer;
        }

        input[type="range"]::-moz-range-thumb {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #4a9eff;
            cursor: pointer;
            border: none;
        }

        .slider-value {
            display: inline-block;
            margin-left: 10px;
            color: #4a9eff;
            font-weight: 500;
        }

        .selection-panel {
            border: 1px solid var(--border-soft);
            border-radius: var(--radius);
            padding: 16px;
            background: linear-gradient(180deg, rgba(23, 34, 44, 0.96), rgba(17, 25, 33, 0.96));
            box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
        }

        .selection-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }

        .selection-count {
            font-size: 12px;
            color: var(--text-soft);
            white-space: nowrap;
        }

        .assembly-select-all-label,
        .assembly-item-visibility {
            margin-bottom: 0;
            flex-shrink: 0;
        }

        .assembly-select-all-label {
            display: flex;
            align-items: center;
            align-self: center;
        }

        .assembly-item-visibility {
            display: flex;
            align-items: center;
            align-self: center;
        }

        .assembly-item-visibility input[type="checkbox"] {
            display: block;
            margin: 0;
            transform: translateY(2px);
        }

        .assembly-list-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            margin-bottom: 12px;
            padding: 12px 14px;
            border: 1px solid rgba(121, 183, 255, 0.14);
            border-radius: 14px;
            background: linear-gradient(180deg, rgba(31, 46, 61, 0.88), rgba(21, 31, 41, 0.92));
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
        }

        .assembly-list-header__summary {
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 12px;
            flex: 1;
        }

        .assembly-list-header__visibility {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            margin: 0;
            border-radius: 10px;
            background: rgba(117, 177, 244, 0.08);
            border: 1px solid rgba(117, 177, 244, 0.12);
        }

        .assembly-list-header__visibility input[type="checkbox"] {
            margin: 0;
            transform: none;
        }

        .assembly-list-header__text {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .assembly-list-header__eyebrow-row {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
        }

        .assembly-list-header__kicker {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.16em;
            text-transform: uppercase;
            color: var(--accent);
        }

        .assembly-list-header__count {
            display: inline-flex;
            align-items: center;
            padding: 2px 8px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.06);
            color: var(--text-soft);
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .assembly-list-header__title {
            font-size: 16px;
            font-weight: 800;
            line-height: 1.2;
            color: var(--text);
            word-break: break-word;
        }

        .assembly-list-header__actions {
            display: flex;
            align-items: center;
            flex-shrink: 0;
        }

                .small-btn.assembly-list-header__collapse-btn {
                        width: 26px;
                        height: 26px;
                        min-height: 26px;
            padding: 0;
                        display: inline-flex;
                        align-items: center;
                        justify-content: center;
                        border-radius: 7px;
                        border: 1px solid rgba(122, 146, 170, 0.24);
            background: linear-gradient(180deg, rgba(76, 94, 114, 0.96), rgba(53, 68, 85, 0.96));
            color: #e7f0f8;
                        font-size: 20px;
                        font-weight: 800;
            line-height: 1;
                        flex-shrink: 0;
        }

                .small-btn.assembly-list-header__collapse-btn:hover {
            background: linear-gradient(180deg, rgba(94, 116, 139, 0.98), rgba(68, 86, 106, 0.98));
        }

                .assembly-list-header__collapse-icon {
                        display: inline-block;
                        font-size: 22px;
                        font-weight: 900;
                        line-height: 1;
                        transform: translateY(-1px);
                        pointer-events: none;
                }

        .assembly-item--hidden {
            border-left-color: #5d6976;
            opacity: 0.72;
        }

        .assembly-item--hidden .assembly-item-label {
            color: #a8b7c5;
        }

        .model-name-display__label {
            display: block;
            margin-bottom: 6px;
            font-size: 10px;
            font-weight: 600;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: var(--accent);
        }

        .model-name-display__input {
            width: 100%;
            min-height: 44px;
            padding: 10px 12px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            border-radius: 12px;
            outline: none;
            background: rgba(7, 12, 17, 0.42);
            color: var(--text);
            font: 600 15px/1.35 "Segoe UI", Arial, sans-serif;
            letter-spacing: 0.01em;
        }

        .model-name-display__input::placeholder {
            color: rgba(243, 249, 255, 0.58);
        }

        .model-name-display__input:focus,
        .fabrication-meta-panel__textarea:focus {
            border-color: rgba(164, 209, 255, 0.7);
            box-shadow: 0 0 0 3px rgba(82, 157, 255, 0.2);
        }

        .fabrication-meta-panel {
            display: grid;
            gap: 14px;
        }

        .fabrication-meta-field {
            display: grid;
            gap: 6px;
        }

        .fabrication-status {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 30px;
            width: fit-content;
            margin: 0 0 12px;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(127, 213, 171, 0.28);
            background: rgba(39, 96, 73, 0.22);
            color: #d7ffee;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .fabrication-status.is-dirty {
            border-color: rgba(210, 143, 76, 0.35);
            background: rgba(210, 143, 76, 0.18);
            color: #ffe5c8;
        }

        .fabrication-meta-panel__textarea {
            width: 100%;
            min-height: 72px;
            padding: 10px 12px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            border-radius: 12px;
            outline: none;
            resize: vertical;
            background: rgba(7, 12, 17, 0.42);
            color: var(--text);
            font: 500 13px/1.5 "Segoe UI", Arial, sans-serif;
        }

        .fabrication-meta-panel__textarea::placeholder {
            color: rgba(243, 249, 255, 0.58);
        }

        .assembly-explorer {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            padding: 2px 0 8px;
        }

        .assembly-breadcrumb {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            flex-wrap: nowrap;
            gap: 0;
            font-size: 12px;
            overflow-x: auto;
            scrollbar-width: thin;
            white-space: nowrap;
        }

        .assembly-breadcrumb__item {
            display: inline;
            padding: 0;
            border: none;
            background: none;
            color: var(--accent);
            font: inherit;
            cursor: pointer;
            white-space: nowrap;
            text-decoration: underline;
            text-underline-offset: 2px;
            transition: color 0.18s ease;
        }

        .assembly-breadcrumb__item:hover {
            color: var(--text);
        }

        .assembly-breadcrumb__item--current {
            color: var(--text);
            font-weight: 700;
            cursor: default;
            text-decoration: none;
        }

        .assembly-breadcrumb__separator {
            color: #6f89a3;
            font-size: 12px;
            line-height: 1;
            user-select: none;
            margin: 0 4px;
        }

        .selection-list {
            max-height: 260px;
            overflow-y: auto;
            border: 1px solid rgba(121, 183, 255, 0.14);
            border-radius: 14px;
            background: rgba(10, 16, 22, 0.42);
            padding: 8px;
        }

        .selection-empty {
            padding: 10px;
            font-size: 12px;
            color: var(--text-soft);
            text-align: center;
        }

        .assembly-items {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding-top: 2px;
        }

        .assembly-item {
            background-color: rgba(24, 34, 44, 0.92);
            border: 1px solid rgba(121, 183, 255, 0.14);
            border-left: 4px solid var(--accent-strong);
            border-radius: 12px;
            padding: 10px;
            box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
            transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
        }

        .assembly-item--navigable {
            cursor: pointer;
        }

        .assembly-item--navigable:hover {
            border-color: rgba(121, 183, 255, 0.36);
            background-color: rgba(31, 46, 60, 0.98);
            transform: translateX(2px);
        }

        .assembly-item-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 6px;
            padding-bottom: 6px;
            border-bottom: 1px solid rgba(126, 154, 184, 0.14);
            gap: 8px;
        }

        .assembly-item-meta {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }

        .assembly-item-label {
            font-size: 12px;
            font-weight: 700;
            color: var(--text);
            line-height: 1.2;
            word-break: break-word;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .subcomponent-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 20px;
            height: 20px;
            padding: 2px 6px;
            background: #ff6b6b;
            color: white;
            border-radius: 10px;
            font-size: 10px;
            font-weight: 700;
            flex-shrink: 0;
        }

        .assembly-item-actions {
            display: flex;
            gap: 4px;
            align-items: center;
        }

        .small-btn {
            background: linear-gradient(180deg, var(--accent), var(--accent-strong));
            color: #08131f;
            border: 1px solid transparent;
            padding: 5px 8px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 11px;
            font-weight: 700;
            transition: background-color 0.2s ease, transform 0.2s ease;
        }

        .small-btn:hover {
            background: linear-gradient(180deg, #8fc4ff, #5ba5ff);
            transform: translateY(-1px);
        }

        .small-btn.danger {
            background-color: #a44b4b;
        }

        .small-btn.danger:hover {
            background-color: #b95a5a;
        }

        .assembly-item-actions .small-btn.icon-btn {
            width: 26px;
            height: 26px;
            min-height: 26px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 7px;
            border: 1px solid rgba(122, 146, 170, 0.24);
        }

        .assembly-item-actions .small-btn.icon-btn svg {
            width: 14px;
            height: 14px;
            fill: currentColor;
            pointer-events: none;
        }

        .assembly-item-nav-btn {
            width: 26px;
            height: 26px;
            min-height: 26px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 7px;
            font-size: 15px;
            line-height: 1;
            flex-shrink: 0;
            background: linear-gradient(180deg, #88d8bd, #4ca483);
            color: #081710;
        }

        .assembly-item-nav-btn:hover {
            background: linear-gradient(180deg, #9be5cc, #5bb290);
        }

        .assembly-item-copy-btn {
            background: linear-gradient(180deg, #ffd48b, #d9a652);
            color: #2e1e03;
        }

        .assembly-item-copy-btn:hover {
            background: linear-gradient(180deg, #ffe0a5, #e1b466);
        }

        .assembly-item-edit-btn {
            background: linear-gradient(180deg, #8ec7ff, #5b97df);
            color: #08131f;
        }

        .assembly-item-edit-btn:hover {
            background: linear-gradient(180deg, #a6d4ff, #6ea6e7);
        }

        .assembly-item-remove-btn {
            background: linear-gradient(180deg, #ef8f8f, #c45d5d);
            color: #260808;
        }

        .assembly-item-remove-btn:hover {
            background: linear-gradient(180deg, #f5a4a4, #cf6d6d);
        }

        .assembly-item-nav-spacer {
            width: 28px;
            height: 28px;
            flex-shrink: 0;
        }

        .assembly-item-preview {
            font-size: 11px;
            color: #a8b5c4;
        }

        .assembly-item-preview table {
            border-collapse: collapse;
            width: auto;
        }

        .assembly-item-preview td {
            padding: 2px 4px;
            white-space: nowrap;
        }

        .assembly-item-preview td:first-child,
        .assembly-item-preview td:nth-child(3) {
            font-weight: 600;
            color: #c7d6e5;
        }

        .assembly-item-preview td:first-child {
            min-width: 24px;
        }

        .assembly-item-preview td:nth-child(3) {
            min-width: 42px;
            padding-left: 18px;
        }

        .assembly-item-preview td:nth-child(2),
        .assembly-item-preview td:nth-child(4) {
            min-width: 64px;
            text-align: right;
            font-variant-numeric: tabular-nums;
        }

        .helper-note {
            margin-top: 6px;
            font-size: 11px;
            color: #8fb6c7;
            line-height: 1.35;
        }

        .modal {
            position: fixed;
            inset: 0;
            z-index: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.58);
            padding: 20px;
        }

        .modal-content {
            width: min(760px, 100%);
            max-height: 90vh;
            overflow-y: auto;
            border-radius: 8px;
            border: 1px solid #314153;
            background: #18222e;
            box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
        }

        .modal-content.component-editor-modal-content {
            width: min(98vw, 1700px);
            min-width: min(1200px, 98vw);
            height: min(96vh, 1180px);
            max-width: 1700px;
            max-height: none;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 14px 16px;
            border-bottom: 1px solid #2b3643;
        }

        .modal-header h3 {
            margin: 0;
            font-size: 16px;
            color: #dbe9f8;
        }

        .modal-close {
            width: 34px;
            height: 34px;
            padding: 0;
            line-height: 1;
            border-radius: 6px;
            border: 1px solid #3d4f63;
            background: #223142;
            color: #dbe9f8;
            font-size: 22px;
        }

        .modal-close:hover {
            background: #2a3b4f;
        }

        .modal-body {
            padding: 16px;
        }

        .component-editor-modal-content .modal-body {
            flex: 1 1 auto;
            min-height: 0;
            padding: 0;
            overflow: hidden;
        }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            padding: 14px 16px;
            border-top: 1px solid #2b3643;
        }

        .guide-content {
            display: flex;
            flex-direction: column;
            gap: 12px;
            color: #d6e2ef;
            line-height: 1.45;
            font-size: 13px;
        }

        .guide-content h4 {
            margin: 0;
            font-size: 13px;
            color: #9fc5e9;
            text-transform: uppercase;
            letter-spacing: 0.03em;
        }

        .guide-content ol,
        .guide-content ul {
            margin: 0 0 0 18px;
            padding: 0;
        }

        .guide-content li {
            margin-bottom: 6px;
        }

        .guide-content p {
            margin: 0;
            color: #b5c8da;
        }

        .component-editor-shell {
            display: flex;
            flex-direction: column;
            height: 100%;
            min-height: 0;
        }

        .component-editor-shell__copy {
            padding: 14px 16px;
            border-bottom: 1px solid #2b3643;
            color: #b5c8da;
            font-size: 13px;
            line-height: 1.45;
            background: rgba(20, 31, 42, 0.55);
        }

        .component-editor-shell__frame {
            flex: 1 1 auto;
            min-height: 0;
            background: #0f151c;
        }

        .component-editor-frame {
            display: block;
            width: 100%;
            height: 100%;
            border: 0;
            background: #0f151c;
        }

        body.component-3d-embed-mode #app-shell:not(.component3d-shell--stacked) {
            display: flex;
            flex-direction: row;
            align-items: stretch;
            width: 100%;
        }

        body.component-3d-embed-mode #app-shell:not(.component3d-shell--stacked) .sidebar-3d {
            flex: 0 0 auto;
            width: clamp(560px, 34vw, 820px);
            min-width: 520px;
            max-width: calc(100% - 760px);
        }

        body.component-3d-embed-mode #app-shell:not(.component3d-shell--stacked) #sidebar-resizer {
            display: block !important;
            width: 10px;
            flex: 0 0 10px;
            border: 0;
        }

        body.component-3d-embed-mode #app-shell:not(.component3d-shell--stacked) .viewport-shell {
            flex: 1 1 auto;
            width: auto;
            min-width: 760px;
        }

        @media (max-width: 1100px) {
            .modal-content.component-editor-modal-content {
                width: min(100%, 96vw);
                min-width: 0;
                height: min(96vh, 980px);
            }

            body.component-3d-embed-mode #app-shell:not(.component3d-shell--stacked) .sidebar-3d {
                width: clamp(420px, 40vw, 620px);
                min-width: 400px;
                max-width: calc(100% - 420px);
            }

            body.component-3d-embed-mode #app-shell:not(.component3d-shell--stacked) .viewport-shell {
                min-width: 420px;
            }
        }

        .spatial-editor {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .editor-section {
            border: 1px solid #2f3c4a;
            border-radius: 6px;
            background: rgba(17, 24, 33, 0.62);
            padding: 12px;
        }

        .editor-section h4 {
            margin: 0 0 10px;
            color: #b9d2e9;
            font-size: 13px;
            letter-spacing: 0.02em;
            text-transform: uppercase;
        }

        .editor-grid {
            display: grid;
            gap: 10px;
        }

        .editor-grid.columns-3 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .editor-grid.columns-2 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .editor-grid.columns-4 {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        .editor-field {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .editor-field label {
            margin: 0;
            font-size: 11px;
            color: #9bb6ce;
            text-transform: uppercase;
            letter-spacing: 0.03em;
        }

        .editor-field input,
        .editor-field select {
            width: 100%;
            height: 34px;
            padding: 6px 8px;
            border: 1px solid #3a4c60;
            border-radius: 4px;
            background: #243648;
            color: #f0f6ff;
            font-size: 13px;
        }

        .editor-field input[type="color"] {
            padding: 2px;
            cursor: pointer;
        }

        .editor-section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 10px;
        }

        .editor-section-header h4 {
            margin: 0;
        }

        .editor-process-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .editor-process-actions button {
            white-space: nowrap;
        }

        .editor-process-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .editor-process-card {
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 12px;
            border: 1px solid #3a4c60;
            border-radius: 6px;
            background: rgba(36, 54, 72, 0.42);
        }

        .editor-process-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .editor-process-card-title {
            margin: 0;
            color: #dbe9f8;
            font-size: 12px;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .editor-process-note {
            margin: 0;
            color: #a8bfd5;
            font-size: 12px;
        }

        .editor-process-empty {
            padding: 10px 12px;
            border: 1px dashed #3a4c60;
            border-radius: 6px;
            color: #9bb6ce;
            font-size: 13px;
        }

        @media (max-width: 1260px) {
            #animation-toolbar {
                gap: 6px;
                right: 14px;
                left: 14px;
            }

            .toolbar-tab-row {
                gap: 8px;
            }

            .toolbar-tab-list {
                gap: 8px;
            }

            .toolbar-quick-actions {
                gap: 6px;
            }

            .toolbar-panel {
                gap: 8px;
            }

            .toolbar-tab.section-gap-before {
                margin-left: 14px;
            }
        }

        @media (max-width: 900px) {
            body.component-3d-panel-mode-fixed-length-piece {
                overflow-x: hidden;
                overflow-y: auto;
            }

            body.component-3d-panel-mode-fixed-length-piece #app-shell,
            body.component-3d-panel-mode-fixed-length-piece #app-shell:not(.component3d-shell--stacked) {
                display: flex;
                flex-direction: column;
                width: 100%;
                min-height: 100vh;
                min-height: 100svh;
                height: auto;
                grid-template-columns: 1fr;
            }

            body.component-3d-panel-mode-fixed-length-piece .sidebar-3d {
                min-height: auto;
                overflow: visible;
                border-right: none;
                border-bottom: 1px solid var(--border);
                box-shadow: none;
            }

            body.component-3d-panel-mode-fixed-length-piece .sidebar-3d > .sidebar-body,
            body.component-3d-panel-mode-fixed-length-piece .sidebar-body-3d {
                overflow: visible;
                min-height: auto;
            }

            body.component-3d-panel-mode-fixed-length-piece .viewport-shell {
                order: 2;
                min-height: 52vh;
                min-height: 52svh;
                height: 52vh;
                height: 52svh;
            }

            body.component-3d-panel-mode-fixed-length-piece .sidebar-3d {
                order: 1;
            }

            body.component-3d-panel-mode-fixed-length-piece #animation-toolbar {
                left: 12px;
                right: 12px;
                top: 12px;
            }

            body.component-3d-panel-mode-fixed-length-piece .viewport-overlay {
                top: 12px;
                left: 12px;
                right: 12px;
                flex-direction: column;
                gap: 12px;
            }

            body.component-3d-panel-mode-fixed-length-piece .viewport-card,
            body.component-3d-panel-mode-fixed-length-piece .viewport-metrics {
                max-width: 100%;
                min-width: 0;
                width: 100%;
            }

            body.component-3d-panel-mode-fixed-length-piece .viewport-display-toggle {
                top: 12px;
                right: 12px;
            }

            #sidebar-resizer {
                display: none;
            }
        }

        @media (max-width: 720px) {
            .toolbar-btn {
                font-size: 10px;
                min-height: 34px;
                padding: 6px 10px;
            }

            .toolbar-label-desktop {
                display: none;
            }

            .toolbar-label-mobile {
                display: inline;
            }

            .toolbar-tab {
                min-height: 34px;
                padding: 6px 10px;
            }

            .toolbar-input {
                min-width: 90px;
            }

            .toolbar-tab.section-gap-before {
                margin-left: 10px;
            }

            .mobile-move-axis-legend {
                margin-left: 36px;
            }

            .mobile-move-axis-legend__label {
                display: none;
            }

            .mobile-move-axis-btn {
                width: 28px;
                height: 28px;
                min-width: 28px;
                min-height: 28px;
            }

            .mobile-move-axis-btn__label {
                font-size: 10px;
            }
        }

        @media (max-width: 480px) {
            #toolbar-panel-camera.toolbar-panel.active {
                display: grid;
                grid-template-columns: repeat(8, minmax(0, 1fr));
                gap: 2px;
                overflow-x: visible;
            }

            #toolbar-panel-camera > .toolbar-btn {
                width: 100%;
                min-width: 0;
                padding: 4px 2px;
                font-size: 9px;
                line-height: 1.1;
            }

            .viewer-display-popover {
                gap: 8px;
            }

            .viewer-display-popover__panel {
                min-width: 148px;
                padding: 8px;
            }
        }

        @media (max-width: 880px) {
            .editor-grid.columns-3,
            .editor-grid.columns-2,
            .editor-grid.columns-4 {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 900px) {
            #rotate-value-control,
            #translate-value-control,
            #measure-value-control {
                display: none !important;
            }

            #controls {
                position: absolute;
                top: 0;
                left: 0;
                width: min(86vw, 380px);
                max-width: calc(100vw - 44px);
                height: 100%;
                padding: 0;
                border-right: 1px solid var(--border);
                border-bottom: none;
                box-shadow: 18px 0 42px rgba(0, 0, 0, 0.38);
                transform: translateX(-100%);
                transition: transform 0.28s ease, box-shadow 0.28s ease;
                will-change: transform;
                z-index: 220;
                overscroll-behavior: contain;
            }

            #container.mobile-controls-open #controls {
                transform: translateX(0);
            }

            .sidebar-header-3d {
                padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 16px;
            }

            .sidebar-body-3d {
                padding: 16px;
                padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
            }

            #container.mobile-controls-dragging #controls,
            #container.mobile-controls-dragging #controls-backdrop,
            #container.mobile-controls-dragging #mobile-sidebar-handle {
                transition: none !important;
            }

            #controls-backdrop {
                position: absolute;
                inset: 0;
                display: block;
                background: rgba(7, 12, 18, 0.62);
                opacity: 0;
                pointer-events: none;
                transition: opacity 0.24s ease;
                z-index: 210;
            }

            #container.mobile-controls-open #controls-backdrop {
                opacity: 1;
                pointer-events: auto;
            }

            #mobile-sidebar-handle {
                position: absolute;
                top: calc(env(safe-area-inset-top, 0px) + var(--mobile-toolbar-height) + var(--mobile-floating-controls-gap));
                left: var(--mobile-sidebar-handle-peek);
                width: var(--mobile-sidebar-handle-width);
                height: 108px;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 6px;
                padding: 10px 2px;
                border: 1px solid rgba(126, 181, 255, 0.88);
                border-left: none;
                border-radius: 0 12px 12px 0;
                background: linear-gradient(180deg, rgba(74, 158, 255, 0.9), rgba(56, 123, 212, 0.9));
                box-shadow: 6px 0 16px rgba(13, 31, 52, 0.22);
                color: #eef6ff;
                transform: translateX(calc(-1 * var(--mobile-sidebar-handle-peek)));
                transition: transform 0.28s ease, background 0.2s ease, box-shadow 0.2s ease;
                z-index: 230;
                touch-action: none;
                user-select: none;
                -webkit-user-select: none;
            }

            #mobile-sidebar-handle:hover,
            #mobile-sidebar-handle:focus-visible {
                background: linear-gradient(180deg, rgba(94, 173, 255, 0.94), rgba(66, 135, 221, 0.94));
                box-shadow: 8px 0 18px rgba(13, 31, 52, 0.28);
            }

            #container.mobile-controls-open #mobile-sidebar-handle {
                transform: translateX(var(--mobile-sidebar-handle-open-shift));
            }

            #mobile-manual-entry-sheet {
                position: fixed;
                left: 12px;
                right: 12px;
                bottom: calc(env(safe-area-inset-bottom, 0px) + 12px + var(--mobile-manual-entry-offset));
                display: block;
                opacity: 0;
                pointer-events: none;
                transform: translateY(calc(100% + 24px));
                transition: transform 0.24s ease, opacity 0.24s ease, bottom 0.18s ease;
                z-index: 310;
            }

            #container.mobile-manual-entry-open #mobile-manual-entry-sheet {
                opacity: 1;
                transform: translateY(0);
            }

            #canvas-container {
                width: 100%;
                height: 100%;
                flex: 1 1 auto;
            }

            #sidebar-resizer {
                display: none;
            }

            #animation-toolbar {
                gap: 6px;
                top: calc(env(safe-area-inset-top, 0px) + 12px);
                left: 12px;
                right: 12px;
                padding-left: 0;
                padding-right: 0;
            }

            #animation-toolbar .toolbar-input {
                font-size: 16px;
                min-height: 36px;
            }

            .viewer-display-popover {
                top: calc(env(safe-area-inset-top, 0px) + var(--mobile-toolbar-height) + var(--mobile-floating-controls-gap));
                right: 12px;
            }

            .toolbar-tab-row {
                gap: 6px;
                padding: 8px;
                border-radius: 16px;
            }

            .toolbar-tab-list {
                gap: 6px;
            }

            .toolbar-quick-actions {
                gap: 4px;
            }

            .toolbar-quick-actions .toolbar-btn {
                min-width: 60px;
                padding: 8px 10px;
            }

            .toolbar-panel {
                gap: 6px;
            }

            .toolbar-panel.active {
                flex-wrap: nowrap;
                overflow-x: auto;
                overflow-y: hidden;
                -webkit-overflow-scrolling: touch;
            }

            #animation-toolbar .toolbar-panel.active > .toolbar-btn,
            #animation-toolbar .toolbar-panel.active > .toolbar-axis-group,
            #animation-toolbar .toolbar-panel.active > .rotate-value-control,
            #animation-toolbar .toolbar-panel.active > .translate-value-control,
            #animation-toolbar .toolbar-panel.active > .measure-value-control {
                flex: 0 0 auto;
            }

            .toolbar-tab {
                min-height: 28px;
                padding: 5px 6px;
                letter-spacing: 0.05em;
            }

            .selection-actions {
                flex-wrap: wrap;
            }

            .button-group {
                grid-template-columns: 1fr !important;
            }

            #toggle-coordinate-space {
                top: calc(
                    env(safe-area-inset-top, 0px)
                    + var(--mobile-toolbar-height)
                    + var(--mobile-floating-controls-gap)
                    + var(--mobile-floating-controls-stagger)
                );
                left: 12px;
                min-width: 138px;
                padding: 9px 12px;
            }

            #toggle-coordinate-space [data-coordinate-space-label] {
                font-size: 9px;
            }

            #toggle-coordinate-space [data-coordinate-space-value] {
                font-size: 14px;
            }

            #info {
                left: 12px;
                right: auto;
                bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
                width: fit-content;
                max-width: min(320px, calc(100% - 24px));
                padding: 12px 14px;
                font-size: 12px;
            }

            #info .info-help-btn {
                width: 28px;
                height: 28px;
                font-size: 16px;
            }

            #info .info-tip-group--desktop {
                display: none;
            }

            #info .info-tip-group--mobile {
                display: block;
            }
        }

/* Source: component-3d.php */
:root {
            color-scheme: dark;
            --sidebar-width: 400px;
            --desktop-min-viewport-width: 600px;
            --bg: #0f141b;
            --bg-elevated: #18212b;
            --bg-panel: rgba(20, 29, 39, 0.96);
            --bg-panel-alt: rgba(26, 38, 50, 0.92);
            --border: #324355;
            --border-soft: rgba(126, 154, 184, 0.22);
            --text: #e7f0f8;
            --text-soft: #a8bacb;
            --accent: #79b7ff;
            --accent-strong: #4a98ff;
            --accent-warm: #d28f4c;
            --danger: #ff7f7f;
            --success: #7fd5ab;
            --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
            --radius: 16px;
        }

        * {
            box-sizing: border-box;
        }

        [hidden] {
            display: none !important;
        }

        html,
        body {
            margin: 0;
            min-height: 100%;
            background:
                radial-gradient(circle at top left, rgba(74, 152, 255, 0.12), transparent 36%),
                radial-gradient(circle at bottom right, rgba(210, 143, 76, 0.12), transparent 28%),
                linear-gradient(180deg, #0d1218 0%, #101820 100%);
            color: var(--text);
            font-family: "Segoe UI", Arial, sans-serif;
        }

        body {
            overflow: hidden;
        }

        #app-shell {
            display: grid;
            grid-template-columns: minmax(320px, var(--sidebar-width, 400px)) 10px minmax(var(--desktop-min-viewport-width, 600px), 1fr);
            width: 100vw;
            height: 100vh;
        }

        #app-shell.component3d-shell--stacked {
            display: flex;
            flex-direction: column;
            width: 100%;
            min-height: 100vh;
            min-height: 100svh;
            height: auto;
        }

        .sidebar-3d {
            position: relative;
            display: flex;
            flex-direction: column;
            min-height: 0;
            background: linear-gradient(180deg, rgba(16, 23, 31, 0.98), rgba(22, 33, 44, 0.98));
            border-right: 1px solid var(--border);
            box-shadow: var(--shadow);
            z-index: 2;
        }

        #sidebar-resizer {
            position: relative;
            width: 10px;
            height: 100%;
            cursor: col-resize;
            background: linear-gradient(180deg, rgba(26, 34, 44, 0.95), rgba(18, 24, 32, 0.95));
            border-right: 1px solid #263240;
            border-left: 1px solid #10161d;
            z-index: 3;
        }

        #sidebar-resizer::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 3px;
            height: 56px;
            border-radius: 2px;
            transform: translate(-50%, -50%);
            background: linear-gradient(180deg, #7f9ec0 0%, #4f6b86 100%);
            opacity: 0.85;
        }

        #sidebar-resizer:hover::before,
        #sidebar-resizer:focus-visible::before {
            background: linear-gradient(180deg, #9bc8ff 0%, #6e9fd4 100%);
            opacity: 1;
        }

        #sidebar-resizer:focus-visible {
            outline: 2px solid #7eb5ff;
            outline-offset: -2px;
        }

        #app-shell.component3d-shell--stacked #sidebar-resizer {
            display: none;
        }

        .sidebar-header-3d {
            padding: 24px 24px 18px;
            border-bottom: 1px solid var(--border-soft);
            background: linear-gradient(180deg, rgba(30, 45, 60, 0.75), rgba(18, 27, 36, 0.2));
        }

        .sidebar-header-3d h1 {
            margin: 0;
            font-size: 26px;
            letter-spacing: 0.02em;
        }

        .sidebar-header-3d p {
            margin: 8px 0 0;
            max-width: 34ch;
            font-size: 13px;
            line-height: 1.45;
            color: var(--text-soft);
        }

        .sidebar-body-3d {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            padding: 22px;
        }

        .sidebar-3d > .sidebar-body {
            flex: 1 1 auto;
            min-height: 0;
            overflow-x: hidden;
            overflow-y: auto;
            scrollbar-gutter: stable;
            padding: 22px;
        }

        #app-shell.component3d-shell--stacked .sidebar-3d {
            min-height: auto;
            overflow: visible;
            border-right: none;
            border-bottom: 1px solid var(--border);
            box-shadow: none;
        }

        #app-shell.component3d-shell--stacked .sidebar-3d > .sidebar-body,
        #app-shell.component3d-shell--stacked .sidebar-body-3d {
            overflow: visible;
            min-height: auto;
        }

        .panel {
            margin-bottom: 18px;
            padding: 16px;
            border: 1px solid var(--border-soft);
            border-radius: var(--radius);
            background: linear-gradient(180deg, rgba(23, 34, 44, 0.96), rgba(17, 25, 33, 0.96));
        }

        .collapsible-panel {
            padding: 0;
            overflow: hidden;
        }

        .collapsible-panel[open] {
            border-color: rgba(121, 183, 255, 0.22);
        }

        .collapsible-summary {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 16px;
            cursor: pointer;
            list-style: none;
        }

        .collapsible-summary::-webkit-details-marker {
            display: none;
        }

        .collapsible-summary::after {
            content: '+';
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 999px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            background: rgba(35, 52, 68, 0.5);
            color: var(--text-soft);
            font-size: 16px;
            font-weight: 700;
            line-height: 1;
            flex-shrink: 0;
        }

        .collapsible-panel[open] .collapsible-summary::after {
            content: '\2212';
            color: var(--accent);
        }

        .collapsible-panel[open] .collapsible-summary {
            border-bottom: 1px solid rgba(126, 154, 184, 0.14);
        }

        .collapsible-content {
            padding: 0 16px 16px;
        }

        .panel h2 {
            margin: 0 0 12px;
            font-size: 12px;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: #9bb7d3;
        }

        .button-row {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }

        .button-row.file-actions {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            align-items: center;
        }

        .button-row.embed-actions {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        button,
        .button-link,
        select,
        input,
        textarea {
            font: inherit;
        }

        button,
        .button-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 42px;
            padding: 10px 14px;
            border: 1px solid transparent;
            border-radius: 12px;
            background: linear-gradient(180deg, var(--accent), var(--accent-strong));
            color: #08131f;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            transition: transform 0.14s ease, filter 0.14s ease, background 0.14s ease;
            text-decoration: none;
        }

        button:hover,
        .button-link:hover {
            filter: brightness(1.06);
            transform: translateY(-1px);
        }

        button.secondary,
        .button-link.secondary {
            background: linear-gradient(180deg, rgba(69, 86, 104, 0.95), rgba(47, 61, 76, 0.95));
            color: var(--text);
            border-color: rgba(122, 146, 170, 0.32);
        }

        button.ghost {
            background: rgba(35, 52, 68, 0.55);
            color: var(--text);
            border-color: rgba(122, 146, 170, 0.3);
        }

        button.warm {
            background: linear-gradient(180deg, #e1a262, #c77e39);
            color: #1b0f04;
        }

        button:disabled {
            cursor: not-allowed;
            filter: grayscale(0.2);
            opacity: 0.6;
            transform: none;
        }

        .file-input {
            position: absolute;
            width: 1px;
            height: 1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            clip-path: inset(50%);
            white-space: nowrap;
        }

        .stack {
            display: grid;
            gap: 12px;
        }

        .field-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .field-grid.columns-3 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .field-grid.columns-4 {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        .coating-button-row {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        .coating-option-btn.active {
            background: linear-gradient(180deg, var(--accent), var(--accent-strong));
            color: #08131f;
            border-color: transparent;
        }

        .field {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .field.full {
            grid-column: 1 / -1;
        }

        .field label {
            font-size: 11px;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-soft);
        }

        .field input,
        .field select,
        .field textarea {
            width: 100%;
            min-height: 42px;
            padding: 10px 12px;
            border-radius: 12px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            background: rgba(7, 12, 17, 0.42);
            color: var(--text);
        }

        .field input[type="color"] {
            padding: 6px;
            min-height: 44px;
        }

        .field textarea {
            min-height: 180px;
            resize: vertical;
            font-family: Consolas, "Courier New", monospace;
            font-size: 12px;
            line-height: 1.45;
        }

        .field input[readonly],
        .field textarea[readonly] {
            background: rgba(17, 24, 31, 0.85);
            color: #c8d6e4;
        }

        .helper {
            font-size: 12px;
            line-height: 1.45;
            color: var(--text-soft);
        }

        .status-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 12px;
        }

        .pill {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            min-height: 30px;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid var(--border-soft);
            background: rgba(20, 31, 42, 0.88);
            color: #d9e6f3;
            font-size: 11px;
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }

        .pill strong {
            color: var(--accent);
        }

        .message-box {
            display: none;
            margin-top: 12px;
            padding: 12px 14px;
            border-radius: 12px;
            font-size: 13px;
            line-height: 1.45;
        }

        .message-box.visible {
            display: block;
        }

        .message-box.error {
            background: rgba(118, 32, 32, 0.28);
            border: 1px solid rgba(255, 127, 127, 0.4);
            color: #ffd8d8;
        }

        .message-box.success {
            background: rgba(39, 96, 73, 0.28);
            border: 1px solid rgba(127, 213, 171, 0.35);
            color: #d7ffee;
        }

        #embed-action-row[hidden] {
            display: none !important;
        }

        .validation-list {
            margin: 0;
            padding-left: 18px;
            display: grid;
            gap: 7px;
            color: #ffd7d7;
            font-size: 12px;
        }

        .validation-list:empty::before {
            content: 'No validation issues.';
            display: block;
            color: var(--success);
            font-size: 12px;
        }

        .drill-list {
            display: grid;
            gap: 12px;
        }

        .drill-card {
            padding: 14px;
            border-radius: 14px;
            border: 1px solid rgba(121, 183, 255, 0.16);
            background: linear-gradient(180deg, rgba(26, 39, 51, 0.94), rgba(19, 28, 37, 0.94));
        }

        .drill-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 12px;
        }

        .drill-card-title {
            margin: 0;
            font-size: 13px;
            font-weight: 700;
            color: #dce9f6;
        }

        .drill-empty {
            padding: 14px;
            border-radius: 12px;
            border: 1px dashed rgba(122, 146, 170, 0.32);
            color: var(--text-soft);
            font-size: 12px;
            text-align: center;
        }

        .viewport-shell {
            position: relative;
            min-width: 0;
            min-height: 0;
            --viewport-toolbar-offset: 0px;
            background:
                linear-gradient(180deg, rgba(8, 12, 17, 0.35), rgba(8, 12, 17, 0.75)),
                radial-gradient(circle at top, rgba(121, 183, 255, 0.1), transparent 34%),
                linear-gradient(180deg, #121a22 0%, #0f151c 100%);
        }

            #app-shell.component3d-shell--stacked .viewport-shell {
                order: 2;
                min-height: 52vh;
                min-height: 52svh;
                height: 52vh;
                height: 52svh;
            }

        .viewport-canvas {
            position: absolute;
            inset: 0;
        }

        #animation-toolbar {
            --toolbar-option-control-height: 32px;
            position: absolute;
            top: 18px;
            left: 18px;
            right: 18px;
            z-index: 4;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .toolbar-tab-row {
            display: flex;
            align-items: center;
            gap: 10px;
            width: 100%;
            min-width: 0;
            padding: 10px;
            border-radius: 18px;
            border: 1px solid rgba(121, 183, 255, 0.16);
            background: rgba(14, 21, 29, 0.84);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
            backdrop-filter: blur(10px);
            pointer-events: auto;
        }

        .toolbar-tab-list {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1 1 auto;
            min-width: 0;
            overflow-x: auto;
            overflow-y: hidden;
            scrollbar-width: thin;
        }

        .toolbar-tab-list::-webkit-scrollbar,
        .toolbar-panel::-webkit-scrollbar {
            height: 6px;
        }

        .toolbar-tab-list::-webkit-scrollbar-thumb,
        .toolbar-panel::-webkit-scrollbar-thumb {
            background: rgba(127, 158, 192, 0.65);
            border-radius: 999px;
        }

        .toolbar-tab {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
            min-height: 40px;
            padding: 10px 14px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            border-radius: 12px;
            background: rgba(35, 52, 68, 0.7);
            color: var(--text);
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            white-space: nowrap;
            user-select: none;
            cursor: pointer;
            box-shadow: none;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
        }

        .toolbar-tab:hover {
            background: rgba(55, 77, 98, 0.82);
            color: var(--text);
            transform: translateY(-1px);
        }

        .toolbar-tab.active {
            background: linear-gradient(180deg, #e1a262, #c77e39);
            border-color: transparent;
            color: #1b0f04;
        }

        .toolbar-panel-row {
            display: none;
            width: 100%;
            min-width: 0;
            align-items: center;
            gap: 10px;
            padding: 10px;
            border-radius: 18px;
            border: 1px solid rgba(121, 183, 255, 0.16);
            background: rgba(14, 21, 29, 0.84);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
            backdrop-filter: blur(10px);
            pointer-events: auto;
        }

        .toolbar-panel-row.has-active-panel {
            display: flex;
        }

        .toolbar-panel {
            display: none;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
            width: 100%;
            min-width: 0;
            padding: 0;
            border: none;
            border-radius: 0;
            background: transparent;
            box-shadow: none;
            overflow-x: auto;
            overflow-y: hidden;
            scrollbar-width: thin;
        }

        .toolbar-panel.active {
            display: flex;
        }

        .toolbar-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 40px;
            padding: 10px 14px;
            border-radius: 12px;
            border: 1px solid rgba(122, 146, 170, 0.28);
            background: rgba(35, 52, 68, 0.7);
            color: var(--text);
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            box-shadow: none;
            transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
        }

        .toolbar-btn:hover {
            background: rgba(55, 77, 98, 0.82);
            transform: translateY(-1px);
        }

        .toolbar-btn.active,
        .toolbar-axis-btn.active {
            background: linear-gradient(180deg, var(--accent), var(--accent-strong));
            color: #08131f;
            border-color: transparent;
        }

        .toolbar-camera-view-btn.active,
        #dimension-linear-btn.active,
        #dimension-angle-btn.active {
            background: linear-gradient(180deg, #e1a262, #c77e39);
            color: #1b0f04;
            border-color: transparent;
        }

        .toolbar-btn.secondary {
            background: rgba(35, 52, 68, 0.52);
            color: var(--text);
        }

        .toolbar-axis-group {
            display: inline-flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
            min-height: 40px;
            padding: 4px 4px 4px 12px;
            border-radius: 14px;
            border: 1px solid rgba(122, 146, 170, 0.18);
            background: rgba(10, 16, 22, 0.34);
        }

        .toolbar-axis-label {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--text-soft);
        }

        .toolbar-axis-buttons {
            display: inline-flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
        }

        .toolbar-axis-btn {
            min-width: 42px;
            min-height: 32px;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid rgba(122, 146, 170, 0.24);
            background: rgba(35, 52, 68, 0.58);
            color: var(--text);
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            cursor: pointer;
        }

        .toolbar-axis-btn:hover {
            background: rgba(55, 77, 98, 0.82);
        }

        .viewport-overlay {
            position: absolute;
            top: calc(18px + var(--viewport-toolbar-offset));
            left: 18px;
            right: 18px;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 18px;
            pointer-events: none;
        }

        .viewport-display-toggle {
            position: absolute;
            top: calc(18px + var(--viewport-toolbar-offset));
            right: 18px;
            z-index: 5;
            width: 42px;
            height: 42px;
            border: 1px solid rgba(178, 207, 235, 0.3);
            border-radius: 12px;
            background: linear-gradient(180deg, rgba(20, 31, 44, 0.96), rgba(13, 21, 31, 0.94));
            box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
        }

        .viewport-display-toggle:hover {
            background: linear-gradient(180deg, rgba(28, 43, 60, 0.98), rgba(18, 29, 41, 0.96));
            border-color: rgba(178, 207, 235, 0.5);
            transform: translateY(-1px);
        }

        .viewport-display-toggle[aria-pressed="true"] {
            border-color: rgba(96, 239, 166, 0.5);
            background: linear-gradient(180deg, rgba(27, 58, 43, 0.98), rgba(16, 35, 27, 0.96));
        }

        .viewport-display-toggle__icon {
            position: relative;
            width: 18px;
            height: 14px;
            display: inline-block;
        }

        .viewport-display-toggle__icon-line {
            position: absolute;
            left: 0;
            width: 100%;
            height: 2px;
            border-radius: 999px;
            background: #e5f1ff;
        }

        .viewport-display-toggle__icon-line:nth-child(1) {
            top: 1px;
        }

        .viewport-display-toggle__icon-line:nth-child(2) {
            top: 6px;
        }

        .viewport-display-toggle__icon-line:nth-child(3) {
            top: 11px;
        }

        .viewport-card {
            max-width: min(420px, calc(100% - 36px));
            min-width: 200px;
            padding: 14px 16px;
            border-radius: 16px;
            background: rgba(14, 21, 29, 0.84);
            border: 1px solid rgba(121, 183, 255, 0.2);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
            backdrop-filter: blur(10px);
            pointer-events: auto;
        }

        .viewport-tool-status {
            margin-top: 10px;
            font-size: 12px;
            color: var(--text-soft);
        }

        .viewport-card h3 {
            margin: 0 0 6px;
            font-size: 17px;
        }

        .viewport-card p {
            margin: 0;
            color: var(--text-soft);
            font-size: 13px;
            line-height: 1.45;
        }

        .viewport-metrics {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            min-width: 280px;
        }

        .viewport-metrics.is-hidden {
            display: none !important;
        }

        .metric {
            padding: 12px 14px;
            border-radius: 14px;
            background: rgba(14, 21, 29, 0.84);
            border: 1px solid rgba(121, 183, 255, 0.16);
            backdrop-filter: blur(10px);
        }

        .metric span {
            display: block;
            font-size: 11px;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--text-soft);
        }

        .metric strong {
            display: block;
            margin-top: 6px;
            font-size: 18px;
            color: #ecf5ff;
        }

        .loading-indicator {
            display: none;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            color: #cbd9e7;
        }

        .loading-indicator.visible {
            display: inline-flex;
        }

        .spinner {
            width: 14px;
            height: 14px;
            border-radius: 999px;
            border: 2px solid rgba(121, 183, 255, 0.24);
            border-top-color: var(--accent);
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        @media (max-width: 1080px) {
            #app-shell {
                grid-template-columns: minmax(320px, var(--sidebar-width, 400px)) 10px minmax(var(--desktop-min-viewport-width, 600px), 1fr);
            }

            .viewport-overlay {
                flex-direction: column;
            }

            .viewport-metrics {
                grid-template-columns: repeat(4, minmax(0, 1fr));
                min-width: 0;
                width: 100%;
            }
        }

        @media (max-width: 900px) {
            body {
                overflow-x: hidden;
                overflow-y: auto;
            }

            #app-shell {
                display: flex;
                flex-direction: column;
                width: 100%;
                min-height: 100vh;
                min-height: 100svh;
                height: auto;
            }

            #sidebar-resizer {
                display: none;
            }

            .sidebar-3d {
                min-height: auto;
                overflow: visible;
                border-right: none;
                border-bottom: 1px solid var(--border);
                box-shadow: none;
            }

            .sidebar-3d > .sidebar-body,
            .sidebar-body-3d {
                overflow: visible;
                min-height: auto;
            }

            .viewport-shell {
                order: 2;
                min-height: 52vh;
                min-height: 52svh;
                height: 52vh;
                height: 52svh;
            }

            #app-shell #animation-toolbar,
            #app-shell .viewport-metrics,
            #app-shell .viewport-display-toggle {
                display: none;
            }

            .viewport-overlay {
                top: 18px;
            }

            .field-grid,
            .field-grid.columns-3,
            .button-row,
            .viewport-metrics {
                grid-template-columns: 1fr;
            }
        }

        #container #toolbar-panel-camera > .toolbar-btn {
            flex: 0 0 auto;
            width: auto;
            min-width: 0;
        }

