@media (hover: none) and (pointer: coarse), (max-width: 900px) {
    .mobile-controls {
        display: flex;
    }
}

@media (max-width: 900px) {
    .game-page {
        padding: 12px;
        gap: 10px;
    }

    h1 {
        font-size: clamp(32px, 11vw, 62px);
    }

    .overlay-panel,
    .imprint-panel {
        padding: 22px 18px;
    }

    .help-grid,
    .imprint-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .game-page {
        justify-content: flex-start;
    }

    .game-stage {
        width: 100%;
        border-radius: 18px;
    }

    .fullscreen-btn {
        display: none;
    }

    .start-screen-help {
        top: 10px;
        right: 10px;
        left: auto;
    }

    .start-screen-imprint {
        right: 10px;
        left: auto;
        bottom: 10px;
        transform: none;
    }

    .start-screen-imprint:hover {
        transform: translateY(-1px);
    }

    .page-imprint-link {
        font-size: 15px;
    }
}

@media (max-width: 560px) {
    .mobile-controls {
        padding: 10px;
    }

    .mobile-controls-bottom,
    .mobile-controls-move,
    .mobile-controls-throw {
        gap: 8px;
    }

    .mobile-btn {
        width: 54px;
        height: 54px;
        font-size: 24px;
    }

    .mobile-btn-throw {
        width: 78px;
        font-size: 15px;
    }

    .overlay-close {
        top: 12px;
        right: 12px;
    }

    .overlay-panel,
    .imprint-panel {
        border-radius: 18px;
    }
}

@media (max-height: 700px) {
    .game-page {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    h1 {
        font-size: clamp(30px, 8vh, 58px);
    }
}

@media (max-width: 900px), (max-height: 700px) {
    .page-imprint-link {
        display: none;
    }

    .start-screen-imprint {
        display: inline-flex;
        right: 16px;
        left: auto;
        bottom: 16px;
        transform: none;
    }

    .start-screen-imprint:hover {
        transform: translateY(-1px);
    }
}

/** Mobile + tablet: only playable in landscape, the canvas fills the full screen, and the buttons stay in their usual positions. */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        overflow: hidden;
    }

    body {
        overscroll-behavior: none;
        touch-action: manipulation;
    }

    .game-page {
        width: 100vw;
        min-height: 100dvh;
        height: 100dvh;
        padding: 0;
        gap: 0;
        justify-content: center;
    }

    .game-page > h1,
    .page-imprint-link {
        display: none;
    }

    .game-stage {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        overflow: hidden;
    }

    #canvas {
        display: block;
        width: 100%;
        height: 100%;
    }

    .rotate-device-hint {
        display: none;
    }

    .fullscreen-btn {
        display: none;
    }

    .stage-overlay-btn {
        z-index: 30;
    }

    .start-screen-help {
        top: 14px;
        right: 14px;
        left: auto;
    }

    .start-screen-imprint {
        right: 14px;
        left: auto;
        bottom: 14px;
        transform: scale(0.92);
        transform-origin: bottom right;
    }

    .start-screen-imprint:hover {
        transform: translateY(-1px) scale(0.92);
    }

    .mobile-controls {
        display: flex;
        position: absolute;
        inset: 0;
        z-index: 25;
        align-items: flex-end;
        justify-content: space-between;
        padding: 0 18px 14px;
        pointer-events: none;
    }

    .mobile-controls-move,
    .mobile-controls-throw,
    .mobile-controls-bottom {
        gap: 10px;
    }

    .mobile-controls-move,
    .mobile-controls-throw {
        pointer-events: auto;
    }

    .mobile-btn {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .mobile-btn-throw {
        width: 74px;
        font-size: 14px;
    }

    .page-overlay {
        padding: 16px;
    }
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        overflow: hidden;
    }

    body {
        overscroll-behavior: none;
    }

    .game-page {
        width: 100vw;
        min-height: 100dvh;
        height: 100dvh;
        padding: 0;
        gap: 0;
    }

    .game-page > h1,
    .page-imprint-link {
        display: none;
    }

    .game-stage {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        overflow: hidden;
        background: #000;
    }

    #canvas,
    .mobile-controls,
    .fullscreen-btn,
    .start-screen-help,
    .start-screen-imprint {
        visibility: hidden;
    }

    .rotate-device-hint {
        display: flex;
        position: absolute;
        inset: 0;
        z-index: 50;
        align-items: center;
        justify-content: center;
        padding: 24px;
        background: rgba(0, 0, 0, 0.92);
        color: #fff;
        text-align: center;
        font-size: clamp(20px, 5vw, 30px);
        line-height: 1.3;
    }
}

.game-stage.show-start-screen-actions .mobile-controls {
    display: none;
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
    .game-stage.show-start-screen-actions .mobile-controls {
        display: none;
    }
}