/* ==================== 1. 全局配置 ==================== */
:root {
    --primary-color: #e0c090;     /* Web3D 主题金 */
    --bg-dark: #1a1a1a;           /* 深色背景 */
    --panel-bg: rgba(40, 40, 40, 0.85); /* 玻璃拟态背景 */
    --text-main: #f0f0f0;         /* 主文字色 */
    --text-muted: #aaa;           /* 辅助文字色 */
    --highlight-bg: rgba(224, 192, 144, 0.2); /* 高亮背景淡金 */
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==================== 2. Header & Logo ==================== */
.main-title {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
    z-index: 10;
}

.main-title img {
    height: 50px;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

.main-title img:hover {
    transform: scale(1.02);
}

/* ==================== 3. 顶部控制栏 (Flex布局) ==================== */
.top-controls-bar {
    display: flex;
    justify-content: space-between; /* 两端对齐 */
    align-items: stretch;           /* 等高 */
    gap: 15px;                      /* 间距 */
    width: 100%;
    max-width: 1400px;              /* 与视频宽度一致 */
    margin: 0 auto 20px auto;
}

/* --- 左侧：信息胶囊框 --- */
.task-info-box {
    flex: 1; /* 占据剩余空间 */
    display: flex;
    align-items: center;
    justify-content: space-between; /* 文字靠左，进度靠右 */
    
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px; /* 与视频圆角一致 */
    padding: 10px 20px;
    
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.info-icon {
    font-size: 1.2rem;
    margin-right: 10px;
    filter: grayscale(100%); /* 低调一点 */
}

.task-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-right: auto; /* 关键：将右侧元素推到最右边 */
}

/* --- 进度标签 Badge --- */
.progress-badge {
    font-size: 0.85rem;
    font-weight: bold;
    font-family: "Menlo", "Consolas", monospace; /* 等宽字体 */
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    margin-left: 15px; /* 与文字的间距 */
    
    /* 默认状态 */
    background: rgba(0, 0, 0, 0.3);
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.progress-badge.warning {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.1);
    animation: pulse-border 2s infinite;
}

.progress-badge.success {
    color: #2ecc71; /* 鲜亮绿 */
    border-color: rgba(46, 204, 113, 0.3);
    background: rgba(46, 204, 113, 0.1);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.2);
}

@keyframes pulse-border {
    0% { border-color: rgba(255, 107, 107, 0.3); }
    50% { border-color: rgba(255, 107, 107, 0.8); }
    100% { border-color: rgba(255, 107, 107, 0.3); }
}

/* --- 右侧：返回按钮 (独立样式) --- */
#return-button {
    flex-shrink: 0; /* 不允许压缩 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
    
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    
    background: rgba(255, 255, 255, 0.05); /* 默认透明黑 */
    color: rgba(255, 255, 255, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px; /* 与左侧框一致 */
    
    cursor: not-allowed;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 激活状态 */
#return-button.active {
    cursor: pointer;
    background: var(--primary-color); /* 金色 */
    color: #1a1a1a; /* 深色文字 */
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(224, 192, 144, 0.3);
    transform: translateY(0);
}

#return-button.active:hover {
    background: #fff;
    border-color: #fff;
    transform: translateY(-2px); /* 微微上浮 */
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 768px) {
    .top-controls-bar {
        flex-direction: column; /* 竖向排列 */
        gap: 10px;
    }
    
    .task-info-box {
        flex-wrap: wrap; /* 内容多时换行 */
        justify-content: center;
        text-align: center;
    }
    
    .task-text {
        margin-right: 0;
        margin-bottom: 8px;
        width: 100%;
    }
    
    #return-button {
        width: 100%;
        padding: 12px 0;
    }
}
/* ==================== 4. 语言切换器 ==================== */
.lang-switcher {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    z-index: 100;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.lang-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: inherit;
    padding: 4px 6px;
    transition: all 0.3s;
    font-family: inherit;
    border-radius: 4px;
}

.lang-btn:hover { color: white; background: rgba(255,255,255,0.1); }

.lang-btn.active {
    color: var(--primary-color);
    font-weight: bold;
    background: transparent; /* 去掉背景 */
    
    /* 添加底部发光线 */
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 2px; /* 给下划线留点呼吸空间 */
    
    /* 可选：文字微发光 */
    text-shadow: 0 0 8px rgba(224, 192, 144, 0.4);
}

.divider { color: rgba(255, 255, 255, 0.2); font-size: 12px; }

/* ==================== 5. 视频容器 ==================== */
#video-wrapper {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    gap: 25px;
    align-items: flex-start;
    position: relative;
}

#experiment-video {
    flex: 1;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    background: #000;
    border: 1px solid var(--border-color);
    aspect-ratio: 16/9;
}

/* ==================== 6. 笔记面板 ==================== */
.notes-panel {
    width: 400px;
    height: 600px;
    max-height: 80vh;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    flex-shrink: 0;
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
}

.notes-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: 0.5px;
}

.notes-header button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.notes-header button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.notes-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column-reverse; /* 新笔记在上方 */
    gap: 12px;
}

/* 滚动条 */
.notes-content::-webkit-scrollbar { width: 6px; }
.notes-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.notes-content::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

/* 笔记条目 */
.note-item {
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #666;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
    transition: all 0.3s ease;
    animation: fadeInUp 0.4s ease-out;
}

.note-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
    border-left-color: var(--primary-color);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 关键词高亮 */
.keyword-highlight {
    background: var(--highlight-bg);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    border-bottom: 1px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(224, 192, 144, 0.15);
    display: inline-block;
}

/* ==================== 7. 响应式适配 ==================== */
@media (max-width: 1024px) {
    #video-wrapper { flex-direction: column; }
    .notes-panel { width: 100%; height: 300px; }
}

/* ==================== 移动端适配 (最终修复版) ==================== */
@media (max-width: 768px) {
    /* 1. 修复语言切换器重叠问题 */
    .lang-switcher {
        position: relative; /* 取消绝对定位 */
        top: auto;
        right: auto;
        
        /* 让它排在 Logo 下方并居中 */
        margin: 0 auto 15px auto; 
        justify-content: center;
        width: fit-content; /* 宽度自适应内容 */
        
        /* 稍微缩小一点字体和内边距 */
        padding: 4px 12px;
        font-size: 13px;
    }

    /* 2. 调整标题 Logo 间距 */
    .main-title {
        margin-top: 10px;
        margin-bottom: 10px; /* 减小下间距，因为下面有语言条了 */
    }
    .main-title img { 
        height: 40px; /* 稍微缩小 Logo */
    }
    
    /* 3. 顶部控制栏变为竖排 */
    .top-controls-bar {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 15px;
    }
    
    /* 4. 任务说明框适配 */
    .task-info-box {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        padding: 12px;
        border-radius: 16px;
    }
    
    .task-text {
        margin-right: 0;
        margin-bottom: 8px;
        width: 100%;
        font-size: 0.85rem;
    }
    
    /* 5. 进度标签和按钮 */
    .progress-badge {
        margin-left: 0; /* 移除左边距 */
        font-size: 0.8rem;
    }
    
    #return-button {
        width: 100%; /* 按钮占满全宽，方便点击 */
        padding: 10px 0;
        margin-top: 5px;
    }
    
    /* 6. 视频播放器圆角调整 */
    #experiment-video { 
        border-radius: 8px; 
    }
}