@font-face {
  font-family: Inter;
  src: url("fonts/inter-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color: #3f2666;
  background: #fff;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --purple: #673f99;
  --ink: #3f2666;
  --muted: #887b97;
  --lime: #b7d341;
  --line: #ece4f2;
  --shadow: 0 5px 22px #54347708;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 66% 15%, #fcf8fe 0%, #fcf8fe00 53%),
    radial-gradient(ellipse at 40% 64%, #fbf7fd 0%, #fff 69%);
  color: var(--ink);
}

button, input, textarea { font: inherit; color: inherit; }
button, a, input, textarea, summary { outline-offset: 4px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid #9d7bc4;
}
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }

.icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 44px 12px;
}

.masthead {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #efe9f4;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 20px;
  letter-spacing: -0.65px;
  font-weight: 580;
  color: #393939;
}

.brand-logo {
  display: block;
  width: 188px;
  height: auto;
  flex-shrink: 0;
}

.brand-divider {
  height: 24px;
  width: 1px;
  background: #e7dfed;
}

.brand-product { font-weight: 400; color: var(--purple); white-space: nowrap; }
.brand-period { color: var(--lime); font-weight: 700; }

.masthead-right { display: flex; align-items: center; }

.tool-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #8562aa;
  background: #faf7fd;
  border: 1px solid #eee6f5;
  border-radius: 25px;
  padding: 7px 12px;
  font-size: 11px;
}

.engine-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 3px #b7d34122;
}

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 37px 10px 28px;
  min-height: 280px;
}

.intro-copy { animation: enter-up 0.65s ease both; }

.eyebrow {
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 1.55px;
  font-weight: 650;
  color: #8562aa;
}

.eyebrow-line {
  width: 21px;
  height: 2px;
  border-radius: 1px;
  background: var(--lime);
}

h1 {
  margin: 0 0 15px;
  font-size: clamp(34px, 3.65vw, 50px);
  line-height: 1.13;
  letter-spacing: -2.25px;
  font-weight: 650;
  color: var(--ink);
}

h1 span {
  font-weight: 400;
  color: var(--purple);
  letter-spacing: -1.9px;
}

.subtitle {
  margin: 0;
  max-width: 46ch;
  color: #806793;
  font-size: 15px;
  line-height: 1.75;
}

.hero-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 20px;
}

.hero-benefits span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #806793;
  font-size: 12px;
}

.hero-benefits .icon { color: #89a51c; }

.intro-illustration {
  width: min(440px, 42vw);
  flex-shrink: 0;
  position: relative;
  animation: enter-up 0.85s ease both;
}

.hero-art, .empty-art { width: 100%; height: auto; display: block; overflow: visible; }

.art-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
  color: #9476aa;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.art-caption span { width: 16px; height: 1px; background: #c9ddb1; }

.art-type-card { animation: float-card 6s ease-in-out infinite; transform-origin: 120px 140px; }
.art-vector-card { animation: float-card 6.5s ease-in-out infinite reverse; transform-origin: center; }
.art-cursor { animation: cursor-drift 7s ease-in-out infinite; }
.art-sparkle { animation: sparkle 4s ease-in-out infinite; transform-origin: center; }
.art-dot { animation: sparkle 3s ease-in-out infinite alternate; }
.art-convert { animation: conversion-pulse 4s ease-in-out infinite; transform-origin: center; }

@keyframes float-card {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(1deg); }
}
@keyframes cursor-drift {
  0%, 100% { transform: translate(0, 0); }
  45% { transform: translate(-6px, -5px); }
  75% { transform: translate(3px, 2px); }
}
@keyframes sparkle {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@keyframes conversion-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes enter-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.panel {
  border: 1px solid #e9dfef;
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: enter-up 0.6s 0.08s ease both;
}

.panel-heading {
  min-height: 58px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #f1eaf6;
}

.panel-heading h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 14px;
  font-weight: 580;
  color: #5e447b;
}

.step {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #f9f3ff;
  color: #9672b1;
  font-size: 11px;
  font-weight: 600;
}

.heading-note { color: #b09bc2; font-size: 12px; }

.field-tag {
  display: block;
  padding: 8px 8px 0;
}

.field-tag > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

textarea {
  display: block;
  width: 100%;
  min-height: 168px;
  resize: vertical;
  border: 0;
  background: #fff;
  padding: 18px 18px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #654780;
  caret-color: var(--purple);
}

textarea::placeholder { color: #c6b5d5; }
textarea:focus { outline: none; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px 18px;
  padding: 8px 20px 18px;
  border-top: 1px solid #f5eff9;
  background: #fcf9ff;
}

.field { display: flex; flex-direction: column; gap: 7px; }

.field > span, .sizes legend {
  color: #806398;
  font-size: 12px;
  font-weight: 500;
}

input[type="number"] {
  width: 108px;
  height: 38px;
  border: 1px solid #eadef1;
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  color: #654780;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.18s, box-shadow 0.18s;
}

input[type="number"]:hover { border-color: #d3bce3; }
input[type="number"]:focus {
  border-color: #b394ce;
  box-shadow: 0 0 0 3px #673f9912;
  outline: none;
}

.sizes {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.sizes legend { width: 100%; padding: 0; }

.sizes label {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #e0d1ed;
  border-radius: 8px;
  background: #fff;
  color: #8862a6;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.18s;
}

.sizes label:hover { background: #f7effd; border-color: #ccb0e1; }
.sizes input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.sizes label:has(input:checked) {
  background: var(--purple);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 7px #673f9918;
}
.sizes label:has(input:focus-visible) { outline: 2px solid #9d7bc4; outline-offset: 3px; }

.actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s, color 0.2s;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0) scale(0.985); }

.button.primary, .primary {
  background: var(--purple);
  color: #fff;
  min-width: 132px;
  box-shadow: 0 3px 7px #673f9918;
}

.button.primary:hover, .primary:hover { background: #593383; }

.button.secondary, .ghost, .rerun {
  border-color: #e0d1ed;
  background: #fff;
  color: #8862a6;
}

.button.secondary:hover, .ghost:hover, .rerun:hover {
  background: #f7effd;
  border-color: #ccb0e1;
}

.form-error {
  margin: 0;
  padding: 12px 18px;
  color: #a34759;
  background: #fff5f7;
  border-top: 1px solid #f6dfe6;
  font-size: 13px;
  line-height: 1.5;
}

.form-error[hidden], .summary[hidden], #empty[hidden], #load-all[hidden], #rerun-all[hidden], #previous[hidden], .preview-well[hidden], .card[hidden] {
  display: none !important;
}

.summary {
  margin-top: 22px;
  animation: enter-up 0.5s ease both;
}

.workspace-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 0 4px 12px;
  color: #9676ac;
  font-size: 11px;
  letter-spacing: 1.2px;
}

.workspace-label span:first-child { font-weight: 600; }
.workspace-label span:last-child {
  letter-spacing: 0;
  color: #9475a9;
  font-size: 12px;
  text-align: right;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #e7dcef;
  border-radius: 999px;
  background: #fff;
  color: #8562aa;
  font-size: 13px;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s;
}

.filter b {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #997bae;
}

.filter:hover { transform: translateY(-1px); border-color: #ccb0e1; }
.filter.is-on {
  background: var(--purple);
  border-color: transparent;
  color: #fff;
}
.filter.is-on b { color: #e7f2b8; }

.insight {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 12px;
}

.previous {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.previous-label {
  color: #9676ac;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.previous-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px dashed #e0d1ed;
  background: #fcf9ff;
  color: #9475a9;
  font-size: 12px;
}

.previous-chip b { font-weight: 650; }
.previous-chip span { font-variant-numeric: tabular-nums; }
.previous-chip.is-creative b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 550;
  font-size: 11px;
}

.groups, .creative-tally {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.group-chip, .creative-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e7dcef;
  background: #fff;
  color: #8562aa;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s;
}

.group-chip:hover, .creative-chip:hover { transform: translateY(-1px); border-color: #ccb0e1; }

.group-chip b, .creative-chip b, .creative-chip span {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.group-chip.is-exposed {
  background: #f5f9e9;
  border-color: #e3ebc7;
  color: #6e832b;
}
.group-chip.is-non-exposed {
  background: #f4eefb;
  border-color: #e4d4f2;
  color: #734fa0;
}
.group-chip.is-regular { color: #9472a9; }

.group-chip.is-on, .creative-chip.is-on {
  background: var(--purple);
  border-color: transparent;
  color: #fff;
}
.group-chip.is-on b, .creative-chip.is-on b, .creative-chip.is-on span { color: #e7f2b8; }

.tally-label, .tally-empty {
  color: #9676ac;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tally-empty { letter-spacing: 0; text-transform: none; font-size: 12px; }

.creative-chip b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 550;
  font-size: 11px;
  color: #5e447b;
}
.creative-chip span { color: #997bae; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding: 16px 0 8px;
}

html[data-preview="970x250"] .grid { grid-template-columns: 1fr; }
html[data-preview="300x600"] .grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

.card {
  min-width: 0;
  background: #fff;
  border: 1px solid #e9dfef;
  border-radius: 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: enter-up 0.45s ease both;
}

.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.16s; }
.card:nth-child(6) { animation-delay: 0.2s; }
.card:nth-child(n+7) { animation-delay: 0.24s; }

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1eaf6;
}

.user-id {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #725094;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 10px 14px 0;
}

.card-meta[hidden] { display: none !important; }

.meta-group, .meta-flight, .meta-creatives {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.meta-group.is-exposed { background: #f5f9e9; color: #6e832b; }
.meta-group.is-non-exposed { background: #f4eefb; color: #734fa0; }
.meta-group.is-regular { background: #f9f3ff; color: #9472a9; }
.meta-flight { background: #fcf9ff; color: #9676ac; font-weight: 500; }
.meta-creatives {
  background: #fff;
  border: 1px solid #eadff2;
  color: #5e447b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 550;
}

.status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #eee1f8;
  background: #fcf8ff;
  color: #9472a9;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c4b2d3;
}

.status-loading::before {
  background: var(--purple);
  animation: sparkle 1s ease-in-out infinite;
}

.status-survey {
  background: #f5f9e9;
  border-color: #e3ebc7;
  color: #6e832b;
}
.status-survey::before { background: var(--lime); }

.status-ad {
  background: #f4eefb;
  border-color: #e4d4f2;
  color: #734fa0;
}
.status-ad::before { background: #9d7bc4; }

.status-unknown {
  background: #fff9ea;
  border-color: #f4ead3;
  color: #987332;
}
.status-unknown::before { background: #e2b15a; }

.rerun {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.preview-well {
  display: flex;
  justify-content: center;
  overflow: hidden;
  max-width: 100%;
  padding: 18px 14px;
  background-color: #fcf9ff;
  background-image: radial-gradient(#e8daf2 0.7px, transparent 0.7px);
  background-size: 15px 15px;
}

.preview-fit {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 25px #673f9914;
}

.preview-well iframe {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  border: 0;
  background: #fff;
  transform-origin: top left;
}

#preview-stage {
  position: fixed;
  left: -10000px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
}

.empty {
  margin: 8px 0 4px;
  padding: 28px 20px 32px;
  text-align: center;
  border: 1px solid #eee5f5;
  border-radius: 13px;
  background: #ffffffb8;
  animation: enter-up 0.6s 0.12s ease both;
}

.empty-art { width: 210px; margin: 0 auto 4px; }

.empty h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 550;
  letter-spacing: -0.2px;
  color: #8c63a7;
}

.empty p {
  margin: 0;
  color: #9577a7;
  font-size: 13px;
  line-height: 1.7;
}

.empty-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 6px 10px;
  border: 1px solid #efe1f9;
  border-radius: 6px;
  background: #f9f1ff;
  color: #8d68a5;
  font-size: 12px;
}

.how-it-works {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  margin-top: 22px;
  padding: 22px 24px;
  border: 1px solid #eee5f5;
  border-radius: 12px;
  background: #ffffffb3;
  animation: enter-up 0.6s 0.2s ease both;
}

.how-it-works > div { display: flex; align-items: center; gap: 12px; }

.how-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 10px;
  transition: transform 0.25s;
}

.how-icon .icon { width: 18px; height: 18px; }
.how-it-works > div:hover .how-icon { transform: translateY(-3px) rotate(-5deg); }
.how-icon.lavender { background: #f5edfd; color: #ae87cb; }
.how-icon.purple { background: #ede1f8; color: #a080bc; }
.how-icon.lime { background: #f1f7d9; color: #7d9428; }

.how-it-works h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 550;
  color: #8964a3;
}

.how-it-works p { margin: 0; font-size: 12px; line-height: 1.5; color: #9a7bae; }
.how-arrow { color: #d6c3e4; }
.how-arrow .icon { width: 16px; height: 16px; }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 4px 32px;
  color: #9976ae;
  font-size: 12px;
  line-height: 1.6;
}

.footer-dot { color: #d3bfe1; margin: 0 8px; }

.compatibility { position: relative; }
.compatibility summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  color: #9976ae;
}
.compatibility summary::-webkit-details-marker { display: none; }
.compatibility summary:hover { color: #9670b2; }
.compatibility p {
  position: absolute;
  right: 0;
  bottom: 24px;
  width: min(340px, calc(100vw - 48px));
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #e7d5f3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 30px #673f9918;
  color: #806793;
  font-size: 13px;
  line-height: 1.65;
  z-index: 5;
  animation: enter-up 0.25s ease;
}

@media (max-width: 980px) {
  .app-shell { padding: 0 24px 8px; }
  .intro { gap: 12px; padding-left: 0; padding-right: 0; }
  .intro-illustration { width: 280px; }
  .tool-pill { display: none; }
  .workspace-label span:last-child { display: none; }
  .how-arrow { display: none; }
  .how-it-works { justify-content: space-between; }
  .how-it-works > div { flex-direction: column; text-align: center; gap: 8px; }
}

@media (max-width: 720px) {
  .app-shell { padding: 0 16px 8px; }
  .masthead { height: 74px; }
  .brand-logo { width: 132px; }
  .wordmark { gap: 10px; font-size: 16px; }
  .brand-divider { display: none; }
  .intro {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 28px 0 18px;
  }
  .intro-illustration { width: min(100%, 360px); margin: 0 auto; }
  .hero-benefits { gap: 10px 14px; }
  h1 { letter-spacing: -1.4px; }
  .actions { margin-left: 0; width: 100%; }
  .button.primary { flex: 1; }
  .how-it-works {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .how-it-works > div { flex-direction: row; text-align: left; }
  footer { flex-direction: column; align-items: center; text-align: center; }
  .compatibility p { right: 50%; transform: translateX(50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
