:root {
  --blue: #0057ff;
  --blue-dark: #0040c4;
  --blue-light: #e8f0ff;
  --electric: #2f7bff;
  --navy: #0b1533;
  --gray-50: #f7f8fb;
  --gray-100: #eef1f6;
  --gray-200: #dfe4ec;
  --gray-400: #9aa4b6;
  --gray-600: #5b6478;
  --white: #ffffff;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(11, 21, 51, 0.06);
  --shadow-md: 0 12px 32px rgba(11, 21, 51, 0.10);
  --shadow-lg: 0 24px 64px rgba(11, 21, 51, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--white);
  color: var(--navy);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--electric);
  outline-offset: 2px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-100);
}
.site-header .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand-title { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.brand-title span { color: var(--blue); }
.brand-subtitle { font-size: 12.5px; color: var(--gray-600); font-weight: 500; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 12.5px;
  font-weight: 700;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.status-dot.offline { background: var(--gray-400); }

/* Hero */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 18px;
  color: var(--navy);
}
.hero h1 .accent { color: var(--blue); }
.hero p {
  font-size: 17px;
  color: var(--gray-600);
  max-width: 620px;
  margin: 0 auto 36px;
  line-height: 1.55;
}
.flow-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
}
.flow-strip .step {
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  padding: 10px 18px;
  border-radius: 999px;
}
.flow-strip .arrow { color: var(--blue); font-size: 16px; }

/* Sections */
.section { padding: 22px 0; }
.section-bg { background: var(--gray-50); border-radius: var(--radius-lg); padding: 32px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.section-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--white);
  background: var(--blue);
  width: 26px; height: 26px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.section-title { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.section-desc { color: var(--gray-600); font-size: 14.5px; margin: 4px 0 20px; }

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}

/* Uploader */
.uploader {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--white);
  padding: 40px 24px;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
  cursor: pointer;
}
.uploader.dragover { border-color: var(--blue); background: var(--blue-light); }
.uploader-icon {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue);
}
.uploader-title { font-weight: 700; font-size: 15.5px; margin-bottom: 4px; }
.uploader-sub { font-size: 13px; color: var(--gray-600); }
.uploader-formats { margin-top: 14px; font-size: 12px; color: var(--gray-400); font-weight: 600; letter-spacing: .02em; }
input[type=file] { display: none; }

.default-campaigns { margin-top: 18px; }
.default-campaigns-label {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gray-600); margin-bottom: 10px;
}
.default-campaigns-row { display: flex; gap: 12px; }
.default-campaign-card {
  position: relative; flex: 1; padding: 0; border: 2px solid var(--gray-200); border-radius: var(--radius-md);
  overflow: hidden; background: #fff; cursor: pointer; text-align: left;
  transition: border-color .15s ease, transform .12s ease;
}
.default-campaign-card:hover { transform: translateY(-2px); border-color: var(--gray-400); }
.default-campaign-card.active { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.default-campaign-card img { width: 100%; height: 150px; object-fit: cover; object-position: top center; display: block; }
.default-campaign-card .dc-name {
  display: block; padding: 8px 12px; font-weight: 700; font-size: 13px; color: var(--navy);
}
.dc-suggested {
  position: absolute; top: 8px; right: 8px; background: var(--blue); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
.default-campaigns-hint { font-size: 12.5px; color: var(--gray-600); margin: 10px 2px 0; min-height: 16px; }

.tips {
  margin-top: 16px;
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--blue-dark);
}
.tips ul { margin: 6px 0 0; padding-left: 18px; }
.tips li { margin: 2px 0; }

.preview-card {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
}
.preview-thumb {
  width: 160px; height: 120px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview-meta .label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--blue); }
.preview-meta .name { font-weight: 700; margin-top: 4px; word-break: break-all; }
.preview-meta .size { font-size: 13px; color: var(--gray-600); margin-top: 2px; }
.preview-actions { display: flex; gap: 8px; flex-direction: column; }

@media (max-width: 640px) {
  .preview-card { grid-template-columns: 1fr; }
  .preview-thumb { width: 100%; height: 180px; }
  .preview-actions { flex-direction: row; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 14.5px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--electric), var(--blue-dark)); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { box-shadow: var(--shadow-lg); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--gray-100); color: var(--navy); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-ghost { background: transparent; color: var(--blue); border: 1.5px solid var(--gray-200); }
.btn-ghost:hover { border-color: var(--blue); }
.btn-danger { background: #fff1f1; color: #c0392b; }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 30px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.btn-cta-wrap { text-align: center; padding: 12px 0 4px; }

/* Settings */
.settings-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 18px 24px; user-select: none;
}
.settings-toggle strong { font-size: 15px; }
.settings-body { padding: 0 24px 24px; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.settings-body.collapsed { display: none; }
.field-label { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); margin-bottom: 8px; display: block; }
.segmented { display: flex; background: var(--gray-100); border-radius: 999px; padding: 4px; }
.segmented button {
  flex: 1; border: none; background: transparent; padding: 8px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--gray-600);
}
.segmented button.active { background: var(--white); color: var(--blue); box-shadow: var(--shadow-sm); }
.static-field {
  background: var(--gray-100); border-radius: 999px; padding: 9px 14px;
  font-size: 13px; font-weight: 700; color: var(--navy);
}

/* Mask review */
.mask-review { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; }
.mask-preview-box {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  background: var(--gray-100); aspect-ratio: 4/5;
}
.mask-preview-box img, .mask-preview-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.mask-preview-box canvas { opacity: .55; pointer-events: none; mix-blend-mode: normal; }
.mask-status { font-size: 13.5px; color: var(--gray-600); margin-bottom: 14px; }
@media (max-width: 720px) { .mask-review { grid-template-columns: 1fr; } }

/* Processing modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,21,51,.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.hidden { display: none !important; }
.processing-card {
  background: #fff; border-radius: var(--radius-lg); padding: 40px 32px; width: 420px; max-width: 100%;
  text-align: center; box-shadow: var(--shadow-lg);
}
.spinner {
  width: 56px; height: 56px; margin: 0 auto 22px; border-radius: 50%;
  border: 5px solid var(--gray-100); border-top-color: var(--blue);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-stage { font-size: 16px; font-weight: 700; margin-bottom: 6px; min-height: 24px; }
.processing-sub { font-size: 13px; color: var(--gray-600); }

/* Mask editor modal */
.editor-card {
  background: #fff; border-radius: var(--radius-lg); width: min(920px, 96vw); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg);
}
.editor-toolbar { display: flex; gap: 8px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--gray-100); flex-wrap: wrap; }
.editor-toolbar .spacer { flex: 1; }
.tool-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--gray-200); background: #fff;
  display: flex; align-items: center; justify-content: center; color: var(--navy);
}
.tool-btn.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.tool-btn:disabled { opacity: .4; }
.brush-size-wrap { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--gray-600); font-weight: 600; }
.editor-canvas-wrap {
  position: relative; flex: 1; overflow: hidden; background: repeating-conic-gradient(#f0f2f6 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
  cursor: crosshair; touch-action: none;
}
.editor-canvas-wrap canvas { position: absolute; top: 0; left: 0; }
.editor-footer { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-top: 1px solid var(--gray-100); gap: 10px; flex-wrap: wrap; }

/* Result */
.result-heading { text-align: center; margin-bottom: 28px; }
.result-heading h2 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
/* The finished image on its own. No fixed aspect-ratio and no object-fit:
   cover here — the campaign art is 2:3 and cropping it cut off the V80
   wordmark. Let the image set its own height so it is always shown whole. */
.result-image-wrap {
  max-width: 640px; margin: 0 auto; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-md); line-height: 0;
}
.result-image-wrap img { display: block; width: 100%; height: auto; }

.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 22px 0; }

.generations-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 8px; margin-top: 18px; }
.generation-thumb { width: 84px; height: 100px; border-radius: 12px; overflow: hidden; border: 3px solid transparent; flex-shrink: 0; cursor: pointer; }
.generation-thumb.active { border-color: var(--blue); }
.generation-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Download & Share */
.download-row { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
select.format-select {
  padding: 12px 16px; border-radius: 999px; border: 1.5px solid var(--gray-200); font-weight: 700; font-size: 14px; background: #fff;
}
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 560px; margin: 20px auto 0; }
@media (max-width: 560px) { .share-grid { grid-template-columns: repeat(2, 1fr); } }
.share-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px;
  border-radius: var(--radius-md); border: 1.5px solid var(--gray-100); background: #fff; font-weight: 700; font-size: 13px; color: var(--navy);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.share-btn:hover { transform: translateY(-3px); border-color: var(--blue); box-shadow: var(--shadow-sm); }
.share-btn .icon-wrap { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.icon-instagram { background: linear-gradient(135deg,#f58529,#dd2a7b,#8134af,#515bd4); }
.icon-tiktok { background: #000; }
.icon-snapchat { background: #fffc00; color: #111 !important; }
.icon-x { background: #000; }

/* Modal (share) */
.share-modal-card { background: #fff; border-radius: var(--radius-lg); width: min(420px, 94vw); padding: 26px; box-shadow: var(--shadow-lg); }
.share-modal-card h3 { margin: 0 0 4px; font-size: 19px; }
.share-modal-card .thumb { width: 100%; border-radius: var(--radius-sm); margin: 14px 0; overflow: hidden; }
.share-modal-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.share-modal-options button {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-100); background: #fff; text-align: left; font-weight: 700; font-size: 14px; color: var(--navy);
}
.share-modal-options button:hover { border-color: var(--blue); }
.close-x { border: none; background: var(--gray-100); width: 32px; height: 32px; border-radius: 50%; float: right; font-size: 15px; }

/* Toasts / errors */
.toast-stack { position: fixed; bottom: 20px; right: 20px; left: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; z-index: 200; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 380px; background: #fff; border-left: 4px solid #c0392b; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 14px 16px; font-size: 13.5px; color: var(--navy); font-weight: 600;
  animation: toast-in .18s ease;
}
.toast.info { border-left-color: var(--blue); }
.toast.success { border-left-color: #16a34a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

footer { text-align: center; padding: 40px 20px 60px; color: var(--gray-400); font-size: 12.5px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.privacy-note { font-size: 12px; color: var(--gray-400); text-align: center; margin-top: 10px; }
