/* ============================================================
   牛油果去水印 — 主题:白 + 渐变牛油果绿
   ============================================================ */
:root {
  --white: #ffffff;
  --paper: #f6faee;
  --ink: #2b3320;
  --ink-soft: #5f6b4d;
  --ink-faint: #8a967a;

  --avo-50:  #f1f7e3;
  --avo-100: #e0efc8;
  --avo-200: #c6dd9c;
  --avo-300: #a8c66c;
  --avo-400: #8bad4e;
  --avo-500: #6f9c3e;
  --avo-600: #56792c;
  --avo-700: #3f5c1f;
  --pit: #b9873e;

  --grad-avo: linear-gradient(135deg, #d7e8b4 0%, #8bad4e 52%, #56792c 100%);
  --grad-soft: linear-gradient(135deg, #f4f9ea 0%, #e6f1cf 100%);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 10px rgba(63, 92, 31, 0.08);
  --shadow-md: 0 14px 40px rgba(63, 92, 31, 0.14);
  --shadow-lg: 0 26px 70px rgba(63, 92, 31, 0.20);
  --ring: 0 0 0 4px rgba(139, 173, 78, 0.25);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* 保证 hidden 属性不被 .editor/.result-actions 等 display 规则覆盖 */
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--white);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 背景装饰:两团柔和牛油果光晕 */
.bg-decor {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 12% -8%, rgba(168, 198, 108, 0.28), transparent 60%),
    radial-gradient(50vw 50vw at 108% 10%, rgba(111, 156, 62, 0.18), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #fbfdf6 100%);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px clamp(16px, 4vw, 44px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid rgba(139, 173, 78, 0.18);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 13px; background: var(--grad-soft);
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text span { font-size: 12px; color: var(--ink-soft); }
.header-tags { display: flex; gap: 8px; }
.tag {
  font-size: 12px; color: var(--avo-700);
  background: var(--avo-50); border: 1px solid var(--avo-100);
  padding: 4px 10px; border-radius: 999px;
}

/* ---------- Layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 28px) 40px; }

/* ---------- Uploader ---------- */
.uploader { text-align: center; }
.hero-title {
  font-size: clamp(26px, 4.4vw, 42px); margin: 12px 0 8px; letter-spacing: .5px;
  background: linear-gradient(120deg, var(--avo-700), var(--avo-400));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--ink-soft); max-width: 640px; margin: 0 auto 28px; font-size: 16px; }

.dropzone {
  position: relative; max-width: 720px; margin: 0 auto;
  background: var(--white); border: 2.5px dashed var(--avo-200);
  border-radius: 26px; padding: clamp(32px, 6vw, 60px) 24px;
  box-shadow: var(--shadow-md); cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.dropzone:hover, .dropzone:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--avo-400); outline: none; }
.dropzone.dragover {
  border-color: var(--avo-500); border-style: solid;
  background: var(--grad-soft); transform: translateY(-4px) scale(1.005);
  box-shadow: var(--shadow-lg), var(--ring);
}
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.dz-icon {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  color: var(--avo-600); background: var(--grad-soft); margin-bottom: 6px;
  box-shadow: inset 0 0 0 1px rgba(139,173,78,.25);
}
.dz-title { font-size: 20px; font-weight: 700; margin: 4px 0 2px; }
.dz-hint { color: var(--ink-soft); font-size: 14px; margin: 0 0 8px; }
.dz-hint kbd {
  background: var(--avo-50); border: 1px solid var(--avo-200); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 7px; font-size: 12px; color: var(--avo-700);
}
.dropzone .btn { pointer-events: auto; }
.sample-link { display: inline-block; margin: 16px auto 0; color: var(--avo-600); }
.sample-link:hover { color: var(--avo-700); text-decoration: underline; }

.feature-row {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px;
  padding: 0; margin: 30px auto 0; max-width: 760px;
}
.feature-row li {
  display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft);
  background: rgba(255,255,255,.7); border: 1px solid var(--avo-100);
  padding: 10px 16px; border-radius: 999px;
}
.feature-row .fi { font-size: 16px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: none;
  border-radius: 12px; padding: 12px 20px; transition: transform .12s ease, box-shadow .2s ease, background .2s ease, filter .2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; background: var(--grad-avo); box-shadow: 0 8px 20px rgba(86,121,44,.28); }
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 12px 26px rgba(86,121,44,.34); }
.btn-primary:disabled { filter: grayscale(.5) brightness(1.05); opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--white); color: var(--avo-700); border: 1.5px solid var(--avo-200); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--avo-400); background: var(--avo-50); }
.btn-text { background: transparent; color: var(--ink-soft); padding: 8px; }
.btn-text:hover { color: var(--avo-600); }
.btn-block { width: 100%; padding: 14px; font-size: 16px; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.stage-col { min-width: 0; }
.side-col { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }

.stage-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--white); border: 1px solid var(--avo-100); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow-sm); margin-bottom: 12px;
}
.seg { display: inline-flex; background: var(--avo-50); border-radius: 10px; padding: 3px; gap: 3px; }
.seg-btn { border: none; background: transparent; padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink-soft); font-weight: 600; }
.seg-btn.active { background: #fff; color: var(--avo-700); box-shadow: var(--shadow-sm); }
.brush-size { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.brush-size input[type=range] { accent-color: var(--avo-500); width: 110px; }

.stage {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background:
    linear-gradient(45deg, #eef3e5 25%, transparent 25%) -12px 0/24px 24px,
    linear-gradient(-45deg, #eef3e5 25%, transparent 25%) -12px 0/24px 24px,
    linear-gradient(45deg, transparent 75%, #eef3e5 75%) -12px 0/24px 24px,
    linear-gradient(-45deg, transparent 75%, #eef3e5 75%) -12px 0/24px 24px,
    #f9fbf4;
  box-shadow: var(--shadow-md); display: grid; place-items: center; min-height: 240px;
}
.stage .layer { display: block; max-width: 100%; height: auto; grid-area: 1 / 1; }
.mask-layer { cursor: crosshair; touch-action: none; }
.result-layer { z-index: 3; pointer-events: none; }  /* 纯展示层,事件穿透到下方掩膜层以便去除后继续编辑 */
.compare-handle {
  position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.9);
  box-shadow: 0 0 0 1px rgba(86,121,44,.4); z-index: 4; transform: translateX(-1px); cursor: ew-resize;
}
.compare-handle span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-md);
  display: grid; place-items: center;
}
.compare-handle span::before { content: "⟺"; color: var(--avo-600); font-size: 15px; }

.stage-busy {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; gap: 10px;
  background: rgba(249, 251, 244, 0.78); backdrop-filter: blur(2px); color: var(--avo-700); font-weight: 600;
}
.stage-busy p { margin: 0; }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--avo-100); border-top-color: var(--avo-500);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.stage-tip { color: var(--ink-soft); font-size: 13px; margin: 10px 2px 0; }

/* ---------- Result card ---------- */
.card { background: var(--white); border: 1px solid var(--avo-100); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.result-card { padding: 16px; overflow: hidden; }
.result-card::before {
  content: ""; display: block; height: 4px; margin: -16px -16px 14px; background: var(--grad-avo);
}
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rc-label { font-size: 12px; letter-spacing: 1px; color: var(--ink-faint); text-transform: uppercase; }
.rc-badge {
  font-size: 12px; font-weight: 700; color: var(--avo-700);
  background: var(--avo-50); border: 1px solid var(--avo-100); border-radius: 999px; padding: 3px 10px;
}
.rc-badge.warn { color: #8a6d1f; background: #fbf3dd; border-color: #f0e4bf; }
.rc-source { font-size: 20px; font-weight: 800; color: var(--ink); margin-bottom: 10px; }
.rc-meter { height: 8px; border-radius: 999px; background: var(--avo-50); overflow: hidden; }
.rc-meter-fill { height: 100%; width: 0%; background: var(--grad-avo); border-radius: 999px; transition: width .5s ease; }
.rc-evidence { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 12px; color: var(--avo-700); background: var(--avo-50);
  border: 1px solid var(--avo-100); border-radius: 8px; padding: 4px 9px;
}
.chip.c2pa { color: var(--pit); background: #fbf1e0; border-color: #f0e0c4; }
.rc-candidates { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.cand-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-soft); }
.cand-row b { color: var(--ink); font-weight: 600; }
.cand-pct { color: var(--avo-600); font-variant-numeric: tabular-nums; }

.result-actions { display: flex; flex-direction: column; gap: 10px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.disclaimer { font-size: 11.5px; color: var(--ink-faint); line-height: 1.55; margin: 6px 2px 0; }

/* ---------- Footer ---------- */
.site-footer { text-align: center; color: var(--ink-faint); font-size: 13px; padding: 26px 16px 34px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #8a2f2f; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .side-col { position: static; }
  .header-tags { display: none; }
}
@media (max-width: 480px) {
  .stage-toolbar { gap: 8px; }
  .brush-size input[type=range] { width: 80px; }
}
