/* ============================================================
   登录页 + 技术支持（双屏横滑）
   ------------------------------------------------------------
   与 style.css 的分工：style.css 是登录卡本身与后台的通用样式，
   这里只放"双屏容器 + 技术支持"相关的部分，避免污染后台。
   设计口径见 docs/01 §4.6。
   ============================================================ */

/* ---------- 双屏容器 ---------- */
html, body { height: 100%; }
body.deck-body { overflow: hidden; background: var(--bg); }

.deck {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;   /* 到边不再把整个浏览器往回弹 */
}
.deck::-webkit-scrollbar { display: none; }

.pane {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* 第 1 屏：登录 */
.pane-login {
  display: flex;
  padding: 24px 20px 64px;
  background: linear-gradient(160deg, #eef3ff 0%, #f5f6f8 100%);
}
.pane-login .login-card { margin: auto; }

.login-jump {
  position: absolute;
  top: 14px; right: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  border: 1px solid #cfe0ff;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.login-jump:active { background: var(--primary-light); }

/* 页码圆点（移动端才有意义） */
.dots {
  position: fixed;
  left: 0; right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 7px;
  z-index: 20;
  pointer-events: none;
}
.dots i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #cfd4dc;
  transition: width 0.2s, background 0.2s;
}
.dots i.on { width: 18px; border-radius: 3px; background: var(--primary); }

/* ---------- 桌面端：顶部标签代替滑动 ---------- */
.deck-tabs {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.deck-tabs .dt-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.deck-tabs .dt-logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.dt-tabs { display: flex; gap: 4px; }
.dt-tab {
  height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
}
.dt-tab:hover { background: #f4f6fa; }
.dt-tab.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

@media (min-width: 900px) {
  .deck-tabs { display: flex; }
  /* 宽屏下 deck 不能横向滚动（scroll-snap 已关、横向溢出裁掉），
     goPane() 里的 scrollTo 到不了第 2 屏 —— 点「技术支持」会毫无反应。
     所以宽屏改成「只显示当前屏」，由 support.js 切 .on。 */
  .deck {
    display: block;
    margin-top: 56px;
    height: calc(100dvh - 56px);
    scroll-snap-type: none;
    overflow: hidden;
  }
  .pane { display: none; height: 100%; overflow-y: auto; }
  .pane.on { display: block; }
  .dots { display: none; }
  .login-jump { display: none; }

  /* 桌面端：顶部已经有了「技术支持」标签，页内那条标题栏就多余了；
     页签要和内容同宽，否则一条通栏蓝条压着 760px 的内容，视觉上很散。
     注意选择器要带 .pane-support：.sp-head / .sp-tabs 的常规规则写在本文件后面，
     同优先级会被它们盖掉（这个坑在截图里出现过一次）。 */
  .pane-support .sp-head { display: none; }
  .pane-support .sp-top { padding-top: 14px; }
  .pane-support .sp-tabs {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 14px 12px;
  }
}

/* ============================================================
   技术支持
   ============================================================ */
.pane-support { background: #f5f6f8; }

.sp-top {
  position: sticky;
  top: 0;
  z-index: 8;
  background: #f5f6f8;
  padding-bottom: 2px;
}
.sp-head {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.sp-head .sp-back {
  width: 64px;
  height: 34px;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 14px;
  text-align: left;
  padding-left: 4px;
  cursor: pointer;
}
.sp-head .sp-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.sp-head .sp-tail { width: 64px; }

.sp-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
}
.sp-tab {
  flex: 1;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #e9ecf1;
  color: #5b6169;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sp-tab.active { background: var(--primary); color: #fff; font-weight: 600; }

.sp-body {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.sp-search { padding: 0 14px 10px; }
.sp-search input {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
}
.sp-search input:focus { outline: none; border-color: #b9cdf7; }

/* ---------- 接线图列表 ---------- */
.sp-list { display: flex; flex-direction: column; gap: 10px; padding: 0 14px; }

/* 型号卡 = 上图下文。
   为什么从"左小图 + 右侧文字"改成大图：客户来问的第一件事是"我这块板子是不是这个型号"，
   52px 的缩略图连串数都数不清，等于没有。图占满卡片宽度、按 16:10 留白，
   型号名反而退到第二行——先认图，再认字。 */
.sp-model {
  display: block;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sp-model:active { border-color: #cfe0ff; }
.sp-model .shot {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #fafbfc;
  border-bottom: 1px solid #f1f3f7;
  overflow: hidden;
}
/* contain 而不是 cover：接线图是横图，cover 会裁成一条缝，两端端子正好被切掉 */
.sp-model .shot img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.sp-model .shot .ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  color: #b6bcc4;
  font-size: 12px;
}
.sp-model .shot .ph em { font-style: normal; }
.sp-model .shot .cnt {
  position: absolute;
  right: 8px; bottom: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(31, 35, 41, 0.62);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.2px;
}
.sp-model .tx { display: block; padding: 10px 12px 12px; }
.sp-model .row { display: flex; align-items: baseline; gap: 8px; }
.sp-model .m {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-model .go { flex: none; font-size: 12px; color: var(--primary); }
.sp-model .s {
  display: block; margin-top: 3px;
  font-size: 12.5px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sp-empty {
  text-align: center;
  padding: 56px 24px;
  color: #9aa0aa;
  font-size: 13px;
  line-height: 1.7;
}
.sp-empty b { color: var(--text-secondary); font-weight: 500; }

/* ---------- 型号详情 ---------- */
.sp-detail {
  position: fixed;
  inset: 0;
  /* 必须高于桌面端顶部标签栏（40），否则详情页的返回按钮会被标签栏盖住点不到 */
  z-index: 50;
  background: #f5f6f8;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s ease;
  visibility: hidden;
}
.sp-detail.show { transform: translateX(0); visibility: visible; }
.sp-detail .sd-head {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.sp-detail .sd-head button {
  width: 64px; height: 34px;
  border: 0; background: none;
  color: var(--primary); font-size: 14px; text-align: left; cursor: pointer;
}
.sp-detail .sd-title {
  flex: 1; text-align: center;
  font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-detail .sd-sub {
  padding: 8px 16px 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: center;
}
.sp-car {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 12px 14px 4px;
  flex: 1;
  align-items: flex-start;
  scrollbar-width: none;
}
.sp-car::-webkit-scrollbar { display: none; }
.sp-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-sizing: border-box;
}
.sp-slide .im {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafbfc;
  border-radius: 8px;
  overflow: hidden;
  min-height: 160px;
}
.sp-slide .im img {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}
.sp-slide .cap { padding: 9px 2px 2px; }
.sp-slide .cap .t { font-size: 14px; font-weight: 600; color: var(--text); }
.sp-slide .cap .d { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.6; }
.sp-slide .cap .d:empty { display: none; }

.sd-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px max(10px, env(safe-area-inset-bottom));
  font-size: 12px;
  color: #9aa0aa;
  background: #f5f6f8;
}
.sd-foot .pager { color: var(--text-secondary); }

/* ---------- 大图查看器（双指缩放） ---------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #0b0d10;
  display: none;
  flex-direction: column;
}
.viewer.show { display: flex; }
.viewer .vbar {
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: #e7e9ee;
  font-size: 13px;
}
.viewer .vclose {
  width: 34px; height: 34px;
  border-radius: 17px;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.viewer .vstage {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
}
.viewer .vstage img {
  position: absolute;
  left: 50%; top: 50%;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  max-width: none;
}
.viewer .vhint {
  flex: none;
  text-align: center;
  padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  font-size: 12px;
  color: #9aa1ad;
}

/* ---------- 常见问题 ---------- */
.sp-cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 14px 10px;
  scrollbar-width: none;
}
.sp-cats::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 30px;
  padding: 0 13px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
}
.chip.active {
  background: var(--primary-light);
  border-color: #cfe0ff;
  color: var(--primary);
  font-weight: 600;
}

.faq-list { padding: 0 14px; display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.faq-item.open { border-color: #cfe0ff; }
.faq-q {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 0;
  background: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  cursor: pointer;
}
.faq-q .qt { flex: 1; min-width: 0; }
.faq-q .pm {
  margin-left: auto;
  margin-top: 1px;
  flex: none;
  width: 20px; height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #b0b4bb;
  transition: transform 0.2s, color 0.2s;
}
.faq-q .pm .chev { display: block; }
.faq-item.open .faq-q .pm { transform: rotate(180deg); color: var(--primary); }
.faq-a {
  display: none;
  padding: 0 14px 13px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.faq-item.open .faq-a { display: block; }

/* Markdown 渲染结果（support_md.py 产出） */
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 6px 0 8px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md strong { color: var(--text); font-weight: 600; }
.md code {
  background: #f1f3f7;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.md a { color: var(--primary); text-decoration: none; }
.md h4, .md h5, .md h6 { margin: 10px 0 6px; font-size: 14px; color: var(--text); }

@media (max-width: 380px) {
  .sp-head .sp-back, .sp-detail .sd-head button { width: 52px; }
  .sp-head .sp-tail { width: 52px; }
  .sp-slide .im img { max-height: 46vh; }
}

/* ============================================================
   桌面端补充（放在文件末尾：.sd-head/.sp-car 的常规规则在上面的 900px 块
   之后才定义，同优先级会被覆盖，所以这里靠"后定义"取胜）
   ============================================================ */
@media (min-width: 900px) {
  .sp-detail { padding-top: 10px; }
  .sp-detail .sd-head,
  .sp-detail .sd-sub,
  .sp-detail .sp-car,
  .sp-detail .sd-foot {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }
  .sp-detail .sd-head { background: transparent; border-bottom: 0; }
  .sp-detail .sd-foot { padding-bottom: 16px; }

  /* 桌面端两列：单列时卡片宽到 730px，预览图按 16:10 会撑出 450px 高，
     一屏只放得下一张，反而不好挑。两列后每张 ~360px，高度回到 225px。 */
  .sp-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .sp-model:hover { border-color: #cfe0ff; box-shadow: 0 4px 16px rgba(47, 107, 237, 0.08); }
}
