/* =========================================================
   Gemini 水印去除 · 手写样式（无外部资源，file:// 可用）
   主色：emerald / 绿色，呼应上游项目。系统字体栈。
   ========================================================= */

:root {
  --bg: #f5f8f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e4e9ee;

  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #ecfdf5;
  --primary-ring: rgba(5, 150, 105, .22);

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;

  --info: #0369a1;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;

  --ok: #047857;
  --ok-bg: #ecfdf5;
  --ok-border: #a7f3d0;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(2, 6, 23, .08);
  --shadow-sm: 0 2px 8px rgba(2, 6, 23, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

/* ===== 头部 ===== */
.hero { text-align: center; margin-bottom: 26px; }

.logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: var(--primary-light);
  border: 1px solid var(--ok-border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -.01em;
}

.subtitle {
  margin: 0 auto 14px;
  max-width: 620px;
  color: var(--muted);
  font-size: 15px;
}
.subtitle strong { color: var(--primary-dark); font-weight: 650; }

.privacy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px solid var(--ok-border);
  border-radius: 999px;
}
.privacy .lock { font-size: 14px; }

/* ===== 错误横幅 ===== */
.error-banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 14px;
}

/* ===== 上传区 ===== */
.dropzone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .06s ease;
  box-shadow: var(--shadow-sm);
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--primary);
  background: #fbfdfc;
  outline: none;
}
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.005);
}
.dz-icon { color: var(--primary); margin-bottom: 10px; }
.dz-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.dz-link { color: var(--primary-dark); text-decoration: underline; text-underline-offset: 3px; }
.dz-hint { margin: 0; font-size: 13px; color: var(--muted); }

/* ===== 工作区 ===== */
.workspace { margin-top: 4px; }

/* ---- 前后对比滑块 ---- */
.compare {
  position: relative;
  width: 100%;
  margin: 0 auto 18px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;            /* 触摸拖动时不滚动页面 */
  --pos: 50%;                    /* 分隔条位置，JS 更新 */
  /* 棋盘格底纹，提示透明区域 */
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eef1f0 25%, transparent 25%),
    linear-gradient(-45deg, #eef1f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef1f0 75%),
    linear-gradient(-45deg, transparent 75%, #eef1f0 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* 上层原图：从左裁掉 --pos，只保留右侧 => 右=原图，左=处理后 */
.layer-before {
  clip-path: inset(0 0 0 var(--pos));
}

.label {
  position: absolute;
  top: 10px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 23, 42, .60);
  border-radius: 999px;
  pointer-events: none;
  letter-spacing: .02em;
}
.label-left { left: 10px; }
.label-right { right: 10px; }

.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 1px rgba(2, 6, 23, .18);
  pointer-events: none;          /* 拖动统一交给 .compare 处理 */
}
.divider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(2, 6, 23, .34);
  border: 2px solid #fff;
}

/* ---- 状态栏 ---- */
.status-bar {
  margin: 0 0 16px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-height: 20px;
}
.status-bar.ok   { background: var(--ok-bg);   border-color: var(--ok-border);   color: var(--ok); }
.status-bar.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.status-bar.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

/* ---- 操作按钮 ---- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .06s ease, box-shadow .15s ease;
}
.btn:hover { border-color: #cfd8e3; background: #fbfdfc; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2f1; border-color: transparent; color: var(--text); }

.copy-hint {
  margin: -4px 0 14px;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.copy-hint.ok   { background: var(--ok-bg);   color: var(--ok);   border: 1px solid var(--ok-border); }
.copy-hint.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }

/* ---- 诚实使用声明 ---- */
.disclaimer {
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #713f12;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-sm);
}
.disclaimer strong { color: #92400e; }

/* ===== 页脚 ===== */
.footer {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.foot-line { margin: 0 0 10px; }
.foot-line strong { color: var(--text); }
.foot-links { margin: 0; padding-left: 18px; }
.foot-links li { margin-bottom: 4px; }
.footer a { color: var(--primary-dark); text-decoration: none; word-break: break-all; }
.footer a:hover { text-decoration: underline; }
.footer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #eef2f1;
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--text);
}

/* ===== 加载遮罩 ===== */
.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 249, .78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
/* 关键：hidden 属性必须能压过上面的 display:flex。
   作者样式 .loading{display:flex} 会盖过 UA 的 [hidden]{display:none}，
   否则加载遮罩会永久显示、盖住整页。这里显式让 hidden 生效。 */
.loading[hidden] { display: none; }
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 26px 34px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.loading-text { margin: 0; font-size: 14px; font-weight: 600; color: var(--primary-dark); }

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

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .app { padding: 24px 15px 44px; }
  .hero h1 { font-size: 23px; }
  .subtitle { font-size: 14px; }
  .dropzone { padding: 40px 16px; }
  .actions { gap: 8px; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .btn-ghost { flex-basis: 100%; }
}

/* ===== 深色模式（可选适配，保持可读）===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #131c2b;
    --text: #e6edf3;
    --muted: #93a1b3;
    --border: #263243;
    --primary-light: #0d2a20;
    --ok-bg: #0d2a20;
    --info-bg: #0c2431;
    --warn-bg: #2a2213;
    --shadow: 0 10px 30px rgba(0, 0, 0, .4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  }
  .dropzone:hover, .dropzone:focus-visible { background: #16202f; }
  .btn:hover { background: #16202f; border-color: #33445a; }
  .btn-ghost:hover { background: #1b2534; }
  .footer code, .disclaimer { color: #f0d9b5; }
  .disclaimer { color: #f3e2c7; }
  .compare {
    background-image:
      linear-gradient(45deg, #1a2534 25%, transparent 25%),
      linear-gradient(-45deg, #1a2534 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #1a2534 75%),
      linear-gradient(-45deg, transparent 75%, #1a2534 75%);
  }
}
