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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin: 20px 0 12px 0;
    font-size: 1.2em;
    text-align: center;
}

/* Song Mode */
.song-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.song-mode h2 {
    color: #fff;
    margin-bottom: 15px;
}

.song-input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.song-input {
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 25px;
    width: 100%;
    max-width: 400px;
    background: #fff;
    color: #333;
    outline: none;
    transition: all 0.3s ease;
}

.song-input:focus {
    border-color: #764ba2;
    box-shadow: 0 0 15px rgba(118, 75, 162, 0.3);
}

.song-input::placeholder {
    color: #999;
}

.load-song-btn {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.load-song-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.song-player {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.song-player.hidden {
    display: none;
}

.nav-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

.song-chords {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 500px;
}

.song-chord-btn {
    padding: 10px 18px;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.song-chord-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.song-chord-btn.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
    border-color: #ff6b6b;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.song-chord-btn.major {
    border-color: rgba(76, 175, 80, 0.5);
}

.song-chord-btn.minor {
    border-color: rgba(33, 150, 243, 0.5);
}

.song-hint {
    margin-top: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Keyboard Source Selector */
.keyboard-source-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    flex-wrap: wrap;
}

.keyboard-source-selector span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
}

.source-btn {
    padding: 8px 16px;
    font-size: 13px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.source-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.source-btn.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
    border-color: #ff6b6b;
    color: white;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    flex-wrap: wrap;
}

.mode-label {
    font-weight: 600;
    color: #333;
}

.mode-btn {
    padding: 10px 25px;
    font-size: 14px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.keyboard-hint {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Piano Container */
.piano-container {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    margin: 20px 0;
    background: linear-gradient(to bottom, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 15px;
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.5);
    overflow-x: auto;
}

/* Piano Keyboard */
.piano {
    position: relative;
    display: inline-flex;
    height: 280px;
    padding: 20px;
    background: #0a0a0a;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

/* White Keys */
.key.white {
    width: 50px;
    height: 240px;
    background: linear-gradient(to bottom, #ffffff 0%, #f5f5f5 100%);
    border: 1px solid #222;
    border-radius: 0 0 5px 5px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
}

.key.white:hover {
    background: linear-gradient(to bottom, #f0f0f0 0%, #e8e8e8 100%);
}

.key.white:active {
    background: linear-gradient(to bottom, #e0e0e0 0%, #d8d8d8 100%);
    transform: translateY(2px);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.key-label {
    font-size: 11px;
    color: #999;
    font-weight: bold;
    user-select: none;
}

/* Black Keys */
.key.black {
    width: 32px;
    height: 150px;
    background: linear-gradient(to bottom, #2a2a2a 0%, #000000 100%);
    border: 1px solid #000;
    border-radius: 0 0 3px 3px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: absolute;
    z-index: 2;
    top: 20px;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.8);
}

.key.black:hover {
    background: linear-gradient(to bottom, #444 0%, #111 100%);
}

.key.black:active {
    background: linear-gradient(to bottom, #1a1a1a 0%, #000 100%);
    transform: translateY(2px);
}

/* Position black keys between white keys */
.key.black[data-black-pos="0"] {
    left: calc(20px + 50px * 0 + 50px * 0.7);
}

/* C# */
.key.black[data-black-pos="1"] {
    left: calc(20px + 50px * 1 + 50px * 0.7);
}

/* D# */
.key.black[data-black-pos="3"] {
    left: calc(20px + 50px * 3 + 50px * 0.7);
}

/* F# */
.key.black[data-black-pos="4"] {
    left: calc(20px + 50px * 4 + 50px * 0.7);
}

/* G# */
.key.black[data-black-pos="5"] {
    left: calc(20px + 50px * 5 + 50px * 0.7);
}

/* A# */
.key.black[data-black-pos="7"] {
    left: calc(20px + 50px * 7 + 50px * 0.7);
}

/* C#2 */
.key.black[data-black-pos="8"] {
    left: calc(20px + 50px * 8 + 50px * 0.7);
}

/* D#2 */
.key.black[data-black-pos="10"] {
    left: calc(20px + 50px * 10 + 50px * 0.7);
}

/* F#2 */

/* Active/highlighted keys */
.key.active {
    box-shadow: 0 0 25px 8px rgba(255, 107, 107, 0.8);
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.key.white.active {
    background: linear-gradient(to bottom, #ff6b6b 0%, #ff5252 100%);
}

.key.white.active .key-label {
    color: white;
}

.key.black.active {
    background: linear-gradient(to bottom, #ff4444 0%, #cc0000 100%);
}

/* Controls */
.controls {
    text-align: center;
    margin-top: 30px;
}

.chord-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

/* Chord Buttons */
.chord-btn {
    padding: 10px 18px;
    font-size: 14px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-width: 60px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chord-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* Major chord buttons */
.chord-btn.major {
    border-color: #4CAF50;
    color: #4CAF50;
}

.chord-btn.major:hover {
    background: #4CAF50;
    color: white;
}

.chord-btn.major.active {
    background: #4CAF50;
    color: white;
}

/* Major Sharp chord buttons */
.chord-btn.major-sharp {
    border-color: #2E7D32;
    color: #2E7D32;
    background: linear-gradient(135deg, #fff 0%, #e8f5e9 100%);
}

.chord-btn.major-sharp:hover {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    color: white;
}

.chord-btn.major-sharp.active {
    background: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    color: white;
}

/* Minor chord buttons */
.chord-btn.minor {
    border-color: #2196F3;
    color: #2196F3;
}

.chord-btn.minor:hover {
    background: #2196F3;
    color: white;
}

.chord-btn.minor.active {
    background: #2196F3;
    color: white;
}

/* Minor Sharp chord buttons */
.chord-btn.minor-sharp {
    border-color: #1565C0;
    color: #1565C0;
    background: linear-gradient(135deg, #fff 0%, #e3f2fd 100%);
}

.chord-btn.minor-sharp:hover {
    background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%);
    color: white;
}

.chord-btn.minor-sharp.active {
    background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%);
    color: white;
}

/* Clear button */
.clear-btn {
    padding: 12px 40px;
    font-size: 16px;
    border: 2px solid #e74c3c;
    background: white;
    color: #e74c3c;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    margin-top: 20px;
}

.clear-btn:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

/* Chord Info Display */
.chord-info {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    font-size: 18px;
    color: #333;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 5px solid #667eea;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .chord-btn {
        min-width: 55px;
        padding: 8px 14px;
        font-size: 13px;
    }

    .mode-selector {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.1em;
    }

    .piano {
        transform: scale(0.8);
        transform-origin: left center;
    }

    .chord-btn {
        min-width: 50px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .chord-info {
        font-size: 16px;
        padding: 15px;
    }

    .song-input {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .piano {
        transform: scale(0.6);
        transform-origin: left center;
    }

    h1 {
        font-size: 1.5em;
    }

    .chord-btn {
        min-width: 45px;
        padding: 6px 10px;
        font-size: 11px;
        gap: 5px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}