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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #18191c 0%, #0a0a0c 100%);
    min-height: 100vh;
    padding: 16px;
    color: #eee;
}

.game-wrap {
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    margin-bottom: 8px;
    padding: 0 8px;
}

.game-header .info {
    font-size: 1rem;
}

#gameCanvas {
    display: block;
    border-radius: 12px;
    border: 3px solid #2f3136;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    background: #1c1c1c;
}

.controls-hint {
    margin-top: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-box {
    background: linear-gradient(180deg, #2a2c30 0%, #17181a 100%);
    border: 3px solid #3a3d42;
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

.overlay-box h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.overlay-box h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.overlay-box p {
    margin-bottom: 20px;
    line-height: 1.5;
}

.game-btn {
    padding: 14px 32px;
    font-size: 1.1rem;
    background: #d35400;
    color: #fff;
    border: 2px solid #e67e22;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background 0.2s, transform 0.2s;
}

.game-btn:hover {
    background: #e67e22;
    transform: scale(1.05);
}

.overlay-box.level-complete {
    border-color: #f39c12;
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
}

.overlay-box.level-complete h2 {
    color: #f1c40f;
}

@media (max-width: 440px) {
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: auto;
        aspect-ratio: 400 / 560;
    }
}