/* ============================================================
 * Metairie 科技创新模块样式(css/tech.css)
 * v91 新增:与主站共享 styles.css 的主题变量,这里只放模块专属规则。
 * 红线:颜色只走主题变量(带语义的数据色除外)/ 尊重 prefers-reduced-motion / 无 emoji。
 * ============================================================ */

/* 面板自己滚(与 .finance-panel / .forum-panel 同一约定:body/html 是 overflow:hidden) */
.tech-panel {
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 18px 24px;
}

/* ===== 头部 ===== */
.tech-header { display: flex; flex-direction: column; gap: 6px; }
.tech-header h2 { font-size: 21px; }
.tech-subtitle { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.tech-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--warning);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.55;
}

/* ===== 一级标签(照 .geo-tab 的视觉,独立实现)===== */
.tech-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
}
.tech-tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    padding: 8px 14px 10px;
    white-space: nowrap;
    transition: color 0.18s ease, border-color 0.18s ease;
}
.tech-tab:hover { color: var(--text-primary); }
.tech-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== 通用 chips(筛选 / 语言 / 难度 / 主题)===== */
.tech-chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tech-chip-row-label { font-size: 12.5px; color: var(--text-muted); margin-right: 2px; }
.tech-chip {
    appearance: none;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 5px 13px;
    font-size: 12.5px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tech-chip:hover { color: var(--text-primary); border-color: var(--border-light); }
.tech-chip.active {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* ===== 排行榜 ===== */
.tech-rank-bar { display: flex; flex-direction: column; gap: 10px; }
.tech-search {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 420px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
}
.tech-search svg { flex: 0 0 auto; color: var(--text-muted); }
.tech-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13.5px;
}

.tech-top3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tech-top3-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.tech-top3-card:hover { border-color: var(--accent); background: var(--accent-light); }
.tech-top3-rank {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.tech-top3-card.is-1 .tech-top3-rank { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.tech-top3-card.is-2 .tech-top3-rank { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }
.tech-top3-card.is-3 .tech-top3-rank { background: rgba(180, 121, 63, 0.18); color: #b4793f; }
.tech-top3-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tech-top3-body b { font-size: 14.5px; }
.tech-top3-body small { color: var(--text-muted); font-size: 11.5px; }
.tech-top3-score {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
}

.tech-rank { width: 100%; border-collapse: collapse; }
.tech-rank th {
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 1;
}
.tech-rank td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
    vertical-align: middle;
}
.tech-rank tbody tr { cursor: pointer; transition: background-color 0.14s ease; }
.tech-rank tbody tr:hover { background: var(--bg-hover); }
.tech-rank tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tech-rank .is-rank { width: 64px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.tech-rank .is-score { width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
.tech-rank .is-score b { color: var(--accent); }
.tech-rank .is-type { width: 84px; }
.tech-rank .is-score, .tech-rank th.is-score { text-align: right; }
.tech-medal {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.tech-medal.is-1 { background: #f59e0b; }
.tech-medal.is-2 { background: #94a3b8; }
.tech-medal.is-3 { background: #b4793f; }
.tech-cell-model { display: flex; flex-direction: column; gap: 1px; }
.tech-cell-model b { font-size: 13.5px; }
.tech-cell-model small { color: var(--text-muted); font-size: 11.5px; }
.tech-cell-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.tech-rank-empty, .tech-rank-note { padding: 14px 10px; color: var(--text-muted); font-size: 12.5px; }
.tech-rank-note { padding-top: 10px; }

/* 类型徽标与标签(语义色:开源=绿系 / 闭源=蓝系,与数据色豁免一致) */
.tech-lic {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 16px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.tech-lic.is-open { color: #047857; border-color: rgba(4, 120, 87, 0.35); background: rgba(16, 185, 129, 0.12); }
.tech-lic.is-closed { color: #1d4ed8; border-color: rgba(29, 78, 216, 0.3); background: rgba(59, 130, 246, 0.12); }
.tech-lic.is-local { color: #c2410c; border-color: rgba(194, 65, 12, 0.35); background: rgba(249, 115, 22, 0.12); }
.tech-tag {
    display: inline-flex;
    padding: 1px 7px;
    border-radius: 6px;
    font-size: 10.5px;
    line-height: 15px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.tech-tag.is-reason { color: #7c3aed; border-color: rgba(124, 58, 237, 0.3); background: rgba(139, 92, 246, 0.1); }
.tech-tag.is-mm { color: #0e7490; border-color: rgba(14, 116, 144, 0.3); background: rgba(6, 182, 212, 0.1); }
.tech-tag.is-cn { color: #b45309; border-color: rgba(180, 83, 9, 0.3); background: rgba(245, 158, 11, 0.1); }
.tech-tag.is-agent { color: #be185d; border-color: rgba(190, 24, 93, 0.3); background: rgba(236, 72, 153, 0.1); }

/* ===== 详情抽屉(覆盖层,与 .modal-overlay 同款遮罩)===== */
.tech-detail {
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.tech-detail[hidden] { display: none; }
.tech-detail-card {
    width: min(560px, 100%);
    max-height: min(640px, 90vh);
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}
.tech-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tech-detail-head h3 { font-size: 17px; }
.tech-detail-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.tech-detail-close {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
}
.tech-detail-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.tech-detail-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tech-detail-desc { font-size: 13.5px; line-height: 1.65; color: var(--text-primary); }
.tech-detail-links { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.tech-detail-links-title { font-size: 12px; color: var(--text-muted); }
.tech-detail-links a {
    color: var(--accent);
    font-size: 13px;
    text-decoration: none;
}
.tech-detail-links a:hover { text-decoration: underline; }
.tech-ai-box { margin-top: 14px; border-top: 1px dashed var(--border-color); padding-top: 12px; }
.tech-ai-btn {
    appearance: none;
    border: 1px solid var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 9px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.tech-ai-btn:hover { filter: brightness(1.06); }
.tech-ai-body { margin-top: 10px; font-size: 13px; line-height: 1.7; color: var(--text-secondary); white-space: pre-wrap; }

/* ===== 代码学堂 ===== */
.tech-code-controls { display: flex; flex-direction: column; gap: 10px; }
.tech-code-generate {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    appearance: none;
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}
.tech-code-generate:hover { filter: brightness(1.08); }
.tech-code-generate:active { transform: translateY(1px); }
.tech-code-generate:disabled { opacity: 0.55; cursor: not-allowed; }
.tech-code-generate.is-ghost {
    background: var(--bg-secondary);
    color: var(--accent);
    border: 1px solid var(--accent);
}
.tech-code-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ===== 课程进度(v92 系统课程)===== */
.tech-course-bar { display: flex; align-items: center; gap: 12px; }
.tech-course-progress {
    flex: 1;
    min-width: 120px;
    max-width: 340px;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.tech-course-progress i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.tech-course-text { font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tech-chip.is-quiet { border-style: dashed; font-size: 11.5px; padding: 3px 10px; color: var(--text-muted); }
.tech-chip.is-quiet:hover { color: var(--text-primary); }
.tech-chip.is-topic .tech-chip-check { display: none; }
.tech-chip.is-topic.is-done .tech-chip-check {
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-left: 5px;
    vertical-align: -1px;
    color: #047857;
}

/* ===== 虚拟控制台(v92)===== */
.tech-console { border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; background: var(--bg-primary); }
.tech-console-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}
.tech-console-head b { font-size: 12.5px; color: var(--text-secondary); }
.tech-console-mode {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}
.tech-console-mode.is-js, .tech-console-mode.is-py { color: #047857; border-color: rgba(4, 120, 87, 0.35); background: rgba(16, 185, 129, 0.12); }
.tech-console-mode.is-html { color: #1d4ed8; border-color: rgba(29, 78, 216, 0.3); background: rgba(59, 130, 246, 0.12); }
.tech-console-mode.is-sim { color: #c2410c; border-color: rgba(194, 65, 12, 0.35); background: rgba(249, 115, 22, 0.12); }
.tech-console-actions { margin-left: auto; display: flex; gap: 6px; }
.tech-console-btn {
    appearance: none;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 7px;
    padding: 4px 11px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.tech-console-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.tech-console-btn.is-run {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.tech-console-btn.is-run:hover { filter: brightness(1.08); color: #fff; }
.tech-console-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.tech-console-in {
    display: block;
    width: 100%;
    min-height: 132px;
    resize: vertical;
    border: 0;
    outline: none;
    padding: 12px 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    tab-size: 4;
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
}
.tech-console-out {
    margin: 0;
    padding: 10px 14px 12px;
    min-height: 54px;
    max-height: 280px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-secondary);
}
.tech-console-line { display: block; white-space: pre-wrap; word-break: break-word; }
.tech-console-line.is-log { color: var(--text-primary); }
.tech-console-line.is-err { color: #dc2626; }
.tech-console-line.is-warn { color: #d97706; }
.tech-console-line.is-muted { color: var(--text-muted); }
.tech-console-line.is-sim { color: #c2410c; font-weight: 600; }
.tech-console-frame { width: 100%; height: 250px; border: 0; background: #fff; }

.tech-lesson {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-secondary);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tech-lesson-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tech-lesson-head h3 { font-size: 16.5px; }
.tech-lesson-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.tech-lesson-summary { font-size: 13.5px; line-height: 1.65; color: var(--text-secondary); }
.tech-lesson-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.tech-point {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-primary);
}
.tech-point b { font-size: 13px; }
.tech-point span { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }

.tech-codebox { border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; background: var(--bg-primary); }
.tech-codebox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}
.tech-copy {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    appearance: none;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 7px;
    padding: 3px 9px;
    font-size: 11.5px;
    cursor: pointer;
    font-family: inherit;
}
.tech-copy:hover { color: var(--text-primary); border-color: var(--border-light); }
.tech-pre {
    margin: 0;
    padding: 13px 14px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.62;
    color: var(--text-primary);
    tab-size: 4;
}
.tech-code-note { padding: 8px 13px; font-size: 12px; color: var(--text-muted); border-top: 1px dashed var(--border-color); }

/* 高亮 token 语义色(数据色豁免:代码着色遵循通用惯例) */
.tk-c { color: #6b7280; font-style: italic; }
.tk-s { color: #16a34a; }
.tk-k { color: #7c3aed; font-weight: 600; }
.tk-n { color: #ea580c; }
.tk-t { color: #0e7490; }

.tech-tips, .tech-exercise {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 13px;
    line-height: 1.65;
}
.tech-tips { background: var(--bg-primary); }
.tech-tips b, .tech-exercise b { display: block; margin-bottom: 5px; font-size: 12.5px; color: var(--text-secondary); }
.tech-tips ul { margin: 0; padding-left: 18px; }
.tech-exercise { background: var(--accent-light); border-color: var(--accent-light); }
.tech-exercise p { margin: 0; }
.tech-exercise-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.tech-lesson-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 42px 0;
    color: var(--text-muted);
    font-size: 13.5px;
}
.tech-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: tech-spin 0.9s linear infinite;
}
@keyframes tech-spin { to { transform: rotate(360deg); } }

/* 入场动画(尊重 prefers-reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
    .tech-lesson { animation: tech-in 0.28s ease both; }
    .tech-top3-card { animation: tech-in 0.26s ease both; }
    .tech-top3-card:nth-child(2) { animation-delay: 0.05s; }
    .tech-top3-card:nth-child(3) { animation-delay: 0.1s; }
    @keyframes tech-in {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* 响应式 */
@media (max-width: 860px) {
    .tech-panel { padding: 12px 12px 20px; }
    .tech-top3 { grid-template-columns: 1fr; }
    .tech-rank .is-type { display: none; }
    .tech-lesson-points { grid-template-columns: 1fr; }
    .tech-console-actions { margin-left: 0; width: 100%; }
    .tech-course-bar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    .tech-tab, .tech-chip, .tech-top3-card, .tech-rank tbody tr, .tech-code-generate, .tech-console-btn { transition: none; }
    .tech-course-progress i { transition: none; }
    .tech-spinner { animation-duration: 1.6s; }
}
