body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
    position: relative;
    min-height: 100vh;
    padding: 0;
}

.container {
    position: relative;
    width: 100%;
    max-width: 640px;
    height: 640px;
    margin: 0 auto;
}

.rectangle {
    width: 128px;
    height: 128px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    border: 2px solid #000;
    position: absolute;
    overflow: hidden;
    margin-right: -5px;  /* Add this line */
    margin-bottom: -5px; /* Add this line */
}

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

.animal-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

/* Top row */
.rectangle:nth-child(1) { top: 0; left: 0; }
.rectangle:nth-child(2) { top: 0; left: 128px; }
.rectangle:nth-child(3) { top: 0; left: 256px; }
.rectangle:nth-child(4) { top: 0; left: 384px; }
.rectangle:nth-child(5) { top: 0; left: 512px; }

/* Right column */
.rectangle:nth-child(6) { top: 128px; right: 0; }
.rectangle:nth-child(7) { top: 256px; right: 0; }
.rectangle:nth-child(8) { top: 384px; right: 0; }

/* Bottom row */
.rectangle:nth-child(9) { bottom: 0; right: 0; }
.rectangle:nth-child(10) { bottom: 0; right: 128px; }
.rectangle:nth-child(11) { bottom: 0; right: 256px; }
.rectangle:nth-child(12) { bottom: 0; right: 384px; }
.rectangle:nth-child(13) { bottom: 0; right: 512px; }

/* Left column */
.rectangle:nth-child(16) { top: 128px; left: 0; }
.rectangle:nth-child(15) { top: 256px; left: 0; }
.rectangle:nth-child(14) { top: 384px; left: 0; }

#score-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    z-index: 10;
}

@media screen and (max-width: 768px) {
    .container {
        height: auto;
        aspect-ratio: 1 / 1;
        max-width: 100vw;
        max-height: 100vw;
    }

    .rectangle {
        width: 20vw;
        height: 20vw;
    }

    .animal-name {
        font-size: 2vw;
    }

    /* Top row */
    .rectangle:nth-child(1) { top: 0; left: 0; }
    .rectangle:nth-child(2) { top: 0; left: 20vw; }
    .rectangle:nth-child(3) { top: 0; left: 40vw; }
    .rectangle:nth-child(4) { top: 0; left: 60vw; }
    .rectangle:nth-child(5) { top: 0; left: 80vw; }

    /* Right column */
    .rectangle:nth-child(6) { top: 20vw; right: 0; }
    .rectangle:nth-child(7) { top: 40vw; right: 0; }
    .rectangle:nth-child(8) { top: 60vw; right: 0; }

    /* Bottom row */
    .rectangle:nth-child(9) { bottom: 0; right: 0; }
    .rectangle:nth-child(10) { bottom: 0; right: 20vw; }
    .rectangle:nth-child(11) { bottom: 0; right: 40vw; }
    .rectangle:nth-child(12) { bottom: 0; right: 60vw; }
    .rectangle:nth-child(13) { bottom: 0; right: 80vw; }

    /* Left column */
    .rectangle:nth-child(16) { top: 20vw; left: 0; }
    .rectangle:nth-child(15) { top: 40vw; left: 0; }
    .rectangle:nth-child(14) { top: 60vw; left: 0; }

    #score-display {
        position: fixed;
        width: 80%;
        max-width: 300px;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 14px;
        background-color: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    #user-name {
        font-size: 18px;
    }

    .score-value {
        font-size: 16px;
    }

    .spin-button, .fancy-spin-button, .game-button {
        font-size: 18px;
        padding: 10px 20px;
    }

    #spinButton {
        font-size: 20px;
        padding: 15px 30px;
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 20;
    }

    #result, #spin-result {
        width: 80%;
        max-width: 300px;
        font-size: 14px;
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
        z-index: 20;
    }
}

#score-display:hover {
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

#user-name {
    font-weight: bold;
    font-size: 24px;
    margin-bottom: 15px;
    padding: 5px 10px;
    border: 2px solid #4CAF50;
    border-radius: 5px;
    display: inline-block;
    min-width: 100px;
    background-color: #f0f8ff;
    transition: all 0.3s ease;
}

#user-name:hover, #user-name:focus {
    background-color: #e6f3ff;
    border-color: #45a049;
    outline: none;
}

#score-display div:not(#user-name) {
    margin-bottom: 10px;
    font-size: 18px;
    color: #333;
}

#score-display div:last-child {
    margin-bottom: 0;
}

/* Add these new styles for labels and values */
.score-label {
    font-weight: bold;
    color: #4CAF50;
    display: block;
    margin-bottom: 5px;
}

.score-value {
    font-size: 22px;
    color: #333;
}

#spinButton {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    font-size: 16px;
    z-index: 1;
    margin-top: 10px;
}

.spin-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    background-color: #4CAF50;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.spin-button:hover {
    background-color: #45a049;
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.spin-button:active {
    transform: translate(-50%, -48%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    display: none;
    flex-direction: column;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#spin-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
}

.highlight {
    border: 4px solid red;
    box-shadow: 0 0 10px red;
}

.result-image {
    margin-bottom: 10px;
}

.result-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-container {
    /* ... existing styles ... */
    padding-right: 5px;  /* Add this line */
    padding-bottom: 5px; /* Add this line */
}

.fancy-spin-button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 24px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 9px #999;
}

.fancy-spin-button:hover {
    background-color: #45a049;
}

.fancy-spin-button:active {
    background-color: #3e8e41;
    box-shadow: 0 5px #666;
    transform: translateY(4px);
}

.fancy-spin-button:disabled {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
    box-shadow: none;
}

.game-button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 18px;
    margin: 10px 5px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 6px #999;
}

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

.game-button:active {
    background-color: #3e8e41;
    box-shadow: 0 3px #666;
    transform: translateY(3px);
}

#spinButton {
    background-color: #4CAF50;
    font-size: 24px;
    padding: 20px 40px;
}

#loginButton {
    background-color: #008CBA;
}

#loginButton:hover {
    background-color: #007B9A;
}

#loginButton:active {
    background-color: #006A89;
}
