/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    overflow: hidden;
    user-select: none;
    font-weight: 500;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    background: linear-gradient(to bottom, #f0f8ff, #b0c4de);
}

#start-menu, #game-screen, #how-to-play, #game-over {
    text-align: center;
    color: #333;
    transition: opacity 0.3s ease;
}

.title {
    font-size: 3rem;
    color: #4169e1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

button {
    margin: 10px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 8px;
    transition: background 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    background: #e0e0e0;
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#gameCanvas {
    width: 90vw;
    height: 80vh;
    max-height: 700px;
    border: 2px solid #aaa;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

#top-bar {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.progress-bar {
    width: 200px;
    height: 10px;
    background: #ddd;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #ccc;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.hidden {
    display: none;
}

#level-complete, #game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    border: 2px solid #4169e1;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

#level-complete h2, #game-over h2 {
    color: #4169e1;
    margin-bottom: 20px;
    font-size: 2rem;
}

#level-complete p, #game-over p {
    margin: 10px 0;
    font-size: 1.2rem;
}

#level-complete button, #game-over button {
    background: #4169e1;
    color: white;
    border: none;
    margin: 10px;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

#level-complete button:hover, #game-over button:hover {
    background: #2e4bc7;
}

#how-to-play {
    max-width: 600px;
    padding: 20px;
}

#how-to-play p {
    margin: 10px 0;
    font-size: 1.1rem;
    text-align: left;
}

#how-to-play h2 {
    color: #4169e1;
    margin-bottom: 20px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    button {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    #top-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress-bar {
        width: 150px;
    }
    
    #level-complete, #game-over {
        padding: 20px;
        margin: 20px;
    }
    
    #level-complete h2, #game-over h2 {
        font-size: 1.5rem;
    }
}

/* Touch feedback */
@media (hover: none) {
    button:hover {
        background: #f0f0f0;
    }
    
    button:active {
        background: #e0e0e0;
    }
}