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

:root {
    --yamaha-teal: #00a0a0;
    --bg-dark: #1a1a2e;
    --panel-dark: #2d2d44;
    --panel-cream: #3a3a52;
    --accent-amber: #ffb000;
    --phosphor-green: #00ff41;
    --text-light: #e8e8e8;
    --text-dim: #888;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Boot Screen */
.boot-screen {
    position: fixed;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.boot-content {
    text-align: center;
}

.boot-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 1s ease-in-out infinite;
}

.boot-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    color: var(--yamaha-teal);
    margin-bottom: 2rem;
    text-shadow: 0 0 20px var(--yamaha-teal);
}

.boot-text {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: var(--phosphor-green);
    margin-bottom: 1rem;
    min-height: 1.5rem;
}

.boot-progress {
    width: 300px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.boot-bar {
    height: 100%;
    background: var(--yamaha-teal);
    animation: bootProgress 3s ease-out forwards;
}

@keyframes bootProgress {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Main Container */
.synth-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.synth-header {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 100%);
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid #3a3a52;
}

.header-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 900;
    color: var(--yamaha-teal);
    text-shadow: 0 0 30px var(--yamaha-teal);
    letter-spacing: 0.1em;
}

.header-subtitle {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: var(--accent-amber);
    letter-spacing: 0.3em;
}

/* Oscilloscope */
.oscilloscope-section {
    margin-bottom: 1rem;
}

.oscilloscope-container {
    background: #0a0a0a;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 
        inset 0 0 30px rgba(0,0,0,0.8),
        0 4px 20px rgba(0,0,0,0.5);
    border: 3px solid #333;
}

.oscilloscope-canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* Preset Section */
.preset-section {
    background: var(--panel-dark);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.preset-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: var(--accent-amber);
    margin-bottom: 0.5rem;
    letter-spacing: 0.2em;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preset-btn {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    background: #1a1a2e;
    border: 1px solid #444;
    color: var(--text-light);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #3a3a52;
    border-color: var(--yamaha-teal);
}

.preset-btn.active {
    background: var(--yamaha-teal);
    color: #000;
    border-color: var(--yamaha-teal);
    box-shadow: 0 0 10px var(--yamaha-teal);
}

/* Controls Row */
.controls-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .controls-row {
        grid-template-columns: 2fr 1fr;
    }
}

/* Section Titles */
.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    color: var(--accent-amber);
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #3a3a52;
}

/* Operators Section */
.operators-section {
    background: var(--panel-dark);
    padding: 1rem;
    border-radius: 8px;
}

.operators-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 600px) {
    .operators-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.operator-panel {
    background: var(--panel-cream);
    padding: 0.75rem;
    border-radius: 8px;
    border: 2px solid #444;
    transition: all 0.2s;
}

.operator-panel.enabled {
    border-color: var(--yamaha-teal);
    box-shadow: 0 0 10px rgba(0, 160, 160, 0.3);
}

.operator-panel.disabled {
    opacity: 0.5;
}

.operator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.operator-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: var(--yamaha-teal);
}

.toggle-btn {
    font-family: 'VT323', monospace;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.on {
    background: var(--phosphor-green);
    border-color: var(--phosphor-green);
    color: #000;
}

.toggle-btn.off {
    background: transparent;
    border-color: #666;
    color: #666;
}

.operator-controls {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 0.5rem;
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Algorithm Section */
.algorithm-section {
    background: var(--panel-dark);
    padding: 1rem;
    border-radius: 8px;
}

.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.alg-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    background: #1a1a2e;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.alg-btn:hover {
    border-color: var(--yamaha-teal);
}

.alg-btn.active {
    background: var(--yamaha-teal);
    border-color: var(--yamaha-teal);
}

.alg-btn.active .alg-num,
.alg-btn.active .alg-name {
    color: #000;
}

.alg-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: var(--yamaha-teal);
}

.alg-name {
    font-size: 0.6rem;
    color: var(--text-dim);
}

/* Envelope Section */
.envelope-section {
    background: var(--panel-dark);
    padding: 1rem;
    border-radius: 8px;
}

.envelope-display {
    width: 100%;
    height: 60px;
    background: #1a1a2e;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.envelope-controls {
    display: flex;
    gap: 0.5rem;
}

.envelope-controls .slider-wrapper {
    flex: 1;
}

/* Master Section */
.master-section {
    background: var(--panel-dark);
    padding: 1rem;
    border-radius: 8px;
}

.master-controls {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Knob Styles */
.knob-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.knob {
    position: relative;
    background: linear-gradient(145deg, #3a3a52, #2d2d44);
    border-radius: 50%;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.1);
    cursor: pointer;
    user-select: none;
}

.knob-inner {
    position: absolute;
    inset: 4px;
    background: linear-gradient(145deg, #444, #333);
    border-radius: 50%;
    display: flex;
    justify-content: center;
}

.knob-indicator {
    width: 3px;
    height: 40%;
    background: var(--yamaha-teal);
    border-radius: 2px;
    margin-top: 4px;
    box-shadow: 0 0 6px var(--yamaha-teal);
}

.knob-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.knob-value {
    font-family: 'VT323', monospace;
    font-size: 0.8rem;
    color: var(--phosphor-green);
}

/* Slider Styles */
.slider-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.slider-wrapper.vertical {
    height: 80px;
}

.slider-label {
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #1a1a2e;
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--yamaha-teal);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px var(--yamaha-teal);
}

.vertical-slider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 6px;
    height: 60px;
}

.slider-value {
    font-family: 'VT323', monospace;
    font-size: 0.7rem;
    color: var(--phosphor-green);
}

/* Keyboard Section */
.keyboard-section {
    background: var(--panel-dark);
    padding: 1rem;
    border-radius: 8px;
}

.keyboard-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 0.75rem;
}

.keyboard-container {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.keyboard {
    position: relative;
    height: 120px;
    min-width: 500px;
}

.white-keys {
    display: flex;
    height: 100%;
}

.white-key {
    flex: 1;
    background: linear-gradient(180deg, #f5f5dc 0%, #e0e0c8 100%);
    border: 1px solid #999;
    border-radius: 0 0 4px 4px;
    margin-right: 2px;
    cursor: pointer;
    transition: all 0.1s;
}

.white-key:hover {
    background: linear-gradient(180deg, #fff 0%, #f0f0dc 100%);
}

.white-key.active {
    background: linear-gradient(180deg, #ccc 0%, #aaa 100%);
    transform: translateY(2px);
}

.black-keys {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60%;
    pointer-events: none;
}

.black-key {
    position: absolute;
    width: 5%;
    height: 100%;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border-radius: 0 0 3px 3px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.1s;
    box-shadow: 0 3px 5px rgba(0,0,0,0.5);
}

.black-key:hover {
    background: linear-gradient(180deg, #444 0%, #222 100%);
}

.black-key.active {
    background: linear-gradient(180deg, #222 0%, #111 100%);
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Footer */
.synth-footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

.synth-footer a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.synth-footer a:hover {
    color: var(--yamaha-teal);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .synth-container {
        padding: 0.5rem;
    }
    
    .keyboard {
        height: 100px;
    }
    
    .operators-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .master-controls {
        gap: 0.5rem;
    }
    
    .preset-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}