* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body {
    background-color: #0b0b0e;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    touch-action: manipulation;
}

#gameContainer {
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    overflow: hidden;

    /* Scale the 1024x576 (16:9) game world to fit the viewport
       while preserving its aspect ratio, instead of rendering at a
       fixed pixel size that overflows small windows/screens. */
    width: min(100vw, calc(100vh * 1024 / 576));
    height: min(100vh, calc(100vw * 576 / 1024));
}

/* Procedural Grass Texture styling */
canvas {
    background-color: #3f7a24;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 2px, transparent 2px),
        radial-gradient(#529332 20%, transparent 20%),
        radial-gradient(#34661c 20%, transparent 20%);
    background-size: 64px 64px, 64px 64px, 8px 8px, 8px 8px;
    background-position: 0 0, 0 0, 0 0, 4px 4px;
    display: block;
    width: 100%;
    height: 100%;
}

#hud {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    user-select: none;
}

.hud-card {
    background: rgba(18, 18, 24, 0.85);
    backdrop-filter: blur(4px);
    color: #f1f1f6;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}