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

html, body {
    height: 100%;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #0a0a12;
    color: #d0d0e0;
    font-size: 13px;
}

.lab { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.lab-header {
    display: flex; align-items: baseline; gap: 0.75rem;
    padding: 0.55rem 1rem; background: #0e0e1c;
    border-bottom: 1px solid #1a1a30; flex-shrink: 0;
}
.lab-title { font-size: 1rem; font-weight: 700; color: #e8e8f8; letter-spacing: -0.3px; }
.lab-sub { font-size: 0.75rem; color: #555; }

.lab-body { display: flex; flex: 1; overflow: hidden; min-height: 0; }

.lab-nav {
    width: 150px; flex-shrink: 0; background: #0e0e1c;
    border-right: 1px solid #1a1a30; padding: 0.75rem 0.5rem;
    display: flex; flex-direction: column; gap: 2px;
}
.nav-label {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: #444; padding: 0 0.5rem; margin-bottom: 0.25rem;
}
.nav-item {
    display: flex; align-items: center; gap: 0.5rem; width: 100%;
    background: transparent; border: none; border-radius: 5px; color: #888;
    cursor: pointer; font-size: 0.8rem; padding: 0.45rem 0.6rem; text-align: left;
    transition: background 0.1s, color 0.1s;
}
.nav-item:hover { background: #16162a; color: #bbb; }
.nav-item.active { background: #171730; color: #c8d8ff; font-weight: 600; }
.nav-item.active::before {
    content: ''; display: inline-block; width: 3px; height: 14px;
    background: #4a90e2; border-radius: 2px; margin-right: 2px; flex-shrink: 0;
}
.nav-icon { font-size: 1rem; }

.lab-canvas-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: #0d0d1a; min-width: 0;
}
canvas {
    display: block; border-radius: 3px; box-shadow: 0 0 0 1px #1e1e38;
    cursor: crosshair; max-width: 100%; max-height: 100%; height: auto;
}

.lab-panel {
    width: 180px; flex-shrink: 0; background: #0e0e1c;
    border-left: 1px solid #1a1a30; padding: 0.75rem;
    display: flex; flex-direction: column; gap: 1rem; overflow-y: auto;
}
.panel-section { display: flex; flex-direction: column; gap: 0.35rem; }
.panel-label {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: #444; margin-bottom: 0.1rem;
}
.panel-scene-name { font-size: 0.85rem; font-weight: 600; color: #c8d8ff; }
.panel-scene-desc { font-size: 0.72rem; color: #555; line-height: 1.45; }
.stat { display: flex; justify-content: space-between; font-size: 0.75rem; color: #777; }
.stat span:last-child { color: #4a90e2; font-variant-numeric: tabular-nums; }

.btn-reset {
    background: #16162a; border: 1px solid #25254a; color: #aaa;
    border-radius: 5px; padding: 0.4rem 0.6rem; cursor: pointer;
    font-size: 0.75rem; width: 100%; transition: background 0.1s, color 0.1s;
}
.btn-reset:hover { background: #1e1e3a; color: #ddd; }
.hint { font-size: 0.68rem; color: #3a3a60; line-height: 1.4; margin-top: 0.25rem; }

.slider {
    -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
    border-radius: 2px; background: #25254a; outline: none; margin-top: 0.35rem;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
    border-radius: 50%; background: #4a90e2; cursor: pointer;
}
.slider::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%; background: #4a90e2;
    cursor: pointer; border: none;
}

@media (max-width: 820px) {
    html, body { font-size: 14px; }
    .lab { height: auto; min-height: 100vh; overflow: visible; }
    .lab-body { flex-direction: column; overflow: visible; }
    .lab-nav {
        width: 100%; flex-direction: row; align-items: center; overflow-x: auto;
        border-right: none; border-bottom: 1px solid #1a1a30; padding: 0.5rem;
        gap: 0.4rem; -webkit-overflow-scrolling: touch;
    }
    #nav-items { display: contents; }
    .nav-label { display: none; }
    .nav-item { width: auto; white-space: nowrap; flex-shrink: 0; }
    .nav-item.active::before { display: none; }
    .lab-canvas-wrap { padding: 0.6rem; max-height: 60vh; }
    canvas { width: 100%; }
    .lab-panel {
        width: 100%; flex-direction: row; flex-wrap: wrap; align-items: flex-start;
        gap: 0.85rem 1.5rem; border-left: none; border-top: 1px solid #1a1a30; overflow: visible;
    }
    .panel-section { flex: 1 1 160px; min-width: 0; }
}
