/* ------------------------------------------------------------------ */
/* Unified Profile - styles                                            */
/* Restrained, light, image-first.                                     */
/* ------------------------------------------------------------------ */

:root {
  --bg: #f5f5f3;
  --panel: #ffffff;
  --border: #e4e4df;
  --border-strong: #cfcfc8;
  --text: #161616;
  --muted: #6d6d68;
  --faint: #a4a49e;
  --accent: #161616;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #1f7a4a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, output, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ol, ul { margin: 0; }
img, canvas { display: block; }

#app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ------------------------------ Header ----------------------------- */

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.brand h1 {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.tagline {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.stepper {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: #ebebe7;
  border-radius: 999px;
  flex-shrink: 0;
}

.step {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.step:hover:not(:disabled) { color: var(--text); }
.step[aria-current="step"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.step:disabled { color: var(--faint); cursor: default; }

/* ------------------------------ Buttons ---------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms, opacity 120ms, transform 60ms;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: #000; }

.btn-secondary { background: var(--panel); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: #ebebe7; }

.btn-block { width: 100%; }
.btn-large { padding: 12px 20px; font-size: 15px; }
.btn-small { padding: 6px 12px; font-size: 13px; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  flex-shrink: 0;
  background: var(--panel);
  border-color: var(--border-strong);
  font-size: 18px;
  font-weight: 500;
}
.btn-icon:hover:not(:disabled) { border-color: var(--text); }

/* ------------------------------ Shared ----------------------------- */

.view { animation: fade-in 160ms ease-out; }
/* Opacity only: a transform here would make the view the containing block for
   the fixed mobile bar and sheet while it animates. */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.lede { color: var(--muted); font-size: 15px; }
.hint { color: var(--faint); font-size: 13px; }

.message {
  min-height: 1.5em;
  font-size: 13.5px;
  color: var(--danger);
  margin-top: 10px;
}
.message:empty { display: none; }
.message[data-kind="info"] { color: var(--muted); }
.message[data-kind="ok"] { color: var(--ok); }
.message[data-kind="error"] {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* ------------------------------ Upload ----------------------------- */

.upload-card {
  background: var(--panel);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 56px 24px 40px;
  text-align: center;
  max-width: 640px;
  margin: 24px auto 0;
  transition: border-color 120ms, background 120ms;
}
.upload-card.is-dragover { border-color: var(--accent); background: #fafaf8; }
.upload-card h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.upload-card .lede { margin: 10px auto 24px; max-width: 460px; }
.upload-card .hint { margin-top: 14px; }

.how-it-works {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 760px;
  margin: 28px auto 0;
}
.how-it-works li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.how-it-works strong { display: block; font-size: 14px; font-weight: 600; }
.how-it-works span:not(.how-num) { display: block; font-size: 13px; color: var(--muted); }
.how-num {
  width: 24px; height: 24px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: #ebebe7; color: var(--text);
  font-size: 12px; font-weight: 600;
}

/* ------------------------------ Editor ----------------------------- */

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.stage {
  background: #101012;
  border: 1px solid #1e1e22;
  border-radius: var(--radius);
  padding: 28px 16px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.stage .preview-hint { color: #7a7a80; font-size: 12.5px; }

/* ------------------------------ Phone mock ------------------------- */

.phone {
  --screen-h: min(calc(100vh - 230px), 820px);
  --bezel: 10px;
  box-sizing: border-box;
  width: calc(var(--screen-h) * var(--phone-ratio, 0.462) + 2 * var(--bezel));
  max-width: 100%;
  background: #000;
  border-radius: 44px;
  padding: var(--bezel);
  box-shadow: 0 0 0 1.5px #2a2a2e, 0 24px 60px rgba(0, 0, 0, 0.55);
}
.phone--small { --screen-h: 560px; --bezel: 7px; border-radius: 30px; }

.phone-screen {
  position: relative;
  width: 100%;
  aspect-ratio: var(--phone-ratio, 0.462);
  background: #000;
  border-radius: 36px;
  overflow: hidden;
  container-type: inline-size;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  --pt: calc(100cqw / 390);
}
.phone--small .phone-screen { border-radius: 24px; }
#editorMock { cursor: grab; }
#editorMock.is-dragging { cursor: grabbing; }
#editorMock:focus-visible { box-shadow: inset 0 0 0 2px #fff; }

.mock-canvas {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Instagram chrome overlay. Everything is positioned in screen points
   (inline styles from app.js) and sized with --pt so it scales with the phone. */
.ig {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  color: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1;
}
.ig > * { position: absolute; display: flex; align-items: center; box-sizing: border-box; }

.ig-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #f5f5f5; }
.ig-icon svg { width: 100%; height: 100%; display: block; }
.ig-icon.ig-tab-dim { color: #8e8e8e; }

.ig-time { font-size: calc(17 * var(--pt)); font-weight: 600; letter-spacing: -0.01em; }
.ig-status-icons { justify-content: flex-end; gap: calc(5 * var(--pt)); }
.ig-battery {
  width: calc(27 * var(--pt)); height: calc(13 * var(--pt));
  border-radius: calc(4 * var(--pt));
  background: #f5f5f5; color: #000;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: calc(10 * var(--pt)); font-weight: 700;
  position: relative;
}
.ig-battery::after {
  content: ""; position: absolute; right: calc(-3 * var(--pt)); top: 50%; transform: translateY(-50%);
  width: calc(1.6 * var(--pt)); height: calc(5 * var(--pt)); background: #8e8e8e; border-radius: 0 1px 1px 0;
}

.ig-username { justify-content: center; gap: calc(4 * var(--pt)); font-size: calc(20 * var(--pt)); font-weight: 700; letter-spacing: -0.01em; }
.ig-username-text { max-width: calc(180 * var(--pt)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ig-chevron { color: #f5f5f5; }

.ig-slot { border-radius: 50%; box-shadow: inset 0 0 0 calc(1.2 * var(--pt)) #2c2c2e; }
.ig-slot--avatar { box-shadow: inset 0 0 0 calc(1 * var(--pt)) #2a2a2c; }
.ig-slot--ring { box-shadow: inset 0 0 0 calc(1.6 * var(--pt)) #3a3a3c; }
.ig-slot--tile { border-radius: 0; box-shadow: inset 0 0 0 1px #1a1a1c; justify-content: flex-end; align-items: flex-start; padding: calc(7 * var(--pt)); }
.ig-slot--mini { box-shadow: 0 0 0 calc(1.5 * var(--pt)) #f5f5f5; }
.ig-pin { color: #f5f5f5; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
.ig-tile-ghost { background: #0d0d0f; }

.ig-avatar-badge {
  border-radius: 50%; background: #f5f5f5; color: #000;
  justify-content: center; box-shadow: 0 0 0 calc(2.5 * var(--pt)) #000;
}
.ig-avatar-badge .ig-icon { color: #000; }

.ig-name { font-size: calc(17 * var(--pt)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ig-stats { gap: calc(18 * var(--pt)); align-items: flex-start; }
.ig-stat { display: flex; flex-direction: column; gap: calc(6 * var(--pt)); }
.ig-stat-num { font-size: calc(20 * var(--pt)); font-weight: 600; }
.ig-stat-label { font-size: calc(16 * var(--pt)); font-weight: 400; }
.ig-bio { font-size: calc(15 * var(--pt)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ig-followed { gap: calc(8 * var(--pt)); font-size: calc(13 * var(--pt)); color: #f5f5f5; white-space: nowrap; overflow: hidden; }
.ig-mutuals { display: inline-flex; flex-shrink: 0; }
.ig-mutual {
  width: calc(20 * var(--pt)); height: calc(20 * var(--pt)); border-radius: 50%;
  background: #3a3a3c; box-shadow: 0 0 0 calc(1.5 * var(--pt)) #000; margin-right: calc(-6 * var(--pt));
}
.ig-mutual:nth-child(2) { background: #4a4a4c; }
.ig-mutual:nth-child(3) { background: #2e2e30; }
.ig-followed-text { overflow: hidden; text-overflow: ellipsis; }
.ig-btn {
  background: #262628; border-radius: calc(10 * var(--pt));
  justify-content: center; font-size: calc(16 * var(--pt)); font-weight: 600; white-space: nowrap;
}
.ig-btn--follow { background: #0095f6; color: #fff; }
.ig-viewer { border-radius: 50%; background: #262628; justify-content: center; }
.ig-viewer .ig-icon { color: #8e8e8e; }
.ig-hl-label { justify-content: center; font-size: calc(14 * var(--pt)); white-space: nowrap; }
.ig-underline { background: #f5f5f5; border-radius: 1px; }
.ig-divider { background: #262628; }
.ig-bottom { background: #000; border-top: 1px solid #1e1e20; }
.ig-dot { background: #ff3040; border-radius: 50%; }
.ig-home-indicator { background: #f5f5f5; border-radius: 999px; }

/* ------------------------------ Controls --------------------------- */

.controls-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 20px;
}

/* Compact control groups: one head row (title, tooltip, inline control) + at most one body row. */
.cg { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.cg:last-child { border-bottom: 0; }
.cg--primary { background: #fafaf8; padding: 14px; }

/* Secondary options live behind a disclosure. */
.more { border-bottom: 0; }
.more > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  border-radius: 0 0 var(--radius) var(--radius);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 120ms;
}
.more[open] > summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
.more[open] > summary { border-bottom: 1px solid var(--border); border-radius: 0; }
.more > summary:hover { color: var(--text); }
.more .cg:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.cg-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.cg-head + * { margin-top: 8px; }
.cg-title { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.cg-head .file-name { flex: 1; margin: 0; text-align: right; font-size: 13px; }
.cg-head .segmented, .cg-head .toggle--right, .cg-head #zoomValue, .cg-head .btn { margin-left: auto; }
.cg-head .info + .segmented, .cg-head .info + .toggle--right { margin-left: auto; }

/* "?" tooltip: hover or focus on desktop, tap (focus) on touch. */
.info {
  position: relative; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: help; flex-shrink: 0;
}
.info:hover, .info:focus-visible { color: var(--text); border-color: var(--text); outline: none; }
.info::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 8px); z-index: 20;
  width: 240px; padding: 9px 11px; border-radius: 10px;
  background: #161616; color: #fff; font-size: 12.5px; font-weight: 400; line-height: 1.4; text-align: left; letter-spacing: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25); opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity 120ms, transform 120ms;
}
.info::before {
  content: ""; position: absolute; left: 5px; top: calc(100% + 3px); border: 5px solid transparent; border-bottom-color: #161616;
  opacity: 0; transition: opacity 120ms;
}
.info:hover::after, .info:focus::after, .info:hover::before, .info:focus::before { opacity: 1; transform: none; }

.file-name {
  font-size: 13px; color: var(--text); margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

#zoomValue { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.zoom-row { display: flex; align-items: center; gap: 8px; }
.row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.row-actions .btn-ghost { padding-left: 6px; padding-right: 6px; margin-left: -6px; }

.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.toggle--right { margin-left: auto; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; height: 24px; background: transparent; margin: 0; cursor: pointer;
}
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--border-strong); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 3px; background: var(--border-strong); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7.5px;
  border-radius: 50%; background: var(--panel); border: 1.5px solid var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--panel); border: 1.5px solid var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------ Export ----------------------------- */

.export-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 8px;
}
.export-header h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.export-header .lede { margin-top: 4px; max-width: 560px; }
.export-header .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.export-header .message { flex-basis: 100%; }
.ios-note {
  flex-basis: 100%; font-size: 13px; color: var(--muted); padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ios-note strong { color: var(--text); font-weight: 600; }

.export-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.export-preview {
  background: #101012; border: 1px solid #1e1e22; border-radius: var(--radius);
  padding: 16px; margin-top: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.export-preview h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #8e8e93; align-self: flex-start; }
.export-preview .phone--small { --screen-h: 490px; }

.asset-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  margin-top: 16px;
}
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h3 { font-size: 15px; font-weight: 600; }
.section-meta { color: var(--faint); font-size: 12.5px; }
.section-head .btn { margin-left: auto; }

.asset-row { display: flex; flex-wrap: wrap; gap: 20px; }

.asset-card { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 120px; }
.asset-card figure { margin: 0; }
.asset-card img { width: 100%; height: auto; border: 1px solid var(--border); background: #fff; }
.asset-card.is-round img { border-radius: 50%; }
.asset-card.is-large { width: 160px; }
.asset-card figcaption { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 6px; }
.asset-card .btn { width: 100%; }

.pin-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 2px; max-width: 480px; background: #000; padding: 0; }
.pin-strip { background: transparent; }
.pin-card { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pin-card figure { margin: 0; width: 100%; }
.pin-tile { display: block; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; background: #000; }
.pin-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin-card figcaption { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 6px; }
.pin-card figcaption strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.pin-card .btn { width: calc(100% - 16px); }

/* ------------------------------ Guide ------------------------------ */

.guide-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 640px;
  margin: 8px auto 0;
  padding: 24px 28px 24px;
}
.guide-progress { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.guide-card h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin-top: 6px; }
.guide-position {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ebebe7;
  font-size: 13px;
  font-weight: 600;
}

.guide-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 20px 0; }
.guide-preview img.round { width: 160px; height: 160px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; }
.guide-preview .caption { font-size: 12.5px; color: var(--muted); }

.pin-row-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: min(100%, 420px);
  background: #000;
  padding: 0;
}
.pin-row-preview .slot { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #000; }
.pin-row-preview .slot img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.28; transition: opacity 120ms; }
.pin-row-preview .slot.is-active img { opacity: 1; }
.pin-row-preview .slot.is-active { outline: 2px solid #fff; outline-offset: -2px; z-index: 1; }
.pin-row-preview .slot-label {
  position: absolute; left: 0; right: 0; bottom: 8px;
  text-align: center; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--faint);
}
.pin-row-preview .slot.is-active .slot-label { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }

.guide-steps { padding-left: 22px; display: grid; gap: 6px; font-size: 15px; }
.guide-steps code { font: 500 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: #f0f0ec; padding: 1px 6px; border-radius: 5px; }

.guide-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--border-strong);
  background: #fafaf8;
  color: var(--muted);
  font-size: 13.5px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.guide-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
}
.guide-nav { display: flex; gap: 8px; margin-left: auto; }

.checklist { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.checklist .check {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ok); color: #fff;
}
.checklist .check svg { width: 12px; height: 12px; }
.checklist li.is-skipped .check { background: #ebebe7; color: var(--muted); }
.checklist li.is-skipped .check svg { display: none; }
.checklist .status { color: var(--faint); font-size: 13px; margin-left: auto; }

.mock-wrap { display: flex; justify-content: center; margin: 14px 0 6px; padding: 20px; background: #101012; border-radius: var(--radius); }

/* ------------------------------ Responsive ------------------------- */

/* Mobile-only chrome is hidden on desktop. */
.mobile-bar, .sheet-head, .sheet-backdrop, .stage .stage-cta[data-when], .sample-strip { display: none; }

.toast {
  position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px);
  max-width: min(92vw, 420px); padding: 10px 14px; border-radius: 12px;
  background: #161616; color: #fff; font-size: 13.5px; line-height: 1.35;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3); opacity: 0; pointer-events: none;
  transition: opacity 160ms, transform 160ms; z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-btn {
  margin-left: 8px; border: 0; border-radius: 8px; padding: 5px 10px; background: #fff; color: #111;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.toast[data-kind="ok"] { background: var(--ok); }

/* Desktop, narrower windows: keep the five Highlight tiles on one row. */
.section-head h3 { white-space: nowrap; flex-shrink: 0; }
@media (min-width: 721px) and (max-width: 1040px) {
  .asset-row { gap: 16px; }
  .asset-card:not(.is-large) { width: calc(20% - 13px); }
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 50px;
    --toolbar-h: calc(60px + env(safe-area-inset-bottom, 0px));
  }
  html, body { overscroll-behavior-y: none; }
  body { touch-action: manipulation; }
  #app { padding: 0 0 16px; max-width: none; }
  body.view-edit #app { padding-bottom: var(--toolbar-h); }

  /* Top bar. */
  .app-header {
    position: sticky; top: 0; z-index: 5;
    display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px;
    height: var(--topbar-h); margin: 0;
    padding: 0 max(12px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .brand h1 { font-size: 16px; }
  .tagline { display: none; }
  .stepper { align-self: auto; padding: 2px; }
  .step { flex: none; font-size: 12.5px; padding: 5px 10px; }

  /* Editor: the mock is the screen. */
  .editor-layout { display: block; }
  .stage {
    position: relative;
    height: calc(100vh - var(--topbar-h) - var(--toolbar-h));
    height: calc(100dvh - var(--topbar-h) - var(--toolbar-h));
    background: #000; border: 0; border-radius: 0; padding: 0; box-shadow: none;
    justify-content: center; gap: 0; min-width: 0;
  }
  .stage .preview-hint, body.has-image .stage .preview-hint[data-when] { display: none; }
  .stage .phone {
    --bezel: 0px;
    width: auto; max-width: 100%; height: 100%; flex-shrink: 0;
    padding: 0; border-radius: 0; box-shadow: none; background: transparent;
    display: flex; align-items: center; justify-content: center;
  }
  /* Width is explicit and height follows from aspect-ratio. Deriving width
     from height does not work under inline-size containment in Safari. */
  .stage .phone-screen {
    width: min(100vw, calc((100vh - var(--topbar-h) - var(--toolbar-h)) * var(--phone-ratio, 0.462)));
    width: min(100vw, calc((100dvh - var(--topbar-h) - var(--toolbar-h)) * var(--phone-ratio, 0.462)));
    height: auto;
    aspect-ratio: var(--phone-ratio, 0.462);
    border-radius: 0;
  }
  body:not(.has-image) .stage .stage-cta[data-when] {
    display: block; position: absolute; left: 50%; bottom: calc(14px + 11%); transform: translateX(-50%);
    padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,0.92); color: #111;
    font-size: 13px; font-weight: 550; white-space: nowrap; pointer-events: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  }

  /* Sample strip under the mock: tap to try. */
  .stage { gap: 0; }
  .stage .phone { flex: 1 1 auto; min-height: 0; }
  .sample-strip {
    display: flex; align-items: center; gap: 10px; flex: 0 0 auto; width: 100%;
    padding: 8px 12px 10px; background: #000;
  }
  .sample-strip-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #8e8e93; flex-shrink: 0; }
  .sample-strip-items { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; min-width: 0; }
  .sample-strip-items::-webkit-scrollbar { display: none; }
  .sample-strip .idea { width: 44px; height: 44px; min-height: 44px; aspect-ratio: auto; flex: 0 0 44px; border-radius: 10px; border-color: #2a2a2c; }
  .sample-strip .idea:hover { border-color: #fff; }

  /* Bottom toolbar. */
  .mobile-bar {
    display: flex; gap: 6px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    height: var(--toolbar-h);
    padding: 6px max(10px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
    background: var(--panel); border-top: 1px solid var(--border);
  }
  .mb-btn {
    flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 14px; border: 0; border-radius: 12px;
    font-size: 14.5px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background 120ms, transform 60ms;
  }
  .mb-btn:active { transform: translateY(1px); }
  .mb-btn:disabled { opacity: 0.4; pointer-events: none; }
  .mb-icon { width: 20px; height: 20px; display: inline-flex; color: inherit; flex-shrink: 0; }
  .mb-icon svg { width: 100%; height: 100%; }
  .mb-btn--icon { flex: 0 0 44px; padding: 0; background: #ebebe7; color: var(--text); }
  .mb-btn--secondary { background: #ebebe7; color: var(--text); flex: 1.2; }
  .mb-btn--primary { background: var(--accent); color: #fff; flex: 1; }
  .mb-btn--primary:active { background: #000; }

  /* The controls panel becomes a bottom sheet. */
  .controls-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 8;
    max-height: 82vh; max-height: 82dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
    border-radius: 18px 18px 0 0; border-bottom: 0;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.28);
    transform: translateY(104%); transition: transform 240ms cubic-bezier(.2,.8,.2,1);
    overscroll-behavior: contain;
  }
  body.sheet-open .controls-panel { transform: none; }
  .sheet-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    position: sticky; top: 0; z-index: 1;
    padding: 8px 10px 8px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
    touch-action: none; cursor: grab;
  }
  .sheet-handle {
    position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong);
  }
  .sheet-title { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 6px; }
  .sheet-backdrop {
    display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 7;
    background: rgba(0,0,0,0.45); opacity: 0; pointer-events: none; transition: opacity 200ms;
  }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
  .cg { padding: 12px 16px; }
  .cg--primary { border-radius: 0; }
  .more .cg:last-child { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .info::after { width: min(260px, 80vw); }
  .controls-panel.is-swiping { transition: none; }
  .controls-panel:focus { outline: none; }
  .sheet-head, .sheet-head * { user-select: none; -webkit-user-select: none; }
  .desktop-only { display: none; }

  /* Touch targets. */
  .btn-small, .btn-ghost, .btn-icon, .seg, .step { min-height: 40px; }
  .seg { min-width: 40px; }
  #sheetCloseBtn { min-height: 40px; padding-left: 14px; padding-right: 14px; }
  .toggle { min-height: 40px; }
  .toggle input { width: 18px; height: 18px; }
  .idea { min-height: 64px; }

  /* Other views. */
  .export-header h2, .guide-card h2 { font-size: 20px; }
  .export-layout { grid-template-columns: minmax(0, 1fr); padding: 0 12px; }
  .export-header { padding: 16px 12px 0; }
  .export-preview { order: 1; }
  .phone--small { --screen-h: 480px; }
  .section-head { flex-wrap: wrap; }
  .asset-card { width: min(120px, calc(33.333% - 14px)); }
  .asset-card.is-large { width: 140px; }
  .guide-card { margin: 12px auto; padding: 18px 16px; max-width: min(640px, calc(100% - 24px)); }
  .how-it-works { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .brand h1 { font-size: 15px; }
  .step { padding: 5px 8px; font-size: 12px; }
  .mb-btn { font-size: 10.5px; }
}

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

/* ------------------------------ Landing / empty state --------------- */

[data-when="image"] { display: none; }
[data-when="empty"] { display: block; }
body.has-image [data-when="image"] { display: block; }
body.has-image [data-when="empty"] { display: none; }
body.has-image .cg[data-when="image"] { display: block; }


body:not(.has-image) #editorMock { cursor: pointer; }
.stage.is-dragover { outline: 2px solid #fff; outline-offset: -2px; }
.stage.is-dragover .phone { box-shadow: 0 0 0 1.5px #fff, 0 24px 60px rgba(0, 0, 0, 0.55); }

.cg:has(#zoomRange:disabled) { opacity: 0.5; }

.row-actions--wrap { justify-content: flex-start; flex-wrap: wrap; margin-top: 0; }
.row-btns { display: inline-flex; gap: 2px; }

.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.field-label { font-size: 13px; color: var(--muted); }
.segmented { display: inline-flex; background: #ebebe7; border-radius: 8px; padding: 2px; }
.seg {
  border: 0; background: transparent; color: var(--muted);
  min-width: 30px; height: 26px; padding: 0 8px; border-radius: 6px;
  font-size: 13px; font-weight: 550; cursor: pointer;
}
.seg[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.toggle--row { margin-top: 12px; }

/* ------------------------------ Idea images ------------------------ */

.ideas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.idea {
  position: relative; display: block; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: #000; cursor: pointer; aspect-ratio: 1 / 1;
  transition: border-color 120ms, transform 60ms;
}
.idea img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idea:hover { border-color: var(--text); }
.idea:active { transform: translateY(1px); }
.idea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.idea-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 5px 4px;
  font-size: 10.5px; font-weight: 550; color: #fff; text-align: left;
  background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ------------------------------ Separate profile picture ----------- */

.pfp-details { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.pfp-details[hidden] { display: none; }
.pfp-details .file-name { flex: 1; margin: 0; font-size: 12.5px; color: var(--muted); }
.pfp-details .row-btns { flex-shrink: 0; }
.pfp-thumb {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: #2a2a2c center / cover no-repeat; border: 1px solid var(--border);
  position: relative;
}
.pfp-thumb:not(.has-image)::before {
  content: ""; position: absolute; left: 50%; top: 32%; width: 10px; height: 10px; margin-left: -5px;
  border-radius: 50%; background: #8e8e8e;
}
.pfp-thumb:not(.has-image)::after {
  content: ""; position: absolute; left: 50%; top: 62%; width: 22px; height: 22px; margin-left: -11px;
  border-radius: 50%; background: #8e8e8e; clip-path: inset(0 0 50% 0);
}

.ig-pfp-badge {
  pointer-events: auto; cursor: pointer; border: 0; padding: 0;
  border-radius: 50%; background: #f5f5f5; color: #000;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 calc(2.5 * var(--pt)) #000;
  transition: background 120ms, transform 60ms;
}
.ig-pfp-badge .ig-icon { color: #000; }
.ig-pfp-badge:hover { background: #fff; }
.ig-pfp-badge:active { transform: scale(0.96); }
.ig-pfp-badge[aria-pressed="true"] { background: #0095f6; }
.ig-pfp-badge[aria-pressed="true"] .ig-icon { color: #fff; }
.ig-pfp-badge:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ------------------------------ Make your own artwork -------------- */

.chips { display: flex; flex-wrap: nowrap; gap: 5px; margin: 0 -14px 8px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; }
.chip {
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 550; cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.textarea {
  width: 100%; resize: vertical; min-height: 44px; margin-bottom: 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 11px;
  font-size: 13.5px; line-height: 1.45; background: var(--panel); color: var(--text);
}
.textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.textarea::placeholder { color: var(--faint); }
@media (max-width: 720px) { .chip { min-height: 36px; } }

/* ---------------------------------------------------------------------- */
/* Paywall: one-time unlock for the full profile set                       */
/* ---------------------------------------------------------------------- */

.paywall {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  background: rgba(22, 22, 22, 0.42);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  overscroll-behavior: contain;
}
.paywall[hidden], .paywall [hidden] { display: none !important; }
body.paywall-open { overflow: hidden; }

.paywall-card {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22), var(--shadow);
  padding: 26px 24px 20px;
}
.paywall-close {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.paywall-close:hover { background: #ebebe7; color: var(--text); }
.paywall-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.paywall-close svg { width: 18px; height: 18px; }

.paywall-head h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; margin: 0 28px 6px 0; }
.paywall-head .lede { font-size: 14.5px; line-height: 1.45; }
.paywall-head .lede strong { color: var(--text); font-weight: 650; }

.paywall-list {
  list-style: none; margin: 16px 0 18px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  font-size: 13.5px; line-height: 1.5; color: var(--muted);
}
.paywall-list li { position: relative; padding-left: 14px; }
.paywall-list li + li { margin-top: 4px; }
.paywall-list li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.paywall-list strong { color: var(--text); font-weight: 600; }

.paywall-loading { padding: 28px 0; text-align: center; color: var(--muted); font-size: 14px; }
.paywall-form #paymentElement { min-height: 40px; margin-bottom: 14px; }
.paywall-form .btn-block { margin-top: 2px; }
.paywall-form .message { margin-top: 10px; }
.paywall.is-busy .paywall-card { cursor: progress; }

.paywall-code-toggle {
  display: block; margin: 14px auto 0; padding: 4px 6px;
  border: 0; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.paywall-code-toggle:hover { color: var(--text); }
.paywall-code-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.paywall-code-row { display: flex; gap: 8px; margin-top: 10px; }
.paywall-code-row[hidden] { display: none; }
.paywall-code-row .text-input {
  flex: 1; min-width: 0; min-height: 40px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px;
  font-size: 14px; background: var(--panel); color: var(--text);
}
.paywall-code-row .text-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.paywall-code-row .text-input::placeholder { color: var(--faint); }

.paywall-fine { margin: 16px 0 0; font-size: 12px; line-height: 1.45; color: var(--faint); }

@media (max-width: 720px) {
  .paywall { align-items: flex-end; padding: 0; }
  .paywall-card { max-width: none; max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: no-preference) {
  .paywall-card { animation: paywall-in 180ms ease-out; }
  @keyframes paywall-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
