/* Web edition shell: reuse the CEP panel, hide Illustrator-only controls. */
body.web-mode {
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(201, 164, 92, .08), transparent 60%),
    #080b12;
}

.web-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px clamp(14px, 4vw, 40px);
  border-bottom: 1px solid rgba(201, 164, 92, .18);
  background: rgba(7, 10, 16, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.web-banner-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.web-banner-brand img { width: 28px; height: 28px; filter: drop-shadow(0 2px 6px rgba(201,164,92,.3)); }
.web-banner-brand strong { color: #f4ebd8; font-family: "STZhongsong", "Songti SC", serif; font-size: 18px; font-weight: 400; letter-spacing: .08em; white-space: nowrap; }
.web-badge { padding: 1px 6px; border: 1px solid rgba(201,164,92,.5); border-radius: 2px; color: #e7cf9a; font-size: 9px; letter-spacing: .12em; }
.web-banner-brand em { color: #8b95a6; font-size: 10px; font-style: normal; letter-spacing: .08em; }
.web-banner-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.web-note { color: #7f8a9c; font-size: 10px; letter-spacing: .04em; }
.web-format-select {
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid #5a513c;
  border-radius: 2px;
  background: #141a22;
  color: #e7cf9a;
  font-size: 11px;
  outline: none;
}
.web-format-select:focus { border-color: #c9a45c; }
.web-format-note { color: #6f7a8c; font-size: 9px; letter-spacing: .02em; }
#webExport {
  height: 34px;
  padding: 0 15px;
  border: 1px solid #c9a45c;
  border-radius: 2px;
  background: #c9a45c;
  color: #15110a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
#webExport:hover { background: #e7cf9a; transform: translateY(-1px); }

.web-mode .app-shell {
  /* 宽屏铺满：小窗还是 100%，大屏最多 1760px，左右留一点呼吸 */
  width: min(1760px, 96vw);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 26px) 42px;
}

/* Illustrator-only controls are meaningless in a browser. */
.web-mode .dieline-picker,
.web-mode #dielinePicker,
.web-mode #updateCurrent,
.web-mode #softUpdate,
.web-mode #cupUpdate,
.web-mode #bottleUpdate,
.web-mode #refreshDielines,
.web-mode #softRefreshList,
.web-mode #cupRefreshList,
.web-mode #bottleRefreshList,
.web-mode #renameCurrent,
.web-mode #softRename,
.web-mode #cupRename,
.web-mode #bottleRename,
.web-mode #barcodeEnabled,
.web-mode .barcode-enable,
.web-mode .barcode-options,
.web-mode .current-dieline-badge,
.web-mode .dieline-empty-state,
.web-mode #licenseButton,
.web-mode .license-modal {
  display: none !important;
}

.web-mode .bottom-action-dock { margin-top: 14px; }
.web-mode .bottom-action-dock .action-grid { grid-template-columns: 1fr 1fr; }

.web-carton-preview {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #3b434e;
  border-radius: 5px;
  background: #0d1219;
}
.web-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #2e3641;
  color: #b9c2d0;
  font-size: 11px;
  letter-spacing: .04em;
}
.web-preview-head span:last-child { color: #8b95a6; font-family: Consolas, monospace; font-size: 10px; }
.web-preview-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 360px;
  padding: 12px;
  overflow: hidden;
  background: #f7f8fa;
}
.web-preview-canvas svg { display: block; width: 100%; height: 100%; }
.web-preview-canvas svg path { vector-effect: non-scaling-stroke; }
.web-preview-canvas svg #bleed path { stroke: #c3c9d1; stroke-width: 1; }
.web-preview-canvas svg #cut path { stroke: #1f6fb2; stroke-width: 1.35; }
.web-preview-canvas svg #crease path { stroke: #d9534f; stroke-width: 1.15; }
.web-preview-canvas svg #adhesive path { stroke: #2f8f6b; stroke-width: 1.15; }
.web-preview-canvas svg #perforation path { stroke: #8e44ad; stroke-width: 1; }
.web-preview-error { padding: 30px 10px; color: #a35454; font-size: 12px; text-align: center; }

.web-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  max-width: min(1760px, 96vw);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 40px) 36px;
  border-top: 1px solid rgba(201, 164, 92, .12);
  color: #6f7a8c;
  font-size: 10px;
  letter-spacing: .06em;
}
.web-footer span:last-child { color: #8b95a6; }

.web-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  max-width: min(360px, calc(100vw - 44px));
  padding: 11px 14px;
  border: 1px solid rgba(201, 164, 92, .45);
  border-radius: 3px;
  background: rgba(13, 17, 24, .96);
  color: #e7cf9a;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.web-toast.show { opacity: 1; transform: none; }

@media (max-width: 720px) {
  .web-banner { align-items: flex-start; }
  .web-banner-brand strong { font-size: 16px; }
  .web-note { display: none; }
  .web-mode .bottom-action-dock .action-grid { grid-template-columns: 1fr; }
  .web-preview-canvas { min-height: 160px; }
}

/* ── 刀模预览：图层开关 / 尺寸标注 / 参考网格 ───────────── */
.web-layer-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.06);
}
.layer-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  color: #8b95a6; font-size: 11.5px; line-height: 1.6;
  transition: border-color .15s, color .15s, background .15s;
}
.layer-chip:hover { color: #cfd6e2; border-color: rgba(201,164,92,.4); }
.layer-chip .layer-chip-eye {
  width: 7px; height: 7px; border-radius: 50%;
  background: transparent; border: 1px solid currentColor; flex: none;
}
.layer-chip.is-on { color: #e7cf9a; border-color: rgba(201,164,92,.45); background: rgba(201,164,92,.1); }
.layer-chip.is-on .layer-chip-eye { background: currentColor; }
.layer-chip[hidden] { display: none; }

.web-preview-canvas[data-hide~="cut"] svg #cut,
.web-preview-canvas[data-hide~="crease"] svg #crease,
.web-preview-canvas[data-hide~="adhesive"] svg #adhesive,
.web-preview-canvas[data-hide~="perforation"] svg #perforation,
.web-preview-canvas[data-hide~="bleed"] svg #bleed,
.web-preview-canvas[data-hide~="dim"] svg #dim,
.web-preview-canvas[data-hide~="overall"] svg #overall,
.web-preview-canvas[data-hide~="grid"] svg #grid { display: none; }

/* ── 选择盒型：管理显示/隐藏 ─────────────────────────── */
.type-heading-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.type-manage-button {
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
  font-size: 11.5px; line-height: 1.7;
  color: #8b95a6; background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.12);
  transition: color .15s, border-color .15s, background .15s;
}
.type-manage-button:hover { color: #cfd6e2; border-color: rgba(201,164,92,.4); }
.type-manage-button.is-active { color: #e7cf9a; border-color: rgba(201,164,92,.55); background: rgba(201,164,92,.1); }

.type-card { position: relative; }
.type-card.is-hidden-type { display: none; }
.type-card.is-managing { opacity: .92; }
.type-card.is-managing[aria-hidden="true"] { opacity: .42; }

.type-hide-toggle {
  position: absolute; top: 5px; right: 7px; z-index: 3;
  width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; cursor: pointer;
  color: #8b95a6; background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.18);
}
.type-hide-toggle:hover { color: #e7cf9a; border-color: rgba(201,164,92,.6); }
.type-hide-toggle[hidden] { display: none; }

.type-hidden-bar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; font-size: 11.5px; color: #8b95a6;
}
.type-hidden-bar button {
  padding: 2px 9px; border-radius: 999px; cursor: pointer;
  font-size: 11.5px; color: #e7cf9a;
  background: rgba(201,164,92,.1); border: 1px solid rgba(201,164,92,.45);
}
.type-hidden-bar button:hover { background: rgba(201,164,92,.18); }
.type-hidden-bar[hidden] { display: none; }

/* ── 桌面端两栏：参数在左（窄），刀模预览在右（大） ───────────── */
@media (min-width: 1080px) {
  #cartonPackaging {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 16px 22px;
    align-items: start;
  }
  #cartonPackaging > section[aria-labelledby="type-heading"] {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #cartonPackaging > .web-carton-preview {
    grid-column: 2;
    grid-row: 2 / 5;
    margin-top: 0;
  }
  #cartonPackaging > .web-carton-preview .web-preview-canvas {
    height: min(72vh, 780px);
  }
  #cartonPackaging > .web-carton-preview .web-preview-head { font-size: 12px; }

  #cartonPackaging > .custom-size-panel { grid-column: 1; grid-row: 2; }
  #cartonPackaging > #configurationLower { grid-column: 1; grid-row: 3; }
  #cartonPackaging > .legend { grid-column: 1; grid-row: 4; }
  #cartonPackaging > .bottom-action-dock { grid-column: 1 / -1; grid-row: 5; margin-top: 4px; }

  /* 左栏变窄后，尺寸/厚度字段改成单列，别挤成小方块 */
  #cartonPackaging > .custom-size-panel .custom-dimension-grid {
    grid-template-columns: 1fr !important;
  }
  #cartonPackaging > .custom-size-panel .size-type-switch { flex-wrap: wrap; }
  #cartonPackaging > .custom-size-panel .size-type-switch button { flex: 1 1 30%; }
  #cartonPackaging > .custom-size-panel .custom-size-head h2 { font-size: 15px; }
}

/* 底部按钮条：去掉大导出按钮后只剩 3D，改成整行；没有可用按钮时整块不占位 */
.web-mode .bottom-action-dock .action-grid { grid-template-columns: 1fr; }
.web-mode .bottom-action-dock .action-grid:not(:has(> button:not([hidden]))) { display: none; }
