/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 10px;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    min-height: 95vh;
}

/* 屏幕切换 */
.screen {
    display: none;
    height: 100%;
    padding: 20px;
}

.screen.active {
    display: block;
}

/* 登录界面 */
.login-card {
    padding: 30px 20px;
    text-align: center;
}

.logo {
    margin-bottom: 30px;
}

.logo i {
    font-size: 4rem;
    color: #f39c12;
    margin-bottom: 15px;
}

.logo h1 {
    font-size: 2rem;
    color: #2c3e50;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #34495e;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-small, .btn-game-control {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(to right, #667eea, #764ba2);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
}

.btn-secondary:hover {
    background-color: #e9ecef;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9rem;
}

.btn-game-control {
    padding: 12px 20px;
    background-color: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
    flex: 1;
}

.btn-game-control.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 游戏大厅 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.header h2 {
    color: #2c3e50;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.difficulty-selector {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.difficulty-selector h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.difficulty-btn {
    padding: 15px;
    background-color: white;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.difficulty-btn.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.players-section {
    background-color: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #eee;
}

.players-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.players-list {
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background-color: white;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.player-item:hover {
    transform: translateX(5px);
    cursor: pointer;
}

.player-item .player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-item i {
    color: #667eea;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #adb5bd;
}

.lobby-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* 游戏界面 */
.game-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.game-info-display {
    text-align: center;
}

.game-meta {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #6c757d;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.turn-indicator {
    background: linear-gradient(to right, #4CAF50, #45a049);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.players-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 15px;
}

.player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background-color: white;
    border-radius: 10px;
    min-width: 120px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: 600;
}

.player-status {
    font-size: 0.8rem;
    color: #6c757d;
}

.player-status.active {
    color: #4CAF50;
    font-weight: 500;
}

.vs {
    font-weight: 700;
    color: #667eea;
    font-size: 1.2rem;
}

/* 扫雷游戏区域 */
.game-container {
    margin-bottom: 20px;
    overflow: auto;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 15px;
}

.minefield {
    display: grid;
    gap: 2px;
    margin: 0 auto;
    background-color: #b0b0b0;
    padding: 5px;
    border-radius: 5px;
    touch-action: manipulation;
}

.cell {
    width: 32px;
    height: 32px;
    background-color: #d4d4d4;
    border: 2px outset #ececec;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

.cell:hover {
    background-color: #e0e0e0;
}

.cell.revealed {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
}

.cell.mine {
    background-color: #ff4444;
    color: white;
}

.cell.flagged::before {
    content: "🚩";
    font-size: 14px;
}

/* 数字颜色 */
.cell.number-1 { color: #1976D2; }
.cell.number-2 { color: #388E3C; }
.cell.number-3 { color: #D32F2F; }
.cell.number-4 { color: #7B1FA2; }
.cell.number-5 { color: #FF8F00; }
.cell.number-6 { color: #0097A7; }
.cell.number-7 { color: #5D4037; }
.cell.number-8 { color: #455A64; }

/* 游戏控制 */
.game-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* 聊天区域 */
.game-chat {
    background-color: white;
    border-radius: 15px;
    padding: 15px;
    border: 2px solid #eee;
}

.game-chat h4 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.chat-messages {
    height: 150px;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    background-color: white;
    border-radius: 10px;
    border-left: 3px solid #667eea;
}

.system-message {
    background-color: #e3f2fd;
    color: #1565C0;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}

.chat-input button {
    padding: 12px 20px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        min-height: 100vh;
        border-radius: 0;
        padding: 0;
    }
    
    .screen {
        padding: 15px;
    }
    
    .difficulty-buttons {
        grid-template-columns: 1fr;
    }
    
    .lobby-controls {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .players-display {
        flex-direction: column;
        gap: 10px;
    }
    
    .cell {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .game-controls {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .cell {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
}