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

body {
    background: linear-gradient(135deg, #1a2a1a 0%, #0d1a0d 50%, #1a2a2a 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', cursive;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    overflow: hidden;
}

#game-container {
    position: relative;
    max-width: 800px;
    width: 100%;
    border: 4px solid #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
    background: #1a2330;
}

#canvas {
    display: block;
    width: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

.menu-screen, .result-screen {
    background: linear-gradient(180deg, rgba(26, 35, 48, 0.98) 0%, rgba(13, 20, 28, 0.98) 100%);
    padding: 30px;
    border: 4px solid #FFD700;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
}

.game-title {
    font-size: clamp(16px, 4vw, 28px);
    color: #FFD700;
    text-shadow: 3px 3px 0 #8B0000, 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: 20px;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.subtitle {
    font-size: clamp(10px, 2vw, 14px);
    color: #FFFFFF;
    margin-bottom: 20px;
}

.map-selection {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.map-card {
    background: #2a3a4a;
    border: 3px solid #4a5a6a;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.map-card:hover {
    transform: scale(1.05);
    border-color: #7a8a9a;
}

.map-card.selected {
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.map-preview {
    width: 80px;
    height: 60px;
    margin-bottom: 10px;
    border: 2px solid #000;
}

.grass-preview {
    background: linear-gradient(180deg, #4A7C23 0%, #3D6B1E 100%);
}

.snow-preview {
    background: linear-gradient(180deg, #E8F4F8 0%, #D4E8EC 100%);
}

.map-card span {
    font-size: 8px;
    color: #FFFFFF;
    display: block;
}

.pixel-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(10px, 2vw, 14px);
    padding: 15px 30px;
    background: linear-gradient(180deg, #DC143C 0%, #8B0000 100%);
    color: #FFFFFF;
    border: none;
    border-bottom: 4px solid #5a0000;
    cursor: pointer;
    transition: all 0.1s;
    margin: 10px;
}

.pixel-btn:hover {
    background: linear-gradient(180deg, #FF1744 0%, #B71C1C 100%);
    transform: translateY(-2px);
}

.pixel-btn:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.stats-display {
    margin-top: 20px;
    font-size: 8px;
    color: #aaa;
}

.stats-display p {
    margin: 5px 0;
}

.result-screen h1 {
    font-size: clamp(14px, 3vw, 22px);
    color: #FFD700;
    text-shadow: 2px 2px 0 #8B0000;
    margin-bottom: 20px;
}

.win-screen {
    background: linear-gradient(180deg, rgba(34, 80, 34, 0.98) 0%, rgba(20, 50, 20, 0.98) 100%);
}

.gameover-screen {
    background: linear-gradient(180deg, rgba(80, 34, 34, 0.98) 0%, rgba(50, 20, 20, 0.98) 100%);
}

.new-best {
    font-size: 12px;
    color: #FFD700;
    animation: newBestFlash 0.5s ease-in-out infinite alternate;
    margin-bottom: 15px;
}

@keyframes newBestFlash {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

.time-display {
    font-size: clamp(12px, 2.5vw, 18px);
    color: #FFFFFF;
    margin-bottom: 20px;
}

.gold-msg {
    font-size: 10px;
    color: #FFD700;
    margin-bottom: 20px;
}

#footer {
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    color: #666;
    padding: 15px;
    text-align: center;
}

#footer a {
    color: #FFD700;
    text-decoration: none;
}

#footer a:hover {
    text-decoration: underline;
}

@media (max-width: 500px) {
    .menu-screen, .result-screen {
        padding: 20px;
    }
    
    .map-preview {
        width: 60px;
        height: 45px;
    }
    
    .pixel-btn {
        padding: 12px 20px;
    }
}