/* ============================================================
   SignMaker.top — 手绘签名生成器样式
   设计主题：墨水蓝 + 纸张质感，干净、专业、无干扰
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --ink: #17203a;            /* 主文字：深墨 */
  --ink-soft: #55617e;       /* 次要文字 */
  --brand: #1e40af;          /* 品牌主色：圆珠笔蓝 */
  --brand-strong: #1d4ed8;
  --brand-soft: #e8effc;     /* 品牌浅色底 */
  --paper: #f6f4ee;          /* 页面纸色底 */
  --card: #ffffff;
  --line: #e4e7f0;           /* 卡片边线 */
  --ok: #0f766e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 32, 58, .05), 0 8px 24px rgba(23, 32, 58, .07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.02em;
}

.brand em {
  font-style: normal;
  color: var(--brand);
  font-weight: 600;
}

.brand-icon { border-radius: 8px; flex: none; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}

.site-nav a:hover { color: var(--brand); }

.lang-select {
  font: inherit;
  font-size: 13.5px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  max-width: 128px;
}

/* ---------- 首屏 ---------- */
.hero {
  text-align: center;
  padding: 46px 0 26px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.6vw, 42px);
  line-height: 1.18;
  letter-spacing: -.03em;
  font-weight: 800;
}

.hero-sub {
  margin: 0 auto;
  max-width: 720px;
  color: var(--ink-soft);
  font-size: clamp(15px, 2vw, 17px);
}

/* ---------- 模式切换 ---------- */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 24px;
  flex-wrap: wrap;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  transition: all .18s ease;
}

.mode-tab:hover { border-color: var(--brand); color: var(--brand); }

.mode-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(30, 64, 175, .28);
}

/* ---------- 工具区布局 ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 44px;
}

.tool-left { display: grid; gap: 16px; }

.panel-card, .preview-card, .pdf-upload-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-card { padding: 18px 20px; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 15.5px;
  font-weight: 700;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 800;
  flex: none;
}

/* ---------- 表单控件 ---------- */
.field { margin-bottom: 14px; }

.field label, .range-row label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.text-input, .select-input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s;
}

.text-input:focus, .select-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, .12);
}

.field-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.range-row label { margin: 0; white-space: nowrap; }

.range-input {
  flex: 1;
  accent-color: var(--brand);
  height: 4px;
  cursor: pointer;
}

.range-val {
  min-width: 44px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

/* ---------- 墨色选择 ---------- */
.swatch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ink-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 2px solid transparent;
  outline-offset: 2px;
  cursor: pointer;
  padding: 0;
  transition: transform .15s, outline-color .15s;
}

.ink-swatch:hover { transform: scale(1.1); }

.ink-swatch.active { outline-color: var(--brand); }

.ink-custom {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px dashed #c3cbdd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 18px;
  cursor: pointer;
  overflow: hidden;
}

.ink-custom input[type="color"] {
  position: absolute;
  inset: -6px;
  width: 46px;
  height: 46px;
  border: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  border-radius: 11px;
  padding: 12px 20px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .16s ease;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(30, 64, 175, .26);
}

.btn-primary:not(:disabled):hover { background: var(--brand-strong); transform: translateY(-1px); }

.btn-outline {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-outline:not(:disabled):hover { border-color: var(--brand); color: var(--brand); }

.btn-ghost {
  background: transparent;
  color: var(--brand);
  padding: 12px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* ---------- 签名画布区 ---------- */
.preview-card {
  position: relative;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sig-stage {
  position: relative;
  border: 1.5px dashed #cfd6e6;
  border-radius: 12px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    #fff;
  overflow: hidden;
  min-height: 300px;
}

.sig-canvas {
  display: block;
  width: 100%;
  height: 340px;
  touch-action: none;
  cursor: crosshair;
  position: relative;
  z-index: 2;
}

.type-canvas { cursor: default; }

/* 签名基线（纸张横线 + 签名 X 提示） */
.sig-baseline {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 72px;
  border-bottom: 2px solid #e8ebf4;
  z-index: 1;
  pointer-events: none;
}

.sig-baseline::before {
  content: "✕";
  position: absolute;
  left: -4px;
  top: -22px;
  color: #c9d2e8;
  font-size: 15px;
}

.sig-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #94a3b8;
  text-align: center;
  padding: 0 24px;
  pointer-events: none;
  z-index: 1;
}

.sig-placeholder p { margin: 0; font-size: 14.5px; }

.preview-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ok);
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 4px 12px;
}

.download-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.download-row .btn { flex: 1; min-width: 110px; }
.download-row .btn-ghost { flex: 0 0 auto; }

/* ---------- 字体宫格 ---------- */
.font-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.font-card {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.font-card:hover { border-color: var(--brand); }

.font-card.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, .1);
}

.font-preview {
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-name {
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: .02em;
}

/* ---------- PDF 上传 ---------- */
.pdf-upload-card { padding: 22px; margin-bottom: 44px; }

.pdf-drop {
  border: 2px dashed #c3cbdd;
  border-radius: 12px;
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
}

.pdf-drop:hover, .pdf-drop.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.pdf-drop-icon { margin-bottom: 8px; }

.pdf-drop-text { font-size: 16px; font-weight: 700; }

.pdf-drop-sub { font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }

/* ---------- PDF 编辑器 ---------- */
.pdf-editor { margin-bottom: 44px; }

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pdf-page-info {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 58px;
  text-align: center;
}

.pdf-toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
}

.pdf-file-name {
  font-size: 13.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.pdf-stage-wrap { display: flex; justify-content: center; }

.pdf-stage {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  /* 不设 overflow:hidden，否则签名边缘的删除按钮/缩放手柄会被裁剪 */
  max-width: 100%;
}

#pdfCanvas { display: block; max-width: 100%; height: auto; border-radius: 9px; }

.pdf-overlay {
  position: absolute;
  inset: 0;
}

/* 已放置的签名（可拖动/缩放） */
.pdf-sig {
  position: absolute;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.pdf-sig img { width: 100%; height: auto; display: block; pointer-events: none; }

.pdf-sig.selected { outline: 2px solid var(--brand); outline-offset: 2px; }

.pdf-sig .sig-handle {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  border: 2.5px solid #fff;
  cursor: nwse-resize;
  display: none;
}

.pdf-sig .sig-remove {
  position: absolute;
  top: -11px;
  right: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  border: 2px solid #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pdf-sig.selected .sig-handle,
.pdf-sig.selected .sig-remove { display: flex; }

.pdf-place-hint { text-align: center; }

.pdf-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pdf-width-row { flex: 1; min-width: 220px; margin: 0; }

/* ---------- 内容区 ---------- */
.content-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 34px;
  margin-bottom: 22px;
}

.content-section h2 {
  margin: 0 0 14px;
  font-size: 23px;
  letter-spacing: -.02em;
}

.content-section p { color: var(--ink-soft); margin: 0 0 12px; }
.content-section p:last-child { margin-bottom: 0; }

.howto-list {
  margin: 0;
  padding-left: 22px;
  color: var(--ink-soft);
}

.howto-list li { margin-bottom: 10px; }
.howto-list li::marker { color: var(--brand); font-weight: 800; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.feature-item h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
  color: var(--ink);
}

.feature-item h3::before {
  content: "✒";
  color: var(--brand);
  margin-right: 7px;
}

.feature-item p { margin: 0; font-size: 14px; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 10px; }

.faq-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  position: relative;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand);
  font-size: 20px;
  font-weight: 400;
}

.faq-item[open] summary::after { content: "–"; }

.faq-item p {
  padding: 0 18px 16px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  margin-top: 44px;
  padding: 30px 0 36px;
}

.footer-inner { text-align: center; }

.footer-inner p { margin: 0 0 10px; color: var(--ink-soft); font-size: 14px; }

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.footer-nav a {
  color: var(--brand);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.footer-nav a:hover { text-decoration: underline; }

.disclaimer { font-size: 12.5px !important; color: #98a2bb !important; max-width: 640px; margin: 0 auto !important; }

/* ---------- Toast ---------- */
.copied-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(23, 32, 58, .3);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 100;
}

.copied-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 静态页（隐私/关于/联系） ---------- */
.page-body { background: var(--paper); }

.page-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px;
  margin: 36px 0 44px;
}

.page-card h1 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: -.02em;
}

.page-card .page-updated {
  color: #98a2bb;
  font-size: 13px;
  margin-bottom: 22px;
}

.page-card h2 {
  font-size: 19px;
  margin: 26px 0 8px;
}

.page-card p, .page-card li {
  color: var(--ink-soft);
  font-size: 15px;
}

.page-card ul { padding-left: 22px; }

.page-card a { color: var(--brand); }

.contact-mail {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--brand-soft);
  border: 1px solid #c7d8f8;
  color: var(--brand);
  font-weight: 700;
  border-radius: 11px;
  padding: 12px 20px;
  text-decoration: none;
  margin: 6px 0;
}

.contact-mail:hover { background: #dbe7fb; }

/* ---------- 响应式 ---------- */
@media (max-width: 920px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-left { order: 2; }
  .preview-card { order: 1; }
  .content-section { padding: 24px 22px; }
  .page-card { padding: 26px 22px; }
}

@media (max-width: 560px) {
  .hero { padding: 32px 0 20px; }
  .mode-tab { padding: 9px 16px; font-size: 14px; }
  .sig-canvas { height: 260px; }
  .site-nav { gap: 12px; }
  .site-nav a { font-size: 13.5px; }
  .download-row .btn { min-width: 90px; }
  .content-section h2 { font-size: 20px; }
  .pdf-actions { flex-direction: column; align-items: stretch; }
}
