/* AbildskovUndervisning - abildskovundervisning.dk */
/* ===================================================
   TOUCH - skærmtastatur til telefon og tablet
   Styres af js/core/touchControls.js
   =================================================== */

:root {
    --touch-pad-h: 0px;
    --app-vh: 100vh;
}

/* Games size themselves from --app-vh so the board stays above the pad */
html.touch-pad-on {
    --app-vh: calc(100vh - var(--touch-pad-h));
}

@supports (height: 100dvh) {
    html.touch-pad-on {
        --app-vh: calc(100dvh - var(--touch-pad-h));
    }
}

/* Room for the pad when the window is scrolled to the bottom */
html.touch-pad-on body {
    padding-bottom: calc(15px + var(--touch-pad-h));
}

/* No double-tap zoom delay on buttons and no grey flash when tapping */
button,
.game-card,
.game-grid-cell {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Swiping on a snake board steers the snake instead of scrolling the page */
.snake-words-board,
.snake-table-board {
    touch-action: none;
}

.touch-pad {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 8px 14px;
    padding: 8px 10px 22px;
    background: rgba(8, 0, 0, 0.97);
    border-top: 2px solid #770000;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.touch-digits {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    flex: 0 1 340px;
}

.touch-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    flex: 0 1 150px;
}

.touch-dpad {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(2, 54px);
    grid-template-areas:
        ". up ."
        "left down right";
    gap: 6px;
}

.touch-key {
    min-width: 0;
    min-height: 50px;
    padding: 0;
    box-sizing: border-box;
    color: #ff4040;
    background: #1a0000;
    border: 2px solid #770000;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.touch-dpad .touch-key {
    min-height: 0;
    font-size: 1.5rem;
}

.touch-key:active {
    background: #660000;
    border-color: #ff0000;
}

.touch-key-enter {
    color: #ffffff;
    background: #330000;
    border-color: #ff0000;
}

@media (max-height: 520px) {
    .touch-pad {
        padding: 5px 10px 20px;
    }

    .touch-key {
        min-height: 40px;
        font-size: 1.15rem;
    }

    .touch-dpad {
        grid-template-columns: repeat(3, 52px);
        grid-template-rows: repeat(2, 42px);
    }
}

@media (max-width: 420px) {
    .touch-pad {
        gap: 6px;
        padding-left: 6px;
        padding-right: 6px;
    }

    .touch-digits {
        flex: 1 1 0;
    }

    .touch-actions {
        flex: 0 0 104px;
    }
}
