* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 20px;
    background: #252525;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.toolbar h1 {
    font-size: 16px;
    color: #3498db;
    white-space: nowrap;
}

.tool-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tool-btn, .action-btn, .view-btn {
    padding: 6px 14px;
    border: 1px solid #444;
    background: #333;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.tool-btn:hover, .action-btn:hover, .view-btn:hover {
    background: #444;
    border-color: #555;
}

.tool-btn.active, .view-btn.active {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.action-btn {
    width: 100%;
    margin-top: 6px;
}

.action-btn.danger {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.5);
    color: #e74c3c;
}

.action-btn.danger:hover {
    background: rgba(231, 76, 60, 0.35);
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: 240px;
    background: #252525;
    overflow-y: auto;
    padding: 12px;
    flex-shrink: 0;
}

.sidebar.left {
    border-right: 1px solid #333;
}

.sidebar.right {
    border-left: 1px solid #333;
}

.panel {
    background: #2a2a2a;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

.panel h3 {
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 10px;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.control-row label {
    font-size: 11px;
    min-width: 65px;
    color: #999;
}

.control-row input[type="number"],
.control-row select {
    flex: 1;
    padding: 4px 6px;
    background: #333;
    border: 1px solid #444;
    color: #e0e0e0;
    border-radius: 3px;
    font-size: 11px;
}

.control-row input[type="range"] {
    flex: 1;
    accent-color: #3498db;
}

.control-row input[type="color"] {
    width: 40px;
    height: 24px;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
    background: transparent;
    padding: 1px;
}

.control-row input[type="checkbox"] {
    accent-color: #3498db;
}

.control-row span {
    font-size: 11px;
    color: #888;
    min-width: 28px;
    text-align: right;
}

.sculpt-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.sculpt-actions .action-btn {
    flex: 1;
    min-width: 60px;
    margin-top: 0;
    padding: 5px 8px;
    font-size: 11px;
}

.action-btn.sculpt-ready {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.5);
    color: #2ecc71;
    font-weight: 600;
}
.action-btn.sculpt-ready:hover {
    background: rgba(46, 204, 113, 0.35);
}

.warning-text {
    font-size: 10px;
    color: #e67e22;
    font-style: italic;
}

.toolbar-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.shapes-group {
    flex-wrap: wrap;
}

.sculpt-status {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 136, 0.15);
    font-size: 12px;
    color: #00ff88;
    pointer-events: none;
    z-index: 10;
}

.sculpt-status span:last-child {
    color: #888;
}

kbd {
    background: rgba(255,255,255,0.1);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: inherit;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    font-size: 10px;
}

.hint {
    font-size: 10px;
    color: #555;
    margin-top: 4px;
    font-style: italic;
}

/* AI Sculpt */
.action-btn.ai-generate {
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.3), rgba(41, 128, 185, 0.3));
    border: 1px solid rgba(142, 68, 173, 0.5);
    color: #bb88ee;
    font-weight: 600;
    font-size: 13px;
    padding: 10px;
    letter-spacing: 0.3px;
    transition: all 0.3s;
}

.action-btn.ai-generate:hover {
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.5), rgba(41, 128, 185, 0.5));
    border-color: rgba(142, 68, 173, 0.8);
    color: #ddaaff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(142, 68, 173, 0.2);
}

.ai-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 8px;
    background: #333;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.ai-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(142, 68, 173, 0.3), rgba(41, 128, 185, 0.3));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.ai-progress span {
    position: relative;
    z-index: 1;
    font-size: 11px;
    color: #bb88ee;
}

#ai-sculpt-form optgroup {
    color: #bb88ee;
    font-style: normal;
    font-weight: 600;
}

#ai-sculpt-form option {
    color: #e0e0e0;
    font-weight: 400;
}

/* Viewport */
.viewport {
    flex: 1;
    position: relative;
    background: #1a1a1a;
    min-width: 0;
}

#canvas-container {
    width: 100%;
    height: 100%;
}

#canvas-container canvas {
    display: block;
}

.viewport-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
}

.view-btn {
    padding: 5px 12px;
    font-size: 11px;
}

/* Object List */
#object-list {
    list-style: none;
    max-height: 160px;
    overflow-y: auto;
}

#object-list li {
    padding: 7px 10px;
    background: #333;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s;
    border: 1px solid transparent;
}

#object-list li:hover {
    background: #3a3a3a;
    border-color: #555;
}

#object-list li.selected {
    background: rgba(52, 152, 219, 0.25);
    border-color: rgba(52, 152, 219, 0.5);
    color: #7ec8e3;
}

/* Vertex Edit */
.vertex-info {
    margin-top: 8px;
    padding: 8px;
    background: #333;
    border-radius: 4px;
}

.vertex-info.hidden {
    display: none;
}

.vertex-info p {
    font-size: 11px;
    margin-bottom: 6px;
}

/* Info Panel */
.panel p {
    font-size: 11px;
    margin-bottom: 4px;
    color: #888;
}

.panel p span {
    color: #e0e0e0;
    float: right;
    font-weight: 600;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile responsive */
@media (max-width: 900px) {
    .sidebar { width: 200px; padding: 8px; }
    .toolbar { padding: 6px 12px; gap: 10px; flex-wrap: wrap; }
}

@media (max-width: 700px) {
    .main-container { flex-direction: column; }
    .sidebar { width: 100%; max-height: 200px; border: none; border-bottom: 1px solid #333; }
    .sidebar.left { display: flex; flex-wrap: wrap; gap: 8px; overflow-x: auto; }
    .sidebar.left .panel { min-width: 200px; flex: 1; margin-bottom: 0; }
    .sidebar.right { display: none; }
}
