@font-face {
  font-family: Caveat;
  src: url("../fonts/Caveat.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: GreatVibes;
  src: url("../fonts/GreatVibes.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: DancingScript;
  src: url("../fonts/DancingScript.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: AlexBrush;
  src: url("../fonts/AlexBrush.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: HomemadeApple;
  src: url("../fonts/HomemadeApple.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Kalam;
  src: url("../fonts/Kalam.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Sacramento;
  src: url("../fonts/Sacramento.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Satisfy;
  src: url("../fonts/Satisfy.woff2") format("woff2");
  font-display: swap;
}
:root {
  --ink: #172c44;
  --muted: #56616b;
  --accent: #a94428;
  --line: #dfded7;
  --paper: #fffefb;
  --canvas: #eeede7;
  --soft: #f7f5ef;
  --blue: #1a3fb5;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button,
.file-button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 550;
  line-height: 1.3;
}
button:hover {
  background: #f0eee7;
  border-color: #b7b8b2;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #2d70b9;
  outline-offset: 3px;
}
input,
select {
  border: 1px solid #c5c8c6;
  border-radius: 6px;
  padding: 9px 10px;
  max-width: 100%;
  background: white;
  color: var(--ink);
}
input[type="color"] {
  width: 50px;
  height: 38px;
  padding: 3px;
}
input[type="range"] {
  padding: 0;
  width: 100%;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.check-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 13px;
}
.primary {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
}
.primary:hover {
  background: #29445e;
  color: white;
}
.quiet {
  border: 0;
  background: transparent;
}
.wide {
  width: 100%;
  margin: 6px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 25px;
  letter-spacing: -1px;
  font-weight: 750;
}
.local {
  font-size: 8px;
  letter-spacing: 1.4px;
  margin-left: 9px;
  font-weight: 600;
  color: var(--muted);
}
.muted,
small {
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  font-size: 17px;
}
p {
  line-height: 1.65;
}
.skip {
  position: fixed;
  top: -80px;
  z-index: 1000;
  background: white;
  padding: 12px;
}
.skip:focus {
  top: 5px;
}
[hidden] {
  display: none !important;
}
.editor-header {
  height: 76px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.file-title {
  flex: 1;
  min-width: 0;
  margin-left: 20px;
}
.file-title strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.file-title small {
  font-size: 11px;
}
.editor-layout {
  display: flex;
  height: calc(100dvh - 111px);
  min-height: 460px;
}
.tools {
  width: 240px;
  flex-shrink: 0;
  padding: 24px 20px;
  overflow: auto;
  border-right: 1px solid var(--line);
}
.tray-heading h1 {
  font:
    26px Georgia,
    serif;
  letter-spacing: -0.6px;
  margin-bottom: 10px;
}
.tray-heading p {
  font-size: 12px;
  color: var(--muted);
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 16px 0 28px;
}
.tool-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 21px;
  padding: 11px 4px;
}
.tool-grid span {
  font-size: 10px;
}
.tools h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.privacy-note {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 24px;
}
.more-tools {
  margin-top: 20px;
}
.more-tools summary {
  cursor: pointer;
  font-size: 12px;
  margin-bottom: 12px;
}
.more-tools button {
  font-size: 12px;
}
.tag {
  font: 8px system-ui;
  letter-spacing: 0.7px;
  color: var(--accent);
  background: #f9e8df;
  border-radius: 3px;
  padding: 3px 5px;
  vertical-align: middle;
}
.document-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}
.document-toolbar {
  height: 53px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: #f7f6f0;
  font-size: 11px;
  gap: 8px;
}
.document-toolbar button {
  font-size: 11px;
  padding: 7px 10px;
}
.document-toolbar label {
  flex-direction: row;
  align-items: center;
  font-size: 11px;
}
.document-toolbar select {
  padding: 6px;
}
.page-layout {
  flex: 1;
  min-height: 0;
  display: flex;
}
#page-scroll {
  overflow: auto;
  flex: 1;
  min-width: 0;
  position: relative;
  padding: 24px;
  scroll-behavior: smooth;
}
#thumbnails {
  width: 124px;
  flex-shrink: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 14px 8px;
}
#thumbnails:empty {
  display: none;
}
.thumbnail {
  padding: 5px;
  background: transparent;
  border: 1px solid transparent;
  width: 105px;
  margin-bottom: 12px;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.thumbnail canvas {
  max-width: 92px;
  height: auto;
  box-shadow: 0 1px 4px #0002;
}
.thumbnail span {
  font-size: 10px;
  margin-top: 5px;
}
.pdf-page {
  position: relative;
  background: white;
  margin: 0 auto 24px;
  box-shadow: 0 2px 12px #172c4415;
  overflow: hidden;
  touch-action: pan-y;
}
.page-canvas {
  display: block;
}
.page-overlay {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
}
.placed-item {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  transform-origin: top left;
  cursor: grab;
  touch-action: none;
  border-radius: 0;
  outline: 1px solid transparent;
  overflow: visible;
}
.placed-item:hover {
  background: transparent;
  outline: 1px dashed #4577aa;
}
.placed-item.selected {
  outline: 1.5px solid #3776b4;
}
.placed-item canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.resize-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1px solid #3776b4;
  background: white;
  border-radius: 2px;
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
  padding: 0;
  touch-action: none;
}
.field-snap {
  position: absolute;
  background: #e2edfa55;
  border: 1px dashed #3d7ab199;
  color: #255c88;
  overflow: hidden;
  font-size: 10px;
  padding: 2px;
  border-radius: 2px;
}
.field-snap:hover {
  background: #c5dcf299;
}
#welcome {
  max-width: 570px;
  margin: 65px auto;
  text-align: center;
  border: 1px dashed #bec1bb;
  padding: 50px 35px;
  border-radius: 14px;
  background: #f8f7f2;
}
#welcome h2 {
  font:
    42px/1.1 Georgia,
    serif;
  letter-spacing: -1.5px;
  margin: 18px 0;
}
#welcome p {
  color: var(--muted);
  max-width: 340px;
  margin: 0 auto 24px;
}
#welcome small {
  display: block;
  margin: 22px auto 0;
  font-size: 11px;
}
#welcome .quiet {
  display: block;
  margin: 12px auto 0;
}
.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 2px;
  color: var(--accent);
}
.file-button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
}
.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  cursor: pointer;
}
#inspector {
  width: 218px;
  padding: 20px 16px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--paper);
}
#inspector label {
  margin-bottom: 13px;
}
#inspector h2 {
  font:
    20px Georgia,
    serif;
  margin-bottom: 20px;
}
.two-fields {
  display: flex;
  gap: 8px;
}
.two-fields > * {
  flex: 1;
  min-width: 0;
}
.rotation-buttons {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.rotation-buttons button {
  font-size: 10px;
  padding: 7px;
  flex: 1;
}
.danger {
  color: #a53027;
}
#inspector .muted {
  font-size: 11px;
}
.editor-footer {
  height: 35px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  font-size: 10px;
  color: var(--muted);
}
.editor-footer span {
  flex: 1;
}
#message:not(:empty) {
  position: fixed;
  z-index: 100;
  bottom: 45px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  background: #172c44;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 5px 25px #0002;
  font-size: 13px;
}
#message.error {
  background: #9b3028;
}
#busy {
  position: fixed;
  top: 76px;
  left: 0;
  right: 0;
  z-index: 90;
  background: #fff8e8;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
#busy progress {
  height: 5px;
  width: 150px;
  accent-color: var(--accent);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  width: min(620px, calc(100vw - 28px));
  max-height: 90dvh;
  overflow: auto;
  color: var(--ink);
  box-shadow: 0 20px 100px #0003;
}
dialog::backdrop {
  background: #172c4470;
  backdrop-filter: blur(3px);
}
.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 14px;
}
.dialog-top h2 {
  font:
    27px Georgia,
    serif;
  letter-spacing: -0.6px;
  margin: 0;
}
.dialog-top button {
  font-size: 22px;
  border: 0;
  background: transparent;
  padding: 4px 8px;
}
.tabs {
  display: flex;
  gap: 4px;
  background: var(--soft);
  border-radius: 9px;
  padding: 4px;
  margin-bottom: 22px;
}
.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 13px;
}
.tabs [aria-selected="true"] {
  background: white;
  box-shadow: 0 1px 4px #0001;
}
.font-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
  max-height: 280px;
  overflow: auto;
}
.font-choice {
  min-width: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  height: 90px;
  background: var(--soft);
}
.font-choice.active {
  border: 2px solid var(--accent);
  background: #fff8ed;
}
.font-choice .signature-sample {
  font-size: 29px;
  overflow: hidden;
  max-width: 100%;
  white-space: nowrap;
}
.font-choice small {
  font: 9px system-ui;
  letter-spacing: 0.3px;
}
.font-choice .tag {
  position: absolute;
  right: 5px;
  top: 5px;
}
#pad {
  display: block;
  width: 100%;
  height: 200px;
  border: 1px dashed #b3b9be;
  background: linear-gradient(
    transparent 73%,
    #d8dce0 73%,
    #d8dce0 73.5%,
    transparent 73.5%
  );
  border-radius: 8px;
  touch-action: none;
}
.pad-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.pad-controls label {
  flex: 1;
}
.pad-controls button {
  font-size: 11px;
}
.signature-bottom {
  display: flex;
  gap: 8px;
  align-items: end;
  margin: 16px 0;
}
.signature-bottom label {
  margin-right: 8px;
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #000 !important;
  padding: 0;
  border: 3px solid white;
  box-shadow: 0 0 0 1px var(--line);
  margin-bottom: 4px;
}
.swatch.blue {
  background: #1a3fb5 !important;
}
.dialog-note {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin: 10px 0 0;
}
.inline-error,
#license-error {
  color: #a53027;
  font-size: 12px;
  margin: 12px 0;
}
.image-preview {
  height: 160px;
  margin: 16px 0;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 0/16px 16px;
}
.image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.price-options {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 22px 0;
}
.saved-signature {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin: 8px 0;
  overflow: hidden;
}
.saved-signature > button:first-child {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  padding: 10px;
  font-size: 12px;
}
.saved-signature img {
  max-width: 130px;
  max-height: 35px;
  display: block;
}
.saved-signature .saved-preview {
  display: block;
  font-size: 26px;
}
.saved-signature > button:last-child {
  border: 0;
  padding: 9px;
}
.upload-label {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
#text-dialog label {
  margin-bottom: 16px;
}
@media (max-width: 1100px) {
  .local {
    display: none;
  }
  .tools {
    width: 200px;
    padding: 20px 14px;
  }
  #thumbnails {
    width: 95px;
  }
  .thumbnail {
    width: 76px;
  }
  .thumbnail canvas {
    max-width: 66px;
  }
  .file-title {
    margin-left: 0;
  }
  #inspector {
    width: 190px;
  }
  .editor-header {
    padding: 12px 16px;
    gap: 10px;
  }
}
@media (max-width: 760px) {
  .editor-header {
    height: auto;
    min-height: 68px;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .brand {
    font-size: 21px;
  }
  .brand img {
    width: 25px;
    height: 25px;
  }
  .file-title {
    flex: 1;
  }
  .file-title strong {
    max-width: 145px;
    font-size: 11px;
  }
  .file-title small {
    font-size: 9px;
  }
  #license-open {
    font-size: 11px;
    padding: 6px;
  }
  #new-file {
    font-size: 11px;
    padding: 6px;
  }
  #download {
    flex: 1;
    font-size: 12px;
    padding: 10px;
  }
  .editor-layout {
    height: calc(100dvh - 139px);
    min-height: 480px;
    flex-direction: column;
  }
  .tools {
    width: 100%;
    height: 62px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    flex-shrink: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .tray-heading,
  .tools h2,
  .privacy-note {
    display: none;
  }
  .tools > .primary {
    white-space: nowrap;
    width: auto;
    font-size: 12px;
    margin: 0;
    padding: 10px;
  }
  .tool-grid {
    display: flex;
    gap: 5px;
    margin: 0;
  }
  .tool-grid button {
    font-size: 16px;
    padding: 4px 10px;
    min-width: 52px;
  }
  .tool-grid span {
    font-size: 9px;
  }
  #saved {
    display: flex;
    gap: 4px;
  }
  .saved-signature {
    min-width: 125px;
    margin: 0;
  }
  .saved-signature .saved-preview {
    font-size: 15px;
  }
  .tools .more-tools {
    margin: 0;
    min-width: 100px;
  }
  .tools .more-tools[open] {
    position: fixed;
    z-index: 80;
    top: 130px;
    right: 8px;
    background: white;
    padding: 18px;
    border: 1px solid var(--line);
    box-shadow: 0 8px 30px #0002;
  }
  .document-toolbar {
    height: 47px;
    padding: 7px 8px;
    gap: 4px;
  }
  .document-toolbar button {
    font-size: 10px;
    padding: 6px;
  }
  .document-toolbar label {
    font-size: 0;
  }
  .document-toolbar select {
    font-size: 11px;
  }
  #thumbnails {
    display: none;
  }
  #page-scroll {
    padding: 12px;
  }
  #welcome {
    margin: 28px auto;
    padding: 28px 18px;
  }
  #welcome h2 {
    font-size: 34px;
  }
  #inspector {
    position: fixed;
    right: 8px;
    bottom: 40px;
    width: 240px;
    max-height: 46dvh;
    z-index: 70;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 40px #0002;
    padding: 14px;
  }
  #inspector label {
    margin-bottom: 9px;
  }
  #inspector h2 {
    font-size: 17px;
    margin-bottom: 10px;
  }
  .editor-footer {
    padding: 0 12px;
    height: 30px;
    font-size: 9px;
  }
  dialog {
    padding: 20px;
  }
  .dialog-top h2 {
    font-size: 24px;
  }
  .font-choice {
    height: 80px;
  }
  .font-choice .signature-sample {
    font-size: 24px;
  }
  #busy {
    top: 0;
  }
  #message:not(:empty) {
    bottom: 10px;
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

.resize-handle.nw {
  left: -6px;
  top: -6px;
  right: auto;
  bottom: auto;
  cursor: nwse-resize;
}
.resize-handle.ne {
  right: -6px;
  top: -6px;
  bottom: auto;
  cursor: nesw-resize;
}
.resize-handle.sw {
  left: -6px;
  bottom: -6px;
  right: auto;
  cursor: nesw-resize;
}
.document-workspace {
  min-height: 0;
}
@media (max-width: 760px) {
  body.editor {
    height: 100dvh;
    overflow: hidden;
  }
  .editor-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    height: 110px;
    min-height: 110px;
    gap: 6px 8px;
  }
  .editor-header .brand {
    grid-row: 1;
    grid-column: 1;
  }
  .file-title {
    grid-row: 2;
    grid-column: 1 / 3;
    overflow: hidden;
  }
  .file-title strong {
    max-width: none;
  }
  .file-title small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #license-open {
    grid-row: 1;
    grid-column: 2;
  }
  #new-file {
    grid-row: 1;
    grid-column: 3;
  }
  #download {
    grid-row: 2;
    grid-column: 3;
    max-width: 140px;
    white-space: nowrap;
    font-size: 10px;
  }
  .editor-layout {
    height: calc(100dvh - 140px);
    min-height: 0;
  }
  #deselect {
    position: sticky;
    bottom: 0;
    background: var(--paper);
    width: 100%;
  }
}
.placement-ghost {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  pointer-events: none;
  z-index: 8;
  outline: 1px dashed var(--blue);
  outline-offset: 3px;
}
.placement-ghost canvas {
  display: block;
  pointer-events: none;
}

.signature-warning {
  margin: 0;
  padding: 10px 20px;
  color: #713a17;
  background: #fff0da;
  border-bottom: 1px solid #e4bc85;
  font-size: 13px;
  line-height: 1.5;
}
body:has(.signature-warning:not([hidden])) .editor-layout {
  height: calc(100dvh - 180px);
}
@media (max-width: 600px) {
  body:has(.signature-warning:not([hidden])) .editor-layout {
    height: calc(100dvh - 250px);
  }
}

.font-choice:disabled { opacity: .55; cursor: not-allowed; }
.font-coverage { color: #8d3025; min-height: 1em; }
#text-error { color: #8d3025; }

@media (max-width: 600px) {
  .tools { height: 148px; flex-wrap: wrap; align-content: flex-start; overflow-y: auto; overflow-x: hidden; }
  .tools > .primary { flex: 1 0 100%; }
  .tool-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
  .tool-grid button { min-width: 0; }
  #saved:empty, #saved:has(> .muted:only-child) { display: none; }
}
