/* One stylesheet (SPEC §7.5): dark theme, CSS variables, system fonts, mobile-first.
   Designed at 375px wide; scales up to a centred 480px column. */

:root {
  --bg: #0d0716;
  --bg-2: #160d26;
  --card: #1c1230;
  --card-2: #251940;
  --line: rgba(255, 255, 255, .1);
  --text: #f6f2ff;
  --muted: #b6a9cf;
  --accent: #ff3d77;
  --accent-2: #7b2ff7;
  --ok: #7dffb0;
  --warn: #ffd84d;
  --danger: #ff6b6b;
  --radius: 22px;
  --radius-sm: 14px;
  --gutter: 16px;
  --col: 480px;
  --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --grad: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(120% 60% at 50% 0%, #2a1247 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, p, ol, ul { margin: 0; }
h1 { font-size: clamp(34px, 10vw, 46px); line-height: 1.02; letter-spacing: -.03em; font-weight: 800; }
h2 { font-size: 22px; line-height: 1.2; letter-spacing: -.01em; font-weight: 800; }
b { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: #000; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--warn); outline-offset: 3px; }

main, .topbar, .footer { width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 var(--gutter); }
main { display: flex; flex-direction: column; gap: 20px; padding-bottom: 32px; }

/* Top bar */
.topbar { display: flex; align-items: center; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { display: block; width: 28px; height: 28px; filter: drop-shadow(0 0 10px rgba(255, 61, 119, .45)); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 12px 20px; border-radius: 999px; border: 0;
  font: 700 16px/1.2 var(--font); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .12s ease, opacity .12s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 30px rgba(255, 61, 119, .3); }
.btn-secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-big { width: 100%; min-height: 56px; font-size: 17px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* Hero */
.hero { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; }
.eyebrow { align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: var(--warn); }
.hero h1 { background: linear-gradient(90deg, #fff 30%, #ffc2d6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: 18px; color: var(--muted); }
.hero-note { font-size: 14px; color: var(--muted); text-align: center; }

/* Horizontal rails (demo + results carousel): CSS scroll-snap, swipeable */
.rail {
  display: flex; gap: 12px; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 12px;
  list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item { flex: 0 0 62%; max-width: 260px; scroll-snap-align: center; }
.rail-item img, .slide img, .teaser {
  width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 18px; background: var(--card);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}
.demo-note { margin-top: -4px; font-size: 14px; color: var(--muted); text-align: center; }

/* How-to tabs */
.howto { display: flex; flex-direction: column; gap: 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: var(--bg-2); border-radius: 999px; }
.tab { min-height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  font: 700 15px/1 var(--font); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--card-2); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.steps { display: flex; flex-direction: column; gap: 10px; padding-left: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding-left: 40px; min-height: 28px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -1px; width: 28px; height: 28px;
  border-radius: 50%; background: var(--card-2); color: var(--warn); font-weight: 800; font-size: 14px;
  display: grid; place-items: center; }
.js .steps[aria-hidden="true"] { display: none; }

/* Upload */
.upload { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 12px; }
.state { display: none; flex-direction: column; gap: 14px; }
.upload-form[data-state="idle"] .state-idle,
.upload-form[data-state="uploading"] .state-uploading,
.upload-form[data-state="processing"] .state-processing,
.upload-form[data-state="error"] .state-error { display: flex; }
.state-title { font-size: 18px; font-weight: 800; }
.drop { position: relative; display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 16px;
  border: 2px dashed rgba(255, 255, 255, .22); border-radius: var(--radius-sm); background: var(--bg-2); cursor: pointer; }
.drop:focus-within { border-color: var(--warn); }
.drop.has-file { border-style: solid; border-color: var(--ok); }
.drop-icon { font-size: 28px; }
.drop-text { overflow-wrap: anywhere; }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.consent input { flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }
.progress { height: 12px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s ease; }
.state-processing, .results-loading { align-items: center; text-align: center; }
.state-error [data-error-text] { color: var(--text); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .15);
  border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } html { scroll-behavior: auto; } }

.privacy-strip { padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(125, 255, 176, .08);
  border: 1px solid rgba(125, 255, 176, .25); font-size: 15px; }

/* Footer */
.footer { padding-top: 12px; padding-bottom: calc(28px + var(--safe-bottom)); color: var(--muted); font-size: 14px; text-align: center; }
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-bottom: 8px; }
.footer a { display: inline-block; padding: 8px 0; text-decoration: none; }
.footer a:hover { color: var(--text); }

/* Results */
.page-results main { padding-bottom: calc(110px + var(--safe-bottom)); }  /* room for the sticky CTA */
.results { display: flex; flex-direction: column; gap: 18px; }
.results > div { display: none; }
.results[data-state="loading"] .results-loading,
.results[data-state="expired"] .results-expired,
.results[data-state="ready"] .results-ready { display: flex; flex-direction: column; gap: 18px; }
.results-loading { padding: 60px 0; gap: 14px; }
.results-expired { gap: 14px; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.results-title { font-size: 28px; }
.carousel { position: relative; }
.rail-results .slide { flex: 0 0 78%; max-width: 360px; scroll-snap-align: center; }
.teaser { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; padding: 20px; text-align: center; color: #fff; }
.teaser::before { content: ""; position: absolute; inset: -30px; filter: blur(26px); opacity: .9;
  background: var(--teaser, var(--grad)); }
.teaser::after { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.12) 0 18px, transparent 18px 44px); filter: blur(6px); }
.teaser > * { position: relative; z-index: 1; }
.teaser-lock { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(0, 0, 0, .35); font-size: 30px; }
.teaser-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.teaser-sub { font-size: 14px; opacity: .85; }
.carousel-nav { display: none; }
@media (hover: hover) and (pointer: fine) {
  .carousel-nav { display: flex; justify-content: space-between; position: absolute; inset: 40% -6px auto; pointer-events: none; }
  .nav-btn { pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
    background: rgba(13, 7, 22, .8); color: var(--text); font-size: 26px; cursor: pointer; }
}
.paid-actions { display: grid; gap: 10px; }
.notice { border-color: rgba(255, 216, 77, .4); background: rgba(255, 216, 77, .08); font-size: 15px; }
.confirming { flex-direction: row; align-items: center; gap: 14px; }
.confirming .spinner { width: 28px; height: 28px; border-width: 3px; flex: 0 0 auto; }
.danger-zone { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin-top: 6px; }
.results-note { text-align: center; font-size: 14px; }

.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px var(--gutter) calc(12px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(13, 7, 22, 0) 0%, rgba(13, 7, 22, .92) 30%, var(--bg) 100%); }
.sticky-cta .btn { max-width: calc(var(--col) - 2 * var(--gutter)); margin: 0 auto; display: flex; }
.results[data-state="ready"] .sticky-cta:not([hidden]) { display: block; }

/* Legal pages */
.legal { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.legal h2 { font-size: 19px; margin-top: 10px; }
.legal ul, .legal ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.legal p, .legal li { color: #e4dcf5; overflow-wrap: anywhere; }
.legal a { color: var(--warn); }
.legal-summary { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); }
.legal-contact { margin-top: 8px; }

.notfound { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }

@media (min-width: 720px) {
  main { padding-top: 12px; }
  .rail-item { flex-basis: 40%; }
}
