* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    touch-action: none; /* prevent scroll/zoom during gameplay */
}

canvas {
    display: block;
}

/* ── Game wrapper — fullscreen target that contains canvas + overlays ──────── */
#game-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

/* ── D-pad mobile controls ─────────────────────────────────────────────────── */
#dpad-overlay {
    display: none; /* shown by GameScene on touch devices */
    position: absolute;  /* inside #game-wrapper so it survives fullscreen */
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    pointer-events: none;
    z-index: 50;
    user-select: none;
    -webkit-user-select: none;
}

#dpad-left,
#dpad-right {
    position: absolute;
    bottom: max(32px, env(safe-area-inset-bottom, 32px));
    display: flex;
    flex-direction: column; /* first child = top, last child = bottom (near edge) */
    gap: 14px;
    pointer-events: all;
}

#dpad-left  { left: 24px; }
#dpad-right { right: 24px; }

.dpad-btn {
    width: 76px;
    height: 76px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(122, 204, 68, 0.55);
    color: #7acc44;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.08s, border-color 0.08s;
    padding: 0;
}

.dpad-btn.pressed,
.dpad-btn:active {
    background: rgba(122, 204, 68, 0.28);
    border-color: rgba(122, 204, 68, 0.9);
    color: #a8ff7e;
}

/* Hide D-pad on real pointer/hover devices (desktop mouse) */
@media (hover: hover) and (pointer: fine) {
    #dpad-overlay { display: none !important; }
}

