:root {
    --bg-color: #FFFFFF;
    --text-main: #1D1D1F;
    --text-light: #86868B;
    --accent-blue: #007AFF;
    --accent-red: #FF3B30;
    --cell-covered: #E5E5EA; /* Concrete Grey */
    --cell-open: #F5F5F7; /* Lighter Ground */
    --glass: rgba(255, 255, 255, 0.7);
    --shadow: 0 20px 40px rgba(0,0,0,0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* Prevent body scroll, handle in grid */
    touch-action: none; /* Helps prevent overscroll on mobile */
}

/* --- AURORA BACKGROUND --- */
.blob-cont {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    background: #FFFFFF;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 15s infinite alternate;
}

.blob-one {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #E0F2FE;
}

.blob-two {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: #F3E8FF;
    animation-delay: -5s;
}

.blob-three {
    top: 40%;
    left: 30%;
    width: 30vw;
    height: 30vw;
    background: #E0E7FF;
    opacity: 0.2;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(40px, 60px) scale(1.1);
    }
}

/* --- NAVIGATION --- */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1rem 2rem;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
}

.logo-img {
    height: 40px;
    width: auto;
    mix-blend-mode: multiply;
}

.logo span {
    font-weight: 700;
    letter-spacing: -0.05em;
    font-size: 1.1rem;
}

.nav-links {
    list-style: none;
}

    .nav-links a {
        font-weight: 500;
        color: var(--text-light);
        text-decoration: none;
        transition: 0.3s;
    }

        .nav-links a:hover {
            color: var(--accent-red);
        }

/* --- GAME WRAPPER --- */
#game-wrapper {
    height: 100vh;
    padding-top: 80px; /* Space for Nav */
    padding-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-card {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Don't go off screen */
    width: auto;
    max-width: 95vw;
}

/* Header & Controls */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    min-width: 300px;
}

h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.sub-text {
    font-size: 0.8rem;
    color: var(--text-light);
}

.stats-box {
    font-size: 1.2rem;
    font-weight: 700;
    background: white;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.diff-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.2s;
}

    .diff-btn:hover, .diff-btn.active {
        background: var(--text-main);
        color: white;
        border-color: var(--text-main);
    }

/* --- THE GRID --- */
.grid-container {
    overflow: auto; /* Allows scrolling for 32x20 on small screens */
    border-radius: 12px;
    background: #D1D1D6; /* Border color */
    padding: 1px; /* Creates the grid lines */
    max-width: 100%;
    /* Center the grid if it's smaller than the screen */
    display: flex;
    justify-content: center;
}

#grid {
    display: grid;
    background: #D1D1D6;
    gap: 1px; /* Grid lines gap */
    margin: 0 auto;
}

.cell {
    width: 30px;
    height: 30px;
    background: var(--cell-covered);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px; /* Slightly bigger for readability */
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
    /* CRITICAL MOBILE FIX: Prevents double-tap to zoom */
    touch-action: manipulation;
}

    .cell:hover {
        filter: brightness(0.95);
    }

    /* Cell States */
    .cell.open {
        background: var(--cell-open);
        cursor: default;
    }

    .cell.mine {
        background: var(--accent-red);
        color: white;
    }

    .cell.flag {
        font-size: 16px;
    }

    /* Numbers Colors */
    .cell[data-val="1"] {
        color: var(--accent-blue);
    }

    .cell[data-val="2"] {
        color: #34C759;
    }

    .cell[data-val="3"] {
        color: #FF9500;
    }

    .cell[data-val="4"] {
        color: #5856D6;
    }

    .cell[data-val="5"] {
        color: #FF2D55;
    }

    .cell[data-val="6"] {
        color: #AF52DE;
    }

/* --- MODAL --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid #E5E5E7;
}

.warning-text {
    color: var(--accent-red);
    margin-bottom: 0.5rem;
}

.sub-warning {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.action-btn {
    padding: 12px 24px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    transition: 0.2s;
}

    .action-btn:hover {
        background: #005ecb;
        transform: translateY(-2px);
    }
