:root {
  --brand: #4f67ff;
  --brand-dark: #3a49f0;
  --border: #e2e8f0;
  --muted: #475569;
  --text: #0f172a;
  --paper: #ffffff;
  --soft: #f8fafc;
  --flyer-red: #c31712;
  --flyer-dark-red: #9f0e0b;
  --flyer-ink: #080808;
  --flyer-yellow: #ffe200;
  --nav-contact: #8a4313;
  --nav-contact-dark: #73360f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  background: #ffffff;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.wrap {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
}

.site-logo {
  display: block;
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  height: auto;
}

.menu {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 6px;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.menu .btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.menu .btn {
  background: var(--nav-contact);
}

.btn:hover {
  color: #ffffff;
  background: var(--brand-dark);
  text-decoration: none;
}

.menu .btn:hover {
  background: var(--nav-contact-dark);
}

.btn-ghost {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text);
}

.btn-ghost:hover {
  background: #f8fafc;
  color: var(--text);
}

.compact-btn {
  min-height: 38px;
  padding: 0 14px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
}

.tool-hero {
  padding: 54px 0 42px;
  background:
    radial-gradient(circle at top left, rgba(195, 23, 18, 0.12), transparent 34rem),
    linear-gradient(180deg, #fff7f7, #ffffff 74%);
}

.tool-hero-grid {
  display: grid;
  gap: 24px;
  align-items: center;
}

.tool-kicker {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
}

.tool-hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.tool-hero p {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.tool-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.tool-hero-note {
  padding: 24px;
  border: 1px solid #fecaca;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 54px rgba(127, 29, 29, 0.08);
}

.tool-hero-note h2,
.preview-panel-header h2,
.control-card h2,
.seo-card h2 {
  margin: 0 0 8px;
  line-height: 1.1;
}

.muted {
  color: var(--muted);
}

.small-copy {
  margin-bottom: 0;
  font-size: 14px;
}

.generator-section {
  padding: 32px 0 42px;
}

.generator-layout {
  display: grid;
  gap: 24px;
  align-items: start;
}

.generator-controls {
  display: grid;
  gap: 16px;
}

.control-card,
.preview-panel,
.seo-card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

.control-card {
  padding: 22px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

label,
fieldset {
  min-width: 0;
}

label > span,
legend {
  display: block;
  margin-bottom: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.photo-position-controls {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  background: #f8fafc;
}

.photo-position-controls[hidden] {
  display: none;
}

.photo-position-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-position-header strong {
  font-size: 0.95rem;
}

.photo-position-controls .field-hint {
  margin: 0;
}

.photo-position-controls label {
  display: grid;
  gap: 8px;
}

.photo-position-controls input[type="range"] {
  min-height: 32px;
  padding: 0;
  accent-color: var(--flyer-red);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--flyer-red);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  line-height: 1.35;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(79, 103, 255, 0.2);
  border-color: var(--brand);
}

.segmented-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.segmented-field legend {
  grid-column: 1 / -1;
}

.segmented-field label {
  position: relative;
  cursor: pointer;
}

.segmented-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-field span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  font-weight: 900;
}

.segmented-field input:checked + span {
  border-color: var(--flyer-red);
  background: #fee2e2;
  color: #991b1b;
}

.control-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
}

.preview-panel {
  overflow: hidden;
  padding: 18px;
  background: #f8fafc;
}

.preview-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.flyer-page {
  --scale: 0.94;
  container-type: inline-size;
  width: min(100%, calc(8.5in * var(--scale)));
  aspect-ratio: 8.5 / 11;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 19.9% minmax(0, 1fr) 12.3%;
  gap: 0.75%;
  padding: 0.85%;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  color: var(--flyer-ink);
  font-family: Arial, Helvetica, sans-serif;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.flyer-page * {
  box-sizing: border-box;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.flyer-masthead {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23.5%;
  gap: 1.7%;
  align-items: stretch;
  padding: 2.25% 2.4% 1.9%;
  color: #ffffff;
  overflow: hidden;
}

.flyer-page.no-reward .flyer-masthead {
  grid-template-columns: 1fr;
}

.flyer-page.no-reward .flyer-masthead-title {
  padding-inline: 6%;
}

.flyer-masthead-bg,
.flyer-reward-bg,
.flyer-contact-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.flyer-masthead > :not(.flyer-masthead-bg),
.flyer-reward > :not(.flyer-reward-bg),
.flyer-contact > :not(.flyer-contact-bg) {
  position: relative;
  z-index: 1;
}

.flyer-masthead-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.flyer-masthead h2 {
  margin: 0;
  font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
  font-size: clamp(2.8rem, 13.5cqw, 7.2rem);
  line-height: 0.78;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.16);
}

.flyer-masthead p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.1%;
  margin: 2.5% 0 0;
  color: #ffffff;
  font-size: clamp(0.75rem, 2.6cqw, 1.72rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.flyer-masthead p::before,
.flyer-masthead p::after {
  content: "";
  width: 9%;
  height: 0.12em;
  background: #ffffff;
}

.flyer-reward {
  position: relative;
  display: grid;
  place-items: center;
  padding: 7% 6% 16%;
  color: var(--flyer-ink);
  text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% 82%, 50% 100%, 0 82%);
  box-shadow: inset 0 0 0 0.06in #ffffff;
  overflow: hidden;
}

.flyer-reward[hidden] {
  display: none;
}

.flyer-star {
  display: block;
  margin-bottom: 2%;
  font-size: clamp(1rem, 3.2cqw, 1.8rem);
  line-height: 1;
}

.flyer-reward span:not(.flyer-star) {
  display: block;
  font-size: clamp(0.9rem, 2.45cqw, 1.55rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.flyer-reward strong {
  display: block;
  margin-top: 4%;
  font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
  font-size: clamp(2rem, 6.2cqw, 3.85rem);
  line-height: 0.86;
}

.flyer-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 54.8% minmax(0, 1fr);
  gap: 1.9%;
}

.flyer-photo {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #e5e7eb;
  touch-action: none;
}

.flyer-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  user-select: none;
  transform-origin: center;
  will-change: object-position, transform;
  -webkit-user-drag: none;
}

.flyer-photo.has-photo {
  cursor: grab;
}

.flyer-photo.has-photo.is-dragging {
  cursor: grabbing;
}

.flyer-photo-pdf-layer {
  width: 100%;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.flyer-photo-placeholder {
  width: 72%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 0.055in dashed var(--flyer-red);
  border-radius: 999px;
  background: #ffffff;
  color: var(--flyer-red);
  font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
  font-size: clamp(1.3rem, 4.1cqw, 2.9rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.flyer-details {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 1.4%;
  padding: 0.25% 0.7% 0.25% 0;
}

.flyer-name-block {
  padding-bottom: 2.3%;
  border-bottom: 0.035in solid var(--flyer-red);
}

.flyer-name-block h3 {
  margin: 0;
  color: var(--flyer-red);
  font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
  font-size: clamp(2.8rem, 10.2cqw, 6rem);
  line-height: 0.84;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.flyer-name-block p {
  margin: 1.7% 0 0;
  font-size: clamp(0.95rem, 2.65cqw, 1.68rem);
  line-height: 1;
  font-weight: 900;
}

.flyer-last-seen {
  display: grid;
  grid-template-columns: 14% minmax(0, 1fr);
  gap: 3.2%;
  align-items: start;
  padding: 1.8% 0 2.4%;
  border-bottom: 0.035in solid var(--flyer-red);
}

.flyer-last-seen h4 {
  margin: 0 0 2.8%;
  color: var(--flyer-red);
  font-size: clamp(0.95rem, 2.65cqw, 1.55rem);
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.flyer-last-seen p {
  margin: 0;
  font-size: clamp(0.82rem, 2.12cqw, 1.35rem);
  line-height: 1.04;
  font-weight: 900;
}

.flyer-icon {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--flyer-red);
  color: #ffffff;
}

.flyer-icon svg {
  width: 58%;
  height: 58%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flyer-facts {
  min-height: 0;
  display: grid;
  align-content: start;
}

.flyer-fact {
  display: grid;
  grid-template-columns: 12.5% minmax(0, 1fr);
  gap: 3.2%;
  align-items: center;
  padding: 1.55% 0;
  border-bottom: 0.025in dotted rgba(195, 23, 18, 0.68);
  font-size: clamp(0.72rem, 1.8cqw, 1.18rem);
  line-height: 1.08;
  font-weight: 900;
}

.flyer-fact p {
  margin: 0;
}

.flyer-fact strong {
  color: var(--flyer-red);
  text-transform: uppercase;
}

.flyer-note {
  display: grid;
  grid-template-columns: 12.5% minmax(0, 1fr);
  gap: 3%;
  align-items: center;
  padding: 3%;
  border-radius: 0.08in;
  background: linear-gradient(180deg, #eeeeee, #dedede);
  font-size: clamp(0.75rem, 1.8cqw, 1.18rem);
  line-height: 1.02;
  font-weight: 900;
}

.flyer-note p {
  margin: 0;
}

.flyer-contact {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0.75% 2.4% 0.85%;
  color: #ffffff;
  overflow: hidden;
  text-align: center;
  text-transform: uppercase;
}

.flyer-contact p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2%;
  width: 100%;
  margin: 0;
  color: #ffffff;
  font-size: clamp(0.8rem, 2.25cqw, 1.58rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.flyer-contact p::before,
.flyer-contact p::after {
  content: "";
  flex: 1;
  max-width: 15%;
  height: 0.08em;
  background: #ffffff;
}

.flyer-contact strong {
  display: block;
  margin-top: 0.4%;
  color: #ffffff;
  font-family: Impact, "Arial Black", Arial, Helvetica, sans-serif;
  font-size: clamp(2rem, 8.8cqw, 5.45rem);
  line-height: 0.86;
  letter-spacing: 0.05em;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.18);
}

.flyer-contact span {
  display: block;
  margin-top: 0.8%;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.34rem, 0.78cqw, 0.52rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
}

.seo-section {
  padding: 14px 0 54px;
}

.seo-grid {
  display: grid;
  gap: 18px;
}

.seo-card {
  padding: 24px;
}

.seo-card ul {
  margin: 0;
  padding-left: 20px;
}

.seo-card li + li {
  margin-top: 8px;
}

.seo-card summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 900;
}

.seo-card details p {
  margin: 12px 0 0;
}

.seo-card details + details {
  margin-top: 16px;
}

.pdf-render-stage {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 8.5in;
  height: 11in;
  overflow: hidden;
  background: #ffffff;
  pointer-events: none;
}

.pdf-render-stage .flyer-page {
  --scale: 1;
  width: 8.5in !important;
  height: 11in !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.footer {
  padding: 28px 0;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 820px) {
  .site-logo {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
  }

  .tool-hero-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .generator-layout {
    grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
  }

  .preview-panel {
    position: sticky;
    top: 94px;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .full-field {
    grid-column: 1 / -1;
  }

  .seo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 819px) {
  .wrap {
    width: min(100% - 32px, 1180px);
  }

  .nav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .logo {
    flex: 1 1 auto;
    min-width: 0;
  }

  .logo-text {
    font-size: 16px;
    line-height: 1.2;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .menu {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .menu.is-open {
    display: flex;
  }

  .menu a {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
  }

  .menu a.nav-contact {
    justify-content: center;
  }

  .tool-hero {
    padding: 34px 0 28px;
  }

  .tool-hero p {
    font-size: 16px;
  }

  .tool-hero-actions,
  .control-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .tool-hero-actions .btn,
  .control-actions .btn {
    width: 100%;
  }

  .control-card,
  .preview-panel,
  .seo-card {
    border-radius: 18px;
  }

  .preview-panel {
    padding: 12px;
  }

  .preview-panel-header {
    align-items: start;
  }

  .preview-actions {
    width: 100%;
    justify-content: stretch;
  }

  .preview-actions .btn {
    flex: 1 1 120px;
  }

  .flyer-page {
    --scale: 1;
    width: 100%;
  }

  .flyer-masthead h2 {
    font-size: 12.3cqw;
  }

  .flyer-masthead p {
    font-size: 2.35cqw;
    letter-spacing: 0.075em;
  }

  .flyer-reward {
    padding-bottom: 14%;
  }

  .flyer-star {
    font-size: 3cqw;
  }

  .flyer-reward span:not(.flyer-star) {
    font-size: 2.25cqw;
  }

  .flyer-reward strong {
    font-size: 5.8cqw;
  }

  .flyer-photo-placeholder {
    font-size: 3.2cqw;
  }

  .flyer-name-block h3 {
    font-size: 9.2cqw;
  }

  .flyer-name-block p {
    font-size: 2.35cqw;
  }

  .flyer-last-seen h4 {
    font-size: 2.3cqw;
  }

  .flyer-last-seen p {
    font-size: 1.82cqw;
  }

  .flyer-fact {
    font-size: 1.6cqw;
  }

  .flyer-note {
    font-size: 1.52cqw;
  }

  .flyer-contact p {
    font-size: 2.05cqw;
    letter-spacing: 0.07em;
  }

  .flyer-contact strong {
    font-size: 7.6cqw;
  }

  .flyer-contact span {
    font-size: 0.72cqw;
  }
}

@page {
  size: letter;
  margin: 0;
}

@media print {
  html,
  body {
    width: 8.5in !important;
    height: 11in !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #ffffff !important;
  }

  body > * {
    display: none !important;
  }

  main,
  .generator-section,
  .generator-section .wrap,
  .generator-layout,
  .preview-panel {
    display: block !important;
  }

  main > :not(.generator-section),
  .generator-controls,
  .preview-panel-header,
  .seo-section {
    display: none !important;
  }

  .generator-section,
  .wrap,
  .generator-layout,
  .preview-panel {
    display: block !important;
    width: 8.5in !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }

  .flyer-page {
    --scale: 1;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 8.49in !important;
    height: 10.98in !important;
    margin: 0 !important;
    box-shadow: none !important;
  }
}
