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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eee;
    line-height: 1.6;
}

/* App layout - scene left, controls right */
.app-layout {
    display: flex;
    height: 100vh;
}

/* 3D Scene Panel */
.scene-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f0f1a;
    position: relative;
}

#scene-container {
    flex: 1;
    width: 100%;
}

#scene-container canvas {
    display: block;
}

.scene-controls {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    z-index: 10;
}

.btn {
    padding: 0.5rem 1rem;
    background: #252540;
    border: 1px solid #333;
    border-radius: 6px;
    color: #ddd;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn:hover {
    background: #333355;
    border-color: #444;
}

.btn:active {
    background: #3b3b60;
}

/* Controls Panel */
.controls-panel {
    width: 380px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: #1a1a2e;
    border-left: 1px solid #333;
    overflow-y: auto;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #333;
}

h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #252540;
    border-radius: 20px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
}

.status-indicator.active {
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
}

.status-text {
    font-size: 0.8rem;
    color: #aaa;
}

/* Section styling */
section {
    background: #252540;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: #888;
}

h3 {
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Axis group */
.axis-group {
    margin-bottom: 1.25rem;
}

.axis-group:last-child {
    margin-bottom: 0;
}

/* Axis row */
.axis-row {
    display: grid;
    grid-template-columns: 110px 1fr 50px 55px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0;
}

.axis-row label {
    font-size: 0.8rem;
    color: #bbb;
}

/* Value display */
.value {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    text-align: right;
    color: #888;
    transition: color 0.1s;
}

.value.active {
    color: #fff;
}

.keys {
    font-size: 0.75rem;
    color: #555;
    text-align: center;
}

/* Visual bar */
.bar {
    position: relative;
    height: 20px;
    background: #1a1a2e;
    border-radius: 3px;
    overflow: hidden;
}

.bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #444;
    transform: translateX(-50%);
    z-index: 1;
}

.bar-fill {
    position: absolute;
    top: 3px;
    bottom: 3px;
    background: #3b82f6;
    border-radius: 2px;
    transition: background 0.1s;
    left: 50%;
    width: 0;
}

.bar-fill.positive {
    background: #3b82f6;
}

.bar-fill.negative {
    background: #f97316;
}

/* Instructions */
.instructions {
    background: #1e1e32;
}

.control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.control-section h4 {
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 0.4rem;
}

.control-section ul {
    list-style: none;
}

.control-section li {
    font-size: 0.8rem;
    color: #888;
    padding: 0.2rem 0;
}

kbd {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: #333;
    border: 1px solid #444;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.75rem;
    color: #ddd;
}

/* Footer */
footer {
    margin-top: auto;
    text-align: center;
    color: #555;
    font-size: 0.8rem;
    padding-top: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .app-layout {
        flex-direction: column;
    }

    .scene-panel {
        height: 50vh;
        min-height: 300px;
    }

    .controls-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid #333;
    }
}

@media (max-width: 500px) {
    .controls-panel {
        padding: 1rem;
    }

    .axis-row {
        grid-template-columns: 90px 1fr 45px;
    }

    .axis-row .keys {
        display: none;
    }

    .control-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
