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

body {
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 15px 10px;
    background: linear-gradient(180deg, #2C3E50 0%, #1a1a2e 100%);
    border: 4px solid #4ECDC4;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 2px solid #45B7D1;
    border-radius: 4px;
    pointer-events: none;
}

.title {
    font-size: 18px;
    color: #FF6B6B;
    text-shadow: 2px 2px 0 #000, 4px 4px 0 #2C3E50;
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 8px;
    color: #4ECDC4;
    letter-spacing: 1px;
}

.controller-icon {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 20px;
}

/* Canvas */
.canvas-container {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.visualizer-canvas {
    border: 4px solid #4ECDC4;
    border-radius: 8px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width: 100%;
    max-width: 460px;
    height: auto;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
}

/* Controls Panel */
.controls-panel {
    background: linear-gradient(180deg, #2C3E50 0%, #1a1a2e 100%);
    border: 4px solid #FF6B6B;
    border-radius: 8px;
    padding: 12px;
    flex: 1;
}

/* Piano */
.piano-section {
    margin-bottom: 15px;
}

.section-label {
    font-size: 8px;
    color: #4ECDC4;
    margin-bottom: 8px;
    text-align: center;
}

.piano {
    display: flex;
    justify-content: center;
    height: 80px;
    position: relative;
    background: #1a1a2e;
    border-radius: 4px;
    padding: 5px;
    overflow-x: auto;
}

.piano-key {
    position: relative;
    cursor: pointer;
    transition: all 0.05s;
}

.piano-key.white {
    width: 20px;
    height: 70px;
    background: linear-gradient(180deg, #fff 0%, #e0e0e0 100%);
    border: 2px solid #333;
    border-radius: 0 0 4px 4px;
    z-index: 1;
}

.piano-key.black {
    width: 14px;
    height: 45px;
    background: linear-gradient(180deg, #333 0%, #000 100%);
    border: 2px solid #000;
    border-radius: 0 0 3px 3px;
    margin-left: -7px;
    margin-right: -7px;
    z-index: 2;
}

.piano-key.white.active {
    background: linear-gradient(180deg, #4ECDC4 0%, #45B7D1 100%);
    transform: translateY(2px);
}

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

.key-hint {
    font-size: 6px;
    color: #888;
    text-align: center;
    margin-top: 8px;
}

/* Control Row */
.control-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.control-group {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    border: 2px solid #333;
}

.control-label {
    font-size: 7px;
    color: #4ECDC4;
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.button-group {
    display: flex;
    gap: 4px;
}

.wave-btn {
    flex: 1;
    padding: 6px 4px;
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    background: #1a1a2e;
    color: #888;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s;
}

.wave-btn:hover {
    background: #2C3E50;
}

.wave-btn.active {
    background: #FF6B6B;
    color: #fff;
    border-color: #c0392b;
}

.select-control {
    width: 100%;
    padding: 6px;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    background: #1a1a2e;
    color: #fff;
    border: 2px solid #4ECDC4;
    border-radius: 4px;
    cursor: pointer;
}

.slider-control {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #1a1a2e;
    border-radius: 4px;
    outline: none;
    border: 2px solid #333;
}

.slider-control::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4ECDC4;
    border-radius: 2px;
    cursor: pointer;
    border: 2px solid #fff;
}

.slider-control::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4ECDC4;
    border-radius: 2px;
    cursor: pointer;
    border: 2px solid #fff;
}

/* Action Buttons */
.action-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.action-btn {
    padding: 10px 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    background: linear-gradient(180deg, #4ECDC4 0%, #45B7D1 100%);
    color: #1a1a2e;
    border: 3px solid #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
    text-shadow: none;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 #2C3E50;
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.action-btn.playing {
    background: linear-gradient(180deg, #FF6B6B 0%, #c0392b 100%);
    color: #fff;
}

.action-btn.demo {
    background: linear-gradient(180deg, #F39C12 0%, #D68910 100%);
}

.action-btn.jazz {
    background: linear-gradient(180deg, #9B59B6 0%, #8E44AD 100%);
    color: #fff;
}

.action-btn.jazz.active {
    background: linear-gradient(180deg, #E74C3C 0%, #C0392B 100%);
    animation: jazz-pulse 0.5s infinite alternate;
}

@keyframes jazz-pulse {
    from { box-shadow: 0 0 10px #E74C3C; }
    to { box-shadow: 0 0 20px #F39C12; }
}

.action-btn.info {
    background: linear-gradient(180deg, #3498DB 0%, #2980B9 100%);
    color: #fff;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: linear-gradient(180deg, #2C3E50 0%, #1a1a2e 100%);
    border: 4px solid #F39C12;
    border-radius: 12px;
    padding: 20px;
    max-width: 400px;
    text-align: center;
    animation: modal-pop 0.3s ease-out;
}

@keyframes modal-pop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 14px;
    color: #F39C12;
    margin-bottom: 15px;
    text-shadow: 2px 2px 0 #000;
}

.modal-text {
    font-size: 8px;
    line-height: 1.8;
    color: #fff;
    margin-bottom: 15px;
}

.modal-small {
    font-size: 7px;
    color: #888;
}

.modal-close {
    padding: 12px 24px;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    background: linear-gradient(180deg, #4ECDC4 0%, #45B7D1 100%);
    color: #1a1a2e;
    border: 3px solid #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.1s;
}

.modal-close:hover {
    transform: scale(1.05);
}

/* Footer */
.footer {
    text-align: center;
    padding: 15px;
    font-size: 7px;
    color: #888;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

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

.footer a:hover {
    color: #4ECDC4;
}

.separator {
    color: #444;
}

/* Responsive */
@media (max-width: 480px) {
    .title {
        font-size: 14px;
    }
    
    .control-row {
        grid-template-columns: 1fr;
    }
    
    .action-row {
        grid-template-columns: 1fr;
    }
    
    .piano-key.white {
        width: 16px;
    }
    
    .piano-key.black {
        width: 12px;
        margin-left: -6px;
        margin-right: -6px;
    }
}

/* CRT Effect */
.app-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03),
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
}