/* Mahjong Solitaire Styles */

.game-header .score {
    display: none;
}

.game-header .timer {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-left: 15px;
}

/* ── Container ───────────────────────────────────────────────────────────────── */

.mahjong-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.mahjong-header {
    display: flex;
    gap: 24px;
    align-items: center;
    padding: 10px 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.mahjong-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.mahjong-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    font-weight: 600;
}

.mahjong-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

/* ── Board ───────────────────────────────────────────────────────────────────── */

.mahjong-board-wrap {
    overflow: hidden;
    width: 100%;
}

.mahjong-board {
    position: relative;
    /* size set by JS based on tile dimensions and layout */
}

/* ── Tiles ───────────────────────────────────────────────────────────────────── */

:root {
    --tile-w: 52px;
    --tile-h: 64px;
    --tile-depth: 3px;
}

.mj-tile {
    position: absolute;
    width: var(--tile-w);
    height: var(--tile-h);
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    border-radius: 5px;
    display: grid;
    place-items: center;
    transition: transform 0.1s ease, box-shadow 0.1s ease;

    background: #f5f0e8;
    border-top:    1px solid #ece0c8;
    border-left:   1px solid #ece0c8;
    border-right:  var(--tile-depth) solid #9e8e76;
    border-bottom: var(--tile-depth) solid #7e6e58;
}

/* All tiles use a single Unicode character */
.mj-tile {
    font-size: 3rem;
}

.mj-tile span {
    display: block;
    transform: translateY(-8px);
}

/* Suit colors — not applied when blocked */
.mj-tile:not(.mj-blocked)[data-suit="man"]    { color: #c0392b; }
.mj-tile:not(.mj-blocked)[data-suit="pin"]    { color: #27ae60; }
.mj-tile:not(.mj-blocked)[data-suit="sou"]    { color: #16a085; }
.mj-tile:not(.mj-blocked)[data-suit="wind"]   { color: #2c3e50; }
.mj-tile:not(.mj-blocked)[data-suit="drag-r"] { color: #c0392b; }
.mj-tile:not(.mj-blocked)[data-suit="drag-g"] { color: #27ae60; }
.mj-tile:not(.mj-blocked)[data-suit="drag-w"] { color: #7f8c8d; }
.mj-tile:not(.mj-blocked)[data-suit="flower"] { color: #8e44ad; }
.mj-tile:not(.mj-blocked)[data-suit="season"] { color: #d35400; }

.mj-tile[data-suit="drag-w"] { border: 2px solid #bdc3c7; }

.mj-tile:hover:not(.mj-blocked) {
    transform: translateY(-2px);
}

.mj-tile.mj-selected {
    background: #ffe8a0;
    border-top-color:    #ffe0b0;
    border-left-color:   #ffe0b0;
    border-right-color:  #b8860b;
    border-bottom-color: #9a6f08;
    box-shadow: 0 0 0 2px #d4a017;
    transform: translateY(-3px);
}

.mj-tile.mj-blocked {
    cursor: default;
    background: #d8d0c4;
    border-top-color:    #c8c0b0;
    border-left-color:   #c8c0b0;
    border-right-color:  #8a7a6a;
    border-bottom-color: #6e5e50;
    color: #aaa;
}

.mj-tile.mj-hint {
    animation: mj-hint-pulse 0.6s ease-in-out 2;
}

@keyframes mj-hint-pulse {
    0%, 100% {
        border-right-color:  #9e8e76;
        border-bottom-color: #7e6e58;
        box-shadow: none;
    }
    50% {
        border-right-color:  #3a9e5f;
        border-bottom-color: #2d7f4c;
        box-shadow: 0 0 0 3px #3a9e5f;
    }
}

.mj-tile.mj-remove {
    animation: mj-remove 0.25s ease forwards;
}

@keyframes mj-remove {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.7); }
}

.mj-tile.mj-no-match {
    animation: mj-no-match 0.35s ease;
}

@keyframes mj-no-match {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-5px); }
    60%      { transform: translateX(5px); }
}

/* ── No-moves overlay ────────────────────────────────────────────────────────── */

.mahjong-no-moves {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    z-index: 100;
}

.mahjong-no-moves.show {
    display: flex;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .mahjong-header {
        gap: 16px;
        padding: 8px 16px;
    }
}
