:root {
  --ink: #171a17;
  --muted: #61645f;
  --paper: #fffdf8;
  --cream: #f6f0e5;
  --yellow: #ffd84d;
  --mint: #dff3e8;
  --blue: #153f8f;
  --line: #cfc9bd;
  --shadow: 7px 7px 0 var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
.shell { width: min(1240px, calc(100% - 40px)); margin-inline: auto; }

.signature-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 64px;
  align-items: end;
  padding-block: 74px 48px;
}
.eyebrow, .maker-topbar small, .export-heading small, .toolbar-label > span, .export-preview > span {
  display: block;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.signature-hero h1 {
  max-width: 820px;
  margin: 12px 0 18px;
  font-size: clamp(48px, 7vw, 88px);
  line-height: .94;
  letter-spacing: -.065em;
}
.signature-hero .hero-copy > p {
  max-width: 760px;
  margin: 0;
  color: #474a46;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.55;
}
.hero-note {
  display: flex;
  gap: 15px;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--ink);
}
.hero-note-dot, .trust-dot {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin-top: 5px;
  background: #087c5b;
  border-radius: 50%;
}
.hero-note strong { font-size: 16px; }
.hero-note p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }

.maker-shell { padding-bottom: 72px; }
.trust-strip {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  min-height: 74px;
  padding: 15px 20px;
  border: 2px solid var(--ink);
  background: var(--mint);
}
.trust-strip > div { display: flex; gap: 13px; align-items: flex-start; }
.trust-strip p { margin: 0; line-height: 1.45; }
.version-note { white-space: nowrap; font-size: 13px; color: #4f5752; }
.maker-frame {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-top: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.maker-topbar {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
  padding: 23px 26px;
  border-bottom: 1px solid var(--line);
}
.maker-topbar > div, .export-heading { display: flex; align-items: center; gap: 13px; }
.step-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-weight: 900;
}
.maker-topbar h2, .export-heading h2 { margin: 2px 0 0; font-size: 23px; letter-spacing: -.025em; }
.maker-topbar p { max-width: 430px; margin: 0; color: var(--muted); text-align: right; }
.maker-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(335px, .7fr); }
.editor-column { min-width: 0; padding: 26px; border-right: 1px solid var(--line); }
.export-column { min-width: 0; padding: 26px; background: #f8f5ee; }

.mode-bar { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 24px; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; }
.mode-button {
  min-height: 50px;
  border: 0;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}
.mode-button + .mode-button { border-left: 2px solid var(--ink); }
.mode-button.is-active { background: var(--ink); color: #fff; }
.canvas-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 10px; }
.toolbar-label strong { display: block; margin-top: 3px; font-size: 14px; }
.history-actions { display: flex; gap: 7px; }
.history-actions button, .secondary-actions button, .confirm-dialog button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  font-weight: 750;
  cursor: pointer;
}
button:disabled { cursor: not-allowed; opacity: .42; }
.history-actions .danger-text { color: #a62f2b; }
.signature-surface {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 8 / 3;
  border: 2px solid var(--ink);
  border-radius: 15px;
  background-color: #fff;
  background-image: linear-gradient(45deg, #f4f4f0 25%, transparent 25%), linear-gradient(-45deg, #f4f4f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f4f4f0 75%), linear-gradient(-45deg, transparent 75%, #f4f4f0 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
#signatureCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.baseline { position: absolute; z-index: 0; left: 8%; right: 8%; bottom: 22%; border-bottom: 1px solid #aeb2ae; pointer-events: none; }
.empty-hint { position: absolute; z-index: 0; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; color: #8d918c; }
.empty-hint strong { font-family: Georgia, serif; font-size: clamp(27px, 4vw, 42px); font-weight: 500; font-style: italic; }
.empty-hint span { margin-top: 6px; font-size: 13px; }
.empty-hint.is-hidden { display: none; }

.control-panel { padding-top: 24px; }
.control-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.control-row label, .slider-field b, .switch-field b, .check-field b { font-weight: 800; }
.control-row > div:first-child span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.color-options { display: flex; gap: 9px; align-items: center; }
.color-dot, .custom-color {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid #fff;
  outline: 1px solid #aaa;
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
}
.color-dot.is-active { outline: 3px solid var(--ink); }
.custom-color { position: relative; overflow: hidden; background: conic-gradient(#f44,#ff0,#0c5,#0bf,#85f,#f44); font-weight: 900; }
.custom-color input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.custom-color span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; }
.slider-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; padding-top: 22px; }
.slider-field { display: block; }
.slider-field > span { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 11px; }
.slider-field output { color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--ink); cursor: pointer; }
.pen-preview { display: block; width: var(--pen-preview, 7px); height: var(--pen-preview, 7px); min-width: 3px; min-height: 3px; margin: 9px auto 0; background: var(--preview-color, #151816); border-radius: 50%; }
.switch-field, .check-field { display: flex; justify-content: space-between; gap: 16px; align-items: center; cursor: pointer; }
.switch-field small, .check-field small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.switch-field input { position: absolute; opacity: 0; pointer-events: none; }
.switch-field i { position: relative; flex: 0 0 auto; width: 48px; height: 28px; border: 2px solid var(--ink); border-radius: 20px; background: #ddd; }
.switch-field i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform .18s; }
.switch-field input:checked + i { background: var(--yellow); }
.switch-field input:checked + i::after { transform: translateX(20px); }
.mobile-tip { margin: 20px 0 0; color: var(--muted); font-size: 13px; }
.typed-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.typed-fields label > span, .style-picker legend, .option-group legend { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.typed-fields input[type="text"] { width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid var(--ink); border-radius: 10px; font-size: 17px; }
.style-picker, .option-group { min-width: 0; margin: 22px 0 0; padding: 0; border: 0; }
.style-picker > div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.style-choice { min-width: 0; padding: 12px 8px; border: 1px solid var(--line); border-radius: 11px; text-align: center; cursor: pointer; }
.style-choice.is-active { border: 2px solid var(--ink); background: #fff2c7; }
.style-choice input { position: absolute; opacity: 0; }
.style-choice span { display: block; overflow: hidden; font-family: var(--sample-font); font-size: 28px; line-height: 1.2; white-space: nowrap; }
.style-choice small { display: block; margin-top: 4px; color: var(--muted); }

.export-heading { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.export-preview { margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background-color: #fff; background-image: linear-gradient(45deg, #f0f0ed 25%, transparent 25%), linear-gradient(-45deg, #f0f0ed 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0ed 75%), linear-gradient(-45deg, transparent 75%, #f0f0ed 75%); background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0; }
.export-preview > span { margin-bottom: 8px; }
#exportPreview { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; background: transparent; }
.export-preview p { margin: 8px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented-control button, .small-segmented button {
  min-height: 52px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.segmented-control button.is-active, .small-segmented button.is-active { border: 2px solid var(--ink); background: #fff2c7; }
.segmented-control strong, .segmented-control span { display: block; }
.segmented-control span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.small-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.small-segmented button { min-height: 42px; }
.export-padding { margin-top: 22px; }
.check-field { margin-top: 20px; padding: 15px; border: 1px solid var(--line); background: #fff; }
.check-field input { width: 20px; height: 20px; accent-color: var(--ink); }
.check-field span { flex: 1; }
.download-button {
  width: 100%;
  min-height: 58px;
  margin-top: 22px;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}
.download-button:active:not(:disabled) { transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.status-message { min-height: 36px; margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; text-align: center; }
.status-message.is-error { color: #a62f2b; font-weight: 700; }
.boundary-note { margin-top: 16px; padding: 15px; border-left: 4px solid var(--blue); background: #eaf0ff; }
.boundary-note p { margin: 5px 0 0; color: #4b5261; font-size: 12px; line-height: 1.45; }

.how-section { padding: 72px 0; border-block: 1px solid var(--ink); background: #fff; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 30px; align-items: end; }
.section-heading .eyebrow { grid-column: 1 / -1; }
.section-heading h2 { max-width: 760px; margin: 10px 0 0; font-size: clamp(36px, 5vw, 62px); line-height: 1; letter-spacing: -.055em; }
.section-heading > p { max-width: 340px; margin: 0; color: var(--muted); font-size: 18px; }
.steps-list { margin: 46px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.steps-list li { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.steps-list li > span { font-size: 13px; font-weight: 900; letter-spacing: .1em; }
.steps-list h3 { margin: 0 0 6px; font-size: 22px; }
.steps-list p { max-width: 820px; margin: 0; color: var(--muted); line-height: 1.6; }
.faq-section { padding-block: 72px 90px; }
.faq-list { margin-top: 40px; border-top: 2px solid var(--ink); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { position: relative; padding: 20px 44px 20px 0; font-size: 18px; font-weight: 800; cursor: pointer; list-style: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 10px; font-size: 24px; font-weight: 500; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list p { max-width: 850px; margin: -5px 0 22px; color: var(--muted); line-height: 1.65; }
.related-tools { display: grid; grid-template-columns: 190px repeat(3, minmax(0, 1fr)); margin-top: 42px; border-block: 1px solid var(--ink); }
.related-tools > span, .related-tools a { padding: 18px 15px; }
.related-tools > span { padding-left: 0; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.related-tools a { border-left: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }
.related-tools a:hover { background: #fff2c7; }
.related-tools b { float: right; }

.confirm-dialog { width: min(430px, calc(100% - 32px)); padding: 25px; border: 2px solid var(--ink); border-radius: 16px; box-shadow: 7px 7px 0 var(--ink); }
.confirm-dialog::backdrop { background: rgb(0 0 0 / .52); }
.confirm-dialog h2 { margin: 0 0 8px; }
.confirm-dialog p { color: var(--muted); line-height: 1.5; }
.confirm-dialog > div { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.confirm-dialog .confirm-danger { background: #a62f2b; color: #fff; }

button:focus-visible, input:focus-visible, summary:focus-visible, .style-choice:focus-within, .custom-color:focus-within { outline: 3px solid #3777d6; outline-offset: 3px; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .signature-hero { grid-template-columns: 1fr; gap: 26px; padding-block: 52px 36px; }
  .hero-note { max-width: 660px; }
  .maker-grid { grid-template-columns: 1fr; }
  .editor-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .export-column { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
  .export-heading, .export-preview, .download-button, .secondary-actions, .status-message, .boundary-note { grid-column: 1 / -1; }
  .export-padding, .check-field { align-self: end; }
}

@media (max-width: 620px) {
  .maker-frame, .signature-surface, #signatureCanvas, .export-preview {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .typed-fields input[type="text"] {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
  }
  .shell { width: min(100% - 24px, 1240px); }
  .nav-links > a:not(.nav-pill) { display: none; }
  .signature-hero { padding-block: 38px 28px; }
  .signature-hero h1 { margin-top: 9px; font-size: clamp(42px, 14vw, 61px); }
  .signature-hero .hero-copy > p { font-size: 17px; }
  .hero-note { padding: 16px; }
  .trust-strip { display: block; padding: 15px; }
  .version-note { display: block; margin: 11px 0 0 26px; white-space: normal; }
  .maker-frame { box-shadow: 4px 4px 0 var(--ink); }
  .maker-topbar { display: block; padding: 18px 15px; }
  .maker-topbar p { margin: 12px 0 0 51px; text-align: left; font-size: 13px; }
  .editor-column, .export-column { padding: 16px 14px; }
  .mode-button { min-height: 48px; font-size: 14px; }
  .canvas-toolbar { align-items: start; }
  .toolbar-label > span { font-size: 10px; }
  .history-actions { gap: 4px; }
  .history-actions button { min-width: 44px; min-height: 44px; padding: 7px 9px; font-size: 12px; }
  .signature-surface { aspect-ratio: 2.05 / 1; border-radius: 12px; }
  .control-row { align-items: flex-start; }
  .control-row > div:first-child span { max-width: 180px; }
  .color-options { flex-wrap: wrap; justify-content: flex-end; }
  .color-dot, .custom-color { width: 34px; height: 34px; }
  .slider-grid, .typed-fields { grid-template-columns: 1fr; }
  .style-picker > div { grid-template-columns: 1fr 1fr; }
  .style-choice { min-height: 77px; }
  .export-column { display: block; }
  .export-preview { margin-top: 18px; }
  .segmented-control button, .small-segmented button { min-height: 48px; }
  .secondary-actions button { min-height: 46px; }
  .how-section, .faq-section { padding-block: 54px; }
  .section-heading { display: block; }
  .section-heading h2 { font-size: 40px; }
  .section-heading > p { margin-top: 15px; font-size: 16px; }
  .steps-list li { grid-template-columns: 44px minmax(0,1fr); gap: 10px; }
  .faq-list summary { font-size: 16px; }
  .related-tools { grid-template-columns: 1fr; }
  .related-tools > span { padding-left: 10px; }
  .related-tools a { border-top: 1px solid var(--line); border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
