/* --- ALYSSIUN CROSS-PLATFORM CORE --- */
:root {
    --vh: 1vh; /* Dynamic viewport unit for iOS Safari */
}

html, body { 
    margin: 0; padding: 0; 
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    width: 100%; 
    overflow: hidden; 
    font-family: 'Segoe UI', sans-serif; 
    background: #121212; 
    color: #e0e0e0; 
    display: flex; 
    flex-direction: column; 
    user-select: none; 
    font-size: 12px; 
    -webkit-tap-highlight-color: transparent;
    touch-action: none; /* UI elements will override this with pan-y */
}
::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: #1e1e1e; } ::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* --- TOP MENU REFINED --- */
#top-menu-bar { 
    height: 45px; 
    background: #050505; 
    border-bottom: 1px solid #111; 
    display: flex; 
    align-items: center; 
    padding: 0 20px; 
    flex-shrink: 0; 
    z-index: 5000; 
    justify-content: space-between; 
}
.menu-logo { font-weight: 800; color: white; letter-spacing: 2px; font-size: 14px; font-family: 'Orbitron', sans-serif; transition: all 0.2s ease; } 
.menu-logo:hover { color: #4fc1ff; filter: drop-shadow(0 0 8px rgba(79, 193, 255, 0.4)); }
.menu-logo span { color: #4fc1ff; font-weight: 300; }

#main-hamburger-toggle {
    background: none; border: none; color: #888; cursor: pointer;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    transition: color 0.2s;
}
#main-hamburger-toggle:hover { color: #fff; }

/* --- CINEMATIC OVERLAY --- */
#menu-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 5500; opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
}
body.menu-open #menu-overlay { opacity: 1; pointer-events: auto; }

/* --- SLIDE-OUT MENU --- */
#main-hamburger-menu {
    position: fixed; top: 0; right: -320px; width: 320px; height: 100%;
    background: #050505; z-index: 6000; border-left: 1px solid #1a1a1a;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; flex-direction: column;
}
#main-hamburger-menu.active { right: 0; box-shadow: -40px 0 80px rgba(0,0,0,0.9); }

.hamburger-header { padding: 25px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #111; }
.close-menu { background: none; border: none; color: #444; font-size: 20px; cursor: pointer; transition: color 0.2s; }
.close-menu:hover { color: #ff4444; }

.hamburger-content { 
    flex: 1; overflow-y: auto; padding: 25px 20px; 
    scrollbar-width: thin; scrollbar-color: #222 transparent;
}
.hamburger-content::-webkit-scrollbar { width: 4px; }
.hamburger-content::-webkit-scrollbar-thumb { background: #222; border-radius: 10px; }

.menu-section { margin-bottom: 35px; }
.section-title { font-size: 9px; color: #4fc1ff; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 18px; font-weight: bold; opacity: 0.8; }

/* Unified 2x2 Grid */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.h-btn { 
    background: #0a0a0a; border: 1px solid #222; color: #999; 
    padding: 12px 0; border-radius: 2px; font-size: 10px; 
    text-transform: uppercase; cursor: pointer; transition: 0.3s; 
    text-align: center; text-decoration: none; font-weight: 600;
    letter-spacing: 1px;
    width: 100%; /* ALYSSIUN PROTOCOL: Ensure full-width for stacked actions */
    display: block;
    box-sizing: border-box;
}
.h-btn:hover { border-color: #fff; color: #fff; background: #111; }
.h-btn.publish { border-color: #4fc1ff44; color: #4fc1ff; }
.h-btn.enter { border-color: #10b98144; color: #10b981; }
.h-btn.donate { border-color: #ffd70044; color: #ffd700; }

/* --- VERTICAL MENU DESIGN --- */
.menu-category {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}

.category-label {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.menu-list-item {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    text-align: left;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    display: block;
    border-bottom: 1px solid transparent;
}

.menu-list-item {
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
}

.menu-list-item:hover {
    color: #fff;
    padding-left: 15px;
    background: rgba(79, 193, 255, 0.1);
    border-left: 2px solid #4fc1ff;
}

.add-cat-label {
    font-size: 9px; 
    color: #4fc1ff; 
    padding: 12px 15px 6px 15px; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    font-weight: bold; 
    opacity: 0.8;
}

#add-menu-list::-webkit-scrollbar { width: 4px; }
#add-menu-list::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }

#hierarchy-add-btn:hover {
    background: #1177bb !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 99, 156, 0.6) !important;
}

#hierarchy-add-btn:active {
    transform: translateY(0);
}

/* Re-styling the Grid for vertical harmony */
.action-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    margin-bottom: 20px;
}

.h-btn {
    padding: 14px 0 !important;
    border-radius: 4px !important;
    background: #080808 !important;
}

.menu-footer { border-top: 1px solid #222; padding-top: 20px; margin-top: auto; display: flex; flex-direction: column; gap: 15px; }
.donate-link { color: #ffd700; text-decoration: none; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.exit-btn { background: #1a1a1a; border: 1px solid #333; color: #666; padding: 12px; border-radius: 4px; cursor: pointer; font-size: 10px; letter-spacing: 1px; }

/* --- UNIFIED EXPERIENCE TOGGLE --- */
#mode-switcher-container {
    display: inline-flex;
    margin-left: 15px;
}

.mode-toggle-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid #333;
    padding: 4px 12px; /* Reduced for menu flow */
    border-radius: 4px; /* Squared to match menu style */
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #888;
    display: flex;
    align-items: center;
    min-width: 110px; /* Slimmer for clean UI */
    justify-content: center;
}

.mode-toggle-btn span { opacity: 0.6; font-weight: normal; }
.mode-toggle-btn strong { color: #fff; }

/* Easy Mode Visual State */
.mode-toggle-btn.easy-active:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* Master Mode Visual State */
.mode-toggle-btn.master-active {
    background: rgba(79, 193, 255, 0.05);
    border-color: #4fc1ff;
}

.mode-toggle-btn.master-active:hover {
    background: rgba(79, 193, 255, 0.15);
    box-shadow: 0 0 15px rgba(79, 193, 255, 0.3);
}

.mode-toggle-btn:active { transform: scale(0.96); }

/* --- WORKSPACE --- */
#workspace { display: flex; flex-grow: 1; overflow: hidden; position: relative; width: 100%; height: calc(100% - 35px); background: #121212; }
#sidebar-left { width: 260px; background: #1e1e1e; display: flex; flex-direction: column; flex-shrink: 0; z-index: 10; border-right: 1px solid #000; }
#sidebar-right { width: 320px; background: #1e1e1e; display: flex; flex-direction: column; flex-shrink: 0; z-index: 10; border-left: 1px solid #000; }
#asset-browser { height: 280px; background: #1e1e1e; display: flex; flex-direction: column; flex-shrink: 0; z-index: 10; border-top: 1px solid #000; }
#center-area { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; position: relative; }
#main-view { flex-grow: 1; position: relative; overflow: hidden; background: #0a0a0a; }

/* --- HIDDEN UI (IMMERSIVE MODE - Used by Easy Mode) --- */
/* Ensure sidebars are full height and top-aligned when revealed in Hidden Mode */
body.hidden-ui #sidebar-left,
body.hidden-ui #sidebar-right {
    top: 0 !important;
    height: 100% !important;
    /* When hidden, they float. When shown via JS hover, they overlay canvas */
}

/* Hide panels by default in Hidden Mode (revealed by JS hover logic) */
body.hidden-ui #sidebar-left,
body.hidden-ui #sidebar-right,
body.hidden-ui #asset-browser,
body.hidden-ui .resizer-v,
body.hidden-ui .resizer-h-desktop,
body.hidden-ui .resizer-h {
    display: none !important;
}

.panel-header { height: 32px; background: #252526; border-bottom: 1px solid #000; display: flex; align-items: center; padding: 0 10px; font-weight: 700; color: #ccc; font-size: 11px; letter-spacing: 0.5px; justify-content: space-between; position: relative; }

/* ALYSSIUN PROTOCOL: Immersive Pin System */
.panel-pin-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #0e639c;
    border-radius: 3px;
    z-index: 2100;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
}

body.hidden-ui .panel-pin-btn { display: flex; }
.panel-pin-btn svg { width: 12px; height: 12px; fill: #fff; transform: rotate(45deg); transition: transform 0.3s; }
.panel-pin-btn.pinned { background: #4fc1ff; box-shadow: 0 0 15px rgba(79, 193, 255, 0.4); }
.panel-pin-btn.pinned svg { transform: rotate(0deg); }

/* Placement Outside Corners */
#pin-left { top: 6px; right: -28px; }
#pin-right { top: 6px; left: -28px; }
#pin-bottom { top: -28px; right: 10px; }

/* ALYSSIUN PROTOCOL: Pinned panels remain overlays to prevent canvas resizing */
body.hidden-ui #sidebar-left.pinned-active,
body.hidden-ui #sidebar-right.pinned-active,
body.hidden-ui #asset-browser.pinned-active {
    display: flex !important;
    position: absolute !important;
    z-index: 2000;
}

/* ALYSSIUN PROTOCOL: Immersive Pin System */
.panel-pin-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    display: none; /* Only visible in Immersive Mode */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #0e639c;
    border-radius: 3px;
    z-index: 2100;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

body.hidden-ui .panel-pin-btn { display: flex; }
.panel-pin-btn svg { width: 12px; height: 12px; fill: #fff; transform: rotate(45deg); transition: transform 0.3s; }
.panel-pin-btn.pinned { background: #4fc1ff; box-shadow: 0 0 15px rgba(79, 193, 255, 0.4); }
.panel-pin-btn.pinned svg { transform: rotate(0deg); }

/* Placement relative to panel corners */
#pin-left { top: 6px; right: -28px; }
#pin-right { top: 6px; left: -28px; }
#pin-bottom { top: -28px; right: 10px; }

/* ALYSSIUN PROTOCOL: Sidebar Pin System */
.panel-pin-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    display: none; /* Only visible in Hidden UI mode */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #0e639c;
    border-radius: 3px;
    z-index: 2100;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

body.hidden-ui .panel-pin-btn { display: flex; }
.panel-pin-btn svg { width: 12px; height: 12px; fill: #fff; transform: rotate(45deg); transition: transform 0.3s; }
.panel-pin-btn.pinned { background: #4fc1ff; box-shadow: 0 0 15px rgba(79, 193, 255, 0.4); }
.panel-pin-btn.pinned svg { transform: rotate(0deg); }

/* Placement Outside Corners */
#pin-left { top: 6px; right: -28px; }
#pin-right { top: 6px; left: -28px; }
#pin-bottom { top: -28px; right: 10px; }

/* ALYSSIUN PROTOCOL: Immersive Pin System */
.panel-pin-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #0e639c;
    border-radius: 3px;
    z-index: 2100;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
}

body.hidden-ui .panel-pin-btn { display: flex; }
.panel-pin-btn svg { width: 12px; height: 12px; fill: #fff; transform: rotate(45deg); transition: transform 0.3s; }
.panel-pin-btn.pinned { background: #4fc1ff; box-shadow: 0 0 15px rgba(79, 193, 255, 0.4); }
.panel-pin-btn.pinned svg { transform: rotate(0deg); }

/* Placement Outside Corners */
#pin-left { top: 6px; right: -28px; }
#pin-right { top: 6px; left: -28px; }
#pin-bottom { top: -28px; right: 10px; }

/* Structural Pin Behavior: Pinned panels push the canvas to maintain centering */
body.hidden-ui #sidebar-left.pinned-active,
body.hidden-ui #sidebar-right.pinned-active,
body.hidden-ui #asset-browser.pinned-active {
    display: flex !important;
    position: relative !important;
    box-shadow: none !important;
    top: 0 !important;
}
.panel-toolbar { 
    padding: 10px; 
    background: #050505; 
    border-bottom: 1px solid #1a1a1a; 
    flex-shrink: 0;
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box;
}
.search-input { 
    background: #000 !important; 
    border: 1px solid #222 !important; 
    color: #fff !important; 
    padding: 8px 12px !important; 
    border-radius: 4px !important; 
    width: 100% !important; 
    flex: 1 1 100% !important; /* Forces absolute expansion */
    box-sizing: border-box !important; 
    font-size: 11px !important;
    transition: border-color 0.2s, background 0.2s !important;
}
.search-input:focus {
    border-color: #4fc1ff;
    background: #0a0a0a;
    outline: none;
}

/* --- HIERARCHY TREE --- */
#hierarchy-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex-grow: 1; }
#hierarchy-list ul { list-style: none; padding-left: 0px; margin: 0; border-left: 1px dotted #333; margin-left: 5px; }
#hierarchy-list li { padding: 4px 5px; cursor: pointer; display: flex; flex-direction: column; color: #bbb; border: 1px solid transparent; } /* Increased padding */
#hierarchy-list li:hover { background: #2a2d2e; }
#hierarchy-list li.selected { background: #094771; color: white; border-color: #007fd4; }
#hierarchy-list li.drag-over { background: #3a3d3e; border: 1px dashed #4fc1ff; }
.hierarchy-row { display: flex; align-items: center; width: 100%; height: 24px; position: relative; overflow: hidden; } 
.hierarchy-icon { margin-right: 5px; opacity: 0.7; font-size: 14px; color: #4fc1ff; flex-shrink: 0; }
.hierarchy-stat-value {
    font-size: 10px;
    font-family: monospace;
    color: #4fc1ff;
    font-weight: bold;
    letter-spacing: 0.5px;
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
    text-align: right;
    padding-right: 12px;
}
.hierarchy-filter-container {
    padding: 8px 10px;
    background: #050505;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    gap: 6px;
}
.hierarchy-filter-select {
    background: #000;
    border: 1px solid #222;
    color: #4fc1ff;
    font-size: 9px;
    padding: 5px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    flex: 1; /* Allows dropdown to take available space */
    min-width: 0;
}
.hierarchy-add-btn-refined {
    background: #0e639c;
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    height: 26px;
    padding: 0 8px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.hierarchy-add-btn-refined:hover {
    background: #1177bb;
    box-shadow: 0 0 10px rgba(79, 193, 255, 0.3);
}
.hierarchy-add-btn-refined .add-plus {
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    margin-top: -2px;
}
.hierarchy-add-btn-refined .add-text {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.hierarchy-add-btn-compact {
    background: #0e639c;
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}
.hierarchy-add-btn-compact:hover {
    background: #1177bb;
    transform: translateY(-1px);
}
.hierarchy-toggle { cursor: pointer; padding-right: 5px; opacity: 0.5; transition: transform 0.1s; font-size: 18px; flex-shrink: 0; width: 18px; text-align: center; } /* Increased size */
.hierarchy-toggle.collapsed { transform: rotate(-90deg); }

/* UPDATED: Hierarchy Content & Actions Layout */
.hierarchy-content { 
    flex-grow: 1; 
    flex-shrink: 1; /* Allow shrinking */
    font-size: 12px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    min-width: 0; /* Crucial for flexbox truncation */
    margin-right: 5px;
} 

/* Hierarchy Actions (Lock & Menu) - Fixed width, never shrink */
.hierarchy-actions { 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    flex-shrink: 0; /* CRITICAL: Prevents actions from disappearing */
    margin-left: auto; /* Pushes to right */
    background: transparent; 
}

.action-btn { 
    cursor: pointer; 
    padding: 5px; 
    border-radius: 4px; 
    font-size: 18px; 
    opacity: 0.8; 
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    -webkit-tap-highlight-color: transparent;
}
.action-btn:active { transform: scale(0.9); opacity: 1; background: rgba(255,255,255,0.15); }
.action-btn:hover { opacity: 1; background-color: rgba(255,255,255,0.1); }
.lock-btn.locked { color: #ff4444; opacity: 1; }

/* --- VIEWPORT UI --- */
.viewport-ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 0; overflow: visible; z-index: 100; pointer-events: none; }
.viewport-ui-layer > * { pointer-events: auto; }
/* ALYSSIUN PROTOCOL: 4-Panel Unified Viewport Organization */
#top-left-controls { 
    position: absolute; 
    top: 10px; 
    left: calc(10px + var(--pin-offset-left, 0px)); 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3000;
}
#top-right-controls { 
    position: absolute; 
    top: 10px; 
    right: calc(10px + var(--pin-offset-right, 0px)); 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    align-items: flex-end; 
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3000;
}
#bottom-center-controls {
    position: absolute;
    bottom: 20px;
    left: calc(50% + (var(--pin-offset-left, 0px) - var(--pin-offset-right, 0px)) / 2);
    transform: translateX(-50%);
    z-index: 4000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
#bottom-center-controls > * { pointer-events: auto; }

/* ALYSSIUN PROTOCOL: High-Fidelity Focus Button */
#tool-focus {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(10, 10, 15, 0.9);
    border: 2px solid #4fc1ff;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(79, 193, 255, 0.3);
    display: none; /* Controlled by selection state */
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#tool-focus:hover {
    transform: scale(1.1);
    background: #4fc1ff;
    box-shadow: 0 0 30px rgba(79, 193, 255, 0.6);
}

#tool-focus:hover svg { fill: #000; }
#tool-focus:hover {
    background: #4fc1ff !important;
    border-color: #ffffff !important;
    transform: scale(1.1);
}
#camera-speed-panel { background: #252526; padding: 4px 8px; border-radius: 4px; display: none; align-items: center; gap: 5px; font-size: 11px; border: 1px solid #3e3e42; }

/* --- CENTER TOOLBAR --- */
/* ALYSSIUN PROTOCOL: Dynamic Centering relative to remaining canvas width */
#toolbar { 
    position: absolute; 
    top: 10px; 
    /* Offset the 50% center by half the difference of the pinned sidebars */
    left: calc(50% + (var(--pin-offset-left, 0px) - var(--pin-offset-right, 0px)) / 2); 
    transform: translateX(-50%); 
    background: #252526; 
    padding: 4px; 
    border-radius: 4px; 
    display: flex; 
    gap: 4px; 
    border: 1px solid #000; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 4000;
}
.toolbar-sep { width: 1px; background: #444; margin: 0 4px; }

.tool-btn { background: #333; border: 1px solid #444; color: #aaa; padding: 0; cursor: pointer; border-radius: 3px; width: 28px; height: 28px; display: flex; justify-content: center; align-items: center; } .tool-btn:hover { background: #444; color: white; } .tool-btn.active { background: #444; color: #4fc1ff; border-color: #4fc1ff; }

/* --- CAMERA CONTROL PANEL --- */
.cam-settings-panel {
    display: none;
    position: absolute;
    top: 45px;
    right: 0;
    background: #252526;
    border: 1px solid #454545;
    border-radius: 4px;
    padding: 12px;
    z-index: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    width: 220px;
    font-family: 'Segoe UI', sans-serif;
    color: #e0e0e0;
}
.cam-setting-row { margin-bottom: 10px; }
.cam-setting-label { font-size: 11px; color: #aaa; margin-bottom: 4px; display: flex; justify-content: space-between; }
.cam-controls { display: flex; align-items: center; gap: 8px; }
.cam-slider { flex-grow: 1; cursor: pointer; height: 4px; }
.cam-num-input { width: 45px; background: #333; border: 1px solid #444; color: white; padding: 2px 4px; border-radius: 3px; text-align: right; font-size: 11px; }

/* --- LIBRARY --- */
.library-header { padding: 0 10px; display: flex; justify-content: space-between; position: relative; overflow: visible; z-index: 50; }
.lib-toolbar { display: flex; align-items: center; gap: 8px; flex-grow: 1; width: 100%; }
.lib-sep { width: 1px; height: 16px; background: #444; flex-shrink: 0; }
#lib-filter-select { background: #1a1a1a; border: 1px solid #444; color: #ccc; border-radius: 3px; padding: 3px 6px; font-size: 11px; width: 130px; cursor: pointer; }
#lib-search { flex-grow: 1; background: #1a1a1a; border: 1px solid #333; color: white; border-radius: 3px; padding: 4px 8px; font-size: 11px; min-width: 100px; }
#lib-search:focus { border-color: #4fc1ff; outline: none; }
#asset-size-slider { width: 100px; cursor: pointer; }
.library-container { display: flex; flex-direction: column; height: 100%; overflow: hidden; width: 100%; }
.library-content { flex-grow: 1; background: #1e1e1e; overflow-y: auto; width: 100%; }
.asset-grid-wrapper { padding: 10px 10px 50px 10px; }
.asset-grid { display: grid; gap: 10px; }
.asset-item { background: #252526; border-radius: 4px; overflow: hidden; cursor: grab; position: relative; display: flex; flex-direction: column; border: 1px solid #333; box-shadow: 0 2px 4px rgba(0,0,0,0.3); transition: transform 0.1s, border-color 0.1s; }
.asset-item:hover { border-color: #4fc1ff; transform: translateY(-2px); }
.asset-thumb { height: 70px; background: #1a1a1a; display: flex; align-items: center; justify-content: center; position: relative; } 
.asset-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.asset-name { padding: 6px; font-size: 10px; text-align: left; color: #ccc; background: #252526; padding-right: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-star { position: absolute; top: 4px; right: 4px; font-size: 14px; color: #555; cursor: pointer; z-index: 10; text-shadow: 0 1px 2px rgba(0,0,0,0.8); transition: color 0.2s, transform 0.1s; } 
.asset-star.active { color: #ffd700; } .asset-star:hover { color: #fff; transform: scale(1.2); }
.asset-cat-badge { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,0.7); color: #fff; font-size: 9px; padding: 2px 6px; border-radius: 3px; pointer-events: none; z-index: 5; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; border: 1px solid rgba(255,255,255,0.1); }
.asset-list .asset-item { flex-direction: row; height: 36px; padding: 0 8px; align-items: center; justify-content: space-between; } 
.asset-list .asset-thumb { width: 36px; height: 28px; margin-right: 10px; background: transparent; }
.asset-list .asset-name { background: transparent; flex-grow: 1; max-width: none; }
.asset-list .asset-cat-badge { position: static; display: block; background: transparent; color: #666; font-size: 9px; margin-right: 10px; border: none; font-weight: normal; }
.asset-list .asset-star { position: static; padding: 0; margin-left: 0; font-size: 14px; } 

/* --- NEW: USER FILES & UTILS --- */
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    color: #666;
    font-size: 12px;
    font-style: italic;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Ensure bottom tabs don't stretch weirdly if using flex:1 from default .tab-btn */
#asset-browser .panel-header .tab-btn {
    flex: 0 0 auto; /* Don't grow, don't shrink */
    padding: 0 20px;
} 

/* --- TABS & SIDEBAR --- */
.tab-btn { 
    flex: 1; 
    border: none; 
    background: transparent; 
    color: #888; 
    cursor: pointer; 
    font-weight: 600; 
    border-bottom: 2px solid transparent; 
    font-size: 10px; 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    overflow: hidden;
}

/* Force icons to remain centered with text */
.tab-btn svg {
    display: block;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

/* Specific centering override for Global Settings icon */
#tab-project-btn {
    display: flex;
    align-items: center;
    justify-content: center;
} 

/* ALYSSIUN CROSS-PLATFORM ICON PROTOCOL */
.tab-btn svg,
.tool-btn svg,
.action-btn svg,
#mobile-tab-bar .tab-btn svg {
    opacity: 1; 
    pointer-events: none;
    flex-shrink: 0;
    width: 24px; /* Standardized to 24px for visual symmetry */
    height: 24px;
    display: block;
    fill: #ffffff;
    margin: 0 auto; /* Horizontally centers the icon within the button */
}

.tab-btn.active svg, 
.tool-btn.active svg { 
    opacity: 1 !important; 
    filter: drop-shadow(0 0 5px rgba(79, 193, 255, 0.5)); /* High-fidelity glow */
}

.tab-btn.active { color: #4fc1ff; border-bottom: 2px solid #4fc1ff; background: #1e1e1e; }
.tab-btn.active svg { opacity: 1; color: #4fc1ff; }
.tab-btn:hover:not(.active) { color: #fff; background: rgba(255,255,255,0.02); }
.tab-btn:hover svg { opacity: 0.8; }
/* ALYSSIUN STUDIO: Extra Breathing Room for Content */
.sidebar-content { 
    padding: 10px 10px 65px 10px; /* Increased to 150px for Inspector and Settings comfort */
    overflow-y: auto; 
    flex-grow: 1; 
    display: none;
    width: 100%;
    box-sizing: border-box;
} 
.sidebar-content.active { display: block; }

/* ALYSSIUN PROTOCOL: Optimized Scrolling Buffer */
#hierarchy-list, 
.library-content, 
#inspector-ui,
.settings-container,
#tab-support {
    padding-bottom: 10px !important; /* Reduced buffer for cleaner presentation */
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

/* --- INSPECTOR STYLES --- */
.insp-group { margin-bottom: 10px; }
.insp-label { font-size: 14px; color: #bbb; display: block; font-weight: 600; margin-bottom: 10px;}
.insp-input, .insp-input-dark { background: #333; border: 1px solid #444; color: #fff; padding: 6px 8px; border-radius: 4px; width: 100%; box-sizing: border-box; font-size: 11px; }
.insp-input:focus, .insp-input-dark:focus { border-color: #4fc1ff; outline: none; }

/* Transform Rows Styling (Updated for Grid-like Look) */
.insp-row-vec3-container { margin-bottom: 12px; }
.insp-vec3 { display: flex; gap: 8px; }
.vec3-item { 
    display: flex; 
    align-items: center; 
    background: #333; 
    border-radius: 4px; 
    padding: 6px 8px; 
    flex: 1; 
    border: 1px solid #333; 
    transition: border-color 0.2s;
}
.vec3-item:hover { border-color: #555; }
.vec3-item:focus-within { border-color: #4fc1ff; background: #2b2b2b; }
.vec3-label { font-size: 14px; color: #ddd; margin-right: 8px; font-weight: 600; cursor: default; }
.vec3-item input { 
    background: transparent; 
    border: none; 
    color: white; 
    width: 100%; 
    font-size: 13px; 
    outline: none; 
    padding: 0;
    font-family: inherit;
}

/* Asset Details */
.asset-details-box { background: #252526; border: 1px solid #333; border-radius: 4px; padding: 12px; margin-top: 20px; }
.asset-details-title { font-size: 10px; font-weight: 700; color: #777; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 6px; color: #aaa; }
.detail-val { color: #fff; font-family: monospace; }

/* --- GLOBAL SETTINGS PANEL (PROJECT TAB) --- */
.settings-container { 
    padding: 10px 0px 100px 0px; /* Standardized side padding and balanced bottom buffer */
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure all form groups and inputs within Settings and Inspector are edge-to-edge */
.settings-container .form-group,
.settings-container .form-input,
.settings-container .upload-zone,
#inspector-ui .asset-details-box,
#inspector-ui .insp-input {
    width: 100% !important;
    box-sizing: border-box;
}

.autosave-card { border: 1px solid #444; border-radius: 4px; background: #252526; padding: 12px; margin-bottom: 20px; width: 100%; box-sizing: border-box; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-title { font-weight: 700; font-size: 11px; color: #e0e0e0; letter-spacing: 0.5px; text-transform: uppercase; }
.card-desc { font-size: 11px; color: #888; line-height: 1.4; }

.toggle-switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #555; transition: .4s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #4fc1ff; }
input:checked + .slider:before { transform: translateX(16px); }

.settings-sep { height: 1px; background: #333; margin: 20px 0; }

.form-group { margin-bottom: 15px; }
.form-label { display: block; font-weight: 600; font-size: 11px; color: #aaa; margin-bottom: 8px; }
.form-input { width: 100%; background: #333; border: 1px solid #444; color: #e0e0e0; padding: 10px; border-radius: 4px; box-sizing: border-box; font-size: 12px; font-family: inherit; }
.form-input:focus { outline: none; border-color: #4fc1ff; background: #3a3a3a; }
.textarea-input { resize: vertical; min-height: 60px; }

.upload-zone { border: 1px dashed #555; border-radius: 4px; padding: 12px; text-align: center; color: #888; font-size: 11px; cursor: pointer; transition: all 0.2s; background: rgba(255,255,255,0.02); }
.upload-zone:hover { border-color: #4fc1ff; color: #e0e0e0; background: rgba(255,255,255,0.05); }
.file-status { margin-top: 5px; font-size: 10px; color: #4fc1ff; text-align: right; font-style: italic; }
.preview-img { width: 100%; height: auto; margin-top: 8px; border-radius: 4px; border: 1px solid #444; display: block; }

.footer-row { display: flex; justify-content: space-between; align-items: center; }
.footer-label { font-weight: 700; font-size: 11px; color: #e0e0e0; text-transform: uppercase; }
.btn-save { background: #e0e0e0; color: #121212; border: none; padding: 6px 16px; border-radius: 4px; font-weight: 700; font-size: 11px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; transition: background 0.2s; }
.btn-save:hover { background: #fff; }

/* --- GENERAL BUTTONS --- */
.btn { background: #0e639c; color: white; border: none; padding: 8px; border-radius: 2px; cursor: pointer; font-size: 11px; width: 100%; font-weight: 600; }
.btn-secondary { background: #444; color: #ccc; } .btn-secondary:hover { background: #555; color: white; }
.resizer-v { width: 4px; background: #121212; cursor: col-resize; z-index: 100; } .resizer-h-desktop { height: 4px; background: #121212; cursor: row-resize; z-index: 100; }

/* --- MODAL --- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.active { display: flex; }
.modal-box { background: #252526; border: 1px solid #444; border-radius: 4px; padding: 20px; width: 300px; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.modal-box h3 { margin-top: 0; color: #e0e0e0; }
.modal-box p { color: #aaa; font-size: 12px; margin-bottom: 20px; line-height: 1.4; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { width: auto; padding: 8px 16px; }

/* --- ALYSSIUN UNIVERSAL AUTH MODAL (BUILDER SUPPORT) --- */
.auth-modal-overlay{
    position: fixed !important;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95) !important;
    backdrop-filter: blur(25px) !important;
    z-index: 2000000 !important;
    display: none;
    align-items: center;
    justify-content: center;
}

.auth-modal-box{
    width: 90%;
    max-width: 380px;
    padding: 50px 40px;
    background: #0a0a0a !important;
    border: 1px solid #333 !important;
    border-radius: 4px;
    text-align: center;
    position: relative;
    box-shadow: 0 40px 100px rgba(0,0,0,1);
}

.auth-modal-close{
    position: absolute;
    top: 20px; right: 20px;
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}
.auth-modal-close:hover{ color: #ff4444; }

.auth-modal-logo{
    width: 60px !important;
    height: 60px !important;
    margin: 0 auto 30px auto !important;
    display: block !important;
    object-fit: contain;
}

.auth-modal-title{
    margin-bottom: 30px;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    color: #fff;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.auth-modal-input{
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    background: #111 !important;
    border: 1px solid #222 !important;
    color: #fff !important;
    border-radius: 2px;
    font-size: 13px;
    outline: none;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}
.auth-modal-input:focus{
    border-color: #4fc1ff !important;
    background: #000 !important;
}

.auth-modal-btn{
    width: 100%;
    padding: 15px;
    background: #4fc1ff;
    color: #000;
    font-weight: 800;
    border: none;
    cursor: pointer;
    border-radius: 2px;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 10px;
    transition: 0.3s;
}
.auth-modal-btn:hover{
    background: #fff;
    transform: translateY(-2px);
}

.auth-modal-links{
    margin-top: 25px;
    font-size: 11px;
    color: #666;
    line-height: 1.6;
}
.auth-modal-links a{
    color: #4fc1ff;
    text-decoration: none;
    font-weight: bold;
}

.auth-modal-msg{
    margin-top: 20px;
    font-size: 11px;
    font-weight: 600;
    min-height: 15px;
}

/* --- ALYSSIUN MOBILE PROTOCOL --- */
#mobile-tab-bar { 
    display: none; 
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 60px; 
    background: #000000; 
    border-top: 1px solid #1a1a1a; 
    z-index: 5500; 
    padding: 0;
    margin: 0;
}

/* ALYSSIUN PROTOCOL: Strict Desktop Suppression */
@media (min-width: 901px) {
    #mobile-tab-bar, .mobile-only {
        display: none !important;
    }
}

/* Visual feedback for dropping onto Hierarchy */
.hierarchy-row.drag-over {
    background: rgba(79, 193, 255, 0.2) !important;
    outline: 1px dashed #4fc1ff;
}

/* Ensure the bar is strictly hidden on desktop/big screens */
@media (min-width: 901px) {
    #mobile-tab-bar, .mobile-only {
        display: none !important;
    }
}

/* Visual feedback for dropping onto Hierarchy */
.hierarchy-row.drag-over {
    background: rgba(79, 193, 255, 0.2) !important;
    outline: 1px dashed #4fc1ff;
}

.mobile-tab-scroll {
    display: flex;
    overflow-x: auto; /* ALYSSIUN PROTOCOL: Enable horizontal scrolling */
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling for iOS */
    align-items: center;
    height: 100%;
    width: 100%;
    gap: 5px;
    padding: 5px 5px 0px 5px;
}

/* Ensure buttons do not shrink so they remain scrollable */
.mobile-tab-scroll .tab-btn {
    flex: 0 0 auto; 
    min-width: 80px;
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Hide scrollbar for a cleaner cinematic look */
.mobile-tab-scroll::-webkit-scrollbar {
    display: none;
}

.mobile-tab-scroll::-webkit-scrollbar { display: none; }

#mobile-tab-bar .tab-btn {
    flex: 1; /* Forces all buttons to share width equally */
    height: 100%;
    font-size: 9px; 
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: none;
    border-top: 5px solid transparent;
    background: transparent;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

#mobile-tab-bar .tab-btn.active {
    border-top: 3px solid #4fc1ff; /* Highlights the active tab at the top */
    background: rgba(79, 193, 255, 0.05);
    color: #4fc1ff;
}

/* Fix for iPhone Notch/Home Indicator overlay - Restricted to Mobile */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 900px) {
        #mobile-tab-bar {
            height: auto !important;
            min-height: 60px !important;
            padding-bottom: env(safe-area-inset-bottom) !important;
            display: flex !important;
        }
    }
}

#mobile-tab-bar .tab-btn.active { 
    border-top: 2px solid #4fc1ff; 
    background: #151515; 
    color: #4fc1ff;
}

#mobile-tab-bar .tab-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

#mobile-tab-bar .tab-btn.active svg {
    opacity: 1;
}

@media (max-width: 900px) {
    .desktop-only { display: none !important; }

    /* ALYSSIUN MOBILE PROTOCOL: Hide Tab Buttons but Keep Toolbars */
    #sidebar-left .panel-header,
    #sidebar-right .panel-header,
    #asset-browser .panel-header:first-child .tab-btn { 
        display: none !important; 
    }

    /* Restore visibility for the utility toolbars on mobile */
    #asset-browser .panel-header:first-child {
        display: flex !important;
        justify-content: flex-start !important;
        height: auto !important;
        padding: 5px 0 !important;
    }

    /* ALYSSIUN MOBILE PROTOCOL: Remove redundant dividers */
    #asset-browser .library-header,
    #bot-tab-library,
    #bot-tab-files,
    #asset-browser .panel-header:first-child {
        display: flex !important;
        border: none !important;
        border-top: none !important;
    }

    .library-header {
        border-bottom: 1px solid #1a1a1a !important; /* Subtle separate for the toolbar only */
    }

    /* Ensure search inputs are readable on mobile */
    .lib-toolbar {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        padding: 5px;
        gap: 5px;
    }

    #lib-search, #files-search {
        min-width: 120px !important;
    }

    #sidebar-left, #sidebar-right, #asset-browser, .resizer-v, .resizer-h-desktop { 
        display: none !important; 
    }
    
    #workspace { 
        height: calc(100% - 35px - 60px);
    }

    #mobile-tab-bar { display: block; transition: transform 0.3s ease; }
    
    /* ALYSSIUN MOBILE PROTOCOL: Full Immersive Toggle Fix */
    body.mobile-ui-hidden #mobile-tab-bar { transform: translateY(60px); pointer-events: none; }
    
    /* ALYSSIUN MOBILE PROTOCOL: Viewport Expansion */
    body.mobile-ui-hidden #workspace { 
        height: calc(100% - 45px) !important; 
        transition: height 0.2s ease;
    }

    body.mobile-ui-hidden #center-area {
        height: 100% !important;
    }

    /* ALYSSIUN MOBILE PROTOCOL: Dynamic Canvas Resizing */
    #sidebar-left.mobile-active-panel, 
    #sidebar-right.mobile-active-panel, 
    #asset-browser.mobile-active-panel { 
        display: flex !important; 
        flex-direction: column !important;
        position: relative !important;
        width: 100% !important; 
        height: 45vh !important;
        background: #0a0a0a !important;
        border-top: 1px solid #1a1a1a !important;
        z-index: 4999 !important;
        order: 2;
        overflow: hidden !important; /* Contains the scrollable inner children */
        touch-action: pan-y !important; /* Explicitly allow vertical panning */
    }

    /* ALYSSIUN MOBILE PROTOCOL: Force content areas to be scrollable */
    #hierarchy-list, 
    .library-content, 
    #inspector-ui,
    .settings-container,
    #tab-support {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        height: 100% !important;
    }

    @media (max-width: 900px) {
        body {
            display: flex;
            flex-direction: column;
            height: 100vh;
        }
        
        #workspace {
            display: flex;
            flex-direction: column; /* Pushes panels to the bottom */
            flex: 1 1 auto !important;
            height: calc(100% - 35px - 60px) !important;
            min-height: 0;
        }
        
        #center-area {
            display: flex;
            flex-direction: column;
            flex: 1 1 auto !important;
            min-height: 0;
        }

        #main-view {
            flex: 1 1 auto !important; /* Viewport takes all remaining space */
            height: auto !important;
        }
    }

    #hierarchy-list, .library-content {
        flex: 1 !important;
        height: auto !important;
    }
}
.loading-overlay { position: absolute; top: 60px; right: 15px; color: #4fc1ff; font-weight: bold; pointer-events: none; }
#scene-stats { 
    position: fixed;
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    color: #ccc; 
    background: rgba(5, 5, 10, 0.98) !important; 
    border-radius: 12px; 
    width: 380px;
    height: 500px;
    max-height: 85vh;
    display: none; 
    flex-direction: column;
    pointer-events: auto; 
    border: 1px solid #333; 
    z-index: 25005;
    overflow: hidden !important;
    touch-action: none;
    box-shadow: 0 20px 80px rgba(0,0,0,1);
    backdrop-filter: none !important; /* Force no blur per protocol */
    -webkit-backdrop-filter: none !important;
}

/* ALYSSIUN MOBILE PROTOCOL: Consistently Scrollable Interior */
#scene-stats > div:nth-child(2) {
    flex-grow: 1;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding: 20px 30px;
}

#scene-stats div { scrollbar-width: thin; scrollbar-color: #4fc1ff #111; }

#scene-stats div { scrollbar-width: thin; scrollbar-color: #4fc1ff #111; }
#scene-stats::-webkit-scrollbar { width: 4px; }
#scene-stats::-webkit-scrollbar-thumb { background: #4fc1ff; border-radius: 10px; }

.stats-close-x {
    cursor: pointer;
    color: #555;
    font-size: 14px;
    font-family: sans-serif;
    transition: color 0.2s, transform 0.2s;
    padding: 0 5px;
}

.stats-close-x:hover {
    color: #ff4444;
    transform: scale(1.2);
}

/* Hierarchy panel "Import" button */
.panel-header .panel-btn-import {
    background: #0e639c;
    border: none;
    color: #fff;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.panel-header .panel-btn-import:hover {
    background: #1177bb;
}

/* ALYSSIUN PROTOCOL: 4-Panel Viewport Organization */
#top-left-controls { 
    position: absolute; 
    top: 10px; 
    left: calc(10px + var(--pin-offset-left, 0px)); 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3000;
}
#top-right-controls { 
    position: absolute; 
    top: 10px; 
    right: calc(10px + var(--pin-offset-right, 0px)); 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    align-items: flex-end; 
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3000;
}
#bottom-center-controls {
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    left: calc(50% + (var(--pin-offset-left, 0px) - var(--pin-offset-right, 0px)) / 2) !important;
}

#tool-focus {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid #4fc1ff !important;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    transition: all 0.2s ease;
}

#tool-focus:hover {
    background: #4fc1ff !important;
    border-color: #ffffff !important;
    transform: scale(1.1);
}

/* ALYSSIUN PROTOCOL: Cinematic Void Backdrop */
#global-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4) !important; /* Lightened backdrop */
    backdrop-filter: none !important; /* BLUR REMOVED PER PROTOCOL */
    -webkit-backdrop-filter: none !important;
    z-index: 24000 !important;
    display: none;
    pointer-events: all;
    transition: opacity 0.3s ease;
}

#global-modal-backdrop.active {
    display: block !important;
    animation: fadeInBlur 0.3s ease-out;
}

@keyframes fadeInBlur {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrollbar Protocol for Centralized Panels */
.modal-scroll-container::-webkit-scrollbar { width: 4px; }
.modal-scroll-container::-webkit-scrollbar-thumb { background: #4fc1ff; border-radius: 10px; }