/* =========================================
   🎨 配色系统
   ========================================= */
:root {
    --bg-body: #f3f4f6;       
    --bg-card: #ffffff;       
    --bg-header: #f8fafc;     
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --c1: #0d9488;
    --c1-bg: rgba(13, 148, 136, 0.1);
    --c2: #4f46e5;
    --c2-bg: rgba(79, 70, 229, 0.1);
    --radius: 12px;           
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-header: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --c1: #2dd4bf;
    --c1-bg: rgba(45, 212, 191, 0.15);
    --c2: #818cf8;
    --c2-bg: rgba(129, 140, 248, 0.15);
}

body { font-family: 'Inter', sans-serif; background: var(--bg-body); color: var(--text-main); margin: 0; padding: 0; line-height: 1.5; transition: background 0.3s ease; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px; }

.navbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; padding: 15px 0; }
.logo { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 700; color: var(--text-main); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--text-muted); font-weight: 400; }
.theme-toggle-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; color: var(--text-muted); font-size: 13px; font-weight: 500; }

.hero-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 20px; text-align: center; margin-bottom: 40px; box-shadow: var(--shadow); }
.hero-title { font-size: 2rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.03em; }
.hero-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

.compare-inputs { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.input-group { position: relative; flex: 1; min-width: 220px; max-width: 320px; }
input { width: 100%; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-body); color: var(--text-main); outline: none; box-sizing: border-box; font-family: 'Inter', sans-serif; transition: all 0.2s; }
input:focus { border-color: var(--c1); box-shadow: 0 0 0 3px var(--c1-bg); background: var(--bg-card); }
.btn-search { background: var(--text-main); color: var(--bg-body); border: none; padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.btn-search:hover { opacity: 0.9; }
.vs-badge { font-family: 'JetBrains Mono', monospace; font-weight: 800; font-style: italic; color: var(--text-muted); opacity: 0.5; }

.autocomplete-items { position: absolute; border: 1px solid var(--border); border-top: none; z-index: 99; top: 100%; left: 0; right: 0; background: var(--bg-card); border-radius: 0 0 8px 8px; max-height: 250px; overflow-y: auto; box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.autocomplete-items div { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); display: flex; justify-content: space-between; }
.autocomplete-items div strong { color: var(--c1); }
.autocomplete-items div:hover { background: var(--bg-header); color: var(--text-main); }
.autocomplete-active { background-color: var(--c1) !important; color: #ffffff !important; }
.autocomplete-active strong { color: #ffffff !important; }

/* 1. 修复裁切问题：把原本的 overflow: hidden 拿掉！改用 visible */
.spec-group-card { 
    background: var(--bg-card); 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    margin-bottom: 24px; 
    overflow: visible; /* 👈 解开封印 */
    box-shadow: var(--shadow); 
}

/* 因为拿掉了 hidden，要手动给标题加上圆角，不然左上右上的角会刺出去 */
.card-header { 
    background: var(--bg-header); 
    padding: 16px 24px; 
    border-bottom: 1px solid var(--border); 
    font-size: 12px; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: var(--text-muted); 
    border-top-left-radius: calc(var(--radius) - 1px);
    border-top-right-radius: calc(var(--radius) - 1px);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
.col-header { padding: 12px 24px; border-bottom: 2px solid var(--border); font-weight: 700; color: var(--text-main); width: 35%; }
.col-label { width: 30%; color: var(--text-muted); font-weight: 500; }
td { padding: 14px 24px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.val-col { font-family: 'JetBrains Mono', monospace; color: var(--text-main); font-weight: 500; }
.win-bg { background-color: rgba(16, 185, 129, 0.12); color: #047857; font-weight: 600; }
[data-theme="dark"] .win-bg { background-color: rgba(16, 185, 129, 0.2); color: #6ee7b7; }

/* 📐 仪表盘样式 */
.visualizer-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 24px; overflow: hidden; box-shadow: var(--shadow); }
.vis-dashboard { display: flex; flex-direction: row; min-height: 340px; }
.vis-panel-left { flex: 4; background: var(--bg-header); border-right: 1px solid var(--border); padding: 30px; display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.vis-panel-right { flex: 6; background: var(--bg-card); padding: 20px; display: flex; align-items: center; justify-content: center; position: relative; }
.vis-item { display: flex; flex-direction: column; gap: 6px; }
.vis-head { font-size: 15px; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.vis-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.vis-dot.c1 { background: var(--c1); }
.vis-dot.c2 { background: var(--c2); }
.vis-sub { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); font-family: 'JetBrains Mono'; }
.vis-track { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.vis-fill { height: 100%; border-radius: 3px; }
.vis-fill.c1 { background: var(--c1); }
.vis-fill.c2 { background: var(--c2); }
.vis-diff { margin-top: 10px; font-size: 12px; color: #10b981; font-weight: 600; background: rgba(16, 185, 129, 0.1); padding: 4px 10px; border-radius: 20px; align-self: flex-start; }
.sensor-rect { stroke-width: 1.5px; transition: all 0.5s ease; }
.rect-c1 { fill: var(--c1-bg); stroke: var(--c1); }
.rect-c2 { fill: var(--c2-bg); stroke: var(--c2); }
.vis-label { font-family: 'JetBrains Mono'; font-size: 11px; font-weight: 600; }

/* 📊 性能评分条样式 */
.perf-container { padding: 20px; }
.perf-row { display: flex; align-items: center; margin-bottom: 16px; font-size: 13px; }
.perf-label { width: 100px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.perf-bars { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bar-wrapper { display: flex; align-items: center; gap: 10px; height: 24px; }
.bar-track { flex: 1; background: var(--bg-body); height: 8px; border-radius: 4px; overflow: hidden; border:1px solid var(--border); }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.fill-c1 { background: var(--c1); }
.fill-c2 { background: var(--c2); }
.score-text { font-family: 'JetBrains Mono'; font-weight: 700; font-size: 12px; width: 40px; text-align: right; }
.perf-note { font-size: 11px; color: var(--text-muted); margin-top: 4px; opacity: 0.8; font-weight: 400; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; /* 让手机端滑动更丝滑 */ }
/* 🔗 推荐列表样式 (阿谦极简横向版) */
.related-grid { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.related-card { background: var(--bg-body); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: row; align-items: center; justify-content: space-between; transition: all 0.2s ease; }
/* 列表模式下，滑鼠移过去改成往右边稍微浮动一点点，会很帅喔！ */
.related-card:hover { transform: translateX(4px); border-color: var(--c1); box-shadow: 4px 4px 15px var(--c1-bg); }
.rel-title { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; color: var(--text-main); flex: 1; }
.rel-actions { display: flex; gap: 10px; align-items: center; }
.btn-rel-view { background: var(--bg-header); border: 1px solid var(--border); color: var(--text-main); padding: 6px 16px; border-radius: 6px; font-size: 12px; cursor: pointer; text-align: center; font-weight: 600; text-decoration: none; transition: background 0.2s; }
.btn-rel-view:hover { background: var(--text-main); color: var(--bg-body); }
.btn-rel-vs { background: var(--c1-bg); border: 1px solid var(--c1); color: var(--c1); padding: 6px 16px; border-radius: 6px; font-size: 12px; cursor: pointer; text-align: center; font-weight: 700; text-decoration: none; transition: background 0.2s; }
.btn-rel-vs:hover { background: var(--c1); color: #ffffff; }

/* 💡 阿谦特制：超帅气 Tooltip 悬浮框样式 */
.has-tooltip, .text-tooltip {
    position: relative;
    cursor: help;
}

/* 💡 给表格列名的专属 Tooltip 样式 */
/* 💡 给表格列名的专属 Tooltip 样式 (进化版：CSS 放大镜) */
.label-tooltip {
    position: relative;
    cursor: help;
    display: inline-flex; /* ✨ 用 Flex 让文字跟放大镜完美并排！ */
    align-items: center;
    gap: 5px; /* 文字跟放大镜的距离 */
    transition: color 0.2s;
}
/* 滑鼠碰到或是锁定的时候，文字变色 */
.label-tooltip:hover, .label-tooltip.is-locked {
    color: var(--text-main); 
}

/* 🔍 纯 CSS 画出来的超迷你放大镜 */
.mag-glass {
    position: relative;
    width: 9px;
    height: 9px;
    border: 1.5px solid var(--text-muted);
    border-radius: 50%;
    flex-shrink: 0;
    transition: border-color 0.2s;
    box-sizing: border-box;
    top: -1px; /* 稍微往上抬一点点，视觉上会更平衡 */
}
/* 放大镜的握柄 */
.mag-glass::after {
    content: "";
    position: absolute;
    bottom: -3px;
    right: -2.5px;
    width: 4.5px;
    height: 1.5px;
    background-color: var(--text-muted);
    transform: rotate(45deg);
    transition: background-color 0.2s;
    border-radius: 1px;
}

/* 连动变色魔法：跟着文字一起发光！ */
.label-tooltip:hover .mag-glass, 
.label-tooltip.is-locked .mag-glass {
    border-color: var(--c1);
}
.label-tooltip:hover .mag-glass::after, 
.label-tooltip.is-locked .mag-glass::after {
    background-color: var(--c1);
}

.tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 250px;
    /* 固定用深色背景，这样不管深色浅色模式都很有极客感 */
    background-color: #1e293b; 
    color: #f8fafc;
    text-align: left;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 999;
    /* 定位在文字正上方 */
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    white-space: normal;
    line-height: 1.5;
    pointer-events: none; /* 避免滑鼠滑到一半闪烁 */
}

/* 小小的三角形指示箭头 */
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

/* 滑鼠碰到就会弹出来！ */
.has-tooltip:hover .tooltip-text,
.text-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 如果是 Tag 里面的 tooltip，稍微往下挪一点，因为 Tag 本身有 padding */
.spec-tag.has-tooltip {
    border-color: var(--c1);
    background: var(--c1-bg);
}

    /* =========================================
   💡 阿谦的终极全域 Tooltip 样式引擎
   ========================================= */
.has-tooltip, .text-tooltip { position: relative; cursor: help; }
.text-tooltip { color: var(--c1); font-weight: 600; border-bottom: 1px dashed var(--c1); }
.spec-tag.has-tooltip { border-color: var(--c1); background: var(--c1-bg); }

/* 这个框框直接贴在 body 上，突破所有裁切限制！ */
#global-tooltip {
    position: absolute; 
    z-index: 99999; /* 突破天际的 z-index */
    background-color: #1e293b; 
    color: #f8fafc;
    width: max-content;
    max-width: 250px;
    text-align: left;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    white-space: normal;
    line-height: 1.5;
    pointer-events: none; /* 预设不能点，才不会闪烁 */
    
    /* 动画过渡 */
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

#global-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* 小三角形 */
#global-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

/* 锁定状态的炫光跟锁头空位 */
#global-tooltip.is-locked {
    border: 1px solid var(--c1);
    box-shadow: 0 5px 20px var(--c1-bg);
    padding-right: 28px;
    pointer-events: auto; /* 锁定后允许你选取文字！ */
}

/* 纯 CSS 画出来的小锁头本体 */
#global-tooltip .lock-icon {
    display: none; 
    position: absolute;
    top: 10px; right: 10px;
    width: 8px; height: 6px;
    background: var(--c1);
    border-radius: 1px;
}
#global-tooltip .lock-icon::before {
    content: "";
    position: absolute;
    top: -5px; left: 1px;
    width: 4px; height: 5px;
    border: 1.5px solid var(--c1);
    border-bottom: none;
    border-radius: 3px 3px 0 0;
}
#global-tooltip.is-locked .lock-icon {
    display: block;
}
        
@media (max-width: 768px) {
    .vis-dashboard { flex-direction: column-reverse; }
    .vis-panel-left { border-right: none; border-top: 1px solid var(--border); }
    .vis-panel-right { min-height: 260px; }
    .compare-inputs { flex-direction: column; }
    
    table thead { display: none; }
    
    /* 🌟 1. 改成允许换行的 Flex 布局，把行距收紧一点 */
    table tbody tr { 
        display: flex; 
        flex-wrap: wrap; /* 重点！允许折行 */
        background: var(--bg-card); 
        border: 1px solid var(--border); 
        border-radius: 8px; 
        margin-bottom: 12px; 
        overflow: hidden; 
        box-shadow: 0 2px 4px rgba(0,0,0,0.02); 
    }
    
    /* 🌟 2. 标题栏依然当老大哥，霸占 100% 宽度 */
    table td:nth-child(1) { 
        background: var(--bg-header); color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; 
        padding: 8px 16px; 
        border-bottom: 1px solid var(--border); 
        display: block; width: 100%; box-sizing: border-box; 
    }
    
    /* 🌟 3. 数据栏用 flex: 1 均分剩下的空间 (50% / 50%) */
    table td:nth-child(2), table td:nth-child(3) { 
        display: flex; 
        align-items: center; 
        flex-wrap: wrap; /* ✨ 关键修补 1：允许 flex 里面的元素（标签）换行！ */
        gap: 4px; /* ✨ 加个 gap 间距，换行后才不会黏在一起 */
        padding: 10px 12px; 
        font-size: 13px; 
        flex: 1; 
        min-width: 0; 
        box-sizing: border-box; 
        min-height: 40px; 
        border-bottom: none; 
    }
    
    /* 🌟 4. 如果是对比模式（两列数据），给左边那列加个右边框划清界限 */
    table td:nth-child(2):not(:last-child) {
        border-right: 1px solid var(--border);
    }
    
    /* 保留帅气点点设计，稍微缩小一点 margin，话说点点好可爱哦，就是那条蛇没错，你也有看吗？ */
    table td:nth-child(2)::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--c1); border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
    table td:nth-child(3)::before { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--c2); border-radius: 50%; margin-right: 8px; flex-shrink: 0; }
    
    /* 修一下首页表格在手机上的第四列（不然可能会跑版） */
    table td:nth-child(4) { 
        flex: 1; padding: 10px 12px; font-size: 12px; color: var(--text-muted); display: flex; align-items: center;
    }
}

.hidden { display: none; }
.loading-spinner { text-align: center; padding: 60px; color: var(--text-muted); font-family: 'JetBrains Mono'; }
.spec-tag { display: inline-block; font-size: 12px; background: var(--bg-body); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); margin-right: 4px; margin-bottom: 4px; /* ✨ 增加下方间距，让桌面端换行也好看 */color: var(--text-muted); white-space: nowrap; /* ✨ 关键修补 2：保护标签里的字，绝对不能断开！ */}

.legal-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 10000; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: all 0.2s ease; }
.legal-modal.active { opacity: 1; pointer-events: auto; }
.legal-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; width: 90%; max-width: 550px; padding: 30px; position: relative; box-shadow: 0 20px 40px rgba(0,0,0,0.2); transform: translateY(20px); transition: transform 0.2s ease; max-height: 80vh; display: flex; flex-direction: column; }
.legal-modal.active .legal-box { transform: translateY(0); }
.legal-content { font-size: 13px; color: var(--text-muted); line-height: 1.6; overflow-y: auto; padding-right: 10px; }
.legal-content p { margin-top: 0; margin-bottom: 12px; }
.legal-content strong { color: var(--text-main); }

.log-block { margin-bottom: 20px; border-left: 2px solid var(--border); padding-left: 16px; position: relative; }
.log-block::before { content: ""; position: absolute; left: -5px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background 0.3s; }
.log-block:hover::before { background: var(--c1); box-shadow: 0 0 8px var(--c1-bg); }
.log-date { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); margin-bottom: 8px; font-weight: 700; letter-spacing: 0.5px; }
.log-item { margin-bottom: 8px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.log-tag { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--bg-body); border: 1px solid var(--border); margin-right: 6px; }
.tag-meta { color: #8b5cf6; border-color: rgba(139, 92, 246, 0.3); background: rgba(139, 92, 246, 0.1); }
.tag-feature { color: #10b981; border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.1); }
.tag-fix { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.1); }
.tag-design { color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.1); }

    /* 让按钮在深色模式下变暗 */
[data-theme="dark"] #feedback-widget button[title="Report Issue"] {
    background: rgba(30, 41, 59, 0.8);
    border-color: #334155;
}
