:root {
  /* Palette sampled from the V80 campaign art: ember-dark backdrop,
     molten orange body, amber glow and the pale-gold V80 wordmark. */
  --bg: #120803;
  --surface: #1c0e06;
  --card: #241209;
  --surface-2: #2f180b;
  --line: #4d2c16;
  --faint: #9a7660;
  --muted: #d2b096;
  --ink: #fff3e6;
  --accent: #ff7a1a;
  --accent-deep: #e04e00;
  --accent-soft: rgba(255, 122, 26, 0.14);
  --glow: #ffb347;
  --gold: #ffe2a8;
  --on-accent: #1a0a02;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(255, 122, 26, 0.12);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 122, 26, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(255, 140, 40, 0.38), rgba(255, 90, 0, 0.10) 55%, transparent 75%),
    radial-gradient(ellipse 50% 40% at 100% 60%, rgba(255, 100, 20, 0.08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

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(--glow);
  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(18, 8, 3, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-2);
}
.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(--ink); }
.brand-title span { color: var(--glow); text-shadow: 0 0 14px rgba(255, 150, 40, 0.55); }
.brand-subtitle { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--glow);
  font-size: 12.5px;
  font-weight: 700;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.status-dot.offline { background: var(--faint); }

/* 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(--ink);
}
.hero h1 .accent {
  background: linear-gradient(180deg, var(--gold) 0%, var(--glow) 55%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 140, 40, 0.45));
}
.hero p {
  font-size: 17px;
  color: var(--muted);
  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(--ink);
}
.flow-strip .step {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  padding: 10px 18px;
  border-radius: 999px;
}
.flow-strip .arrow { color: var(--accent); font-size: 16px; }

/* Sections */
.section { padding: 22px 0; }
.section-bg { background: var(--surface); border: 1px solid var(--surface-2); 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(--on-accent);
  background: linear-gradient(135deg, var(--glow), var(--accent));
  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(--muted); font-size: 14.5px; margin: 4px 0 20px; }

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

/* Uploader */
.uploader {
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 40px 24px;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
  cursor: pointer;
}
.uploader.dragover { border-color: var(--accent); background: var(--accent-soft); }
.uploader-icon {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.uploader-title { font-weight: 700; font-size: 15.5px; margin-bottom: 4px; }
.uploader-sub { font-size: 13px; color: var(--muted); }
.uploader-formats { margin-top: 14px; font-size: 12px; color: var(--faint); 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(--muted); margin-bottom: 10px;
}
.default-campaigns-row { display: flex; gap: 12px; }
.default-campaign-card {
  position: relative; flex: 1; padding: 0; border: 2px solid var(--line); border-radius: var(--radius-md);
  overflow: hidden; background: var(--card); cursor: pointer; text-align: left;
  transition: border-color .15s ease, transform .12s ease;
}
.default-campaign-card:hover { transform: translateY(-2px); border-color: var(--faint); }
.default-campaign-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.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(--ink);
}
.dc-suggested {
  position: absolute; top: 8px; right: 8px; background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
/* Format picker (Social Media / Profile). Thumbnails are contained, not
   cropped, so each card shows its real shape: portrait vs square. */
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.format-card { display: flex; flex-direction: column; }
.format-card .format-thumb {
  display: flex; align-items: center; justify-content: center;
  height: 190px; padding: 12px; background: var(--surface-2);
}
.format-card .format-thumb img {
  width: auto; height: 100%; max-width: 100%; object-fit: contain;
  border-radius: 6px; box-shadow: var(--shadow-sm);
}
.format-card .format-name { padding: 12px 14px 2px; font-weight: 800; font-size: 15px; color: var(--ink); }
.format-card .format-sub { padding: 0 14px 14px; font-size: 12.5px; color: var(--muted); }
.format-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) {
  .format-card .format-thumb { height: 140px; padding: 10px; }
}

.default-campaigns-hint { font-size: 12.5px; color: var(--muted); margin: 10px 2px 0; min-height: 16px; }

.tips {
  margin-top: 16px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--glow);
}
.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(--surface-2);
  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(--accent); }
.preview-meta .name { font-weight: 700; margin-top: 4px; word-break: break-all; }
.preview-meta .size { font-size: 13px; color: var(--muted); 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(--gold) -20%, var(--glow) 20%, var(--accent) 60%, var(--accent-deep)); color: var(--on-accent); 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(--surface-2); color: var(--ink); }
.btn-secondary:hover { background: var(--line); }
.btn-ghost { background: transparent; color: var(--glow); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: rgba(255, 80, 60, 0.12); color: #ff8a78; }
.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(--muted); margin-bottom: 8px; display: block; }
.segmented { display: flex; background: var(--surface-2); 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(--muted);
}
.segmented button.active { background: var(--surface-2); color: var(--accent); box-shadow: var(--shadow-sm); }
.static-field {
  background: var(--surface-2); border-radius: 999px; padding: 9px 14px;
  font-size: 13px; font-weight: 700; color: var(--ink);
}

/* 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(--surface-2); 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(--muted); margin-bottom: 14px; }
@media (max-width: 720px) { .mask-review { grid-template-columns: 1fr; } }

/* Processing modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8, 3, 0, 0.72);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.hidden { display: none !important; }
.processing-card {
  background: var(--card); 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(--surface-2); border-top-color: var(--accent);
  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(--muted); }

/* Mask editor modal */
.editor-card {
  background: var(--card); 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(--surface-2); flex-wrap: wrap; }
.editor-toolbar .spacer { flex: 1; }
.tool-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.tool-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tool-btn:disabled { opacity: .4; }
.brush-size-wrap { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.editor-canvas-wrap {
  position: relative; flex: 1; overflow: hidden; background: repeating-conic-gradient(#2f180b 0% 25%, #1c0e06 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(--surface-2); 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(--accent); }
.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(--line); font-weight: 700; font-size: 14px; background: var(--card); color: var(--ink);
}
.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(--surface-2); background: var(--card); font-weight: 700; font-size: 13px; color: var(--ink);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.share-btn:hover { transform: translateY(-3px); border-color: var(--accent); 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; box-shadow: 0 0 0 1px var(--line); }
.icon-snapchat { background: #fffc00; color: #111 !important; }
.icon-x { background: #000; box-shadow: 0 0 0 1px var(--line); }

/* Modal (share) */
.share-modal-card { background: var(--card); 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(--surface-2); background: var(--card); text-align: left; font-weight: 700; font-size: 14px; color: var(--ink);
}
.share-modal-options button:hover { border-color: var(--accent); }
.close-x { border: none; background: var(--surface-2); 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: var(--card); border-left: 4px solid #ff5a3c; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 14px 16px; font-size: 13.5px; color: var(--ink); font-weight: 600;
  animation: toast-in .18s ease;
}
.toast.info { border-left-color: var(--accent); }
.toast.success { border-left-color: #22c55e; }
@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(--faint); 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(--faint); text-align: center; margin-top: 10px; }

/* Mode tabs: Profile with AI / Profile with Frame */
.mode-tabs {
  display: inline-flex; gap: 4px; padding: 5px; margin: 0 auto 22px;
  background: var(--surface); border: 1px solid var(--surface-2); border-radius: 999px;
}
.mode-tab {
  border: none; background: transparent; color: var(--muted);
  padding: 11px 22px; border-radius: 999px; font-size: 14.5px; font-weight: 800;
  transition: background .15s ease, color .15s ease;
}
.mode-tab:hover { color: var(--ink); }
.mode-tab.active {
  background: linear-gradient(135deg, var(--glow), var(--accent) 60%, var(--accent-deep));
  color: var(--on-accent); box-shadow: var(--shadow-sm);
}
@media (max-width: 420px) { .mode-tab { padding: 10px 14px; font-size: 13.5px; } }

/* Profile with Frame */
.studio-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .studio-layout { grid-template-columns: 1fr; gap: 22px; } }
.studio-stage { text-align: center; }
.studio-example {
  width: 100%; max-width: 520px; height: auto; margin: 0 auto;
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}
.frame-canvas {
  display: block; width: 100%; max-width: 520px; height: auto; aspect-ratio: 1; margin: 0 auto;
  border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  touch-action: none; cursor: grab; background: var(--surface-2);
}
.frame-canvas.dragging { cursor: grabbing; }
.frame-hint { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.frame-adjust { margin-bottom: 20px; }
.zoom-range { width: 100%; accent-color: var(--accent); }
.frame-tip { font-size: 12.5px; color: var(--faint); margin: 6px 0 0; }
.frame-download { justify-content: flex-start; }
.frame-share { margin: 20px 0 0; max-width: none; }
@media (max-width: 860px) { .frame-download { justify-content: center; } }
