:root{
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #1f2937;
  --ink-muted:#6b7280;
  --brand-1:#93B5D4; /* 主色 */
  --brand-2:#A1AACE; /* 辅色 */
  --brand-3:#CEDEE4; /* 淡色底 */
  --radius: 16px;
  --shadow: 0 10px 30px rgba(17,24,39,.08);
  --maxw: 1080px;
}

*{box-sizing:border-box}
html,body{
  margin:0;padding:0;
  background:var(--bg);
  color:var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
}

/* ===== 结构通用 ===== */
.wrap{max-width: var(--maxw); margin: 28px auto; padding: 0 20px;}
section.card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 26px;
  border: 1px solid rgba(0,0,0,.06);
}
.card h2{margin: 4px 0 6px; font-size: clamp(22px, 3vw, 26px); letter-spacing:.2px;}
.sub{
  color:black; 
  margin: 0 0 16px; 
  font-size: 16px;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.6;
}

/* ===== 顶部横幅（Hero） ===== */
.hero{
  background: linear-gradient(135deg, var(--brand-3), #fff 40%, var(--brand-2) 120%);
  padding: 56px 20px 40px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.hero__inner{max-width: var(--maxw); margin: 0 auto; text-align: center;}
.hero h1{margin: 0 0 8px; font-size: clamp(28px, 4vw, 40px); letter-spacing:.2px;}
.hero p{margin: 6px 0 0; color: var(--ink-muted); font-size: 16px}
.meta{
  margin-top: 14px;
  display:inline-flex; gap:10px; padding:8px 14px; border-radius:999px;
  background: rgba(255,255,255,.6); backdrop-filter: blur(6px); border: 1px solid rgba(0,0,0,.05);
  color: var(--ink-muted);
}

/* ===== 标签式锚点（Tabs） ===== */
.tabs{
  margin-top: 18px;
  display:flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.tab{
  display:inline-block; padding:10px 14px; border-radius: 999px; text-decoration:none; color:#0f172a;
  background:#fff; border:1px solid rgba(0,0,0,.06);
  transition:.2s ease; box-shadow:0 4px 12px rgba(0,0,0,.04);
}
.tab:hover{transform: translateY(-1px); box-shadow:0 8px 18px rgba(0,0,0,.08)}

/* ===== 栅格 ===== */
.grid{display:grid; gap:16px; grid-template-columns: repeat(12, minmax(0, 1fr));}
.col-4{grid-column: span 4;}
.col-6{grid-column: span 6;}
.col-7{grid-column: span 7;}
.col-8{grid-column: span 8;}
.col-12{grid-column: span 12;}
@media (max-width: 820px){
  .col-4,.col-6,.col-7,.col-8{grid-column: span 12;}
}

/* ===== 媒体盒 ===== */
figure{
  margin:0; background:#fff; border:1px solid rgba(0,0,0,.06);
  border-radius:12px; overflow:hidden;
}
figure img, figure video{display:block; width:100%; height:auto; cursor:zoom-in;}
figcaption{
  font-size:13px; color:var(--ink-muted);
  padding:4x 8px; background: linear-gradient(180deg,#fff, #fafafa);
  border-top:1px solid rgba(0,0,0,.06);
}

/* 小尺寸容器 / 固定尺寸辅助类 */
.figure-narrow{ max-width: 350px; margin: 0 auto; }
.img-sm{ max-width: 420px; width: 100%; display: block; margin: 0 auto; }
.img-fixed { width: 375px; height: 500px; object-fit: cover; display: block; margin: 0 auto; border-radius: 8px; }
.same-height {
  height: 100%;
  width: auto;
  max-height: 400px;
  display: block;   /* img 变成块级元素 */
  margin: 0 auto;   /* 水平自动外边距 = 居中 */
}

/* 两图并排的小网格（输入/输出） */
.tile-io { padding: 8px; }
.io {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: start;
}
.io img {
  width: 100%;
  display: block;
  border-radius: 6px;
}

/* 更紧凑的参数框 */
.meta-box.compact {
  margin-top: 6px;
  padding: 8px 10px;
}
.meta-box.compact .kv { padding: 3px 0; }

.grid2-video{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;                 /* ✅ 两个视频之间无空隙 */
  align-items: start;
}

/* video 本身 */
.grid2-video video{
  width: 100%;
  height: auto;
  display: block;
}

.grid2-video figcaption{
  display: none;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.grid4 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.grid5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.grid7 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.tile {
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

.tile img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin: 0 auto 6px;
}

.tile figcaption {
  font-size: 0.85rem;
  line-height: 1.3;
}

/* 让 figcaption 右侧能放按钮，与你的风格一致 */
.tile figcaption.with-btn{
  display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  flex-wrap: wrap;
}

/* 小按钮风格，复用你的品牌色 */
.mini-btn{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.06);
  background: var(--brand-3);
  color: #0f172a;
  cursor: pointer;
}
.mini-btn:hover{ background: var(--brand-2); color:#0f172a; }

/* code space */
.code-grid-3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
}
@media (max-width: 1080px){
  .code-grid-3{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px){
  .code-grid-3{ grid-template-columns: 1fr; }
}

.code-card{
  background: var(--card);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.code-card h4{ margin: 10px 12px 0; font-size: 14px; color: var(--ink); }

.code-block{
  margin: 8px 12px 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0f172a;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.45;

  /* ✅ 保持竖直滚动，隐藏横向滚动 */
  max-height: 400px;      /* 自定义一个合适的高度 */
  overflow-y: auto;       /* 开启竖直滚动条 */
  overflow-x: hidden;     /* 禁止横向滚动条 */

  white-space: pre-wrap;  /* 长行自动换行 */
  word-break: break-word; /* 必要时断词 */
}

.mt{ margin-top: 12px; }

/* ===== 六张图（“左两小 + 右一大”）只在 .pairs 中生效 ===== */

/* 外层容器：两组上下排 */
.pairs{
  display:grid;
  gap:20px;
}

/* 每一组：两列布局，并限定一个响应式高度，确保“左两小总高 = 右一大高” */
.pairs .pair{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:16px;
  height: clamp(280px, 36vw, 520px); /* 可按需要微调 */
}

/* 左列：上下两张等高 */
.pairs .pair-left{
  display:grid;
  grid-template-rows: 1fr 1fr; /* 上下一样高 */
  gap:16px;
}

/* 右列：单张跨两行（与左两张总高相等） */
.pairs .pair-right{
  display:grid;
  grid-row: 1 / span 2; /* 关键：跨两行 */
}

/* 在 .pairs 作用域内，tile 变为“图在上 + 说明在下”的两行网格 */
.pairs .tile{
  margin:0;
  padding:0;                    /* 不要内边距，避免撑高 */
  border:1px solid rgba(0,0,0,.08);
  border-radius:12px;
  overflow:hidden;
  display:grid;
  grid-template-rows: 1fr auto; /* 上：图片占满；下：说明文字自高 */
  background:#fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

/* 只在 .pairs 内覆盖图片：填满所在“图片行” */
.pairs .tile img{
  width:100%;
  height:100%;
  object-fit:cover;             /* 居中裁切填满 */
  display:block;
}

/* 说明文字：保持你的全局风格 */
.pairs .tile figcaption{
  margin:0;
  padding:10px 12px;
  font-size:.9rem;
  color:#666;
  background: linear-gradient(180deg,#fff, #fafafa);
  border-top:1px solid rgba(0,0,0,.06);
}
.tile.small img,
.hyb-small {
  max-height: 300px;
  width: auto;
  object-fit: contain;
  display: block;
}

.pair-left {
  height: 100%;
}

.hyb-large {
  max-height: 700px;
  width: auto;
  object-fit: contain;
  display: block;
}
.video-wrap {
  width: 100%;
  max-width: 720px;   /* 你想要的视频宽度上限 */
  margin: 0 auto 1rem; 
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.hyb-video {
  width: 100%;
  height: 400px;      /* ✅ 固定高度，例如 400px */
  object-fit: cover;  /* 保持比例裁切 */
  display: block;
}

/* ===== 高亮提示块 ===== */
.note{
  margin-top:14px; padding:12px 14px; border-radius:12px;
  background:linear-gradient(145deg, #fff, var(--brand-3));
  border:1px solid rgba(0,0,0,.06); color:#334155; font-size:14px;
}
code.func {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.95em;

  background: #f2f3f5;
  color: #2f3542;

  padding: 2px 8px;
  border-radius: 6px;

  border: 1px solid rgba(0,0,0,0.06);
  white-space: nowrap;
}


/* ===== 表格（结果/Offset用） ===== */
.tbl{width:100%; border-collapse: collapse; font-size:14px}
.tbl th,.tbl td{border:1px solid rgba(0,0,0,.08); padding:10px 12px; text-align:left}
.tbl thead th{background: linear-gradient(180deg,#fff, #f5f7fb); color:#0f172a}
.tbl tbody tr:hover{background:#fafcff}

/* ===== 页脚 ===== */
.footer{
  text-align:center; color:var(--ink-muted);
  padding: 28px 16px 40px;
}
.footer a{color:#0f172a; text-decoration:none; border-bottom:1px dashed rgba(15,23,42,.3)}
.footer a:hover{border-bottom-color:#0f172a}

/* ===== 轻量灯箱 ===== */
.lightbox{
  position: fixed; inset:0; background: rgba(0,0,0,.65);
  display:none; align-items:center; justify-content:center; padding:20px; z-index: 99;
}
.lightbox.open{display:flex;}
.lightbox img, .lightbox video{
  max-width: min(1200px, 92vw); max-height: 88vh; border-radius:12px; box-shadow: 0 20px 80px rgba(0,0,0,.5);
}

/* ===== 打印优化 ===== */
@media print{
  .hero, .tabs{box-shadow:none; background:#fff}
  .tab, .meta{display:none}
  body{background:#fff}
  section.card{ box-shadow:none; border: 1px solid #ddd; page-break-inside: avoid; }
  .footer{color:#333; border-top:1px solid #ddd}
  a[href]::after{content:" (" attr(href) ")"; font-size:12px; color:#555}
}

