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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f3460 100%);
    min-height: 100vh;
    color: #e2e8f0;
    overflow-x: hidden;
}

#gameContainer {
    max-width: 1280px;
    margin: 0 auto;
    padding: 15px;
}

/* ===== 游戏标题 ===== */
.game-header {
    text-align: center;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}
.game-header h1 {
    font-size: 2.2em;
    margin-bottom: 5px;
    background: linear-gradient(45deg, #fbbf24, #f59e0b, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.subtitle {
    font-size: 1em;
    color: #94a3b8;
    letter-spacing: 3px;
}

/* ===== 信息面板 ===== */
.info-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    padding: 12px 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}

/* 角色信息 */
.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 260px;
}
.role-display {
    display: flex;
    align-items: center;
    gap: 10px;
}
.role-icon {
    font-size: 2.5em;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.role-text { display: flex; flex-direction: column; }
.role-name { font-size: 1.1em; font-weight: bold; color: #fbbf24; }
.role-level { font-size: 0.85em; color: #94a3b8; }

/* 积分条 */
.points-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 140px;
}
.points-bar {
    width: 100%;
    height: 14px;
    background: rgba(255,255,255,0.1);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}
.points-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.5s ease, background 0.3s ease;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    box-shadow: 0 0 8px rgba(34,197,94,0.4);
}
.points-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    box-shadow: 0 0 8px rgba(245,158,11,0.4);
}
.points-fill.danger {
    background: linear-gradient(90deg, #ef4444, #f87171);
    box-shadow: 0 0 8px rgba(239,68,68,0.4);
    animation: pulse-bar 1s infinite;
}
@keyframes pulse-bar {
    0%,100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.points-text { font-size: 0.85em; color: #94a3b8; font-weight: bold; }

/* 计分板 */
.score-board {
    display: flex;
    gap: 20px;
    flex: 1;
    justify-content: center;
}
.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}
.score-item .label { font-size: 0.8em; color: #64748b; margin-bottom: 3px; }
.score-item .value { font-size: 1.5em; font-weight: bold; transition: all 0.3s; }
.score-item .value.safe { color: #4ade80; }
.score-item .value.danger { color: #f87171; }
.score-item .value.upgrade { color: #a78bfa; }

.game-status {
    font-size: 0.95em;
    color: #cbd5e1;
    padding: 8px 16px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border-left: 3px solid #fbbf24;
    min-width: 200px;
    text-align: center;
}

/* ===== 游戏区域 ===== */
.game-area {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

#gameCanvas {
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

/* ===== 控制面板 ===== */
.control-panel {
    flex: 1;
    min-width: 260px;
    max-width: 300px;
    max-height: 600px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0,0,0,0.35);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.control-panel::-webkit-scrollbar { width: 4px; }
.control-panel::-webkit-scrollbar-track { background: transparent; }
.control-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.control-section {
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
}
.control-section h3 {
    font-size: 0.95em;
    margin-bottom: 8px;
    color: #fbbf24;
}
.good-section { border-color: rgba(74,222,128,0.2); }
.good-section h3 { color: #4ade80; }

/* 按键提示 */
.key-hints { display: flex; flex-direction: column; gap: 5px; }
.key-hint { font-size: 0.85em; color: #94a3b8; display: flex; align-items: center; gap: 4px; }
kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.85em;
    font-family: monospace;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: #e2e8f0;
    min-width: 22px;
    text-align: center;
}

/* 任务显示 */
.task-display p { font-size: 0.9em; color: #cbd5e1; margin-bottom: 6px; }
.task-progress {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}
.task-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.task-count { font-size: 0.8em; color: #a78bfa; }

/* 规则列表 */
.rules-list { display: flex; flex-direction: column; gap: 4px; }
.rule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 0.82em;
    background: rgba(255,255,255,0.03);
    border-radius: 5px;
    color: #cbd5e1;
}
.rule-item.good { color: #86efac; }
.rule-icon { margin-right: 6px; }
.rule-pts { font-weight: bold; color: #f87171; font-size: 0.9em; }
.rule-pts.good { color: #4ade80; }

/* 升级路线 */
.upgrade-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    justify-content: center;
}
.upgrade-node {
    padding: 4px 8px;
    font-size: 0.78em;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #64748b;
    transition: all 0.3s;
    white-space: nowrap;
}
.upgrade-node.current {
    background: rgba(251,191,36,0.15);
    border-color: #fbbf24;
    color: #fbbf24;
    box-shadow: 0 0 8px rgba(251,191,36,0.2);
}
.upgrade-node.unlocked {
    background: rgba(74,222,128,0.1);
    border-color: rgba(74,222,128,0.3);
    color: #4ade80;
}
.upgrade-node.final {
    border-color: rgba(168,85,247,0.3);
}
.upgrade-node.final.unlocked {
    background: rgba(168,85,247,0.2);
    border-color: #a855f7;
    color: #c084fc;
    box-shadow: 0 0 12px rgba(168,85,247,0.3);
}
.upgrade-arrow {
    font-size: 0.7em;
    color: #475569;
}

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }

.modal-content {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 30px 35px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    max-width: 420px;
    width: 90%;
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 升级弹窗 */
.upgrade-animation {
    font-size: 4em;
    margin-bottom: 10px;
    animation: bounce 0.6s ease infinite;
}
@keyframes bounce {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
.upgrade-modal h2 { font-size: 1.6em; color: #fbbf24; margin-bottom: 8px; }
.upgrade-desc { color: #94a3b8; margin-bottom: 15px; font-size: 0.95em; }
.new-role-display {
    font-size: 3em;
    margin: 10px 0;
    padding: 15px;
    background: rgba(251,191,36,0.1);
    border-radius: 12px;
    border: 1px solid rgba(251,191,36,0.2);
}
.upgrade-perks {
    text-align: left;
    margin: 10px 0;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}
.upgrade-perks p {
    font-size: 0.9em;
    color: #cbd5e1;
    padding: 3px 0;
}
.upgrade-perks p::before {
    content: "✓ ";
    color: #4ade80;
    font-weight: bold;
}

/* 小狗弹窗 */
.dog-animation {
    font-size: 5em;
    margin-bottom: 10px;
    animation: dogWag 0.4s ease infinite alternate;
}
@keyframes dogWag {
    from { transform: rotate(-5deg); }
    to { transform: rotate(5deg); }
}
.dog-modal h2 { font-size: 1.5em; color: #f87171; margin-bottom: 10px; }
.dog-desc { color: #94a3b8; margin-bottom: 15px; line-height: 1.6; }
.dog-stats {
    padding: 12px;
    background: rgba(239,68,68,0.1);
    border-radius: 8px;
    margin-bottom: 15px;
}
.dog-stats p { font-size: 0.9em; color: #fca5a5; padding: 3px 0; }
.dog-stats span { color: #f87171; font-weight: bold; }

/* 事件弹窗 */
.event-icon { font-size: 3.5em; margin-bottom: 10px; }
.event-modal h3 { font-size: 1.3em; color: #fbbf24; margin-bottom: 8px; }
.event-desc { color: #cbd5e1; margin-bottom: 15px; line-height: 1.5; font-size: 0.95em; }
.event-actions { display: flex; gap: 10px; justify-content: center; }

/* 按钮 */
.btn-primary {
    padding: 10px 24px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: linear-gradient(45deg, #f59e0b, #fbbf24);
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(251,191,36,0.3); }
.btn-secondary {
    padding: 10px 24px;
    font-size: 1em;
    font-weight: bold;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: #e2e8f0; }
.btn-yes { background: linear-gradient(45deg, #22c55e, #4ade80); }

/* ===== 动画 ===== */
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.05)} }
.score-change { animation: pulse 0.3s ease; }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
    .game-area { flex-direction: column; align-items: center; }
    .control-panel { max-width: 100%; max-height: none; flex-direction: row; flex-wrap: wrap; }
    .control-section { flex: 1; min-width: 200px; }
}
@media (max-width: 600px) {
    .game-header h1 { font-size: 1.6em; }
    .info-panel { flex-direction: column; gap: 10px; }
    .score-board { gap: 12px; }
    #gameCanvas { width: 100%; height: auto; }
}
