:root {
  --ink: #13233f;
  --brand: #16345e;
  --accent: #2f6fed;
  --accent-soft: #e8f0ff;
  --teal: #0e9f8a;
  --bg: #f2f5fa;
  --card: #ffffff;
  --line: #e3e8f1;
  --muted: #6d7a8c;
  --danger: #c0392b;
  --shadow-sm: 0 2px 10px rgba(19, 35, 63, .06);
  --shadow-md: 0 12px 34px rgba(19, 35, 63, .10);
  --shadow-lg: 0 24px 60px rgba(19, 35, 63, .16);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 420px at 8% -10%, #e4edff 0%, rgba(228, 237, 255, 0) 62%),
    radial-gradient(760px 380px at 100% 0%, #e6f7f3 0%, rgba(230, 247, 243, 0) 58%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(227, 232, 241, .8);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 34px; height: 34px; }
.brand-text { font-size: 17px; font-weight: 800; letter-spacing: .2px; color: var(--brand); }
.brand-text em { font-style: normal; color: var(--accent); margin-left: 2px; }
.site-nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 28px); font-size: 13.5px; color: #40506a; }
.site-nav a { padding: 6px 2px; border-bottom: 2px solid transparent; transition: color .18s, border-color .18s; }
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tip-link {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  color: inherit;
  padding: 6px 2px;
  cursor: pointer;
  transition: color .18s, border-color .18s;
}
.tip-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tip-pop {
  position: fixed;
  top: 64px;
  right: max(16px, 4vw);
  z-index: 80;
  width: 238px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.tip-pop img { display: block; width: 210px; max-width: 100%; margin: 0 auto 8px; border-radius: 8px; }
.tip-pop p { font-size: 11.5px; line-height: 1.7; color: var(--muted); }

/* ---------- 首页 ---------- */
.hero {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 92px) clamp(18px, 4vw, 32px) 12px;
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: clamp(30px, 5vw, 64px);
  align-items: center;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #e9fbf6;
  color: #087c6c;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 18px;
}
.hero-tag::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(14, 159, 138, .14);
}
.hero h1 {
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.12;
  letter-spacing: -1px;
  font-weight: 900;
  color: var(--ink);
}
.hero h1 span {
  background: linear-gradient(96deg, var(--accent), #11a89a 72%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { margin-top: 18px; max-width: 470px; color: #56657c; font-size: 15px; line-height: 1.85; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; list-style: none; }
.hero-badges li {
  font-size: 12px;
  color: #38506f;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: var(--shadow-sm);
}

.uploader { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.drop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 224px;
  padding: 26px 18px;
  border-radius: var(--radius);
  border: 1.6px dashed #c6d3e6;
  background: rgba(255, 255, 255, .86);
  cursor: pointer;
  text-align: center;
  transition: transform .18s, border-color .18s, box-shadow .18s, background .18s;
  box-shadow: var(--shadow-sm);
}
.drop-card:hover, .drop-card.dragover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: #f7faff;
  box-shadow: var(--shadow-md);
}
.drop-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(140deg, #2f6fed, #16345e);
  box-shadow: 0 10px 22px rgba(47, 111, 237, .28);
}
#stampDrop .drop-icon { background: linear-gradient(140deg, #0e9f8a, #0b6f61); box-shadow: 0 10px 22px rgba(14, 159, 138, .26); }
.drop-card strong { font-size: 15.5px; color: var(--ink); }
.drop-card small { font-size: 12px; color: var(--muted); line-height: 1.6; }
.file-chip {
  margin-top: 4px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #1e4fae;
  font-size: 11.5px;
  word-break: break-all;
}
.stamp-chip { max-width: 96px; max-height: 62px; object-fit: contain; margin-top: 2px; }

.steps {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
  color: var(--muted);
}
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.step b {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 11px;
  box-shadow: var(--shadow-sm);
}
.steps i { font-style: normal; color: #b7c2d3; }

/* ---------- 编辑器 ---------- */
.workspace {
  flex: 1;
  display: flex;
  gap: 16px;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 18px clamp(10px, 2.4vw, 26px) 120px;
  align-items: flex-start;
}
.page-rail {
  position: sticky;
  top: 78px;
  width: 132px;
  flex: none;
  max-height: calc(100vh - 100px);
  overflow: auto;
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.rail-head { font-size: 11px; font-weight: 800; color: #8b98ab; padding: 2px 4px 8px; letter-spacing: .5px; }
.rail-list { display: flex; flex-direction: column; gap: 8px; }
.rail-item {
  position: relative;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #f4f6fa;
  transition: border-color .16s, transform .16s;
}
.rail-item:hover { transform: translateY(-1px); }
.rail-item.active { border-color: var(--accent); }
.rail-item img { display: block; width: 100%; }
.rail-item span {
  position: absolute; right: 4px; bottom: 4px;
  background: rgba(15, 28, 51, .66);
  color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 4px;
}

.stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
}
.pdf-page {
  position: relative;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 18px 44px rgba(19, 35, 63, .16);
  outline: 2px solid transparent;
  outline-offset: 6px;
  transition: outline-color .18s;
}
.pdf-page.active { outline-color: rgba(47, 111, 237, .55); }
.page-badge {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: #5b687c;
  background: rgba(255, 255, 255, .92);
  border: 1px solid #e3e8f1;
  border-radius: 999px;
  padding: 2px 10px;
  box-shadow: 0 1px 5px rgba(19, 35, 63, .1);
  white-space: nowrap;
  letter-spacing: .3px;
}
.canvas-wrap { position: relative; line-height: 0; }
.canvas-wrap .bg-canvas { display: block; width: 100%; height: 100%; }
.canvas-wrap .canvas-container { position: absolute !important; left: 0; top: 0; }

/* fabirc 控件配色 */
.canvas-container { z-index: 2; }

/* ---------- 底部工具栏 ---------- */
.toolbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: calc(100vw - 24px);
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(170%) blur(16px);
  -webkit-backdrop-filter: saturate(170%) blur(16px);
  border: 1px solid rgba(227, 232, 241, .9);
  box-shadow: var(--shadow-lg);
}
.tb-ranges { display: flex; gap: 16px; }
.tb-range { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: #5b687c; white-space: nowrap; }
.tb-range b { color: var(--brand); font-size: 12.5px; }
.tb-range input[type="range"] { width: 118px; accent-color: var(--accent); }
.tb-actions { display: flex; gap: 8px; flex-wrap: nowrap; }
.tb-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #2c3b52;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s, background .15s, border-color .15s, color .15s;
}
.tb-btn:hover { transform: translateY(-1px); border-color: #c4d1e6; }
.tb-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 18px rgba(47, 111, 237, .28); }
.tb-btn.primary:hover { background: #2560d8; }
.tb-btn.danger { color: var(--danger); border-color: #f0d3cf; background: #fff7f6; }
.tb-btn.danger:hover { background: #fdeeec; }
.tb-btn.ghost { color: #6b7789; }
.tb-btn.export {
  background: linear-gradient(135deg, #0f9f8a, #0b7a69);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 22px rgba(14, 159, 138, .3);
}
.tb-btn.export:hover { filter: brightness(1.04); }
.tb-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- 教程 / 场景 / FAQ ---------- */
.page-extra { width: 100%; }
.guide,
.scenes {
  width: min(880px, calc(100% - 36px));
  margin: 26px auto 0;
  padding: clamp(20px, 3vw, 30px);
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.guide h2,
.scenes h2 { font-size: 20px; margin-bottom: 12px; color: var(--ink); }
.guide p { font-size: 13.5px; line-height: 1.9; color: #5b687c; }
.guide-list { margin: 14px 0; padding-left: 20px; }
.guide-list li { font-size: 13.5px; line-height: 1.9; color: #5b687c; margin-bottom: 8px; }
.guide-list strong { color: #2c3b52; }
.scene-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 4px; }
.scene-card { padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.scene-card h3 { font-size: 13.5px; color: #2c3b52; margin-bottom: 6px; }
.scene-card p { font-size: 12.5px; line-height: 1.8; color: #5b687c; }

/* ---------- FAQ / footer ---------- */
.faq {
  width: min(880px, calc(100% - 36px));
  margin: 26px auto 40px;
}
.faq h2 { font-size: 20px; margin-bottom: 12px; color: var(--ink); }
.faq details {
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
}
.faq summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: #2c3b52; }
.faq details p { margin-top: 9px; font-size: 13px; line-height: 1.8; color: #5b687c; }

.site-footer {
  margin-top: auto;
  padding: 20px 16px 26px;
  text-align: center;
  font-size: 12px;
  color: #62708a;
}
.site-footer a:hover { color: var(--accent); }

/* ---------- 提示 / 遮罩 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 76px;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(22, 36, 58, .94);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-width: calc(100vw - 32px);
}
.busy {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(15, 26, 44, .55);
  color: #fff;
  font-size: 14px;
  backdrop-filter: blur(3px);
}
.spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(255, 255, 255, .28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 移动端 ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 30px; gap: 28px; }
  .hero-sub { max-width: none; }
  .uploader { gap: 10px; }
  .drop-card { min-height: 168px; padding: 18px 12px; }
  .drop-icon { width: 46px; height: 46px; border-radius: 13px; }
  .page-rail { display: none; }
  .workspace { padding: 12px 8px 132px; }
  .toolbar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    transform: none;
    max-width: none;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }
  .tb-ranges { width: 100%; justify-content: space-between; gap: 10px; }
  .tb-range { flex: 1; }
  .tb-range input[type="range"] { width: 100%; }
  .tb-actions { flex: 1; overflow-x: auto; padding-bottom: 2px; }
  .tb-right { width: 100%; }
  .tb-btn.export { width: 100%; }
  .site-nav { gap: 12px; font-size: 12.5px; }
  .tip-pop { top: 60px; right: 12px; width: 224px; }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 31px; }
  .uploader { grid-template-columns: 1fr; }
  .drop-card { min-height: 132px; flex-direction: row; justify-content: flex-start; text-align: left; gap: 14px; }
  .drop-card small { display: none; }
  .stamp-chip { margin-left: auto; }
  .site-nav a:nth-child(1) { display: none; }
  .scene-grid { grid-template-columns: 1fr; }
}
