/* Mahjong Solitaire (/mahjong-solitaire): only what is the game's own - the canvas with the tiles. Tiles, buttons,
   fields and the accent come from the app kit (css/app-kit, docs/app-kit.md), the button row from
   css/app-kit/games.css (every game). Loaded only on this page (StylePaths). The table keeps its own jade colours in
   both themes (filter-engines/mahjong-solitaire.js). */

/* The canvas takes the shape of the layout (--mj-ar, width : height, set by the script), as large as the stage
   allows and no taller than the screen. */
.mahjong-solitaire-board {
    --mj-ar: 1.75;
    /* The shared .game-fit layout reads the board's shape from here (it changes with the layout). */
    --game-aspect: var(--mj-ar);
    width: min(100%, calc((100vh - 220px) * var(--mj-ar)));
    min-width: min(100%, 300px);
    aspect-ratio: var(--mj-ar);
    position: relative;
}

/* Laid over the box, so the canvas's own pixel size never stretches the box when the layout changes. */
.mahjong-solitaire-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    background: #c9dccf;
    touch-action: manipulation;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ak-app[data-theme="dark"] .mahjong-solitaire-canvas {
    background: #13221d;
}

.mahjong-solitaire-canvas:focus-visible {
    box-shadow: 0 0 0 3px var(--ak-accent);
}

/* Phones: the shared .game-fit layout (css/app-kit/games.css) fits the tiles and the board on the screen, whatever the
   layout's shape (the tall Butterfly too); --game-room is what the stage holds besides the board (no touch pad: the
   tiles are tapped). */
.mahjong-solitaire-stage {
    --game-max: 1100px;
    --game-room: 103px;
    --game-room-touch: 103px;
    --game-room-short: 56px;
}

/* Phones without the app layout: the board uses the full width of the stage, but no more height than the stage leaves
   under the tiles, so a tall layout such as the Butterfly is never cut off. */
@media (max-width: 640px) {
    .mahjong-solitaire-panel {
        margin-inline: calc(var(--ak-space-2, 0.5rem) * -1);
    }

    .mahjong-solitaire-board {
        width: min(100%, calc((100vw - 124px) * var(--mj-ar)));
        min-width: 0;
    }
}
