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

:root {
  --pri: #6366f1;
  --pri2: #8b5cf6;
  --bg: #f8f9fc;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --code-bg: #f3f4f6;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ─── Header ─── */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}
.site-header .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
}
.header-badge {
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

/* ─── Layout ─── */
.layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ─── Page title ─── */
.page-title {
  text-align: center;
  margin-bottom: 40px;
}
.page-title h1 {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}
.page-title p {
  color: var(--muted);
  font-size: 15px;
}

/* ─── Tab switcher ─── */
.tab-bar {
  display: flex;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}
.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.tab-btn:hover {
  background: var(--code-bg);
  color: var(--text);
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.tab-btn svg {
  flex-shrink: 0;
}

/* ─── Panel ─── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Section card ─── */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.section-card + .section-card {
  margin-top: 0;
}

/* ─── Step header ─── */
.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.step-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Image placeholder ─── */
.img-box {
  width: 100%;
  border-radius: 10px;
  border: 2px dashed var(--border);
  background: var(--code-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #9ca3af;
  font-size: 13px;
  margin: 18px 0;
  position: relative;
  overflow: hidden;
}
/* 仅无图片时使用固定高度占位 */
.img-box.h-sm:not(:has(img))  { height: 180px; }
.img-box.h-md:not(:has(img))  { height: 260px; }
.img-box.h-lg:not(:has(img))  { height: 340px; }
/* 有图片时自适应，完整展示原图 */
.img-box:has(img) {
  height: auto;
  background: transparent;
  border: none;
  display: block;
}
.img-box:has(img) .img-label { display: none; }
.img-box img {
  width: 75%;
  height: auto;
  object-fit: unset;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}
.img-box-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.img-box-inner svg { opacity: .4; }
.img-label {
  position: absolute;
  top: 10px;
  left: 12px;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}

/* ─── Desc text ─── */
.desc {
  font-size: 14px;
  color: #374151;
  line-height: 1.8;
  margin-bottom: 10px;
}
.desc + .desc { margin-top: -4px; }

/* ─── Code block ─── */
.code-block {
  background: #181825;
  color: #cdd6f4;
  border-radius: 10px;
  padding: 0;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
  line-height: 1.8;
  margin: 14px 0;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
/* 顶部标题栏 */
.code-block::before {
  content: '';
  display: block;
  background: #24243e;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: 11px;
  color: #6c7086;
  letter-spacing: .5px;
}
.code-block code {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 16px 20px;
  overflow-x: auto;
}
.code-block .cmt { color: #6c7086; }
.code-block .key { color: #89b4fa; }
.code-block .val { color: #a6e3a1; }
.code-block .str { color: #f9e2af; }
.copy-btn {
  position: absolute;
  top: 6px;
  right: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  color: #a6adc8;
  font-size: 11px;
  padding: 2px 10px;
  cursor: pointer;
  transition: background .2s, color .2s;
  font-family: inherit;
  z-index: 2;
}
.copy-btn:hover { background: rgba(255,255,255,.16); color: #cdd6f4; }

/* ─── Tip box ─── */
.tip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(99,102,241,.06);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 13px;
  color: #374151;
}
.tip-icon { flex-shrink: 0; margin-top: 1px; }
.tip.warn {
  background: rgba(245,158,11,.06);
  border-color: rgba(245,158,11,.25);
}
.tip.warn .tip-icon { color: #f59e0b; }
.tip.info .tip-icon { color: var(--pri); }

/* ─── Two-col image layout ─── */
.img-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 18px 0;
}
.img-row .img-box {
  margin: 0;
  height: auto !important;
  background: transparent;
  border: none;
  display: block;
}
.img-row .img-box img {
  width: 75%;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* ─── Login button ─── */
.btn-outline {
  display: inline-flex; align-items: center;
  padding: 7px 14px;
  border-radius: 9px;
  border: 1.5px solid rgba(99,102,241,.3);
  background: rgba(99,102,241,.06);
  color: var(--pri);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background .2s, border-color .2s;
}
.btn-outline:hover { background: rgba(99,102,241,.12); border-color: var(--pri); }

/* ─── Inline badge ─── */
.badge {
  display: inline-block;
  background: rgba(99,102,241,.1);
  color: var(--pri);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
}
.badge.green { background: rgba(16,185,129,.1); color: #059669; }
.badge.amber { background: rgba(245,158,11,.1); color: #b45309; }

/* ─── Field row ─── */
.field-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  align-items: start;
  margin: 10px 0;
  font-size: 13px;
}
.field-label { color: var(--muted); font-weight: 500; padding-top: 2px; }
.field-val { color: var(--text); word-break: break-all; }

/* ─── Divider ─── */
hr.divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 20px 0;
}

/* ─── Footer ─── */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 24px 24px;
  border-top: 1px solid var(--border);
}

/* ── Image Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 30, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 32px;
  cursor: zoom-out;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: lb-fade .18s ease;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: lb-zoom .22s ease;
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,.25); }
@keyframes lb-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes lb-zoom { from { transform: scale(.92); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.section-card img,
.img-box img {
  cursor: zoom-in;
  transition: transform .2s ease, box-shadow .2s ease;
}
.section-card img:hover,
.img-box img:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
