body {
    margin: 0;
    min-height: 100vh;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    background:
        radial-gradient(circle at top,
        #1f1f25,
        #0f0f12 60%);

    font-family: "Poppins", sans-serif;

    color: #f5f5f5;

    overflow-x: hidden;
}


h1 {
    font-family: "Great Vibes", cursive;

    font-size: 5.5rem;

    font-weight: normal;

    letter-spacing: 2px;

    color: white;

    text-shadow:
        0 0 20px rgba(139,92,246,0.35);
}

h2 {
    font-weight: 300;

    color: #b3b3c2;

    margin-bottom: 5px;
}

em {
    color: #8b5cf6;
}


.piano {
    margin-top: 40px;
    
    padding: 35px;

    border-radius: 28px;

    background:
        linear-gradient(
            145deg,
            #202028,
            #141419
        );

    box-shadow:
        0 25px 50px rgba(0,0,0,0.6),
        inset 0 1px 1px rgba(255,255,255,0.04);

    border:
        1px solid rgba(255,255,255,0.05);
}

.keys {
    display: flex;
    justify-content: center;
    position: relative;
    height: 320px;
}

.key-group {
    position: relative;
}

.key {
    position: relative;
    border-radius: 15px;
    transition:
        transform 0.08s ease,
        box-shadow 0.08s ease,
        filter 0.08s ease,
        background 0.08s ease;
}

.white {
    width: 80px;
    height: 320px;

    background:linear-gradient(
            to bottom,
            #ffffff,
            #e8e8e8
        );
    border:  1px solid rgba(0,0,0,0.15);
    color: #111;
    border-radius: 0 0 12px 12px;

    font-size: 1.2rem;
    font-weight: bold;

    display: flex;
    justify-content: center;
    align-items: flex-end;

    padding-bottom: 20px;

    position: relative;
    z-index: 1;

    box-shadow:
    inset 0 -4px 8px rgba(0,0,0,0.15),
    0 4px 6px rgba(0,0,0,0.2);
}
.black {
    width: 50px;
    height: 200px;

    background:  linear-gradient(
            to bottom,
            #2a2a2f,
            #0f0f12
        );

    border-radius: 0 0 10px 10px;

    color: #f5f5f5;

    position: absolute;

    top: 0;
    right: -25px;

    z-index: 2;

    display: flex;
    justify-content: center;
    align-items: flex-end;

    padding-bottom: 20px;

    font-weight: bold;

    box-shadow:
    0 8px 12px rgba(0,0,0,0.4),
    inset 0 -2px 4px rgba(255,255,255,0.05);
}



.pressed {
    transform: translateY(4px) scale(0.98);

    transition: all 0.08s ease;

    filter: brightness(0.9);
}

.white:hover {
    background: #ffffff;

    transform: translateY(2px);

    cursor: pointer;
}

.black:hover {
    background: #222;

    transform: translateY(2px);

    cursor: pointer;
}

.white.pressed {
    box-shadow:
        0 0 25px rgba(139,92,246,0.5),
        inset 0 -4px 8px rgba(0,0,0,0.2);
}

.black.pressed {
    box-shadow:
        0 0 20px rgba(139,92,246,0.35);
}

body::before {
    content: "";

    position: fixed;

    width: 500px;
    height: 500px;

    background:
        radial-gradient(
            circle,
            rgba(139,92,246,0.18),
            transparent 70%
        );

    top: -120px;
    left: -120px;

    filter: blur(40px);

    z-index: -2;

    animation: floatGlow 8s ease-in-out infinite;
}

body::after {
    content: "";

    position: fixed;

    width: 450px;
    height: 450px;

    background:
        radial-gradient(
            circle,
            rgba(59,130,246,0.12),
            transparent 70%
        );

    bottom: -150px;
    right: -100px;

    filter: blur(50px);

    z-index: -2;

    animation: floatGlow2 10s ease-in-out infinite;
}

@keyframes floatGlow {

    0% {
        transform: translate(0px, 0px);
    }

    50% {
        transform: translate(40px, 30px);
    }

    100% {
        transform: translate(0px, 0px);
    }
}

@keyframes floatGlow2 {

    0% {
        transform: translate(0px, 0px);
    }

    50% {
        transform: translate(-30px, -20px);
    }

    100% {
        transform: translate(0px, 0px);
    }
}

body::selection {
    background: #8b5cf6;
}

.noise {
    position: fixed;

    inset: 0;

    background-image:
        url("https://www.transparenttextures.com/patterns/asfalt-light.png");

    opacity: 0.03;

    pointer-events: none;

    z-index: -1;
}

.piano::before {
    content: "";

    position: absolute;

    width: 120%;
    height: 120px;

    background:
        radial-gradient(
            rgba(139,92,246,0.18),
            transparent 70%
        );

    bottom: -40px;
    left: -10%;

    filter: blur(35px);

    z-index: -1;
}

.controls {
    display: flex;
    gap: 12px;
    margin: 24px 0 8px;
}

.controls button {
    padding: 10px 22px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: linear-gradient(145deg, #202028, #141419);
    color: #b3b3c2;
    font-family: "Poppins", sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.controls button:hover:not(:disabled) {
    background: linear-gradient(145deg, #2a2a35, #1a1a22);
    color: #f5f5f5;
    box-shadow: 0 0 14px rgba(139,92,246,0.3);
}

.controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Pulsing red glow when recording is active */
#btn-record.recording {
    color: #f87171;
    box-shadow: 0 0 16px rgba(248,113,113,0.45);
    animation: recordPulse 1.2s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(248,113,113,0.35); }
    50%       { box-shadow: 0 0 24px rgba(248,113,113,0.7);  }
}
.controls-secondary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    color: #b3b3c2;
    font-size: 0.85rem;
}

#speed-slider {
    -webkit-appearance: none;
    width: 140px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    outline: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

#speed-slider:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(139,92,246,0.5);
}

#speed-label {
    min-width: 28px;
    color: #8b5cf6;
    font-weight: 500;
}