:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2128;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --up: #12805c;
  --warn: #b54708;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --panel: #171b21;
    --text: #e6e9ee;
    --muted: #8b95a5;
    --line: #262c35;
    --accent: #6ea0ff;
    --accent-soft: #1b2740;
    --up: #4cc79a;
    --warn: #f0a35b;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; color: var(--accent); line-height: 1; }
h1 { margin: 0; font-size: 18px; }
#meta { margin: 0; color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 12px; }
.progress { color: var(--muted); font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

main { min-width: 0; }
.hl { min-width: 0; }
.side { position: sticky; top: 76px; align-self: start; }
#cats { display: flex; flex-direction: column; gap: 2px; }
.cat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
}
.cat:hover { background: var(--accent-soft); }
.cat.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cat .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.hl {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.hl h3 { margin: 0 0 8px; font-size: 13px; }
.hl .hint { color: var(--muted); font-size: 12px; margin: 0; }
.hl ol { margin: 0; padding: 0; list-style: none; }
.hl li { padding: 4px 0; }
.hl li .row { display: flex; justify-content: space-between; gap: 8px; }
.hl li .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl li a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl li a:hover { color: var(--accent); }
.hl li .row .dl-mini { flex: none; overflow: visible; color: var(--muted); }
.hl li .row .dl-mini:hover { color: var(--accent); }
.hl li span { color: var(--up); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.toolbar input, .toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
.toolbar input[type="search"] { flex: 1 1 260px; min-width: 0; }
.toolbar .chk { display: flex; align-items: center; gap: 6px; padding: 0 4px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.toolbar .chk input { padding: 0; }

/* 历史快照提示条 */
.histbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--warn) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
  border-radius: var(--radius);
}
.histbar b { color: var(--warn); }

/* 翻译费用面板 */
.cost {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cost h2 { margin: 0 0 4px; font-size: 15px; }
.cost .note { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.cost .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.cost .stat { padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.cost .stat .k { color: var(--muted); font-size: 12px; }
.cost .stat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cost .forecast { margin: 0 0 12px; padding: 10px 12px; background: var(--accent-soft); border-radius: 8px; }
.cost .forecast p { margin: 2px 0; }
.cost .tablewrap { overflow-x: auto; }
.cost table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cost th, .cost td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.cost th:first-child, .cost td:first-child { text-align: left; }
.cost th { color: var(--muted); font-weight: 500; font-size: 12px; }
.cost .foot { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.count { margin: 6px 2px 10px; color: var(--muted); font-size: 12px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card:hover { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-title { font-weight: 600; font-size: 15px; color: var(--accent); text-decoration: none; word-break: break-all; }
.card-title:hover { text-decoration: underline; }
.card-title .owner { color: var(--muted); font-weight: 400; }
.stars { white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
/* 下载源码按钮 */
.dl {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.dl:hover { background: var(--accent); color: var(--panel); }
.dl .sz { opacity: .75; margin-left: 4px; }
.gain { color: var(--up); font-size: 12px; margin-left: 6px; }
.desc { margin: 6px 0 8px; color: var(--text); opacity: .86; word-break: break-word; }
.desc-en { margin: -4px 0 8px; color: var(--muted); font-size: 12px; word-break: break-word; }
.chip.pending { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 12px; }
.chip {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}
.chip.new { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.topics { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.topic { font-size: 11px; padding: 0 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

.more { display: block; margin: 18px auto 0; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .side { position: static; }
  #cats { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .cat { border: 1px solid var(--line); padding: 5px 10px; }
  .highlights { grid-template-columns: minmax(0, 1fr); }
  .cost .stats { grid-template-columns: minmax(0, 1fr); }
  .histbar { flex-direction: column; align-items: flex-start; }
  .top { padding: 12px 16px; position: static; }
}
