/* style.css — Phase 1 modernization
 * Covers: green gradient background, styled instruction card,
 * D-pad cross layout, touch-action hygiene, responsive sizing.
 */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(155deg, #163d16 0%, #2a7a2a 55%, #163d16 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: Arial, sans-serif;
    overflow-x: hidden;
    /* Prevent body scroll on mobile while playing */
    touch-action: pan-y;
}

/* ── Instruction / start screen ─────────────────────────────────────────────── */

#instructions {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
}

.card {
    background: rgba(255, 255, 255, 0.93);
    border-radius: 20px;
    padding: 44px 52px;
    max-width: 560px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 48px rgba(0, 0, 0, 0.45);
}

.card h1 {
    margin: 0 0 18px;
    font-size: 2.5rem;
    color: #1a5c1a;
    line-height: 1.15;
}

.card p {
    font-size: 1.1rem;
    line-height: 1.75;
    color: #333;
    margin-bottom: 30px;
}

#startButton {
    padding: 15px 44px;
    font-size: 1.3rem;
    font-weight: bold;
    background: #2a8a2a;
    color: #fff;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
}

#startButton:hover,
#startButton:focus-visible {
    background: #38aa38;
    transform: scale(1.04);
    outline: 3px solid #38aa38;
    outline-offset: 2px;
}

/* ── Game canvas ─────────────────────────────────────────────────────────────── */

canvas {
    border: 3px solid #1b6b1b;
    border-radius: 6px;
    display: block;
    max-width: 1200px;
    margin-top: 14px;
    /* Prevent stray touch events from scrolling while on canvas */
    touch-action: none;
}

/* ── D-pad controls ──────────────────────────────────────────────────────────── */

#controls {
    display: flex;
    justify-content: center;
    margin-top: 14px;
    margin-bottom: 20px;
    /* Prevent scroll interference on mobile */
    touch-action: none;
    user-select: none;
}

.dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dpad-middle {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* All D-pad buttons: minimum 64 × 64 px touch target */
.control-button {
    width: 68px;
    height: 68px;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    border: 2px solid rgba(0, 0, 0, 0.18);
    touch-action: none;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, transform 0.08s;
    /* Prevent text highlight on rapid taps */
    -webkit-tap-highlight-color: transparent;
}

.control-button:active {
    background: #b0c8b0;
    transform: scale(0.94);
}

.control-button:focus-visible {
    outline: 3px solid #38aa38;
    outline-offset: 2px;
}

/* ── Responsive adjustments ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .control-button {
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    .card {
        padding: 30px 24px;
    }

    .card h1 {
        font-size: 1.9rem;
    }

    .card p {
        font-size: 1rem;
    }
}

