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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

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

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

.game-header h1 {
    color: #333;
    font-size: 2.5rem;
    font-weight: 700;
}

.game-info {
    margin-bottom: 20px;
}

.info-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

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

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

.value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #667eea;
    min-width: 40px;
    text-align: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn-reset {
    background: #667eea;
    color: white;
}

.btn-reset:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.btn-reset:active {
    transform: scale(0.95);
}

.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-difficulty {
    background: #e9ecef;
    color: #495057;
    padding: 10px 16px;
    font-size: 0.9rem;
}

.btn-difficulty:hover {
    background: #dee2e6;
}

.btn-difficulty.active {
    background: #28a745;
    color: white;
}

.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    overflow: auto;
}

.game-board {
    display: inline-grid;
    gap: 2px;
    background: #ddd;
    padding: 2px;
    border-radius: 8px;
}

.cell {
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #f0f0f0, #d9d9d9);
    border: 2px solid #bbb;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.cell:hover:not(.revealed):not(.flagged) {
    background: linear-gradient(145deg, #fff, #e6e6e6);
    transform: scale(1.05);
}

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

.cell.revealed {
    background: #fff;
    border: 1px solid #ddd;
    cursor: default;
    color: #333;
}

.cell.flagged {
    background: linear-gradient(145deg, #ffc107, #ff9800);
}

.cell.mine {
    background: #dc3545;
    color: white;
}

.cell.safe {
    background: #28a745;
    animation: reveal 0.3s ease;
}

@keyframes reveal {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cell[data-count="1"] { color: #0d6efd; }
.cell[data-count="2"] { color: #198754; }
.cell[data-count="3"] { color: #dc3545; }
.cell[data-count="4"] { color: #6f42c1; }
.cell[data-count="5"] { color: #fd7e14; }
.cell[data-count="6"] { color: #20c997; }
.cell[data-count="7"] { color: #000; }
.cell[data-count="8"] { color: #6c757d; }

.game-status {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    min-height: 40px;
    padding: 10px;
    border-radius: 8px;
}

.game-status.win {
    background: #d4edda;
    color: #155724;
    animation: bounce 0.5s ease;
}

.game-status.lose {
    background: #f8d7da;
    color: #721c24;
    animation: shake 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

/* 响应式设计 - 平板 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .game-header h1 {
        font-size: 2rem;
    }

    .info-panel {
        padding: 12px;
        gap: 10px;
    }

    .label {
        font-size: 1rem;
    }

    .value {
        font-size: 1.2rem;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .cell {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 15px;
    }

    .game-header h1 {
        font-size: 1.6rem;
    }

    .info-panel {
        padding: 10px;
        gap: 8px;
    }

    .label {
        font-size: 0.9rem;
    }

    .value {
        font-size: 1.1rem;
        min-width: 30px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .btn-difficulty {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .cell {
        width: 28px;
        height: 28px;
        font-size: 0.95rem;
        border-width: 1px;
    }

    .game-status {
        font-size: 1.2rem;
        padding: 8px;
    }

    .game-board {
        gap: 1px;
        padding: 1px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .cell {
        width: 24px;
        height: 24px;
        font-size: 0.85rem;
    }

    .game-header h1 {
        font-size: 1.4rem;
    }

    .btn-difficulty {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .cell:hover:not(.revealed):not(.flagged) {
        transform: none;
    }
    
    .cell:active:not(.revealed):not(.flagged) {
        background: linear-gradient(145deg, #e6e6e6, #d9d9d9);
    }
}
