* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #4A7CFF;
    --primary-light: #E8EEFF;
    --primary-dark: #2D5BD6;
    --bg: #F8FAFF;
    --card: #FFFFFF;
    --text: #1A1A2E;
    --text-light: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --kanban-todo: #FEF3C7;
    --kanban-doing: #DBEAFE;
    --kanban-done: #D1FAE5;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
.hidden { display: none !important; }

.hero { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; padding: 60px 20px 50px; text-align: center; box-shadow: 0 4px 20px rgba(74, 124, 255, 0.2); }
.hero-content h1 { font-size: 2.2em; font-weight: 700; margin-bottom: 12px; }
.brand { background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 8px; backdrop-filter: blur(10px); }
.subtitle { font-size: 1.1em; opacity: 0.95; margin-bottom: 16px; }
.hero-tags { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.tag { background: rgba(255,255,255,0.2); padding: 6px 16px; border-radius: 20px; font-size: 0.9em; backdrop-filter: blur(10px); }

.container { max-width: 960px; margin: -30px auto 0; padding: 0 20px 40px; position: relative; z-index: 10; }

.form-section, .result-section, .trae-guide { background: var(--card); border-radius: 16px; padding: 32px; margin-bottom: 24px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
.form-section h2, .result-section h2, .trae-guide h2 { font-size: 1.3em; margin-bottom: 20px; color: var(--text); }

.templates-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; padding: 12px 16px; background: var(--primary-light); border-radius: 10px; }
.templates-label { font-weight: 600; font-size: 0.9em; color: var(--primary-dark); }
.template-btn { padding: 8px 14px; border: 2px solid var(--primary); background: white; color: var(--primary); border-radius: 20px; font-size: 0.85em; font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.template-btn:hover { background: var(--primary); color: white; transform: translateY(-1px); }
.template-btn.history { border-color: var(--text-light); color: var(--text-light); margin-left: auto; }
.template-btn.history:hover { background: var(--text-light); color: white; }
.template-btn.demo { background: linear-gradient(135deg, #EF4444 0%, #F59E0B 100%); border-color: transparent; color: white; animation: demoPulse 2s infinite; }
.template-btn.demo:hover { transform: translateY(-1px) scale(1.03); }
@keyframes demoPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.95em; color: var(--text); }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

input[type="text"], input[type="date"] { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; font-size: 1em; transition: border-color 0.2s; font-family: inherit; }
input[type="text"]:focus, input[type="date"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.member-controls { display: flex; align-items: center; gap: 16px; }
.ctrl-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--primary); background: white; color: var(--primary); font-size: 1.3em; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.ctrl-btn:hover:not(:disabled) { background: var(--primary); color: white; }
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.count { font-size: 1.3em; font-weight: 700; color: var(--primary); min-width: 30px; text-align: center; }

.member-input { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; animation: slideIn 0.3s ease; }
.member-input input { flex: 1; min-width: 0; }
.member-input .member-name { flex: 0 0 88px; font-weight: 700; text-align: center; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

.mode-switch { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.mode-option { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.2s; }
.mode-option.active { border-color: var(--primary); background: var(--primary-light); }
.mode-option input[type="radio"] { accent-color: var(--primary); }
.tip { font-size: 0.85em; color: var(--text-light); margin-top: 8px; }
.tip a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.tip a:hover { color: var(--primary-dark, #2563EB); }
.tip.subtle { opacity: 0.8; margin-top: 4px; }

.primary-btn { width: 100%; padding: 16px; background: var(--primary); color: white; border: none; border-radius: 12px; font-size: 1.1em; font-weight: 700; cursor: pointer; transition: all 0.2s; margin-top: 8px; }
.primary-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(74,124,255,0.3); }

.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; flex-wrap: wrap; gap: 10px; }
.view-toggle { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; border: 1px solid var(--border); }
.view-btn { padding: 8px 14px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-size: 0.88em; font-weight: 600; color: var(--text-light); transition: all 0.2s; }
.view-btn.active { background: var(--primary); color: white; }

.timeline { background: var(--primary-light); border-radius: 10px; padding: 12px 20px; margin-bottom: 16px; }
.timeline-deadline { font-weight: 600; color: var(--primary-dark); }

.stats-bar { display: flex; gap: 12px; padding: 16px; background: var(--bg); border-radius: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-item { flex: 1; min-width: 80px; text-align: center; }
.stat-num { display: block; font-size: 1.4em; font-weight: 800; color: var(--primary-dark); line-height: 1.2; }
.stat-num.danger { color: var(--danger); }
.stat-label { font-size: 0.78em; color: var(--text-light); margin-top: 2px; }

.progress-track { height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 20px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%); border-radius: 3px; width: 0%; transition: width 0.6s ease; }

.risk-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; border-left: 4px solid; animation: slideIn 0.3s ease; }
.risk-banner.ok { background: #F0FDF4; border-color: #10B981; color: #047857; }
.risk-banner.done { background: #ECFDF5; border-color: #10B981; color: #047857; }
.risk-banner.warn { background: #FFFBEB; border-color: #F59E0B; color: #B45309; }
.risk-banner.danger { background: #FEF2F2; border-color: #EF4444; color: #B91C1C; }
.risk-icon { font-size: 1.5em; line-height: 1; }
.risk-text { display: flex; flex-direction: column; gap: 2px; }
.risk-text strong { font-size: 0.95em; }
.risk-text small { font-size: 0.82em; opacity: 0.85; }

.workload-section { background: var(--bg); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.wl-title { font-weight: 700; font-size: 0.95em; color: var(--primary-dark); margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.finish-all { background: linear-gradient(135deg, #F59E0B, #EF4444); color: white; border: none; padding: 6px 14px; border-radius: 20px; font-size: 0.82em; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.finish-all:hover { transform: translateY(-1px) scale(1.05); }
.wl-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 0.88em; }
.wl-row.overload { background: #FEF2F2; border-radius: 6px; padding: 4px 8px; }
.wl-name { min-width: 70px; font-weight: 600; color: var(--text); }
.wl-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.wl-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 4px; transition: width 0.5s ease; }
.wl-row.overload .wl-fill { background: linear-gradient(90deg, #F59E0B, #EF4444); }
.wl-val { min-width: 100px; text-align: right; color: var(--text-light); font-size: 0.85em; }

.task-cards { display: flex; flex-direction: column; gap: 16px; }

.task-card { background: var(--card); border: 2px solid var(--border); border-radius: 12px; padding: 20px; position: relative; transition: all 0.2s; }
.task-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(74,124,255,0.15); }
.task-card.priority-high { border-left: 4px solid var(--danger); }
.task-card.priority-medium { border-left: 4px solid var(--warning); }
.task-card.priority-low { border-left: 4px solid var(--success); }
.task-card.status-done { opacity: 0.65; background: #F0FDF4; }
.task-card.status-done .task-content { text-decoration: line-through; color: var(--text-light); }

@keyframes cardFadeIn { 0% { opacity: 0; transform: translateY(16px) scale(0.96); } 100% { opacity: 1; transform: translateY(0) scale(1); } }

.task-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.task-owner { font-weight: 700; font-size: 1.05em; color: var(--primary-dark); }
.skill-tag { display: inline-block; background: var(--primary-light); color: var(--primary-dark); padding: 2px 8px; border-radius: 10px; font-size: 0.72em; font-weight: 600; margin-left: 6px; }
.priority-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.8em; font-weight: 600; }
.priority-badge.high { background: #FEE2E2; color: var(--danger); }
.priority-badge.medium { background: #FEF3C7; color: var(--warning); }
.priority-badge.low { background: #D1FAE5; color: var(--success); }
.task-content { font-size: 0.95em; color: var(--text); margin-bottom: 12px; line-height: 1.7; min-height: 40px; }
.task-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.82em; color: var(--text-light); }
.task-meta span { display: flex; align-items: center; gap: 3px; }
.status-inline { margin-left: auto; padding: 2px 8px; background: var(--bg); border-radius: 6px; color: var(--text-light); }
.phase-badge { padding: 2px 8px; background: #EEF2FF; color: #4338CA; border-radius: 6px; font-weight: 600; }
.shared-badge { margin-left: 6px; padding: 4px 10px; border-radius: 20px; font-size: .78em; font-weight: 700; background: #EDE9FE; color: #6D28D9; }
.transfer-row { display: flex; align-items: center; gap: 10px; }
.transfer-select { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .88em; font-family: inherit; background: #fff; color: var(--text); cursor: pointer; }
.transfer-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,124,255,.12); }
.transfer-hint { font-size: .78em; color: var(--text-light); }

.toggle-detail {
    width: 100%; margin: 12px 0 8px; padding: 8px;
    background: var(--bg); border: 1px dashed var(--border); border-radius: 8px;
    cursor: pointer; font-size: 0.85em; font-weight: 600; color: var(--primary);
    transition: all 0.15s;
}
.toggle-detail:hover { background: var(--primary-light); border-color: var(--primary); }

.detail-body {
    border-top: 1px dashed var(--border); padding-top: 12px; margin: 8px 0 12px;
    display: flex; flex-direction: column; gap: 12px;
    animation: slideInDetail 0.25s ease;
}
@keyframes slideInDetail { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 1000px; } }

.detail-block { background: var(--bg); border-radius: 10px; padding: 14px; }
.detail-title { font-size: 0.88em; font-weight: 700; color: var(--primary-dark); margin-bottom: 10px; }
.rationale-list { list-style: none; font-size: 0.87em; color: var(--text); line-height: 1.8; }
.rationale-list li { padding: 4px 0 4px 18px; position: relative; }
.rationale-list li::before { content: '•'; position: absolute; left: 4px; color: var(--primary); font-weight: 700; }
.subtasks { display: flex; flex-direction: column; gap: 6px; }
.subtask { background: white; border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; font-size: 0.85em; color: var(--text-light); font-family: "SF Mono", "Consolas", monospace; }
.resource-list { display: flex; flex-direction: column; gap: 6px; }
.resource-link {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 14px; background: white; border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.85em; color: var(--primary-dark); text-decoration: none; font-weight: 500;
    transition: all 0.15s;
}
.resource-link:hover { border-color: var(--primary); background: var(--primary-light); transform: translateX(2px); }

.comment-box { background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.comment-list { padding: 10px; min-height: 40px; max-height: 180px; overflow-y: auto; }
.comment-empty { text-align: center; color: var(--text-light); font-size: 0.82em; padding: 8px; }
.comment-item { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; font-size: 0.85em; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.c-author { background: var(--primary); color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.75em; font-weight: 600; align-self: flex-start; }
.c-text { flex: 1; color: var(--text); }
.c-time { width: 100%; font-size: 0.72em; color: var(--text-light); padding-left: 30px; }
.comment-input-row { display: flex; border-top: 1px solid var(--border); }
.comment-input { flex: 1; border: none; padding: 10px; font-size: 0.85em; outline: none; font-family: inherit; }
.comment-send { padding: 0 16px; background: var(--primary); color: white; border: none; font-size: 0.85em; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.comment-send:hover { background: var(--primary-dark); }

.task-status-bar { display: flex; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.status-btn { flex: 1; padding: 6px 8px; border: 2px solid var(--border); background: white; border-radius: 8px; font-size: 0.82em; cursor: pointer; transition: all 0.2s; color: var(--text-light); font-weight: 600; }
.status-btn:hover { border-color: var(--primary); color: var(--primary); }
.status-btn.active[data-status="todo"] { background: var(--kanban-todo); border-color: var(--warning); color: #B45309; }
.status-btn.active[data-status="doing"] { background: var(--kanban-doing); border-color: var(--primary); color: var(--primary-dark); }
.status-btn.active[data-status="done"] { background: var(--kanban-done); border-color: var(--success); color: #047857; }

/* ============ KANBAN ============ */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kanban-col { background: var(--bg); border-radius: 12px; padding: 14px; min-height: 120px; }
.kanban-col[data-status="todo"] { background: var(--kanban-todo); }
.kanban-col[data-status="doing"] { background: var(--kanban-doing); }
.kanban-col[data-status="done"] { background: var(--kanban-done); }
.kanban-col h4 { font-size: 0.9em; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.kanban-count { background: rgba(0,0,0,0.1); padding: 2px 10px; border-radius: 20px; font-size: 0.78em; }
.kanban-tasks { display: flex; flex-direction: column; gap: 10px; min-height: 10px; }
.kanban-task { background: white; border-radius: 10px; padding: 12px; border-left: 3px solid var(--primary); font-size: 0.88em; cursor: pointer; transition: all 0.15s; }
.kanban-task:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.kanban-task.dragging { opacity: 0.4; transform: scale(0.95); }
.kanban-tasks.drag-over { background: rgba(74,124,255,0.1); border-radius: 8px; outline: 2px dashed var(--primary); outline-offset: 4px; }
.kt-owner { font-weight: 700; color: var(--primary-dark); margin-bottom: 4px; font-size: 0.85em; }
.kt-desc { color: var(--text); line-height: 1.4; }
.kt-priority { font-size: 0.72em; margin-top: 6px; font-weight: 600; }
.kanban-col[data-status="todo"] .kanban-task { border-left-color: var(--warning); }
.kanban-col[data-status="doing"] .kanban-task { border-left-color: var(--primary); }
.kanban-col[data-status="done"] .kanban-task { border-left-color: var(--success); opacity: 0.7; }

/* ============ GANTT ============ */
.gantt { background: var(--bg); border-radius: 12px; padding: 14px; overflow-x: auto; }
.gantt-warning { background: #FEF2F2; color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: 0.85em; font-weight: 600; margin-bottom: 12px; border-left: 3px solid var(--danger); }
.gantt-row { display: grid; gap: 2px; margin-bottom: 6px; align-items: center; }
.gantt-header { font-weight: 700; font-size: 0.8em; color: var(--text-light); }
.gantt-label-col { min-width: 130px; max-width: 150px; font-size: 0.82em; font-weight: 600; color: var(--text); padding-right: 8px; white-space: nowrap; }
.gantt-skill { color: var(--primary-dark); font-weight: 500; }
.gantt-cell { height: 28px; background: var(--border); border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 0.65em; color: var(--text-light); min-width: 40px; text-align: center; }
.gantt-bar-cell { height: 28px; display: flex; align-items: center; padding: 0 2px; }
.gantt-bar { height: 100%; border-radius: 3px; width: 100%; box-shadow: 0 2px 6px rgba(0,0,0,0.1); transition: opacity 0.2s; }
.gantt-bar:hover { opacity: 0.8; }
.gantt-bar.urgent { animation: urgentPulse 1.2s infinite; }
@keyframes urgentPulse { 0%,100% { box-shadow: 0 2px 6px rgba(239,68,68,0.3); } 50% { box-shadow: 0 2px 12px rgba(239,68,68,0.6); } }
.gantt-deadline { height: 28px; background: var(--danger); color: white; font-size: 0.65em; font-weight: 700; border-radius: 3px; display: flex; align-items: center; justify-content: center; min-width: 40px; }

/* ============ AI LOG SECTION ============ */
.ai-log-section { background: linear-gradient(135deg, #F0FDF4 0%, #DBEAFE 100%); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; border: 1px solid rgba(74,124,255,0.2); }
.ailog-title { font-weight: 700; font-size: 0.95em; color: var(--primary-dark); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.ailog-badge { padding: 3px 12px; border-radius: 20px; font-size: 0.78em; font-weight: 600; background: #FEF3C7; color: #B45309; }
.ailog-badge.real { background: #D1FAE5; color: #047857; }
.ailog-badge.mock { background: #E0E7FF; color: #4338CA; }
.ailog-details { background: white; border-radius: 10px; padding: 12px; }
.ailog-details summary { cursor: pointer; font-size: 0.85em; font-weight: 600; color: var(--primary); padding: 4px 0; user-select: none; }
.ailog-details[open] summary { margin-bottom: 12px; }
.ailog-body { display: flex; flex-direction: column; gap: 12px; }
.ailog-block { background: var(--bg); border-radius: 8px; padding: 12px; }
.ailog-label { font-size: 0.78em; font-weight: 700; color: var(--text-light); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.ailog-pre { background: var(--text); color: #10B981; padding: 12px; border-radius: 6px; font-family: "SF Mono", "Consolas", monospace; font-size: 0.82em; line-height: 1.5; max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }
.ailog-list { list-style: none; font-size: 0.85em; color: var(--text); line-height: 1.8; }
.ailog-list li { padding: 3px 0 3px 16px; position: relative; }
.ailog-list li::before { content: '▸'; position: absolute; left: 0; color: var(--primary); }
.ailog-desc { font-size: 0.85em; color: var(--text); line-height: 1.7; }
.ailog-desc strong { color: var(--primary-dark); }

.result-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.secondary-btn { flex: 1; min-width: 100px; padding: 14px; background: white; color: var(--primary); border: 2px solid var(--primary); border-radius: 12px; font-size: 0.95em; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.secondary-btn:hover { background: var(--primary); color: white; }

.trae-guide { background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%); }
.trae-guide h2 { color: #B45309; }
.guide-desc { color: var(--text); margin-bottom: 20px; font-size: 0.95em; }
.guide-desc b { color: var(--primary-dark); }
.prompt-box { position: relative; margin-bottom: 20px; }
.prompt-box textarea { width: 100%; height: 220px; padding: 16px; border: 2px solid #F59E0B; border-radius: 12px; background: white; font-family: "SF Mono", "Consolas", monospace; font-size: 0.88em; resize: none; color: var(--text); line-height: 1.6; }
.copy-btn { position: absolute; top: 12px; right: 12px; padding: 8px 16px; background: #F59E0B; color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.copy-btn:hover { background: #D97706; }
.trae-steps { display: flex; gap: 16px; flex-wrap: wrap; }
.step { flex: 1; min-width: 180px; background: white; padding: 16px; border-radius: 10px; text-align: center; font-weight: 600; color: var(--text); }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--primary); color: white; border-radius: 50%; margin-bottom: 8px; font-weight: 700; }

.footer { text-align: center; padding: 20px; color: var(--text-light); font-size: 0.85em; }
.footer-tip { margin-top: 8px; font-size: 0.8em; color: var(--primary); }
.footer-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.footer-link:hover { text-decoration: underline; }

.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--text); color: white; padding: 14px 24px; border-radius: 30px; font-size: 0.9em; box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 1000; animation: toastIn 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.loading { text-align: center; padding: 40px; color: var(--text-light); }
.loading::after { content: ''; display: inline-block; width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 8px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-content { position: relative; background: white; border-radius: 16px; width: 90%; max-width: 500px; max-height: 75vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: modalIn 0.25s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.1em; }
.modal-close { width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 50%; font-size: 1.4em; cursor: pointer; color: var(--text-light); line-height: 1; transition: all 0.15s; }
.modal-close:hover { background: var(--border); color: var(--text); }
.history-list { overflow-y: auto; padding: 12px; flex: 1; }
.history-item { padding: 14px; border-radius: 10px; cursor: pointer; transition: all 0.15s; margin-bottom: 6px; background: var(--bg); }
.history-item:hover { background: var(--primary-light); transform: translateX(4px); }
.history-item h4 { font-size: 0.95em; margin-bottom: 4px; color: var(--text); }
.hi-meta { font-size: 0.8em; color: var(--text-light); }
.history-empty { text-align: center; padding: 40px 20px; color: var(--text-light); }
.history-empty .icon { font-size: 2.5em; margin-bottom: 10px; }

.share-body { padding: 20px 24px 24px; }
.share-desc { color: var(--text); margin-bottom: 14px; font-size: 0.92em; }
.share-link-row { display: flex; gap: 8px; margin-bottom: 16px; }
.share-link-row input { flex: 1; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px; font-size: 0.85em; font-family: "SF Mono", "Consolas", monospace; background: var(--bg); color: var(--text); }
.share-link-row .copy-btn { position: static; padding: 10px 18px; font-size: 0.88em; }
.share-qr { background: var(--bg); border-radius: 10px; padding: 20px; text-align: center; margin-bottom: 14px; }
.qr-placeholder { color: var(--text-light); font-size: 0.85em; line-height: 1.6; }
.share-tip { font-size: 0.82em; color: var(--text-light); text-align: center; }

.demo-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 2000; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.demo-overlay.hidden { display: none; }
.demo-hint { pointer-events: auto; background: white; border-radius: 14px; padding: 18px 22px; margin: 20px; max-width: 500px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.4); animation: demoHintIn 0.35s ease; }
@keyframes demoHintIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.demo-step { font-weight: 700; color: var(--text); margin-bottom: 12px; font-size: 1em; min-height: 24px; }
.demo-progress { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.demo-progress-fill { height: 100%; background: linear-gradient(90deg, #EF4444, #F59E0B, #10B981); width: 0; transition: width 0.4s ease; }
.demo-skip { width: 100%; padding: 8px; border: none; background: var(--bg); color: var(--text-light); border-radius: 8px; cursor: pointer; font-size: 0.85em; transition: all 0.15s; }
.demo-skip:hover { background: var(--border); color: var(--text); }

/* ============ 🎮 解压小游戏：有矛盾了？来局游戏吧！ ============ */
.game-entry { margin: 0 0 24px; padding: 0; }
.game-entry-btn {
    position: relative; isolation: isolate; overflow: hidden;
    width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 34px 24px 22px; border: none; border-radius: 18px;
    background: linear-gradient(120deg, #FF3D7F 0%, #EC4899 28%, #8B5CF6 66%, #4A7CFF 100%);
    background-size: 220% 220%;
    color: #fff; cursor: pointer; font-family: inherit;
    box-shadow: 0 12px 34px rgba(236,72,153,0.38);
    animation: gameGradient 7s ease infinite, gameBreathe 2.8s ease-in-out infinite;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
.game-entry-btn:hover { transform: translateY(-4px) scale(1.015); }
.game-entry-btn:active { transform: scale(.985); }
.game-entry-btn::after {
    content: ''; position: absolute; top: 0; left: -60%; width: 38%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
    transform: skewX(-18deg); animation: gameShimmer 3.4s ease-in-out infinite; pointer-events: none;
}
.ge-badge {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    font-size: .72em; font-weight: 700; letter-spacing: 1px; white-space: nowrap;
    padding: 3px 13px; border-radius: 20px; color: #fff;
    background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35);
    backdrop-filter: blur(6px);
}
.ge-emoji { font-size: 2.6em; line-height: 1; animation: gameWobble 1.8s ease-in-out infinite; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.ge-text { font-size: 1.5em; font-weight: 900; letter-spacing: 1px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.28); }
.ge-sub { font-size: .85em; font-weight: 500; color: rgba(255,255,255,.92); text-align: center; }
.ge-cta {
    margin-top: 8px; padding: 8px 26px; border-radius: 24px;
    background: rgba(255,255,255,.96); color: #BE185D;
    font-size: .9em; font-weight: 800; letter-spacing: .5px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    animation: gameCta 1.8s ease-in-out infinite;
}
@keyframes gameGradient { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes gameBreathe { 0%,100% { box-shadow: 0 12px 34px rgba(236,72,153,.38); } 50% { box-shadow: 0 16px 46px rgba(139,92,246,.58); } }
@keyframes gameWobble { 0%,100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.12); } }
@keyframes gameShimmer { 0% { left: -60%; } 55%,100% { left: 130%; } }
@keyframes gameCta { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.game-modal-content { max-width: 480px; }
.game-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.game-player-inputs { display: flex; gap: 12px; }
.game-player-input { flex: 1; }
.game-player-input label { display: block; font-size: 0.8em; font-weight: 700; color: var(--text-light); margin-bottom: 6px; }
.game-player-input input { width: 100%; padding: 10px 12px; border: 2px solid var(--border); border-radius: 10px; font-size: 0.92em; font-family: inherit; transition: border-color 0.2s; }
.game-player-input input:focus { outline: none; border-color: #EC4899; box-shadow: 0 0 0 3px #FDF2F8; }

.game-result { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--bg); border-radius: 12px; padding: 16px; text-align: center; }
.game-prompt { color: var(--text-light); font-size: 0.9em; }
.game-big-emoji { font-size: 2.6em; line-height: 1.2; animation: gamePop 0.4s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes gamePop { from { transform: scale(0.4) rotate(-15deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.game-battle { display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; }
.game-player-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.game-player-label { font-size: 0.82em; font-weight: 700; color: var(--primary-dark); }
.game-vs { font-size: 1em; font-weight: 900; color: #EC4899; letter-spacing: 1px; }
.game-punishment-text { margin-top: 10px; background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #B45309; padding: 12px 18px; border-radius: 10px; font-weight: 700; font-size: 0.92em; animation: gamePop 0.45s ease both; }

.game-choice-buttons { display: flex; gap: 10px; justify-content: center; }
.game-choice-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border: 2px solid var(--border); border-radius: 12px; background: white; cursor: pointer; font-family: inherit; font-size: 0.85em; font-weight: 700; color: var(--text); transition: all 0.15s; }
.game-choice-btn:hover { border-color: #EC4899; background: #FDF2F8; transform: translateY(-3px) scale(1.04); }
.game-choice-btn:active { transform: scale(0.96); }

.game-start-btn { width: 100%; padding: 14px; border: none; border-radius: 12px; background: linear-gradient(135deg, #EC4899, #F43F5E); color: white; font-size: 1em; font-weight: 700; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.game-start-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(236,72,153,0.35); }

.game-rules { background: var(--bg); border-radius: 10px; padding: 12px 16px; }
.game-rules-title { font-size: 0.82em; font-weight: 700; color: var(--text-light); margin-bottom: 6px; }
.game-rules-text { font-size: 0.8em; color: var(--text-light); line-height: 1.8; }

@media (max-width: 640px) {
    .hero-content h1 { font-size: 1.6em; }
    .form-section, .result-section, .trae-guide { padding: 24px 20px; }
    .kanban { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .result-actions { flex-direction: column; }
    .trae-steps { flex-direction: column; }
    .gantt-label-col { min-width: 100px; max-width: 100px; font-size: 0.78em; }
    .gantt-cell, .gantt-bar-cell, .gantt-deadline { min-width: 32px; height: 24px; }
    .templates-bar { gap: 8px; }
    .template-btn { font-size: 0.86em; padding: 11px 14px; min-height: 44px; }
    .view-btn { padding: 11px 14px; font-size: 0.88em; min-height: 44px; }
    .copy-btn { min-height: 44px; padding: 11px 14px; }
    .status-btn { min-height: 40px; }
    .task-status-bar { gap: 6px; }
    .stats-bar { gap: 6px; }
    .stat-num { font-size: 1.1em; }
    .game-player-inputs { flex-direction: column; }
    .ge-text { font-size: 1.25em; }
    .game-entry-btn { padding: 30px 18px 20px; }
}

.scenarios { margin: 26px 0; }
.scenarios h2 { font-size: 1.1em; margin-bottom: 12px; }
.scenario-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scenario-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.scenario-icon { font-size: 1.6em; }
.scenario-card h3 { font-size: 0.95em; margin: 6px 0; }
.scenario-card p { font-size: 0.84em; color: var(--text-light); line-height: 1.65; }
.task-search { margin-bottom: 12px; }
#task-search { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 0.9em; }
#task-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74, 124, 255, 0.12); }

@media (max-width: 640px) {
    .scenario-grid { grid-template-columns: 1fr; }
    .scenario-card { padding: 14px; }
}

@media print {
    body * { visibility: hidden; }
    .result-section, .result-section * { visibility: visible; }
    .result-section { position: absolute; left: 0; top: 0; width: 100%; }
    .hero, .form-section, .scenarios, .footer, .result-header, .result-actions, .stats-bar, .progress-track, .view-toggle, .workload-section, .ai-log-section, .gantt, .task-kanban, .game-entry, #game-modal { display: none !important; }
    .toggle-detail, .task-status-bar, .detail-body, .transfer-row { display: none !important; }
    .task-card { break-inside: avoid; border-left: 4px solid var(--primary) !important; }
}
