/* 索引页预览：每 Tab 独占一行；机模左 + 开发说明占满剩余宽 */

.preview-section {
  width: 100%;
  padding: 0 0 2rem;
}

.preview-rows {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.preview-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  align-items: start;
}

/* 每 Tab 一行（首页 / 简历 / 助手 / 我的 不再并排） */
.preview-row > .preview-unit {
  grid-column: 1 / -1;
}

.preview-row-compare {
  display: none;
}

.preview-unit {
  grid-column: 1 / -1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.preview-unit > .preview-label {
  font-size: 13px;
  font-weight: 600;
  color: #f9b400;
  margin-bottom: 8px;
  text-align: left;
}

.preview-unit-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(249, 180, 0, 0.15);
  border-radius: 14px;
  padding: 10px 0;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

/* 机模固定宽；红框 = 第 2～3 列全部剩余宽；说明弹窗 flex 铺满红框（含原竖条右侧空白） */
@media (min-width: 768px) {
  .preview-unit-body {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: var(--index-grid-gap, 0.5rem);
    align-items: start;
    width: 100%;
    min-width: 0;
  }

  .preview-phone {
    grid-column: 1;
    width: max-content;
    max-width: none;
    flex-shrink: 0;
  }

  .preview-spec-zone {
    grid-column: 2;
    width: 100%;
    min-width: var(--index-col-w);
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 4px;
    align-self: stretch;
    min-height: calc(var(--preview-src-h) * var(--preview-scale));
  }

  .preview-spec-zone .preview-spec-rail {
    flex-shrink: 0;
    align-self: center;
  }

  .preview-spec-zone .preview-spec-panel.is-open {
    flex: 1 1 auto;
    width: auto;
    min-width: min(420px, 100%);
    min-height: 100%;
    max-height: min(720px, calc(var(--preview-src-h) * var(--preview-scale) + 120px));
    height: auto;
    align-self: stretch;
  }
}

@media (max-width: 767px) {
  .preview-unit-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .preview-spec-zone {
    width: 100%;
    max-width: 100%;
  }
  .preview-spec-panel.is-open {
    width: 100%;
  }
}

.preview-phone {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex-shrink: 0;
}

.preview-viewport {
  position: relative;
  flex-shrink: 0;
  width: calc(var(--preview-src-w) * var(--preview-scale-slot, var(--preview-scale)));
  height: calc(var(--preview-src-h) * var(--preview-scale-slot, var(--preview-scale)));
}

.preview-viewport iframe {
  width: var(--preview-src-w);
  height: var(--preview-src-h);
  transform: scale(var(--preview-scale-slot, var(--preview-scale)));
  transform-origin: 0 0;
  background: #101010;
}

.preview-hud-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.preview-hud {
  min-width: 120px;
  max-width: 78%;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(28, 28, 30, 0.92);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  opacity: 0;
  transform: scale(0.86);
  transition:
    opacity 0.22s ease,
    transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.preview-hud.is-visible {
  opacity: 1;
  transform: scale(1);
}
.preview-hud-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.preview-hud-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: #fff;
  letter-spacing: -0.01em;
}

.preview-spec-rail {
  flex-shrink: 0;
  align-self: center;
  padding: 10px 6px;
  border: none;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(180deg, #f9b400, #ff770f);
  color: #000026;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  cursor: pointer;
}
.preview-spec-rail:hover {
  filter: brightness(1.06);
}
.preview-spec-rail.is-open {
  box-shadow: -2px 0 12px rgba(249, 180, 0, 0.4);
}

.preview-spec-panel {
  display: none;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  text-align: left;
  max-height: min(720px, calc(var(--preview-src-h) * var(--preview-scale) + 120px));
  overflow: hidden;
}
.preview-spec-panel.is-open {
  display: flex;
}

/* 不因打开说明而缩小机模（已移除 --preview-scale-slot 缩放） */

.preview-spec-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.preview-spec-head strong {
  font-size: 12px;
  color: #0f172a;
  line-height: 1.35;
}
.preview-spec-close {
  border: none;
  background: #fff;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: #64748b;
  font-size: 15px;
  cursor: pointer;
}
.preview-spec-close:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.preview-spec-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
  --spec-chapter-size: 12px;
}
.preview-spec-body .spec-chapter-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  box-sizing: border-box;
  border: 1px solid #64748b;
  border-radius: 50%;
  font-size: 1em;
  font-weight: 400;
  line-height: 1;
  margin: 0;
  color: #0f172a;
}
.preview-spec-body .spec-chapter-digit {
  font-weight: 800;
  font-size: 0.58em;
  line-height: 1;
  letter-spacing: -0.02em;
}
.preview-spec-body .spec-chapter-num--inline {
  font-size: var(--spec-chapter-size);
  vertical-align: middle;
  margin: 0 0.05em;
  transform: translateY(-0.11em);
}
.preview-spec-body strong .spec-chapter-num--inline {
  font-weight: 400;
}
.preview-spec-body h4 {
  margin: 8px 0 3px;
  font-size: var(--spec-chapter-size);
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.3em;
  line-height: 1;
}
.preview-spec-body h4 .spec-chapter-num {
  font-size: inherit;
}
.preview-spec-body h4:first-child { margin-top: 0; }
.preview-spec-body p { margin: 0 0 5px; }
.preview-spec-body ol {
  margin: 0 0 6px;
  padding-left: 1.1em;
  list-style: decimal;
}
.preview-spec-body ul { margin: 0 0 6px; padding-left: 0; list-style: none; }
.preview-spec-body li {
  margin-bottom: 4px;
  padding-left: 0.6em;
}
.preview-spec-body li > ul {
  margin: 3px 0 5px;
  padding-left: 0.75em;
  border-left: 2px solid #e2e8f0;
}
.preview-spec-body li > ul > li {
  font-size: 10px;
  color: #475569;
  margin-bottom: 2px;
  list-style: none;
}
.preview-spec-body li > ul > li::before {
  content: "– ";
  color: #94a3b8;
}
.preview-spec-body code {
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #f8fafc;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.preview-spec-body code.spec-id {
  background: #f3e8ff;
  color: #7c3aed;
  font-weight: 600;
}
.preview-spec-body code.spec-api {
  background: #ecfdf5;
  color: #047857;
  font-weight: 500;
}
.preview-spec-body code.spec-event {
  background: #fff7ed;
  color: #c2410c;
  font-weight: 500;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.preview-spec-body code.spec-generic {
  background: #f1f5f9;
  color: #475569;
}
/* 原型页文件名链接 · 与单页 dev-spec 一致（蓝色可识别） */
.preview-spec-body a.dev-spec-page-link {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 500;
}
.preview-spec-body a.dev-spec-page-link:hover {
  color: #1d4ed8;
}
.preview-spec-body a[href*="dev-notes"] {
  color: #b45309;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.preview-spec-foot {
  font-size: 10px;
  color: #64748b;
  padding: 6px 10px;
  border-top: 1px dashed #e2e8f0;
  background: #fffbeb;
  flex-shrink: 0;
}

.preview-unit > a.preview-open-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  color: #f9b400;
  text-decoration: none;
  text-align: left;
}
.preview-unit > a.preview-open-link:hover {
  text-decoration: underline;
}

@media (max-width: 767px) {
  .preview-spec-panel.is-open {
    max-height: min(70vh, 480px);
    width: 100%;
  }
}
