/* =====================================================
   游戏合集统一样式 - V2 迭代
   ===================================================== */

/* CSS 变量 - 统一配色方案 */
:root {
    /* 主色调 */
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --primary-dark: #5849c2;
    
    /* 背景色 */
    --bg-dark: #0f0c29;
    --bg-medium: #302b63;
    --bg-light: #24243e;
    
    /* 文字色 */
    --text-primary: #ffffff;
    --text-secondary: #b8c0ff;
    --text-muted: #8b92d4;
    
    /* 功能色 */
    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --info: #3498db;
    
    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 50%, var(--bg-light) 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    color: var(--text-primary);
}

/* 游戏容器 - 统一外观 */
.game-container {
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary);
    max-width: 100%;
    width: 100%;
    max-width: 600px;
}

/* 游戏标题 */
.game-header {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.game-header h1 {
    font-size: clamp(20px, 5vw, 28px);
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 游戏统计 */
.game-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(108, 92, 231, 0.2);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
    min-width: 70px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: clamp(18px, 5vw, 24px);
    font-weight: bold;
    color: var(--primary);
}

/* 游戏区域 */
.game-area {
    border: 3px solid var(--primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-md);
    line-height: 0;
}

.game-board {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

/* Canvas 统一样式 */
canvas {
    display: block;
    touch-action: none;
}

/* 游戏控制区 */
.game-controls {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md);
}

/* 按钮样式 */
.btn, .control-btn, button {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    min-width: 44px;
}

.btn:hover, .control-btn:hover, button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn:active, .control-btn:active, button:active {
    transform: translateY(0);
}

/* 次要按钮 */
.btn-secondary {
    background: rgba(108, 92, 231, 0.3);
    border: 1px solid var(--primary);
}

/* 危险按钮 */
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%);
}

/* 成功按钮 */
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #27ae60 100%);
}

/* 游戏底部提示 */
.game-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: clamp(11px, 3vw, 13px);
}

/* 难度选择器 */
.difficulty-selector, .size-selector {
    display: flex;
    gap: var(--spacing-xs);
    justify-content: center;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.difficulty-btn, .size-btn {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 44px;
}

.difficulty-btn.active, .size-btn.active {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: var(--spacing-md);
}

.modal-box {
    background: linear-gradient(160deg, #1e1e3f 0%, #2a1040 100%);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl) var(--spacing-lg);
    max-width: 360px;
    width: 100%;
    text-align: center;
}

.modal-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-md);
}

.modal-title {
    font-size: clamp(22px, 6vw, 28px);
    color: var(--primary);
    margin-bottom: var(--spacing-md);
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: var(--spacing-lg);
}

.modal-tips {
    background: rgba(108, 92, 231, 0.15);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.tip-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: var(--spacing-sm);
}

.tip-item:last-child {
    margin-bottom: 0;
}

.tip-key {
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-weight: bold;
    font-size: 12px;
    min-width: 50px;
    text-align: center;
}

.modal-stats {
    background: rgba(108, 92, 231, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: var(--spacing-sm);
}

.stat-row:last-child {
    margin-bottom: 0;
}

.modal-btn, .modal-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
    min-height: 48px;
}

.modal-btn:hover, .modal-btn.primary:hover {
    transform: translateY(-2px);
}

/* 虚拟按键（用于游戏控制） */
.virtual-controls {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-md);
    flex-wrap: wrap;
}

.virtual-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 92, 231, 0.4);
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.virtual-btn:active {
    background: var(--primary);
    transform: scale(0.95);
}

/* 方向键布局 */
.d-pad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    gap: var(--spacing-xs);
}

.d-pad .up { grid-area: up; }
.d-pad .down { grid-area: down; }
.d-pad .left { grid-area: left; }
.d-pad .right { grid-area: right; }

/* 响应式断点 */
@media (max-width: 600px) {
    body {
        padding: var(--spacing-sm);
    }
    
    .game-container {
        border-radius: var(--radius-md);
        border: none;
        padding: var(--spacing-sm);
    }
    
    .game-area {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .modal-box {
        margin: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .game-stats {
        gap: var(--spacing-sm);
    }
    
    .stat-item {
        padding: 6px 12px;
        min-width: 60px;
    }
    
    .btn, .control-btn, button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .virtual-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}
