* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-size: 2.5em;
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-controls {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 25px;
    margin-bottom: 30px;
}

.piano-keyboard {
    display: flex;
    background: rgba(44, 62, 80, 0.9);
    padding: 25px;
    border-radius: 15px;
    height: 220px;
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.key {
    position: relative;
    border: none;
    cursor: pointer;
    transition: all 0.1s ease;
}

.white-key {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    width: 45px;
    height: 180px;
    z-index: 1;
    border-radius: 0 0 8px 8px;
    border: 1px solid #ddd;
    margin: 0 1px;
}

.black-key {
    background: linear-gradient(to bottom, #333, #000);
    width: 28px;
    height: 110px;
    margin-left: -14px;
    margin-right: -14px;
    z-index: 2;
    border-radius: 0 0 5px 5px;
}

.key.pressed {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    transform: translateY(2px);
}

.key.scale-note {
    background: linear-gradient(to bottom, #e74c3c, #c0392b);
}

.key.chord-note {
    background: linear-gradient(to bottom, #27ae60, #229954);
}

.keyboard-info {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 14px;
    color: #bdc3c7;
}

#current-note {
    font-weight: bold;
    color: #3498db;
    margin-top: 5px;
}

.controls-panel {
    background: rgba(44, 62, 80, 0.9);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.controls-panel h3 {
    margin-bottom: 20px;
    color: #feca57;
    border-bottom: 2px solid #34495e;
    padding-bottom: 10px;
    font-size: 1.2em;
}

.control-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.controls-panel select, .controls-panel button {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.controls-panel select {
    background: #34495e;
    color: white;
    border: 2px solid transparent;
}

.controls-panel select:focus {
    border-color: #3498db;
    outline: none;
}

.controls-panel button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
}

.controls-panel button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.controls-panel button:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#play-scale, #play-chord {
    background: linear-gradient(135deg, #27ae60, #229954);
}

#highlight-scale, #highlight-chord {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

#start-mic {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

#stop-mic {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

.theory-info {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.theory-info > div {
    background: rgba(44, 62, 80, 0.9);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.theory-info h3 {
    margin-bottom: 20px;
    color: #feca57;
    border-bottom: 2px solid #34495e;
    padding-bottom: 10px;
    font-size: 1.1em;
}

.notes-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
    min-height: 60px;
    align-items: center;
    justify-content: center;
}

.note-badge {
    background: linear-gradient(135deg, #3498db, #2980b9);
    padding: 12px 18px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
    min-width: 50px;
    text-align: center;
}

#detection-result {
    text-align: center;
    padding: 15px;
    background: #34495e;
    border-radius: 10px;
    margin: 15px 0;
}

#detected-note {
    font-size: 2em;
    font-weight: bold;
    color: #27ae60;
    margin-bottom: 8px;
}

#detected-note.detected {
    animation: pulse 0.5s ease-in-out;
}

#frequency-display {
    font-size: 1.1em;
    color: #bdc3c7;
}

.interval-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.interval-buttons button {
    padding: 10px;
    background: #34495e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.interval-buttons button:hover {
    background: #3498db;
    transform: translateY(-2px);
}

#play-interval {
    background: linear-gradient(135deg, #e67e22, #d35400);
    width: 100%;
    margin-bottom: 15px;
}

#interval-result {
    text-align: center;
    padding: 12px;
    background: #34495e;
    border-radius: 8px;
    margin: 10px 0;
    font-style: italic;
    min-height: 20px;
}

.visualization {
    background: rgba(44, 62, 80, 0.9);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.visualization h3 {
    margin-bottom: 20px;
    color: #feca57;
    border-bottom: 2px solid #34495e;
    padding-bottom: 10px;
}

#wave-canvas {
    width: 100%;
    background: #1a252f;
    border-radius: 8px;
    margin-top: 15px;
    border: 2px solid #34495e;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .main-controls {
        grid-template-columns: 1fr;
    }
    
    .theory-info {
        grid-template-columns: 1fr;
    }
    
    .piano-keyboard {
        height: 180px;
        padding: 15px;
    }
    
    .white-key {
        width: 35px;
        height: 140px;
    }
    
    .black-key {
        width: 22px;
        height: 85px;
        margin-left: -11px;
        margin-right: -11px;
    }
}