:root {
    /* Geek/Sci-Fi & Deep Aerospace Tones */
    --bg-deep: #020617;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-alert: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --hud-border: rgba(6, 182, 212, 0.3);
    --hud-bg: rgba(2, 6, 23, 0.7);
    --hud-glow: 0 0 15px rgba(6, 182, 212, 0.5);
}

/* ==========================================
   0. Local Font Import (Nasalization)
========================================== */
@font-face {
    font-family: 'Nasalization';
    src: url('./nasalization.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ==========================================
   1. Reset & Typography
========================================== */
html { scroll-snap-type: y mandatory; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Nasalization', 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif; scroll-behavior: smooth; }

body { 
    background-color: var(--bg-deep); 
    background-image: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #020617 70%);
    color: var(--text-main); 
    overflow-x: hidden;
    scrollbar-width: none; 
    user-select: none;
    -webkit-user-select: none;
}
body::-webkit-scrollbar { display: none; }

/* ==========================================
   2. Global VFX (CRT Scanlines & Flash)
========================================== */
.scanlines { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%); background-size: 100% 4px; z-index: 999; pointer-events: none; opacity: 0.6; }
#flash-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #fff; z-index: 9000; opacity: 0; pointer-events: none; transition: opacity 0.5s; }

/* ==========================================
   3. Loader Screen
========================================== */
#loader-screen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #020617; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.8s ease-out; }
.loader-box { width: 90%; max-width: 420px; padding: 3rem; border: 1px solid var(--accent-cyan); background: rgba(6, 182, 212, 0.05); text-align: center; position: relative; transition: all 0.3s; }
.loader-box::before, .loader-box::after { content: ''; position: absolute; width: 25px; height: 25px; transition: border-color 0.3s; }
.loader-box::before { top: -6px; left: -6px; border-top: 2px solid var(--accent-cyan); border-left: 2px solid var(--accent-cyan); }
.loader-box::after { bottom: -6px; right: -6px; border-bottom: 2px solid var(--accent-cyan); border-right: 2px solid var(--accent-cyan); }

.progress-container { width: 100%; height: 2px; background: #1e293b; margin-top: 2.5rem; position: relative; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: var(--accent-cyan); transition: width 0.2s, background-color 0.3s; }
.loader-text { color: var(--accent-cyan); margin-top: 15px; font-family: 'Nasalization', monospace; font-size: 0.95rem; letter-spacing: 1px; transition: color 0.3s; }

.loader-box.timeout-alert { border-color: var(--text-alert); background: rgba(239, 68, 68, 0.05); box-shadow: 0 0 25px rgba(239, 68, 68, 0.2); }
.loader-box.timeout-alert::before, .loader-box.timeout-alert::after { border-color: var(--text-alert); }
.timeout-alert .progress-bar { background: var(--text-alert); }
.timeout-alert .loader-text { color: var(--text-alert); }

/* ==========================================
   4. 3D Canvas & HUD Controls
========================================== */
#canvas-container { 
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0; cursor: grab; 
    touch-action: pan-y; /* 允许页面上下滚动，接管手势缩放 */
}
#canvas-container:active { cursor: grabbing; }

.viewport-controls { position: fixed; bottom: 40px; right: 5%; z-index: 100; display: flex; flex-direction: column; gap: 8px; padding: 15px; background: var(--hud-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--hud-border); border-right: 3px solid var(--accent-cyan); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.viewport-controls button { padding: 8px 0; font-size: 1.2rem; min-width: 45px; cursor: pointer; color: var(--accent-cyan); background: rgba(6, 182, 212, 0.05); border: 1px solid var(--hud-border); transition: all 0.2s; }
.viewport-controls button:hover { background: var(--accent-cyan); color: #000; box-shadow: var(--hud-glow); }

/* ==========================================
   5. Navigation Bar
========================================== */
.navbar { position: fixed; top: 0; width: 100%; padding: 2rem 5%; display: flex; justify-content: space-between; align-items: center; z-index: 100; mix-blend-mode: difference; pointer-events: none; }
.navbar > * { pointer-events: auto; }
.logo { font-size: 1.5rem; font-weight: 900; letter-spacing: 4px; border-bottom: 2px solid var(--accent-cyan); padding-bottom: 5px; text-transform: uppercase; }
.nav-links { display: flex; gap: 3rem; list-style: none; }
.nav-links a { color: var(--text-main); text-decoration: none; font-size: 0.85rem; letter-spacing: 2px; text-transform: uppercase; transition: color 0.3s, text-shadow 0.3s; }
.nav-links a:hover { color: var(--accent-cyan); text-shadow: var(--hud-glow); }

/* ==========================================
   6. Scrolling Content Blocks
========================================== */
main { position: relative; z-index: 10; pointer-events: none; }
section { scroll-snap-align: start; scroll-snap-stop: always; min-height: 100vh; height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-left: 10%; width: 100%; opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
section.is-visible { opacity: 1; transform: translateY(0); }

.content-block { width: 40%; max-width: 650px; pointer-events: auto; cursor: default; background: var(--hud-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-left: 4px solid var(--accent-cyan); padding: 3.5rem; box-shadow: 20px 20px 0 rgba(0,0,0,0.15); position: relative; }
.content-block::before { content: ''; position: absolute; top: 0; right: 0; width: 30px; height: 1px; background: var(--accent-cyan); }
.content-block::after { content: ''; position: absolute; bottom: 0; right: 0; width: 1px; height: 30px; background: var(--accent-cyan); }

.type-target { visibility: hidden; }
.sys-label { color: var(--accent-cyan); font-family: 'Nasalization', monospace; font-size: 0.9rem; margin-bottom: 1.5rem; letter-spacing: 2px; }
h1 { font-size: 4.5rem; font-weight: 900; line-height: 1.1; margin-bottom: 1.5rem; text-transform: uppercase; letter-spacing: 2px; background: linear-gradient(90deg, #fff, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
h2 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1.5rem; color: #fff; letter-spacing: 1px; }
p { font-size: 1.05rem; line-height: 1.8; color: var(--text-muted); margin-bottom: 2.5rem; letter-spacing: 1px; }

/* ==========================================
   7. Buttons, Lists & Terminal
========================================== */
button.action-btn { background: transparent; color: var(--accent-cyan); border: 1px solid var(--accent-cyan); padding: 1.2rem 3rem; font-size: 1rem; font-weight: bold; letter-spacing: 3px; text-transform: uppercase; cursor: pointer; transition: all 0.3s; position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
button.action-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: var(--accent-cyan); transition: left 0.3s cubic-bezier(0.25, 1, 0.5, 1); z-index: -1; }
button.action-btn:hover, button.action-btn:active { color: #000; box-shadow: var(--hud-glow); }
button.action-btn:hover::before, button.action-btn:active::before { left: 0; }

.btn-primary { background: var(--accent-cyan); color: #000; border: none; }
.btn-primary:hover, .btn-primary:active { background: #fff; box-shadow: 0 0 20px rgba(255,255,255,0.4); color: #000; }
.btn-primary:disabled { background: #334155; color: #94a3b8; cursor: not-allowed; box-shadow: none; }
.btn-primary:disabled::before { display: none; }

.data-list { list-style: none; border-top: 1px solid var(--hud-border); }
.data-list li { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 0; border-bottom: 1px solid var(--hud-border); font-family: 'Nasalization', monospace; font-size: 0.95rem; letter-spacing: 1px; }
.data-list span:first-child { color: var(--text-main); }
.data-highlight { color: var(--accent-cyan) !important; font-weight: bold; text-shadow: 0 0 8px rgba(6, 182, 212, 0.4); }

.terminal-box { background: #000; border: 1px solid #334155; padding: 1.5rem; height: 220px; overflow: hidden; position: relative; font-family: 'Nasalization', monospace; font-size: 0.9rem; color: #10b981; line-height: 1.6; }
.terminal-box::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 50px; background: linear-gradient(transparent, #000); pointer-events: none;}
.cursor-blink { animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ==========================================
   8. Modals & Scroll Animations
========================================== */
.scroll-indicator { position: absolute; bottom: 50px; left: 10%; display: flex; align-items: center; gap: 15px; font-size: 0.8rem; letter-spacing: 3px; color: var(--text-muted); text-transform: uppercase; pointer-events: auto;}
.scroll-line { width: 50px; height: 1px; background: var(--accent-cyan); animation: pulseWidth 2s infinite cubic-bezier(0.4, 0, 0.6, 1); }
@keyframes pulseWidth { 0%, 100% { width: 15px; opacity: 0.5; } 50% { width: 60px; opacity: 1; } }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(2, 6, 23, 0.9); backdrop-filter: blur(20px); z-index: 1000; align-items: center; justify-content: center; }
.modal-content { width: 90%; max-width: 600px; padding: 4rem 3rem; background: #0f172a; border: 1px solid var(--accent-cyan); text-align: center; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.modal-content::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent); }
.close { position: absolute; top: 15px; right: 25px; font-size: 2.5rem; line-height: 1; color: var(--text-muted); cursor: pointer; transition: color 0.3s; }
.close:hover { color: #fff; }

/* ==========================================
   9. Mobile / Responsive Overrides
========================================== */
@media (max-width: 1024px) { .content-block { width: 55%; } h1 { font-size: 3.5rem; } }
@media (max-width: 768px) {
    .navbar { padding: 1.5rem 5%; }
    .logo { font-size: 1.2rem; }
    .nav-links { display: none; }
    section { padding-left: 5%; padding-right: 5%; justify-content: flex-end; padding-bottom: 8vh; }
    .content-block { width: 100%; padding: 1.8rem; background: rgba(2, 6, 23, 0.5); border-left: none; border-top: 3px solid var(--accent-cyan); }
    .content-block::before { width: 1px; height: 30px; top: 0; left: 0; }
    .content-block::after { width: 30px; height: 1px; bottom: 0; right: 0; }
    h1 { font-size: 2.5rem; margin-bottom: 1rem; } 
    h2 { font-size: 1.8rem; margin-bottom: 1rem; }
    p { font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.6; }
    .sys-label { margin-bottom: 1rem; }
    button.action-btn { padding: 1rem 1.5rem; font-size: 0.9rem; width: 100%; text-align: center; }
    .scroll-indicator, .viewport-controls { display: none; }
    .data-list li { flex-direction: column; align-items: flex-start; gap: 8px; font-size: 0.85rem; padding: 1rem 0; }
    .terminal-box { height: 160px; font-size: 0.8rem; padding: 1rem; }
    .modal-content { padding: 3rem 1.5rem; }
    #result-name { font-size: 2.2rem; }
    .loader-box { padding: 2rem 1.5rem; }
    .loader-box h3 { font-size: 1.3rem !important; }
}

/* ==========================================
   10. Footer (Terminal Style)
========================================== */
.site-footer { scroll-snap-align: start; position: relative; z-index: 10; width: 100%; padding: 4rem 10%; background: rgba(2, 6, 23, 0.85); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border-top: 1px solid var(--hud-border); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2rem; pointer-events: auto; }
.site-footer::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 25%; height: 2px; background: var(--accent-cyan); box-shadow: var(--hud-glow); }
.footer-logo { font-size: 1.5rem; font-weight: 900; letter-spacing: 6px; color: var(--text-main); text-transform: uppercase; }
.footer-links { display: flex; gap: 3rem; list-style: none; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; letter-spacing: 2px; transition: color 0.3s, text-shadow 0.3s; }
.footer-links a:hover { color: var(--accent-cyan); text-shadow: var(--hud-glow); }
.footer-sys-info { font-family: 'Nasalization', monospace; font-size: 0.8rem; color: #475569; letter-spacing: 2px; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-sys-info .highlight { color: var(--accent-cyan); }
@media (max-width: 768px) { .site-footer { padding: 3rem 5%; gap: 1.5rem; } .site-footer::before { width: 50%; } .footer-links { flex-direction: column; gap: 1rem; } }

/* ==========================================
   11. AERO.BOX CUSTOM CURSOR
========================================== */
@media (pointer: fine) {
    body, button, a, #canvas-container, .modal { cursor: none !important; }
}

#aero-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    border: 2px solid var(--accent-cyan);
    background-color: rgba(6, 182, 212, 0.1);
    pointer-events: none; /* 穿透点击，绝不影响底层交互 */
    z-index: 999999;
    transform: translate(-50%, -50%);
    transition: width 0.2s ease, height 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(2px);
}

#aero-cursor.hovering {
    width: 36px;
    height: 36px;
    border-color: var(--accent-purple);
    background-color: rgba(139, 92, 246, 0.2);
    transform: translate(-50%, -50%) rotate(45deg); 
}

#aero-cursor.clicking {
    width: 14px;
    height: 14px;
    border-color: #fff;
    background-color: rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%) scale(0.8);
    box-shadow: 0 0 10px var(--accent-cyan);
}

@media (max-width: 768px) {
    #aero-cursor { display: none !important; }
}

/* ==========================================
   12. USER AUTH DROPDOWN (UPLINK STATUS)
========================================== */
#user-zone {
    position: relative;
    display: none; 
    align-items: center;
}

#user-dropdown-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    border-color: rgba(6, 182, 212, 0.5);
    background: transparent;
    transition: all 0.3s ease;
}

#user-dropdown-btn:hover, #user-dropdown-btn.active {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: inset 0 0 10px rgba(6, 182, 212, 0.2);
}

.user-name-truncated {
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: bottom;
    color: #fff;
    text-shadow: 0 0 5px var(--accent-cyan);
}

#user-status-card {
    display: none; 
    position: absolute;
    top: 130%; 
    right: 0;
    width: 250px;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--hud-border);
    border-top: 3px solid var(--accent-cyan);
    padding: 1.5rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.8);
    z-index: 1000;
    animation: terminalDrop 0.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes terminalDrop {
    0% { opacity: 0; transform: translateY(-10px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.status-card-header {
    font-size: 0.7rem; color: var(--text-muted); margin-bottom: 5px; letter-spacing: 1px;
}
.status-card-name {
    font-size: 1.2rem; color: #fff; margin-bottom: 15px; word-break: break-all; letter-spacing: 2px;
}
.status-card-stats {
    border-top: 1px dashed #334155; padding-top: 12px; margin-bottom: 15px; font-size: 0.75rem; color: #cbd5e1; display: flex; flex-direction: column; gap: 8px;
}

@media (max-width: 768px) {
    #user-status-card {
        right: -20px; 
    }
}

/* ==========================================
   13. OPTICAL TRACKING HUD (SPATIAL UPLINK)
========================================== */
#gesture-tracker-ui {
    position: fixed;
    bottom: 40px;
    left: 5%; 
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: var(--hud-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--hud-border);
    border-left: 3px solid var(--accent-cyan);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    pointer-events: auto;
    transition: all 0.3s ease;
}

#gesture-canvas {
    border-radius: 2px;
    border: 1px solid #334155;
    background: #000;
    width: 140px;
    height: 105px;
    box-shadow: inset 0 0 15px rgba(6, 182, 212, 0.2);
    /* [新增修改] 镜像翻转画面，符合人类直觉 */
    transform: scaleX(-1);
}

#gesture-status {
    color: var(--accent-cyan);
    font-family: 'Nasalization', monospace;
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: var(--hud-glow);
}

#gesture-tracker-ui button:hover {
    color: #000;
}

@media (max-width: 768px) {
    #gesture-tracker-ui {
        bottom: auto;
        top: 90px; 
        left: 5%;
        padding: 10px;
        transform: scale(0.85);
        transform-origin: top left;
    }
}