/* ============================================================
   产品专属页面：统一设计面板
   手机端优先，电脑端并排。只影响新面板，不动原有样式。
   ============================================================ */

.lockedHidden {
  display: none !important;
}

#designPanel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 8px;
}

#designPanel .dpSection {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
}

#designPanel .dpTitle {
  font-size: 14px;
  font-weight: 600;
  color: #1f2430;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#designPanel .dpTitle .dpHint {
  font-size: 12px;
  font-weight: 400;
  color: #8a8f9a;
}

/* ---- 款式（设计几）---- */
.dpDesignGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dpDesignBtn {
  min-height: 52px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  background: #f7f8fa;
  color: #33383f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}

.dpDesignBtn .dpDesignSub {
  font-size: 11px;
  color: #8a8f9a;
  font-weight: 400;
}

.dpDesignBtn.isActive {
  background: #0d448d;
  border-color: #0d448d;
  color: #fff;
}

.dpDesignBtn.isActive .dpDesignSub {
  color: rgba(255, 255, 255, 0.75);
}

/* ---- 文字行 ---- */
.dpLines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dpLine {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dpLineTag {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #f7f8fa;
  color: #5f6470;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dpLineTag.isActive {
  background: #0d448d;
  border-color: #0d448d;
  color: #fff;
}

.dpLineInput {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  font-size: 16px; /* 16px 可避免 iOS 自动放大页面 */
  background: #fff;
  color: #1f2430;
}

.dpLineBtns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.dpMiniBtn {
  flex: 1 1 0;
  min-height: 40px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  background: #f7f8fa;
  color: #33383f;
  font-size: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dpMiniBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---- 滑块 ---- */
.dpSlider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.dpSlider:last-child {
  margin-bottom: 0;
}

#designPanel .dpSlider[hidden] {
  display: none;
}

.dpSliderHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #5f6470;
}

.dpSliderHead .dpVal {
  font-variant-numeric: tabular-nums;
  color: #0d448d;
  font-weight: 600;
}

.dpSlider input[type="range"] {
  width: 100%;
  height: 32px;
  margin: 0;
}

/* ---- 位置：左右 / 上下两个滑块 ---- */
/* 外观直接复用上面的 .dpSlider / .dpSliderHead / .dpVal，和字号、间距滑块保持一致 */

/* ---- 底部：文件名 + 导出 ---- */
.dpExport {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dpExport button {
  min-height: 46px;
  border: none;
  border-radius: 10px;
  background: #0d448d;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dpExport button.secondary {
  background: #f1f3f7;
  color: #33383f;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

/* ---- 顶部产品条 ---- */
.dpProductBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #eef3fb;
  border: 1px solid rgba(13, 68, 141, 0.16);
  margin-bottom: 4px;
}

.dpProductBar .dpName {
  font-size: 15px;
  font-weight: 600;
  color: #0d448d;
}

.dpProductBar .dpSub {
  font-size: 12px;
  color: #6b7280;
}

.dpCopyBtn {
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(13, 68, 141, 0.3);
  background: #fff;
  color: #0d448d;
  font-size: 13px;
  cursor: pointer;
}

/* ============================================================
   手机端：单列、预览在上、大按钮
   ============================================================ */
/* 「放大 / 收起」默认不显示，只有手机端才出现 */
.dpPreviewToggle {
  display: none;
}

/* ============================================================
   手机端：上半屏预览钉死不动 + 下半屏参数独立滚动
   调任何参数都能同时看到效果，不用上下反复滑
   ============================================================ */
@media (max-width: 900px) {
  /* 整个页面不滚动，滚动交给下面的参数区 */
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  main.app {
    display: flex !important;
    flex-direction: column !important;
    gap: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh; /* 避开手机地址栏高度变化 */
    overflow: hidden;
  }

  /* 预览固定在上半屏，永远看得见 */
  main.app section.previewWrap {
    order: 1;
    flex: 0 0 auto;
    height: 46vh;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0;
  }

  /* 点「放大」后预览撑到 85%，参数区缩到只剩一条 */
  main.app.previewExpanded section.previewWrap {
    height: 85vh;
  }

  /* 参数区自己滚，不影响上方的预览 */
  main.app section.panel.controls {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    background: #f2f4f7;
  }

  main.app.previewExpanded section.panel.controls {
    max-height: 15vh;
  }

  /* 预览图自适应塞进固定高度里，完整显示不裁切 */
  .preview {
    min-height: 0 !important;
    height: 100%;
    overflow: auto;
    touch-action: none; /* 允许手指在预览图上直接拖动文字 */
    border: 0;
    border-radius: 0;
  }

  .preview svg {
    width: min(100%, 900px);
    height: auto;
    max-height: 100%;
  }

  .previewToolbar {
    padding: 0 12px;
  }

  /* 「放大 / 收起」按钮只在手机端出现 */
  .dpPreviewToggle {
    display: inline-flex !important;
    align-items: center;
    min-height: 36px;
    padding: 0 18px;
    border-radius: 999px;
    border: 2px solid #0d448d;
    background: #0d448d;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex: none;
    margin-left: auto;
  }

  /* 参数卡片之间留出间距，视觉上更好区分 */
  #designPanel {
    gap: 10px;
  }

  #designPanel .dpSection {
    padding: 12px;
  }

  .dpDesignGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* 导出按钮吸在参数区底部，滑到哪都能直接导出 */
  #designPanel .dpExport {
    position: sticky;
    bottom: 0;
    padding: 8px 0 4px;
    background: #f2f4f7;
  }

  .dpExport button {
    min-height: 50px;
    font-size: 16px;
  }
}

/* ---------- 保存按钮：客户在这个链接里的最后一个动作，必须显眼 ---------- */
#designPanel .dpSaveWrap {
  margin: 14px 0 4px;
}

#designPanel .dpSaveBtn {
  display: block;
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 12px;
  background: #0d448d;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(13, 68, 141, 0.28);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#designPanel .dpSaveBtn:active {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(13, 68, 141, 0.28);
}

#designPanel .dpSaveBtn:disabled {
  background: #9aa5b4;
  box-shadow: none;
  cursor: default;
}

#designPanel .dpSaveHint {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #6b7280;
}

/* ---------- 二次确认 / 提交成功 弹窗 ---------- */
.dpMask {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  -webkit-tap-highlight-color: transparent;
}

.dpDialog {
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 20px 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  text-align: center;
}

.dpDialogTitle {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.dpDialogPreview {
  margin: 14px 0;
  padding: 10px;
  border-radius: 12px;
  background: #f3f4f6;
}

.dpDialogPreview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.dpDialogText {
  font-size: 14px;
  line-height: 1.6;
  color: #6b7280;
}

.dpDialogText + .dpDialogText {
  margin-top: 6px;
}

/* ---------- 提交中 ---------- */
.dpBusyCard {
  text-align: center;
}

.dpSpinner {
  width: 34px;
  height: 34px;
  margin: 2px auto 14px;
  border: 3px solid #dbe4f0;
  border-top-color: #0d448d;
  border-radius: 50%;
  animation: dpSpin 0.85s linear infinite;
}

@keyframes dpSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 终态页 ---------- */
.dpMaskDone {
  background: #f4f7fb;
}

.dpDoneCard {
  text-align: center;
  padding: 30px 22px 26px;
}

.dpDoneCheck {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 30px;
  line-height: 56px;
  font-weight: 700;
}

.dpDoneFoot {
  margin-top: 16px;
  color: #6b7280;
}

.dpPersonalizationBox {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: #eef3fb;
  text-align: left;
}

.dpPersonalizationTitle {
  color: #334155;
  font-size: 14px;
  font-weight: 600;
}

.dpDesignId {
  display: block;
  color: #13458b;
  margin: 8px 0;
  font-size: 20px;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.dpPersonalizationText {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  resize: vertical;
  white-space: pre-wrap;
}

.dpPersonalizationCopy {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  background: #0d448d;
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.dpPersonalizationCopy:focus-visible {
  outline: 3px solid #65a4ef;
  outline-offset: 2px;
}

.dpPersonalizationCount {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  line-height: 16px;
  text-align: right;
}

.dpPersonalizationCount.isOverLimit {
  color: #b42318;
}

.dpPersonalizationHint {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
}

.dpDialogActions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.dpDialogBtn {
  flex: 1;
  min-height: 46px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dpDialogCancel {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
}

.dpDialogOk {
  border: none;
  background: #0d448d;
  color: #fff;
}

.dpDownloadPreview {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 8px 12px;
  text-decoration: none;
}

.dpDownloadPreview:focus-visible {
  outline: 3px solid #65a4ef;
  outline-offset: 2px;
}

/* ---------- 轻提示 ---------- */
.dpToast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10001;
  transform: translate(-50%, 12px);
  max-width: 88vw;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.dpToast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 380px) {
  .dpDesignGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- 旗面颜色：色块按钮 ---- */
/* 用色块而不是下拉框 —— 客户一眼就能看出有哪些颜色可选 */
.dpColorGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dpColorBtn {
  flex-direction: row;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  min-height: 48px;
  text-align: left;
}

.dpSwatch {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.dpColorName {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- 字体下拉 ---- */
.dpSelect {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  background: #fff;
  color: #1f2430;
  font-size: 16px; /* 16px 可避免 iOS 自动放大页面 */
  font-family: inherit;
}

/* ---- 文字提示（分两行的建议） ---- */
.dpTextHint {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #6b7280;
}

.dpTextHint.isWarn {
  color: #9a3412;
  background: #fff4ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 10px 12px;
}

.dpLineTagStatic {
  cursor: default;
}

/* Pennant customer controls: keep every regular adjustment visible. */
.dpSmallHint { margin: 0 0 10px; font-size: 12px; line-height: 1.6; color: #667085; }
.dpThreadGrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.dpThreadButton { min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; cursor: pointer; color: #344054; }
.dpThreadButton.isActive { border: 2px solid #0d448d; background: #eef3fb; font-weight: 700; }
.dpThreadLabel { margin: 8px 0 0; }
.dpOrnamentGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dpOrnamentAdd { padding: 8px; min-height: 76px; font-size: 12px; }
.dpOrnamentAdd img { width: 32px; height: 32px; object-fit: contain; }
.dpOrnamentList { display: grid; gap: 12px; margin-top: 12px; }
.dpOrnamentCard { min-width: 0; padding: 12px; border: 1px solid #d0d5dd; border-radius: 10px; background: #fafbfc; }
.dpOrnamentCard.isSelected { border-color: #1274c0; box-shadow: 0 0 0 1px #1274c0; }
.dpOrnamentHeader { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dpOrnamentSelect, .dpOrnamentDelete { min-height: 44px; border: 0; border-radius: 6px; padding: 6px 10px; font: inherit; cursor: pointer; }
.dpOrnamentSelect { min-width: 0; background: transparent; text-align: left; color: #344054; font-size: 13px; }
.dpOrnamentDelete { flex: none; background: #fff1f0; color: #a32924; font-size: 13px; }
.dpCharacterError { margin-top: 10px; padding: 10px; color: #9a3412; background: #fff4ed; border-radius: 8px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.dpCharacterError[hidden] { display: none; }
.dpConfirmSummary { margin: 14px 0; text-align: left; font-size: 14px; line-height: 1.6; }
.dpConfirmSummary dt { font-size: 12px; color: #667085; margin-top: 10px; }
.dpConfirmSummary dd { margin: 2px 0 0; color: #1d2939; white-space: pre-wrap; overflow-wrap: anywhere; }
.dpDraftStatus { padding: 0 4px; }
.customPennantOrnament, #customPennantText { cursor: grab; touch-action: none; }
#designPanel button:focus-visible, #designPanel input:focus-visible, #designPanel select:focus-visible { outline: 3px solid #65a4ef; outline-offset: 2px; }
@media (min-width: 901px) {
  body.pennantCustomer { height: 100vh; overflow: hidden; }
  .pennantCustomer main.app { box-sizing: border-box; height: 100dvh; grid-template-columns: 390px minmax(0, 1fr); align-items: stretch; }
  .pennantCustomer section.panel.controls { min-height: 0; overflow-y: auto; }
  .pennantCustomer section.previewWrap { min-height: 0; display: flex; flex-direction: column; }
  .pennantCustomer .preview { flex: 1; min-height: 0; overflow: hidden; }
  /* Preserve the source aspect ratio: filling both axes stretched pennant photos vertically. */
  .pennantCustomer .preview svg { width: min(100%, 900px); height: auto; max-height: 100%; }
  .pennantCustomer .dpPreviewToggle { display: none !important; }
}
.pennantCustomer .dpColorName { overflow: visible; text-overflow: clip; }
@media (max-width: 480px) {
  .dpThreadGrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #designPanel .dpTitle { align-items: flex-start; flex-wrap: wrap; }
  .dpDialog { box-sizing: border-box; }
}
