
:root {
  /* 色值来自 template.json 的 theme，由 theme.css.php 注入 --tpl-*；
     这里只做变量映射，改色板不用动 CSS */
  --ink:        var(--tpl-ink, #3e3440);
  --ink-2:      var(--tpl-ink2, #6f5c74);
  --ink-3:      var(--tpl-ink3, #9d8aa2);
  --pink:       var(--tpl-acc, #ef7ba6);
  --pink-deep:  var(--tpl-acc-d, #d95f8c);
  --pink-soft:  var(--tpl-acc-line, #ffd6e5);
  --pink-mist:  var(--tpl-acc-soft, #fff1f6);
  --lilac:      var(--tpl-acc-2, #c98bd8);
  --lilac-soft: #f8e6f4;
  --gold:       #e2b25e;
  --paper:      var(--tpl-paper, #fffafc);
  --line:       var(--tpl-line, #f2e3ec);
  --shadow:     0 18px 44px -22px rgba(217, 95, 140, .45);
  --shadow-sm:  0 8px 22px -14px rgba(62, 52, 64, .35);
  --r:          20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 82% -8%, var(--pink-mist) 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(900px 560px at 4% 12%, var(--lilac-soft) 0%, rgba(240, 232, 255, 0) 60%),
    var(--tpl-bg, #fffafc);
  background-attachment: fixed;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

code, pre {
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: inherit;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  width: min(1140px, calc(100% - 44px));
  margin-inline: auto;
}

/* ---------------- 花瓣 ---------------- */
.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.petals span {
  position: absolute;
  top: -6vh;
  width: 14px;
  height: 10px;
  background: linear-gradient(135deg, #ffc9dc, #ef7ba6);
  border-radius: 60% 40% 55% 45% / 60% 55% 45% 40%;
  opacity: .55;
  animation: fall linear infinite;
}
.petals span:nth-child(1) { left: 6%;  animation-duration: 15s; animation-delay: 0s;   }
.petals span:nth-child(2) { left: 18%; animation-duration: 19s; animation-delay: 3s;   transform: scale(.8); }
.petals span:nth-child(3) { left: 31%; animation-duration: 13s; animation-delay: 6s;   transform: scale(1.2); }
.petals span:nth-child(4) { left: 46%; animation-duration: 21s; animation-delay: 1.5s; }
.petals span:nth-child(5) { left: 58%; animation-duration: 16s; animation-delay: 8s;   transform: scale(.9); }
.petals span:nth-child(6) { left: 69%; animation-duration: 18s; animation-delay: 4.5s; transform: scale(1.1); }
.petals span:nth-child(7) { left: 79%; animation-duration: 14s; animation-delay: 10s;  }
.petals span:nth-child(8) { left: 88%; animation-duration: 20s; animation-delay: 2s;   transform: scale(.85); }
.petals span:nth-child(9) { left: 94%; animation-duration: 17s; animation-delay: 7s;   transform: scale(1.15); }
.petals span:nth-child(10){ left: 40%; animation-duration: 23s; animation-delay: 12s;  transform: scale(.75); }

@keyframes fall {
  0%   { transform: translate3d(0, -8vh, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: .6; }
  100% { transform: translate3d(48px, 112vh, 0) rotate(420deg); opacity: .15; }
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 56px;
  align-items: center;
  padding: 54px 0 62px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 7px 15px;
  font-size: 13px;
  color: var(--pink-deep);
  background: var(--pink-mist);
  border: 1px solid var(--pink-soft);
  border-radius: 999px;
}
.eyebrow svg { width: 15px; height: 15px; fill: none; stroke: var(--pink); stroke-width: 1.8; stroke-linejoin: round; }

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.24;
  letter-spacing: -.5px;
  font-weight: 800;
}
.hero h1 span {
  background: linear-gradient(100deg, var(--pink-deep), var(--lilac));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0 0 28px;
  color: var(--ink-2);
  font-size: 16px;
  max-width: 30em;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: transform .25s cubic-bezier(.34, 1.4, .64, 1), box-shadow .25s, background .25s;
}
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-main {
  color: #fff;
  background: linear-gradient(120deg, var(--pink), var(--pink-deep) 55%, var(--lilac));
  box-shadow: 0 14px 28px -14px rgba(217, 95, 140, .8);
}
.btn-main:hover { transform: translateY(-3px); box-shadow: 0 20px 34px -14px rgba(217, 95, 140, .9); }
.btn-ghost {
  color: var(--ink-2);
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { color: var(--pink-deep); transform: translateY(-3px); border-color: var(--pink-soft); }

.mini-stats {
  display: flex;
  gap: 34px;
  margin-top: 40px;
  padding-top: 26px;
  border-top: 1px dashed var(--line);
}
.mini-stats b { display: block; font-size: 24px; letter-spacing: -.4px; }
.mini-stats i { font-style: normal; font-size: 12.5px; color: var(--ink-3); }

/* 预览卡 */
.hero-card { position: relative; }
.card-frame {
  position: relative;
  border-radius: 26px;
  padding: 12px;
  background: linear-gradient(150deg, #fff, #fff6fa 60%, #fcf1f9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: rotate(-1.2deg);
  transition: transform .5s cubic-bezier(.34, 1.4, .64, 1);
}
.card-frame:hover { transform: rotate(0deg) translateY(-4px); }
.card-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
  background: linear-gradient(120deg, #ffe9f2, #f9eaf6);
}
.shuffle {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .25s, color .25s;
}
.shuffle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.shuffle:hover { color: var(--pink-deep); transform: translateY(-2px); }
.card-note {
  margin: 14px 4px 0;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}

/* ---------------- 通用区块 ---------------- */
section { position: relative; z-index: 1; }
.sec-head { margin-bottom: 30px; }
.sec-head h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -.3px;
}
.sec-head h2::before {
  content: "";
  display: inline-block;
  width: 6px; height: 22px;
  margin-right: 12px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--pink), var(--lilac));
  vertical-align: -3px;
}
.sec-head p { margin: 0; color: var(--ink-2); font-size: 14.5px; }

/* ---------------- 文档 ---------------- */
.doc { padding: 26px 0 70px; }

.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.verb {
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .6px;
  color: #fff;
  background: linear-gradient(120deg, var(--pink), var(--pink-deep));
  border-radius: 8px;
}
.endpoint code { font-size: 14px; color: var(--ink); word-break: break-all; }
.tagpill {
  margin-left: auto;
  padding: 3px 12px;
  font-size: 12px;
  color: var(--pink-deep);
  background: var(--pink-mist);
  border: 1px solid var(--pink-soft);
  border-radius: 999px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 26px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
thead th {
  text-align: left;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
  background: linear-gradient(180deg, #fff6fa, #fdf2f8);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 13px 18px; border-bottom: 1px solid #faf0f5; color: var(--ink-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fff8fb; }
tbody code, .note-card code {
  padding: 2px 7px;
  font-size: 12.8px;
  color: var(--pink-deep);
  background: var(--pink-mist);
  border-radius: 6px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.code-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.code-card header {
  padding: 11px 18px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: linear-gradient(90deg, #fff4f9, #f7f2ff);
  border-bottom: 1px solid var(--line);
}
.code-card pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.code-card pre code { font-size: 13px; color: var(--ink-2); white-space: pre; background: none; }

.note-card {
  display: flex;
  gap: 14px;
  padding: 20px 22px;
  background: linear-gradient(120deg, #fff6fa, #fcf1f9);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.note-card svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--pink); stroke-width: 1.8; stroke-linecap: round; }
.note-card b { display: block; margin-bottom: 6px; font-size: 14px; }
.note-card p { margin: 0; font-size: 13px; color: var(--ink-2); word-break: break-all; }

/* ---------------- 示例 ---------------- */
.demo { padding: 0 0 70px; }
.demo-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.demo-out {
  margin: 0;
  padding: 22px;
  min-height: 150px;
  max-height: 420px;
  overflow: auto;
  font-size: 13px;
  color: #5b4a66;
  background: #fffdfe;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
  word-break: break-all;
}
.demo-stage {
  margin-top: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.demo-stage img {
  max-width: 100%;
  max-height: 380px;
  border-radius: 12px;
  object-fit: contain;
  background: #fdf3f9;
}
.demo-open {
  font-size: 13px;
  color: var(--pink-deep);
  border-bottom: 1px dashed var(--pink-soft);
}

/* ---------------- 状态 ---------------- */
.status { padding: 0 0 80px; }
.status-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}
.status-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 20px;
  background: var(--paper);
}
.status-item svg {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: var(--pink); stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.status-item b { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.status-item span { font-size: 15px; font-weight: 600; }
.status-item .ok { color: #3f9b6e; }

/* ---------------- 页脚 ---------------- */
.foot {
  position: relative;
  z-index: 1;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 252, .7);
}
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-brand svg { width: 32px; height: 32px; }
.foot-brand strong { font-size: 15px; }
.foot-brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.foot-meta { display: flex; gap: 18px; font-size: 12.5px; color: var(--ink-3); }
.foot-meta a:hover { color: var(--pink-deep); }

/* ---------------- 公告 ---------------- */
.notice-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(62, 52, 64, .34);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade .28s ease;
}
.notice-box {
  width: min(460px, 100%);
  background: #fffdfe;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 70px -28px rgba(62, 52, 64, .6);
  animation: pop .38s cubic-bezier(.34, 1.5, .64, 1);
}
.notice-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 26px 20px;
  background: linear-gradient(120deg, #ffd9e7, #fbeaf5);
}
.notice-top svg { width: 22px; height: 22px; fill: none; stroke: var(--pink-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notice-top h3 { margin: 0; font-size: 17px; }
.notice-body {
  padding: 22px 26px;
  max-height: 46vh;
  overflow: auto;
  font-size: 14.5px;
  color: var(--ink-2);
}
.notice-foot { padding: 0 26px 24px; }
.notice-foot .btn { width: 100%; justify-content: center; }

/* ---------------- 返回顶部 ---------------- */
.to-top {
  position: fixed;
  left: 20px;
  bottom: 22px;
  z-index: 55;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--pink-deep);
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: all .3s;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}
.to-top.on { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 40px 0 40px; }
  .hero-card { order: -1; max-width: 520px; }
  .status-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .wrap { width: calc(100% - 32px); }
  .grid-2 { grid-template-columns: 1fr; }
  .mini-stats { gap: 22px; }
  .mini-stats b { font-size: 20px; }
  .status-card { grid-template-columns: 1fr; }
  .foot-in { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
