/* Core App Base Reset Reset */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1f2937;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Visibility Control Utility Gating */
.hidden-ui {
    display: none !important;
}

/* Lobby Interface Box Configuration */
.lobby-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    text-align: center;
}
.lobby-card h2 { margin: 0 0 4px 0; font-size: 24px; color: #111827; }
.lobby-card .subtitle { margin: 0 0 24px 0; color: #6b7280; font-size: 14px; }

/* Lobby Tab Engine Layouts */
.tab-header {
    display: flex;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    color: #4b5563;
    transition: all 0.15s ease;
}
.tab-btn.active {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.panel { display: none; }
.panel.active { display: block; }

/* Global Input Form Fields */
.input-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    margin-bottom: 14px;
    outline: none;
}
.input-field:focus { border-color: #4f46e5; }

.radio-group {
    display: flex;
    justify-content: space-around;
    margin-bottom: 18px;
    font-size: 14px;
}
.radio-group label { cursor: pointer; }

.divider {
    margin: 20px 0;
    font-size: 11px;
    color: #9ca3af;
    letter-spacing: 1px;
    position: relative;
}

.join-action-row {
    display: flex;
    gap: 10px;
}
.code-input { text-align: center; font-weight: bold; letter-spacing: 2px; margin-bottom: 0; }

/* Fixed Component Buttons Matrix */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background-color: #4f46e5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s ease;
    transform: none !important;
    animation: none !important;
}
.btn:hover { background-color: #4338ca; }
.btn:active { background-color: #3730a3; }
.btn:disabled { background-color: #9ca3af; cursor: not-allowed; }

.btn-secondary { background-color: #4b5563; }
.btn-secondary:hover { background-color: #374151; }
.btn-danger { background-color: #dc2626; }
.btn-danger:hover { background-color: #b91c1c; }

.small-action-btn { width: auto; padding: 6px 12px; font-size: 12px; }

/* MAIN STUDIO VIEWPORT INTERACTIVE PANELS SPLIT GRID */
.app-workspace {
    display: grid;
    grid-template-columns: 280px 1fr;
    width: 100vw;
    height: 100vh;
    background: #e5e7eb;
}

/* Controls Dashboard Sidebar Design */
.control-sidebar {
    background: #ffffff;
    border-right: 1px solid #d1d5db;
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.sidebar-header h3 { margin: 0; font-size: 18px; }
.room-tag { font-size: 12px; background: #f3f4f6; padding: 4px 8px; border-radius: 4px; }

.host-controls { margin-top: 8px; width: 100%; display: flex; }
.host-controls .btn { width: 100%; }

hr { border: 0; border-top: 1px solid #f3f4f6; margin: 16px 0; }

.control-section { margin-bottom: 16px; display: flex; flex-direction: column; }
.control-section label, .control-section h4 { 
    font-size: 12px; font-weight: 600; text-transform: uppercase; 
    color: #4b5563; margin: 0 0 8px 0; letter-spacing: 0.5px;
}

/* Tool Icons Selection Grid */
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tool-btn {
    font-size: 16px; padding: 8px; background: #f3f4f6; border: 1px solid #e5e7eb;
    border-radius: 6px; cursor: pointer; transition: all 0.1s ease;
}
.tool-btn:hover { background: #e5e7eb; }
.tool-btn.active { background: #111827; color: #ffffff; border-color: #111827; }

.control-select {
    padding: 8px; border-radius: 6px; border: 1px solid #d1d5db; font-size: 13px; background: #fff; outline: none;
}

/* Range Sliders Formatting Blocks */
.slider-header { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.val-indicator { color: #6b7280; font-weight: 500; }
.slider-input { width: 100%; margin: 0; cursor: pointer; }

/* Multi-Color Grid Containers */
.color-picker-wrapper { display: flex; gap: 10px; align-items: center; }
#primary-color {
    padding: 0; border: none; width: 40px; height: 40px; border-radius: 6px; cursor: pointer; background: none;
}
.swatches-mini-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; flex: 1; }
.swatch { height: 20px; border-radius: 4px; cursor: pointer; }

/* Realtime Dynamic Layer Selection List Layout */
.layers-section { flex: 1; display: flex; flex-direction: column; min-height: 120px; }
.section-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-header-row h4 { margin: 0; }
.layers-stack-list {
    flex: 1; border: 1px solid #e5e7eb; border-radius: 6px; background: #f9fafb;
    overflow-y: auto; max-height: 180px;
}
.layer-item-ui {
    display: flex; align-items: center; justify-content: space-between; padding: 8px;
    border-bottom: 1px solid #f3f4f6; cursor: pointer; font-size: 13px;
}
.layer-item-ui:hover { background: #f3f4f6; }
.layer-item-ui.selected-layer { background: #e0e7ff; font-weight: 600; }
.layer-meta-left { display: flex; align-items: center; gap: 8px; }
.layer-visibility-toggle { background: none; border: none; cursor: pointer; padding: 0; font-size: 14px; }

.sidebar-footer-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; }
.sidebar-footer-actions .btn { flex: 1; }

/* CENTRAL RENDERING WORKSPACE PORT FRAME */
.canvas-viewport {
    display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto;
}
.canvas-relative-frame {
    position: relative; background: #ffffff; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border-radius: 4px;
}

/* Layer Stack Canvas Elements Alignment Rules */
.interactive-layer, .composited-layer-slice {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block;
}
.interactive-layer { pointer-events: auto; z-index: 999; }
.composited-layer-slice { pointer-events: none; }