/* Brain Puzzle Game Styles - Vivayasa Theme Compatible */

:root {
    /* Map Game specific vars to Global Theme Variables */
    --bp-bg-color: var(--bg-primary);
    --bp-primary: var(--accent-primary);
    --bp-accent: var(--accent-secondary);
    --bp-glass-bg: var(--bg-secondary);
    --bp-glass-border: var(--border-color);

    /* Tile colors can remain distinct but should play nice with themes */
    --bp-tile-bg: var(--bg-primary);
    --bp-tile-active: var(--accent-primary);
    --bp-tile-success: #4ade80;
    /* Keep success green */
    --bp-tile-error: #f87171;
    /* Keep error red */

    --bp-text-main: var(--text-primary);
    --bp-text-muted: var(--text-secondary);
}

/* Game Board Wrapper */
.game-board-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    background: var(--bg-secondary);
    /* Remove heavy blur/glass effect to match clean Vivayasa style */
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-soft);
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    height: 100%;
}

.tile {
    background: var(--bg-primary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tile:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tile.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: scale(0.96);
    box-shadow: 0 0 15px var(--accent-primary);
}

.tile.success {
    background: var(--bp-tile-success);
    border-color: var(--bp-tile-success);
}

.tile.error {
    background: var(--bp-tile-error);
    border-color: var(--bp-tile-error);
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

/* Modal & Overlay */
.game-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    /* Subtle dim for overlay */
    backdrop-filter: blur(4px);
    border-radius: 20px;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 20;
    visibility: visible;
}

.game-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.glass-panel-game {
    background: var(--bg-primary);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    max-width: 90%;
}

.glass-panel-game h2 {
    font-size: 2rem;
    color: var(--accent-primary);
    font-family: 'Playfair Display', serif;
    margin-bottom: 0.5rem;
}

.glass-panel-game p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}

.glow-btn {
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    padding: 12px 32px;
    border-radius: 50px;
    color: var(--bg-primary);
    /* Contrast text */
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
}

.glow-btn:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Animations */
@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Countdown */
.countdown-number {
    font-size: 6rem;
    font-weight: 700;
    color: var(--accent-primary);
    animation: pulse-countdown 0.8s ease-out forwards;
}

@keyframes pulse-countdown {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Layout Utilities specific to game page */
.game-stats {
    display: flex;
    gap: 3rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.stat-box {
    text-align: center;
    background: var(--bg-secondary);
    padding: 15px 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}