/* style.css */
:root {
    --bg-color: #0a0b10;
    --panel-bg: rgba(20, 24, 35, 0.95);
    --primary: #00f3ff; /* 青色 - 正常 */
    --warning: #ffbf00; /* 黄色 - 警告 */
    --danger: #ff2a6d;  /* 红色 - 谎言/错误 */

    /* === 【必须添加】JS中使用的简写别名 === */
    --p: var(--primary);
    --warn: var(--warning);
    --dang: var(--danger);

    --text-main: #e0e6ed;
    --text-dim: #5c6b7f;
    --grid-line: rgba(0, 243, 255, 0.1);
    --input-bg: rgba(0, 243, 255, 0.05);
}

body {
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Rajdhani', 'Segoe UI', monospace;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================
   1. 背景与视频层
   ============================ */
.app-container {
    position: relative;
    width: 100vw; 
    height: 100vh; 
    overflow: hidden;
}

video#videoEl {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.6; /* 让背景视频暗一点，突出UI */
    z-index: 0;
}

.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
    pointer-events: none; /* 让鼠标事件穿透到下层 */
}

/* ============================
   2. 顶部导航 (Top Bar)
   ============================ */
.top-bar {
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 80px; 
    padding: 0 30px; 
    display: flex; justify-content: space-between; align-items: center; 
    background: linear-gradient(to bottom, rgba(0,0,0,0.95), transparent); 
    z-index: 3000; 
    pointer-events: auto; /* 恢复点击 */
    box-sizing: border-box;
}

.logo {
    font-weight: 700; font-size: 24px; letter-spacing: 4px;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.auth-controls { display: flex; gap: 20px; align-items: center; }
#viewBtn {
    display: none; 
}
.status-indicator { 
    font-size: 14px; color: #555; font-weight: 600; margin-right: 15px; 
}
.status-indicator.online { 
    color: var(--primary); text-shadow: 0 0 5px var(--primary); 
}

.view-toggle, .auth-btn {
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid var(--text-dim);
    color: var(--primary);
    padding: 8px 20px;
    cursor: pointer;
    font-family: 'Share Tech Mono', sans-serif;
    font-size: 14px;
    transition: 0.3s;
    display: flex; align-items: center; gap: 8px;
}
.view-toggle:hover, .auth-btn:hover, .view-toggle.active, .auth-btn.active {
    border-color: var(--primary);
    background: rgba(0, 243, 255, 0.15);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
    color: #fff;
}

/* ============================
   3. HUD 中心区域 (Question Box)
   ============================ */
.hud-center {
    position: absolute; 
    top: 25%; width: 100%; 
    text-align: center; 
    pointer-events: auto;
}

.question-box {
    background: rgba(0,0,0,0.85);
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    padding: 30px;
    display: inline-block;
    max-width: 800px;
    backdrop-filter: blur(5px);
}

.status-badge {
    font-size: 14px; 
    color: var(--warning); 
    text-transform: uppercase; 
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.q-text {
    font-size: 32px; 
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
    font-weight: 600;
}

/* ============================
   4. 左下角简单仪表盘 (Simple Panel)
   ============================ */
.simple-metrics {
    position: absolute; 
    bottom: 50px; left: 50px; 
    display: flex; gap: 40px; 
    pointer-events: auto;
}

.metric-circle {
    width: 100px; height: 100px;
    border: 2px solid #333;
    border-radius: 50%;
    display: grid; place-items: center;
    position: relative;
    background: rgba(0,0,0,0.6);
}

.metric-circle span {
    font-size: 28px; 
    font-family: 'Share Tech Mono'; 
    font-weight: bold;
    z-index: 2;
}

.metric-circle label {
    position: absolute; 
    bottom: -25px; 
    font-size: 14px; 
    color: var(--text-dim); 
    width: 100%; text-align: center;
}

.ring-svg {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

/* ============================
   5. 右侧专业面板 (Pro Panel)
   ============================ */
.pro-panel {
    position: absolute; 
    right: 0; top: 80px; bottom: 0; 
    width: 340px;
    background: var(--panel-bg);
    border-left: 1px solid #333;
    padding: 25px;
    transform: translateX(100%); /* 默认隐藏 */
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; gap: 20px;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.pro-panel.visible {
    transform: translateX(0);
}

.panel-header {
    margin: 0; padding-bottom: 10px;
    border-bottom: 1px solid #444;
    color: var(--primary);
    font-size: 18px; letter-spacing: 1px;
}

.chart-item { margin-bottom: 5px; }
.chart-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 5px; }
.chart-label { font-size: 12px; color: var(--text-dim); }
.chart-val { font-family: 'Share Tech Mono'; color: #fff; font-size: 16px; }

.bar-wrap { width: 100%; height: 4px; background: #222; }
.bar-fill { height: 100%; background: var(--primary); width: 0%; transition: width 0.2s; }

.divider { border-top: 1px solid #333; margin: 10px 0; }

.detail-row {
    display: flex; justify-content: space-between;
    font-size: 14px; color: var(--text-dim);
    border-bottom: 1px solid #222;
    padding: 8px 0;
}
.detail-val { color: #fff; font-family: 'Share Tech Mono'; }

.footer-info {
    margin-top: auto;
    font-size: 10px; color: #444; text-align: center;
}

/* ============================
   6. 模态框 (Modal) - 修复重点
   ============================ */
/* 修复：HTML中使用的是 class="modal"，这里必须对应 */
.modal {
    position: fixed;
    inset: 0; /* top/left/right/bottom: 0 */
    background: rgba(0,0,0,0.92);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    backdrop-filter: blur(5px);
    padding-top: 60px; 
    box-sizing: border-box; /* 确保 padding 不会撑破高度 */
}
.modal.hidden { display: none; }

/* 场景选择网格 */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    width: 90%;
}
.scene-card {
    border: 1px solid #333;
    padding: 30px;
    cursor: pointer;
    transition: 0.3s;
    background: rgba(255,255,255,0.03);
}
.scene-card:hover {
    border-color: var(--primary);
    background: rgba(0, 243, 255, 0.08);
    transform: translateY(-2px);
}
.scene-title { font-size: 20px; color: var(--primary); margin-bottom: 10px; font-weight: bold; }
.scene-desc { font-size: 14px; color: #aaa; line-height: 1.4; }

/* 认证框 (Auth Box) */
.auth-modal-overlay {
    /* 这其实也是一个模态框，可以复用 .modal 的样式，或者单独保留 */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 1001;
    display: none; justify-content: center; align-items: center;
}
.auth-modal-overlay.active { display: flex; }

.auth-box {
    background: #0a0a0a;
    border: 1px solid var(--primary);
    width: 400px;
    box-shadow: 0 0 40px rgba(0,243,255,0.1);
}
.auth-header { display: flex; border-bottom: 1px solid #333; }
.modal-tab {
    flex: 1; padding: 15px; text-align: center; cursor: pointer;
    color: #666; font-weight: bold; background: #080808;
    transition: 0.3s;
}
.modal-tab.active { background: var(--primary); color: #000; }

.close-modal {
    width: 50px; background: transparent; border: none;
    border-left: 1px solid #333; color: #666; font-size: 20px; cursor: pointer;
}
.close-modal:hover { color: var(--danger); }

.auth-form { padding: 30px; display: none; flex-direction: column; gap: 20px; }
.auth-form.active { display: flex; }

.form-group input {
    width: 100%; background: var(--input-bg);
    border: 1px solid #333; color: #fff;
    padding: 12px; font-family: 'Rajdhani'; font-size: 16px;
    outline: none; box-sizing: border-box;
}
.form-group input:focus { border-color: var(--primary); }

.captcha-group { display: flex; gap: 10px; }
.captcha-group img { height: 44px; border: 1px solid #333; cursor: pointer; }

/* ============================
   7. 按钮样式 (修复 "start-btn" 问题)
   ============================ */

/* 修复：原本缺失的 .start-btn 样式 */
.start-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 12px 40px; /* 增加左右内边距，防止太窄 */
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    min-width: 200px; /* 防止变形成细长条 */
    display: inline-block;
}

.start-btn:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    transform: scale(1.02);
}

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #555;
    color: #555;
}

/* ============================
   8. Context & Calibration 样式
   ============================ */
textarea#contextText {
    width: 80%;
    max-width: 600px;
    height: 150px;
    background: rgba(20, 24, 35, 0.8);
    border: 1px solid #333;
    color: #fff;
    padding: 20px;
    font-family: monospace;
    font-size: 14px;
    resize: none;
    outline: none;
    margin: 20px 0;
}
textarea#contextText:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
}

.calib-box {
    width: 400px; height: 8px;
    background: #222;
    margin: 30px 0;
    border-radius: 4px;
    overflow: hidden;
}
#calibBar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.05s ease-out;
    box-shadow: 0 0 10px var(--primary);
}

.report-content {
    max-width: 600px;
    font-size: 18px;
    line-height: 1.6;
    color: #ddd;
    margin-bottom: 30px;
    text-align: center;
}

/* 定义一个录音红点 */
.rec-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: var(--danger);
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 10px var(--danger);
    opacity: 0; /* 默认隐藏 */
    transition: opacity 0.3s;
}

/* 录音状态下的动画 */
.rec-dot.active {
    opacity: 1;
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 42, 109, 0.7); }
    70% { transform: scale(1.0); box-shadow: 0 0 0 10px rgba(255, 42, 109, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 42, 109, 0); }
}

/* 修改状态文字区域，让它支持 flex 布局以便放红点 */
.status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    /* 保持原有的字体样式 */
    font-size: 14px; 
    color: var(--warning); 
    text-transform: uppercase; 
    letter-spacing: 3px;
    margin-bottom: 10px;
}

/* style.css */

/* 报告模态框调整 */
#reportModal {
    justify-content: flex-start; /* 顶部对齐，防止内容过多被切掉 */
    padding-top: 50px; 
}

.report-title {
    color: var(--text-main);
    letter-spacing: 5px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-bottom: 30px;
    width: 80%;
    text-align: center;
}

/* === 关键需求：一行展示 Score 和 Risk === */
.report-header-row {
    display: flex;
    justify-content: center; /* 居中 */
    gap: 60px; /* 两个数据之间的间距 */
    width: 100%;
    margin-bottom: 20px;
}

.report-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.report-metric .label {
    font-size: 14px;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.report-metric .value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 48px;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(0,0,0,0.5);
}

/* 分隔线 */
.divider {
    width: 80%;
    height: 1px;
    background: #333;
    margin: 20px 0;
}

/* 内容滚动区 (防止内容太长溢出屏幕) */
.report-content-scroll {
    width: 80%;
    max-width: 800px;
    max-height: 50vh; /* 限制高度，超出滚动 */
    overflow-y: auto;
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border: 1px solid #333;
    margin-bottom: 20px;
}

/* 简单的 Markdown 样式 */
.md-content {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #ddd;
    text-align: left; /* 文本左对齐，阅读体验更好 */
}

.md-content strong {
    color: #fff;
    text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

.md-content ul {
    padding-left: 20px;
    margin: 10px 0;
}

.md-content li {
    margin-bottom: 8px;
    list-style-type: square;
    color: #ccc;
}

/* ============================
   9. NEW ADDITIONS (Loading, Homepage, Hints)
   ============================ */

/* Loading Spinner */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.loader {
    border: 4px solid rgba(0, 243, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Homepage / Protocol Modal Enhancements */
.hero-icon {
    font-size: 60px;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
    margin-bottom: 10px;
    animation: pulse-eye 3s infinite ease-in-out;
}
@keyframes pulse-eye {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); text-shadow: 0 0 30px var(--primary); }
}

.environment-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 191, 0, 0.1); /* Low opacity warning yellow */
    border: 1px solid rgba(255, 191, 0, 0.3);
    padding: 10px 20px;
    border-radius: 4px;
    margin-bottom: 25px;
    color: #ccc;
    font-size: 14px;
}
.environment-hint i { color: var(--warning); }

/* Calibration Heart Rate Display */
.calib-hr-display {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 25px;
    border-radius: 30px;
    border: 1px solid #333;
}
.calib-hr-val {
    font-family: 'Share Tech Mono';
    font-size: 24px;
    color: var(--primary);
    font-weight: bold;
}
.calib-hr-label {
    font-size: 12px;
    color: #666;
    letter-spacing: 1px;
}
#calibHeartIcon {
    transition: opacity 0.3s ease, text-shadow 0.3s ease;
    opacity: 0.3; /* 默认状态：暗淡 */
}
/* style.css */

/* --- HUD 专用 Loading --- */
.hud-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

/* 六边形或圆环旋转动画 */
.hex-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(0, 243, 255, 0.1);
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    border-radius: 50%; /* 如果想要六边形可以用 clip-path，这里用圆形更流畅 */
    animation: spin-reverse 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
    margin-bottom: 15px;
}

.loader-text {
    font-family: 'Share Tech Mono', monospace;
    color: var(--primary);
    font-size: 16px;
    letter-spacing: 2px;
    animation: pulse-text 1.5s infinite;
}

@keyframes spin-reverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; text-shadow: 0 0 8px var(--primary); }
}

/* =========================================
   10. TECH INTRO & DISCLAIMER STYLES (NEW)
   ========================================= */

/* Tech Introduction Grid (Homepage) */
.tech-intro-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 90%;
    max-width: 1000px;
    margin-bottom: 25px;
}

.tech-card {
    background: rgba(0, 243, 255, 0.03);
    border: 1px solid rgba(0, 243, 255, 0.1);
    padding: 15px;
    text-align: center;
    transition: 0.3s;
    border-radius: 4px;
}

.tech-card:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-5px);
}

.tech-card i {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.tech-card h4 {
    margin: 5px 0;
    color: #fff;
    font-size: 14px;
    letter-spacing: 1px;
}

.tech-card p {
    font-size: 11px;
    color: #aaa;
    line-height: 1.4;
    margin: 0;
}

/* Disclaimer Modal Styling */
.disclaimer-box {
    background: #0f111a;
    border: 1px solid var(--warning); /* Yellow border for caution */
    width: 500px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    position: relative;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.disclaimer-text {
    text-align: left;
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    max-height: 250px;
    overflow-y: auto;
    font-size: 14px;
    color: #ccc;
    border: 1px solid #333;
}

.disclaimer-text ul {
    padding-left: 20px;
}
.disclaimer-text li {
    margin-bottom: 8px;
}

.disclaimer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}

.disclaimer-actions a {
    text-decoration: none;
    font-size: 12px;
}
.config-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.config-row label {
    color: var(--text-dim);
    font-size: 14px;
}
.config-input {
    background: rgba(0,0,0,0.5);
    border: 1px solid #333;
    color: var(--primary);
    padding: 8px;
    width: 100px;
    text-align: center;
    font-family: 'Share Tech Mono';
}

/* 4. 线下辅助模式专用 UI (Copilot Mode) */
.copilot-alert {
    border: 1px solid var(--dang);
    background: rgba(255, 42, 109, 0.1);
    color: var(--dang);
    padding: 10px;
    margin-top: 10px;
    display: none; /* 默认隐藏 */
    animation: flash 2s infinite;
}
@keyframes flash { 0%{opacity:1} 50%{opacity:0.5} 100%{opacity:1} }


.full-width-input {
    width: 100%;
    box-sizing: border-box; /* 关键：包含 padding 在宽度内 */
    background: rgba(255,255,255,0.05);
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    font-family: monospace;
    margin-top: 5px;
    resize: none; /* 禁止拖拽改变大小 */
}
.full-width-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Custom Setup Modal 内部布局调整 */
#customSetupModal .form-group {
    margin-bottom: 15px;
}

.completion-box {
    text-align: center;
    padding: 40px;
    border: 1px solid var(--primary);
    background: rgba(0, 20, 30, 0.95);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
    max-width: 500px;
}
.completion-icon {
    font-size: 60px;
    color: var(--primary);
    margin-bottom: 20px;
    animation: pulse-check 2s infinite;
}
@keyframes pulse-check {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; text-shadow: 0 0 20px var(--primary); }
    100% { transform: scale(0.95); opacity: 0.8; }
}

#langBtn {
    background: transparent !important;  /* 强制去背景 */
    border: none !important;             /* 强制去边框 */
    box-shadow: none !important;         /* 强制去发光/阴影 */
    
    font-size: 11px;                     /* 字体调小 (原14px) */
    color: rgba(255, 255, 255, 0.3);     /* 颜色调暗，半透明白 */
    padding: 4px 8px;                    /* 减小内边距 */
    
    transition: color 0.3s ease;         /* 仅保留颜色过渡 */
}

/* 鼠标悬停时只亮起文字，不出框 */
#langBtn:hover {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--primary);               /* 悬停时变回青色 */
    opacity: 1;
}