/* Affiliate Assistant — dark, creator-tool aesthetic. Phone-first (390px design target). */

:root {
  --bg: #0d0d12;
  --bg-card: #17171f;
  --bg-inset: #1f1f2a;
  --text: #f2f2f7;
  --text-dim: #a9a9bd;
  --accent: #2c7bfe;          /* coral blue */
  --accent-2: #25f4ee;        /* cyan counterpoint */
  --grad: linear-gradient(100deg, #2c7bfe, #4fd8ff);
  --amber: #ffb340;
  --green: #34d399;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display",
    "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(60vw 40vh at 85% -5%, rgba(44, 123, 254, .13), transparent 60%),
    radial-gradient(50vw 35vh at 0% 100%, rgba(37, 244, 238, .07), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 6px;
}
.logo { font-weight: 800; font-size: 17px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.logo-mark {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--grad); color: #fff; font-size: 15px;
  box-shadow: 0 2px 10px rgba(44, 123, 254, .45);
}
.mode-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-2); border: 1px solid rgba(37,244,238,.4);
  padding: 3px 9px; border-radius: 99px;
}

/* ---------- layout ---------- */
#main { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 10px 20px 24px; }
.view { animation: rise .35s cubic-bezier(.2,.8,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- input view ---------- */
.hero {
  font-size: clamp(34px, 9vw, 44px); line-height: 1.05; font-weight: 800;
  letter-spacing: -.03em; margin: 26px 0 12px;
}
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--text-dim); font-size: 15px; line-height: 1.5; margin-bottom: 26px; }

.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg-card); border: 1.5px solid #2c2c3a;
  border-radius: var(--radius); padding: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.field select { appearance: none; -webkit-appearance: none; }
.field select:has(option[value=""]:checked) { color: var(--text-dim); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(44,123,254,.18);
}
.field textarea { resize: vertical; min-height: 120px; }

.link-btn {
  background: none; border: none; color: var(--accent-2); font: inherit;
  font-size: 14px; font-weight: 600; padding: 12px 4px; cursor: pointer;
}
.hint { color: var(--text-dim); font-size: 13px; margin-top: 8px; line-height: 1.45; }
.hint.center { text-align: center; }

.fallback-note {
  background: rgba(255,179,64,.1); border: 1px solid rgba(255,179,64,.35);
  color: var(--amber); border-radius: 14px; padding: 12px 14px;
  font-size: 14px; line-height: 1.45; margin: 4px 0 10px;
  animation: rise .3s both;
}

/* ---------- primary button ---------- */
.cta {
  width: 100%; margin-top: 14px; padding: 17px;
  font: inherit; font-size: 17px; font-weight: 800; letter-spacing: -.01em;
  color: #fff; background: var(--grad); border: none; border-radius: var(--radius);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 24px rgba(44,123,254,.35);
  transition: transform .12s, box-shadow .2s, filter .2s;
  -webkit-tap-highlight-color: transparent;
}
.cta:active { transform: scale(.97); }
.cta:disabled { filter: grayscale(.6) brightness(.7); box-shadow: none; }
.cta-arrow { transition: transform .2s; }
.cta:hover .cta-arrow { transform: translateX(4px); }

.ghost-btn {
  width: 100%; margin-top: 18px; padding: 14px;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--text-dim);
  background: none; border: 1.5px solid #2c2c3a; border-radius: var(--radius); cursor: pointer;
}

/* ---------- loading ---------- */
.loader-card { text-align: left; padding: 60px 8px; }
.pulse-ring {
  width: 54px; height: 54px; margin: 0 auto 34px; border-radius: 50%;
  border: 3px solid rgba(44,123,254,.25); border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; max-width: 280px; margin: 0 auto 20px; display: grid; gap: 16px; }
.steps li {
  color: var(--text-dim); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 12px; transition: color .3s;
}
.steps li::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: #2c2c3a; flex: none; transition: background .3s, box-shadow .3s;
}
.steps li.active { color: var(--text); }
.steps li.active::before { background: var(--accent); box-shadow: 0 0 10px rgba(44,123,254,.7); }
.steps li.done { color: var(--green); }
.steps li.done::before { background: var(--green); }

/* ---------- results ---------- */
.card {
  background: var(--bg-card); border: 1px solid #23232f;
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
#resultsView .card { animation: rise .4s cubic-bezier(.2,.8,.3,1) both; }
#resultsView .card:nth-child(2) { animation-delay: .08s; }
#resultsView .card:nth-child(3) { animation-delay: .16s; }

.product-card .p-name { font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.p-meta { color: var(--text-dim); font-size: 14px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.p-price { color: var(--accent-2); font-weight: 700; }
.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap;
}
.badge.link { background: rgba(37,244,238,.12); color: var(--accent-2); }
.badge.paste { background: rgba(255,179,64,.12); color: var(--amber); }

/* collapsible sections */
.section > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 800; letter-spacing: -.01em;
  -webkit-tap-highlight-color: transparent;
}
.section > summary::-webkit-details-marker { display: none; }
.sec-ico { font-size: 18px; }
.count { color: var(--text-dim); font-weight: 600; font-size: 14px; }
.chev { margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim); transform: rotate(45deg); transition: transform .25s; }
details[open] .chev { transform: rotate(-135deg); }

/* ingredient cards */
.ing-list { display: grid; gap: 10px; margin-top: 16px; }
.ing {
  background: var(--bg-inset); border-radius: 14px; padding: 14px;
}
.ing > summary {
  list-style: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ing > summary::-webkit-details-marker { display: none; }
.ing-chev {
  margin-left: auto; flex-shrink: 0; width: 8px; height: 8px;
  border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg); transition: transform .25s; align-self: center;
}
.ing[open] .ing-chev { transform: rotate(-135deg); }
.expand-all { margin-top: 12px; font-size: 13px; }
.ing-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ing-name { font-weight: 800; font-size: 15px; }
.ing-pron { color: var(--text-dim); font-size: 13px; font-style: italic; }
.ing-say { background: none; border: none; padding: 0 2px; font-size: 15px;
  line-height: 1; cursor: pointer; }
.ing-expl { font-size: 14px; line-height: 1.5; color: var(--text); margin-top: 6px; }
.ing-angle { font-size: 13px; line-height: 1.5; color: var(--text-dim); margin-top: 5px; }
.ing-angle b { color: var(--accent-2); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px;
  background: rgba(37,244,238,.1); color: var(--accent-2);
}
.chip.flag { background: rgba(255,179,64,.13); color: var(--amber); }
.chip.flag::before { content: "⚠ "; }

/* hook ideas */
.hooks-hint { margin-top: 12px; }
.hook-list { display: grid; gap: 10px; margin-top: 12px; }
.hook {
  background: var(--bg-inset); border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.hook-text { flex: 1; font-size: 14.5px; line-height: 1.5; margin: 0; }
.hook-copy {
  flex-shrink: 0; font-size: 12px; font-weight: 700; padding: 6px 12px;
  border-radius: 99px; border: 1px solid rgba(37,244,238,.35);
  background: transparent; color: var(--accent-2); cursor: pointer;
}

/* caption + hashtags */
.caption-block {
  background: var(--bg-inset); border-radius: 14px; padding: 14px;
  margin-top: 16px;
}
.caption-block p { margin: 0; font-size: 15px; line-height: 1.6; }
.hashtags { color: var(--accent-2); font-size: 14px; margin-top: 10px !important; }
.caption-btns { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* script */
.script-block {
  background: var(--bg-inset); border-radius: 14px; padding: 16px;
  font-size: 15.5px; line-height: 1.65; white-space: pre-wrap; margin-top: 16px;
  border-left: 3px solid var(--accent);
}
.script-block.original { border-left-color: #2c2c3a; color: var(--text-dim); }

/* CTA line badge + the arrow hint below that points at it */
.cta-line {
  display: inline-block;
  background: rgba(44,123,254,.08);
  border: 1px dashed rgba(44,123,254,.5);
  border-radius: 10px;
  padding: 9px 12px;
}
.cta-line::before {
  content: "CTA";
  display: inline-block;
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em;
  color: var(--accent);
  background: rgba(44,123,254,.14);
  border-radius: 6px;
  padding: 2px 7px;
  margin-right: 8px;
  vertical-align: 1px;
}
.cta-hint { display: flex; align-items: baseline; gap: 7px; }
.cta-hint-arrow { color: var(--accent); font-size: 16px; font-weight: 800; }
.cta-hint .cta-word { color: var(--accent); font-weight: 700; }
.copy-btn { margin-top: 12px; }
.copy-btn.copied { background: var(--green); box-shadow: 0 6px 24px rgba(52,211,153,.3); }

/* claims */
.claims {
  margin-top: 14px; background: rgba(255,179,64,.07);
  border: 1px solid rgba(255,179,64,.3); border-radius: 14px;
}
.claims summary {
  list-style: none; cursor: pointer; padding: 14px;
  font-weight: 700; font-size: 15px; color: var(--amber);
  display: flex; align-items: center; gap: 8px;
}
.claims summary::-webkit-details-marker { display: none; }
.claims-body { padding: 0 14px 14px; display: grid; gap: 12px; }
.claim { font-size: 14px; line-height: 1.5; }
.claim .risky { color: var(--amber); font-weight: 700; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.claim .why { color: var(--text-dim); font-size: 13px; display: block; margin: 2px 0; }
.claim .safer { color: var(--green); font-weight: 600; }
.claim .chip.flag { margin: 2px 0; }
.claim.unresolved .risky { text-decoration: none; }

/* backstop catches left in the text for the creator to rephrase */
mark.needs-review {
  background: rgba(255, 176, 32, 0.16);
  color: var(--amber);
  border-bottom: 2px dotted var(--amber);
  border-radius: 3px;
  padding: 0 3px;
}
.claims-clean {
  margin-top: 14px; padding: 13px 14px; border-radius: 14px; font-size: 14px;
  background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.3); color: var(--green);
}

/* footer */
.foot {
  text-align: center; color: #62627a; font-size: 12px; line-height: 1.5;
  padding: 12px 24px calc(16px + var(--safe-bot)); max-width: 520px; margin: 0 auto;
}

/* wider screens: just keep the column centered, slightly airier */
@media (min-width: 700px) {
  #main { padding-top: 32px; }
}

/* tall desktop screens: denser stack so sections need less scrolling */
@media (min-width: 900px) {
  .card { padding: 16px 18px; margin-bottom: 12px; }
  .ing-list, .hook-list { gap: 8px; }
}

/* ================= SaaS v1 additions ================= */

/* top bar: usage + logout */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.usage-pill {
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--text-dim); border: 1px solid #2c2c3a;
  padding: 4px 10px; border-radius: 99px; background: var(--bg-card);
}
.usage-pill.maxed { color: var(--amber); border-color: rgba(255,179,64,.45); }
.trial-pill {
  cursor: pointer; font: inherit; font-size: 12px;
  color: var(--amber); border-color: rgba(255,179,64,.45);
  background: rgba(255,179,64,.08);
}
.trial-pill:hover { background: rgba(255,179,64,.16); }
.logout-btn {
  background: none; border: 1px solid #2c2c3a; color: var(--text-dim);
  width: 30px; height: 30px; border-radius: 10px; cursor: pointer;
  font-size: 14px; display: grid; place-items: center;
}

/* auth */
.auth-toggle { display: block; margin: 8px auto 0; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 18px 0 14px;
  color: var(--text-dim); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: #2c2c3a;
}
.google-btn-wrap { display: flex; justify-content: center; min-height: 44px; }
.support-link { color: var(--accent-2); text-decoration: none; }

/* paywall */
.paywall-card { padding: 24px 20px; }
.paywall-price { font-size: 40px; font-weight: 800; letter-spacing: -.03em; }
.paywall-price .per { font-size: 16px; font-weight: 600; color: var(--text-dim); }
.paywall-list { list-style: none; padding: 0; margin: 16px 0 8px; display: grid; gap: 10px; }
.paywall-list li { font-size: 15px; line-height: 1.4; padding-left: 26px; position: relative; }
.paywall-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }

/* tab bar */
.tabbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; max-width: 520px; margin: 0 auto; width: 100%;
  background: rgba(13,13,18,.92); backdrop-filter: blur(12px);
  border-top: 1px solid #23232f;
  padding: 6px 10px calc(6px + var(--safe-bot));
}
.tab {
  flex: 1; background: none; border: none; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--text-dim);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0; border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}
.tab-ico { font-size: 20px; }
.tab.active { color: var(--text); }

/* samples */
.view-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 18px 0 8px; }
.add-sample-btn { margin-bottom: 14px; }
.sample-form { display: grid; gap: 10px; }
.date-row { display: flex; gap: 10px; }
.date-field {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--text-dim);
  display: grid; gap: 6px;
}
.date-field input {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--bg-inset); border: 1.5px solid #2c2c3a;
  border-radius: 12px; padding: 12px;
  color-scheme: dark;
}
.sample-form-btns { display: grid; gap: 4px; }
.sample-form-btns .cta { margin-top: 0; }
.sample-form-btns .ghost-btn { margin-top: 6px; }

.sample-list { display: grid; gap: 12px; }
.sample-card { margin-bottom: 0; }
.sample-card.posted, .sample-card.archived { opacity: .65; }
.sample-main { cursor: pointer; }
.sample-head { display: flex; align-items: center; gap: 10px; }
.sample-name { font-size: 16px; font-weight: 800; letter-spacing: -.01em; flex: 1; line-height: 1.3; }
.sample-meta {
  color: var(--text-dim); font-size: 13px; margin-top: 6px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.sample-meta .linked { color: var(--green); font-weight: 600; }
.due-pill {
  flex-shrink: 0; font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; padding: 4px 10px; border-radius: 99px; white-space: nowrap;
}
.due-pill.red { background: rgba(44,123,254,.15); color: var(--accent); }
.due-pill.amber { background: rgba(255,179,64,.14); color: var(--amber); }
.due-pill.green { background: rgba(52,211,153,.12); color: var(--green); }
.due-pill.done-pill { background: rgba(52,211,153,.12); color: var(--green); }
.due-pill.arch-pill { background: #23232f; color: var(--text-dim); }
.sample-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mini-btn {
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 7px 13px;
  border-radius: 99px; cursor: pointer; background: transparent;
  border: 1px solid #2c2c3a; color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.mini-btn.primary { border-color: rgba(37,244,238,.4); color: var(--accent-2); }
.mini-btn.dim { color: var(--text-dim); }

/* analyzing-for-sample banner */
.sample-context {
  background: rgba(37,244,238,.08); border: 1px solid rgba(37,244,238,.3);
  color: var(--text); border-radius: 14px; padding: 11px 14px;
  font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}
.sample-context b { flex: 1; }
.sample-context .link-btn { padding: 0 4px; }

/* author display rules must never beat the hidden attribute */
[hidden] { display: none !important; }

/* ---------- plan cards (paywall) ---------- */
.plan-grid { display: grid; gap: 14px; }
.plan-name { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px; }
.pro-card { border: 1px solid var(--coral, #ff6b5e); position: relative; }
.pro-badge { font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; background: var(--coral, #ff6b5e); color: #fff;
  border-radius: 999px; padding: 2px 8px; }
.ghost-cta { background: transparent; border: 1px solid rgba(255,255,255,.25);
  color: inherit; }

/* ---------- ingredient images (Pro) ---------- */
.photo-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.photo-btn { margin: 0; }
.photo-preview { width: 56px; height: 56px; object-fit: cover;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.15); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-top: 14px; }
.gen-img { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gen-img img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: #16161d; }
.gen-img figcaption { font-size: 0.8rem; opacity: 0.85; text-align: center; }
.dl-btn { text-align: center; text-decoration: none; display: block; }

/* ---------- landing (logged-out authView) ---------- */
.land-ctas { margin: 18px 0 26px; }
.inline-link { display: inline; padding: 0; font: inherit; text-decoration: underline; }
.land-features { display: grid; gap: 12px; margin: 26px 0; }
@media (min-width: 560px) { .land-features { grid-template-columns: 1fr 1fr; } }
.land-feat { padding: 16px; }
.land-feat .feat-ico { font-size: 1.6rem; margin-bottom: 6px; }
.land-feat b { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.land-feat p { margin: 0; font-size: 0.9rem; opacity: 0.8; line-height: 1.45; }
.land-title { font-size: 1.25rem; margin: 30px 0 12px; text-align: center; }

/* ---------- niche profile pills ---------- */
.niche-pills {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin: 4px 0 16px;
}
.niche-pill {
  background: var(--bg-card); color: var(--text-dim);
  border: 1px solid rgba(255,255,255,.1); border-radius: 99px;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 14px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.niche-pill.active {
  color: var(--text); border-color: var(--accent);
  background: rgba(44,123,254,.14);
}

/* ---------- share-sheet shortcut promo ---------- */
.promo-card { padding: 14px 16px; margin-bottom: 14px; }
.promo-text { font-size: 0.9rem; line-height: 1.45; opacity: 0.9; margin-bottom: 10px; }
.promo-btns { display: flex; gap: 8px; }
.promo-btns .mini-btn { text-decoration: none; }

/* ---------- clipboard catch banner ---------- */
.clip-banner { margin: 0 0 14px; text-align: center; }
.clip-btn {
  background: rgba(37,244,238,.1); color: var(--accent-2);
  border: 1px solid rgba(37,244,238,.4); border-radius: 99px;
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; cursor: pointer;
  transition: background .15s;
}
.clip-btn:active { background: rgba(37,244,238,.2); }

/* ---------- tutorial video modal ---------- */
.video-modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.82);
  display: grid; place-items: center; padding: 18px; }
.vm-box { position: relative; width: min(84vw, 45vh, 340px); }
.vm-box video { width: 100%; aspect-ratio: 384 / 848; border-radius: 16px;
  background: #000; display: block; border: 1px solid rgba(255,255,255,.15); }
.vm-close { position: absolute; top: -14px; right: -14px; width: 32px; height: 32px;
  border-radius: 50%; border: none; background: #fff; color: #000; font-size: .9rem;
  font-weight: 700; cursor: pointer; z-index: 1; }
