/* ============================================================
   24H 实验室 · 设计系统
   明亮优先 + 暖琥珀强调色；4px 间距基准；统一 6/10px 圆角
   ============================================================ */

:root {
  --bg: #101216;
  --bg-elev: #16191f;
  --bg-input: #1b1f27;
  --bg-hover: #1f242d;
  --border: #262b35;
  --border-strong: #333a47;
  --text: #e6e9ef;
  --text-dim: #9aa3b2;
  --text-faint: #67707e;
  --accent: #e8a33d;
  --accent-ink: #241703;
  --accent-soft: rgba(232, 163, 61, .13);
  --ok: #4ec06a;
  --ok-soft: rgba(78, 192, 106, .14);
  --err: #f06060;
  --err-soft: rgba(240, 96, 96, .13);
  --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  --radius-s: 6px;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;

  /* 内容列：超宽屏下加宽上限并居中，两侧留白对称。
     顶栏与页脚复用同一套内边距，使标题、徽标、页脚文字与内容列左右边界严格对齐；
     --content-gutter 里的 100% 在各自元素上解析为其包含块宽度（即 .main 的内容宽度）。 */
  --content-max: 1520px;
  --content-pad: 26px;
  --content-gutter: max(var(--content-pad), calc((100% - var(--content-max)) / 2 + var(--content-pad)));

  /* 首页工具图标配色：按工具顺序循环取用（见 core.js 的 ICON_HUES），明亮主题另有一套加深版 */
  --ic-amber: #dfa03f;
  --ic-orange: #dd8a48;
  --ic-coral: #db6b5b;
  --ic-rose: #d55f92;
  --ic-violet: #b279d6;
  --ic-indigo: #8b85de;
  --ic-azure: #6a90e0;
  --ic-cyan: #4b9cde;
  --ic-teal: #38a8c2;
  --ic-mint: #34b394;
  --ic-green: #5cb963;
  --ic-lime: #9cbd45;
}

[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-elev: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #eef0f3;
  --border: #e2e5ea;
  --border-strong: #c9cfd8;
  --text: #22272f;
  --text-dim: #5b6472;
  --text-faint: #8b93a1;
  --accent: #b47510;
  --accent-ink: #ffffff;
  --accent-soft: rgba(180, 117, 16, .12);
  --ok: #1a7f37;
  --ok-soft: rgba(26, 127, 55, .1);
  --err: #cf222e;
  --err-soft: rgba(207, 34, 46, .08);
  --shadow: 0 8px 28px rgba(30, 35, 45, .12);

  /* 首页工具图标配色（浅底加深版，与暗色主题同色相） */
  --ic-amber: #a8741c;
  --ic-orange: #a85f16;
  --ic-coral: #b8433a;
  --ic-rose: #ab2f66;
  --ic-violet: #7d45b5;
  --ic-indigo: #5245b8;
  --ic-azure: #2f5cc0;
  --ic-cyan: #1665ad;
  --ic-teal: #0f7387;
  --ic-mint: #0f7f66;
  --ic-green: #2b7a33;
  --ic-lime: #67851a;
}

/* ---------- 基础 ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

::selection {
  background: var(--accent-soft);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- 布局 ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 238px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tool-root {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 22px var(--content-pad) 40px;
}

.tool-root:focus {
  outline: none;
}

/* ---------- 侧边栏内部 ---------- */
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.sidebar-head:hover .brand strong {
  color: var(--accent);
}

.logo {
  display: inline-flex;
  flex: none;
}

.logo img {
  display: block;
  width: 26px;
  height: 26px;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.brand strong {
  font-size: 15px;
  letter-spacing: .02em;
}

.brand span {
  font-size: 11px;
  color: var(--text-faint);
}

.search-wrap {
  padding: 4px 14px 10px;
}

#search {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}

#search::placeholder {
  color: var(--text-faint);
}

#search:focus {
  outline: none;
  border-color: var(--accent);
}

.tool-nav {
  flex: 1;
  overflow-y: auto;
  padding: 2px 8px 12px;
}

.nav-group {
  margin-top: 10px;
}

.nav-group:first-child {
  margin-top: 2px;
}

.nav-group-label {
  font-size: 11px;
  color: var(--text-faint);
  padding: 4px 8px 3px;
  letter-spacing: .06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  margin: 1px 0;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: var(--radius-s);
  cursor: pointer;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: .75;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-item.active svg {
  opacity: 1;
  color: var(--accent);
}

.nav-item .nav-keywords {
  display: none;
}

.nav-empty {
  padding: 14px 10px;
  font-size: 12px;
  color: var(--text-faint);
}

/* 底部工具条：只保留主题切换，高度与主区页脚（.foot）一致，使左右两侧的分隔线落在同一条水平线上。
   .foot = 1px 边框 + 12px 上下内边距 + 一行 12px/1.6 文字（19.2px）；
   此处内容为 32px 的图标按钮，故上下内边距取 12 - (32 - 19.2) / 2 = 5.6px，总高与 .foot 相等。 */
.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 5.6px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ---------- 顶栏 / 页脚 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px var(--content-gutter);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar h1 {
  font-size: 17px;
}

.topbar-title p {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 1px;
}

.topbar-badge {
  font-size: 11px;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid transparent;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 需要联网的工具（如 GitHub 相关）用强调色标注，与「本地运行」区分 */
.topbar-badge.net {
  color: var(--accent);
  background: var(--accent-soft);
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px var(--content-gutter);
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

/* ---------- 通用组件 ---------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
}

.btn.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.small {
  padding: 3px 9px;
  font-size: 12px;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel+.panel {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.panel-body {
  padding: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.grow {
  flex: 1;
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field>label {
  font-size: 12px;
  color: var(--text-dim);
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="password"],
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 7px 10px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.ta {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 10px 12px;
  tab-size: 2;
}

textarea.ta.small {
  min-height: 96px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.check input {
  accent-color: var(--accent);
  cursor: pointer;
}

.hint {
  font-size: 12px;
  color: var(--text-faint);
}

.msg-error {
  font-size: 12px;
  color: var(--err);
  background: var(--err-soft);
  border-radius: var(--radius-s);
  padding: 7px 10px;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
}

.msg-ok {
  font-size: 12px;
  color: var(--ok);
  background: var(--ok-soft);
  border-radius: var(--radius-s);
  padding: 7px 10px;
}

.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.kv th,
.kv td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.kv th {
  font-weight: 500;
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
}

.kv tr:last-child td {
  border-bottom: none;
}

.kv td.mono {
  font-family: var(--mono);
  word-break: break-all;
}

.stat {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--mono);
}

/* ---------- 输出代码块 ---------- */
pre.out {
  margin: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg-input);
  border-radius: var(--radius-s);
  overflow: auto;
  max-height: 480px;
  white-space: pre-wrap;
  word-break: break-word;
}

pre.out.nowrap {
  white-space: pre;
}

/* JSON 语法高亮 */
.j-key {
  color: var(--accent);
}

.j-str {
  color: #8ddb8c;
}

.j-num {
  color: #79b8ff;
}

.j-bool {
  color: #d2a8ff;
}

.j-null {
  color: var(--text-faint);
  font-style: italic;
}

[data-theme="light"] .j-str {
  color: #116329;
}

[data-theme="light"] .j-num {
  color: #0550ae;
}

[data-theme="light"] .j-bool {
  color: #8250df;
}

/* ---------- Diff ---------- */
.diff-box {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  max-height: 520px;
}

.diff-line {
  display: flex;
  white-space: pre;
}

.diff-line .ln {
  flex-shrink: 0;
  width: 46px;
  padding: 0 8px;
  text-align: right;
  color: var(--text-faint);
  user-select: none;
}

.diff-line .sign {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  user-select: none;
}

.diff-line .code {
  padding-right: 12px;
  word-break: break-all;
  white-space: pre-wrap;
}

.diff-line.add {
  background: var(--ok-soft);
}

.diff-line.add .sign {
  color: var(--ok);
}

.diff-line.del {
  background: var(--err-soft);
}

.diff-line.del .sign {
  color: var(--err);
}

.diff-line.ctx {
  color: var(--text-dim);
}

/* ---------- 正则高亮 ---------- */
.rx-preview {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
}

.rx-preview mark {
  background: var(--accent-soft);
  color: var(--text);
  outline: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0 1px;
}

/* ---------- 颜色工具 ---------- */
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.swatch {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: none;
  font-family: var(--mono);
}

.swatch .chip {
  height: 44px;
}

.swatch .hex {
  display: block;
  font-size: 11px;
  padding: 4px;
  color: var(--text-dim);
  background: var(--bg-input);
  text-align: center;
}

.swatch:hover .hex {
  color: var(--text);
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  font-family: var(--mono);
}

.badge.pass {
  color: var(--ok);
  background: var(--ok-soft);
}

.badge.warn {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.fail {
  color: var(--err);
  background: var(--err-soft);
}

input[type="color"] {
  width: 46px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg-input);
  cursor: pointer;
}

/* ---------- 关于页 ---------- */
.about-hero {
  padding: 26px;
  border-bottom: 1px solid var(--border);
}

.about-hero h2 {
  font-size: 19px;
  margin-bottom: 6px;
}

.about-hero .sub {
  color: var(--text-dim);
  font-size: 13px;
}

.rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.rule {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg-input);
}

.rule strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.rule span {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- Markdown 预览 ---------- */
.md-preview {
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}

.md-preview h1,
.md-preview h2,
.md-preview h3 {
  margin: .9em 0 .4em;
  line-height: 1.3;
}

.md-preview> :first-child,
.md-preview h1:first-child,
.md-preview h2:first-child {
  margin-top: 0;
}

.md-preview h1 {
  font-size: 1.5em;
  border-bottom: 1px solid var(--border);
  padding-bottom: .25em;
}

.md-preview h2 {
  font-size: 1.25em;
  border-bottom: 1px solid var(--border);
  padding-bottom: .2em;
}

.md-preview h3 {
  font-size: 1.1em;
}

.md-preview p {
  margin: .6em 0;
}

.md-preview ul,
.md-preview ol {
  margin: .6em 0;
  padding-left: 1.6em;
}

.md-preview blockquote {
  margin: .8em 0;
  padding: .4em 1em;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  background: var(--accent-soft);
  color: var(--text-dim);
}

.md-preview pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  overflow: auto;
}

.md-preview pre code {
  background: none;
  border: none;
  padding: 0;
}

.md-preview table {
  border-collapse: collapse;
  margin: .8em 0;
  width: 100%;
}

.md-preview th,
.md-preview td {
  border: 1px solid var(--border);
  padding: 5px 10px;
  text-align: left;
}

.md-preview th {
  background: var(--bg-input);
}

.md-preview img {
  max-width: 100%;
  border-radius: var(--radius-s);
}

.md-preview hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2em 0;
}

.md-preview del {
  color: var(--text-faint);
}

/* ---------- 首页 ---------- */
.home-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.home-hero .flask {
  color: var(--accent);
  flex-shrink: 0;
  display: inline-flex;
}

.home-hero h2 {
  font-size: 16px;
  margin-bottom: 3px;
}

.home-hero p {
  font-size: 12px;
  color: var(--text-dim);
}

.home-group {
  margin-bottom: 24px;
}

.home-group:last-child {
  margin-bottom: 0;
}

.home-group-title {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.tool-card:hover {
  border-color: var(--ic, var(--accent));
  background: var(--bg-hover);
}

.tool-card-icon {
  color: var(--ic, var(--accent));
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 0;
}

.tool-card-icon svg {
  width: 26px;
  height: 26px;
}

.tool-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tool-card-body strong {
  font-size: 15px;
  font-weight: 500;
}

.tool-card-body span {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

@media (max-width: 560px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Box-Shadow 生成器 ---------- */
.bs-stage {
  min-height: 220px;
  display: grid;
  place-items: center;
  background: repeating-conic-gradient(var(--bg-input) 0% 25%, var(--bg-elev) 0% 50%) 0 0 / 22px 22px;
}

.bs-box {
  width: 130px;
  height: 86px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

/* ---------- KeyCode 查询 ---------- */
.kc-area {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
}

.kc-area:focus {
  outline: none;
  border-color: var(--accent);
}

.kc-area:focus .kc-key {
  color: var(--accent);
}

.kc-key {
  font-family: var(--mono);
  font-size: 40px;
  line-height: 1.2;
  color: var(--text);
  word-break: break-all;
}

.kc-area .kv {
  max-width: 460px;
  margin: 0 auto;
  text-align: left;
}

.badge.on {
  color: var(--accent);
  background: var(--accent-soft);
  outline: 1px solid var(--accent);
}

/* ---------- 图片转 Base64 ---------- */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 120px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.drop-zone strong {
  font-size: 14px;
  font-weight: 500;
}

.drop-zone:hover,
.drop-zone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.img-preview {
  max-width: 100%;
  max-height: 260px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
}

/* ---------- CSS 渐变生成器 ---------- */
.grad-stage {
  padding: 14px;
}

.grad-preview {
  height: 200px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
}

/* ---------- Flexbox 演练场 ---------- */
.fx-stage {
  padding: 14px;
}

.fx-preview {
  display: flex;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-s);
  padding: 10px;
  overflow: auto;
}

.fx-item {
  min-width: 56px;
  min-height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-s);
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- GitHub 文件夹下载 ---------- */
.prog {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
}

.prog>i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .2s ease;
}

.file-list {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg-input);
}

.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.file-row:last-child {
  border-bottom: none;
}

.file-row .idx {
  flex-shrink: 0;
  width: 34px;
  text-align: right;
  color: var(--text-faint);
}

.file-row .path {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .state {
  flex-shrink: 0;
  font-size: 11px;
}

.file-row.ok .state {
  color: var(--ok);
}

.file-row.loading .state {
  color: var(--accent);
}

.file-row.error {
  background: var(--err-soft);
  cursor: pointer;
}

.file-row.error .state {
  color: var(--err);
  text-decoration: underline;
}

/* ---------- GitHub Star 统计 ---------- */
.gh-avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.tbl-wrap {
  max-height: 460px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}

.tbl-wrap .kv {
  font-size: 12.5px;
}

.tbl-wrap .kv th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-elev);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 12px;
}

.bar-row .lang {
  flex-shrink: 0;
  width: 96px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row .num {
  flex-shrink: 0;
  width: 116px;
  text-align: right;
  font-family: var(--mono);
  color: var(--text-faint);
}

.bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.bar-track>i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.badge.muted {
  color: var(--text-dim);
  background: var(--bg-input);
}

/* ---------- iconfont 字体解析 ---------- */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 8px;
  max-height: 560px;
  overflow: auto;
}

.icon-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  font-family: inherit;
  color: var(--text);
  text-align: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  cursor: pointer;
}

.icon-cell:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.icon-cell .glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  font-size: 26px;
  line-height: 1;
}

.icon-cell .glyph svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.icon-cell .nm {
  max-width: 100%;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-cell .code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

/* ---------- CSS 美化 / 净化 / 压缩 ---------- */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}

.seg button {
  padding: 5px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.seg button:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.seg button.active {
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 500;
}

.seg button.active:hover {
  filter: brightness(1.08);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow);
  padding: 8px 16px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 60;
  max-width: 80vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 响应式 ---------- */
.only-mobile {
  display: none;
}

@media (max-width: 880px) {
  .only-mobile {
    display: inline-flex;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .tool-root {
    padding: 16px 16px 32px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar-badge {
    display: none;
  }

  .foot {
    padding: 10px 16px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }

  .app.nav-open .sidebar {
    transform: translateX(0);
  }

  .app::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  .app.nav-open::after {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 480px) {

  .kv th:nth-child(3),
  .kv td:nth-child(3) {
    display: none;
  }
}