* {
    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;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem;
    text-align: center;
    color: white;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.instructions {
    margin-top: 1rem;
    font-size: 1.1rem;
    opacity: 0.9;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

main {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.piano-container {
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.bubble-piano {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 
        inset -5px -5px 10px rgba(0, 0, 0, 0.1),
        inset 5px 5px 10px rgba(255, 255, 255, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #764ba2;
    animation: float 3s ease-in-out infinite;
}

.bubble-piano::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 25%;
    width: 20%;
    height: 20%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent);
    border-radius: 50%;
}

.key-label {
    position: absolute;
    bottom: 5px;
    font-size: 0.8rem;
    color: #666;
}

.note-label {
    font-size: 1.2rem;
    z-index: 1;
}

.bubble-piano:hover {
    transform: scale(1.1);
    box-shadow: 
        inset -5px -5px 10px rgba(0, 0, 0, 0.1),
        inset 5px 5px 10px rgba(255, 255, 255, 0.5),
        0 6px 12px rgba(0, 0, 0, 0.3);
}

.bubble-piano.popping {
    animation: pop 0.4s ease-out forwards;
}

.bubble-piano.active {
    transform: scale(0.95);
    background: radial-gradient(circle at 30% 30%, rgba(255, 200, 200, 0.8), rgba(255, 150, 150, 0.4));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes pop {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.pop-effect {
    position: absolute;
    pointer-events: none;
    width: 100px;
    height: 100px;
    animation: popEffect 0.6s ease-out forwards;
}

.pop-effect::before,
.pop-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.pop-effect::before {
    animation: ripple 0.6s ease-out forwards;
}

.pop-effect::after {
    animation: ripple 0.6s ease-out 0.1s forwards;
}

@keyframes popEffect {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

.controls {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: calc(100% - 2rem);
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.recording {
    background: rgba(255, 100, 100, 0.5);
    border-color: rgba(255, 100, 100, 0.7);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 100, 100, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 100, 100, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 100, 100, 0); }
}

.keyboard-hint {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 15px;
    color: white;
    font-size: 0.9rem;
}

.keyboard-hint h3 {
    margin-bottom: 0.5rem;
}

.key-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.key {
    background: rgba(255, 255, 255, 0.3);
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-family: monospace;
    font-weight: bold;
}

.achievement {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: rgba(255, 255, 255, 0.95);
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 1000;
    animation: achievementPop 0.4s ease-out forwards;
    max-width: 300px;
}

@keyframes achievementPop {
    0% {
        transform: translateX(-50%) scale(0) translateY(10px);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) scale(1.02) translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) scale(1) translateY(0);
        opacity: 1;
    }
}

.achievement h2 {
    color: #764ba2;
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.achievement p {
    color: #666;
    font-size: 0.9rem;
}

.recording-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 100, 100, 0.95);
    color: white;
    padding: 1.2rem 2rem;
    border-radius: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    display: none;
    z-index: 1001;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    min-width: 200px;
    text-align: center;
}

.recording-indicator.active {
    display: block;
    animation: recordingPulse 1.5s infinite;
}

.recording-indicator .count {
    font-size: 1.5rem;
    color: #ffeb3b;
    margin: 0 0.3rem;
}

@keyframes recordingPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.05); 
        box-shadow: 0 15px 50px rgba(255, 100, 100, 0.6);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .instructions {
        font-size: 0.9rem;
        margin-top: 0.5rem;
    }
    
    .stats {
        gap: 0.5rem;
        margin-top: 0.5rem;
    }
    
    .stat-item {
        padding: 0.3rem 0.8rem;
        border-radius: 20px;
        min-width: 70px;
        justify-content: center;
    }
    
    .stat-icon {
        font-size: 1rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    main {
        padding: 1rem;
        padding-bottom: 6rem; /* Space for controls */
    }
    
    .piano-container {
        gap: 10px;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .bubble-piano {
        width: 60px;
        height: 60px;
    }
    
    .note-label {
        font-size: 1rem;
    }
    
    .key-label {
        font-size: 0.7rem;
    }
    
    .keyboard-hint {
        display: none;
    }
    
    .controls {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        justify-content: center;
        gap: 0.5rem;
        background: rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(10px);
        padding: 0.5rem;
        border-radius: 30px;
        max-width: none;
    }
    
    .control-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        flex: 1;
        justify-content: center;
    }
    
    .achievement {
        top: 8%;
        padding: 0.6rem 1.2rem;
        max-width: 250px;
    }
    
    .achievement h2 {
        font-size: 1rem;
    }
    
    .achievement p {
        font-size: 0.8rem;
    }
    
    .recording-indicator {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
}