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

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

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    position: relative;
}

#viewport {
    flex: 1;
    position: relative;
    margin-left: 200px;
    transition: margin-left 0.3s ease;
}

#canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.controls-panel {
    width: 200px;
    background-color: #2a2a2a;
    border-right: 1px solid #444;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    order: -1;
    transform: translateX(0);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.35);
}

.controls-panel.collapsed {
    transform: translateX(-100%);
    box-shadow: none;
}

.controls-content {
    padding: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
}

.control-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    margin-bottom: 15px;
    color: #00ff88;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: #ccc;
}

.control-section input,
.control-section select,
.control-section button {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    background-color: #3a3a3a;
    border: 1px solid #555;
    color: #ffffff;
    border-radius: 4px;
    font-size: 12px;
}

.control-section input:focus,
.control-section select:focus,
.control-section button:focus {
    outline: none;
    border-color: #00ff88;
}

.control-section button {
    cursor: pointer;
    transition: background-color 0.2s;
}

.control-section button:hover {
    background-color: #4a4a4a;
}

.control-section button:active {
    background-color: #00ff88;
    color: #000;
}


.pattern-btn {
    margin-bottom: 5px !important;
    padding: 6px !important;
    font-size: 11px !important;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #555;
    border: none !important;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00ff88;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #00ff88;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

input[type="color"] {
    height: 30px;
    border: none !important;
    cursor: pointer;
}

input[type="color"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

input[type="number"] {
    /* Hide spinner buttons for cleaner direct entry */
    -moz-appearance: textfield;
    appearance: textfield;
    text-align: center;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="checkbox"] {
    width: auto !important;
    margin-right: 8px !important;
    margin-bottom: 0 !important;
}

.camera-help {
    margin-top: 10px;
    padding: 10px;
    background-color: #1a1a1a;
    border-radius: 4px;
    line-height: 1.4;
}

.status-bar {
    position: absolute;
    bottom: 0;
    left: 200px;
    right: 0;
    height: 40px;
    background-color: #2a2a2a;
    border-top: 1px solid #444;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 12px;
    z-index: 50;
    transition: left 0.3s ease;
}

.status-bar span {
    margin-right: 20px;
    color: #ccc;
}

.status-bar span:last-child {
    margin-right: 0;
}

.controls-toggle {
    position: fixed;
    top: 20px;
    left: 210px;
    z-index: 150;
    background-color: #00ff88;
    color: #000;
    border: none;
    border-radius: 0 4px 4px 0;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    transition: left 0.3s ease, background-color 0.2s ease, color 0.2s ease;
}

.controls-toggle:hover {
    background-color: #33ffaa;
}

.controls-toggle:active {
    background-color: #ffffff;
}

body.controls-collapsed #viewport {
    margin-left: 0;
}

body.controls-collapsed .status-bar {
    left: 0;
}

#timeline-container {
    position: absolute;
    left: 200px;
    right: 0;
    bottom: 40px;
    z-index: 55;
    transition: left 0.3s ease;
}

body.controls-collapsed #timeline-container {
    left: 0;
}

.timeline-scrubber {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: rgba(15, 15, 15, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
}

.transport-controls {
    display: flex;
    gap: 6px;
}

.transport-btn {
    min-width: 34px;
    height: 30px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.transport-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.transport-btn:focus-visible {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

.transport-btn.play-btn {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.5);
    font-weight: 600;
}

.transport-btn.reset-btn {
    min-width: 54px;
}

.timeline-track-container {
    flex: 1;
    padding: 0 8px;
}

.timeline-track {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    touch-action: none;
}

.timeline-range {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(0, 255, 136, 0.35);
    border-radius: 4px;
    pointer-events: none;
}

.timeline-scrubber-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #00ff88;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.55);
    z-index: 2;
}

.timeline-scrubber-handle.start-handle {
    background: #39ffb0;
    box-shadow: 0 0 6px rgba(57, 255, 176, 0.5);
}

.timeline-scrubber-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.15);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

.timeline-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
    justify-content: flex-end;
}

.time-display {
    font-family: monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

.speed-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.speed-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #ffffff;
    padding: 4px 6px;
    font-size: 12px;
}

.speed-select:focus-visible {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

body.controls-collapsed .controls-toggle {
    left: 20px;
    border-radius: 4px;
    background-color: #2a2a2a;
    color: #00ff88;
    border: 1px solid #00ff88;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 136, 0.95);
    color: black;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    z-index: 1000;
    animation: slideUp 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast-error {
    background: rgba(255, 68, 68, 0.95);
    color: white;
}

.toast.fade-out {
    opacity: 0;
    transition: opacity 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .controls-panel {
        width: 200px;
    }

    #viewport {
        margin-left: 200px;
    }

    .status-bar {
        left: 200px;
    }

    #timeline-container {
        left: 200px;
    }
}
