.minesweeper-board {
    display: inline-grid;
    gap: 1px;
    background: #999;
    border: 3px solid #999;
    padding: 0;
    margin: 0 auto;
    user-select: none;
    max-width: 100%;
    overflow-x: auto;
}

#gameBoard {
    width: 100%;
    overflow-x: auto;
    text-align: center;
}

.minesweeper-cell {
    width: 32px;
    height: 32px;
    background: #ddd;
    border: 2px outset #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.1s;
    aspect-ratio: 1;
}

.minesweeper-cell:hover:not(.revealed):not(.flagged) {
    background: #eee;
}

.minesweeper-cell:active:not(.revealed):not(.flagged) {
    border-style: inset;
}

.minesweeper-cell.revealed {
    background: #ccc;
    border: 1px solid #999;
    cursor: default;
}

.minesweeper-cell.flagged {
    background: #ffd700;
}

.minesweeper-cell.mine {
    background: #ff4444;
}

.minesweeper-cell.mine-wrong {
    background: #ffaa44;
}

/* Number colors */
.minesweeper-cell[data-count="1"] { color: #0000ff; }
.minesweeper-cell[data-count="2"] { color: #008000; }
.minesweeper-cell[data-count="3"] { color: #ff0000; }
.minesweeper-cell[data-count="4"] { color: #000080; }
.minesweeper-cell[data-count="5"] { color: #800000; }
.minesweeper-cell[data-count="6"] { color: #008080; }
.minesweeper-cell[data-count="7"] { color: #000000; }
.minesweeper-cell[data-count="8"] { color: #808080; }

/* Cell size is now calculated dynamically by JS */
/* These are fallback values only */
@media (max-width: 768px) {
    .minesweeper-cell {
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .minesweeper-cell {
        font-size: 12px;
        border-width: 1px;
    }
}

/* Dark mode */
[data-bs-theme="dark"] .minesweeper-cell {
    background: #444;
    border-color: #666;
}

[data-bs-theme="dark"] .minesweeper-cell:hover:not(.revealed):not(.flagged) {
    background: #555;
}

[data-bs-theme="dark"] .minesweeper-cell.revealed {
    background: #333;
    border-color: #555;
}

[data-bs-theme="dark"] .minesweeper-cell.flagged {
    background: #b8860b;
}

[data-bs-theme="dark"] .minesweeper-cell.mine {
    background: #cc0000;
}

[data-bs-theme="dark"] .minesweeper-cell.mine-wrong {
    background: #cc7700;
}

/* Emoji icons */
.minesweeper-cell.mine,
.minesweeper-cell.flagged {
    font-size: 16px;
    line-height: 1;
}

@media (max-width: 768px) {
    .minesweeper-cell.mine,
    .minesweeper-cell.flagged {
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .minesweeper-cell.mine,
    .minesweeper-cell.flagged {
        font-size: 12px;
    }
}

/* Fullscreen mode */
#minesweeperGame.fullscreen-mode {
    background: var(--bs-body-bg);
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
}

#minesweeperGame.fullscreen-mode .card {
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

#minesweeperGame.fullscreen-mode .card:last-of-type {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#minesweeperGame.fullscreen-mode .card:last-of-type .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#minesweeperGame.fullscreen-mode #gameBoard {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow: auto;
    padding: 10px;
}

#minesweeperGame.fullscreen-mode .minesweeper-board {
    margin: 0 auto;
}

/* Cell size in fullscreen is calculated dynamically by JS */
#minesweeperGame.fullscreen-mode .minesweeper-cell {
    font-size: 16px;
}

@media (min-width: 576px) {
    #minesweeperGame.fullscreen-mode .minesweeper-cell {
        font-size: 18px;
    }
}

@media (min-width: 768px) {
    #minesweeperGame.fullscreen-mode .minesweeper-cell {
        font-size: 20px;
    }
}

/* Hide SEO content in fullscreen */
#minesweeperGame.fullscreen-mode ~ .row {
    display: none;
}

/* Dark mode fullscreen */
[data-bs-theme="dark"] #minesweeperGame.fullscreen-mode {
    background: var(--bs-body-bg);
}

/* Touch feedback */
.minesweeper-cell.touching {
    transform: scale(0.92);
    opacity: 0.8;
}

.minesweeper-cell.long-pressed {
    animation: pulse-flag 0.3s ease;
}

@keyframes pulse-flag {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Mobile improvements */
@media (max-width: 576px) {
    .minesweeper-cell.mine,
    .minesweeper-cell.flagged {
        font-size: 14px;
    }

    #minesweeperGame .card-body {
        padding: 0.75rem;
    }

    #minesweeperGame .row.text-center .col-4 {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    /* Compact stats on mobile */
    #minesweeperGame .row.text-center .d-flex {
        flex-direction: column;
        gap: 0 !important;
    }

    #minesweeperGame .row.text-center .small.text-muted {
        font-size: 0.65rem;
    }

    #minesweeperGame .row.text-center .fs-5 {
        font-size: 1rem !important;
    }
}

/* Highlight blink animation for adjacent cells */
.minesweeper-cell.highlight-blink {
    animation: cell-blink 0.4s ease;
}

@keyframes cell-blink {
    0%, 100% {
        background: #ddd;
    }
    50% {
        background: #87ceeb;
        box-shadow: 0 0 8px rgba(135, 206, 235, 0.8);
    }
}

[data-bs-theme="dark"] .minesweeper-cell.highlight-blink {
    animation: cell-blink-dark 0.4s ease;
}

@keyframes cell-blink-dark {
    0%, 100% {
        background: #444;
    }
    50% {
        background: #4a90a4;
        box-shadow: 0 0 8px rgba(74, 144, 164, 0.8);
    }
}

/* Flag mode button active state */
#flagModeBtn.btn-warning {
    color: #000;
}

#flagModeBtn.btn-warning .fsvg {
    filter: brightness(0);
}

/* Better button spacing on mobile */
@media (max-width: 767px) {
    #minesweeperGame .row.g-3 > [class*="col-"] {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }

    #minesweeperGame .btn {
        padding: 0.5rem 0.5rem;
        font-size: 0.875rem;
    }

    #minesweeperGame .btn .fsvg {
        width: 16px !important;
        height: 16px !important;
        margin-right: 0.25rem !important;
    }

    .flag-mode-text,
    .fullscreen-text {
        font-size: 0.75rem;
    }
}

/* Game History table */
#historyTable {
    font-size: 0.875rem;
}

#historyTable th {
    font-weight: 600;
    white-space: nowrap;
}

#historyTable td {
    vertical-align: middle;
}

@media (max-width: 576px) {
    #historyTable {
        font-size: 0.8rem;
    }
}
