/* MarkClear Web — 纯静态，无构建步骤。设计对标 dewatermark.ai：浅色、留白、渐变点缀 */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #16181d;
  --ink-2: #5c6470;
  --ink-3: #9aa3af;
  --line: #e6e9ee;
  --brand: #2f6bff;
  --brand-2: #7a5cff;
  --brand-grad: linear-gradient(135deg, #2f6bff, #7a5cff);
  --danger: #e5484d;
  --ok: #30a46c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 24, 29, .05), 0 8px 24px rgba(22, 24, 29, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 20px; font-weight: 800; text-decoration: none; color: var(--ink);
  letter-spacing: -.02em;
}
.brand-drop { filter: drop-shadow(0 2px 6px rgba(47, 107, 255, .4)); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.quota-badge {
  background: var(--brand-grad); color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  cursor: pointer; user-select: none;
}

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  transition: all .15s ease; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary {
  background: var(--brand-grad); border: none; color: #fff;
  box-shadow: 0 4px 14px rgba(47, 107, 255, .32);
}
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.big { padding: 13px 28px; font-size: 16px; border-radius: 12px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  border: none; background: transparent; font-size: 18px; cursor: pointer;
  color: var(--ink-3); padding: 6px; border-radius: 8px;
}
.icon-btn:hover { color: var(--ink); background: var(--bg); }

/* ---------- 主区 ---------- */
main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.view { padding: 28px 0 56px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.page-head.center { justify-content: center; }
.back-btn { padding-left: 6px; }

/* ---------- 首页 Hero ---------- */
.hero { text-align: center; padding: clamp(28px, 6vw, 64px) 0 8px; }
.hero h1 {
  font-size: clamp(28px, 5vw, 44px); letter-spacing: -.03em; margin: 0 0 12px;
  background: linear-gradient(120deg, #16181d 30%, #2f6bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--ink-2); font-size: clamp(15px, 2vw, 18px); margin: 0 0 32px; }

.dropzone {
  max-width: 560px; margin: 0 auto;
  border: 2px dashed #c9d2e0; border-radius: 18px;
  background: var(--card);
  padding: clamp(28px, 5vw, 48px) 24px;
  cursor: pointer; text-align: center;
  transition: all .18s ease;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: var(--brand); background: #f5f8ff; transform: translateY(-1px);
}
.dropzone.dragover { box-shadow: var(--shadow); }
.dz-icon { width: 44px; height: 44px; color: var(--brand); }
.dz-main { font-size: 17px; font-weight: 700; margin: 12px 0 6px; }
.dz-hint { color: var(--ink-3); font-size: 13px; margin: 0; }
.free-hint { color: var(--ink-3); font-size: 13px; margin-top: 14px; }

/* ---------- 特性 / 步骤 ---------- */
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin-top: 48px;
}
.feature-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.feature-icon { font-size: 26px; }
.feature-card h3 { margin: 10px 0 6px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }

.steps { margin-top: 56px; text-align: center; }
.steps h2 { font-size: 22px; letter-spacing: -.01em; }
.steps-list {
  list-style: none; display: flex; justify-content: center; gap: clamp(20px, 5vw, 64px);
  padding: 0; margin: 24px 0 0; flex-wrap: wrap;
}
.steps-list li { display: flex; align-items: center; gap: 12px; }
.step-num {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 10px rgba(47, 107, 255, .3);
}
.steps-list p { margin: 0; color: var(--ink-2); font-weight: 500; }

/* ---------- 编辑器 ---------- */
.editor-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 14px;
}
.seg { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 3px; }
.seg-btn {
  border: none; background: transparent; font: inherit; font-size: 14px; font-weight: 600;
  padding: 7px 16px; border-radius: 8px; cursor: pointer; color: var(--ink-2);
}
.seg-btn.active { background: var(--card); color: var(--brand); box-shadow: 0 1px 4px rgba(22,24,29,.12); }
.brush-size { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.brush-size input[type="range"] { width: 110px; }
.toolbar-spacer { flex: 1; }

.canvas-wrap {
  position: relative; display: flex; justify-content: center;
  background:
    repeating-conic-gradient(#eef0f4 0% 25%, #fff 0% 50%) 0 0 / 22px 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; min-height: 200px; overflow: auto;
}
.canvas-inner { position: relative; display: inline-block; line-height: 0; }
#editImg { max-width: 100%; max-height: min(66vh, 640px); user-select: none; -webkit-user-drag: none; }
#editOverlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: crosshair; touch-action: none;
}
.editor-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 14px; flex-wrap: wrap;
}
.hint { color: var(--ink-3); font-size: 13px; margin: 0; }

/* ---------- 处理 ---------- */
.section-label { font-weight: 700; margin: 6px 0 12px; }
.quality-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.quality-card {
  position: relative; text-align: left; font: inherit;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: all .15s ease;
}
.quality-card:hover { border-color: #b9c8ff; }
.quality-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 255, .15); }
.quality-card.locked { opacity: .75; }
.q-head { display: flex; justify-content: space-between; align-items: center; }
.q-name { font-size: 17px; font-weight: 700; }
.q-credits {
  background: rgba(47, 107, 255, .1); color: var(--brand);
  font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.q-desc { color: var(--ink-2); font-size: 13.5px; margin: 8px 0 0; line-height: 1.5; }
.q-lock { display: block; margin-top: 10px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.quota-line { color: var(--ink-2); font-size: 14px; margin: 18px 0; }
#btnStart { display: block; margin: 0 auto; }

.proc-box { text-align: center; padding: 72px 0; }
.proc-status { font-size: 17px; font-weight: 700; margin: 22px 0 8px; }
.proc-box .hint { text-align: center; }

/* ---------- Spinner ---------- */
.spinner {
  width: 40px; height: 40px; margin: 0 auto;
  border: 3px solid #dde3ee; border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite; display: inline-block;
}
.spinner.mini { width: 14px; height: 14px; border-width: 2px; margin: 0 0 -2px 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- 结果 ---------- */
.compare {
  position: relative; max-width: 860px; margin: 0 auto;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  background: #20242b;
  user-select: none;
}
.compare img {
  display: block; width: 100%; pointer-events: none;
  max-height: min(70vh, 680px); object-fit: contain; margin: 0 auto;
}
#cmpBefore {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  clip-path: inset(0 50% 0 0);
}
.cmp-divider {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: #fff; box-shadow: 0 0 8px rgba(0, 0, 0, .5); pointer-events: none;
}
.cmp-divider::after {
  content: "⇔"; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; color: var(--ink);
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
}
.cmp-label {
  position: absolute; top: 12px; font-size: 12px; font-weight: 700;
  background: rgba(0, 0, 0, .55); color: #fff; padding: 4px 10px; border-radius: 999px;
  pointer-events: none;
}
.label-l { left: 12px; } .label-r { right: 12px; }
#cmpRange {
  position: absolute; left: 0; right: 0; bottom: 14px; width: calc(100% - 32px);
  margin: 0 16px; accent-color: var(--brand); cursor: ew-resize;
}
.result-actions {
  display: flex; justify-content: center; gap: 14px; margin-top: 22px; flex-wrap: wrap;
}

.fail-box { text-align: center; padding: 48px 0; }
.fail-msg { font-size: 17px; font-weight: 700; }
.refunded-note { color: var(--ok); font-size: 14px; }

/* ---------- 商店 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(22, 24, 29, .45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 480px;
  max-height: 88vh; overflow: auto; padding: 22px; box-shadow: 0 24px 64px rgba(22, 24, 29, .3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 20px; }
.store-quota {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg); border-radius: 10px; padding: 10px 14px;
  margin: 14px 0; color: var(--ink-2); font-size: 14px;
}
.store-quota b { font-size: 18px; color: var(--brand); }
.store-products { display: flex; flex-direction: column; gap: 10px; }
.pack {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.pack-info h4 { margin: 0 0 4px; font-size: 15px; }
.pack-info p { margin: 0; color: var(--ink-2); font-size: 12.5px; }
.pack-buy {
  flex-shrink: 0; background: var(--brand-grad); color: #fff; border: none;
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 9px 18px; border-radius: 10px; cursor: pointer;
}
.pack-buy:hover { filter: brightness(1.06); }
.pack-buy:disabled { opacity: .45; cursor: not-allowed; }
.pack-tag { font-size: 11px; font-weight: 700; color: #fff; background: var(--ok); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: 1px; }
.store-note { color: var(--ink-3); font-size: 12.5px; margin: 14px 2px 0; line-height: 1.5; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 200; max-width: min(90vw, 480px);
  background: var(--ink); color: #fff;
  font-size: 14px; line-height: 1.5;
  padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 12px 32px rgba(22, 24, 29, .35);
  animation: toast-in .22s ease;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 18px clamp(16px, 4vw, 40px); text-align: center;
}
.footer p { color: var(--ink-3); font-size: 12.5px; margin: 0; line-height: 1.6; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .editor-toolbar { gap: 8px; }
  .brush-size input[type="range"] { width: 84px; }
  .editor-footer { flex-direction: column; align-items: stretch; text-align: center; }
  .editor-footer .btn { justify-content: center; }
  .result-actions { flex-direction: column; align-items: stretch; }
  .quota-badge { font-size: 12px; padding: 5px 10px; }
}

/* ---- 账户弹窗（可选登录） ---- */
.account-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.account-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  box-sizing: border-box;
  background: #fff;
}
.account-form input:focus { outline: none; border-color: var(--brand); }
#acctEmailStep { display: flex; flex-direction: column; gap: 10px; }
.acct-code-row { display: flex; gap: 10px; }
.acct-code-row input { flex: 1; letter-spacing: 4px; text-align: center; font-size: 17px; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn.link {
  border: none; background: none; padding: 2px 0; color: var(--ink-3);
  font-size: 13px; cursor: pointer; align-self: flex-start;
}
.btn.link:hover { color: var(--brand); }
#accountLoggedIn { display: flex; flex-direction: column; gap: 12px; }
#accountLoggedIn .btn { align-self: flex-start; }
.acct-kv {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
}
.acct-kv span { color: var(--ink-3); font-size: 14px; }
.acct-kv b { font-size: 15px; word-break: break-all; text-align: right; }
