/**
 * Minesweeper Game Styles
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.game-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #eee;
}

.stats {
    display: flex;
    gap: 0.5rem;
}

.stat-box {
    background: #16213e;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.stat-box .label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
}

.stat-box .value {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.instruction {
    color: #888;
    font-size: 0.875rem;
}

.best-time {
    color: #4ade80;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    background: #0f0f1a;
    border-radius: 8px;
    padding: 6px;
    width: 100%;
    aspect-ratio: 1;
}

.cell {
    background: #3b3b5c;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.1s;
    aspect-ratio: 1;
}

.cell:active {
    background: #4a4a6a;
}

.cell.revealed {
    background: #1a1a2e;
    cursor: default;
}

.cell.flagged {
    background: #4a4a6a;
}

.cell.mine {
    background: #ef4444;
}

.cell.mine-clicked {
    background: #dc2626;
}

/* Number colors */
.cell[data-count="1"] { color: #3b82f6; }
.cell[data-count="2"] { color: #22c55e; }
.cell[data-count="3"] { color: #ef4444; }
.cell[data-count="4"] { color: #8b5cf6; }
.cell[data-count="5"] { color: #f59e0b; }
.cell[data-count="6"] { color: #06b6d4; }
.cell[data-count="7"] { color: #ec4899; }
.cell[data-count="8"] { color: #6b7280; }

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: #1a1a2e;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.overlay-content h2 {
    font-size: 1.75rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.overlay-content h2.win {
    color: #4ade80;
}

.overlay-content h2.lose {
    color: #ef4444;
}

.overlay-content p {
    font-size: 1rem;
    color: #888;
    margin-bottom: 1.5rem;
}

.restart-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.restart-btn:hover {
    background: #2563eb;
}

.restart-btn:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 2px;
}

/* Home link */
.home-link {
    margin-top: 0.75rem;
    color: #888;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.home-link:hover {
    color: #aaa;
    text-decoration: underline;
}

.home-link:focus-visible {
    outline: 2px solid #888;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 400px) {
    .game-container {
        padding: 0.5rem;
    }

    .title {
        font-size: 1.5rem;
    }

    .cell {
        font-size: 0.875rem;
    }
}
