/**
 * whack-a-bug.css — Styles dédiés au jeu Whack-a-Bug
 * Préfixes : .wb-* (uniquement pour ce jeu)
 * Tout ce qui est mutualisé reste dans games.css.
 */

/* ── Plateau 4×4 ────────────────────────────────────────────────────────────── */
.wb-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .6rem;
    max-width: 520px;
    margin: 0 auto 1.25rem;
    padding: .9rem;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-radius: 14px;
    box-shadow: inset 0 2px 14px rgba(0, 0, 0, .35);
}

/* ── Cellule (trou) ─────────────────────────────────────────────────────────── */
.wb-cell {
    aspect-ratio: 1 / 1;
    border: none;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 30%, #4b5563 0%, #1f2937 60%, #0f172a 100%);
    box-shadow:
        inset 0 -4px 8px rgba(0, 0, 0, .55),
        inset 0 4px 6px rgba(255, 255, 255, .04),
        0 2px 4px rgba(0, 0, 0, .25);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform .08s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wb-cell:disabled {
    cursor: not-allowed;
    opacity: .92;
}

.wb-cell:not(:disabled):active {
    transform: scale(.95);
}

.wb-cell:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 3px;
}

/* ── Bug (emoji) — caché par défaut, visible quand .is-active ──────────────── */
.wb-bug {
    font-size: 2.2rem;
    line-height: 1;
    transform: translateY(110%) scale(.6);
    opacity: 0;
    transition: transform .12s cubic-bezier(.34, 1.56, .64, 1), opacity .1s;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5));
}

.wb-cell.is-active .wb-bug {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Hit : flash vert + secousse */
.wb-cell.is-hit {
    animation: wb-hit-flash .35s ease;
}

.wb-cell.is-hit .wb-bug {
    animation: wb-bug-squash .35s ease forwards;
}

/* Miss : flash rouge */
.wb-cell.is-missed {
    animation: wb-miss-flash .35s ease;
}

@keyframes wb-hit-flash {
    0%   { box-shadow: inset 0 0 0 4px #10b981, inset 0 -4px 8px rgba(0, 0, 0, .55); }
    100% { box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .55); }
}

@keyframes wb-bug-squash {
    0%   { transform: translateY(0) scale(1); opacity: 1; }
    50%  { transform: translateY(0) scale(1.6); opacity: .9; }
    100% { transform: translateY(-30%) scale(.2); opacity: 0; }
}

@keyframes wb-miss-flash {
    0%   { box-shadow: inset 0 0 0 4px #dc3545, inset 0 -4px 8px rgba(0, 0, 0, .55); }
    100% { box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .55); }
}

/* ── Vies (cœurs) — animation perte ─────────────────────────────────────────── */
#wb-lives {
    letter-spacing: .15em;
}

#wb-lives.is-shake {
    animation: wb-shake .35s ease;
}

@keyframes wb-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* ── Combo badge — pulse au-delà de x2 ──────────────────────────────────────── */
#wb-combo-badge.is-active {
    animation: wb-combo-pulse 1s infinite;
    background: #f59e0b !important;
}

@keyframes wb-combo-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}

/* ── Game-over overlay (optionnel, message) ────────────────────────────────── */
.wb-game-over {
    background: rgba(220, 53, 69, .08);
    border: 1px dashed rgba(220, 53, 69, .35);
    border-radius: 10px;
    padding: .8rem;
    text-align: center;
    margin-top: 1rem;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .wb-board {
        gap: .45rem;
        padding: .6rem;
    }
    .wb-bug {
        font-size: 1.7rem;
    }
}

@media (max-width: 380px) {
    .wb-bug {
        font-size: 1.4rem;
    }
}

/* ── Dark mode ─────────────────────────────────────────────────────────────── */
[data-theme="dark"] .wb-board {
    background: linear-gradient(135deg, #0b1020 0%, #050811 100%);
}

[data-theme="dark"] .wb-cell {
    background: radial-gradient(ellipse at 50% 30%, #374151 0%, #111827 60%, #030712 100%);
}
