/* ═══════════════════════════════════════════════════════════════
   MAHJONG SOLITAIRE — Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Wrapper scrollable ────────────────────────────────────────── */
.mahjong-board-wrapper {
    display: flex;
    justify-content: center;
    overflow: auto;
    padding: var(--spacing-4);
    -webkit-overflow-scrolling: touch;
}

/* ── Plateau : conteneur relatif pour positionnement absolu ─────── */
.mahjong-board {
    position: relative;
    /* Largeur = (maxCol * STEP_X) + TILE_W + couches*LAYER_OFFSET */
    /* maxCol=20, STEP_X=26 → 520 + 52 + 3*5 = ~587px */
    width: 600px;
    /* Hauteur = (maxRow * STEP_Y) + TILE_H + 2 * maxLayer * LAYER_OFFSET */
    /* maxRow=12, STEP_Y=35 → 420 + 70 + 2*3*5 = ~520px */
    height: 520px;
    flex-shrink: 0;
}

/* ── Tuile de base ──────────────────────────────────────────────── */
.mahjong-tile {
    position: absolute;
    width: 52px;
    height: 70px;
    border-radius: var(--border-radius-sm, 6px);
    background: linear-gradient(145deg, #f5f0e8, #e8e0d0);
    border: 1.5px solid #b8a898;
    box-shadow:
        2px 2px 0 #8a7a6a,
        3px 3px 0 #6a5a4a,
        inset 0 1px 0 rgba(255,255,255,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: default;
    user-select: none;
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
    box-sizing: border-box;
}

/* Tuile bloquée (non libre) : légèrement assombrie */
.mahjong-tile:not(.is-free) {
    filter: brightness(0.82) saturate(0.7);
}

/* Tuile libre : curseur pointer + effet hover */
.mahjong-tile.is-free {
    cursor: pointer;
}
.mahjong-tile.is-free:hover {
    transform: translateY(-3px);
    box-shadow:
        2px 5px 0 #8a7a6a,
        3px 6px 0 #6a5a4a,
        inset 0 1px 0 rgba(255,255,255,0.6);
    filter: brightness(1.05);
    z-index: 9999 !important;
}

/* Tuile sélectionnée */
.mahjong-tile.is-selected {
    border: 2px solid var(--color-gold-10, #f0c040);
    box-shadow:
        0 0 0 2px var(--color-gold-10, #f0c040),
        2px 2px 0 #8a7a6a,
        3px 3px 0 #6a5a4a;
    filter: brightness(1.1);
    z-index: 9999 !important;
}

/* Tuile indice (surlignée en vert pulsant) */
.mahjong-tile.is-hint {
    border: 2px solid var(--color-emerald-10, #4caf50);
    box-shadow:
        0 0 0 2px var(--color-emerald-10, #4caf50),
        2px 2px 0 #8a7a6a;
    animation: hint-pulse 0.7s ease-in-out infinite alternate;
    z-index: 9999 !important;
}

@keyframes hint-pulse {
    from { box-shadow: 0 0 0 2px var(--color-emerald-10, #4caf50), 2px 2px 0 #8a7a6a; }
    to   { box-shadow: 0 0 8px 3px var(--color-emerald-10, #4caf50), 2px 2px 0 #8a7a6a; }
}

/* ── Contenu de la tuile ────────────────────────────────────────── */
.tile-label {
    font-size: 1.3rem;
    line-height: 1;
    font-weight: 700;
}
.tile-family-icon {
    font-size: 0.6rem;
    opacity: 0.5;
    line-height: 1;
}

/* ── Couleurs par famille ────────────────────────────────────────── */
.tile-bambou  { color: var(--color-emerald-10, #4caf50); }
.tile-cercle  { color: var(--color-coral-10, #e5644f); }
.tile-carac   { color: var(--color-purple-10, #9c27b0); }
.tile-vent    { color: var(--color-gold-10, #f0c040); font-weight: 800; }
.tile-dragon  {
    color: var(--color-coral-10, #e5644f);
    font-size: 1.1rem;
    font-weight: 800;
}
.tile-fleur   { font-size: 1.4rem; }

/* Dragon blanc : fond différent */
.tile-dragon .tile-label:has(+ .tile-family-icon) { /* fallback */ }

/* ── Conteneur principal du plateau ─────────────────────────────── */
.game-board-mahjong {
    position: relative;
    flex: 1;
    overflow: hidden;
}

/* ── Responsive ─────────────────────────────────────────────────── */
/* Le board est mis à l'échelle via transform:scale() dans Mahjong.js */
/* On masque juste les icônes de famille sur petit écran */
@media (max-width: 640px) {
    .tile-family-icon { display: none; }
}
