/* ========== 全局样式 (已限定在 #tool 作用域，避免污染 v2 yst-shell) ========== */
#tool * { box-sizing: border-box;
} :root { --primary-color: #3498db; --secondary-color: #e74c3c; --success-color: #2ecc71; --warning-color: #f39c12; --danger-color: #e74c3c; --bg-light: #f8f9fa; --bg-white: #ffffff; --text-dark: #2c3e50; --text-light: #7f8c8d; --border-color: #dee2e6; --shadow-sm: 0 2px 4px rgba(0,0,0,0.08); --shadow-md: 0 4px 12px rgba(0,0,0,0.1); --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
} #tool { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; line-height: 1.6;
} #tool .container { max-width: 1200px; width: 100%; background: var(--bg-white); padding: 28px; animation: fadeIn 0.5s ease;
} @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); }
} /* ========== 头部 ========== */
.header { text-align: center; margin-bottom: 40px; padding-bottom: 20px; border-bottom: 2px solid var(--border-color);
} .header h1 { font-size: 2.5rem; color: var(--text-dark); margin-bottom: 8px; font-weight: 700;
} .subtitle { color: var(--text-light); font-size: 1rem;
} /* ========== 主内容区 ========== */
.main-content { display: grid; grid-template-columns: 180px 1fr 180px; gap: 20px; margin-bottom: 30px;
} /* ========== 玩家信息卡片 ========== */
.player-section { display: flex; flex-direction: column; gap: 20px;
} .player-card { background: white; border-radius: 12px; padding: 16px; text-align: center; transition: all 0.3s ease; border: 2px solid #e9ecef; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); position: relative; overflow: hidden;
} .player-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--primary-color), #64b5f6); opacity: 0; transition: opacity 0.3s ease;
} .player-card.player-ai::before { background: linear-gradient(90deg, #ff9800, #ffb74d);
} .player-card.active { border-color: var(--primary-color); background: linear-gradient(to bottom, #e3f2fd 0%, white 100%); box-shadow: 0 4px 16px rgba(52, 152, 219, 0.2);
} .player-card.active::before { opacity: 1;
} .player-card.player-ai.active { border-color: #ff9800; background: linear-gradient(to bottom, #fff8e1 0%, white 100%); box-shadow: 0 4px 16px rgba(255, 152, 0, 0.2);
} .player-header { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px;
} .player-header::before { content: ''; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
} .player-card.player-human .player-header::before { content: '👨'; background: linear-gradient(135deg, #e3f2fd, #90caf9); box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
} .player-card.player-ai .player-header::before { content: '🎯'; background: linear-gradient(135deg, #fff3e0, #ffb74d); box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
} .player-header h3 { font-size: 1rem; color: var(--text-dark); margin: 0;
} .player-score { font-size: 2.5rem; font-weight: 700; color: var(--primary-color); margin-bottom: 10px; text-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
} .player-ai .player-score { color: #ff9800; text-shadow: 0 2px 4px rgba(255, 152, 0, 0.2);
} .player-status { font-size: 0.85rem; color: var(--text-light); padding: 4px 12px; background: var(--bg-light); border-radius: 20px; display: inline-block; font-weight: 500;
} /* ========== 难度选择 ========== */
.difficulty-selector,
.first-move-selector { background: white; border-radius: 12px; padding: 12px; border: 2px solid #e9ecef; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
} .difficulty-selector label,
.first-move-selector label { display: block; font-size: 0.85rem; color: var(--text-light); margin-bottom: 10px; font-weight: 600;
} .difficulty-btns { display: flex; flex-direction: column; gap: 8px;
} .diff-btn { padding: 8px 12px; border: 2px solid var(--border-color); background: white; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.2s ease; color: var(--text-dark);
} .diff-btn:hover { border-color: var(--primary-color); background: #e3f2fd; transform: translateX(4px);
} .diff-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color);
} /* ========== 先手选择 ========== */
.first-move-btns { display: flex; flex-direction: column; gap: 8px;
} .move-btn { padding: 10px 12px; border: 2px solid var(--border-color); background: white; border-radius: 10px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.3s ease; color: var(--text-dark); display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
} .move-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 1.1rem; transition: all 0.3s ease;
} .move-btn[data-first="player"] .move-icon { background: linear-gradient(135deg, #e3f2fd, #90caf9);
} .move-btn[data-first="ai"] .move-icon { background: linear-gradient(135deg, #fff8e1, #ffb74d);
} .move-btn:hover { border-color: var(--success-color); background: #f8f9fa; transform: translateX(4px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
} .move-btn:hover .move-icon { transform: scale(1.1);
} .move-btn.active { background: var(--success-color); color: white; border-color: var(--success-color); box-shadow: 0 4px 16px rgba(46, 204, 113, 0.3);
} .move-btn.active .move-icon { background: rgba(255, 255, 255, 0.3); transform: scale(1.05);
} /* ========== 游戏区域 ========== */
.game-area { display: flex; flex-direction: column; align-items: center;
} .game-status { font-size: 1.3rem; color: var(--text-dark); margin-bottom: 24px; padding: 14px 28px; background: linear-gradient(135deg, #f8f9fa, #e9ecef); border-radius: 12px; font-weight: 600; min-width: 250px; text-align: center; border: 2px solid #e9ecef; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
} /* ========== 棋盘 ========== */
.board { display: grid; grid-template-columns: repeat(3, 150px); grid-template-rows: repeat(3, 150px); gap: 0; margin-bottom: 30px; position: relative; background: white; padding: 24px; border-radius: 16px; box-shadow: var(--shadow-md); border: 2px solid var(--border-color);
} .cell { background: transparent; border: none; border-right: 4px solid #95a5a6; border-bottom: 4px solid #95a5a6; display: flex; align-items: center; justify-content: center; font-size: 4rem; font-weight: 700; cursor: pointer; transition: all 0.15s ease; position: relative; user-select: none;
} /* 移除右侧列的右边框 */
.cell:nth-child(3),
.cell:nth-child(6),
.cell:nth-child(9) { border-right: none;
} /* 移除底部行的底边框 */
.cell:nth-child(7),
.cell:nth-child(8),
.cell:nth-child(9) { border-bottom: none;
} .cell:hover:not(.filled) { background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(52, 152, 219, 0.15)); border-radius: 8px;
} .cell:active:not(.filled) { transform: scale(0.95); background: linear-gradient(135deg, rgba(52, 152, 219, 0.2), rgba(52, 152, 219, 0.25));
} .cell.filled { cursor: not-allowed; pointer-events: none;
} .cell.player-x { color: var(--primary-color); text-shadow: 0 2px 8px rgba(52, 152, 219, 0.4); animation: cellPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
} .cell.player-o { color: var(--secondary-color); text-shadow: 0 2px 8px rgba(231, 76, 60, 0.4); animation: cellPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
} @keyframes cellPop { 0% { transform: scale(0) rotate(-90deg); opacity: 0; } 70% { transform: scale(1.05) rotate(5deg); } 100% { transform: scale(1) rotate(0deg); opacity: 1; }
} .cell.winner { background: linear-gradient(135deg, rgba(255, 193, 7, 0.3), rgba(255, 152, 0, 0.3)); border-radius: 8px; animation: winPulse 0.8s ease-in-out infinite;
} @keyframes winPulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); } 50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
} /* ========== 控制按钮 ========== */
.game-controls { display: flex; gap: 12px;
} .btn-primary,
.btn-secondary { padding: 12px 32px; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
} .btn-primary { background: var(--primary-color); color: white; box-shadow: var(--shadow-sm);
} .btn-primary:hover { background: #2980b9; transform: translateY(-2px); box-shadow: var(--shadow-md);
} .btn-secondary { background: var(--bg-light); color: var(--text-dark); border: 2px solid var(--border-color);
} .btn-secondary:hover { border-color: var(--text-dark); transform: translateY(-2px);
} /* ========== 游戏统计 ========== */
.game-stats { background: white; border-radius: 12px; padding: 16px; border: 2px solid #e9ecef; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
} .game-stats h4 { font-size: 0.95rem; color: var(--text-dark); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--border-color); font-weight: 700;
} .stats-grid { display: flex; flex-direction: column; gap: 12px;
} .stat-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: linear-gradient(135deg, #f8f9fa, #e9ecef); border-radius: 10px; transition: all 0.3s ease; border: 2px solid transparent;
} .stat-item:hover { transform: translateX(4px); border-color: var(--primary-color); box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
} .stat-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; background: white; border-radius: 50%; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
} .stat-info { flex: 1;
} .stat-label { font-size: 0.85rem; color: var(--text-light); margin-bottom: 4px; font-weight: 500;
} .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text-dark); line-height: 1;
} /* ========== 底部说明 ========== */
.footer { text-align: center; padding-top: 24px; border-top: 2px solid var(--border-color);
} .footer p { color: var(--text-light); font-size: 0.95rem; line-height: 1.6;
} /* ========== 弹窗 ========== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; align-items: center; justify-content: center;
} .modal.show { display: flex;
} .modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); animation: fadeIn 0.3s ease;
} .modal-box { position: relative; background: white; border-radius: 16px; padding: 40px; max-width: 400px; width: 90%; text-align: center; box-shadow: var(--shadow-lg); animation: modalSlide 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
} @keyframes modalSlide { from { transform: translateY(-50px) scale(0.8); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; }
} .modal-icon { font-size: 5rem; margin-bottom: 20px; animation: bounce 1s ease infinite;
} @keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); }
} .modal-box h2 { font-size: 1.8rem; color: var(--text-dark); margin-bottom: 12px;
} .modal-box p { color: var(--text-light); font-size: 1.1rem; margin-bottom: 30px;
} .modal-btns { display: flex; gap: 12px; justify-content: center;
} /* ========== 响应式设计 ========== */
@media (max-width: 1024px) { .main-content { grid-template-columns: 1fr; gap: 24px; } .player-section { flex-direction: row; gap: 16px; } .player-card, .difficulty-selector, .scoreboard { flex: 1; }
} @media (max-width: 768px) { .container { padding: 24px; } .header h1 { font-size: 2rem; } .board { grid-template-columns: repeat(3, 100px); grid-template-rows: repeat(3, 100px); gap: 8px; } .cell { font-size: 3rem; } .player-section { flex-direction: column; }
} @media (max-width: 480px) { .container { padding: 20px; } .header h1 { font-size: 1.6rem; } .board { grid-template-columns: repeat(3, 85px); grid-template-rows: repeat(3, 85px); gap: 6px; } .cell { font-size: 2.5rem; border-width: 2px; } .game-status { font-size: 1.1rem; padding: 10px 20px; } .modal-box { padding: 30px 24px; } .modal-icon { font-size: 4rem; } .modal-btns { flex-direction: column; } .btn-primary, .btn-secondary { width: 100%; }
}
