body {
    background-color: #c0d9af;
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
    margin: 0;
    padding: 10px;
}

h1 {
    color: #534431;
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.grid {
    width: 90vw;
    height: 90vw;
    max-width: 606px;
    max-height: 606px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    border: 3px solid #7a6344;
    background-color: #a08464;
    position: relative;
}

.square {
    width: 33.333%;
    height: 33.333%;
    box-sizing: border-box; /* Include border in the width/height */
    border: 1px solid #7a6344;
    background-color: #a08464;
    position: relative;
    overflow: hidden;
}

.square::after {
    content: '';
    display: block;
    background: #534431;
    width: 60%;
    height: 60%;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.mole {
    background-color: #be9767;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='55' rx='45' ry='42' fill='%23be9767'/%3E%3Cellipse cx='50' cy='55' rx='45' ry='42' fill='none' stroke='%23534431' stroke-width='3'/%3E%3Cellipse cx='25' cy='30' rx='14' ry='12' fill='%23a07850'/%3E%3Cellipse cx='25' cy='30' rx='14' ry='12' fill='none' stroke='%23534431' stroke-width='2'/%3E%3Cellipse cx='75' cy='30' rx='14' ry='12' fill='%23a07850'/%3E%3Cellipse cx='75' cy='30' rx='14' ry='12' fill='none' stroke='%23534431' stroke-width='2'/%3E%3Cellipse cx='25' cy='30' rx='8' ry='7' fill='%23c9a87a'/%3E%3Cellipse cx='75' cy='30' rx='8' ry='7' fill='%23c9a87a'/%3E%3Ccircle cx='36' cy='48' r='5' fill='%23534431'/%3E%3Ccircle cx='64' cy='48' r='5' fill='%23534431'/%3E%3Ccircle cx='37.5' cy='46.5' r='1.8' fill='%23FFFFFF'/%3E%3Ccircle cx='65.5' cy='46.5' r='1.8' fill='%23FFFFFF'/%3E%3Cellipse cx='50' cy='62' rx='8' ry='5.5' fill='%23b07060'/%3E%3Cellipse cx='50' cy='62' rx='8' ry='5.5' fill='none' stroke='%23534431' stroke-width='1.5'/%3E%3Cline x1='30' y1='58' x2='12' y2='54' stroke='%23534431' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='30' y1='62' x2='10' y2='62' stroke='%23534431' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='30' y1='66' x2='12' y2='70' stroke='%23534431' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='70' y1='58' x2='88' y2='54' stroke='%23534431' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='70' y1='62' x2='90' y2='62' stroke='%23534431' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='70' y1='66' x2='88' y2='70' stroke='%23534431' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M44 72 Q50 80 56 72' fill='none' stroke='%23534431' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    width: 70%;
    height: 70%;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 40%;
    border: none;
    transition: top 0.2s ease-in-out;
}

.mole.up {
    top: 15%;
}

#start-button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    margin-bottom: 20px;
}

#player-setup {
    margin-bottom: 20px;
}

#player-name {
    padding: 5px;
    font-size: 1em;
}

#submit-name {
    padding: 5px 10px;
    font-size: 1em;
    cursor: pointer;
}

.leaderboard-container {
    margin: 20px auto;
    width: 90%;
    max-width: 400px;
    border: 2px solid #7a6344;
    padding: 10px;
    background-color: #a08464;
}

#leaderboard-list {
    list-style-type: none;
    padding: 0;
    text-align: left;
}

#leaderboard-list li {
    margin-bottom: 5px;
    font-size: 1.1em;
    color: #534431;
}

#contrast-toggle {
    display: block;
    margin: 0 auto 15px auto;
    padding: 8px 16px;
    font-size: 1em;
    cursor: pointer;
    border: 2px solid #7a6344;
    border-radius: 5px;
    background-color: #a08464;
    color: #534431;
}

.high-contrast {
    background-color: #1a1a1a;
    color: #FFFFFF;
}

.high-contrast h1 {
    color: #FFFFFF;
}

.high-contrast h2 {
    color: #FFFFFF;
}

.high-contrast .grid {
    background-color: #333333;
    border-color: #555555;
}

.high-contrast .square {
    background-color: #333333;
    border-color: #555555;
}

.high-contrast .square::after {
    background: #000000;
}

.high-contrast .mole {
    background-color: #FFD700;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cellipse cx='50' cy='55' rx='45' ry='42' fill='%23FFD700'/%3E%3Cellipse cx='50' cy='55' rx='45' ry='42' fill='none' stroke='%23FFFFFF' stroke-width='3'/%3E%3Cellipse cx='25' cy='30' rx='14' ry='12' fill='%23DAA520'/%3E%3Cellipse cx='25' cy='30' rx='14' ry='12' fill='none' stroke='%23FFFFFF' stroke-width='2'/%3E%3Cellipse cx='75' cy='30' rx='14' ry='12' fill='%23DAA520'/%3E%3Cellipse cx='75' cy='30' rx='14' ry='12' fill='none' stroke='%23FFFFFF' stroke-width='2'/%3E%3Cellipse cx='25' cy='30' rx='8' ry='7' fill='%23FFE44D'/%3E%3Cellipse cx='75' cy='30' rx='8' ry='7' fill='%23FFE44D'/%3E%3Ccircle cx='36' cy='48' r='5' fill='%23000000'/%3E%3Ccircle cx='64' cy='48' r='5' fill='%23000000'/%3E%3Ccircle cx='37.5' cy='46.5' r='1.8' fill='%23FFFFFF'/%3E%3Ccircle cx='65.5' cy='46.5' r='1.8' fill='%23FFFFFF'/%3E%3Cellipse cx='50' cy='62' rx='8' ry='5.5' fill='%23FF6347'/%3E%3Cellipse cx='50' cy='62' rx='8' ry='5.5' fill='none' stroke='%23FFFFFF' stroke-width='1.5'/%3E%3Cline x1='30' y1='58' x2='12' y2='54' stroke='%23FFFFFF' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='30' y1='62' x2='10' y2='62' stroke='%23FFFFFF' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='30' y1='66' x2='12' y2='70' stroke='%23FFFFFF' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='70' y1='58' x2='88' y2='54' stroke='%23FFFFFF' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='70' y1='62' x2='90' y2='62' stroke='%23FFFFFF' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='70' y1='66' x2='88' y2='70' stroke='%23FFFFFF' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M44 72 Q50 80 56 72' fill='none' stroke='%23FFFFFF' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    border-color: #FFD700;
}

.high-contrast .leaderboard-container {
    background-color: #333333;
    border-color: #555555;
}

.high-contrast #leaderboard-list li {
    color: #FFFFFF;
}

.high-contrast #start-button {
    background-color: #333333;
    color: #FFFFFF;
    border: 2px solid #FFFFFF;
}

.high-contrast #submit-name {
    background-color: #333333;
    color: #FFFFFF;
    border: 2px solid #FFFFFF;
}

.high-contrast #player-name {
    background-color: #333333;
    color: #FFFFFF;
    border: 2px solid #FFFFFF;
}

.high-contrast #contrast-toggle {
    background-color: #333333;
    color: #FFFFFF;
    border-color: #FFFFFF;
}

.high-contrast label {
    color: #FFFFFF;
}

/* Hit feedback animations */
@keyframes float-up {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -40px);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
}

.score-popup {
    position: absolute;
    z-index: 10;
    font-weight: bold;
    font-size: 1.4em;
    color: #FFFFFF;
    text-shadow: 1px 1px 3px #000000;
    pointer-events: none;
    animation: float-up 500ms ease-out forwards;
}

.square.hit {
    animation: shake 300ms ease-in-out;
}

.high-contrast .score-popup {
    color: #FFD700;
    text-shadow: 1px 1px 3px #000000, 0 0 6px #FFD700;
}

/* Countdown overlay */
#countdown-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    background-color: rgba(0, 0, 0, 0.5);
}

#countdown-overlay.active {
    display: flex;
}

#countdown-text {
    font-size: 5em;
    font-weight: bold;
    color: #FFFFFF;
    text-shadow: 2px 2px 6px #534431, 0 0 10px #a08464;
}

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

.countdown-animate {
    animation: countdown-pop 900ms ease-out forwards;
}

.high-contrast #countdown-text {
    color: #FFD700;
    text-shadow: 2px 2px 6px #000000, 0 0 10px #FFD700;
}

/* Media query for smaller screens */
@media screen and (max-width: 600px) {
    body {
        padding: 5px;
    }

    h1 {
        font-size: 1.5em;
    }

    .game-info {
        font-size: 1em;
    }
}