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

html, body {
    width: 100%;
    height: 100%;
    /* Use 100dvh for dynamic viewport height on iOS Safari (accounts for address bar) */
    height: 100dvh;
    overflow: hidden;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    overscroll-behavior: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    /* Prevent iOS Safari pull-to-refresh and elastic scroll */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#gameCanvas {
    width: 100%;
    height: 100vh;         /* fallback for older browsers */
    height: 100dvh;        /* override for browsers that support dvh */
    display: block;
    image-rendering: pixelated;
    touch-action: none;
}

/* Landscape orientation lock hint */
@media (orientation: portrait) and (max-width: 600px) {
    body::after {
        content: '↻ Rotate your device to landscape mode';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #1a1a2e;
        color: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: sans-serif;
        font-size: 1.5rem;
        text-align: center;
        padding: 2rem;
        z-index: 9999;
    }
}

/* Also show rotation hint on iPad portrait (wider screens) */
@media (orientation: portrait) and (min-width: 601px) {
    body::after {
        content: '↻ Rotate your iPad to landscape mode for the best experience';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #1a1a2e;
        color: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
        font-family: sans-serif;
        font-size: 1.5rem;
        text-align: center;
        padding: 2rem;
        z-index: 9999;
    }
}
