:root {
  --ink: #0b1f1c;
  --ink-soft: #2a4540;
  --mist: #e8f1ef;
  --paper: #f5faf8;
  --line: rgba(11, 31, 28, 0.12);
  --accent: #0d8f78;
  --accent-deep: #066554;
  --accent-bright: #1ec9a8;
  --warn: #c45c26;
  --danger: #b42318;
  --surface: #fff;
  --shadow: 0 14px 36px rgba(6, 40, 34, 0.08);
  --radius: 16px;
  --nav-h: 64px;
  --font: "Figtree", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Bricolage Grotesque", "Segoe UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.wrap {
  width: min(1140px, calc(100% - 32px));
  margin-inline: auto;
  transition: width 0.15s ease;
}
/* 宽屏逐步放宽内容区 */
@media (min-width: 1280px) {
  .wrap { width: min(1280px, calc(100% - 40px)); }
}
@media (min-width: 1440px) {
  .wrap { width: min(1400px, calc(100% - 48px)); }
}
@media (min-width: 1600px) {
  .wrap { width: min(1560px, calc(100% - 56px)); }
}
@media (min-width: 1800px) {
  .wrap { width: min(1720px, calc(100% - 64px)); }
}
/* 文档页三栏更吃宽度，额外放宽一档 */
.wrap:has(.layout-doc) {
  width: min(1200px, calc(100% - 32px));
}
@media (min-width: 1280px) {
  .wrap:has(.layout-doc) { width: min(1360px, calc(100% - 40px)); }
}
@media (min-width: 1440px) {
  .wrap:has(.layout-doc) { width: min(1520px, calc(100% - 48px)); }
}
@media (min-width: 1600px) {
  .wrap:has(.layout-doc) { width: min(1680px, calc(100% - 56px)); }
}
@media (min-width: 1800px) {
  .wrap:has(.layout-doc) { width: min(1840px, calc(100% - 72px)); }
}

.nav {
  position: sticky; top: 0; z-index: 40; height: var(--nav-h);
  backdrop-filter: blur(12px);
  background: rgba(245, 250, 248, 0.9);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 800; font-size: 1.15rem;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-deep));
}
.nav-links { display: flex; align-items: center; gap: 18px; color: var(--ink-soft); font-weight: 500; }
.nav-links a:hover { color: var(--accent-deep); }
.nav-links .active { color: var(--accent-deep); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; background: var(--ink); color: #fff;
}
.btn:hover { background: var(--accent-deep); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); background: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 0.88rem; }
.btn-danger { background: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.hero {
  position: relative; padding: 56px 0 64px; isolation: isolate; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 75% 15%, rgba(30, 201, 168, 0.28), transparent 55%),
    linear-gradient(180deg, #dff0eb 0%, var(--paper) 70%);
}
.hero-brand {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4.4rem); letter-spacing: -0.04em; line-height: 0.95;
  margin-bottom: 20px;
}
.hero h1 {
  font-family: var(--display); font-size: clamp(1.4rem, 2.8vw, 1.95rem);
  letter-spacing: -0.02em; max-width: 18ch; margin-bottom: 12px;
}
.hero .lead { color: var(--ink-soft); max-width: 38ch; margin-bottom: 24px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.section { padding: 56px 0; }
.section-head { max-width: 560px; margin-bottom: 28px; }
.eyebrow {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.section-head h2 {
  font-family: var(--display); font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -0.03em; margin-bottom: 8px;
}
.muted { color: var(--ink-soft); }

.api-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.api-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.api-card:hover { transform: translateY(-3px); border-color: rgba(13,143,120,.4); }
.api-card .top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.badge {
  font-size: 0.72rem; font-weight: 700; padding: 4px 8px; border-radius: 8px;
  background: rgba(13,143,120,.1); color: var(--accent-deep);
}
.badge.warn { background: rgba(196,92,38,.1); color: var(--warn); }
.method {
  font-size: 0.72rem; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: var(--accent-deep); padding: 3px 8px; border-radius: 6px;
}
.method.GET { background: #0b6e4f; }
.method.POST { background: #1d4ed8; }
.api-card h3 { font-family: var(--display); font-size: 1.05rem; margin-bottom: 6px; }
.api-card p { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 12px; min-height: 2.6em; }

.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-tabs button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 600;
}
.cat-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.catalog-search {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.catalog-search input {
  flex: 1; min-width: 200px; height: 42px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; padding: 0 14px;
}
.catalog-search-meta { font-size: 0.85rem; color: var(--ink-soft); margin: -6px 0 14px; }

.layout-doc {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 280px;
  gap: 16px;
  padding: 28px 0 56px;
}
@media (min-width: 1440px) {
  .layout-doc {
    grid-template-columns: 250px minmax(0, 1fr) 310px;
    gap: 20px;
  }
}
@media (min-width: 1680px) {
  .layout-doc {
    grid-template-columns: 270px minmax(0, 1fr) 340px;
    gap: 22px;
  }
}
.doc-side {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; height: fit-content; position: sticky; top: calc(var(--nav-h) + 12px);
  max-height: calc(100vh - var(--nav-h) - 24px); overflow: auto;
}
.doc-side h4 { font-size: 0.8rem; color: var(--accent); margin: 12px 0 6px; letter-spacing: .06em; }
.doc-side a {
  display: block; padding: 7px 8px; border-radius: 8px; font-size: 0.9rem; color: var(--ink-soft);
}
.doc-side a:hover, .doc-side a.on { background: var(--mist); color: var(--accent-deep); font-weight: 600; }

.doc-history {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; height: fit-content; position: sticky; top: calc(var(--nav-h) + 12px);
  max-height: calc(100vh - var(--nav-h) - 24px); overflow: auto;
}
.doc-history-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px;
}
.doc-history-tip { font-size: 0.78rem; margin: 0 0 10px; line-height: 1.4; }
.debug-log-list { display: grid; gap: 8px; }
.debug-log-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fbfefe;
  font-size: 0.82rem;
}
.debug-log-item .t { color: var(--ink-soft); font-size: 0.74rem; margin-bottom: 4px; }
.debug-log-item .name { font-weight: 700; margin-bottom: 4px; word-break: break-all; }
.debug-log-item .tid {
  font-family: ui-monospace, Consolas, monospace; background: var(--mist);
  border-radius: 6px; padding: 4px 6px; margin: 4px 0; word-break: break-all; cursor: pointer;
}
.debug-log-item .tid:hover { background: #dceee8; }
.debug-log-item .resp {
  font-family: ui-monospace, Consolas, monospace; font-size: 0.72rem; color: var(--ink-soft);
  max-height: 72px; overflow: hidden; white-space: pre-wrap; word-break: break-word; margin: 4px 0 6px;
}
.debug-log-item .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.debug-log-empty { color: var(--ink-soft); font-size: 0.82rem; padding: 8px 0; }

.doc-main {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); min-width: 0;
}
.doc-main h1 { font-family: var(--display); font-size: 1.6rem; margin-bottom: 8px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.path-box {
  font-family: ui-monospace, Consolas, monospace; background: var(--mist);
  border-radius: 10px; padding: 10px 12px; margin: 10px 0 18px; word-break: break-all;
}
table.params { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 10px 0 18px; }
table.params th, table.params td {
  border-bottom: 1px solid var(--line); text-align: left; padding: 8px 6px; vertical-align: top;
}
table.params th { color: var(--ink-soft); font-weight: 600; }

.try-box {
  margin-top: 22px; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  background: linear-gradient(180deg, #f8fcfb, #fff);
}
.try-box h3 { font-family: var(--display); margin-bottom: 12px; }
.try-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; margin-bottom: 10px; align-items: center; }
.try-row label { font-size: 0.86rem; color: var(--ink-soft); font-weight: 600; }
.try-row input, .try-row select, .try-row textarea, .field {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff;
}
.try-row textarea, #respBox { min-height: 160px; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.param-lines { display: grid; gap: 8px; }
.param-line { display: grid; grid-template-columns: 140px 1fr; gap: 8px; }
.resp-wrap { position: relative; }
.btn-copy-resp {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  border: 1px solid rgba(215, 245, 238, 0.28); background: rgba(11, 31, 28, 0.88);
  color: #d7f5ee; border-radius: 8px; padding: 4px 10px; font-size: 0.78rem;
  font-weight: 600; cursor: pointer; line-height: 1.4;
}
.btn-copy-resp:hover { background: #163833; border-color: rgba(215, 245, 238, 0.5); }
#respBox {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 72px 12px 12px;
  background: #0b1f1c; color: #d7f5ee; white-space: pre-wrap; word-break: break-word;
}
.resp-ellipsis { color: #9ad8c8; font-weight: 700; }
.btn-expand-resp {
  display: inline; margin-left: 8px; vertical-align: baseline;
  border: 1px solid rgba(215, 245, 238, 0.35); background: #1a4a42;
  color: #e8fff8; border-radius: 6px; padding: 1px 8px; font-size: 0.78rem;
  font-weight: 700; cursor: pointer; line-height: 1.5; font-family: inherit;
}
.btn-expand-resp:hover { background: #246056; }

.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.panel h2, .panel h3 { font-family: var(--display); margin-bottom: 12px; }
.field-group { margin-bottom: 12px; }
.field-group label { display: block; font-size: 0.86rem; color: var(--ink-soft); margin-bottom: 4px; font-weight: 600; }
.stat {
  display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.stat .item {
  flex: 1; min-width: 140px; background: var(--mist); border-radius: 12px; padding: 14px;
}
.stat .item b { display: block; font-family: var(--display); font-size: 1.4rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 9px 6px; text-align: left; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.84rem; word-break: break-all; }
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 99;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  display: none; max-width: 320px;
}
.toast.show { display: block; }
.hidden { display: none !important; }
html.ed-authed #authPanel { display: none !important; }
html.ed-authed #dashPanel { display: block !important; }
html.ed-guest #authPanel { display: block !important; }
html.ed-guest #dashPanel { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.55);
}
.modal-card {
  position: relative;
  width: min(360px, 100%);
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e6e0d8);
  border-radius: 14px;
  padding: 22px 22px 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
  text-align: center;
}
.modal-card h3 {
  font-family: var(--display);
  margin: 0 0 6px;
}
.pay-qr-wrap {
  margin: 16px auto 0;
  width: 240px;
  height: 240px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line, #e6e0d8);
  border-radius: 10px;
}
.pay-qr-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

footer {
  border-top: 1px solid var(--line); padding: 22px 0 36px; color: var(--ink-soft); font-size: 0.88rem;
}
.foot-inner { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.sms-row { display: flex; gap: 8px; }
.sms-row .field { flex: 1; }
#yd-captcha-overlay {
  position: fixed; inset: 0; z-index: 2147483647;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
#yd-captcha-card {
  width: 360px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 12px; padding: 16px 16px 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
}
#yd-captcha-inner { min-height: 160px; width: 320px; max-width: 100%; }
#yd-captcha-loading { color: #888; font-size: 13px; margin-bottom: 8px; }
.yidun, .yidun_popup, .yidun_modal { z-index: 2147483647 !important; }

@media (max-width: 1100px) {
  .layout-doc { grid-template-columns: 210px minmax(0, 1fr); }
  .doc-history { grid-column: 1 / -1; position: static; max-height: 320px; }
}
@media (max-width: 960px) {
  .api-grid { grid-template-columns: 1fr 1fr; }
  .layout-doc, .auth-grid { grid-template-columns: 1fr; }
  .doc-side, .doc-history { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .api-grid { grid-template-columns: 1fr; }
  .nav-links a:not(.btn) { display: none; }
  .param-line, .try-row { grid-template-columns: 1fr; }
}
