body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: #ffd700;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: none;
    touch-action: pan-y;
}

.game-container {
    position: relative;
    text-align: center;
    padding: 20px;
    width: min(94vw, 760px);
}

.game-title {
    margin-bottom: 20px;
    font-size: 24px;
    color: #00f2ff;
    text-shadow: 0 0 10px #00f2ff, 0 0 20px #00f2ff;
}

.score-display, .lives-display, .stage-display {
    font-size: 16px;
    margin-bottom: 10px;
    color: #fff;
}

.stage-display {
    color: #8ed3ff;
}

.best-display {
    font-size: 10px;
    margin-bottom: 8px;
    color: #88b9ff;
    line-height: 1.5;
}

canvas {
    background-color: #000;
    border: 4px solid #0000ff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 255, 0.6);
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    touch-action: none;
}

.game-over, .game-win {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 4px solid #ffff00;
    padding: 40px;
    z-index: 10;
    color: #ff0000;
    text-align: center;
}

.game-win {
    color: #4facfe;
    border-color: #4facfe;
}

.game-over h2, .game-win h2 {
    font-size: 24px;
    margin-bottom: 20px;
    line-height: 1.5;
}

button {
    background: #ffff00;
    color: #000;
    border: none;
    padding: 15px 30px;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    cursor: pointer;
    margin-top: 20px;
}

button:hover {
    background: #fff;
}

.controls {
    margin-top: 20px;
    color: #888;
    font-size: 10px;
    line-height: 1.5;
}

.game-meta {
    position: absolute;
    top: 10px;
    right: 10px;
    color: rgba(140, 200, 255, 0.8);
    font-size: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    line-height: 1.4;
    z-index: 20;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.55);
}

.back-link {
    position: absolute;
    top: 10px;
    left: 10px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 9px;
    transition: color 0.3s, opacity 0.3s;
    z-index: 20;
    letter-spacing: 0.02em;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.55);
}

.back-link:hover {
    color: #ffff00;
    opacity: 1;
}

@media (max-width: 768px) {
    body {
        align-items: stretch;
        padding: 0;
        overflow: hidden;
    }

    .game-container {
        width: 100vw;
        height: 100dvh;
        padding: calc(8px + env(safe-area-inset-top)) 8px calc(10px + env(safe-area-inset-bottom));
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .game-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .score-display,
    .lives-display,
    .stage-display {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .best-display {
        font-size: 8px;
        margin-bottom: 6px;
    }

    canvas {
        width: 100%;
        max-height: 52dvh;
    }

    .controls {
        margin-top: 12px;
        font-size: 8px;
    }

    .back-link {
        top: calc(8px + env(safe-area-inset-top));
        left: 8px;
        font-size: 8px;
    }

    .game-meta {
        top: calc(8px + env(safe-area-inset-top));
        right: 8px;
        font-size: 7px;
    }
}
