/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* 返回主页按钮样式 */
.back-home-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.back-home-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(#764ba2);
    color: white;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.back-home-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.back-home-icon {
    font-size: 16px;
}

.back-home-text {
    white-space: nowrap;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: white;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

/* 主游戏容器 */
.game-container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 30px;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* 控制面板样式 */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 280px;
    backdrop-filter: blur(10px);
}

.control-panel h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

/* 模块选择器样式 */
.module-selector {
    margin-bottom: 30px;
}

.module-buttons {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 10px 1fr 10px 1fr;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.module-btn {
    background: #ffffff;
    background: linear-gradient(to bottom, #ffffff, #f5f5f5);
    color: #333;
    border: 1px solid #ddd;
    padding: 12px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(201, 201, 201, 0.3);
    -webkit-box-shadow: 0 4px 15px rgba(201, 201, 201, 0.3);
    -moz-box-shadow: 0 4px 15px rgba(201, 201, 201, 0.3);
}

.module-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(228, 228, 228, 0.4);
}

.module-btn.active {
    background: #e0e0e0;
    border-color: #bbb;
}

.selected-module {
    background: #f7fafc;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-size: 0.9rem;
}

/* 模块预览样式 */
.module-preview {
    width: 100%;
    height: 20px;
    border-radius: 2px;
    margin: 0 auto;
}

.size-1-preview {
    width: 20%;
    background: #667eea;
}

.size-2-preview {
    width: 40%;
    background: #f5576c;
}

.size-3-preview {
    width: 60%;
    background: #44a08d;
}

.size-4-preview {
    width: 80%;
    background: #ffaf37;
}

.size-5-preview {
    width: 100%;
    background: #9b59b6;
}

.bison-preview {
    width: 100%;
    height: 20px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    background: #8B4513;
    background: linear-gradient(135deg, #8B4513, #D2691E);
    color: white;
    text-align: center;
    line-height: 1;
}

/* 操作按钮区域两列分行布局 */
.action-buttons h3 {
    margin-bottom: 8px;
    text-align: left;
}
.action-btn-group {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 12px 1fr;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}
.action-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    outline: none;
}
.action-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px #ffb199;
}

#delete-btn {
    min-width: 120px;
    white-space: nowrap;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

#reset-btn {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

#reset-btn:hover {
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

#restart-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(168, 237, 234, 0.3);
}

#restart-btn:hover {
    box-shadow: 0 6px 20px rgba(168, 237, 234, 0.4);
}

#ai-btn {
    background: linear-gradient(135deg, #ff8c42, #ff6b35);
    box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
}

#ai-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 140, 66, 0.4);
}

/* 提示面板样式 */
.hint-panel {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #48bb78;
}

#hint-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #4a5568;
    white-space: pre-line;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }
    
    .control-panel {
        min-width: 100%;
        max-width: 400px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}
