:root {
  --bg: #0e1117;
  --bg-soft: #151a23;
  --bg-card: #1a212c;
  --bg-hover: #212a38;
  --border: #2a3543;
  --border-soft: #222c39;
  --text: #e6edf3;
  --text-dim: #93a4b8;
  --text-mute: #6b7d92;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 15% -10%, #172133 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: rgba(16, 21, 29, .92);
  border-right: 1px solid var(--border-soft); padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand-img {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; object-fit: contain; display: block;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06121f; font-weight: 700;
}
.brand-title { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-mute); }
.nav-scroll { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text-dim); cursor: pointer; font-size: 13.5px; user-select: none; border: 1px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(59,130,246,.18), rgba(34,211,238,.06)); color: #dbeafe; border-color: rgba(59,130,246,.35); }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 4px; font-size: 11px; color: var(--text-mute); line-height: 1.7; border-top: 1px solid var(--border-soft); }
.sidebar-foot .foot-brand a { color: var(--text-mute); text-decoration: none; border-bottom: 1px dotted var(--border); }
.sidebar-foot .foot-brand a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }

/* ---------- 通用组件 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0 0 4px; font-weight: 650; }
.page-head .sub { color: var(--text-mute); font-size: 12.5px; }
.card { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-title { font-size: 14px; font-weight: 620; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 14px; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.small { font-size: 12px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }

button, .btn {
  appearance: none; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit;
  transition: .15s; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { background: var(--bg-hover); border-color: #3a4a5e; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: linear-gradient(135deg, #2563eb, #0ea5e9); border-color: transparent; color: #f8fbff; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: #fecaca; border-color: #7f2a2a; background: #2a1518; }
button.danger:hover { background: #3a1b1f; }
button.ghost { background: transparent; }
button.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }

input, select, textarea {
  background: #0f141c; border: 1px solid var(--border); color: var(--text); border-radius: 8px;
  padding: 8px 11px; font-size: 13px; font-family: inherit; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.field { display: block; margin-bottom: 14px; }
.field.grow { min-height: 0; }
/* 长文本输入：随视口伸缩，避免固定行数在小屏溢出 / 大屏浪费 */
textarea.tall { min-height: clamp(160px, 30vh, 420px); resize: vertical; }
textarea.fillh { min-height: clamp(200px, 42vh, 620px); resize: vertical; }
label.field { display: block; margin-bottom: 12px; }
label.field > span.lbl { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }
label.field > span.hint { display: block; font-size: 11.5px; color: var(--text-mute); margin-top: 4px; }
.inline { display: flex; gap: 10px; align-items: center; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; }
.checkbox input { width: auto; }

/* ---------- 版本历史（镜像详情） ---------- */
.ver-list { display: grid; gap: 8px; }
.ver-item {
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  background: var(--bg-soft); padding: 10px 12px;
}
.ver-item.current { border-color: rgba(59, 130, 246, .45); background: rgba(59, 130, 246, .07); }
.ver-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ver-ref { font-weight: 600; font-size: 13.5px; }
.ver-meta { color: var(--text-dim); font-size: 12px; }
.ver-files { flex: 1 1 100%; font-size: 11.5px; color: var(--text-mute); overflow-wrap: anywhere; }
.ver-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ver-acts .btn, .ver-acts button { padding: 3px 9px; font-size: 12px; }
.ver-acts .btn:hover { text-decoration: none; }
.ver-stale { color: var(--text-mute); font-size: 12px; align-self: center; }
.ver-hint { margin-top: 8px; font-size: 12px; color: var(--text-mute); line-height: 1.7; }
.ver-hint code { background: var(--bg-hover); padding: 1px 5px; border-radius: 4px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
th { color: var(--text-mute); font-weight: 550; font-size: 12px; text-transform: none; white-space: nowrap; }
tbody tr:hover { background: rgba(255,255,255,.02); }
.table-wrap { overflow-x: auto; }
td.actions { white-space: nowrap; }
td.actions button { margin-right: 4px; }
/* 计数列右对齐，位数差得多也不跳 */
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 已收藏的按钮：淡金色描边，一眼能看出来 */
.btn.sm.fav-on, button.sm.fav-on { border-color: #b98b31; color: #e5b95c; background: rgba(229,185,92,.10); }
button.sm.fav-on:hover { background: rgba(229,185,92,.18); }


/* ---------- 表格列宽：按内容多少分配 ---------- */
/* 镜像表用固定布局：每列宽度就是下面写的值，多出来的空间丢给行尾那一列空白（col-fill），
   这样「镜像」列不会随屏幕变宽一路胀到七八百像素，短列也不会被平均分走宽度。
   现在的列：镜像 / 语言 / Star / 归档 / 存储状态 / 最近升级 / 操作（+ 行尾填充）。 */
#repo-table, #image-table, #skill-table, #token-table, #log-table, #storage-table { table-layout: auto; }
#repo-table { table-layout: fixed; width: 100%; }

#repo-table > thead > tr > th:nth-child(1),
#repo-table > tbody > tr > td:nth-child(1) { width: 34%; min-width: 0; max-width: none; }
#repo-table > thead > tr > th:nth-child(2),
#repo-table > tbody > tr > td:nth-child(2) { width: 92px; }
#repo-table > thead > tr > th:nth-child(3),
#repo-table > tbody > tr > td:nth-child(3) { width: 64px; white-space: nowrap; }
#repo-table > thead > tr > th:nth-child(4),
#repo-table > tbody > tr > td:nth-child(4) { width: 150px; }
#repo-table > thead > tr > th:nth-child(5),
#repo-table > tbody > tr > td:nth-child(5) { width: 96px; white-space: nowrap; }
#repo-table > thead > tr > th:nth-child(6),
#repo-table > tbody > tr > td:nth-child(6) { width: 128px; min-width: 0; white-space: nowrap; }
#repo-table > thead > tr > th:nth-child(7),
#repo-table > tbody > tr > td:nth-child(7) { width: 236px; white-space: nowrap; }
#repo-table > thead > tr > th:nth-child(8),
#repo-table > tbody > tr > td:nth-child(8) { width: auto; padding: 0; }

#repo-table > tbody > tr > td:nth-child(6) .badge { display: block; margin: 2px 0 0 0; }
#repo-table > tbody > tr > td:nth-child(6) .mono { white-space: nowrap; }
#repo-table > tbody > tr > td:nth-child(4) { max-width: 150px; overflow-wrap: anywhere; }
#repo-table > tbody > tr > td:nth-child(4) .tiny { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#repo-table > tbody > tr > td:nth-child(7) button { padding: 3px 7px; font-size: 11.5px; margin: 1px 3px 1px 0; }

/* 自制镜像表：9 列，固定布局按百分比切，操作列必须留够一行放三个按钮 */
#image-table { table-layout: fixed; width: 100%; }
#image-table > thead > tr > th:nth-child(1), #image-table > tbody > tr > td:nth-child(1) { width: 24%; }
#image-table > thead > tr > th:nth-child(2), #image-table > tbody > tr > td:nth-child(2) { width: 8%; }
#image-table > thead > tr > th:nth-child(3), #image-table > tbody > tr > td:nth-child(3) { width: 7%; }
#image-table > thead > tr > th:nth-child(4), #image-table > tbody > tr > td:nth-child(4) { width: 5.5%; }
#image-table > thead > tr > th:nth-child(5), #image-table > tbody > tr > td:nth-child(5) { width: 8%; }
#image-table > thead > tr > th:nth-child(6), #image-table > tbody > tr > td:nth-child(6) { width: 11%; }
#image-table > thead > tr > th:nth-child(7), #image-table > tbody > tr > td:nth-child(7) { width: 9.5%; }
#image-table > thead > tr > th:nth-child(8), #image-table > tbody > tr > td:nth-child(8) { width: 12%; }
#image-table > thead > tr > th:nth-child(9), #image-table > tbody > tr > td:nth-child(9) { width: 15%; }
/* 名字与文件名各自截断，别把整行撑宽 */
#image-table > tbody > tr > td:nth-child(1) { overflow-wrap: anywhere; }
#image-table > tbody > tr > td:nth-child(1) .mono,
#image-table > tbody > tr > td:nth-child(6) .tiny { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* GitHub 列只放状态与仓库名，仓库名过长省略 */
#image-table > tbody > tr > td:nth-child(6), #image-table > tbody > tr > td:nth-child(7),
#image-table > tbody > tr > td:nth-child(8), #image-table > tbody > tr > td:nth-child(9) { white-space: normal; }
#image-table > tbody > tr > td:nth-child(9) a { white-space: nowrap; }

/* 其它表：短列按内容收缩，主列吃掉剩余宽度 */
#skill-table > thead > tr > th:nth-child(3),
#skill-table > thead > tr > th:nth-child(4),
#skill-table > thead > tr > th:nth-child(5),
#token-table > thead > tr > th:nth-child(n+3),
#storage-table > thead > tr > th:nth-child(n+2),
#log-table > thead > tr > th:nth-child(-n+4),
#log-table > thead > tr > th:nth-child(n+7) { width: 1%; white-space: nowrap; }

#skill-table > tbody > tr > td:nth-child(3),
#skill-table > tbody > tr > td:nth-child(4),
#skill-table > tbody > tr > td:nth-child(5),
#token-table > tbody > tr > td:nth-child(n+3),
#storage-table > tbody > tr > td:nth-child(n+2),
#log-table > tbody > tr > td:nth-child(-n+4),
#log-table > tbody > tr > td:nth-child(n+7) { width: 1%; white-space: nowrap; }

#skill-table > thead > tr > th:nth-child(1), #skill-table > tbody > tr > td:nth-child(1) { width: 1%; max-width: 170px; }
#skill-table > thead > tr > th:nth-child(2), #skill-table > tbody > tr > td:nth-child(2) { width: auto; min-width: 200px; }
#token-table > thead > tr > th:nth-child(1), #token-table > tbody > tr > td:nth-child(1) { width: auto; min-width: 170px; }
#log-table > thead > tr > th:nth-child(5), #log-table > tbody > tr > td:nth-child(5) { width: auto; min-width: 180px; }
#storage-table > thead > tr > th:nth-child(1), #storage-table > tbody > tr > td:nth-child(1) { width: auto; min-width: 200px; }

/* 中等长度列：允许换行，但不许挤掉主列 */
#token-table > tbody > tr > td:nth-child(2) { max-width: 240px; overflow-wrap: anywhere; }
#token-table > thead > tr > th:nth-child(8), #token-table > tbody > tr > td:nth-child(8) { white-space: normal; max-width: 180px; }
#log-table > tbody > tr > td:nth-child(6) { max-width: 200px; overflow-wrap: anywhere; }

/* 操作列：一行放得下四个按钮，靠收紧内边距而不是堆成四行 */
#token-table > thead > tr > th:nth-child(8),
#token-table > tbody > tr > td:nth-child(8) { white-space: normal; }

/* 镜像名下面的介绍：最多三行，够看清说什么，也不至于把行撑太高 */
#repo-table .name-desc {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.55; margin-top: 2px;
}

/* ---------- 徽标 ---------- */
.token-gen { border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: var(--bg-soft); }
.token-gen .url-row { margin-top: 6px; }
.tabs .tab-count { color: var(--text-dim); font-size: 11.5px; margin-left: 4px; }
.req { color: #f87171; font-weight: 600; margin-left: 2px; }
.field .lbl { display: inline-flex; align-items: center; gap: 2px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-dim); }
.badge.ok { color: #a7f3d0; border-color: #14532d; background: #052e1a; }
.badge.warn { color: #fde68a; border-color: #713f12; background: #2b1d05; }
.badge.err { color: #fecaca; border-color: #7f1d1d; background: #2a0e0e; }
.badge.info { color: #bfdbfe; border-color: #1e3a8a; background: #0b1a33; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; background: var(--bg-soft); border: 1px solid var(--border-soft); color: var(--text-dim); }

/* ---------- 统计卡 ---------- */
.stat { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .7; }
.stat .k { font-size: 12px; color: var(--text-mute); }
.stat .v { font-size: 22px; font-weight: 680; margin-top: 4px; letter-spacing: .3px; }
.stat .s { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

/* ---------- 进度条 ---------- */
.progress { height: 6px; border-radius: 99px; background: #0d1219; overflow: hidden; border: 1px solid var(--border-soft); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }

/* ---------- 提示 ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; max-width: 380px; animation: slidein .2s ease; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(4, 7, 12, .72); display: grid; place-items: center; z-index: 9000; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); width: min(860px, 100%); max-height: 88vh; overflow: auto; }
/* 撑满型弹窗：标题与按钮固定，正文区吃掉剩余高度，适合长文本编辑 */
.modal.fill { display: flex; flex-direction: column; overflow: hidden; height: 92vh; max-height: 92vh; }
.modal.fill .modal-body { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.modal.fill .modal-body > .field { flex: 0 0 auto; }
.modal.fill .modal-body > .field.grow {
  flex: 1 1 auto; min-height: 0; margin-bottom: 0;
  display: flex; flex-direction: column;
}
.modal.fill .field.grow textarea {
  flex: 1 1 auto; height: auto; resize: none;
  min-height: clamp(220px, 46vh, 620px);
}
/* label 默认是 inline，撑满模式下面板需要 block 才能让 textarea 吃到高度 */
.modal.fill .field.grow > .lbl,
.modal.fill .field.grow > span.lbl { flex: 0 0 auto; display: block; }
.modal.fill .field.grow > .hint,
.modal.fill .field.grow > span.hint { flex: 0 0 auto; display: block; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--bg-card); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--bg-card); }

/* ---------- 代码块 ---------- */
pre.code { background: #0a0f16; border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.65; margin: 0; }
.copy-box { position: relative; }
.copy-box .copy-btn { position: absolute; right: 8px; top: 8px; padding: 2px 8px; font-size: 11.5px; }

/* ---------- 杂项 ---------- */
.empty { padding: 28px; text-align: center; color: var(--text-mute); font-size: 13px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--text-mute); }
.note-box { background: #0c1219; border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; font-size: 13px; line-height: 1.7; color: #cfe0f0; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; font-size: 12.5px; margin-bottom: 7px; }
.bar { height: 8px; border-radius: 99px; background: #0d1219; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #22d3ee); }
.steps { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-mute); }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.url-row { display: flex; gap: 8px; align-items: center; padding: 7px 10px; background: #0c1219; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 7px; }
.url-row .tag { font-size: 11px; color: var(--text-mute); width: 74px; flex: 0 0 74px; }
.url-row code { flex: 1; font-size: 12.5px; overflow-x: auto; white-space: nowrap; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border-soft); margin-bottom: 14px; }
.tab { padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--text-dim); border-bottom: 2px solid transparent; }
.tab.active { color: #dbeafe; border-bottom-color: var(--accent); }
.repo-row-check { width: 18px; }
/* ---------- 文章管理 ---------- */
.art-scroll { max-height: calc(100vh - 190px); overflow: auto; }
.art-item { padding: 10px 12px; border-bottom: 1px solid var(--line, #2a2f3a); cursor: pointer; }
.art-item:last-child { border-bottom: 0; }
.art-item:hover { background: rgba(120,150,255,.07); }
.art-item.active { background: rgba(120,150,255,.14); }
.art-item .t { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.art-item .m { font-size: 11px; color: var(--muted, #8b93a5); display: flex; gap: 8px; flex-wrap: wrap; }
.art-item .s { font-size: 11px; color: var(--muted, #8b93a5); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art-text { white-space: pre-wrap; font-size: 13px; line-height: 1.75; overflow-wrap: anywhere;
  background: rgba(0,0,0,.22); border-radius: 8px; padding: 12px 14px; margin-top: 8px; }
/* ---------- GitHub Skill 检索栏 ---------- */
.intro-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 0; }
.spinner { width: 22px; height: 22px; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--accent, #4da3ff);
  border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skill-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border, #2a2f3a); }
.skill-block[hidden] { display: none; }
.skill-tools { gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.skill-kv { grid-template-columns: 96px 1fr; }
.cap-body { max-height: 72vh; overflow: auto; }
.cap-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.8;
  background: rgba(0,0,0,.2); border-radius: 8px; padding: 14px 16px; }
.cap-list { display: flex; flex-direction: column; gap: 8px; }
.cap-list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border: 1px solid var(--border, #2a2f3a); border-radius: 8px; }

/* 宽屏：文章正文占满整行，分析结果挪到下面 */
[data-page="articles"].art-wide .grid.c2 { grid-template-columns: 1fr; }
[data-page="articles"].art-wide .art-text { max-width: none; font-size: 13.5px; line-height: 1.85; }
/* 沉浸阅读：正文占满弹窗，字号再放大一档 */
.reader-body { max-height: 74vh; overflow: auto; white-space: pre-wrap; font-size: 15px; line-height: 1.95;
  overflow-wrap: anywhere; background: rgba(0,0,0,.2); border-radius: 10px; padding: 18px 22px; }
.reader-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-mute); margin-bottom: 10px; }
.tag-ok { color: #4ade80; }
.tag-no { color: #f87171; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 10.5px; padding: 1px 6px; border-radius: 10px; white-space: nowrap;
  border: 1px solid rgba(140,160,200,.25); color: #9aa4b8; }
.chip.on { color: #4ade80; border-color: rgba(74,222,128,.35); background: rgba(74,222,128,.08); }
.chip.off { color: #f0a0a0; border-color: rgba(248,113,113,.28); background: rgba(248,113,113,.07); }

/* ================= 响应式：统一放在文件末尾，确保覆盖前面的桌面规则 ================= */

/* ---------- AI 分析页 ---------- */
/* 分析失败记录：一条一卡片，手机/桌面都无需横向滚动 */
.ai-fail-item { border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--bg-soft); }
.ai-fail-item:last-child { margin-bottom: 0; }
.ai-fail-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ai-fail-top .spacer { flex: 1; }
.ai-fail-src-wrap { min-width: 0; margin-bottom: 4px; }
.ai-fail-src { display: inline-block; max-width: 100%; font-size: 12px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.ai-fail-msg { font-size: 12.5px; line-height: 1.7; color: #fecaca; overflow-wrap: anywhere;
  max-height: 3.6em; overflow: auto; }
.ai-fail-actions { margin-top: 8px; gap: 8px; }
.ai-fail-actions button { flex: 0 0 auto; }
.ai-error { border: 1px solid #7f1d1d; background: #2a0e0e; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.ai-error-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-error-msg { font-size: 13px; line-height: 1.7; color: #fecaca; overflow-wrap: anywhere; white-space: pre-wrap; }
.ai-error-tip { margin-top: 8px; font-size: 12.5px; line-height: 1.7; color: #fca5a5; }
.ai-result-head { margin-bottom: 10px; }
.ai-result-title { font-weight: 620; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-result-head .tiny { overflow-wrap: anywhere; }
.ai-summary { max-height: 240px; overflow: auto; margin-bottom: 4px; }
.ai-sub-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
.ai-repos { border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; }
.ai-repo-head, .ai-repo { display: grid; grid-template-columns: 30px minmax(0, 1fr) 152px minmax(0, 1.05fr); gap: 10px; align-items: center; padding: 8px 12px; }
.ai-repo-head { background: #0c1219; border-bottom: 1px solid var(--border-soft); font-size: 12px; color: var(--text-mute); }
.ai-repo { border-bottom: 1px solid var(--border-soft); }
.ai-repo:last-child { border-bottom: 0; }
.ai-repo:hover { background: rgba(255, 255, 255, .02); }
.ai-repo .ai-chk { display: flex; align-items: center; }
.ai-repo .ai-name { font-size: 12.5px; overflow-wrap: anywhere; }
.ai-repo .ai-reason { color: var(--text-dim); line-height: 1.6; overflow-wrap: anywhere; }
.ai-repo .ai-cat select { width: 100%; min-width: 0; }
.ai-pulls { display: flex; flex-direction: column; gap: 6px; }
.ai-pull { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center;
  padding: 8px 12px; border: 1px solid var(--border-soft); border-radius: 8px; font-size: 12.5px; }
.ai-pull .p-repo { overflow-wrap: anywhere; }


/* 项目说明展示态：保留段落与换行，长文本可读 */
.note-view { font-size: 13px; line-height: 1.75; color: var(--text); background: var(--bg-soft, rgba(255,255,255,.02)); border: 1px solid var(--border-soft); border-radius: 10px; padding: 14px 16px; max-height: 46vh; overflow: auto; overflow-wrap: anywhere; }
.note-view p { margin: 0 0 10px; }
.note-view p:last-child { margin-bottom: 0; }
.note-view code { background: rgba(127,127,127,.18); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.note-view strong { color: var(--text); font-weight: 600; }

/* 可点击的名称：整行名称都能打开详情，但保持文字外观 */
.name-link { color: inherit; text-decoration: none; cursor: pointer; border-bottom: 1px dashed transparent; }
.name-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* 弹窗表格里的徽标不换行，避免挤成两行 */
.modal .badge[style] { white-space: nowrap; }

/* 开源链接区块 */
.share-box{border:1px solid var(--line);border-radius:10px;padding:12px 14px;background:rgba(127,127,127,.03)}
.share-url{word-break:break-all;color:var(--acc);text-decoration:none}
.share-url:hover{text-decoration:underline}
.share-box select{max-width:220px}

/* ============================================================================
   手机端布局（2026-11-05 重做，统一定义在文件末尾，保证覆盖桌面规则）
   - ≤900px：侧栏换成底部标签栏 + 「更多」抽屉；表格转卡片；表单铺满；弹窗变底部面板
   - ≤520px：小屏进一步压缩留白与字号
   ============================================================================ */

/* 手机端专用元素在桌面端不存在 */
#mtab, #msheet-mask { display: none; }

/* mcard：窄屏把表格渲染成「一条一卡片」，标签来自表头（JS 写入 data-label）。
   断点 1400px：桌面侧栏 900px 以下才换底部导航，但表格列多，1400px 以下就换卡片，
   这样 1024 / 1280 / 1366 这类窗口不会出现横向拖动或挤压。 */
@media (max-width: 1400px) {
  .table-wrap { overflow-x: visible; }
  .table-wrap table { min-width: 0; }
  table.mcard, table.mcard tbody, table.mcard tr, table.mcard td { display: block; width: auto; }
  table.mcard thead { display: none; }
  table.mcard tr {
    border: 1px solid var(--border-soft); border-radius: 12px; background: var(--bg-soft);
    padding: 10px 12px; margin-bottom: 9px;
  }
  table.mcard tr:hover { background: var(--bg-soft); }
  table.mcard td {
    border: 0; padding: 3px 0; font-size: 13px; line-height: 1.65;
    display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; align-items: start;
    overflow-wrap: anywhere; max-width: none !important;
  }
  table.mcard td::before {
    content: attr(data-label); color: var(--text-mute); font-size: 11.5px; line-height: 1.7;
  }
  table.mcard td:not([data-label]) { display: block; padding: 2px 0; }
  table.mcard td:not([data-label])::before { display: none; }
  table.mcard td.num { text-align: left; }
  table.mcard td.actions { white-space: normal; padding-top: 8px; margin-top: 4px;
    border-top: 1px dashed var(--border-soft); }
  table.mcard td.actions::before { content: none; }
  table.mcard { table-layout: auto; }
  /* 卡片里每格都是整行，桌面那套列宽（百分比 / 固定像素）一律不生效 */
  table.mcard td { width: auto !important; min-width: 0 !important; }
  table.mcard td.col-fill, table.mcard th.col-fill { display: none; }
  table.mcard td.actions button, table.mcard td.actions a { margin: 2px 6px 2px 0; }
  table.mcard tr.mcard-empty { border: 0; background: none; padding: 8px 0; }
  table.mcard tr.mcard-empty td { display: block; grid-template-columns: none; }
  #repo-table .name-desc { -webkit-line-clamp: 4; }
  /* 卡片里仓库名是主入口，放大一点、留足手指点的高度 */
  table.mcard td a.name-link { display: inline-block; padding: 5px 0; font-size: 15px; }
  table.mcard td a.name-link strong { font-size: 15px; }
}

@media (max-width: 900px) {
  /* ---------- 骨架 ---------- */
  html, body { height: auto; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .layout { display: block; min-height: auto; }
  .sidebar { display: none; }
  .main {
    width: 100%; max-width: 100%; padding: 12px 12px calc(26px + env(safe-area-inset-bottom, 0px));
  }

  /* ---------- 底部标签栏 ---------- */
  #mtab {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    background: rgba(13, 17, 24, .96);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-soft);
  }
  #mtab button {
    appearance: none; background: none; border: 0; border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 50px; padding: 4px 2px; color: var(--text-mute); font-size: 11px; font-family: inherit;
  }
  #mtab button .mt-ico { font-size: 16px; line-height: 1; }
  #mtab button.active { color: #dbeafe; background: rgba(59, 130, 246, .16); }
  #mtab button.active .mt-ico { color: var(--accent-2); }

  /* ---------- 「更多」抽屉 ---------- */
  #msheet-mask {
    display: flex; align-items: flex-end; position: fixed; inset: 0; z-index: 70;
    background: rgba(4, 7, 12, .6);
  }
  #msheet-mask.hidden { display: none; }
  #msheet {
    width: 100%; background: var(--bg-card); border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .5); animation: sheetup .18s ease;
  }
  @keyframes sheetup { from { transform: translateY(24px); opacity: .6; } }
  .msheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
  .msheet-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .msheet-brand .msheet-logo { width: 28px; height: 28px; flex: 0 0 auto; }
  .msheet-title { font-size: 13.5px; font-weight: 620; }
  .msheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .msheet-grid button {
    justify-content: center; min-height: 46px; font-size: 13px; border-radius: 10px;
  }
  .msheet-grid button.active { border-color: rgba(59, 130, 246, .5); color: #dbeafe; background: rgba(59, 130, 246, .14); }
  .msheet-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px;
    border-top: 1px solid var(--border-soft); }

  /* ---------- 页头 / 卡片 ---------- */
  .page-head { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 12px; }
  .page-head > .row { width: 100%; }
  .page-head h1 { font-size: 18px; }
  .page-head .sub { font-size: 12.5px; line-height: 1.6; }
  .page-head .row > button { flex: 1 1 calc(50% - 5px); min-height: 40px; justify-content: center; }
  .card { padding: 12px; border-radius: 12px; }
  .card + .card { margin-top: 10px; }
  .card-title { font-size: 13.5px; margin-bottom: 10px; flex-wrap: wrap; }
  .grid { gap: 10px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  #stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .v { font-size: 19px; }

  /* ---------- 标签页 ---------- */
  .tabs { overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 9px 12px; font-size: 13px; min-height: 40px; display: flex; align-items: center; }

  /* ---------- 表单：整行铺满，字号 16px 防 iOS 自动放大 ---------- */
  .row { gap: 8px; }
  .row > input, .row > select, .row > textarea { flex: 1 1 100%; width: 100% !important; max-width: none !important; }
  .row > button, .row > .btn { flex: 1 1 auto; min-height: 42px; justify-content: center; }
  .row > .spacer { display: none; }
  input, select, textarea { min-height: 44px; font-size: 16px; padding: 10px 12px; border-radius: 10px; }
  textarea { min-height: 96px; font-size: 15px; }
  label.field > span.lbl { font-size: 12.5px; }
  .checkbox { font-size: 13.5px; min-height: 32px; }
  .checkbox input { width: 18px; height: 18px; }
  button, .btn { min-height: 42px; font-size: 13.5px; }
  button.sm, .btn.sm { min-height: 36px; font-size: 12.5px; padding: 6px 10px; }
  .inline { flex-wrap: wrap; }

  /* ---------- 表格：卡片模式由上面的 1200px 块负责，这里只管间距 ---------- */
  .table-wrap { overflow-x: visible; }
  table.mcard td { grid-template-columns: 76px minmax(0, 1fr); }

  /* ---------- 地址 / 代码 ---------- */
  .url-row { flex-wrap: wrap; padding: 9px 11px; gap: 6px; }
  .url-row .tag { flex: 0 0 auto; }
  .url-row code { flex: 1 1 100%; white-space: pre-wrap; word-break: break-all; font-size: 12.5px; }
  .url-row button { margin-left: auto; min-height: 36px; }
  pre.code { font-size: 11.5px; padding: 10px 12px; overflow-x: auto; }
  .kv { grid-template-columns: 84px minmax(0, 1fr); font-size: 13px; gap: 6px 10px; }
  .bar-row { grid-template-columns: 76px minmax(0, 1fr) 52px; font-size: 12px; }

  /* ---------- 弹窗：底部面板，标题与按钮固定 ---------- */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0;
    display: flex; flex-direction: column; overflow: hidden;
  }
  .modal-head { padding: 13px 14px; position: sticky; top: 0; z-index: 2; background: var(--bg-card); }
  .modal-body { padding: 12px 14px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    position: sticky; bottom: 0; z-index: 2; background: var(--bg-card); border-top: 1px solid var(--border-soft);
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .modal-foot button { width: 100%; justify-content: center; }
  .modal.fill { height: 92dvh; max-height: 92dvh; }
  .reader-body { max-height: none; font-size: 15px; line-height: 1.9; padding: 14px; }
  .note-view { max-height: 52vh; font-size: 13.5px; padding: 12px 14px; }

  /* ---------- 分页 ---------- */
  .pager, .pager-row, .table-pager { flex-wrap: wrap; }
  .pager button, .pager-row button { min-height: 38px; }

  /* ---------- 技能检索栏 ---------- */
  .skill-block { margin-top: 14px; }
  .ver-item { padding: 12px; }
  .ver-acts { gap: 8px; }
  .ver-acts .btn, .ver-acts button { flex: 1 1 auto; min-height: 38px; font-size: 13px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; }
  .skill-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .skill-tools > input, .skill-tools > select, .skill-tools > button { grid-column: span 1; width: 100% !important; max-width: none !important; }
  .skill-tools > input { grid-column: 1 / -1; }
  .skill-tools > strong, .skill-tools > .small, .skill-tools > .spacer { grid-column: 1 / -1; }
  .skill-tools > .spacer { display: none; }
  .skill-kv { grid-template-columns: 88px minmax(0, 1fr); }

  /* ---------- AI 分析页：单列卡片 ---------- */
  #ai-result-hint { display: none; }
  .ai-submit #btn-analyze { flex: 1 1 100%; }
  .ai-submit #ai-status { flex: 1 1 100%; text-align: center; }
  .ai-result-head .ai-result-title { font-size: 14px; }
  .ai-summary { max-height: 180px; font-size: 12.5px; padding: 10px 12px; }
  .ai-repos { border: 0; border-radius: 0; overflow: visible; display: flex; flex-direction: column; gap: 8px; }
  .ai-repo-head { display: none; }
  .ai-repo {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-areas: "chk name" "chk cat" "chk reason";
    align-items: start; gap: 6px 8px; padding: 10px 12px;
    border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-soft);
  }
  .ai-repo .ai-chk { grid-area: chk; padding-top: 2px; }
  .ai-repo .ai-name { grid-area: name; font-size: 13px; font-weight: 600; }
  .ai-repo .ai-cat { grid-area: cat; }
  .ai-repo .ai-reason { grid-area: reason; font-size: 12px; }
  .ai-actions button { flex: 1 1 auto; }
  .ai-fail-actions button { flex: 1 1 auto; }
  .ai-pull {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "repo state" "cat size"; gap: 4px 8px; padding: 9px 11px;
  }
  .ai-pull .p-repo { grid-area: repo; }
  .ai-pull .p-state { grid-area: state; text-align: right; }
  .ai-pull .p-cat { grid-area: cat; }
  .ai-pull .p-size { grid-area: size; text-align: right; }

  /* ---------- 徽标 / 小字 ---------- */
  .chip { font-size: 11px; }
  .badge { font-size: 11.5px; }
  .tiny { font-size: 11.5px; }
}

/* ---------- 小屏手机（≤520px）---------- */
@media (max-width: 520px) {
  .main { padding: 10px 10px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .page-head h1 { font-size: 17px; }
  .page-head .sub { font-size: 12px; }
  .card { padding: 11px; }
  #stat-cards { grid-template-columns: minmax(0, 1fr); }
  .modal { max-height: 94dvh; border-radius: 14px 14px 0 0; }
  .modal-body { padding: 10px 12px; }
  table.mcard td { grid-template-columns: 68px minmax(0, 1fr); font-size: 12.5px; }
  table.mcard td::before { font-size: 11px; }
  #mtab button { font-size: 10.5px; }
  .modal-foot { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* 手机端下侧栏底部的页脚不再显示（信息移进「更多」抽屉） */
@media (max-width: 900px) {
  .sidebar-foot { display: none; }
}
