/* Mahjong solitaire (Pages/Games/Mahjong, wwwroot/js/mahjong.js): tiles are absolutely placed buttons on a board sized in tile units (--mj-cols, --mj-rows). */
.mahjong { max-width: 44rem; }
.mj-board-wrap {
    --mj-tile: min(calc((100vw - 2.5rem) / (var(--mj-cols) + .6)), 3.6rem);
    margin: .75rem auto 0;
    padding: .75rem;
    border-radius: 1rem;
    background: var(--game-panel, #fff);
    box-shadow: 0 0 0 .2rem var(--game-frame, #212529);
    overflow: hidden;
}
.mj-board {
    position: relative;
    margin: 0 auto;
    width: calc(var(--mj-tile) * (var(--mj-cols) + .3));
    height: calc(var(--mj-tile) * 1.25 * (var(--mj-rows) + .25));
}
.mj-tile {
    position: absolute;
    width: var(--mj-tile);
    height: calc(var(--mj-tile) * 1.25);
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-weight: 700;
    color: #212529;
    background: linear-gradient(160deg, #fffdf5, #f1e8cf);
    border: 1px solid #8a7b52;
    border-radius: .35rem;
    /* the tile's thickness: a darker edge to the right and below, so layers look stacked */
    box-shadow: .18rem .22rem 0 #b9a977, .26rem .32rem 0 #6f6240, .3rem .4rem .45rem rgba(0, 0, 0, .25);
    transition: transform .08s, opacity .15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.mj-tile .mj-top { font-size: calc(var(--mj-tile) * .5); }
.mj-tile .mj-bottom { font-size: calc(var(--mj-tile) * .3); margin-top: .1em; }
.mj-tile.blocked { background: linear-gradient(160deg, #e6e0cf, #cfc7ae); color: #6c6a63; cursor: default; }
.mj-tile.blocked .mj-top, .mj-tile.blocked .mj-bottom { opacity: .65; }
.mj-tile:not(.blocked):hover { transform: translateY(-2px); }
.mj-tile.selected { background: linear-gradient(160deg, #fff3b0, #ffd966); border-color: var(--bs-primary); box-shadow: 0 0 0 3px var(--bs-primary), .26rem .32rem 0 #6f6240; z-index: 100; }
.mj-tile.hinted { animation: mj-pulse .7s ease-in-out 3; }
.mj-tile.gone { opacity: 0; pointer-events: none; transform: scale(.7); }
@keyframes mj-pulse { 50% { box-shadow: 0 0 0 4px var(--bs-success), .26rem .32rem 0 #6f6240; } }
@media (prefers-reduced-motion: reduce) { .mj-tile, .mj-tile.hinted { transition: none; animation: none; } }
.mj-c0 { color: #c0392b; }   /* characters */
.mj-c1 { color: #1e8449; }   /* bamboo */
.mj-c2 { color: #1f5fa8; }   /* circles */
.mj-c3 { color: #212529; }   /* winds */
.mj-c4 { color: #c0392b; }   /* dragons */
.mj-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1rem; }
.mj-c5 { color: #a61e4d; }   /* flowers */
.mj-c6 { color: #e67700; }   /* seasons */
/* The big board (Mahjong Titans): sixteen columns of tiles, so a tile may be smaller and the board wider. */
.mahjong.mj-titans { max-width: 64rem; }
.mj-titans .mj-board-wrap { --mj-tile: min(calc((100vw - 2.5rem) / (var(--mj-cols) + .8)), 3.4rem); }
.mj-tools [data-left]::after { content: " (" attr(data-left) ")"; }
/* the big board: room for the lifted layers, lower layers a touch darker so the stacks read at a glance */
.mj-titans .mj-board { width: calc(var(--mj-tile) * (var(--mj-cols) + 1)); height: calc(var(--mj-tile) * 1.25 * (var(--mj-rows) + .9)); }
.mj-titans .mj-tile.mj-z0 { filter: brightness(.9); }
.mj-titans .mj-tile.mj-z1 { filter: brightness(.96); }
.mj-titans .mj-tile.selected { filter: none; }
