body {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #d1f7ff;
    font-family: 'Arial', sans-serif;
    overflow: hidden;
}

#game-container {
    position: relative;
    border: 3px solid #333;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

canvas {
    display: block;
    background-color: #87CEEB; /* Fallback Sky blue */
}

#ui-container {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 3px white;
}

#score-display.popping {
    animation: pop 0.3s ease-out;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); color: #ffc107; }
    100% { transform: scale(1); }
}

#shop-button {
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #333;
    border-radius: 8px;
    background-color: #ffc107;
    box-shadow: 0 4px #e0a800;
    transition: all 0.1s ease;
}

#shop-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px #e0a800;
}

#instructions {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.7);
    padding: 5px 10px;
    border-radius: 5px;
}

/* Shop Modal Styling */
#shop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#shop-modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#close-shop-button {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
}

#hat-items-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.hat-item {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f9f9f9;
}

.hat-item:hover {
    transform: translateY(-5px);
    border-color: #f0c419;
}

.hat-item h3 {
    margin: 5px 0;
    font-size: 16px;
}

.hat-item .hat-price {
    font-weight: bold;
    color: #28a745;
}

.hat-item .hat-graphic {
    font-size: 48px;
    line-height: 1;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hat-item.purchased {
    background-color: #e9f7ec;
    border-color: #28a745;
}

.hat-item.equipped {
    border-color: #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.7);
}

#shop-score {
    font-weight: bold;
}