/* GitHub Accelerator 设计系统
   Colours, spacing and radii are declared once and reused everywhere so the
   whole product keeps a single, calm visual language. */

:root {
  --bg: #f5f7fa;
  --bg-soft: #eef1f6;
  --card: #ffffff;
  --text: #111827;
  --text-muted: #667085;
  --text-soft: #8b93a1;
  --border: #e5e7eb;
  --border-strong: #d5dae2;
  --primary: #1f2937;
  --primary-hover: #111827;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --accent-strong: #1d4ed8;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warn: #b45309;
  --warn-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info-soft: #f0f9ff;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 8px 24px -12px rgba(16, 24, 40, .18);
  --shadow-lg: 0 24px 48px -24px rgba(16, 24, 40, .28);
  --container: 1240px;
  --nav-height: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }

code, pre, .mono { font-family: var(--mono); font-size: .875em; }

/* ---------- 布局 ---------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.page { min-height: 100vh; display: flex; flex-direction: column; }
.page-main { flex: 1; padding: 40px 0 72px; }

.section { margin-bottom: 56px; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-head p { margin: 6px 0 0; color: var(--text-muted); }
.eyebrow {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* ---------- 导航 ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.nav.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 1px 12px rgba(16, 24, 40, .05);
  background: rgba(255, 255, 255, .9);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.brand-name { font-size: 1rem; letter-spacing: -.01em; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: .925rem;
}
.nav-link:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-link.is-active { color: var(--text); background: var(--bg-soft); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-user { display: flex; align-items: center; gap: 10px; }

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }

.nav-mobile {
  display: none;
  position: fixed;
  inset: var(--nav-height) 0 auto 0;
  z-index: 39;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px 20px;
  box-shadow: var(--shadow);
}
.nav-mobile.is-open { display: block; }
.nav-mobile a {
  display: block;
  padding: 12px 4px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.nav-mobile a:last-child { border-bottom: 0; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: .925rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .6); }
.btn-accent:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }
.btn-danger:hover { background: #fee4e2; }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 24px; }
.card-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h2, .card-head h3 { font-size: 1rem; }
.card-body { padding: 24px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- 首屏 ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 64px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(1000px 420px at 12% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(760px 380px at 92% 0%, rgba(15, 118, 110, .08), transparent 55%),
    var(--card);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(17, 24, 39, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(17, 24, 39, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 780px; }
.hero h1 { font-size: 2.9rem; letter-spacing: -.025em; }
.hero .lead { margin: 18px 0 28px; font-size: 1.08rem; color: var(--text-muted); max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-meta { margin-top: 26px; display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-soft); font-size: .875rem; }

.gradient-text {
  background: linear-gradient(96deg, #1f2937 12%, #2563eb 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 统计数字 ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stat {
  position: relative;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: .875rem; font-weight: 500; }
.stat-label svg { width: 16px; height: 16px; color: var(--text-soft); }
.stat-value { margin-top: 12px; font-size: 1.85rem; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-foot { margin-top: 8px; font-size: .8rem; color: var(--text-soft); }

/* ---------- 服务卡片 ---------- */

.service {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.service:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.service-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.service-icon svg { width: 22px; height: 22px; }
.service h3 { font-size: 1.05rem; }
.service p { color: var(--text-muted); margin: 0; font-size: .925rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 500;
}

/* ---------- 服务状态 ---------- */

.status-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.status-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.status-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-soft); display: inline-block; }
.dot-ok { background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, .15); }
.dot-warn { background: #f79009; box-shadow: 0 0 0 3px rgba(247, 144, 9, .15); }
.dot-bad { background: #f04438; box-shadow: 0 0 0 3px rgba(240, 68, 56, .15); }
.status-text { font-size: .875rem; color: var(--text-muted); }

/* ---------- 表单 ---------- */

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field label { font-weight: 600; font-size: .875rem; }
.field .hint { color: var(--text-soft); font-size: .8rem; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--card);
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.input::placeholder { color: var(--text-soft); }
.input-mono { font-family: var(--mono); font-size: .9rem; }

.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.checkbox { display: flex; align-items: center; gap: 9px; font-size: .925rem; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--accent); }

/* ---------- 提示条 ---------- */

.alert {
  display: flex;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: .9rem;
  margin-bottom: 18px;
}
.alert-error { background: var(--danger-soft); border-color: #fecdca; color: #912018; }
.alert-success { background: var(--success-soft); border-color: #abefc6; color: #054f31; }
.alert-info { background: var(--info-soft); border-color: #b9e6fe; color: #0b4a6f; }
.alert-warn { background: var(--warn-soft); border-color: #fedf89; color: #93370d; }

/* ---------- 代码块 ---------- */

.code {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #1e293b;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 8px 16px;
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  font-size: .78rem;
  color: #94a3b8;
}
.code pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: .86rem;
  line-height: 1.7;
  white-space: pre;
}
.code-copy {
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: .75rem;
  font-family: inherit;
  cursor: pointer;
}
.code-copy:hover { background: rgba(255, 255, 255, .14); }
.code-light {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}
.code-light .code-head { background: rgba(17, 24, 39, .03); border-bottom-color: var(--border); color: var(--text-muted); }
.code-light .code-copy { border-color: var(--border-strong); background: var(--card); color: var(--text-muted); }

/* ---------- 表格 ---------- */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.table th, table.table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table.table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #fafbfc;
  white-space: nowrap;
}
table.table tbody tr:hover { background: #fafbfc; }
table.table td { vertical-align: middle; }
.cell-mono { font-family: var(--mono); font-size: .84rem; color: var(--text-muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--text-muted);
}
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- 标签页 ---------- */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab {
  padding: 10px 14px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: .925rem;
  font-weight: 550;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--text); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- 侧边栏页面 ---------- */

.layout-side { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.side {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-xs);
}
.side-title {
  padding: 8px 10px 6px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.side a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .9rem;
}
.side a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.side a.is-active { background: var(--bg-soft); color: var(--text); font-weight: 600; }

/* ---------- 管理后台 ---------- */

.admin { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.admin-side {
  background: #0f172a;
  color: #cbd5e1;
  padding: 18px 14px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; padding: 6px 10px 18px; }
.admin-brand svg { width: 26px; height: 26px; }
.admin-nav-group { margin-bottom: 16px; }
.admin-nav-title { padding: 6px 10px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #64748b; }
.admin-side a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: .9rem;
}
.admin-side a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.admin-side a.is-active { background: rgba(37, 99, 235, .22); color: #fff; font-weight: 600; }
.admin-side svg { width: 17px; height: 17px; opacity: .85; }
.admin-body { display: flex; flex-direction: column; min-width: 0; }
.admin-top {
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 26px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.admin-top h1 { font-size: 1.05rem; }
.admin-top-right { display: flex; align-items: center; gap: 14px; font-size: .875rem; color: var(--text-muted); }
.admin-main { padding: 26px; }
.admin-side-toggle { display: none; }

/* ---------- 其它 ---------- */

.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 18px; font-size: .92rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

.empty { padding: 40px 20px; text-align: center; color: var(--text-soft); }
.empty svg { width: 34px; height: 34px; opacity: .35; margin-bottom: 10px; }

.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 18px; font-size: .875rem; color: var(--text-muted); }

.list-divider > * + * { border-top: 1px solid var(--border); }

.msg { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); margin-bottom: 14px; }
.msg-admin { background: var(--accent-soft); border-color: #c7d7fe; }
.msg-meta { display: flex; justify-content: space-between; gap: 12px; font-size: .8rem; color: var(--text-soft); margin-bottom: 8px; }
.msg-body { white-space: pre-wrap; word-break: break-word; }

.footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 40px 0 28px;
  font-size: .89rem;
  color: var(--text-muted);
}
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 28px; margin-bottom: 26px; }
.footer h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); margin-bottom: 10px; }
.footer a { display: block; color: var(--text-muted); padding: 4px 0; }
.footer a:hover { color: var(--text); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: space-between;
  padding-top: 20px; border-top: 1px solid var(--border); font-size: .84rem; color: var(--text-soft);
}
.footer-stats { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 16px; font-size: .84rem; }

.doc-body { font-size: .96rem; line-height: 1.8; }
.doc-body h1 { font-size: 1.9rem; margin: 0 0 18px; }
.doc-body h2 { font-size: 1.28rem; margin: 34px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.doc-body h3 { font-size: 1.06rem; margin: 24px 0 10px; }
.doc-body p, .doc-body ul, .doc-body ol { margin: 0 0 14px; }
.doc-body li { margin-bottom: 6px; }
.doc-body pre {
  background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: var(--radius);
  overflow-x: auto; font-size: .86rem; line-height: 1.7;
}
.doc-body code { background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; font-size: .86em; }
.doc-body pre code { background: transparent; padding: 0; color: inherit; }
.doc-body table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: .9rem; }
.doc-body th, .doc-body td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.doc-body th { background: #fafbfc; font-weight: 600; }
.doc-body blockquote {
  margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: #1e3a8a;
}
.doc-body img { max-width: 100%; border-radius: var(--radius-sm); }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }

.chart { width: 100%; height: 260px; display: block; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .82rem; color: var(--text-muted); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.meter { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }

.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; }
.toast {
  padding: 12px 16px; border-radius: 10px; background: #111827; color: #f9fafb;
  font-size: .875rem; box-shadow: var(--shadow-lg); animation: toast-in .22s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.fade-in { animation: fade-in .4s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

@media (max-width: 900px) {
  .layout-side { grid-template-columns: 1fr; }
  .side { position: static; }
  .grid-3 { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .admin-side {
    position: fixed; inset: 0 auto 0 0; width: 258px; z-index: 50;
    transform: translateX(-100%); transition: transform .24s ease;
    height: 100vh;
  }
  .admin-side.is-open { transform: none; }
  .admin-side-toggle { display: inline-flex; }
  .status-list { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links, .nav-actions { display: none; }
  .nav-toggle { display: inline-flex; }
  .hero { padding: 48px 0 40px; }
  .hero h1 { font-size: 2.05rem; }
  .hero .lead { font-size: 1rem; }
  .container, .nav-inner { padding: 0 18px; }
  .grid-2, .grid-4, .field-row, .footer-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 18px; }
  .stat-value { font-size: 1.5rem; }
  .admin-main { padding: 16px; }
  .admin-top { padding: 0 16px; }
  .card-pad, .card-body { padding: 18px; }
  .kv { grid-template-columns: 1fr; gap: 4px 0; }
  .kv dd { margin-bottom: 10px; }
  /* 模板里为桌面端写死的多列内联网格，手机上强制收成单列/两列 */
  .grid[style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .stat-grid[style*="grid-template-columns"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 430px) {
  h1 { font-size: 1.7rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-grid[style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .footer-bottom { flex-direction: column; }
}

/* ==========================================================================
   手机端加固
   目标：任何页面在 320px 宽的手机上都不会撑破屏幕宽度
   （页面一旦比屏幕宽，手机浏览器会整体缩小，表现为「字号/布局大小异常」）。
   ========================================================================== */

html,
body {
  max-width: 100%;
}

/* 兜底：极窄屏幕下仍有个别长内容时，避免整页横向滚动。
   clip 不产生滚动容器，因此不会影响 position: sticky。 */
body {
  overflow-x: hidden;
}

@supports (overflow-x: clip) {
  body {
    overflow-x: clip;
  }
}

/* ==========================================================================
   防“网格被长内容撑破”
   grid / flex 子项默认 min-width:auto，会取内容的最小宽度。
   加速地址、代码块、长标识符这类不可断词的内容会因此把整页撑宽，
   浏览器随后整体缩小，media query 失效 → 桌面布局被套用到手机上。
   给这些容器统一加 min-width:0，长内容改为容器内部横向滚动。
   ========================================================================== */
.grid > *,
.layout-side > *,
.admin-body,
.admin-main,
.card,
.stat,
.code,
.table-wrap,
.msg {
  min-width: 0;
}

/* 键值表：两侧都可以收缩，避免长接口路径顶宽卡片 */
.kv {
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr);
}

.kv dt,
.kv dd,
.cell-mono,
.doc-body td,
.doc-body th {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 代码块内部保持不换行 + 自身横向滚动 */
pre,
.code pre,
.doc-body pre {
  overflow-wrap: normal;
  word-break: normal;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

/* 卡片头部与区块头部允许换行：内部常带搜索表单和按钮 */
.card-head,
.section-head {
  flex-wrap: wrap;
}

.card-head form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

/* 代码块与长链接：内部横向滚动，不撑破父容器 */
.code,
.code pre,
.doc-body pre {
  max-width: 100%;
}

.code pre,
pre {
  overflow-x: auto;
}

/* 表格容器：移动端惯性滚动 */
.table-wrap {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* --------------------------------------------------------------------------
   折叠式侧栏（文档目录 / 用户中心导航）
   桌面端侧栏常驻；手机上一份完整目录会把首屏占满，正文要滚动很久才能看到。
   这里用 :checked 兄弟选择器实现纯 CSS 折叠面板：默认收起，点标题展开，
   不依赖 JavaScript，也不依赖 details/summary 的浏览器实现差异。
   模板见 layout/site.html 中的 side_nav_toggle。
   -------------------------------------------------------------------------- */

.side-nav-cb,
.side-nav-btn {
  display: none;
}

.side-nav-btn {
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.side-nav-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex: none;
}

/* 右侧箭头：展开后翻转，给用户状态反馈 */
.side-nav-btn::after {
  content: "";
  margin-left: auto;
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-top-color: var(--text-soft);
  transform: translateY(2px);
  transition: transform .2s ease;
}

.side-nav-cb:checked ~ .side-nav-btn::after {
  transform: rotate(180deg) translateY(2px);
}

@media (max-width: 900px) {
  .side-nav-btn {
    display: flex;
  }
  /* 收起时不渲染侧栏，正文直接出现在标题下方 */
  .side-nav-cb:not(:checked) ~ .side {
    display: none;
  }
  /* 展开后限制高度，目录很长也只需要在面板内部滚动 */
  .side-nav-cb:checked ~ .side {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* 文档正文里的宽表格：自身滚动，而不是把整页撑宽 */
.doc-body table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

/* 主题里的二维码尽量自适应 */
.qr-code {
  width: 100%;
  height: auto;
  max-width: 220px;
}

/* --------------------------------------------------------------------------
   链接转换器：目标客户端标签页与快捷示例
   标签页与示例都是按钮而不是链接，样式需要自己写，
   同时要保证手机上四五个标签能自动换行、不撑破屏幕。
   -------------------------------------------------------------------------- */

.gh-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.gh-tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.gh-tab:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
}

.gh-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 不适用当前链接的形态（例如对文件地址做 git clone）置灰并给出原因 */
.gh-tab:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.gh-samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  min-width: 0;
}

.gh-samples-label {
  font-size: .875rem;
  color: var(--text-muted);
}

.gh-chip {
  padding: 6px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.gh-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

@media (max-width: 768px) {
  /* 卡片头部的搜索/筛选表单在手机上占满一行，
     并覆盖模板里为桌面端写死的像素宽度 */
  .card-head {
    align-items: flex-start;
    gap: 10px;
  }

  .card-head > form {
    width: 100%;
  }

  .card-head form .input,
  .card-head form .select {
    width: auto !important;
    min-width: 0 !important;
    flex: 1 1 130px;
  }

  .card-head form .btn {
    flex: 0 0 auto;
  }

  .card-head h2,
  .card-head h3 {
    flex: 1 1 100%;
  }

  /* 分页、统计等内联网格在手机上单列 */
  .pager {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .admin-top-right > a:first-child {
    display: none; /* 手机端隐藏「访问主站」，避免顶栏拥挤 */
  }

  .admin-top-right > span {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  table.table {
    font-size: .85rem;
  }

  table.table th,
  table.table td {
    padding: 10px 12px;
  }

  .side {
    max-height: none;
  }
}

@media (max-width: 480px) {
  .container,
  .nav-inner {
    padding: 0 14px;
  }

  .card-head,
  .card-body,
  .card-pad {
    padding: 14px;
  }

  .card-head h2 {
    font-size: .95rem;
  }

  .btn {
    padding: 9px 14px;
  }

  .stat-value {
    font-size: 1.45rem;
  }

  /* 链接转换器：手机上压缩标签与示例胶囊，保证一行能放下更多 */
  .gh-tab {
    padding: 7px 12px;
    font-size: .82rem;
  }

  .gh-chip {
    padding: 5px 10px;
    font-size: .78rem;
  }

  .gh-samples {
    gap: 6px;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .kv {
    font-size: .88rem;
  }

  .admin-top {
    padding: 0 12px;
  }

  .admin-main {
    padding: 12px;
  }
}
