/* style.css - 升级版：Stitch Tactical HUD Design System */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Noto+Sans+SC:wght@300;400;500;700&family=Space+Grotesk:wght@400;600&display=swap');

:root {
    /* Stitch Design System Palette */
    --bg-void: #080e1c;
    --surface-low: #0c1323;
    --surface-high: #181f32;
    --primary: #73ffe3;
    --primary-container: #00f5d4;
    --secondary: #9e8fff;
    --secondary-container: #442bb5;
    --error: #ff716c;
    --error-container: #9f0519;
    --warning: #ffb347;
    --success: #2ed573;
    --gold: #ffd36b;
    --on-surface: #e3e7fc;
    --on-surface-variant: #a5aabe;
    --text-primary: #f4f7ff;
    --text-secondary: #b6bdd5;
    --text-dim: #7f88a8;
    --ghost-border: rgba(112, 117, 135, 0.15); /* Outline-variant at 15% */
    
    --font-display: 'Orbitron', 'Space Grotesk', sans-serif;
    --font-body: 'Noto Sans SC', sans-serif; /* Using Noto Sans as Manrope equivalent for Chinese */
    --font-mono: 'Space Grotesk', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: var(--bg-void);
    color: var(--on-surface);
    font-family: var(--font-body);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
}

/* 布局：Intentional Asymmetry (不对称司令部) */
#app {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 100% 0%, rgba(12,19,35,0.8) 0%, var(--bg-void) 70%);
}

/* =========================================
   左侧面板 (40%)：控制台
   ========================================= */
#left-panel {
    width: 40%;
    height: 100%;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    background: linear-gradient(90deg, var(--surface-low) 0%, rgba(8,14,28,0.4) 100%);
    border-right: 1px solid var(--ghost-border);
    transition: all 0.5s ease;
}

/* 紧急状态 (Phase 2 & 4a) */
#left-panel.phase-alert {
    background: linear-gradient(90deg, rgba(159,5,25,0.4) 0%, rgba(8,14,28,0.4) 100%);
    box-shadow: inset 20px 0 100px rgba(255,113,108,0.1);
}
#left-panel.phase-alert .panel-header h1 { color: var(--error); text-shadow: 0 0 15px rgba(255,113,108,0.5); }
#left-panel.phase-alert .status-dot { background-color: var(--error); box-shadow: 0 0 10px var(--error); }
#left-panel.phase-alert #system-status { color: var(--error); }
#left-panel.phase-alert .avatar-ring circle[fill="url(#avatar-glow)"] { fill: rgba(255,113,108,0.2) !important; }
#left-panel.phase-alert .avatar-ring circle[stroke="#00f5d4"] { stroke: var(--error) !important; }
#left-panel.phase-alert path[stroke="#00f5d4"] { stroke: var(--error) !important; }
#left-panel.phase-alert .progress-fill { background: var(--error); box-shadow: 0 0 10px var(--error); }
#left-panel.phase-alert .step-dot { border-color: var(--error); }

/* 发射状态 (Phase 4b, 4c) */
#left-panel.phase-launch {
    background: linear-gradient(90deg, rgba(68,43,181,0.4) 0%, rgba(8,14,28,0.4) 100%);
}

#left-panel.phase-success {
    background: linear-gradient(90deg, rgba(0,245,212,0.15) 0%, rgba(8,14,28,0.4) 100%);
}

/* Header */
.panel-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    gap: 16px;
}

.header-icon {
    width: 48px;
    height: 48px;
    background: var(--surface-high);
    border-radius: 8px; /* Sharp corners: mostly small */
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--ghost-border);
    box-shadow: 0 0 20px rgba(115,255,227,0.1);
}

.panel-header h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--on-surface);
    text-transform: uppercase;
    flex: 1;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-high);
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--ghost-border);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--primary);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: pulse-dot 2s infinite;
}

/* AI助手区域 (The Module) */
#assistant-area {
    display: flex;
    gap: 20px;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.assistant-avatar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.avatar-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface-high);
    border: 1px solid var(--ghost-border);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.avatar-name {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--on-surface-variant);
    letter-spacing: 1px;
}

#dialogue-box {
    flex: 1;
    background: rgba(24, 31, 50, 0.4); /* surface-high w/ opacity */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ghost-border);
    border-left: 3px solid var(--primary);
    border-radius: 2px 8px 8px 8px;
    padding: 16px 20px;
    position: relative;
    font-size: 14px;
    line-height: 1.6;
    color: var(--on-surface);
    min-height: 80px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.typing-indicator {
    display: none;
    gap: 4px;
    margin-top: 8px;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite both;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* 内容区域 */
#content-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 12px;
    display: flex;
    flex-direction: column;
    gap: 24px; /* Spacing-6 equivalent */
}

#content-area > * {
    flex-shrink: 0;
}
#content-area::-webkit-scrollbar { width: 4px; }
#content-area::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
#content-area::-webkit-scrollbar-thumb { background: var(--ghost-border); border-radius: 2px; }

.phase-brief {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 0% 0%, rgba(115,255,227,0.14), transparent 45%),
        linear-gradient(135deg, rgba(17, 26, 46, 0.9), rgba(10, 16, 30, 0.76));
    border: 1px solid rgba(115,255,227,0.18);
    border-radius: 10px;
    padding: 18px 18px 16px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.phase-brief::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), transparent);
    opacity: 0.9;
}

.phase-brief.alert {
    background:
        radial-gradient(circle at 0% 0%, rgba(255,113,108,0.18), transparent 48%),
        linear-gradient(135deg, rgba(46, 14, 28, 0.92), rgba(14, 12, 30, 0.82));
    border-color: rgba(255,113,108,0.25);
}

.phase-brief.success {
    background:
        radial-gradient(circle at 0% 0%, rgba(46,213,115,0.16), transparent 48%),
        linear-gradient(135deg, rgba(9, 35, 37, 0.92), rgba(10, 18, 30, 0.82));
    border-color: rgba(46,213,115,0.24);
}

.phase-brief-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid rgba(115,255,227,0.24);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 14px;
}

.phase-brief-title {
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 1.25;
    margin-bottom: 14px;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}

.phase-brief.compact {
    padding: 14px 16px 14px;
}

.phase-brief.compact .phase-brief-label {
    margin-bottom: 10px;
}

.phase-brief.compact .phase-brief-title {
    font-size: 15px;
    margin-bottom: 12px;
    line-height: 1.35;
}

.phase-brief-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.phase-brief-stack {
    display: grid;
    gap: 8px;
}

.phase-brief-stack-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
}

.phase-brief-stack-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.phase-brief-stack-value {
    font-size: 13px;
    line-height: 1.5;
    color: var(--on-surface);
}

.phase-brief-item {
    padding: 12px 12px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    min-height: 88px;
}

.phase-brief-item-label {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.phase-brief-item-value {
    font-size: 13px;
    line-height: 1.55;
    color: var(--on-surface);
}

.component-progress {
    position: relative;
    overflow: hidden;
    padding: 16px 18px 18px;
    background: rgba(10, 16, 30, 0.72);
    border: 1px solid rgba(115,255,227,0.14);
    border-radius: 10px;
}

.component-progress::after {
    content: '';
    position: absolute;
    inset: auto -30% 0 auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(115,255,227,0.12), transparent 70%);
    pointer-events: none;
}

.component-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.component-progress-title {
    font-family: var(--font-display);
    font-size: 15px;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}

.component-progress-count {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--primary);
}

.component-progress-bar {
    width: 100%;
    height: 10px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    overflow: hidden;
}

.component-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(115,255,227,0.5), rgba(115,255,227,1));
    box-shadow: 0 0 18px rgba(115,255,227,0.35);
    transition: width 0.35s ease;
}

.component-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.component-progress-tip {
    font-size: 12px;
    line-height: 1.6;
    color: var(--on-surface-variant);
}

/* 玻璃态卡片 (Glassmorphism Cards) */
.knowledge-card {
    background: rgba(24, 31, 50, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ghost-border);
    border-top: 2px solid var(--secondary); /* The 2px top-accent bar */
    border-radius: 4px;
    padding: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.knowledge-card.visible {
    opacity: 1;
    transform: translateY(0);
}
.knowledge-card .card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.knowledge-card .icon {
    font-size: 18px;
    filter: drop-shadow(0 0 5px rgba(158,143,255,0.5));
}
.knowledge-card .card-body {
    font-size: 14px;
    color: var(--on-surface);
    line-height: 1.7;
    margin-bottom: 16px;
}
.knowledge-card .card-body b {
    color: var(--primary);
    font-weight: 500;
}
.knowledge-card .card-svg {
    display: flex;
    justify-content: center;
    margin: 16px 0;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    padding: 16px;
}

/* Fun Fact (Telemetry chip) */
.fun-fact {
    background: rgba(115, 255, 227, 0.05);
    border-left: 2px solid var(--primary);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--on-surface-variant);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-family: var(--font-mono);
}

/* Data Readout Cards (Phase 2 & 4 & 5) */
.data-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(24, 31, 50, 0.4);
    border: 1px solid var(--ghost-border);
    border-radius: 4px;
    font-family: var(--font-mono);
}
.data-card .data-label { color: var(--on-surface-variant); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.data-card .data-value { color: var(--primary); font-size: 16px; font-weight: 700; text-shadow: 0 0 10px rgba(115,255,227,0.3); }

.data-card.danger { border-color: rgba(255,113,108,0.3); background: rgba(159,5,25,0.2); }
.data-card.danger .data-value { color: var(--error); text-shadow: 0 0 10px rgba(255,113,108,0.4); }
.data-card.warning { border-color: rgba(255,171,0,0.3); background: rgba(255,171,0,0.05); }
.data-card.warning .data-value { color: #ffab00; }
.data-card.success { border-color: rgba(0,245,212,0.3); background: rgba(0,245,212,0.05); }

/* Component Grid (Phase 3) */
.component-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.component-btn {
    background: rgba(24, 31, 50, 0.5);
    border: 1px solid var(--ghost-border);
    border-radius: 4px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}
.component-btn::before {
    content: ''; position: absolute; top:0; left:0; right:0; height: 2px;
    background: var(--primary); transform: scaleX(0); transition: transform 0.3s;
}
.component-btn:hover {
    background: rgba(35, 44, 66, 0.6);
    border-color: rgba(115,255,227,0.3);
}
.component-btn:hover::before { transform: scaleX(1); }

.component-btn.active {
    transform: translateY(-2px);
    border-color: rgba(115,255,227,0.45);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22), 0 0 18px rgba(115,255,227,0.1);
}

.component-btn .comp-icon { font-size: 28px; filter: drop-shadow(0 0 8px rgba(115,255,227,0.4)); }
.component-btn .comp-name { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--on-surface); }
.component-btn .comp-status { font-family: var(--font-mono); font-size: 10px; color: var(--on-surface-variant); text-transform: uppercase;}

.component-btn.installed {
    border-color: rgba(115,255,227,0.4);
    background: rgba(0,245,212,0.1);
}
.component-btn.installed .comp-status { color: var(--primary); }
.component-btn.installed::after {
    content: ''; position: absolute; inset: 0;
    box-shadow: inset 0 0 20px rgba(0,245,212,0.1); pointer-events: none;
}

/* Phase 4 Controls & Data */
.control-panel {
    background: rgba(24, 31, 50, 0.4);
    border: 1px solid var(--ghost-border);
    border-radius: 4px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.panel-title {
    width: 100%;
    text-align: left;
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--ghost-border);
    padding-bottom: 8px;
}

/* Nav Data Box */
.nav-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-family: var(--font-mono);
}
.nav-item {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--ghost-border);
    padding: 10px;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-label { font-size: 10px; color: var(--on-surface-variant); text-transform: uppercase;}
.nav-value { font-size: 14px; color: var(--primary); font-weight: 600; }

/* Direction Pad */
.direction-pad {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 8px;
}
.dir-btn {
    background: var(--surface-high);
    border: 1px solid var(--ghost-border);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s;
    height: 100%;
}
.dir-btn:hover { background: rgba(115,255,227,0.1); border-color: var(--primary); box-shadow: 0 0 10px rgba(115,255,227,0.3); }
.dir-btn:active { background: var(--primary); color: #000; }
.dir-btn.center { font-size: 10px; color: var(--on-surface-variant); pointer-events: none; background: rgba(0,0,0,0.3);}

/* Countdown */
.countdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 160px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,113,108,0.3);
    border-radius: 4px;
    box-shadow: inset 0 0 50px rgba(255,113,108,0.1);
}
.count-number {
    font-family: var(--font-display);
    font-size: 80px;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(115,255,227,0.5);
    line-height: 1;
}
.count-label {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--on-surface-variant);
    letter-spacing: 4px;
    margin-top: 10px;
}

/* SMART Nav Camera */
.crosshair-container {
    width: 100%;
    height: 200px;
    background: #000;
    border: 1px solid var(--primary);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(115,255,227,0.1);
}
#crosshair-canvas {
    width: 100%;
    height: 100%;
}
.lock-status {
    width: 100%;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 8px;
    border-radius: 2px;
    letter-spacing: 1px;
    background: rgba(159,5,25,0.2);
    color: var(--error);
    border: 1px solid rgba(255,113,108,0.3);
    animation: pulse-slow 2s infinite;
}

/* Action Bar */
#action-bar {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Telemetry Scanner Progress (Replaced circles with tactical dashes) */
.progress-track {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
    padding-bottom: 24px;
}
.progress-line {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: repeating-linear-gradient(90deg, var(--surface-high), var(--surface-high) 10px, transparent 10px, transparent 14px);
    z-index: 1;
}
.progress-line-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    transition: width 0.8s ease-in-out;
    z-index: 2;
}
.progress-step {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.step-dot {
    width: 12px;
    height: 12px;
    background: var(--surface-low);
    border: 2px solid var(--surface-high);
    border-radius: 0px; /* Square dots for tactical look */
    transform: rotate(45deg); /* Diamond shape */
    transition: all 0.3s;
    position: absolute;
    bottom: -4px;
}
.step-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ghost-border);
    text-transform: uppercase;
    transition: all 0.3s;
    letter-spacing: 1px;
}
.progress-step.completed .step-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 10px var(--primary); }
.progress-step.completed .step-label { color: var(--primary); }
.progress-step.active .step-dot { background: var(--surface-low); border-color: var(--primary); box-shadow: 0 0 15px var(--primary); animation: diamond-pulse 1.5s infinite; }
.progress-step.active .step-label { color: #fff; text-shadow: 0 0 5px rgba(255,255,255,0.5); font-weight: 700; }

/* 战术按钮 (Tactical Triggers) */
.primary-btn {
    appearance: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
    border: none;
    border-radius: 2px; /* sm roundness */
    padding: 20px 24px;
    color: var(--bg-void);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(115,255,227,0.2);
}

.primary-btn::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(transparent, rgba(255,255,255,0.4), transparent);
    transform: rotate(45deg) translateY(-100%);
    transition: transform 0.6s ease;
}
.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(115,255,227,0.4), inset 0 0 10px rgba(255,255,255,0.5);
}
.primary-btn:hover::after { transform: rotate(45deg) translateY(100%); }
.primary-btn:active {
    transform: translateY(1px);
    opacity: 0.8; /* Flicker effect on click */
}

/* 警报按钮 */
.primary-btn.danger { background: linear-gradient(135deg, var(--error) 0%, #d7383b 100%); box-shadow: 0 4px 20px rgba(255,113,108,0.3); color: #fff; }
.primary-btn.danger:hover { box-shadow: 0 0 25px rgba(255,113,108,0.5); }

/* 成功按钮 */
.primary-btn.success { background: linear-gradient(135deg, #2ed573 0%, #1e90ff 100%); color: #fff; box-shadow: 0 4px 20px rgba(46,213,115,0.3);}


/* =========================================
   右侧面板 (60%)：3D 宇宙视界
   ========================================= */
#right-panel {
    width: 60%;
    height: 100%;
    position: relative;
}

#scene-canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

.debug-panel {
    position: absolute;
    top: 86px;
    left: 40px;
    z-index: 26;
    width: min(340px, calc(100% - 80px));
    padding: 14px 14px 12px;
    border: 1px solid rgba(255, 179, 71, 0.28);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(12, 18, 32, 0.9), rgba(11, 16, 28, 0.78)),
        radial-gradient(circle at top right, rgba(255, 179, 71, 0.12), transparent 45%);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.debug-panel[hidden] {
    display: none;
}

.debug-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.debug-panel-title {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.12em;
    color: var(--warning);
}

.debug-panel-state {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.debug-panel-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.debug-metric {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}

.debug-metric.wide {
    grid-column: 1 / -1;
}

.debug-metric-label {
    display: block;
    margin-bottom: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.debug-metric-value {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.debug-panel-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.debug-panel-keys span {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--on-surface-variant);
}

.scene-brief {
    position: absolute;
    left: 40px;
    bottom: 40px;
    z-index: 25;
    width: min(380px, calc(100% - 80px));
    padding: 18px 20px 18px;
    background:
        linear-gradient(135deg, rgba(7, 13, 28, 0.78), rgba(9, 15, 24, 0.5)),
        radial-gradient(circle at top right, rgba(115,255,227,0.12), transparent 45%);
    border: 1px solid rgba(115,255,227,0.16);
    border-radius: 16px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

#right-panel.preview-mode .scene-brief {
    background:
        linear-gradient(135deg, rgba(6, 12, 24, 0.82), rgba(11, 19, 36, 0.65)),
        radial-gradient(circle at top right, rgba(158,143,255,0.16), transparent 48%);
    border-color: rgba(158,143,255,0.22);
}

.scene-brief-eyebrow {
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--primary);
}

.scene-brief-title {
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.scene-brief-text {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.scene-brief-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.scene-brief-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--on-surface-variant);
}

/* HUD Overlay Elements */
#hud-overlay {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    bottom: 40px;
    pointer-events: none;
    z-index: 20;
}

/* Corner Brackets 标记 */
.hud-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: var(--primary);
    border-style: solid;
    border-width: 0;
    opacity: 0.6;
    transition: all 0.5s ease;
}
.hud-corner.top-left { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.hud-corner.top-right { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.hud-corner.bottom-left { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.hud-corner.bottom-right { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

#left-panel.phase-alert ~ #right-panel .hud-corner { border-color: var(--error); opacity: 0.8; }
#left-panel.phase-launch ~ #right-panel .hud-corner { border-color: var(--primary); opacity: 0.8; }

.hud-info {
    position: absolute;
    top: 0;
    right: 0;
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(158,143,255,0.5);
}

.hud-crosshair-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 1px dotted rgba(115,255,227,0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.hud-crosshair-center::before, .hud-crosshair-center::after {
    content: ''; position: absolute; background: rgba(115,255,227,0.3);
}
.hud-crosshair-center::before { width: 100%; height: 1px; }
.hud-crosshair-center::after { width: 1px; height: 100%; }

/* Animations */
@keyframes typing {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(-4px); opacity: 1; }
}
@keyframes pulse-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.4; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes diamond-pulse {
    0% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 0 rgba(115,255,227,0.7); }
    70% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 8px rgba(115,255,227,0); }
    100% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 0 rgba(115,255,227,0); }
}
@keyframes pulse-slow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.3; }
}

@media (max-width: 1180px) {
    #left-panel {
        width: 46%;
        padding: 28px 24px;
    }

    #right-panel {
        width: 54%;
    }

    .panel-header h1 {
        font-size: 21px;
    }

    .scene-brief {
        left: 24px;
        bottom: 24px;
        width: min(340px, calc(100% - 48px));
    }

    .debug-panel {
        top: 72px;
        left: 24px;
        width: min(320px, calc(100% - 48px));
    }
}

@media (max-width: 820px) {
    body {
        height: auto;
        min-height: 100svh;
        overflow: auto;
        align-items: stretch;
    }

    #app {
        min-height: 100svh;
        height: auto;
        flex-direction: column;
    }

    #right-panel,
    #left-panel {
        width: 100%;
    }

    #right-panel {
        order: -1;
        height: 42svh;
        min-height: 320px;
    }

    #left-panel {
        height: auto;
        min-height: calc(58svh - 1px);
        padding: 18px 16px 28px;
        background: linear-gradient(180deg, rgba(12,19,35,0.92) 0%, rgba(8,14,28,0.98) 100%);
        border-right: none;
        border-top: 1px solid var(--ghost-border);
    }

    .panel-header {
        gap: 12px;
        margin-bottom: 20px;
        flex-wrap: wrap;
    }

    .panel-header h1 {
        font-size: 20px;
    }

    .header-status {
        margin-left: auto;
    }

    #assistant-area {
        gap: 12px;
        margin-bottom: 18px;
    }

    .avatar-ring {
        width: 56px;
        height: 56px;
    }

    #dialogue-box {
        padding: 14px 16px;
    }

    #content-area {
        gap: 16px;
        padding-right: 0;
        overflow: visible;
    }

    .debug-panel {
        top: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        padding: 12px;
    }

    .debug-panel-body {
        grid-template-columns: 1fr;
    }

    .phase-brief-grid {
        grid-template-columns: 1fr;
    }

    .component-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .component-progress-head,
    .component-progress-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-data {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #action-bar {
        position: sticky;
        bottom: 0;
        margin-top: 18px;
        padding-top: 18px;
        background: linear-gradient(180deg, rgba(8,14,28,0) 0%, rgba(8,14,28,0.82) 18%, rgba(8,14,28,0.98) 100%);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .primary-btn {
        padding: 16px 18px;
        font-size: 14px;
        letter-spacing: 1px;
    }

    #hud-overlay {
        top: 16px;
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .hud-info {
        font-size: 13px;
    }

    .scene-brief {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
        padding: 14px 16px;
        border-radius: 12px;
    }

    .scene-brief-title {
        font-size: 18px;
    }

    .scene-brief-text {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .scene-brief-tags {
        gap: 6px;
    }

    .scene-brief-tag {
        font-size: 10px;
        padding: 5px 8px;
    }
}
