/* ==========================================================================
   老照片修复 — 设计系统
   取色来自"档案纸/老相册"：暖纸底、墨色字、单一铁锈红强调色。
   ========================================================================== */

:root {
  --bg: #f3efe7;
  --surface: #fffdf9;
  --surface-2: #efe9dd;
  --ink: #1e1a15;
  --muted: #6d6355;
  --line: #dcd3c3;
  --line-strong: #c8bda9;
  --accent: #9c4a2f;
  --accent-ink: #fffdf9;
  --accent-soft: #f2e3da;
  --ok: #2f6b46;
  --danger: #a8321f;
  --shadow: 0 1px 2px rgba(40, 28, 18, 0.05), 0 8px 24px -12px rgba(40, 28, 18, 0.25);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120f;
    --surface: #1d1913;
    --surface-2: #262019;
    --ink: #f0e9dc;
    --muted: #a89a86;
    --line: #342c23;
    --line-strong: #4a4034;
    --accent: #d9835f;
    --accent-ink: #1a130f;
    --accent-soft: #2e211a;
    --ok: #6fbf8f;
    --danger: #e07a63;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120f;
  --surface: #1d1913;
  --surface-2: #262019;
  --ink: #f0e9dc;
  --muted: #a89a86;
  --line: #342c23;
  --line-strong: #4a4034;
  --accent: #d9835f;
  --accent-ink: #1a130f;
  --accent-soft: #2e211a;
  --ok: #6fbf8f;
  --danger: #e07a63;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.wrap { max-width: 1120px; margin: 0 auto; }
.narrow { max-width: 760px; margin: 0 auto; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; }

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 14px;
}

/* ---------- 顶栏 ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
}
.head-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-block: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex: none;
}
img.brand-mark { background: none; display: block; }
  font-size: 15px;
  flex: none;
}
.head-nav { display: flex; gap: 22px; margin-left: auto; font-size: 14px; }
.head-nav a { color: var(--muted); text-decoration: none; }
.head-nav a:hover { color: var(--ink); }
.head-actions { display: flex; align-items: center; gap: 10px; }

.lang-btn {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
}
.lang-btn:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { padding: 7px 16px; font-size: 13.5px; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.ghost:hover { background: var(--surface-2); }
.btn:focus-visible, .lang-btn:focus-visible, .cmp-range:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- 首屏 ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding-block: 72px 80px;
}
.hero h1 {
  font-size: clamp(34px, 5.2vw, 54px);
  letter-spacing: -0.035em;
  margin-bottom: 20px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}
.lede {
  font-size: 17px;
  color: var(--muted);
  max-width: 44ch;
  margin-bottom: 26px;
}
.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.trust li {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trust li::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}

/* ---------- 上传卡片 ---------- */

.uploader {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
}
.uploader-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.uploader-title { font-size: 15px; font-weight: 700; }
.uploader-hint { font-size: 12.5px; color: var(--muted); }

.drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon {
  width: 40px; height: 40px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--accent);
}
.drop-main { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.drop-sub { font-size: 12.5px; color: var(--muted); }

.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.turnstile { margin-top: 14px; display: flex; justify-content: center; }
.turnstile[hidden] { display: none; }
.opt {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}
.opt:hover { border-color: var(--line-strong); }
.opt input { accent-color: var(--accent); margin: 0; width: 14px; height: 14px; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.beta {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-2);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--muted);
}

/* ---------- 进度 ---------- */

.steps { display: grid; gap: 10px; margin: 4px 0 16px; }
.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}
.step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex: none;
  color: var(--muted);
}
.step-row.active { color: var(--ink); font-weight: 600; }
.step-row.active .step-dot { border-color: var(--accent); color: var(--accent); }
.step-row.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-row.done { color: var(--muted); }
.step-row .eta { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.progress-note { font-size: 12.5px; color: var(--muted); }
.progress-note b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 对比滑块 ---------- */

.cmp {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  touch-action: pan-y;
  user-select: none;
}
.cmp img { display: block; width: 100%; height: auto; pointer-events: none; }
.cmp-before { position: absolute; inset: 0; clip-path: inset(0 50% 0 0); }
.cmp-tag {
  position: absolute;
  top: 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(20, 14, 8, 0.55);
  backdrop-filter: blur(4px);
  padding: 3px 9px;
  border-radius: 999px;
  pointer-events: none;
}
.cmp-tag.left { left: 10px; }
.cmp-tag.right { right: 10px; background: color-mix(in srgb, var(--accent) 88%, #000); }
.cmp-line {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}
.cmp-handle {
  position: absolute;
  top: 50%; left: 50%;
  width: 34px; height: 34px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
  color: #1e1a15;
  font-size: 12px;
  letter-spacing: -2px;
}
.cmp-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.cmp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 40px; height: 100%; }
.cmp-range::-moz-range-thumb { width: 40px; height: 100%; border: none; background: transparent; }

/* ---------- 结果 ---------- */

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.result-meta { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.share-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.share-input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 10px;
}

.err {
  color: var(--danger);
  font-size: 13.5px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  margin-top: 12px;
  white-space: pre-wrap;
}

/* ---------- 结果页 ---------- */

.result-page {
  grid-template-columns: 1fr;
  max-width: 820px;
  margin: 0 auto;
  padding-block: 56px 40px;
}
.result-page h1 { font-size: clamp(28px, 4.4vw, 42px); margin-bottom: 24px; }
.result-page .uploader { box-shadow: none; }

/* ---------- 买断成功页 ---------- */

section.buy-page { display: grid; gap: 18px; justify-items: start; padding-block: 64px 80px; border-top: 0; }
.buy-page h1 { font-size: clamp(28px, 4.4vw, 40px); }
.buy-page .lede { max-width: 56ch; }
.license-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}
.license-box code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px;
  letter-spacing: 0.06em;
  color: var(--accent);
  word-break: break-all;
}

/* ---------- 通用区块 ---------- */

section.block { padding-block: 76px; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 32px; }
.section-head h2 { font-size: clamp(24px, 3.4vw, 32px); margin-bottom: 10px; }
.section-head p { color: var(--muted); max-width: 56ch; font-size: 15.5px; }

.samples { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.sample { margin: 0; }
.sample figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.sample figcaption b { color: var(--ink); font-size: 13.5px; }
.badge {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.badge.hot { border-color: var(--accent); color: var(--accent); }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.how-item .n {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 10px;
}
.how-item h3 { font-size: 17px; margin-bottom: 8px; }
.how-item p { font-size: 14.5px; color: var(--muted); }

.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.plan {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.plan.pro { border-color: var(--accent); }
.plan-name { font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.plan.pro .plan-name { color: var(--accent); }
.plan-price { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; margin-bottom: 6px; }
.plan-price small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.plan-note { font-size: 13.5px; color: var(--muted); margin-bottom: 20px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 9px; font-size: 14px; }
.plan li { display: flex; gap: 9px; align-items: flex-start; }
.plan li::before { content: "✓"; color: var(--ok); font-weight: 700; flex: none; }
.plan li.off { color: var(--muted); }
.plan li.off::before { content: "—"; color: var(--line-strong); }

.faq { display: grid; gap: 2px; }
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 16px 2px;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--muted); font-size: 14.5px; margin-top: 10px; max-width: 68ch; }

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 28px 40px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: baseline;
}

.hidden, [hidden] { display: none !important; }

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-block: 44px 56px; }
  .head-nav { display: none; }
  .samples { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr; gap: 22px; }
  .price-grid { grid-template-columns: 1fr; }
  section.block { padding-block: 52px; }
}
@media (max-width: 520px) {
  body { font-size: 15.5px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .head-inner { gap: 12px; }
  .brand span:not(.brand-mark) { display: none; }
  .uploader { padding: 16px; }
  .drop { padding: 26px 14px; }
  .result-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
