* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.game-container {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid #e94560;
    max-width: 100%;
    width: fit-content;
}

.game-header {
    text-align: center;
    margin-bottom: 12px;
}

.game-header h1 {
    font-size: clamp(20px, 5vw, 28px);
    color: #e94560;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(233, 69, 96, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #e94560;
}

.stat-label {
    font-size: 11px;
    color: #b8c0ff;
}

.stat-value {
    font-size: clamp(18px, 5vw, 24px);
    font-weight: bold;
    color: #e94560;
}

/* 难度选择 */
.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: clamp(11px, 3vw, 13px);
    transition: all 0.2s;
}

.difficulty-btn:hover {
    background: rgba(233, 69, 96, 0.3);
}

.difficulty-btn.active {
    background: #e94560;
    border-color: #e94560;
}

/* 游戏棋盘 */
.game-board {
    display: grid;
    gap: 2px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    max-width: calc(100vw - 52px);
}

.cell {
    width: clamp(24px, 6vw, 32px);
    height: clamp(24px, 6vw, 32px);
    background: linear-gradient(145deg, #3a3a5a, #2a2a4a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 3.5vw, 16px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.cell:hover:not(.revealed) {
    background: linear-gradient(145deg, #4a4a6a, #3a3a5a);
    transform: scale(1.05);
}

.cell.revealed {
    background: rgba(255, 255, 255, 0.1);
    cursor: default;
}

.cell.mine {
    background: #e94560 !important;
}

.cell.flagged {
    background: linear-gradient(145deg, #f39c12, #e67e22);
}

.cell[data-number="1"] { color: #3498db; }
.cell[data-number="2"] { color: #27ae60; }
.cell[data-number="3"] { color: #e74c3c; }
.cell[data-number="4"] { color: #9b59b6; }
.cell[data-number="5"] { color: #e67e22; }
.cell[data-number="6"] { color: #1abc9c; }
.cell[data-number="7"] { color: #34495e; }
.cell[data-number="8"] { color: #7f8c8d; }

/* 控制区 */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.control-btn {
    background: linear-gradient(135deg, #e94560 0%, #c23a51 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s;
}

.control-btn:hover {
    transform: translateY(-2px);
}

.mode-toggle {
    display: flex;
    gap: 4px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.mode-btn.active {
    background: #e94560;
    border-color: #e94560;
}

.game-footer {
    text-align: center;
    color: #b8c0ff;
    font-size: clamp(11px, 3vw, 13px);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-box {
    background: linear-gradient(160deg, #1e1e3f 0%, #2a1040 100%);
    border: 2px solid #e94560;
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 320px;
    width: 100%;
    text-align: center;
}

.modal-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 24px;
    color: #e94560;
    margin-bottom: 20px;
}

.modal-stats {
    background: rgba(233, 69, 96, 0.15);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    color: #fff;
    font-size: 16px;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #e94560 0%, #c23a51 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
}

/* 移动端适配 */
@media (max-width: 600px) {
    body {
        padding: 0;
    }
    
    .game-container {
        border-radius: 0;
        border: none;
        padding: 10px;
        max-width: 100vw;
    }
    
    .game-board {
        max-width: calc(100vw - 20px);
    }
    
    .cell {
        width: clamp(20px, 7vw, 28px);
        height: clamp(20px, 7vw, 28px);
    }
}
