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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

/* 难度选择 */
.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.difficulty-btn {
    padding: 10px 15px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    touch-action: manipulation;
}

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

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

/* 游戏信息 */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

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

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

.value {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    min-width: 30px;
}

.game-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.reset-btn, .pause-btn {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
    touch-action: manipulation;
}

.reset-btn:active, .pause-btn:active {
    transform: scale(0.95);
    background: #5568d3;
}

/* 游戏状态 */
.game-status {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    min-height: 30px;
    padding: 5px;
}

.game-status.win {
    color: #28a745;
}

.game-status.lose {
    color: #dc3545;
}

/* 游戏面板 */
.game-board {
    display: inline-grid;
    gap: 1px;
    background: #999;
    border: 2px solid #999;
    margin: 0 auto 30px;
    max-width: 100%;
    overflow-x: auto;
    touch-action: manipulation;
}

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

.cell {
    width: 30px;
    height: 30px;
    background: #bbb;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

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

.cell.covered {
    background: linear-gradient(135deg, #ddd 0%, #bbb 100%);
}

.cell.covered:hover {
    background: linear-gradient(135deg, #ccc 0%, #aaa 100%);
}

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

.cell.mine {
    background: #ff6b6b;
}

.cell.flagged {
    background: linear-gradient(135deg, #ffd93d 0%, #f6b93b 100%);
}

.cell.flagged::before {
    content: '🚩';
}

.cell.mine::before {
    content: '💣';
}

/* 数字颜色 */
.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; }

/* 游戏规则 */
.game-rules {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.game-rules h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
}

.game-rules ul {
    list-style: none;
    padding: 0;
}

.game-rules li {
    padding: 8px 0;
    color: #555;
    line-height: 1.6;
}

.game-rules strong {
    color: #667eea;
}

/* 横屏提示 */
.orientation-notice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    text-align: center;
}

.orientation-notice.hidden {
    display: none;
}

.notice-content {
    padding: 30px;
}

.notice-content p {
    font-size: 18px;
    margin: 10px 0;
}

.notice-content p:first-child {
    font-size: 48px;
}

/* 暂停遮罩 */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(10px);
}

.pause-overlay.hidden {
    display: none;
}

.pause-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: pauseAppear 0.3s ease-out;
}

@keyframes pauseAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pause-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pausePulse 2s ease-in-out infinite;
}

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

.pause-text {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.pause-hint {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.resume-btn {
    padding: 12px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s;
    touch-action: manipulation;
}

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        border-radius: 10px;
    }

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

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

    .game-info {
        padding: 10px;
        font-size: 14px;
    }

    .reset-btn {
        padding: 6px 15px;
        font-size: 14px;
    }

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

    .game-rules h2 {
        font-size: 18px;
    }

    .game-rules li {
        font-size: 14px;
    }

    .pause-content {
        padding: 30px;
        max-width: 90%;
    }

    .pause-icon {
        font-size: 48px;
    }

    .pause-text {
        font-size: 22px;
    }

    .pause-hint {
        font-size: 14px;
    }

    .resume-btn {
        padding: 10px 25px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 10px;
    }

    h1 {
        font-size: 18px;
    }

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

    .cell {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .game-info {
        font-size: 12px;
    }

    .value {
        font-size: 16px;
    }

    .pause-content {
        padding: 25px;
    }

    .pause-icon {
        font-size: 42px;
    }

    .pause-text {
        font-size: 20px;
    }

    .pause-hint {
        font-size: 13px;
    }

    .resume-btn {
        padding: 8px 20px;
        font-size: 15px;
    }
}

/* 横屏模式（高级难度） */
@media (orientation: landscape) and (max-width: 900px) {
    .container {
        max-width: 100%;
    }

    .cell {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}
