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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.flag-particle {
    position: absolute;
    font-size: 24px;
    opacity: 0.6;
    animation: float-diagonal 15s linear infinite;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes float-diagonal {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translate(120vw, -120vh) rotate(360deg);
        opacity: 0;
    }
}

.container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #333;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

.info-panel {
    display: flex;
    gap: 30px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2em;
}

.label {
    font-weight: 600;
    color: #555;
}

.value {
    font-weight: 700;
    color: #667eea;
    min-width: 40px;
}

.game-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#difficulty {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    transition: border-color 0.3s;
}

#difficulty:hover {
    border-color: #667eea;
}

.btn-reset {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-reset:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-reset:active {
    transform: translateY(0);
}

.game-status {
    text-align: center;
    padding: 15px;
    margin-top: 20px;
    border-radius: 8px;
    font-size: 1.3em;
    font-weight: 700;
    transition: all 0.3s;
}

.game-status.hidden {
    display: none;
}

.game-status.won {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.game-status.lost {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.board-container {
    text-align: center;
}

.game-board {
    display: inline-grid;
    gap: 1px;
    background: #999;
    border: 3px solid #999;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
}

.cell {
    width: 30px;
    height: 30px;
    background: #bbb;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: all 0.1s;
    position: relative;
}

.cell:hover:not(.revealed):not(.flagged) {
    background: #ccc;
}

.cell:active:not(.revealed):not(.flagged) {
    background: #aaa;
}

.cell.revealed {
    background: #ddd;
    cursor: default;
}

.cell.flagged {
    background: #ffa500;
    cursor: pointer;
}

.cell.flagged::before {
    content: '🚩';
    font-size: 16px;
}

.cell.mine {
    background: #ff4444;
}

.cell.mine::before {
    content: '💣';
    font-size: 16px;
}

.cell.mine-hit {
    background: #cc0000;
}

.cell.mine-hit::before {
    content: '💥';
    font-size: 16px;
}

/* Number colors */
.cell[data-count="1"] {
    color: #0000ff;
}

.cell[data-count="2"] {
    color: #008000;
}

.cell[data-count="3"] {
    color: #ff0000;
}

.cell[data-count="4"] {
    color: #000080;
}

.cell[data-count="5"] {
    color: #800000;
}

.cell[data-count="6"] {
    color: #008080;
}

.cell[data-count="7"] {
    color: #000000;
}

.cell[data-count="8"] {
    color: #808080;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .info-panel {
        justify-content: center;
    }

    .game-controls {
        flex-direction: column;
    }

    #difficulty, .btn-reset {
        width: 100%;
    }

    .cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
}
