/* === Minesweeper Styles === */

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
    min-height: calc(100vh - var(--nav-height));
    padding-top: calc(var(--nav-height) + var(--space-8));
}

.game-header {
    text-align: center;
}

/* ── Difficulty ── */
.difficulty-selector {
    display: flex;
    justify-content: center;
}

.difficulty-buttons {
    display: flex;
    gap: var(--space-2);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 4px;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-body);
}

.difficulty-btn small {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: var(--weight-normal);
}

.difficulty-btn:hover {
    color: var(--text-primary);
}

.difficulty-btn--active {
    background: var(--gradient-primary);
    color: white;
}

.difficulty-btn--active small {
    color: rgba(255, 255, 255, 0.7);
}

/* ── Status Bar ── */
.status-bar {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-3) var(--space-6);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
}

.status-bar__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.status-bar__value {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--accent-cyan);
    min-width: 3ch;
    text-align: center;
}

.status-bar__face {
    font-size: var(--text-2xl);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast);
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
}

.status-bar__face:hover {
    transform: scale(1.15);
}

.status-bar__face:active {
    transform: scale(0.95);
}

/* ── Board ── */
.board-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-2);
}

.board {
    display: grid;
    gap: 1px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg);
    padding: 2px;
    border: 2px solid var(--glass-border);
    user-select: none;
}

/* ── Cells ── */
.ms-cell {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: var(--weight-bold);
    font-family: var(--font-mono);
    cursor: pointer;
    border: none;
    transition: all 80ms ease;
    border-radius: 2px;
    padding: 0;
    line-height: 1;
}

/* Unrevealed */
.ms-cell--hidden {
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ms-cell--hidden:hover {
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.3);
}

.ms-cell--hidden:active {
    background: var(--bg-secondary);
    transform: scale(0.95);
}

/* Revealed */
.ms-cell--revealed {
    background: var(--bg-secondary);
    cursor: default;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

/* Flagged */
.ms-cell--flagged {
    background: var(--bg-tertiary);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

/* Mine */
.ms-cell--mine {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.4);
}

.ms-cell--mine-hit {
    background: rgba(248, 113, 113, 0.4);
    border: 1px solid var(--error);
    animation: mineExplode 0.3s ease both;
}

@keyframes mineExplode {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
        background: rgba(248, 113, 113, 0.6);
    }

    100% {
        transform: scale(1);
    }
}

/* Number colors */
.ms-cell[data-num="1"] {
    color: #60a5fa;
}

.ms-cell[data-num="2"] {
    color: #34d399;
}

.ms-cell[data-num="3"] {
    color: #f87171;
}

.ms-cell[data-num="4"] {
    color: #818cf8;
}

.ms-cell[data-num="5"] {
    color: #f97316;
}

.ms-cell[data-num="6"] {
    color: #22d3ee;
}

.ms-cell[data-num="7"] {
    color: #a855f7;
}

.ms-cell[data-num="8"] {
    color: #e2e8f0;
}

/* ── Stats ── */
.game-stats {
    display: flex;
    gap: var(--space-4);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    min-width: 90px;
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: var(--weight-medium);
}

.stat-value {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .difficulty-buttons {
        flex-direction: column;
    }

    .ms-cell {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .ms-cell {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    .game-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
}