/* 挂机工具更新日志 — 时间线风格 */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #1b1f24;
  --text-2: #59616e;
  --text-3: #8b93a1;
  --border: rgba(16, 24, 40, .10);
  --border-strong: rgba(16, 24, 40, .20);
  --accent: #185fa5;

  --c-green-bg: #eaf3de;   --c-green-fg: #3b6d11;
  --c-red-bg: #fcebeb;     --c-red-fg: #a32d2d;
  --c-blue-bg: #e6f1fb;    --c-blue-fg: #185fa5;
  --c-amber-bg: #faeeda;   --c-amber-fg: #854f0b;
  --c-gray-bg: #f1efe8;    --c-gray-fg: #5f5e5a;
  --c-purple-bg: #eeedfe;  --c-purple-fg: #534ab7;
  --c-teal-bg: #e1f5ee;    --c-teal-fg: #0f6e56;
  --c-pink-bg: #fbeaf0;    --c-pink-fg: #993556;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2024;
    --surface-2: #23282d;
    --text: #eceef1;
    --text-2: #a8b0ba;
    --text-3: #7b838e;
    --border: rgba(255, 255, 255, .10);
    --border-strong: rgba(255, 255, 255, .20);
    --accent: #85b7eb;

    --c-green-bg: rgba(151, 196, 89, .16);  --c-green-fg: #c0dd97;
    --c-red-bg: rgba(226, 75, 74, .16);     --c-red-fg: #f09595;
    --c-blue-bg: rgba(55, 138, 221, .16);   --c-blue-fg: #85b7eb;
    --c-amber-bg: rgba(239, 159, 39, .16);  --c-amber-fg: #fac775;
    --c-gray-bg: rgba(180, 178, 169, .16);  --c-gray-fg: #d3d1c7;
    --c-purple-bg: rgba(127, 119, 221, .16);--c-purple-fg: #cecbf6;
    --c-teal-bg: rgba(29, 158, 117, .16);   --c-teal-fg: #9fe1cb;
    --c-pink-bg: rgba(212, 83, 126, .16);   --c-pink-fg: #f4c0d1;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Hiragino Sans GB", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 头部 ---------- */

.site-header {
  padding: 40px 0 24px;
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 14px;
}

.meta {
  display: flex;
  gap: 10px;
}

.latest,
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 96px;
}

.meta-label {
  display: block;
  font-size: 12px;
  color: var(--text-3);
}

.latest strong { font-size: 16px; font-weight: 600; color: var(--accent); font-family: ui-monospace, Consolas, monospace; }
.stat strong { font-size: 16px; font-weight: 600; }

/* ---------- 下载区 ---------- */

.download {
  margin-bottom: 20px;
}

.download-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
}

.download-text h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.download-text p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: #0c447c; }

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.code-chip {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 13px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: none;
  color: var(--text-2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.code-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.code-chip.is-done {
  border-color: var(--c-green-fg);
  color: var(--c-green-fg);
}

@media (prefers-color-scheme: dark) {
  .btn-primary { color: #10141a; }
  .btn-primary:hover { background: #b5d4f4; }
}

/* ---------- 工具条 ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 24px;
}

.toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.chip:hover { border-color: var(--border-strong); color: var(--text); }

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .chip[aria-pressed="true"] { color: #10141a; }
}

.search input {
  width: 260px;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}

.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: var(--accent); }

/* ---------- 状态区 ---------- */

.status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-2);
  text-align: center;
}

.status[hidden] { display: none; }

.status.is-error { color: var(--c-red-fg); }
.status.is-error code {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--text);
}
.status p { margin: 0; }
.status .hint { font-size: 13px; color: var(--text-3); }

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

/* ---------- 时间线 ---------- */

.timeline {
  position: relative;
  max-width: 780px;
  margin-bottom: 50px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--border-strong);
}

.entry {
  position: relative;
  padding-left: 34px;
  padding-bottom: 32px;
}

.entry:last-child { padding-bottom: 0; }

.entry::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border-strong);
  transition: border-color .18s, background .18s, box-shadow .18s;
}

.entry:hover::before { border-color: var(--accent); }

.entry.is-latest::before {
  border-color: var(--accent);
  background: var(--accent);
}

.entry.is-target::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent);
}

.entry.is-target h2 { color: var(--accent); }

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.version {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--c-blue-bg);
  border-radius: 7px;
  padding: 2px 8px;
}

.tag-latest {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-green-fg);
  background: var(--c-green-bg);
  border-radius: 999px;
  padding: 2px 9px;
}

.date {
  font-size: 12px;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

.entry h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  transition: color .18s;
}

.summary {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 13.5px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tag {
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
}

/* ---------- 改动条目 ---------- */

.changes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.change {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: start;
  font-size: 13.5px;
  line-height: 1.55;
}

.change.no-type { grid-template-columns: 1fr; }

.change.no-type .change-text::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 8px;
  vertical-align: 3px;
  border-radius: 50%;
  background: var(--text-3);
}

.badge {
  font-size: 12px;
  line-height: 1.6;
  border-radius: 6px;
  padding: 0 7px;
  white-space: nowrap;
  font-weight: 500;
}

.badge[data-c="green"]  { background: var(--c-green-bg);  color: var(--c-green-fg); }
.badge[data-c="red"]    { background: var(--c-red-bg);    color: var(--c-red-fg); }
.badge[data-c="blue"]   { background: var(--c-blue-bg);   color: var(--c-blue-fg); }
.badge[data-c="amber"]  { background: var(--c-amber-bg);  color: var(--c-amber-fg); }
.badge[data-c="gray"]   { background: var(--c-gray-bg);   color: var(--c-gray-fg); }
.badge[data-c="purple"] { background: var(--c-purple-bg); color: var(--c-purple-fg); }
.badge[data-c="teal"]   { background: var(--c-teal-bg);   color: var(--c-teal-fg); }
.badge[data-c="pink"]   { background: var(--c-pink-bg);   color: var(--c-pink-fg); }

.change-text code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 4px;
}

/* ---------- 条目底部 ---------- */

.entry-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.entry-foot a,
.copy-btn {
  font-size: 12.5px;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}

.entry-foot a:hover,
.copy-btn:hover { color: var(--accent); text-decoration: underline; }

.copy-btn { margin-left: auto; }
.copy-btn.is-done { color: var(--c-green-fg); }

/* ---------- 页脚 ---------- */

.site-footer {
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12.5px;
}

@media (max-width: 640px) {
  .site-header { padding: 28px 0 16px; }
  .brand h1 { font-size: 21px; }
  .download-inner { flex-direction: column; align-items: stretch; padding: 16px; }
  .download-actions { width: 100%; }
  .download-actions .btn,
  .download-actions .code-chip { flex: 1 1 130px; justify-content: center; }
  .entry { padding-left: 26px; padding-bottom: 26px; }
  .entry h2 { font-size: 16.5px; }
  .search input { width: 100%; }
  .toolbar-inner { flex-direction: column; align-items: stretch; }
  .date { margin-left: 0; }
}

/* ---------- 站点导航 ---------- */

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.site-nav a {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none;
  transition: color .15s, background .15s, border-color .15s;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.site-nav a.is-active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  font-weight: 600;
}

/* ---------- API 文档：布局 ---------- */

.api-header .wrap { align-items: center; }

.api-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding-bottom: 60px;
}

.api-side {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding-right: 4px;
}

.api-search { margin-bottom: 14px; }
.api-search input { width: 100%; }

.api-cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.api-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none;
  transition: background .12s, color .12s;
}

.api-cat:hover { background: var(--surface); color: var(--text); }

.api-cat.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.api-cat-num {
  color: var(--text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.api-cat.is-active .api-cat-num { color: var(--accent); }

.api-stat {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
}

.api-main { min-width: 0; }

/* ---------- API 文档：全局提示 ---------- */

.api-notes { margin-bottom: 26px; }

.note-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.note-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}

.note-summary::-webkit-details-marker { display: none; }
.note-summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform .18s;
  margin-left: 2px;
}

.note-box[open] .note-summary::before { transform: rotate(45deg); }

.note-count {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
}

.note-list {
  margin: 0;
  padding: 0 16px 14px;
  list-style: none;
}

.note-item {
  padding: 9px 0 9px 12px;
  border-top: 1px solid var(--border);
  border-left: 2px solid var(--border-strong);
  font-size: 13px;
  line-height: 1.65;
}

.note-item-title { display: block; color: var(--text); font-weight: 600; }

.note-item-text { color: var(--text-2); }

.note-danger { border-left-color: var(--c-red-fg); }
.note-warn   { border-left-color: var(--c-amber-fg); }
.note-info   { border-left-color: var(--accent); }

/* ---------- API 文档：分组 ---------- */

.api-group { margin-bottom: 40px; scroll-margin-top: 16px; }

.api-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.api-group-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.api-group-num {
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.api-group-desc {
  margin: 0 0 14px;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- API 文档：接口卡片 ---------- */

.api-fn {
  padding: 15px 18px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  scroll-margin-top: 16px;
  transition: border-color .18s, box-shadow .18s;
}

.api-fn:hover { border-color: var(--border-strong); }

.api-fn.is-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--c-blue-bg);
}

.api-fn[hidden] { display: none; }

.api-fn-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-fn-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.api-name {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.api-badge {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--c-amber-bg);
  color: var(--c-amber-fg);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
}

.api-copy {
  margin-left: auto;
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.api-copy:hover { color: var(--text); border-color: var(--border-strong); }
.api-copy.is-done { color: var(--c-green-fg); border-color: var(--c-green-fg); }

.api-brief {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.65;
}

.api-sig {
  margin: 11px 0 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow-x: auto;
}

.api-sig code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  color: var(--text);
  white-space: pre;
}

/* 参数表 */

.api-params {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px 16px;
  margin: 12px 0 0;
}

.api-params dt {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text);
}

.api-params dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.api-type {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--accent);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  line-height: 17px;
}

/* 返回与说明 */

.api-ret {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

.api-ret code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text);
}

.api-label {
  flex: none;
  color: var(--text-3);
  font-size: 12px;
}

.api-note {
  margin: 10px 0 0;
  padding: 8px 11px;
  border-left: 2px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 0 6px 6px 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
}

.api-note .api-label { margin-right: 8px; }

.api-note.is-warn {
  border-left-color: var(--c-amber-fg);
  background: var(--c-amber-bg);
  color: var(--c-amber-fg);
}

.api-note.is-warn .api-label { color: inherit; font-weight: 600; }

/* ---------- API 文档：移动端 ---------- */

@media (max-width: 860px) {
  .api-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .api-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .api-cats {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .api-cats::-webkit-scrollbar { display: none; }

  .api-cat {
    flex: none;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
  }

  .api-stat { margin-top: 10px; padding-top: 10px; }
}

.brand-nav { margin-top: 12px; }

@media (max-width: 860px) {
  .brand-nav { margin-top: 10px; }
}

.api-list { min-width: 0; }

.api-cat-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-pdesc { flex: 1 1 200px; min-width: 0; }

/* ---------- API 文档：溢出防护 ---------- */

.api-side,
.api-cats,
.api-cat,
.api-main {
  min-width: 0;
}

.api-cats { max-width: 100%; }

.api-params dd,
.api-note,
.api-brief,
.note-item-text {
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .api-header .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .api-header .site-nav { align-self: stretch; }
}
