* {
    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: 10px;
}

.container {
    background-color: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 20px;
    max-width: 600px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

#game-info {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#game-info label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #555;
}

#game-info input {
    width: 60px;
    padding: 6px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    transition: border-color 0.3s;
}

#game-info input:focus {
    outline: none;
    border-color: #667eea;
}

#restart-button {
    padding: 10px 24px;
    font-size: 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

#restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#restart-button:active {
    transform: translateY(0);
}

.flag-info {
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

#game-board {
    display: grid;
    gap: 3px;
    margin: 0 auto;
    padding: 15px;
    background-color: #e8e8e8;
    border-radius: 8px;
    width: fit-content;
}

.cell {
    width: 32px;
    height: 32px;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid #999;
    user-select: none;
    transition: all 0.1s;
}

.cell:active {
    transform: scale(0.95);
}

.cell.open {
    background: linear-gradient(145deg, #f8f8f8, #e0e0e0);
    border-color: #aaa;
    color: #333;
}

.cell.mine {
    background-color: #ff6b6b;
    border-color: #d63031;
    animation: shake 0.5s;
}

.cell.flag {
    background-color: #ffd93d;
    border-color: #f0a500;
    color: #000;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* 数字颜色 */
.cell.open {
    --text-color: #333;
}

.cell.open[data-count="1"] { color: #0066cc; }
.cell.open[data-count="2"] { color: #00aa00; }
.cell.open[data-count="3"] { color: #ff0000; }
.cell.open[data-count="4"] { color: #000099; }
.cell.open[data-count="5"] { color: #990000; }
.cell.open[data-count="6"] { color: #009999; }
.cell.open[data-count="7"] { color: #000000; }
.cell.open[data-count="8"] { color: #666666; }

/* Mobile responsive styles */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.6em;
        margin-bottom: 15px;
    }

    .info-row {
        gap: 8px;
    }

    #game-info label {
        font-size: 14px;
    }

    #game-info input {
        width: 50px;
        padding: 5px;
        font-size: 12px;
    }

    #restart-button {
        padding: 8px 16px;
        font-size: 14px;
    }

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

    .cell {
        width: 28px;
        height: 28px;
        font-size: 14px;
        border-width: 0.5px;
        gap: 2px;
    }

    #game-board {
        gap: 2px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.4em;
        margin-bottom: 12px;
    }

    .info-row {
        flex-direction: row;
        gap: 6px;
    }

    #game-info label {
        font-size: 13px;
    }

    #game-info input {
        width: 45px;
        padding: 4px;
        font-size: 11px;
    }

    #restart-button {
        padding: 6px 12px;
        font-size: 13px;
    }

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

    #game-board {
        gap: 1px;
        padding: 8px;
    }
}