/* === 设计令牌 ===
 * design-taste-frontend-v1 原则适配原生栈：
 *  - Geist + Geist Mono（禁 Inter）；系统兜底，离线优雅降级
 *  - 单一 accent，饱和 <80%；去 AI 紫/纯黑/霓虹辉光
 *  - 去卡盒化：仅统计卡用高程（diffusion shadow，着背景色相），
 *    工具栏/目录区改 hairline 分割 + 负空间呼吸
 *  - hero 不用渐变 wash，改 accent top-rule + 极淡色相
 *  - 砍入场 stagger（"只有动画"的源头），仅留功能性动效
 */
:root {
  /* 表面与油墨 —— 中性暖灰，dark-first，非纯黑 */
  --bg:          #0d0d0d;
  --bg2:         #141413;
  --panel:       #1a1a19;
  --panel2:      #222220;
  --border:      rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.16);
  --text:        #ffffff;
  --secondary:   #c3c2b7;
  --muted:       #898781;
  --gridline:    #2c2c2a;
  --code-bg:     #0a0a09;

  /* 单一 accent（蓝），饱和度内敛 */
  --accent:      #3987e5;
  --accent-soft: rgba(57,135,229,0.14);

  /* 状态色固定，配点+标签，不靠色独 */
  --good:    #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical:#d03b3b;

  /* 扩散阴影（着背景色相，非黑体块） */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 1px 3px rgba(0,0,0,0.06), 0 10px 24px -14px rgba(0,0,0,0.42);

  --radius: 12px;
  --radius-sm: 7px;

  /* 缓动 —— 内置 ease 太弱 */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  color-scheme: dark light;
}

/* 字体：Geist 优先，系统兜底；mono 用 Geist Mono */
@font-face {
  font-family: "Geist Fallback";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: local("Geist"), local("Geist VF"), local(system-ui);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:          #f9f9f7;
    --bg2:         #f1f0ec;
    --panel:       #fcfcfb;
    --panel2:      #f4f3ef;
    --border:      rgba(11,11,11,0.10);
    --border-strong: rgba(11,11,11,0.16);
    --text:        #0b0b0b;
    --secondary:   #52514e;
    --muted:       #898781;
    --gridline:    #e1e0d9;
    --code-bg:     #f4f3ef;
    --accent:      #2a78d6;
    --accent-soft: rgba(42,120,214,0.10);
    --shadow-sm: 0 1px 2px rgba(11,11,11,0.04);
    --shadow:    0 1px 3px rgba(11,11,11,0.05), 0 10px 24px -16px rgba(11,11,11,0.18);
  }
}
:root[data-theme="light"] {
  --bg:          #f9f9f7;
  --bg2:         #f1f0ec;
  --panel:       #fcfcfb;
  --panel2:      #f4f3ef;
  --border:      rgba(11,11,11,0.10);
  --border-strong: rgba(11,11,11,0.16);
  --text:        #0b0b0b;
  --secondary:   #52514e;
  --muted:       #898781;
  --gridline:    #e1e0d9;
  --code-bg:     #f4f3ef;
  --accent:      #2a78d6;
  --accent-soft: rgba(42,120,214,0.10);
  --shadow-sm: 0 1px 2px rgba(11,11,11,0.04);
  --shadow:    0 1px 3px rgba(11,11,11,0.05), 0 10px 24px -16px rgba(11,11,11,0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Geist", "Geist Fallback", system-ui, -apple-system, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  font-feature-settings: "ss01", "cv01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 40px 28px 72px; }

/* === 顶栏 === */
header.top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 22px; border-bottom: 1px solid var(--border); margin-bottom: 32px;
}
header.top h1 {
  font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -0.014em;
  color: var(--text);
}
.brand { flex: none; width: 26px; height: 26px; display: block; border-radius: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--accent-soft); border: 1px solid transparent; color: var(--accent);
  letter-spacing: 0;
}
.meta { color: var(--muted); font-size: 12.5px; margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.meta code { background: var(--panel2); color: var(--secondary); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.cross-link {
  padding: 6px 13px; border-radius: 8px; border: 1px solid var(--border-strong); color: var(--text);
  font-size: 13px; font-weight: 500;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.cross-link:hover { background: var(--panel2); border-color: var(--accent); text-decoration: none; }
.cross-link:active { transform: scale(0.97); }

/* === 统计卡：hero figure + stat tiles（唯一保留高程的容器） === */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 36px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow);
  transition: transform 200ms var(--ease-out), border-color 200ms var(--ease-out);
}
.stat .k { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.stat .v {
  font-size: 24px; font-weight: 600; margin-top: 5px; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: proportional-num;
}
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
@media (hover: hover) and (pointer: fine) {
  .stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
}
/* hero：同源率，唯一的带头大数字 —— accent top-rule + 极淡色相，去 AI 渐变 wash */
.stat.rate {
  grid-column: span 2;
  background: var(--panel);
  border-top: 2px solid var(--accent);
  position: relative;
}
.stat.rate::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  background: var(--accent-soft); pointer-events: none;
}
.stat.rate > * { position: relative; }
.stat.rate .k { color: var(--secondary); }
.stat.rate .v { font-size: 54px; font-weight: 600; color: var(--accent); line-height: 1.0; letter-spacing: -0.035em; }
.stat.rate .sub { color: var(--secondary); margin-top: 7px; }

/* === 目录分布：去盒，hairline 分割 + 负空间 === */
.dirs { margin-bottom: 32px; }
.dirs h2 {
  margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.dir-row {
  display: grid; grid-template-columns: 130px 1fr 78px 64px; gap: 12px; align-items: center;
  padding: 11px 0; font-size: 13px; border-bottom: 1px solid var(--gridline);
}
.dir-row:last-child { border-bottom: 0; }
.dir-row .name { font-weight: 500; color: var(--text); }
.bar { height: 7px; background: var(--panel2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; }
.bar > i.good { background: var(--good); }
.bar > i.warning { background: var(--warning); }
.bar > i.critical { background: var(--critical); }
.bar > i.neutral { background: var(--muted); }
.num { text-align: right; color: var(--secondary); font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* === 工具栏：去盒，flush 行 + 底部 hairline === */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px; padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}
.toolbar input, .toolbar select {
  background: var(--bg2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input::placeholder { color: var(--muted); }
.toolbar select { cursor: pointer; }
.toolbar input, .toolbar select { transition: border-color 160ms var(--ease-out); }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); outline: none; }
.toolbar .seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.toolbar .seg button {
  background: var(--bg2); color: var(--muted); border: 0; padding: 7px 12px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; font-weight: 500;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.toolbar .seg button:active { transform: scale(0.97); }
.toolbar .seg button.active { background: var(--accent); color: #fff; }
.toolbar .count { color: var(--muted); font-size: 12.5px; margin-left: auto; font-variant-numeric: tabular-nums; }

/* === 表格 === */
table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
thead th {
  text-align: left; padding: 11px 12px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  position: sticky; top: 0; z-index: 2; letter-spacing: 0.04em; text-transform: uppercase;
  background: color-mix(in srgb, var(--panel) 68%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border-strong);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--gridline); vertical-align: middle; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; transition: background-color 120ms var(--ease-out); }
tbody tr.clickable:hover { background: var(--panel2); }
tbody tr.detail td { background: var(--bg2); padding: 0 12px; border: 0; }
/* 行展开：grid 0fr→1fr + opacity */
.dw { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 220ms var(--ease-out); }
.dw.open { grid-template-rows: 1fr; }
.di { overflow: hidden; min-height: 0; opacity: 0; transition: opacity 160ms var(--ease-out); padding: 14px 0 18px; }
.dw.open .di { opacity: 1; transition-delay: 50ms; }

.title-cell { font-weight: 500; color: var(--text); }
.path { color: var(--muted); font-size: 11.5px; }
.owner-cell { color: var(--secondary); font-size: 12.5px; }
.mono {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums; color: var(--secondary);
}
.pct { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.expander { color: var(--muted); width: 14px; display: inline-block; transition: transform 160ms var(--ease-out); }
tr.clickable.open .expander { transform: rotate(90deg); }

/* 状态徽标：圆点承状态色，文字穿文本 token */
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 500; background: var(--panel2);
  color: var(--secondary); border: 1px solid var(--border); letter-spacing: 0;
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tag.all::before { background: var(--good); }
.tag.partial::before { background: var(--warning); }
.tag.none::before { background: var(--critical); }
.tag.noblock::before { background: var(--muted); }

/* === 展开详情：未同源块 === */
.blocks { display: flex; flex-direction: column; gap: 10px; }
.block { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.block-head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--panel2); font-size: 12.5px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.block-head .ln { color: var(--secondary); font-variant-numeric: tabular-nums; font-family: "Geist Mono", ui-monospace, Menlo, monospace; }
.block-head .lang { background: var(--code-bg); color: var(--muted); padding: 1px 7px; border-radius: 4px; font-size: 11px; }
.block-head .hd { color: var(--muted); }
.block-head a { margin-left: auto; font-size: 12px; }
pre.snippet {
  margin: 0; padding: 12px 14px; background: var(--code-bg); color: var(--text);
  font-size: 12.5px; line-height: 1.55; overflow-x: auto;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
pre.snippet:empty { display: none; }
.empty { color: var(--muted); font-size: 13px; padding: 4px 0; }

footer { margin-top: 36px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); padding-top: 16px; line-height: 1.6; }
footer code { color: var(--secondary); }

/* === 无障碍三件套 === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  .dw { transition: none; }
  .di { transition: opacity 120ms ease; }
}
@media (prefers-reduced-transparency: reduce) {
  thead th { background: var(--panel2); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --border: var(--border-strong); --muted: var(--secondary); }
  .stat, .block, table { border-width: 2px; }
  thead th { background: var(--panel2); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
