:root {
  --ink: #182033;
  --muted: #657087;
  --soft: #eef1f7;
  --surface: #ffffff;
  --paper: #fffefa;
  --blue: #3d5afe;
  --blue-dark: #2739bb;
  --blue-soft: #e9edff;
  --coral: #ff6b5f;
  --green: #2d9d78;
  --line: #dce1eb;
  --danger: #c94141;
  --shadow: 0 24px 60px rgba(26, 36, 64, .12);
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(61, 90, 254, .09), transparent 27rem),
    radial-gradient(circle at 92% 38%, rgba(255, 107, 95, .07), transparent 29rem),
    #f5f6f9;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 11px 16px;
  border-radius: 10px;
  color: #fff;
  background: var(--blue-dark);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(1480px, calc(100% - 48px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.12rem;
  font-weight: 500;
  letter-spacing: -.03em;
}
.wordmark b { font-weight: 800; }
.wordmark-icon {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(61, 90, 254, .25);
}
.wordmark-icon svg { width: 21px; height: 21px; }
.printer-state {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  background: rgba(255,255,255,.75);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}
.printer-state > span { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.printer-state.is-online > span { background: var(--green); box-shadow: 0 0 0 4px rgba(45, 157, 120, .14); }

main { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 86px; }
.intro {
  max-width: 1280px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .7fr);
  align-items: end;
  gap: clamp(40px, 8vw, 130px);
}
.eyebrow {
  margin: 0 0 17px;
  color: var(--blue);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .15em;
}
.intro h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 6.2rem);
  font-weight: 820;
  line-height: .91;
  letter-spacing: -.085em;
}
.intro h1 span { color: var(--blue); }
.intro-copy { padding-bottom: 9px; }
.intro-copy > p {
  margin: 0;
  color: #505b70;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.65;
}
.feature-pills { margin-top: 25px; display: flex; flex-wrap: wrap; gap: 8px; }
.feature-pills span {
  padding: 8px 12px;
  border: 1px solid #d7ddeb;
  border-radius: 999px;
  color: #4e5b73;
  background: rgba(255,255,255,.65);
  font-size: .72rem;
  font-weight: 700;
}

.notice {
  max-width: 1100px;
  margin: 36px 0 0;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 12px 34px rgba(27, 37, 61, .06);
}
.notice-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  font-weight: 850;
}
.notice-error .notice-icon { background: var(--danger); }
.notice-warning .notice-icon { background: var(--coral); }
.notice strong { display: block; font-size: .92rem; }
.notice p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }

.workspace {
  margin-top: 54px;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(470px, 1.1fr);
  align-items: start;
  gap: clamp(24px, 3vw, 44px);
}
.composer,
.preview-wrap {
  min-width: 0;
  border: 1px solid rgba(211, 217, 229, .82);
  border-radius: 26px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
}
.composer { padding: clamp(24px, 3.2vw, 44px); }
.composer-heading {
  margin-bottom: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.composer-heading p { margin: 0 0 7px; color: var(--blue); font-size: .66rem; font-weight: 800; letter-spacing: .15em; }
.composer-heading h2 { margin: 0; font-size: clamp(1.65rem, 2.7vw, 2.25rem); line-height: 1.05; letter-spacing: -.045em; }
.composer-heading > span { margin-top: 3px; color: var(--muted); font-size: .69rem; font-weight: 700; white-space: nowrap; }

.field { margin-top: 18px; display: grid; gap: 8px; }
.field > span { display: flex; justify-content: space-between; gap: 12px; color: #374258; font-size: .75rem; font-weight: 750; }
.field small { color: #8a93a5; font-size: .68rem; font-weight: 500; }
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fbfcfe;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.field textarea { min-height: 190px; resize: vertical; line-height: 1.55; }
.field input::placeholder,
.field textarea::placeholder { color: #9ca4b4; }
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(61, 90, 254, .11); }
.field input:disabled,
.field textarea:disabled,
.field select:disabled { cursor: not-allowed; opacity: .58; background: #f0f1f4; }
.field-row { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(145px, .55fr); gap: 15px; }

.image-tools {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #d6dcff;
  border-radius: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  background: linear-gradient(145deg, #f4f6ff, #fbfcff);
}
.image-tools-copy { display: flex; align-items: center; gap: 12px; }
.tool-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
}
.tool-icon svg { width: 21px; height: 21px; }
.image-tools h3 { margin: 0; font-size: .9rem; letter-spacing: -.01em; }
.image-tools-copy p { margin: 4px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.secondary-button {
  border: 1px solid #cfd6ea;
  border-radius: 10px;
  padding: 10px 13px;
  color: var(--blue-dark);
  background: #fff;
  font-size: .72rem;
  font-weight: 750;
  cursor: pointer;
}
.secondary-button:hover { border-color: var(--blue); box-shadow: 0 5px 16px rgba(61,90,254,.1); }
.secondary-button:focus-visible { outline: 3px solid rgba(61,90,254,.25); outline-offset: 2px; }
.secondary-button:disabled { cursor: not-allowed; opacity: .5; }
.image-selection {
  grid-column: 1 / -1;
  padding: 11px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #4c5870;
  background: #fff;
  font-size: .72rem;
}
.image-selection button { border: 0; padding: 4px; color: var(--danger); background: none; font-size: .69rem; font-weight: 750; cursor: pointer; }
.image-limits { grid-column: 1 / -1; margin: -5px 0 0; color: #798398; font-size: .66rem; line-height: 1.45; }

.acknowledge {
  margin-top: 22px;
  padding: 15px;
  border-radius: 13px;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 11px;
  color: #4d586e;
  background: var(--soft);
  cursor: pointer;
}
.acknowledge input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--blue); }
.acknowledge span { font-size: .72rem; line-height: 1.52; }
.form-footer {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 22px;
}
.form-footer p { margin: 0; color: var(--muted); font-size: .67rem; line-height: 1.5; }
.print-button {
  min-width: 188px;
  min-height: 50px;
  border: 0;
  border-radius: 13px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  cursor: pointer;
  box-shadow: 0 12px 25px rgba(61, 90, 254, .24);
  transition: transform .16s, box-shadow .16s;
}
.print-button span { font-size: .76rem; font-weight: 800; }
.print-button svg { width: 20px; height: 20px; }
.print-button:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(61, 90, 254, .31); }
.print-button:focus-visible { outline: 3px solid rgba(61,90,254,.28); outline-offset: 3px; }
.print-button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.form-status { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; color: #9d3030; background: #ffeded; font-size: .76rem; line-height: 1.45; }
.trap { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

.preview-wrap {
  position: sticky;
  top: 24px;
  padding: clamp(22px, 3vw, 38px);
  background: linear-gradient(155deg, #e8ebf3, #dfe4ef);
  overflow: hidden;
}
.preview-wrap::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  top: -110px;
  right: -75px;
  border-radius: 50%;
  background: rgba(61,90,254,.09);
  pointer-events: none;
}
.preview-label {
  position: relative;
  z-index: 1;
  max-width: 610px;
  margin: 0 auto 13px;
  display: flex;
  justify-content: space-between;
  color: #566177;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .11em;
}
.paper {
  position: relative;
  width: min(100%, 610px);
  aspect-ratio: 8.5 / 11;
  margin: 0 auto;
  padding: 6% 8.75%;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 55px rgba(28, 37, 58, .2), 0 2px 5px rgba(28, 37, 58, .1);
  outline: 3px solid transparent;
  outline-offset: -3px;
  transition: outline-color .16s, box-shadow .16s, transform .16s;
  touch-action: none;
}
.paper:focus-visible { outline-color: var(--blue); }
.paper.is-dragover {
  outline-color: var(--blue);
  box-shadow: 0 32px 70px rgba(61,90,254,.25);
  transform: translateY(-2px);
}
.paper.is-overflowing { outline-color: var(--danger); }
.paper-copy { position: relative; z-index: 2; pointer-events: none; }
.paper-copy > p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.paper .is-placeholder { color: #a9afba; }
.paper[data-size="large"] #previewMessage { font-size: clamp(.9rem, 1.55vw, 1.36rem); line-height: 1.5; }
.paper[data-size="standard"] #previewMessage { font-size: clamp(.75rem, 1.22vw, 1.06rem); line-height: 1.52; }
.paper[data-size="compact"] #previewMessage { font-size: clamp(.65rem, .98vw, .85rem); line-height: 1.5; }
.paper .paper-signature { margin-top: 1.2em; font-style: italic; }
.image-layer { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.placed-image {
  position: absolute;
  min-width: 38px;
  min-height: 38px;
  border: 2px solid transparent;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}
.placed-image:active { cursor: grabbing; }
.placed-image.is-selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 8px 25px rgba(28,37,58,.18); }
.placed-image img { width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 17px;
  height: 17px;
  border: 3px solid #fff;
  border-radius: 50%;
  display: none;
  background: var(--blue);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  cursor: nwse-resize;
}
.placed-image.is-selected .resize-handle { display: block; }
.paper-drop-hint {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 52%;
  width: 180px;
  padding: 18px;
  border: 2px dashed rgba(61,90,254,.45);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  color: var(--blue);
  background: rgba(243,245,255,.92);
  font-size: .72rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.96);
  transition: opacity .16s, transform .16s;
}
.paper-drop-hint svg { width: 27px; height: 27px; }
.paper.is-dragover .paper-drop-hint { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.preview-note { max-width: 610px; margin: 17px auto 0; color: #626d82; font-size: .68rem; line-height: 1.5; }

.site-footer {
  min-height: 92px;
  padding: 26px max(24px, calc((100vw - 1480px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #dfe4f1;
  background: #192238;
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .08em;
}
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 1080px) {
  .intro { grid-template-columns: 1fr; gap: 28px; }
  .intro-copy { max-width: 700px; }
  .workspace { grid-template-columns: 1fr; }
  .preview-wrap { position: static; }
}

@media (max-width: 650px) {
  .site-header,
  main { width: min(100% - 28px, 1480px); }
  .site-header { min-height: 72px; }
  .wordmark-icon { width: 35px; height: 35px; }
  .printer-state { padding: 8px 10px; font-size: .61rem; }
  main { padding-top: 40px; padding-bottom: 56px; }
  .intro h1 { font-size: clamp(3rem, 15vw, 4.6rem); }
  .intro-copy > p { font-size: .97rem; }
  .workspace { margin-top: 36px; gap: 18px; }
  .composer,
  .preview-wrap { border-radius: 19px; }
  .composer,
  .preview-wrap { padding: 21px 16px; }
  .composer-heading { display: block; }
  .composer-heading > span { margin-top: 11px; display: block; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .image-tools { grid-template-columns: 1fr; }
  .secondary-button { width: 100%; }
  .form-footer { grid-template-columns: 1fr; }
  .print-button { width: 100%; }
  .paper[data-size="large"] #previewMessage { font-size: clamp(.7rem, 3.25vw, .96rem); }
  .paper[data-size="standard"] #previewMessage { font-size: clamp(.61rem, 2.75vw, .82rem); }
  .paper[data-size="compact"] #previewMessage { font-size: clamp(.54rem, 2.35vw, .7rem); }
  .site-footer { align-items: flex-start; flex-direction: column; }
}

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