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

body {
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
    background: url('background/playingmusic1.png') no-repeat center center fixed;
    background-size: cover;
    background-attachment: scroll; /* Better iPad compatibility */
    overflow: hidden;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: background-image 0.5s ease-in-out;
    position: relative;
    /* iPad-specific optimizations */
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
}

/* Numbers 1-10 background graphics */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 30%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(69, 183, 209, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(150, 206, 180, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(254, 202, 87, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* iPad-specific background optimizations */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
    body {
        background-attachment: scroll;
        background-size: cover;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
    }
    
    body.count-3, body.count-4, body.count-5, body.count-6, 
    body.count-7, body.count-8, body.count-9, body.count-10 {
        background-attachment: scroll;
        background-size: cover;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
    }
}



body.count-3 {
    background-image: url('background/playingmusic2.png');
}

body.count-4 {
    background-image: url('background/playingmusic3.png');
}

body.count-5 {
    background-image: url('background/playingmusic2.png');
}

body.count-6 {
    background-image: url('background/playingmusic3.png');
}

body.count-7 {
    background-image: url('background/playingmusic2.png');
}

body.count-8 {
    background-image: url('background/playingmusic3.png');
}

body.count-9 {
    background-image: url('background/playingmusic2.png');
}

body.count-10 {
    background-image: url('background/end.png');
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 500px;
    padding: 40px;
}

.loading-content h1 {
    font-size: 3rem;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-bar-container {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-text {
    font-size: 1.2rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.loading-progress {
    font-size: 1.5rem;
    font-weight: bold;
    opacity: 0.8;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Top center counter */
.counter-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    min-width: 150px;
    text-align: center;
}

.big-number {
    font-size: 8rem;
    font-weight: bold;
    color: #4a90e2;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
    line-height: 1;
    min-width: 800px;
    text-align: center;
}

/* Responsive design for different devices */
@media (max-width: 1200px) {
    .big-number {
        font-size: 6rem;
        min-width: 600px;
    }
    
    .counter-display {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .big-number {
        font-size: 4rem;
        min-width: 400px;
    }
    
    .counter-display {
        padding: 15px;
        top: 15px;
    }
}

@media (max-width: 480px) {
    .big-number {
        font-size: 2.5rem;
        min-width: 250px;
    }
    
    .counter-display {
        padding: 10px;
        top: 8px;
    }
}

.counter-label {
    display: none;
}

/* Bottom center dots display */
.dots-display {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    max-width: 600px;
}

.dots-label {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
    text-align: center;
}

/* Responsive dots for different devices */
@media (max-width: 768px) {
    .dots-display {
        padding: 15px;
        bottom: 15px;
        max-width: 500px;
    }
    
    .dots-container {
        gap: 12px;
        padding: 8px;
    }
    
    .dot {
        width: 28px;
        height: 28px;
    }
    
    .dots-label {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .dots-display {
        padding: 10px;
        bottom: 8px;
        max-width: 350px;
        max-width: 85vw;
    }
    
    .dots-container {
        gap: 6px;
        padding: 5px;
    }
    
    .dot {
        width: 18px;
        height: 18px;
    }
    
    .dots-label {
        font-size: 0.8rem;
    }
}

.dots-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    padding: 10px;
}

.dot {
    width: 35px;
    height: 35px;
    background: #ff4757;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    animation: popIn 0.3s ease-out;
}

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

/* Main game area */
.game-area {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}



.instructions {
    text-align: center;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    animation: float 3s ease-in-out infinite;
}

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

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

.instructions p {
    font-size: 1.2rem;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive instructions */
@media (max-width: 768px) {
    .instructions {
        padding: 25px;
        max-width: 90vw;
    }
    
    .instructions h1 {
        font-size: 2rem;
    }
    
    .instructions p {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .instructions {
        padding: 20px;
        max-width: 95vw;
    }
    
    .instructions h1 {
        font-size: 1.8rem;
    }
    
    .instructions p {
        font-size: 1rem;
    }
}

/* Instruments */
.instrument {
    position: absolute;
    width: 200px;
    height: 200px;
    cursor: pointer;
    transition: all 0.5s ease;
    animation: instrumentAppear 0.5s ease-out;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
    background: transparent;
}

.instrument img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
}

@keyframes instrumentAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(-90deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.instrument:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.4));
}

.instrument img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.instrument.playing {
    animation: playAnimation 0.5s ease-in-out;
}

@keyframes playAnimation {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1) rotate(5deg);
    }
    75% {
        transform: scale(1.1) rotate(-5deg);
    }
}

/* Sound wave effect */
.sound-wave {
    position: absolute;
    border: 2px solid #4a90e2;
    border-radius: 50%;
    animation: soundWave 1s ease-out forwards;
    pointer-events: none;
}

@keyframes soundWave {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        transform: translate(-50%, -50%);
    }
}



/* Responsive Loading Screen */
@media (max-width: 768px) {
    .loading-content h1 {
        font-size: 2.5rem;
        margin-bottom: 30px;
    }
    
    .loading-content {
        padding: 30px;
        max-width: 90vw;
    }
    
    .loading-bar-container {
        height: 18px;
        margin-bottom: 15px;
    }
    
    .loading-text {
        font-size: 1.1rem;
    }
    
    .loading-progress {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .loading-content h1 {
        font-size: 2rem;
        margin-bottom: 25px;
    }
    
    .loading-content {
        padding: 25px;
        max-width: 95vw;
    }
    
    .loading-bar-container {
        height: 16px;
        margin-bottom: 12px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .loading-progress {
        font-size: 1.2rem;
    }
}

/* Responsive design for iPad */
@media (max-width: 1024px) {
    .big-number {
        font-size: 6rem;
        min-width: 600px;
    }
    
    .counter-display {
        padding: 20px;
        min-width: 120px;
    }
    
    .dots-display {
        max-width: 400px;
        padding: 15px;
    }
    
    .dot {
        width: 30px;
        height: 30px;
    }
    
    .instrument {
        width: 150px;
        height: 150px;
    }
    
    .instructions h1 {
        font-size: 2rem;
    }
    
    .instructions p {
        font-size: 1rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .instrument {
        width: 150px;
        height: 150px;
    }
    
    .counter-display,
    .dots-display {
        padding: 25px;
    }
    
    .big-number {
        font-size: 7rem;
        min-width: 700px;
    }
}

/* Comprehensive responsive design for all devices */
@media (max-width: 768px) {
    .instrument {
        width: 120px;
        height: 120px;
    }
    
    .sound-wave {
        width: 120px;
        height: 120px;
    }
    
    .music-control-btn,
    .stop-music-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .qr-code-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .copyright p {
        font-size: 0.7rem;
        padding: 8px 12px;
    }
    

}

@media (max-width: 480px) {
    .instrument {
        width: 90px;
        height: 90px;
    }
    
    .sound-wave {
        width: 90px;
        height: 90px;
    }
    
    .music-control-btn,
    .stop-music-btn {
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    .qr-code-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .copyright p {
        font-size: 0.6rem;
        padding: 6px 10px;
    }
    
    .play-again-btn {
        padding: 15px 30px;
        font-size: 1.5rem;
    }
}



/* Hide instructions after first interaction */
.instructions.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Play again button */
.play-again-btn {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 20px 40px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    animation: bounceIn 0.6s ease-out;
    transition: all 0.3s ease;
}

.play-again-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.play-again-btn.hidden {
    display: none;
}

.music-control-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.music-control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.stop-music-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.stop-music-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.qr-code-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.qr-code-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* QR Code Modal */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.qr-modal.active {
    display: flex;
}

.qr-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.qr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.qr-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.qr-close-btn {
    background: #e74c3c;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-close-btn:hover {
    background: #c0392b;
}

.qr-code-container {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-url {
    margin-top: 20px;
}

.qr-url p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9rem;
}

.qr-link {
    color: #4a90e2;
    text-decoration: none;
    font-weight: bold;
    word-break: break-all;
}

.qr-link:hover {
    text-decoration: underline;
}

/* Copyright and Credit */
.copyright {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

.copyright p {
    margin: 0;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.copyright p:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}



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

/* Celebration animation for milestones */
.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 6rem;
    animation: celebration 3s ease-out forwards;
    pointer-events: none;
    z-index: 2000;
}

@keyframes celebration {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    25% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 1;
    }
    75% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Birthday celebration overlay */
.birthday-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff9ff3, #f368e0, #ff6b6b, #ee5a24, #ff9ff3);
    background-size: 400% 400%;
    animation: gradientShift 2s ease-in-out infinite;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.birthday-overlay.active {
    opacity: 1;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Clapping hands animation */
.clapping-hands {
    position: fixed;
    font-size: 4rem;
    animation: clap 0.5s ease-in-out infinite;
    z-index: 2000;
    pointer-events: none;
}

@keyframes clap {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}
