/* 新时代扫雷游戏样式 */

:root {
    /* 霓虹主题色彩 */
    --primary-color: #00ff88;
    --secondary-color: #ff0088;
    --accent-color: #0088ff;
    --background-dark: #0a0a0f;
    --background-light: #1a1a2e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --shadow-neon: 0 0 20px rgba(0, 255, 136, 0.3);
    --shadow-pink: 0 0 20px rgba(255, 0, 136, 0.3);
    --shadow-blue: 0 0 20px rgba(0, 136, 255, 0.3);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 自然主题 */
.theme-nature {
    --primary-color: #4CAF50;
    --secondary-color: #FF5722;
    --accent-color: #2196F3;
    --background-dark: #1B2631;
    --background-light: #273746;
}

/* 太空主题 */
.theme-space {
    --primary-color: #9C27B0;
    --secondary-color: #FF9800;
    --accent-color: #00BCD4;
    --background-dark: #000051;
    --background-light: #1A237E;
}

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

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-light) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 背景粒子效果 */
#particles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: float 6s infinite linear;
}

@keyframes float {
    0% { transform: translateY(100vh) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100px) translateX(100px); opacity: 0; }
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 游戏头部 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-neon);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2rem;
    color: var(--secondary-color);
    animation: pulse 2s infinite;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo .version {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--accent-color);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

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

/* 统计面板 */
.stats-panel {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item i {
    color: var(--accent-color);
    font-size: 1.2rem;
}

.stat-item span {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 40px;
    text-align: center;
}

/* 控制按钮 */
.control-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: var(--background-dark);
    box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(0, 255, 136, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* 难度选择面板 */
.difficulty-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.difficulty-btn i {
    font-size: 2rem;
    margin-bottom: 5px;
}

.difficulty-btn span {
    font-weight: 700;
    font-size: 1rem;
}

.difficulty-btn small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.difficulty-btn.active {
    border-color: var(--primary-color);
    background: rgba(0, 255, 136, 0.1);
    box-shadow: var(--shadow-neon);
}

/* 游戏模式选择 */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.mode-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: var(--background-dark);
    border-color: transparent;
}

/* 游戏区域 */
.game-area {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.game-board {
    display: grid;
    gap: 2px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-neon);
    backdrop-filter: blur(10px);
}

/* 雷区格子 */
.cell {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    position: relative;
    transition: var(--transition);
    user-select: none;
}

.cell:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.cell.revealed {
    background: rgba(255, 255, 255, 0.8);
    color: var(--background-dark);
    cursor: default;
}

.cell.mine {
    background: linear-gradient(45deg, var(--secondary-color), #ff4444);
    color: white;
    animation: explode 0.5s ease-out;
}

.cell.flagged {
    background: rgba(255, 0, 136, 0.3);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.cell.flagged::before {
    content: '🚩';
    animation: flag-wave 0.3s ease-out;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes flag-wave {
    0% { transform: scale(0) rotate(-180deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* 数字颜色 */
.cell[data-number="1"] { color: #0088ff; }
.cell[data-number="2"] { color: #00ff00; }
.cell[data-number="3"] { color: #ff0000; }
.cell[data-number="4"] { color: #000080; }
.cell[data-number="5"] { color: #800000; }
.cell[data-number="6"] { color: #008080; }
.cell[data-number="7"] { color: #000000; }
.cell[data-number="8"] { color: #808080; }

/* 游戏覆盖层 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.overlay-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.overlay-content h2 {
    font-size: 2rem;
    margin: 20px 0;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#game-result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.overlay-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* 成就系统 */
.achievements-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.achievements-panel h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.achievement-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.achievement-card.unlocked {
    border-color: var(--primary-color);
    background: rgba(0, 255, 136, 0.1);
    box-shadow: var(--shadow-neon);
}

.achievement-card:not(.unlocked) {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.achievement-info h4 {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.achievement-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 统计面板 */
.statistics-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.statistics-panel h3 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-icon {
    font-size: 2rem;
    color: var(--accent-color);
    width: 50px;
    text-align: center;
}

.stat-info {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: var(--background-light);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-neon);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--secondary-color);
}

.modal-body {
    padding: 20px;
}

/* 设置选项 */
.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--primary-color);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

/* 主题选择器 */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-btn.active {
    border-color: var(--primary-color);
    background: rgba(0, 255, 136, 0.1);
}

.theme-preview {
    width: 40px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.neon-theme {
    background: linear-gradient(45deg, #00ff88, #0088ff);
}

.nature-theme {
    background: linear-gradient(45deg, #4CAF50, #2196F3);
}

.space-theme {
    background: linear-gradient(45deg, #9C27B0, #00BCD4);
}

/* 开关按钮 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: var(--transition);
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 范围滑块 */
input[type="range"] {
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-neon);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-neon);
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .stats-panel {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .control-buttons {
        justify-content: center;
    }
    
    .cell {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
    
    .difficulty-panel {
        grid-template-columns: 1fr 1fr;
    }
    
    .mode-selector {
        flex-wrap: wrap;
    }
    
    .achievements-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .cell {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }
    
    .difficulty-panel {
        grid-template-columns: 1fr;
    }
    
    .overlay-content {
        padding: 20px;
    }
    
    .overlay-buttons {
        flex-direction: column;
    }
}

/* 动画增强 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.game-header,
.difficulty-panel,
.mode-selector,
.game-area,
.achievements-panel,
.statistics-panel {
    animation: slideInUp 0.6s ease-out;
}

.cell {
    animation: fadeInScale 0.3s ease-out;
}

/* 性能优化 */
.game-board {
    will-change: transform;
}

.cell {
    will-change: transform, background-color;
}

.btn {
    will-change: transform, box-shadow;
}