/* =========================================================
   JAPI Reference — Multi Dark Themes
   4 套暗色主题：Onyx · Graphite · Noir · Midnight
   通过 html[data-theme] 切换
   ========================================================= */

/* ---------- theme tokens ---------- */

:root {
  color-scheme: dark;

  /* Typography */
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "Microsoft YaHei", Georgia, serif;
  --font-sans: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "Fira Code", "SFMono-Regular", Consolas, Monaco, monospace;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadow (theme-independent) */
  --shadow-1:   0 1px 0 rgba(255, 255, 255, 0.025) inset,
                0 6px 18px rgba(0, 0, 0, 0.40);
  --shadow-2:   0 1px 0 rgba(255, 255, 255, 0.035) inset,
                0 18px 40px rgba(0, 0, 0, 0.58);

  /* =========================================
     Midnight · 午夜蓝
     冷静深蓝底 + 冰蓝点睛 + 亮象牙正文
     ========================================= */
  --bg:           #0A0D14;
  --bg-sunken:    #07090F;
  --panel:        #11141F;
  --card:         #161B28;
  --card-raised:  #1D2330;
  --card-hover:   #252C3D;

  --ivory:        #F4F6FB;
  --body:         #E2E6F1;
  --mute:         #A8AFC1;
  --dim:          #6B7284;

  --rule:         #272D40;
  --rule-2:       #3C4256;

  --accent:       #A2B8E5;
  --accent-hi:    #C2D1F1;
  --accent-deep:  #5A74AB;

  --hue-cyan:     #A6CEDC;
  --hue-violet:   #C2B4DC;
  --hue-amber:    #E3C890;
  --hue-emerald:  #ACD1BA;
  --hue-rose:     #DD9291;

  /* glow / surface alphas */
  --accent-a05: color-mix(in srgb, var(--accent) 6%,  transparent);
  --accent-a10: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-a20: color-mix(in srgb, var(--accent) 22%, transparent);
  --accent-a35: color-mix(in srgb, var(--accent) 38%, transparent);
  --accent-a50: color-mix(in srgb, var(--accent) 55%, transparent);

  --shadow-hi:   0 0 0 1px var(--accent-a35),
                 0 22px 48px rgba(0, 0, 0, 0.65);
}

/* ---------- reset / base ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  font-family: var(--font-sans);
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-feature-settings: "ss01", "cv11";
  transition: background-color 0.35s ease, color 0.35s ease;
}

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

input, select, textarea { font: inherit; }

code, pre, .mono {
  font-family: var(--font-mono);
  font-feature-settings: "liga" 0, "calt" 0;
}

::selection { background: var(--accent-a35); color: var(--ivory); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-a35); }

/* ---------- atmosphere ---------- */

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 60% 42% at 15% 0%, var(--accent-a10), transparent 60%),
    radial-gradient(ellipse 55% 40% at 100% 12%, rgba(255,255,255,0.025), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-sunken) 100%);
}

.app-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 65% at 50% 10%, black 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 80% 65% at 50% 10%, black 30%, transparent 85%);
}

/* ---------- layout shell ---------- */

.shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px;
}

.page {
  min-height: 100vh;
  padding-bottom: 140px;
}

/* ---------- top nav ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--rule);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent-a20) 0 6px,
    transparent 6px 12px
  );
  opacity: 0.55;
  pointer-events: none;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  user-select: none;
}

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 6px;
  background: linear-gradient(160deg, var(--card-raised) 0%, var(--bg) 100%);
  position: relative;
  display: grid; place-items: center;
  box-shadow:
    0 0 0 1px var(--accent-a35),
    0 6px 14px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--accent-a20);
  border-radius: 3px;
  pointer-events: none;
}

.brand-mark span {
  position: relative;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 0.01em;
  line-height: 1;
}

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

.brand-text b {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 17px;
  color: var(--ivory);
}

.brand-text small {
  color: var(--mute);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 2px;
  font-weight: 500;
}

.nav-tabs {
  display: flex;
  gap: 0;
  margin-left: 32px;
  padding: 0;
  border: 0;
  background: none;
  position: relative;
}

.nav-tab {
  padding: 10px 18px;
  font-size: 13.5px;
  color: var(--mute);
  border-radius: 0;
  transition: color 0.2s;
  white-space: nowrap;
  position: relative;
  font-weight: 500;
}

.nav-tab::after {
  content: "";
  position: absolute;
  left: 18px; right: 18px; bottom: 2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-tab:hover { color: var(--ivory); }
.nav-tab:hover::after { transform: scaleX(0.3); }

.nav-tab.active { color: var(--accent); }
.nav-tab.active::after { transform: scaleX(1); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--mute);
  font-size: 12px;
}

.nav-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.015) 100%);
  color: var(--mute);
  transition: color 0.18s, border-color 0.18s, background 0.18s, transform 0.18s;
}

.nav-search-trigger:hover {
  color: var(--ivory);
  border-color: var(--accent-a35);
  background: linear-gradient(180deg, var(--accent-a10) 0%, rgba(255, 255, 255, 0.02) 100%);
  transform: translateY(-1px);
}

.nav-search-trigger svg {
  flex: 0 0 auto;
  color: inherit;
}

.nav-search-text {
  min-width: 0;
  flex: 1;
  text-align: left;
  font-size: 13px;
  color: inherit;
  white-space: nowrap;
}

.nav-search-shortcut {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.pill-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--body);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.pill-stat.violet {
  color: var(--accent);
  border-color: var(--accent-a35);
  background: var(--accent-a05);
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 80px 0 46px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 48px;
}

.hero::before {
  content: "";
  position: absolute;
  top: 40px;
  left: -2px;
  width: 3px;
  height: 80px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-a50);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 11px;
  font-family: var(--font-sans);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 600;
}

.hero-kicker::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--accent);
}

.hero-title {
  margin: 22px 0 18px;
  font-family: var(--font-serif);
  font-size: clamp(42px, 6.5vw, 84px);
  line-height: 0.98;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ivory);
  font-variation-settings: "opsz" 144, "SOFT" 30;
}

.hero-title .grad {
  color: var(--accent);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 80;
}

.hero-sub {
  max-width: 560px;
  color: var(--body);
  font-size: 16px;
  line-height: 1.75;
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-variation-settings: "opsz" 14;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 34px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-1);
  max-width: 720px;
}

.hero-meta .metric {
  padding: 16px 22px;
  border-right: 1px solid var(--rule);
  background: transparent;
  flex: 1 1 160px;
  min-width: 150px;
}

.hero-meta .metric:last-child { border-right: 0; }

.hero-meta .metric .k {
  font-size: 10.5px;
  color: var(--mute);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
}

.hero-meta .metric .v {
  margin-top: 6px;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 500;
  color: var(--ivory);
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 36;
}

/* ---------- Lua engine page ---------- */

.lua-module-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-top: 18px;
}

.lua-module-sidebar {
  top: 96px;
}

.lua-module-list {
  display: grid;
  gap: 18px;
}

.lua-engine-hero .hero-sub {
  white-space: pre-line;
}

.plugin-home-hero .hero-sub {
  white-space: pre-line;
}

.plugin-home-desc {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--body);
  font-size: 16px;
  line-height: 1.85;
  white-space: pre-line;
}

.plugin-home-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 34px;
}

.plugin-home-action {
  display: flex;
  min-height: 118px;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
  box-shadow: var(--shadow-1);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.plugin-home-action:hover {
  border-color: var(--accent-a35);
  background: linear-gradient(180deg, var(--accent-a10) 0%, var(--card) 100%);
  transform: translateY(-1px);
}

.plugin-home-action span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.plugin-home-action b {
  color: var(--ivory);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 600;
}

.lua-module-card {
  padding: 24px 26px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
  box-shadow: var(--shadow-1);
}

.lua-module-card h3 {
  margin: 0;
  color: var(--ivory);
  font-family: var(--font-mono);
  font-size: 21px;
  line-height: 1.35;
  word-break: break-word;
}

.lua-module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.lua-module-head code {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: var(--panel);
  color: var(--hue-emerald);
  font-size: 11px;
  white-space: nowrap;
}

.lua-module-kicker {
  display: block;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.lua-module-card > p {
  margin: 14px 0 18px;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-line;
}

.lua-module-code {
  margin-bottom: 18px;
}

.lua-module-attachments h4 {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lua-attachment-list {
  display: grid;
  gap: 8px;
}

.lua-attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-xs);
  background: rgba(255, 255, 255, 0.02);
  color: var(--body);
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}

.lua-attachment-item:hover {
  border-color: var(--accent-a35);
  background: var(--accent-a05);
  transform: translateY(-1px);
}

.lua-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lua-attachment-size {
  flex: 0 0 auto;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ---------- main grid: sidebar + content ---------- */

.main-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: sticky;
  top: 96px;
  border: 0;
  border-right: 1px solid var(--rule);
  background: transparent;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-right: 24px;
}

.sidebar-block {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.sidebar-block-fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.sidebar-block-fill .related-list {
  flex: 1 1 auto;
  min-height: 0;
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.sidebar-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ivory);
}

.sidebar-head small {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11px;
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  padding-right: 4px;
  counter-reset: mod;
}

.module-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px 11px 40px;
  border-radius: var(--r-xs);
  color: var(--body);
  border: 1px solid transparent;
  font-size: 13.5px;
  text-align: left;
  width: 100%;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  position: relative;
  counter-increment: mod;
}

.module-item::before {
  content: counter(mod, decimal-leading-zero);
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  transition: color 0.18s;
}

.module-item:hover {
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.035);
}

.module-item:hover::before { color: var(--mute); }

.module-item.active {
  color: var(--accent);
  background: var(--accent-a10);
  border-color: var(--accent-a20);
}

.module-item.active::before { color: var(--accent); }

.module-item.active::after {
  content: "";
  position: absolute;
  right: -24px;
  top: 10%;
  bottom: 10%;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-a50);
}

.module-name {
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-item.active .module-name { font-weight: 600; }

.module-count {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  padding: 2px 8px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}

.module-item.active .module-count {
  color: var(--accent);
  background: var(--accent-a10);
  border-color: var(--accent-a35);
}

/* ---------- content ---------- */

.content { min-width: 0; }

.content-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 0 24px 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 28px;
  position: relative;
}

.content-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ivory);
  display: flex;
  align-items: center;
  gap: 16px;
  font-variation-settings: "opsz" 48;
  line-height: 1.15;
}

.content-head h2 .chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--body);
  padding: 3px 10px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--card);
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.content-head p {
  margin: 0;
  color: var(--mute);
  font-size: 14.5px;
  font-family: var(--font-serif);
  font-style: italic;
  font-variation-settings: "opsz" 14;
  line-height: 1.65;
}

.content-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.content-head-side {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.content-head-meta {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11.5px;
  display: flex;
  gap: 12px;
  align-items: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.content-head-meta .dot {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--dim);
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--card);
  box-shadow: var(--shadow-1);
}

.view-toggle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  transition: color 0.18s, background 0.18s, transform 0.18s;
}

.view-toggle:hover {
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.04);
}

.view-toggle.active {
  color: var(--bg);
  background: var(--accent);
  box-shadow: 0 8px 18px var(--accent-a35);
}

/* ---------- API card list ---------- */

.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  counter-reset: card;
}

.api-grid.list-view {
  display: block;
}

.api-card {
  counter-increment: card;
  position: relative;
  padding: 22px 22px 60px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 176px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}

.api-card::before {
  content: "№ " counter(card, decimal-leading-zero);
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  z-index: 1;
  transition: color 0.25s;
}

.api-card::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 44px;
  height: 1px;
  background: linear-gradient(90deg, var(--rule-2) 0%, transparent 75%);
  pointer-events: none;
}

.api-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-a35);
  box-shadow: var(--shadow-hi);
}

.api-card:hover::before { color: var(--accent); }

.api-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-right: 52px;
}

.api-name {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-all;
  color: var(--ivory);
  letter-spacing: -0.005em;
}

.api-name .prefix {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.95;
  font-size: 14px;
  margin-right: 2px;
}

.api-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--body);
  background: var(--panel);
  border: 1px solid var(--rule-2);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.tag.cyan {
  color: var(--hue-cyan);
  background: color-mix(in srgb, var(--hue-cyan) 10%, transparent);
  border-color: color-mix(in srgb, var(--hue-cyan) 32%, transparent);
}
.tag.violet {
  color: var(--hue-violet);
  background: color-mix(in srgb, var(--hue-violet) 10%, transparent);
  border-color: color-mix(in srgb, var(--hue-violet) 32%, transparent);
}
.tag.amber {
  color: var(--hue-amber);
  background: color-mix(in srgb, var(--hue-amber) 10%, transparent);
  border-color: color-mix(in srgb, var(--hue-amber) 36%, transparent);
}
.tag.emerald {
  color: var(--hue-emerald);
  background: color-mix(in srgb, var(--hue-emerald) 10%, transparent);
  border-color: color-mix(in srgb, var(--hue-emerald) 32%, transparent);
}
.tag.rose {
  color: var(--hue-rose);
  background: color-mix(in srgb, var(--hue-rose) 10%, transparent);
  border-color: color-mix(in srgb, var(--hue-rose) 34%, transparent);
}

.tag.tag-return {
  color: var(--body);
  background: color-mix(in srgb, var(--card) 78%, var(--panel) 22%);
  border-color: color-mix(in srgb, var(--rule-2) 76%, transparent);
}

.tag.tag-status.is-async {
  color: var(--hue-rose);
  background: color-mix(in srgb, var(--hue-rose) 12%, transparent);
  border-color: color-mix(in srgb, var(--hue-rose) 38%, transparent);
}

.tag.tag-status.is-sync {
  color: #8ce3a7;
  background: rgba(76, 175, 80, 0.14);
  border-color: rgba(76, 175, 80, 0.36);
}

.api-desc {
  color: var(--body);
  font-size: 14px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--font-serif);
  font-variation-settings: "opsz" 14;
}

.api-link { display: none; }

.api-list-table {
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 82%, var(--bg) 18%);
}

.api-list-head,
.api-list-row {
  display: grid;
  grid-template-columns: 72px minmax(220px, 1.1fr) minmax(240px, 1.7fr) minmax(280px, 1.2fr);
  align-items: center;
}

.api-col {
  min-width: 0;
  padding: 17px 16px;
}

.api-list-head {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--card) 88%, black 12%);
}

.api-list-head .api-col {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.api-list-row {
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 68%, transparent 32%);
  transition: background 0.18s, border-color 0.18s;
}

.api-list-row:last-child {
  border-bottom: 0;
}

.api-list-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.015);
}

.api-list-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.api-list-row:hover {
  background: color-mix(in srgb, var(--accent) 10%, var(--card) 90%);
}

.api-list-row .api-col {
  border-right: 1px solid color-mix(in srgb, var(--rule) 62%, transparent 38%);
}

.api-list-row .api-col:last-child,
.api-list-head .api-col:last-child {
  border-right: 0;
}

.api-list-row .api-name {
  display: block;
  font-size: 15.5px;
  line-height: 1.55;
  word-break: break-all;
}

.api-list-index {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.api-list-desc {
  display: block;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.8;
  font-family: var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-list-meta,
.api-list-return,
.api-list-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  color: var(--body);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.api-list-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.api-list-return,
.api-list-status {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: color-mix(in srgb, var(--panel) 88%, var(--bg) 12%);
  font-size: 11.5px;
  line-height: 1.2;
}

.api-list-status.is-async {
  color: var(--hue-rose);
  background: color-mix(in srgb, var(--hue-rose) 10%, transparent);
  border-color: color-mix(in srgb, var(--hue-rose) 36%, transparent);
}

.api-list-status.is-sync {
  color: #8ce3a7;
  background: rgba(76, 175, 80, 0.14);
  border-color: rgba(76, 175, 80, 0.34);
}

/* ---------- empty state ---------- */

.empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--mute);
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-md);
  background: var(--panel);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  font-variation-settings: "opsz" 14;
}

.empty svg { margin-bottom: 16px; color: var(--dim); }

/* ---------- pagination ---------- */

.pagination {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  gap: 4px;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  background: transparent;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: all 0.18s;
  font-variant-numeric: tabular-nums;
}

.pagination button:hover:not(:disabled):not(.active) {
  color: var(--ivory);
  border-color: var(--rule-2);
  background: var(--card);
}

.pagination button.active {
  color: var(--bg);
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 6px 18px var(--accent-a35);
}

.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }

.pagination .ellipsis {
  min-width: 20px;
  color: var(--dim);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
}

/* ---------- detail page ---------- */

.detail-hero {
  position: relative;
  padding: 40px 48px 44px;
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
  background:
    radial-gradient(ellipse 90% 120% at 100% 0%, var(--accent-a10), transparent 55%),
    linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  margin-bottom: 28px;
}

.detail-hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent-a50);
}

.detail-hero::after {
  content: "ENTRY";
  position: absolute;
  top: 20px;
  right: 28px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--mute);
  font-weight: 600;
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font-size: 12px;
  font-family: var(--font-mono);
  margin-bottom: 20px;
  letter-spacing: 0.04em;
}

.detail-breadcrumb a { color: var(--mute); transition: color 0.18s; }
.detail-breadcrumb a:hover { color: var(--accent); }
.detail-breadcrumb svg { color: var(--dim); }

/* 标题行：函数名 + 复制按钮 */
.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 18px;
}

.detail-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.25;
  font-weight: 600;
  word-break: break-all;
  color: var(--ivory);
}

.detail-title .grad { color: var(--ivory); font-style: normal; }

.detail-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  background: var(--accent);
  margin-top: 14px;
  box-shadow: 0 0 16px var(--accent-a50);
}

/* 复制按钮 */
.copy-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: var(--r-xs);
  border: 1px solid var(--rule-2);
  background: var(--card);
  color: var(--mute);
  display: grid;
  place-items: center;
  transition: color 0.18s, border-color 0.18s, background 0.18s, transform 0.18s;
  margin-top: 6px;
  cursor: pointer;
  position: relative;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-a05);
  transform: translateY(-1px);
}

.copy-btn:active { transform: translateY(0); }

.copy-btn svg { display: block; }
.copy-btn .icon-check { display: none; }

.copy-btn.copied {
  color: var(--hue-emerald);
  border-color: var(--hue-emerald);
  background: color-mix(in srgb, var(--hue-emerald) 10%, transparent);
}

.copy-btn.copied .icon-copy  { display: none; }
.copy-btn.copied .icon-check { display: block; }

.copy-btn::after {
  content: attr(data-feedback);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  background: var(--panel);
  border: 1px solid var(--rule-2);
  color: var(--ivory);
  font-size: 11.5px;
  font-family: var(--font-sans);
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
}

.copy-btn.copied::after {
  opacity: 1;
  transform: translateY(0);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--card-raised) 92%, white 8%) 0%, var(--card) 100%);
  color: var(--ivory);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.ghost-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--rule-2) 40%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.ghost-btn:active { transform: translateY(0); }

.ghost-btn.copied {
  color: var(--hue-emerald);
  border-color: var(--hue-emerald);
  background: color-mix(in srgb, var(--hue-emerald) 10%, transparent);
}

.ghost-btn svg {
  flex: 0 0 auto;
  display: block;
}

.template-modal,
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.template-modal.is-open,
.spotlight.is-open {
  opacity: 1;
  pointer-events: auto;
}

.template-modal-backdrop,
.spotlight-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    radial-gradient(circle at top, rgba(125, 211, 252, 0.14), transparent 38%),
    rgba(7, 10, 18, 0.78);
  backdrop-filter: blur(18px);
}

.template-modal-panel,
.spotlight-panel {
  position: relative;
  width: min(900px, calc(100vw - 32px));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--rule) 82%);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(17, 23, 39, 0.96) 0%, rgba(10, 14, 24, 0.98) 100%);
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.template-modal-head,
.spotlight-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.template-modal-title-wrap,
.spotlight-title-wrap {
  min-width: 0;
  flex: 1;
}

.template-modal-title,
.spotlight-title {
  margin: 0;
  color: var(--ivory);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.template-modal-subtitle,
.spotlight-subtitle {
  margin-top: 4px;
  color: var(--mute);
  font-size: 12px;
  line-height: 1.6;
}

.modal-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--mute);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.modal-close-btn:hover {
  color: var(--ivory);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.template-modal-body {
  padding: 22px;
}

.template-code-wrap {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: rgba(7, 10, 18, 0.78);
  overflow: hidden;
}

.template-code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.template-code-label {
  color: var(--mute);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.template-code {
  margin: 0;
  padding: 20px 22px 24px;
  max-height: min(62vh, 640px);
  overflow: auto;
  color: var(--ivory);
  font-size: 13px;
  line-height: 1.85;
  font-family: var(--font-mono);
  white-space: pre;
}

.template-code code { color: inherit; }

.template-code code.hljs,
.template-code .hljs {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
}

.create-api-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.78fr);
  gap: 22px;
  align-items: start;
}

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

.editor-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.editor-field {
  display: block;
}

.editor-label {
  display: block;
  margin-bottom: 8px;
  color: var(--mute);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.editor-input,
.editor-textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ivory);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.7;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

select.editor-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--mute) 50%),
    linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

select.editor-input option {
  color: var(--ivory);
  background: #141a24;
}

.editor-input:focus,
.editor-textarea:focus {
  outline: none;
  border-color: var(--accent-a50);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.08);
}

.editor-textarea {
  resize: vertical;
  min-height: 120px;
}

.editor-codearea {
  font-family: var(--font-mono);
  white-space: pre-wrap;
}

.editor-table-wrap {
  overflow-x: auto;
}

.draft-preview-card {
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.025);
  padding: 18px 18px 20px;
}

.draft-preview-kicker {
  color: var(--mute);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.draft-preview-title {
  margin-top: 10px;
  color: var(--ivory);
  font-size: 24px;
  line-height: 1.25;
  font-family: var(--font-mono);
  font-weight: 600;
  word-break: break-word;
}

.draft-preview-desc {
  margin-top: 12px;
  color: var(--body);
  font-size: 14px;
  line-height: 1.8;
}

.draft-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.draft-check-list {
  display: grid;
  gap: 10px;
}

.draft-check-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  color: var(--body);
  background: rgba(255, 255, 255, 0.02);
  font-size: 14px;
  line-height: 1.7;
}

.draft-check-item.is-done {
  border-color: color-mix(in srgb, var(--hue-emerald) 28%, var(--rule) 72%);
  background: color-mix(in srgb, var(--hue-emerald) 8%, transparent);
  color: var(--ivory);
}

.draft-actions {
  display: grid;
  gap: 10px;
}

.spotlight-panel {
  width: min(760px, calc(100vw - 32px));
}

.spotlight-head {
  gap: 16px;
  padding: 20px 22px 18px;
}

.spotlight-search-icon {
  color: var(--mute);
  flex: 0 0 auto;
}

.spotlight-input-wrap {
  min-width: 0;
  flex: 1;
}

.spotlight-input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ivory);
  font-size: 20px;
  line-height: 1.4;
  font-family: var(--font-serif);
}

.spotlight-input::placeholder {
  color: color-mix(in srgb, var(--mute) 70%, transparent 30%);
  font-style: italic;
}

.spotlight-shortcut {
  flex: 0 0 auto;
  color: var(--mute);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.spotlight-body {
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 10px;
}

.spotlight-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spotlight-item {
  display: block;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  color: inherit;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}

.spotlight-item:hover,
.spotlight-item.is-active {
  border-color: color-mix(in srgb, var(--accent) 42%, rgba(255, 255, 255, 0.08) 58%);
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.09) 0%, rgba(255, 255, 255, 0.02) 100%);
  transform: translateY(-1px);
}

.spotlight-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.spotlight-item-title {
  color: var(--ivory);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.spotlight-item-meta {
  flex: 0 0 auto;
  color: var(--mute);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spotlight-item-desc {
  margin-top: 6px;
  color: var(--body);
  font-size: 13px;
  line-height: 1.7;
}

.spotlight-item-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.spotlight-item mark {
  padding: 0;
  color: var(--accent);
  background: transparent;
}

.spotlight-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 18px;
  color: var(--mute);
  text-align: center;
}

.spotlight-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: var(--mute);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

body.overlay-open {
  overflow: hidden;
}

/* 描述：正文式说明，去掉左侧装饰条，避免视觉噪音 */
.detail-desc {
  max-width: 760px;
  color: color-mix(in srgb, var(--ivory) 90%, white 10%);
  font-size: 16px;
  line-height: 1.9;
  margin: 8px 0 18px;
  padding: 0;
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.hero-overview {
  max-width: 920px;
}

.hero-overview-title {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-overview-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.hero-overview-item {
  min-width: 0;
  flex: 1 1 0;
  padding: 12px 16px;
  border-right: 1px solid var(--rule);
}

.hero-overview-item:last-child {
  border-right: 0;
}

.hero-overview-key {
  display: block;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-overview-value {
  display: block;
  margin-top: 6px;
  color: var(--ivory);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
  word-break: break-word;
}

.async-notice {
  margin: 0 0 22px;
  padding: 18px 20px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 106, 106, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 126, 126, 0.16) 0%, rgba(255, 92, 92, 0.1) 100%),
    rgba(255, 88, 88, 0.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.08);
}

.async-notice-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.async-notice-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 106, 106, 0.18);
  color: #ffc1c1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.async-notice-title {
  color: #fff0f0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.async-notice-desc {
  margin-top: 10px;
  color: rgba(255, 226, 226, 0.9);
  font-size: 14px;
  line-height: 1.85;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  color: var(--body);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-xs);
  background: var(--card);
  transition: all 0.2s;
  font-weight: 500;
}

.back-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-a05);
}

/* section blocks */

.section {
  position: relative;
  padding: 30px 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.section::before { content: none; }

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-variation-settings: "opsz" 14;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--rule-2), transparent);
}

/* =========================================================
   Signature box — 多行友好 + 左侧行号轨
   ========================================================= */

.signature-box {
  position: relative;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule-2);
  background: var(--bg-sunken);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.signature-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}

.signature-box-head .dots { display: flex; gap: 5px; }
.signature-box-head .dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dim);
}
.signature-box-head .dots span:nth-child(1) { background: var(--hue-rose);    opacity: 0.85; }
.signature-box-head .dots span:nth-child(2) { background: var(--hue-amber);   opacity: 0.85; }
.signature-box-head .dots span:nth-child(3) { background: var(--hue-emerald); opacity: 0.85; }

.signature-box-head .label {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

.signature-box-head .template-trigger {
  margin-top: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.signature-box pre {
  margin: 0;
  padding: 20px 22px 20px 26px;
  overflow-x: auto;
  color: var(--ivory);
  font-size: 13.5px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  background: transparent;
  tab-size: 4;
}

.signature-box code.hljs,
.signature-box .hljs {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
}

.signature-box code .kw    { color: var(--hue-violet); font-weight: 600; }
.signature-box code .fn    { color: var(--accent);     font-weight: 700; }
.signature-box code .type  { color: var(--hue-cyan);   font-weight: 500; }
.signature-box code .pname { color: var(--ivory); }
.signature-box code .punct { color: var(--mute); }
.signature-box code .ret   { color: var(--hue-emerald); font-weight: 600; }
.signature-box code .param { color: var(--ivory); }
.signature-box code .arrow { color: var(--accent); font-weight: 700; margin: 0 4px; }
.signature-box code .paren { color: var(--mute); }

/* =========================================================
   参数表 —— 主 sans 提高可读性
   ========================================================= */

.param-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  table-layout: auto;
}

.param-table thead th {
  padding: 13px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--mute);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--panel);
  border-bottom: 1.5px solid var(--accent-deep);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.param-table thead th:first-child { border-top-left-radius: var(--r-xs); }
.param-table thead th:last-child  { border-top-right-radius: var(--r-xs); }

.param-table th:nth-child(1),
.param-table td:nth-child(1) { width: 48px; text-align: center; }

.param-table th:nth-child(2),
.param-table td:nth-child(2) {
  white-space: nowrap;
  text-align: center;
}

.param-table th:nth-child(3),
.param-table td:nth-child(3) {
  white-space: nowrap;
  width: 1%;
  text-align: center;
}

.param-table th:nth-child(4),
.param-table td:nth-child(4) {
  white-space: nowrap;
  width: 1%;
  text-align: center;
}

.param-table thead th:nth-child(2),
.param-table thead th:nth-child(3),
.param-table thead th:nth-child(4) {
  text-align: center;
}

.param-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.6;
}

.param-table tbody tr:last-child td { border-bottom: none; }
.param-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
.param-table tbody tr:hover td { background: var(--accent-a05); }

.param-table td.idx {
  font-family: var(--font-mono);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}

.param-table td code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--panel);
  border: 1px solid var(--rule-2);
  color: var(--ivory);
  font-weight: 500;
  font-family: var(--font-mono);
}

.param-table td:nth-child(2) code {
  /* 参数名放大、加粗更显眼 */
  font-size: 13.5px;
  color: var(--ivory);
  background: var(--card);
  border-color: var(--rule-2);
  font-weight: 600;
}

.param-table .type-cell code {
  color: var(--hue-cyan);
  background: color-mix(in srgb, var(--hue-cyan) 12%, transparent);
  border-color: color-mix(in srgb, var(--hue-cyan) 36%, transparent);
  font-weight: 600;
}

.param-table .default-cell {
  text-align: center;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.param-table td:nth-child(5) {
  /* 说明列 */
  color: var(--body);
  min-width: 260px;
}

.empty-state {
  padding: 18px 20px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.02);
  color: var(--mute);
  font-size: 14px;
  line-height: 1.7;
}

.return-table-head {
  margin-bottom: 0;
}

.return-table-wrap {
  border-radius: var(--r-sm);
}

.return-table-scroll {
  overflow-x: auto;
}

.return-table {
  width: 100%;
  table-layout: fixed;
}

.return-table th:nth-child(1),
.return-table td:nth-child(1) {
  white-space: nowrap;
  width: 220px;
  min-width: 220px;
  text-align: center;
}

.return-table th:nth-child(2),
.return-table td:nth-child(2) {
  min-width: 280px;
}

.return-table tbody td {
  vertical-align: middle;
}

.return-table .type-cell code {
  display: inline-block;
  white-space: nowrap;
  word-break: keep-all;
  width: max-content;
  max-width: 100%;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.pager-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pager-card {
  display: block;
  min-width: 0;
  padding: 16px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--panel) 0%, transparent 100%);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}

.pager-card:hover {
  border-color: var(--accent-a35);
  background: linear-gradient(180deg, var(--accent-a10) 0%, transparent 100%);
  transform: translateY(-1px);
}

.pager-card.is-empty {
  opacity: 0.56;
  pointer-events: none;
}

.pager-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pager-label,
.pager-shortcut {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pager-title {
  margin-top: 10px;
  color: var(--ivory);
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.pager-desc {
  margin-top: 6px;
  color: var(--body);
  font-size: 13.5px;
  line-height: 1.7;
}

/* =========================================================
   同模块函数列表 —— 中文为主，英文变次级
   - flex column-reverse 让 desc 在上
   - fn 改成小号 mono，opacity 压低
   ========================================================= */

.related-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.related-item {
  display: flex;
  flex-direction: column-reverse;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--body);
  transition: all 0.18s;
  position: relative;
}

.related-item:last-child { border-bottom: 0; }

.related-item:hover {
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.028);
}

.related-item.active {
  color: var(--ivory);
  background: var(--accent-a10);
}

.related-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 10%; bottom: 10%;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-a50);
}

/* 英文函数名：次级、很小、低透明度 */
.related-fn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--mute);
  word-break: break-all;
  line-height: 1.4;
  font-weight: 400;
  opacity: 0.72;
  letter-spacing: 0.01em;
  transition: opacity 0.18s, color 0.18s;
}

.related-item:hover .related-fn { opacity: 0.95; color: var(--body); }
.related-item.active .related-fn { opacity: 1; color: var(--accent); font-weight: 500; }

/* 中文说明：主角、大号、衬线 */
.related-desc {
  font-family: var(--font-serif);
  font-size: 14.5px;
  color: var(--ivory);
  line-height: 1.55;
  font-style: normal;
  font-weight: 500;
  font-variation-settings: "opsz" 16;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.related-item.active .related-desc { color: var(--ivory); }

/* ---------- changelog page ---------- */

.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--rule-2);
}

.release {
  position: relative;
  margin-bottom: 52px;
}

.release::before {
  content: "";
  position: absolute;
  left: -36px;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent-deep);
}

.release.current::before {
  background: var(--accent);
  border-color: var(--accent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-a50); }
  50%      { box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.release-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.release-ver {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 500;
  color: var(--ivory);
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 48;
  line-height: 1;
}

.release.current .release-ver { color: var(--accent); font-style: italic; }

.release-date {
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.release-badge {
  font-size: 10px;
  font-family: var(--font-sans);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--accent-a10);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
}

.release-note {
  color: var(--body);
  font-size: 15px;
  line-height: 1.75;
  margin: 0 0 22px;
  font-family: var(--font-serif);
  font-style: italic;
  font-variation-settings: "opsz" 14;
  max-width: 780px;
}

.change-group {
  margin-top: 18px;
  padding: 22px 26px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--card-raised) 0%, var(--card) 100%);
  box-shadow: var(--shadow-1);
}

.change-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.change-group-head .dot-cg {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.change-group.added .dot-cg { color: var(--hue-emerald); background: var(--hue-emerald); }
.change-group.changed .dot-cg { color: var(--hue-cyan); background: var(--hue-cyan); }
.change-group.fixed .dot-cg { color: var(--hue-amber); background: var(--hue-amber); }
.change-group.removed .dot-cg { color: var(--hue-rose); background: var(--hue-rose); }
.change-group.deprecated .dot-cg { color: var(--mute); background: var(--mute); box-shadow: none; }

.change-group.added .label-cg { color: var(--hue-emerald); }
.change-group.changed .label-cg { color: var(--hue-cyan); }
.change-group.fixed .label-cg { color: var(--hue-amber); }
.change-group.removed .label-cg { color: var(--hue-rose); }
.change-group.deprecated .label-cg { color: var(--mute); }

.change-group-head .count {
  margin-left: auto;
  color: var(--mute);
  font-family: var(--font-mono);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.change-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.change-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  background: transparent;
  transition: all 0.2s;
  border-bottom: 1px solid var(--rule);
}

.change-list .change-item:last-child { border-bottom: 0; }

.change-item:hover {
  background: rgba(255, 255, 255, 0.028);
  border-bottom-color: var(--rule);
}

.change-item.clickable { cursor: pointer; }
.change-item.clickable:hover { background: var(--accent-a05); }

.change-fn {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ivory);
  word-break: break-all;
  line-height: 1.5;
  flex-shrink: 0;
  font-weight: 500;
}

.change-arrow {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 13px;
  flex: 0 0 auto;
}

.change-text {
  color: var(--body);
  font-size: 14px;
  line-height: 1.65;
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-variation-settings: "opsz" 14;
}

.change-link {
  flex: 0 0 auto;
  color: var(--dim);
  transition: color 0.18s;
  margin-left: auto;
}

.change-item:hover .change-link { color: var(--accent); }

.changelog-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 36px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.filter-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: transparent;
  color: var(--mute);
  font-size: 12.5px;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: all 0.18s;
  letter-spacing: 0.01em;
}

.filter-chip:hover {
  color: var(--ivory);
  border-color: var(--accent-deep);
  background: var(--card);
}

.filter-chip.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- responsive ---------- */

@media (max-width: 1200px) {
  .api-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .shell { padding: 0 28px; }
}

@media (max-width: 960px) {
  .shell { padding: 0 20px; }
  .main-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .lua-module-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .plugin-home-actions {
    grid-template-columns: 1fr;
  }
  .create-api-grid {
    grid-template-columns: 1fr;
  }
  .editor-form-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding-right: 0;
    padding-bottom: 16px;
  }
  .sidebar-block {
    padding-bottom: 14px;
    margin-bottom: 14px;
  }
  .module-item.active::after { display: none; }
  .module-list {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    gap: 6px;
  }
  .module-item { flex: 0 0 auto; padding-left: 36px; }
  .hero { padding: 48px 0 32px; margin-bottom: 32px; }
  .topbar-inner {
    flex-wrap: wrap;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }
  .content-head-side {
    width: 100%;
    justify-content: space-between;
  }
  .nav-search-trigger {
    min-width: 0;
    width: 40px;
    padding: 0;
    justify-content: center;
  }
  .nav-search-text,
  .nav-search-shortcut { display: none; }
  .topbar-right .pill-stat { display: none; }
  .hero-overview-strip {
    flex-direction: column;
  }
  .hero-overview-item {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .hero-overview-item:last-child {
    border-bottom: 0;
  }
  .detail-hero { padding: 28px 24px 32px; }
  .detail-hero::after { display: none; }
  .section { padding: 24px 22px; }
  .pager-grid { grid-template-columns: 1fr; }
  .spotlight-head { align-items: flex-start; }
  .spotlight-shortcut { display: none; }
  .spotlight-foot {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .api-grid { grid-template-columns: 1fr; }
  .api-list-head {
    display: none;
  }
  .api-list-row {
    grid-template-columns: 1fr;
  }
  .api-list-row .api-col {
    border-right: 0;
    padding: 8px 14px;
  }
  .api-col.api-col-index {
    padding-top: 14px;
    padding-bottom: 2px;
  }
  .api-col.api-col-name {
    padding-top: 0;
  }
  .api-col.api-col-desc {
    padding-top: 0;
    padding-bottom: 6px;
  }
  .api-col.api-col-params {
    display: inline-flex;
    width: auto;
    padding-top: 0;
    padding-bottom: 14px;
  }
  .api-list-desc {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .timeline { padding-left: 28px; }
  .release::before { left: -24px; width: 10px; height: 10px; }
  .content-head h2 { font-size: 30px; }
  .hero-meta .metric { flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--rule); }
  .hero-meta .metric:last-child { border-bottom: 0; }
  .lua-module-head {
    flex-direction: column;
  }
  .lua-module-head code {
    white-space: normal;
  }
  .param-table thead th,
  .param-table tbody td { padding: 11px 10px; font-size: 12.5px; }
  .template-modal,
  .spotlight { padding: 12px; }
  .template-modal-panel,
  .spotlight-panel {
    width: min(100vw - 24px, 100%);
    border-radius: 22px;
  }
  .template-modal-head,
  .spotlight-head {
    padding: 16px;
  }
  .template-modal-body {
    padding: 16px;
  }
  .template-code {
    padding: 16px;
    font-size: 12px;
  }
  .spotlight-input {
    font-size: 18px;
  }
  .spotlight-item {
    padding: 13px 14px;
    border-radius: 16px;
  }
  .spotlight-item-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- tiny niceties ---------- */

.fade-in { animation: fade-in 0.4s ease both; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stagger > * { animation: fade-in 0.45s ease both; }
.stagger > *:nth-child(1)  { animation-delay: 0.02s; }
.stagger > *:nth-child(2)  { animation-delay: 0.04s; }
.stagger > *:nth-child(3)  { animation-delay: 0.06s; }
.stagger > *:nth-child(4)  { animation-delay: 0.08s; }
.stagger > *:nth-child(5)  { animation-delay: 0.10s; }
.stagger > *:nth-child(6)  { animation-delay: 0.12s; }
.stagger > *:nth-child(7)  { animation-delay: 0.14s; }
.stagger > *:nth-child(8)  { animation-delay: 0.16s; }
.stagger > *:nth-child(9)  { animation-delay: 0.18s; }
.stagger > *:nth-child(10) { animation-delay: 0.20s; }
