/* 图片转投影页面样式 */
/* 侧栏：内容超过屏幕高度时可滚动（.preset-col 已设 sticky + max-height） */
.mapart-side {
  flex: 0 0 276px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;   /* 滚动条出现/消失时不抖动 */
  scrollbar-width: thin;
  scrollbar-color: #c3ccd8 transparent;
  padding-right: 8px;         /* 内容区仍为 260px */
}
.mapart-side::-webkit-scrollbar { width: 8px; }
.mapart-side::-webkit-scrollbar-track { background: transparent; }
.mapart-side::-webkit-scrollbar-thumb { background: #c9d1dc; border-radius: 4px; border: 2px solid #f5f6f8; }
.mapart-side::-webkit-scrollbar-thumb:hover { background: #a9b4c2; }

.mapart-side .mt { margin-top: 16px; }

/* 可折叠分区 */
.sec-head { cursor: pointer; user-select: none; -webkit-user-select: none; }
.sec-head:hover .preset-title { color: #3b82f6; }
.sec-head:focus-visible { outline: 2px solid #3b82f6; outline-offset: 3px; border-radius: 4px; }
.sec-right { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.sec-caret {
  display: inline-block; font-size: 10px; line-height: 1; color: #9aa3af;
  transition: transform .18s ease; flex-shrink: 0;
}
.sec-head[aria-expanded="false"] .sec-caret { transform: rotate(-90deg); }
.sec-badge {
  font-size: 10px; line-height: 15px; padding: 0 6px; border-radius: 8px;
  color: #8a93a0; background: #f0f2f5; border: 1px solid #e3e6ea;
  max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sec-badge.on { color: #3b82f6; background: #eef4ff; border-color: #cfe0ff; }
/* 0fr/1fr 网格实现高度过渡，收起后彻底隐藏（visibility 避免仍可 tab 到） */
.sec-panel {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows .18s ease, visibility .18s;
}
.sec-panel > * { min-height: 0; overflow: hidden; }
.sec-panel.collapsed { grid-template-rows: 0fr; visibility: hidden; }

/* 窄屏：侧栏改为整行铺开，不再限高滚动（与 style.css 的响应式保持一致） */
@media (max-width: 900px) {
  .mapart-side {
    flex: none; width: 100%; max-height: none;
    overflow: visible; padding-right: 0;
  }
}

.drop-zone {
  border: 2px dashed #c3ccd8; border-radius: 10px; padding: 22px 10px;
  text-align: center; cursor: pointer; color: #666; font-size: 13px;
  transition: border-color .15s, background .15s; background: #fff;
}
.drop-zone:hover, .drop-zone.dragover { border-color: #3b82f6; background: #eef4ff; }
.drop-hint { font-size: 11px; color: #999; margin-top: 4px; }

.side-info { font-size: 12px; color: #888; margin-top: 6px; line-height: 1.5; }

.export-form label {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: #555;
}
.export-form input {
  width: 100%; padding: 5px 8px; border: 1px solid #d0d4da;
  border-radius: 6px; font-size: 13px;
}
.export-form input:focus { outline: none; border-color: #3b82f6; }

.slider-form { display: flex; flex-direction: column; gap: 8px; }
.slider-form label { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.slider-form input[type="range"] { flex: 1 0 100%; padding: 0; border: none; accent-color: #3b82f6; }
.slider-label { color: #888; font-size: 11px; }
.slider-hint { font-size: 11px; color: #999; margin: 0; }

/* 预处理 / 抖动 面板 */
.field { margin-bottom: 7px; }
.field input[type="range"] {
  width: 100%; padding: 0; border: none;
  accent-color: #3b82f6; display: block; margin: 2px 0 0;
}
.opt-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: 12px; color: #555; }
.opt-row .val { font-size: 11px; color: #3b82f6; font-variant-numeric: tabular-nums; }

.check-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #555; margin: 8px 0; }
.check-row input[type="checkbox"] { width: 14px; height: 14px; accent-color: #3b82f6; margin: 0; cursor: pointer; }
.check-row label { flex: 1; cursor: pointer; }
.check-row input[type="color"] {
  width: 34px; height: 24px; padding: 0; border: 1px solid #d0d4da;
  border-radius: 5px; background: none; cursor: pointer;
}

.export-form select {
  width: 100%; padding: 5px 8px; border: 1px solid #d0d4da;
  border-radius: 6px; font-size: 13px; background: #fff; color: #333;
}
.export-form select:focus { outline: none; border-color: #3b82f6; }

#pp-body.disabled { opacity: .45; pointer-events: none; }

.btn-mini {
  margin-top: 4px; padding: 4px 10px; font-size: 12px; color: #555;
  background: #fff; border: 1px solid #d0d4da; border-radius: 6px; cursor: pointer;
}
.btn-mini:hover { border-color: #3b82f6; color: #3b82f6; }

#cv-src { cursor: grab; touch-action: none; }
#cv-src.dragging { cursor: grabbing; }

.preview-row { display: flex; gap: 18px; flex-wrap: wrap; }
.preview-box { display: flex; flex-direction: column; gap: 6px; }
.preview-cap { font-size: 12px; color: #888; }
.preview-box canvas {
  max-width: 45vw; max-height: 70vh; border: 1px solid #e3e6ea;
  border-radius: 6px; background:
    repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
  image-rendering: pixelated;
}

/* 计算进度遮罩：大图匹配要跑好几秒，盖在预览区上给个反馈 */
.key-editor { position: relative; }
.calc-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .78); border-radius: 10px;
}
.calc-overlay[hidden] { display: none; }
.calc-box {
  width: 264px; padding: 16px 18px; background: #fff;
  border: 1px solid #e3e6ea; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .1);
}
.calc-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #333; }
.calc-pct { margin-left: auto; font-size: 12px; color: #3b82f6; font-variant-numeric: tabular-nums; }
.calc-spin {
  flex-shrink: 0; width: 13px; height: 13px;
  border: 2px solid #dfe6f1; border-top-color: #3b82f6; border-radius: 50%;
  animation: calc-spin .7s linear infinite;
}
@keyframes calc-spin { to { transform: rotate(360deg); } }
.calc-bar { margin-top: 10px; height: 6px; border-radius: 3px; background: #eef0f3; overflow: hidden; }
.calc-fill {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: #3b82f6; transition: width .12s linear;
}
/* 进度未知的同步阶段（读像素 / 合成画布）：条纹流动表示还在跑 */
.calc-fill.indet {
  width: 100% !important; transition: none;
  background: repeating-linear-gradient(45deg, #bcd4fb 0 8px, #3b82f6 8px 16px);
  background-size: 22px 22px; animation: calc-move .6s linear infinite;
}
@keyframes calc-move { to { background-position: 22px 0; } }
.calc-hint { margin-top: 8px; font-size: 11px; color: #999; }
@media (prefers-reduced-motion: reduce) {
  .calc-spin, .calc-fill.indet { animation: none; }
}
