/* 기본 스타일 */
@import url('https://fonts.googleapis.com/css2?family=Dongle:wght@300&family=Gamja+Flower&family=Gowun+Dodum&display=swap');
body {
    font-family: "Gowun Dodum", sans-serif;
    background-color: #f0f8ff;
    text-align: center;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-container {
    max-width: 600px;
    width: 90%;
    margin: 20px;
    padding: 20px;
    position: relative;
    background-color: #ffffff;
    border: 2px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    font-size: 2em;
    margin-bottom: 20px;
}

#start-game-button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    background-color: #4CAF50;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 20px;
}

#start-game-button:hover {
    background-color: #45a049;
}

.timer, .score {
    font-size: 1.5em;
    margin: 10px 0;
}

.head-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin: 20px 0;
}

#head {
    width: 300px;
    max-width: 80vw;
    transition: transform 0.1s;
}

.shake {
    animation: shake 0.2s;
}

@keyframes shake {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    50% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

#flakes-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    transform: translateX(-50%);
    z-index: 2; /* 비듬 애니메이션이 누적 비듬보다 위에 오도록 설정 */
}

#accumulated-flakes-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px; /* 누적될 공간 설정 */
    pointer-events: none;
    overflow: hidden;
    z-index: 1; /* 비듬 쌓임이 애니메이션보다 아래에 오도록 설정 */
}

.flake { /* 클래스 이름 오타 수정 */
    position: absolute;
    top: 0;
    width: 10px;
    height: 10px;
    background: rgba(150, 150, 150, 0.9); /* 더 진한 회색으로 변경 */
    border-radius: 50%;
    opacity: 0.8;
    animation: fall 1s linear;
}

@keyframes fall {
    to {
        transform: translateY(300px) rotate(360deg); /* 애니메이션 수정 */
        opacity: 0;
    }
}

.accumulated-flake {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(100, 100, 100, 1); /* 더 진한 회색으로 변경 */
    border-radius: 50%;
    opacity: 1; /* 불투명도를 1로 설정하여 진하게 */
}

/* 모달 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 300px;
    position: relative;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content input {
    padding: 10px;
    font-size: 1em;
    width: 80%;
    max-width: 250px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 10px;
}

.modal-content button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    background-color: #4CAF50;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
}

.modal-content button:hover {
    background-color: #45a049;
}

#close-modal {
    background-color: #f44336; /* 빨간색 */
}

#close-modal:hover {
    background-color: #d32f2f;
}

.hidden {
    display: none;
}

.leaderboard {
    max-width: 600px;
    width: 90%;
    margin: 20px;
    padding: 20px;
    background-color: #ffffff;
    border: 2px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
    z-index: 5;
}

.leaderboard h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 10px;
}

.leaderboard ol {
    padding-left: 20px;
}

.leaderboard li {
    font-size: 1.2em;
    margin: 5px 0;
}

/* 반응형 디자인 추가 */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }

    .timer, .score {
        font-size: 1.2em;
    }

    #head {
        width: 80vw;
    }

    #start-game-button {
        width: 50%;
    }

    .modal-content input {
        width: 70%;
    }

    .modal-content button {
        width: 45%;
        margin: 5px 2.5px;
    }

    .leaderboard h2 {
        font-size: 1.3em;
    }

    .leaderboard li {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    .timer, .score {
        font-size: 1em;
    }

    #head {
        width: 90vw;
    }

    #start-game-button {
        width: 70%;
    }

    .modal-content input {
        width: 65%;
        padding: 8px;
        font-size: 0.9em;
    }

    .modal-content button {
        padding: 8px 15px;
        font-size: 0.9em;
        width: 40%;
    }

    .leaderboard h2 {
        font-size: 1.1em;
    }

    .leaderboard li {
        font-size: 0.9em;
    }
}
