:root {
    --primary-color: #00ccff;
    --secondary-color: #1a472a;
    --danger-color: #e74c3c;
    --safe-color: #4caf50;
    --font-title: 'Press Start 2P', monospace;
    --font-body: 'Roboto', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #0a0a16 0%, #1a472a 100%);
    color: #fff;
    font-family: var(--font-body);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.minesweeper-header {
    padding: 1.5rem 0 1rem 0;
    text-align: center;
    background: #0a0a16;
}

.game-title {
    font-family: var(--font-title);
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    letter-spacing: 2px;
    display: inline-flex; /* Align icon and text */
    align-items: center;
}

.nav-link {
    color: var(--primary-color);
    text-decoration: none;
    font-family: var(--font-title);
    font-size: 1rem;
}

.game-controls {
    display: flex;
    gap: 1rem;
    justify-content: center; /* Center items horizontally */
    align-items: center;
    margin: 1.5rem auto 1rem auto; /* Center the whole control bar */
    flex-wrap: wrap;
    color: #ccc; /* Lighter text for labels */
    font-size: 0.9rem;
    max-width: 600px; /* Limit width for better centering */
    padding: 0.5rem;
    background: #111; /* Add a subtle background */
    border-radius: 8px;
    border: 1px solid #333;
}

.game-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.game-controls select {
    background: #222;
    color: #fff;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-family: var(--font-body);
}

/* Style for the counter displays (Mines, Timer) */
.control-display {
    display: inline-flex; /* Align icons in counters */
    align-items: center;
    background: #0a0a16;
    padding: 0.5rem 0.8rem; /* Adjusted padding */
    border-radius: 4px;
    border: 1px solid #333;
    min-width: 110px; /* Ensure consistent width */
    justify-content: center;
    font-family: var(--font-title); /* Use retro font */
    font-size: 1rem; /* Slightly larger font */
    color: var(--danger-color); /* Red color for numbers */
    line-height: 1; /* Ensure consistent line height */
}
.control-display img {
    margin-right: 0.4rem; /* Space between icon and text */
}
/* Timer specific color if needed, but red is standard */
/* #timer { color: var(--primary-color); } */

/* Center the smiley button */
.face-btn {
    order: 0; /* Default order */
    margin: 0 1rem; /* Add some margin around the face */
}

/* Push counters to edges */
#mineCounter {
    order: -1; /* Move to the left */
    margin-right: auto; /* Push smiley and timer away */
}
#timer {
    order: 1; /* Move to the right */
    margin-left: auto; /* Push smiley and counter away */
}

/* Difficulty label styling */
.difficulty-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%; /* Make it take full width below */
    justify-content: center; /* Center it */
    margin-top: 0.5rem; /* Add space above */
    order: 2; /* Ensure it's below the main controls */
}

.brand-btn {
    background: var(--primary-color);
    color: #0a0a16;
    border: none;
    border-radius: 6px;
    font-family: var(--font-title);
    font-size: 1rem;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,204,255,0.15);
    transition: background 0.2s;
    display: inline-flex; /* Align icon */
    align-items: center;
}
.brand-btn:hover {
    background: #00b0e6;
}

/* Specific style for the face button */
.face-btn {
    padding: 0.3rem; /* Less padding for image button */
    background: #333; /* Neutral background */
    border: 2px outset #555;
}
.face-btn:active {
    border-style: inset;
}
.face-btn img {
    display: block; /* Prevent extra space below image */
}

#boardContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.minesweeper-board {
    display: grid;
    background: #111; /* Darker background for the grid itself */
    border: 3px solid var(--primary-color);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,204,255,0.15);
    overflow: hidden;
    padding: 5px; /* Small padding around cells */
    gap: 1px; /* Thin gap between cells */
}

.cell {
    width: 30px; /* Slightly smaller cells */
    height: 30px;
    background: #444; /* Default unrevealed color */
    border: 2px outset #666; /* 3D button effect */
    font-family: var(--font-title);
    font-size: 1rem;
    color: #fff;
    text-align: center;
    line-height: 28px; /* Center content vertically */
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
    outline: none;
    position: relative;
    padding: 0; /* Remove default button padding */
    display: flex; /* Center icon */
    justify-content: center;
    align-items: center;
}
.cell:active:not(.revealed) {
    border-style: inset;
    background: #333;
}

.cell.revealed {
    background: #282828; /* Revealed background */
    border: 1px solid #1a1a1a; /* Flatter border */
    cursor: default;
}

.cell.mine {
    /* Background handled by revealed */
}
.cell.hit-mine { /* Specific style for the mine that was clicked */
    background-color: var(--danger-color);
}

.cell.flagged {
    /* Background is default unrevealed color */
}

.cell.wrong-mine { /* Style for incorrectly flagged cells */
     background: #555; /* Indicate it's revealed but wrong */
}

.cell-icon {
    max-width: 70%;
    max-height: 70%;
    display: block; /* Ensure image behaves well */
}

/* Number Colors */
.cell[data-adjacent="1"] { color: #00ccff; }
.cell[data-adjacent="2"] { color: #4caf50; }
.cell[data-adjacent="3"] { color: #ffd700; }
.cell[data-adjacent="4"] { color: #e67e22; }
.cell[data-adjacent="5"] { color: #e74c3c; }
.cell[data-adjacent="6"] { color: #8e44ad; }
.cell[data-adjacent="7"] { color: #00bcd4; }
.cell[data-adjacent="8"] { color: #fff; }

.game-message {
    text-align: center;
    font-family: var(--font-title);
    font-size: 1.2rem;
    margin: 1rem 0;
    color: var(--primary-color);
    min-height: 2rem;
}

.minesweeper-footer {
    text-align: center;
    padding: 1.5rem 0 1rem 0;
    background: #0a0a16;
    color: #aaa;
    font-size: 0.9rem;
    margin-top: auto;
}
