@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #151932;
    --bg-tertiary: #1e2442;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --white-key: #ffffff;
    --white-key-active: #e2e8f0;
    --black-key: #1a202c;
    --black-key-active: #2d3748;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
}

.container {
    max-width: 1200px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    animation: fadeIn 1s ease-out 0.2s both;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-secondary);
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.volume-control label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.volume-icon {
    font-size: 1.3rem;
}

#volume {
    width: 120px;
    height: 6px;
    border-radius: 5px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

#volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-gradient);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease;
}

#volume::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#volume::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-gradient);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease;
}

#volume::-moz-range-thumb:hover {
    transform: scale(1.2);
}

#volume-value {
    min-width: 45px;
    font-weight: 600;
    color: var(--accent-primary);
}

.toggle-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid rgba(99, 102, 241, 0.3);
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    font-family: 'Poppins', sans-serif;
}

.toggle-btn:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.toggle-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.piano-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    animation: fadeInUp 1s ease-out 0.4s both;
}

.piano {
    display: flex;
    position: relative;
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.key {
    position: relative;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    transition: all 0.1s ease;
    border-radius: 0 0 8px 8px;
}

.key.white {
    width: 60px;
    height: 240px;
    background: var(--white-key);
    border: 2px solid #e2e8f0;
    margin: 0 2px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.key.white:hover {
    background: #f7fafc;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.key.white.active {
    background: var(--white-key-active);
    transform: translateY(2px);
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.2);
}

.key.black {
    width: 40px;
    height: 150px;
    background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
    border: 2px solid #0a0e27;
    position: absolute;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.key.black:hover {
    background: linear-gradient(180deg, #3d4758 0%, #2a303c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.key.black.active {
    background: var(--black-key-active);
    transform: translateY(2px);
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.5);
}

/* Position black keys */
.key.black[data-key="W"] { left: 72px; }
.key.black[data-key="E"] { left: 136px; }
.key.black[data-key="T"] { left: 264px; }
.key.black[data-key="Y"] { left: 328px; }
.key.black[data-key="U"] { left: 392px; }
.key.black[data-key="O"] { left: 520px; }
.key.black[data-key="P"] { left: 584px; }

.key-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.key.white .key-label {
    color: var(--black-key);
}

.key.black .key-label {
    color: var(--white-key);
}

.note-label {
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 12px;
    opacity: 0.5;
}

.key.white .note-label {
    color: var(--black-key);
}

.key.black .note-label {
    color: var(--white-key);
}

.hide-keys .key-label,
.hide-keys .note-label {
    opacity: 0;
}

.info {
    text-align: center;
    animation: fadeIn 1.2s ease-out 0.6s both;
}

.info p {
    margin: 10px 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.hint {
    font-size: 0.95rem !important;
    color: var(--text-secondary);
    opacity: 0.7;
    font-weight: 300;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .piano {
        padding: 20px;
        transform: scale(0.7);
        transform-origin: center;
    }

    .controls {
        gap: 15px;
    }

    .volume-control {
        padding: 12px 20px;
    }

    #volume {
        width: 100px;
    }

    .info p {
        font-size: 0.95rem;
    }

    .hint {
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .piano {
        transform: scale(0.5);
    }
}
