.zm-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}

#zm-canvas {
    display: block;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: default;
    max-width: 100%;
}

.zm-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.zm-btn {
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    background: #4CAF50;
    color: #fff;
    border: 1px solid #4CAF50;
}

.zm-btn:hover { background: #388E3C; border-color: #388E3C; }

.zm-btn-sec {
    background: #fff;
    color: #333;
    border: 1px solid #aaa;
}

.zm-btn-sec:hover { background: #f0f0f0; }

.zm-size-label {
    font-size: 0.88rem;
    color: #555;
}

#zm-size {
    font-size: 0.9rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid #bbb;
    border-radius: 4px;
}

.zm-hint {
    font-size: 0.82rem;
    color: #777;
}

.zm-hint span {
    display: inline-block;
    background: #eee;
    border: 1px solid #bbb;
    border-radius: 3px;
    padding: 0 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

/* ---- d-pad ---- */

.zm-dpad {
    display: none; /* hidden on desktop — keyboard preferred */
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(3, 52px);
    gap: 4px;
    user-select: none;
    -webkit-user-select: none;
}

.zm-dpad-btn {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
    line-height: 1;
    background: #333;
    color: #eee;
    border: 1px solid #555;
    border-radius: 8px;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zm-dpad-btn:active { background: #555; }

.zm-dpad-center { /* empty centre cell */ }

.zm-dpad-n { grid-column: 2; grid-row: 1; }
.zm-dpad-w { grid-column: 1; grid-row: 2; }
.zm-dpad-e { grid-column: 3; grid-row: 2; }
.zm-dpad-s { grid-column: 2; grid-row: 3; }

@media (hover: none) and (pointer: coarse) {
    .zm-dpad { display: grid; }
}
