/* 引入 Nasalization 字体 (OTF 格式) */
@font-face {
    font-family: 'Nasalization';
    src: url('./fonts/nasalization.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-deep: #020617;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-alert: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --hud-border: rgba(6, 182, 212, 0.3);
    --hud-bg: rgba(2, 6, 23, 0.75);
    --hud-glow: 0 0 10px rgba(6, 182, 212, 0.2); 
}

/* 基础重置与排版 */
body { 
    margin: 0; 
    background: var(--bg-deep); 
    background-image: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #020617 70%);
    overflow: hidden; 
    font-family: 'Nasalization', sans-serif; 
    touch-action: none; 
    color: var(--text-main);
    user-select: none;
}

/* CRT 扫描线特效 */
.scanlines {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px; z-index: 9999; pointer-events: none; opacity: 0.5;
}

/* ================= 新增：导航按钮组与基础样式 ================= */
/* ================= 新增：导航按钮组与基础样式 ================= */
#nav-link-group {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 105; /* <--- 关键修改：从 100 改为 105，确保它在控制面板之上 */
    display: flex;
    gap: 15px; 
}

.nav-btn {
    padding: 10px 20px;
    background: rgba(6, 182, 212, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-family: 'Nasalization', sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(6, 182, 212, 0.1);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.nav-btn:hover {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: var(--hud-glow);
    text-shadow: none;
}

/* 加载页面 */
#loading-screen { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: #020617; overflow: hidden; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; z-index: 1000; 
    transition: transform 1.2s cubic-bezier(0.85, 0, 0.15, 1); 
}
.loader-box {
    width: 350px; padding: 2.5rem; border: 1px solid var(--accent-cyan);
    background: rgba(6, 182, 212, 0.05); text-align: center; position: relative;
}
.loader-box::before, .loader-box::after { content: ''; position: absolute; width: 20px; height: 20px; }
.loader-box::before { top: -5px; left: -5px; border-top: 2px solid var(--accent-cyan); border-left: 2px solid var(--accent-cyan); }
.loader-box::after { bottom: -5px; right: -5px; border-bottom: 2px solid var(--accent-cyan); border-right: 2px solid var(--accent-cyan); }
.loader-logo { font-size: 1.8rem; font-weight: 900; letter-spacing: 6px; margin-bottom: 30px; color: var(--text-main); text-shadow: var(--hud-glow); }

.loader-bar-container { width: 100%; height: 2px; background: #1e293b; position: relative; overflow: hidden; }
#loader-progress { width: 0%; height: 100%; background: var(--accent-cyan); box-shadow: var(--hud-glow); transition: width 0.3s ease; }
#loader-text-dynamic { margin-top: 15px; font-size: 0.85rem; letter-spacing: 2px; color: var(--accent-cyan); }

/* 顶部状态栏 */
#status { 
    position: absolute; top: 40px; width: 100%; text-align: center; 
    color: var(--accent-cyan); font-weight: bold; font-size: 1.2rem; letter-spacing: 4px;
    pointer-events: none; z-index: 100; opacity: 0; transition: opacity 1s 1s; 
    text-shadow: var(--hud-glow); text-transform: uppercase;
}
.status-active { animation: hudBlink 1s step-end infinite; color: var(--text-alert) !important; text-shadow: 0 0 15px rgba(239, 68, 68, 0.8) !important; }
@keyframes hudBlink { 50% { opacity: 0; } }

/* 左上角面板 */
#counter-panel { 
    position: absolute; top: 80px; left: 20px; 
    background: var(--hud-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 20px; border-left: 3px solid var(--accent-cyan); border-top: 1px solid var(--hud-border); border-bottom: 1px solid var(--hud-border);
    color: var(--text-muted); z-index: 100; font-size: 0.85rem; 
    transform: translateX(-150%); transition: transform 0.8s 1.2s; 
    box-shadow: 10px 10px 0 rgba(0,0,0,0.3); min-width: 200px;
}
.sys-label { color: var(--accent-cyan); font-size: 0.75rem; margin-bottom: 1rem; letter-spacing: 2px; }
.data-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--hud-border); }
.data-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--hud-border); letter-spacing: 1px; }
.data-list span:first-child { color: var(--text-main); }
.data-highlight { font-weight: bold; color: var(--accent-cyan); text-shadow: var(--hud-glow); }

/* 底部控制区 */
#control-panel { 
    position: absolute; bottom: -30%; left: 0; width: 100%; height: 25%; 
    background: linear-gradient(0deg, var(--hud-bg) 0%, rgba(2,6,23,0) 100%); 
    display: flex; align-items: center; justify-content: center; gap: 80px; 
    z-index: 101; transition: bottom 1s 1s; border-top: 1px solid var(--hud-border);
}

/* 补货按钮 */
#spawn-btn { 
    position: fixed; top: 20px; right: 20px; padding: 10px 20px; 
    background: rgba(6, 182, 212, 0.05); backdrop-filter: blur(10px); 
    border: 1px solid var(--accent-cyan); color: var(--accent-cyan); 
    cursor: pointer; z-index: 100; font-weight: bold; 
    font-family: 'Nasalization', sans-serif;
    letter-spacing: 2px; opacity: 0; transition: all 0.3s; text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(6, 182, 212, 0.1);
}
#spawn-btn:hover { background: var(--accent-cyan); color: #000; box-shadow: var(--hud-glow); }
#spawn-btn:disabled { border-color: #334155; color: #334155; cursor: not-allowed; box-shadow: none; background: transparent; }

/* 摇杆 */
#joystick-container { 
    width: 160px; height: 160px; background: rgba(6, 182, 212, 0.05); 
    border: 1px dashed var(--accent-cyan); border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; position: relative; 
}
#joystick-container::after { content: '+'; position: absolute; color: var(--accent-cyan); opacity: 0.5; font-size: 1.5rem; }
#joystick-knob { 
    width: 60px; height: 60px; background: rgba(2, 6, 23, 0.9); 
    border: 2px solid var(--accent-cyan); border-radius: 50%; 
    box-shadow: var(--hud-glow); cursor: grab; position: relative; z-index: 1; transition: background 0.2s; 
}
#joystick-knob:active { background: var(--accent-cyan); cursor: grabbing; }

/* 抓取按钮 */
#catch-btn { 
    width: 130px; height: 130px; background: transparent; 
    color: var(--accent-cyan); border-radius: 0; border: 1px solid var(--accent-cyan); 
    font-size: 1.2rem; font-weight: bold; cursor: pointer; transition: all 0.3s; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; 
    font-family: 'Nasalization', sans-serif; 
    letter-spacing: 2px; position: relative; overflow: hidden;
}
#catch-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; }
#catch-btn:hover:not(:disabled) { color: #000; box-shadow: var(--hud-glow); }
#catch-btn:hover:not(:disabled)::before { left: 0; }
#catch-btn:active:not(:disabled) { transform: scale(0.95); }
#catch-btn:disabled { border-color: #334155; color: #334155; cursor: not-allowed; box-shadow: none; }
.btn-subtext { font-size: 0.7rem; opacity: 0.8; font-weight: normal; }


/* =========================================
   移动端 (手机) 适配样式
========================================= */
@media (max-width: 768px) {
    /* --- 1. 手机端导航按钮组到底部 --- */
    #nav-link-group {
        top: auto;
        bottom: 15px; /* 固定在屏幕最底部上方一点点 */
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        padding: 0 15px;
        box-sizing: border-box;
        justify-content: space-between; /* 将两个按钮分别推向左下角和右下角 */
        pointer-events: none; /* 让容器本身不阻挡点击... */
    }

    .nav-btn {
        font-size: 0.75rem;
        padding: 8px 12px;
        background: rgba(2, 6, 23, 0.4); /* 稍微加深背景，避免跟底部控制区混淆 */
        pointer-events: auto; /* ...但按钮自身保持可点击 */
    }

    /* --- 2. 底部控制区调整 --- */
    #control-panel {
        height: 25%;
        gap: 20px; 
    }

    /* --- 3. 计数面板移动到下方 --- */
    #counter-panel {
        top: auto; 
        bottom: 26%; 
        left: 10px;
        min-width: 140px;
        padding: 12px;
        background: rgba(2, 6, 23, 0.15); 
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: 1px solid rgba(6, 182, 212, 0.2);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        transform: translateX(0); 
    }
    .sys-label { margin-bottom: 0.5rem; }
    .data-list li { padding: 4px 0; font-size: 0.75rem; }

    /* --- 4. 补货按钮移动到下方 --- */
    #spawn-btn {
        top: auto;
        bottom: 26%; 
        right: 10px;
        padding: 8px 15px;
        font-size: 0.8rem;
        background: rgba(6, 182, 212, 0.05); 
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: 1px solid rgba(6, 182, 212, 0.3);
        box-shadow: none;
    }
}

/* 针对屏幕特别小（比如 iPhone SE 等）的极限适配 */
@media (max-width: 400px) {
    #control-panel { gap: 5px; } 
    #counter-panel { bottom: 24%; left: 5px; min-width: 120px; }
    #spawn-btn { bottom: 24%; right: 5px; }
    /* 极限小屏微调底部导航按钮 */
    #nav-link-group { bottom: 8px; padding: 0 8px; }
    .nav-btn { font-size: 0.65rem; padding: 6px 8px; letter-spacing: 1px; }
}
/* ==========================================
   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; }
}
/* ==========================================
   光学手势 HUD 界面
========================================== */
#hud-cam-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 240px;
    background: var(--hud-bg);
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
    z-index: 102; /* 确保在控制台之上 */
    display: flex;
    flex-direction: column;
    pointer-events: none; /* 穿透点击，不影响游戏 */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hud-cam-wrapper {
    position: relative;
    width: 100%;
    height: 140px;
    border-bottom: 1px solid var(--hud-border);
    overflow: hidden;
}

#hud-cam-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 核心：将真实画面转换为赛博青色雷达感 */
    filter: grayscale(100%) contrast(150%) brightness(70%) sepia(100%) hue-rotate(130deg) saturate(300%);
}

.hud-scanlines {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(6, 182, 212, 0) 50%, rgba(6, 182, 212, 0.15) 50%);
    background-size: 100% 4px;
    pointer-events: none;
}

#gesture-hint {
    padding: 10px;
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.6;
    letter-spacing: 1px;
}

.hint-title {
    color: var(--accent-cyan);
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
    font-size: 0.75rem;
}

#gesture-status {
    margin-top: 6px;
    font-weight: bold;
    text-align: right;
    font-size: 0.75rem;
}

.status-waiting { color: #64748b; }
.status-tracking { color: var(--accent-cyan); text-shadow: var(--hud-glow); }
.status-pinching { color: var(--text-alert); text-shadow: 0 0 8px rgba(239, 68, 68, 0.6); animation: hudBlink 0.5s infinite; }

/* 移动端适配 */
@media (max-width: 768px) {
    #hud-cam-container {
        width: 160px;
        bottom: 110px; /* 避开底部控制按钮 */
        right: 10px;
    }
    .hud-cam-wrapper { height: 100px; }
    #gesture-hint { padding: 8px; font-size: 0.55rem; }
}