/*
  ============================================================
  文件：style.css —— 全部界面样式
  ------------------------------------------------------------
  【本文件是什么】
    四块屏幕的视觉样式。设计基调：深色专业工作台风格，
    大按钮大滑杆（单手操作，PRD 三屏原则），低饱和不抢画面的戏。
  ============================================================
*/

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #141a24;              /* 深蓝黑：不干扰图片色彩判断 */
  color: #e8eaed;
  height: 100vh;
  overflow: hidden;
}

/* ---------- 屏幕容器：同一时刻只显示 .active 的那块 ---------- */
.screen { display: none; height: 100vh; flex-direction: column; }
.screen.active { display: flex; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; gap: 8px;
  background: #1a2332; border-bottom: 1px solid #2a3547;
  flex-shrink: 0;
}
.brand { font-size: 15px; font-weight: 500; }
.filename {
  font-size: 12px; color: #9aa3b2;
  max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 按钮体系 ---------- */
.primary-btn {
  background: #c8502e; color: #fff; border: none;
  padding: 10px 18px; border-radius: 10px; font-size: 15px;
}
.primary-btn.big { width: 100%; padding: 15px; font-size: 17px; }
.ghost-btn {
  background: transparent; color: #9aa3b2; border: 1px solid #2a3547;
  padding: 8px 14px; border-radius: 10px; font-size: 14px;
}
.ghost-btn.on { color: #e8845f; border-color: #c8502e; }
button:active { opacity: 0.7; }

/* ---------- 图库屏 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 4px; flex-shrink: 0;
}
.hint { font-size: 12px; color: #9aa3b2; }
.hint.center { text-align: center; margin: 8px 0; }

.preset-bar {
  display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto;
  flex-shrink: 0;
}
.preset-btn {
  background: #223046; color: #7fb8ff; border: 1px solid #2a3d5c;
  padding: 8px 16px; border-radius: 18px; font-size: 13px; white-space: nowrap;
}

.grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px; padding: 8px 12px 20px;
}
.cell { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; }
.cell img { width: 100%; height: 100%; object-fit: cover; }
.cell.picked::after {
  content: '✓'; position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #c8502e; color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.empty { text-align: center; color: #5c6675; padding: 60px 20px; line-height: 2; }

/* ---------- 编辑屏 ---------- */
.canvas-holder {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 8px;
}
.tabs { display: flex; border-top: 1px solid #2a3547; flex-shrink: 0; }
.tab {
  flex: 1; padding: 13px; background: transparent; border: none;
  color: #9aa3b2; font-size: 15px;
  border-bottom: 2px solid transparent;
}
.tab.active { color: #e8845f; border-bottom-color: #c8502e; }

.tab-panel { display: none; padding: 14px 20px 90px; background: #1a2332; flex-shrink: 0; }
.tab-panel.active { display: block; }
.row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 16px;
}
.row > label { font-size: 14px; color: #c3cad6; white-space: nowrap; min-width: 96px; }
.row select {
  flex: 1; background: #223046; color: #e8eaed; border: 1px solid #2a3547;
  padding: 9px; border-radius: 8px; font-size: 14px;
}
.row input[type="range"] { flex: 1; accent-color: #c8502e; height: 32px; }
.note { font-size: 12px; color: #6b7686; line-height: 1.6; margin-top: 4px; }

/* 开关控件 */
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { display: none; }
.switch span {
  position: absolute; inset: 0; background: #3a4658; border-radius: 13px;
  transition: background 0.15s;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: left 0.15s;
}
.switch input:checked + span { background: #c8502e; }
.switch input:checked + span::after { left: 23px; }

/* ---------- 导出屏 ---------- */
.compare {
  flex: 1; display: flex; gap: 8px; padding: 12px; overflow: hidden;
}
.compare > div { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.compare p { margin-bottom: 6px; }
.compare img, .compare canvas {
  max-width: 100%; max-height: 100%; object-fit: contain; margin: 0 auto;
}

/* 按住看原图：成品图容器 + 原图覆盖层 */
.compare-wrap { position: relative; display: inline-block; cursor: pointer; }
.compare-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: none; align-items: center; justify-content: center;
  background: #141a24; object-fit: contain;
}
.note.center { text-align: center; margin-top: 6px; }
.export-actions { padding: 0 20px 26px; flex-shrink: 0; }

/* ---------- 证据面板（隐形水印的可视化证明） ---------- */
.ghost-btn.big2 {
  width: 100%; margin-top: 10px; padding: 12px; font-size: 14px;
}
.ghost-btn.big2:disabled { opacity: 0.5; }
.evidence-grid {
  display: flex; gap: 10px; margin-top: 12px;
}
.evidence-grid > div { flex: 1; min-width: 0; }
.prove-result {
  margin-top: 6px; padding: 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.8;
}
.prove-result.ok { background: #1c3327; color: #7fd4a8; border: 1px solid #2c5a42; }
.prove-result.bad { background: #3a2224; color: #e59a9a; border: 1px solid #5c3538; }

/* 差异图缩放查看器（真图 + X光双层） */
.diff-view {
  position: relative; overflow: hidden; height: 320px;
  background: #000; border-radius: 8px; cursor: grab; touch-action: none;
}
.diff-inner { position: relative; transform-origin: 0 0; }
.diff-xray {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none;
}
.diff-tools { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.diff-tools .ghost-btn { padding: 5px 12px; font-size: 13px; }
.diff-tools .xray-btn.on { color: #7fd4a8; border-color: #2c5a42; }

/* 裁切取景器（框固定，底图拖动缩放） */
#ed-canvas-holder { position: relative; }
.crop-overlay {
  position: absolute; inset: 0; z-index: 5; overflow: hidden;
  cursor: move; touch-action: none; background: rgba(0,0,0,0.2);
}
.crop-overlay canvas { position: absolute; }
.crop-frame {
  position: absolute; border: 2px solid #c8502e; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62); /* 框外压暗，框内清晰 */
}
.crop-tools {
  position: absolute; left: 0; right: 0; bottom: 14px;
  display: flex; justify-content: center; gap: 12px; z-index: 6;
}
.crop-tools .ghost-btn, .crop-tools .primary-btn { padding: 9px 22px; font-size: 15px; }

/* ---------- 验水印屏 ---------- */
.verify-body { flex: 1; padding: 24px 20px; }
.file-label { display: flex; align-items: center; justify-content: center; margin-top: 16px; }
.verify-result {
  margin-top: 18px; padding: 16px; border-radius: 10px;
  font-size: 14px; line-height: 1.8; display: none;
}
.verify-result.ok { display: block; background: #1c3327; color: #7fd4a8; border: 1px solid #2c5a42; }
.verify-result.bad { display: block; background: #3a2224; color: #e59a9a; border: 1px solid #5c3538; }
.verify-result .dim { color: inherit; opacity: 0.65; font-size: 12px; }

/* ---------- 提示条 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%);
  background: #2a3547; color: #fff; padding: 10px 22px; border-radius: 20px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s;
  z-index: 99; white-space: nowrap;
}
#toast.show { opacity: 1; }
