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

body {
    font-family: 'Share Tech Mono', monospace;
    background: #0d0d1a;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(200, 50, 50, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(50, 100, 200, 0.05) 0%, transparent 40%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.01) 2px,
            rgba(255, 255, 255, 0.01) 4px
        );
    min-height: 100vh;
    color: #e0e0e0;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(180deg, #2a1a1a 0%, #1a1a2e 100%);
    border: 3px solid #cc0000;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 
        0 0 20px rgba(200, 0, 0, 0.3),
        inset 0 2px 10px rgba(255, 255, 255, 0.05);
}

.chip-icon {
    font-size: 32px;
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

header h1 {
    font-family: 'VT323', monospace;
    font-size: clamp(28px, 6vw, 48px);
    color: #ffd700;
    text-shadow: 
        0 0 10px #ffd700,
        0 0 20px #cc0000,
        3px 3px 0 #cc0000;
    letter-spacing: 4px;
}

.powered-by {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #888;
}

.oscilloscope-container {
    margin-bottom: 20px;
}

.crt-frame {
    position: relative;
    background: #0a0a0a;
    border: 8px solid #2a2a2a;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 
        inset 0 0 50px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(0, 255, 65, 0.1);
    overflow: hidden;
}

.crt-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    border-radius: 12px;
}

#oscilloscope {
    width: 100%;
    height: 200px;
    background: #000500;
    border-radius: 8px;
}

.scanlines {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.3) 2px,
        rgba(0, 0, 0, 0.3) 4px
    );
    pointer-events: none;
    border-radius: 8px;
}

.crt-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 20, 0, 0.3) 100%);
    pointer-events: none;
    border-radius: 8px;
}

.scope-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 10px;
    background: #1a1a2e;
    border-radius: 5px;
}

.scope-btn {
    background: linear-gradient(180deg, #3a3a4e 0%, #2a2a3e 100%);
    border: 2px solid #4a4a5e;
    color: #00ff41;
    padding: 8px 16px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    text-transform: uppercase;
}

.scope-btn:hover {
    background: linear-gradient(180deg, #4a4a5e 0%, #3a3a4e 100%);
}

.scope-info {
    display: flex;
    gap: 20px;
    color: #00ff41;
    font-size: 14px;
}

.channels-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.channel-panel {
    background: linear-gradient(180deg, #252535 0%, #1a1a2a 100%);
    border: 2px solid #3a3a4a;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 15px rgba(0, 0, 0, 0.4);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #3a3a4a;
}

.channel-label {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: #ffd700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.led-btn {
    background: #1a1a2a;
    border: 2px solid #3a3a4a;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.led {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #333;
    transition: all 0.2s;
}

.led-btn[data-active="true"] .led {
    background: #00ff00;
    box-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00;
}

.waveform-preview {
    width: 100%;
    height: 50px;
    background: #0a0a15;
    border: 1px solid #2a2a3a;
    border-radius: 5px;
    margin-bottom: 15px;
    display: block;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.value-display {
    color: #00ff41;
}

.duty-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.duty-btn {
    background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
    border: 1px solid #3a3a4a;
    color: #888;
    padding: 6px 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.duty-btn:hover {
    background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
    color: #aaa;
}

.duty-btn.active {
    background: linear-gradient(180deg, #cc0000 0%, #880000 100%);
    border-color: #ff4444;
    color: #fff;
    box-shadow: 0 0 10px rgba(200, 0, 0, 0.5);
}

.slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, #1a1a2a 0%, #2a2a3a 100%);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(180deg, #ffd700 0%, #cc9900 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(180deg, #ffd700 0%, #cc9900 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.presets-container {
    background: linear-gradient(180deg, #252535 0%, #1a1a2a 100%);
    border: 2px solid #3a3a4a;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.presets-container h3 {
    font-family: 'VT323', monospace;
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 18px;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preset-btn {
    background: linear-gradient(180deg, #3a3a4e 0%, #2a2a3e 100%);
    border: 2px solid #4a4a5e;
    color: #ccc;
    padding: 10px 16px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: linear-gradient(180deg, #4a4a5e 0%, #3a3a4e 100%);
    color: #fff;
    border-color: #ffd700;
}

.preset-btn.randomize {
    background: linear-gradient(180deg, #4a3a5e 0%, #3a2a4e 100%);
    border-color: #6a4a7e;
}

.preset-btn.reset {
    background: linear-gradient(180deg, #5e3a3a 0%, #4e2a2a 100%);
    border-color: #7e4a4a;
}

.keyboard-container {
    background: linear-gradient(180deg, #252535 0%, #1a1a2a 100%);
    border: 2px solid #3a3a4a;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.keyboard-container h3 {
    font-family: 'VT323', monospace;
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 18px;
}

.keyboard-mode {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.kbd-mode-btn {
    background: linear-gradient(180deg, #2a2a3a 0%, #1a1a2a 100%);
    border: 2px solid #3a3a4a;
    color: #888;
    padding: 8px 16px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    min-width: 50px;
}

.kbd-mode-btn.active {
    background: linear-gradient(180deg, #cc0000 0%, #880000 100%);
    border-color: #ff4444;
    color: #fff;
}

.piano-keyboard {
    display: flex;
    position: relative;
    height: 120px;
    background: #111;
    border-radius: 5px;
    padding: 10px 5px;
    overflow-x: auto;
}

.white-key {
    flex: 1;
    min-width: 40px;
    max-width: 60px;
    background: linear-gradient(180deg, #f5f5f5 0%, #d0d0d0 100%);
    border: 1px solid #888;
    border-radius: 0 0 5px 5px;
    margin: 0 2px;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    transition: all 0.1s;
    position: relative;
}

.white-key span {
    font-size: 10px;
    color: #666;
}

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

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

.black-key {
    width: 30px;
    height: 65%;
    background: linear-gradient(180deg, #333 0%, #111 100%);
    border: 1px solid #000;
    border-radius: 0 0 4px 4px;
    margin: 0 -15px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 5px;
    transition: all 0.1s;
}

.black-key span {
    font-size: 8px;
    color: #666;
}

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

.black-key:active, .black-key.pressed {
    background: linear-gradient(180deg, #cc0000 0%, #880000 100%);
    transform: translateY(2px);
}

.master-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #252535 0%, #1a1a2a 100%);
    border: 2px solid #3a3a4a;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.master-volume {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.master-volume label {
    font-family: 'VT323', monospace;
    color: #ffd700;
    font-size: 16px;
}

.master-slider {
    width: 200px;
}

.audio-toggle {
    background: linear-gradient(180deg, #00aa00 0%, #006600 100%);
    border: 3px solid #00ff00;
    color: #fff;
    padding: 15px 30px;
    font-family: 'VT323', monospace;
    font-size: 20px;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    transition: all 0.2s;
}

.audio-toggle:hover {
    background: linear-gradient(180deg, #00cc00 0%, #008800 100%);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
}

.audio-toggle.active {
    background: linear-gradient(180deg, #cc0000 0%, #880000 100%);
    border-color: #ff4444;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
}

footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 12px;
}

footer a {
    color: #ffd700;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.disclaimer {
    margin-top: 5px;
    font-size: 10px;
    color: #444;
}

@media (max-width: 768px) {
    #app {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 10px;
    }
    
    .powered-by {
        position: static;
        transform: none;
    }
    
    #oscilloscope {
        height: 150px;
    }
    
    .channels-container {
        grid-template-columns: 1fr;
    }
    
    .duty-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preset-buttons {
        justify-content: center;
    }
    
    .piano-keyboard {
        height: 100px;
    }
    
    .white-key {
        min-width: 30px;
    }
    
    .black-key {
        width: 22px;
        margin: 0 -11px;
    }
    
    .master-slider {
        width: 150px;
    }
}