body {
    margin: 0;
    overflow: hidden;
    background-color: #87CEEB;
    /* soft sky */
    font-family: 'Courier New', Courier, monospace;
    user-select: none;
}

.overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    text-shadow: 2px 2px 0 #cc5b7b;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.5s ease;
}

#ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    text-shadow: 2px 2px 0 #cc5b7b;
    z-index: 10;
    cursor: pointer;
    background: rgba(255, 183, 197, 0.4);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    border: 3px solid white;
}

#ui.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    margin-top: 0;
}

p,
h2 {
    font-size: 1.2rem;
    line-height: 1.5;
}

#start-screen p {
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

#loading {
    background-color: #87CEEB;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 20;
}

#loading.hidden {
    display: none;
}

#hud {
    position: absolute;
    top: 25px;
    left: 30px;
    right: 30px;
    height: 50px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 0 #cc5b7b;
    pointer-events: none;
    z-index: 5;
}

#score-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

#time-display {
    position: absolute;
    right: 0;
}

#audio-control {
    position: absolute;
    top: 25px;
    left: 30px;
    font-size: 2.5rem;
    z-index: 100;
    cursor: pointer;
    background: none;
    padding: 0;
    border: none;
    pointer-events: auto;
    transition: transform 0.2s, opacity 0.2s;
    /* 이모지를 하얗게 만들고 핑크 그림자 부여 */
    filter: grayscale(100%) brightness(200%) drop-shadow(2px 2px 0 #cc5b7b);
    opacity: 0.8;
}

#audio-control:hover {
    transform: scale(1.1);
    opacity: 1.0;
}

#combo-display {
    position: absolute;
    left: 50%;
    top: 55px;
    transform: translateX(-50%);
    color: #ffeb3b;
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 2px 2px 0 #cc5b7b, -2px -2px 0 #cc5b7b, 2px -2px 0 #cc5b7b, -2px 2px 0 #cc5b7b;
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.2); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

#audio-control-container {
    position: absolute;
    top: 25px;
    left: 30px;
    z-index: 100;
    display: flex;
    align-items: center;
    background: rgba(255, 183, 197, 0.6);
    padding: 10px 15px;
    border-radius: 15px;
    pointer-events: auto;
    border: 2px solid white;
}

#volume-slider {
    cursor: pointer;
    width: 100px;
}

#player-id {
    font-family: inherit;
    font-size: 1.2rem;
    padding: 10px;
    border: 2px solid white;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    color: #cc5b7b;
    text-align: center;
    margin-bottom: 15px;
    pointer-events: auto;
}

#player-id:focus {
    outline: none;
    border-color: #ffeb3b;
    background: white;
}

#lives-display {
    position: absolute;
    right: 0;
}

#leaderboard-container {
    margin: 15px 0;
    max-height: 150px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px;
    border: 1px solid white;
}

#leaderboard-container h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: #ffeb3b;
    text-shadow: 1px 1px 0 #cc5b7b;
}

#leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    font-size: 1rem;
}

#leaderboard-list li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    border-bottom: 1px dashed rgba(255,255,255,0.5);
    padding-bottom: 3px;
}

#leaderboard-container::-webkit-scrollbar {
    width: 8px;
}
#leaderboard-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1); 
    border-radius: 4px;
}
#leaderboard-container::-webkit-scrollbar-thumb {
    background: rgba(255, 183, 197, 0.8); 
    border-radius: 4px;
}

.heart {
    transition: all 0.3s ease;
    display: inline-block;
    margin-left: 5px;
}

.heart-lost {
    opacity: 0.3;
    filter: grayscale(100%);
    transform: scale(0.8);
}

.mobile-only {
    display: none !important;
}

@media (pointer: coarse), (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }
    
    /* Reduce HUD size to prevent portrait overlap */
    #hud {
        top: 10px;
        left: 10px;
        right: 10px;
    }
    #score-display, #combo-display, #lives-display {
        font-size: 1rem !important;
        padding: 4px 8px !important;
        border-radius: 8px !important;
        border-width: 1px !important;
    }
    .heart {
        margin-left: 2px !important;
        font-size: 1rem !important;
    }
    
    #audio-control-container {
        top: 55px !important;
        left: 10px !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        pointer-events: none !important;
    }
    #audio-control-container > div:first-child {
        display: none !important;
    }
    #youtube-wrapper {
        position: absolute !important;
        left: -9999px !important;
        opacity: 0.01 !important;
        pointer-events: none !important;
    }

    #btn-quit {
        position: absolute;
        top: 55px;
        right: 10px;
        background: rgba(255, 0, 0, 0.5);
        color: white;
        border: 2px solid white;
        border-radius: 10px;
        padding: 5px 15px;
        font-family: inherit;
        font-size: 1.2rem;
        pointer-events: auto;
    }
    
    #mobile-controls {
        position: fixed;
        bottom: 30px;
        left: 0;
        width: 100%;
        display: flex !important;
        justify-content: space-around;
        pointer-events: none;
        z-index: 100;
    }

    #mobile-controls button {
        background: rgba(255, 183, 197, 0.6);
        border: 3px solid white;
        color: white;
        font-family: inherit;
        font-size: 1.5rem;
        font-weight: bold;
        border-radius: 20px;
        padding: 15px;
        pointer-events: auto;
        user-select: none;
        width: 30%;
        box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    }
    
    #mobile-controls button:active {
        background: rgba(255, 183, 197, 0.9);
        transform: translateY(2px);
        box-shadow: none;
    }
    
    #instructions {
        display: none !important;
    }
}