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

body {
    font-family: Arial, sans-serif;
    background-color: #FFF3E0; /* Cream background from screenshot */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.game-container {
    position: relative;
    width: 360px;
    height: 640px;
    border: 4px solid #214738; /* Dark green from screenshot */
    border-radius: 8px;
    overflow: hidden;
}

#game-canvas {
    background-color: #FFF3E0; /* Cream background */
    display: block;
    width: 100%;
    height: 100%;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: rgba(255, 243, 224, 0.9); /* Semi-transparent cream */
    text-align: center;
    padding: 50px 20px 20px;
    overflow-y: auto;
}

.hidden {
    display: none;
}

h1 {
    color: #214738; /* Dark green from screenshot */
    margin-bottom: 15px;
    font-size: 36px;
}

h2 {
    color: #214738; /* Dark green from screenshot */
    margin: 10px 0;
    font-size: 22px;
}

p {
    color: #214738; /* Dark green from screenshot */
    margin-bottom: 15px;
    font-size: 18px;
}

button {
    background-color: #F47458; /* Coral/orange from screenshot */
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin: 10px 0;
}

button:hover {
    background-color: #E35C42; /* Darker coral */
}

#score-display {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    color: #F47458; /* Coral/orange from screenshot */
    text-shadow: 2px 2px 0 #214738; /* Dark green shadow for visibility */
}

#treats-display {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #F47458; /* Coral/orange from screenshot */
    text-shadow: 2px 2px 0 #214738; /* Dark green shadow for visibility */
    display: flex;
    align-items: center;
    gap: 5px;
}

/* High Scores Styling */
#high-scores-container, #high-scores-container-game-over {
    background-color: rgba(33, 71, 56, 0.1); /* Semi-transparent dark green */
    border-radius: 10px;
    padding: 12px;
    margin: 10px 0;
    width: 90%;
}

#high-scores-list, #high-scores-list-game-over {
    list-style-type: none;
    padding: 0;
    width: 100%;
}

#high-scores-list li, #high-scores-list-game-over li {
    display: grid;
    grid-template-columns: 40px 1fr 60px;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(33, 71, 56, 0.2);
    color: #214738;
    font-size: 16px;
}

#high-scores-list li:last-child, #high-scores-list-game-over li:last-child {
    border-bottom: none;
}

.rank {
    font-weight: bold;
    text-align: left;
}

.name {
    text-align: left;
    padding: 0 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score {
    font-weight: bold;
    text-align: right;
}

.highlighted {
    background-color: rgba(244, 116, 88, 0.2); /* Highlight new high score */
    font-weight: bold;
    border-radius: 5px;
    padding-left: 8px;
    padding-right: 8px;
    margin-left: -8px;
    margin-right: -8px;
}

/* New High Score Form */
#new-high-score {
    background-color: rgba(244, 116, 88, 0.1); /* Semi-transparent coral */
    border-radius: 10px;
    padding: 10px;
    margin: 8px 0;
    width: 90%;
}

#player-name {
    padding: 10px;
    border: 2px solid #214738;
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
    margin-bottom: 10px;
}

#save-score {
    width: 100%;
}

/* Layout adjustments */
#start-screen h1 {
    margin-top: 10px;
}

#game-over-screen h1 {
    margin-top: 10px;
}

#restart-button {
    margin-top: 15px;
}

#high-scores-container h2, #high-scores-container-game-over h2 {
    margin: 8px 0;
}

#game-over-screen > * {
    margin-bottom: 8px;
}

#game-over-screen p {
    margin-bottom: 8px;
}
