:root {
    --bg-color: #f4f6f9;
    --panel-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary-color: #2563eb;
    --primary-light: rgba(37, 99, 235, 0.08);
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
    --radius-sm: 6px;
    --radius-md: 10px;
    --highlight-bg: #fef08a;
    --highlight-color: #854d0e;
    --bilibili-color: #00aeec;
}

/* 深色模式变量 override */
body.dark-mode {
    --bg-color: #0f172a;
    --panel-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --primary-color: #3b82f6;
    --primary-light: rgba(59, 130, 246, 0.2);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --highlight-bg: #854d0e;
    --highlight-color: #fef08a;
    background-image: radial-gradient(#334155 1px, transparent 1px);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
    padding-bottom: env(safe-area-inset-bottom);
    transition: background-color 0.3s, color 0.3s;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* 按钮通用 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    min-height: 38px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13.5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover, .btn:active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.theme-toggle-btn {
    font-size: 16px;
    padding: 6px 12px;
    border-radius: 20px;
}

header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 12px 0;
    transition: background 0.3s;
}

body.dark-mode header {
    background: rgba(30, 41, 59, 0.9);
}

header .container { display: flex; justify-content: space-between; align-items: center; }
header h1 a { font-size: 20px; font-weight: 700; color: var(--text-primary); }

.nav-wrapper { display: flex; align-items: center; gap: 16px; }
header nav ul { display: flex; gap: 20px; }
header nav a { font-size: 14px; font-weight: 500; color: var(--text-secondary); padding: 6px 0; display: inline-block; }
header nav a:hover, header nav a.active { color: var(--primary-color); font-weight: 600; }

main { padding: 24px 0; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-description { color: var(--text-secondary); margin-bottom: 20px; font-size: 14px; }

/* 搜索框与热门词 */
.search-box-wrapper { margin-bottom: 12px; }
#search-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.hot-searches {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.hot-tag {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.hot-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

/* 关键词高亮 */
mark.search-highlight {
    background-color: var(--highlight-bg);
    color: var(--highlight-color);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* FAQ 卡片 */
.faq-item {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    padding: 18px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.faq-item:target {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    transform: translateY(-2px);
}

.faq-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.faq-question { color: var(--text-primary); font-size: 16px; font-weight: 600; line-height: 1.4; }

.product-tag {
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.faq-body { display: flex; gap: 16px; color: var(--text-secondary); font-size: 14px; }
.faq-text { flex: 1; word-break: break-word; }
.faq-media { width: 140px; flex-shrink: 0; }
.faq-media img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border-color); display: block; }

/* 视频嵌入与 B 站备用按钮 */
.faq-video-container {
    margin-top: 14px;
}

.faq-video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000000;
    box-shadow: var(--shadow-sm);
}

.faq-video-wrapper iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%; border: none;
}

.faq-video-fallback {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
}

.bilibili-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--bilibili-color);
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.bilibili-link-btn:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* FAQ 底部操作栏（复制/反馈） */
.faq-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.faq-tools { display: flex; gap: 8px; }
.tool-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover { color: var(--primary-color); border-color: var(--primary-color); }

.faq-feedback { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.feedback-btn {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-btn:hover, .feedback-btn.voted {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

/* 产品的横向滑块选项 */
.product-selector {
    display: flex; gap: 8px; overflow-x: auto; white-space: nowrap; padding-bottom: 8px; margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}
.product-selector::-webkit-scrollbar { display: none; }
.product-btn {
    padding: 8px 16px; min-height: 38px; background: var(--panel-bg); border: 1px solid var(--border-color);
    color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; flex-shrink: 0; font-size: 13.5px;
}
.product-btn.active { background: var(--primary-color); border-color: var(--primary-color); color: #ffffff; }

/* 缺省/搜索无结果面板与客服兜底 */
.empty-result-box {
    text-align: center;
    padding: 40px 20px;
    background: var(--panel-bg);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 10px;
}
.empty-result-title { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-result-desc { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 16px; }

/* 联系人工客服 Modal 弹窗 */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all 0.2s ease; padding: 16px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-width: 440px; width: 100%;
    padding: 24px; box-shadow: var(--shadow-md);
    position: relative; transform: scale(0.95); transition: transform 0.2s ease;
}
.modal-overlay.active .modal-card { transform: scale(1); }

.modal-close {
    position: absolute; top: 14px; right: 14px; background: transparent; border: none;
    font-size: 20px; cursor: pointer; color: var(--text-secondary);
}

.modal-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.modal-desc { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 16px; }

.wechat-box {
    background: var(--primary-light);
    border: 1px dashed var(--primary-color);
    padding: 14px; border-radius: var(--radius-sm);
    text-align: center; margin-bottom: 16px;
}
.wechat-id { font-size: 18px; font-weight: 800; color: var(--primary-color); letter-spacing: 1px; user-select: all; }

/* 全局 Toast 提示 */
.toast-msg {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1e293b; color: #ffffff; padding: 10px 20px; border-radius: 20px;
    font-size: 13px; z-index: 3000; opacity: 0; pointer-events: none; transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
body.dark-mode .toast-msg { background: #f8fafc; color: #0f172a; }
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 参数表、下载等通用 */
.download-list li {
    background: var(--panel-bg); border: 1px solid var(--border-color); padding: 16px;
    margin-bottom: 12px; border-radius: var(--radius-md); display: flex;
    justify-content: space-between; align-items: center; gap: 16px;
}

.filter-panel {
    background: var(--panel-bg); padding: 16px; border-radius: var(--radius-md);
    border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.filter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.filter-title { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.result-count {
    font-size: 12px; background: var(--primary-light); color: var(--primary-color);
    border: 1px solid rgba(37, 99, 235, 0.2); padding: 3px 10px; border-radius: 20px; font-weight: 600;
}
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.filter-input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); font-size: 16px; background: var(--panel-bg); color: var(--text-primary);
}

.table-card { background: var(--panel-bg); border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-wrapper { width: 100%; overflow-x: auto; max-height: 68vh; }
.custom-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13.5px; white-space: nowrap; }
.custom-table th, .custom-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-color); }
.custom-table tbody tr:nth-child(even) { background-color: rgba(0,0,0,0.02); }
.custom-table th { background: var(--bg-color); color: var(--text-primary); font-weight: 700; position: sticky; top: 0; z-index: 10; }
.custom-table th:first-child, .custom-table td:first-child {
    position: sticky; left: 0; z-index: 11; font-weight: 700; color: var(--text-primary); background: var(--panel-bg);
}
.custom-table th:first-child { background: var(--bg-color); z-index: 12; }
.highlight-val { color: var(--primary-color); font-weight: 700; }

.loading-status { text-align: center; padding: 30px 20px; color: var(--text-secondary); background: var(--panel-bg); border: 1px dashed var(--border-color); border-radius: var(--radius-md); font-size: 14px; }

footer { text-align: center; padding: 24px 16px; color: var(--text-secondary); font-size: 12px; border-top: 1px solid var(--border-color); margin-top: 40px; background: var(--panel-bg); }

/* 移动端处理 */
@media (max-width: 768px) {
    header nav ul { gap: 12px; overflow-x: auto; white-space: nowrap; max-width: 50vw; -webkit-overflow-scrolling: touch; }
    header nav ul::-webkit-scrollbar { display: none; }
    header nav a { font-size: 13px; }

    .faq-body { flex-direction: column-reverse; }
    .faq-media { width: 100%; }

    .download-list li { flex-direction: column; align-items: flex-start; }
    .download-list .btn { width: 100%; margin-top: 8px; }

    .table-wrapper { max-height: none; overflow-x: visible; }
    .custom-table, .custom-table tbody, .custom-table tr, .custom-table td { display: block; width: 100%; white-space: normal; }
    .custom-table thead { display: none; }
    .custom-table tbody tr { margin-bottom: 16px; background: var(--panel-bg) !important; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px 16px; box-shadow: var(--shadow-sm); }
    .custom-table td { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border-color); font-size: 13.5px; text-align: right; }
    .custom-table td:last-child { border-bottom: none; }
    .custom-table td::before { content: attr(data-label); font-weight: 600; color: var(--text-secondary); text-align: left; padding-right: 12px; }
    .custom-table td:first-child { position: static; box-shadow: none; background: transparent !important; font-size: 16px; color: var(--primary-color); border-bottom: 2px solid var(--border-color); padding-bottom: 10px; margin-bottom: 4px; }
    .custom-table td:first-child::before { content: "产品型号"; color: var(--text-primary); }
}