/* NicheLabs — dark, tool-register UI
   Palette in OKLCH. Brand: indigo primary + a restrained gold "die-pip" spark. */

:root {
  /* surfaces (cool near-black ramp) */
  --bg:            oklch(0.158 0.008 268);
  --surface:       oklch(0.202 0.010 268);
  --surface-2:     oklch(0.242 0.012 268);
  --surface-hi:    oklch(0.285 0.013 268);
  --border:        oklch(0.320 0.014 268);
  --border-strong: oklch(0.410 0.016 268);

  /* ink ramp */
  --ink:      oklch(0.972 0.004 268);
  --ink-dim:  oklch(0.820 0.008 268);
  --muted:    oklch(0.680 0.012 268);
  --faint:    oklch(0.560 0.012 268);

  /* brand */
  --primary:        oklch(0.635 0.190 274);
  --primary-bright: oklch(0.710 0.170 274);
  --primary-dim:    oklch(0.635 0.190 274 / 0.16);
  --primary-ink:    oklch(0.985 0.010 274);
  --ring:           oklch(0.710 0.170 274 / 0.55);

  /* gold spark — used sparingly (mark, accents) */
  --gold:      oklch(0.820 0.130 86);
  --gold-dim:  oklch(0.820 0.130 86 / 0.14);

  /* semantic */
  --ok:      oklch(0.760 0.150 156);
  --ok-dim:  oklch(0.760 0.150 156 / 0.14);
  --danger:      oklch(0.680 0.185 24);
  --danger-dim:  oklch(0.680 0.185 24 / 0.14);

  /* type */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "Consolas", monospace;

  /* scale (fixed rem — product register) */
  --step--1: 0.82rem;
  --step-0:  0.95rem;
  --step-1:  1.08rem;
  --step-2:  1.35rem;
  --step-3:  1.72rem;
  --step-4:  2.15rem;

  /* geometry */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow: 0 1px 2px oklch(0 0 0 / 0.4), 0 8px 24px oklch(0 0 0 / 0.28);
  --shadow-lg: 0 20px 60px oklch(0 0 0 / 0.45);

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* ease-out-quint-ish */
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1); /* strong ease-out for reveals */
  --dur: 200ms;

  /* z-scale */
  --z-sticky: 20;
  --z-toast: 60;

  --maxw: 40rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

/* ambient backdrop glow — subtle, behind everything */
.aura {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 78% -8%, oklch(0.635 0.190 274 / 0.16), transparent 70%),
    radial-gradient(50% 34% at 8% 4%, oklch(0.820 0.130 86 / 0.06), transparent 70%);
  pointer-events: none;
}

/* ───────────────── top bar ───────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 5vw, 28px);
  background: oklch(0.158 0.008 268 / 0.72);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand__mark { color: var(--primary-bright); flex: none; }
.brand__text { font-size: var(--step-1); font-weight: 560; }
.brand__text b { font-weight: 760; }
.brand__beta {
  align-self: center;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--primary-bright);
  background: var(--primary-dim);
  border: 1px solid oklch(0.635 0.190 274 / 0.4);
  padding: 3px 6px;
  border-radius: var(--r-pill);
}
.topbar__tag {
  font-size: var(--step--1);
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid oklch(0.680 0.185 24 / 0.4);
  padding: 3px 10px;
  border-radius: var(--r-pill);
}

/* ───────────────── stepper ───────────────── */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px 4px;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
}
.step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 6px 4px;
  color: var(--faint);
  font: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.step__dot {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted);
  transition: all var(--dur) var(--ease);
}
.step__line { flex: 1; max-width: 44px; height: 1px; background: var(--border); }
.step:hover { color: var(--ink-dim); }
/* locked steps look disabled and aren't invited to be clicked */
.step.is-locked { opacity: 0.4; cursor: not-allowed; }
.step.is-locked:hover { color: var(--faint); }
.step.is-locked .step__dot { border-style: dashed; background: none; color: var(--faint); }
.step[aria-current="true"] { color: var(--ink); }
.step[aria-current="true"] .step__dot {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
  box-shadow: 0 0 0 4px var(--primary-dim);
}
.step.is-done .step__dot {
  background: var(--ok-dim);
  border-color: oklch(0.760 0.150 156 / 0.5);
  color: var(--ok);
}
.step.is-done .step__label { color: var(--ink-dim); }
@media (max-width: 380px) { .step__label { display: none; } }

/* ───────────────── stage / views ───────────────── */
.stage {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px clamp(16px, 5vw, 28px) 40px;
}
.view { display: none; }
.view.is-active { display: block; animation: viewIn 360ms var(--ease) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.view__head { margin: 18px 0 22px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.display {
  margin: 0 0 10px;
  font-size: var(--step-4);
  line-height: 1.08;
  font-weight: 680;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.lede { margin: 0; color: var(--muted); max-width: 46ch; }

/* back-to-dashboard link (dashboard-edit mode) */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 6px 0 -4px;
  color: var(--muted); font-size: var(--step--1); text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.back-link:hover { color: var(--ink); }

/* ───────────────── cards & callouts ───────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.callout {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--step--1);
}
.callout svg { color: var(--primary-bright); flex: none; }

/* ───────────────── buttons ───────────────── */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--ink);
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 560;
  font-size: var(--step-0);
  padding: 11px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur);
}
.btn:hover { background: var(--surface-hi); }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--primary {
  --btn-bg: var(--primary);
  --btn-fg: var(--primary-ink);
  border-color: transparent;
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.14) inset, 0 6px 18px oklch(0.635 0.190 274 / 0.35);
}
.btn--primary:hover { --btn-bg: var(--primary-bright); }
.btn--soft { --btn-bg: var(--primary-dim); --btn-fg: var(--primary-bright); border-color: transparent; }
.btn--soft:hover { --btn-bg: oklch(0.635 0.190 274 / 0.26); }
.btn--ghost { --btn-bg: transparent; border-color: var(--border); color: var(--ink-dim); }
.btn--link {
  background: none; border: 0; color: var(--muted); padding: 8px 2px;
  font-size: var(--step--1); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}
.btn--link:hover { color: var(--ink-dim); }
.btn--sm { padding: 6px 11px; font-size: var(--step--1); border-radius: var(--r-sm); }
.btn--block { display: flex; width: 100%; margin-top: 20px; padding: 14px; }
.btn--run { font-size: var(--step-1); font-weight: 640; }
.btn__arrow { transition: transform var(--dur) var(--ease); }
.btn:hover .btn__arrow { transform: translateX(3px); }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label::after {
  content: ""; display: inline-block; width: 15px; height: 15px; margin-left: 10px;
  vertical-align: -2px;
  border: 2px solid oklch(1 0 0 / 0.35); border-top-color: var(--primary-ink);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────────── profile card ───────────────── */
.profile-card { display: grid; gap: 16px; }
.profile-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-card__summary { margin: 0; color: var(--ink-dim); }
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; }
@media (min-width: 520px) { .profile-grid { grid-template-columns: 1fr 1fr; } }
.profile-grid > div { min-width: 0; }
.profile-grid dt {
  font-size: var(--step--1); color: var(--faint); text-transform: uppercase;
  letter-spacing: 0.03em; margin-bottom: 3px; font-weight: 600;
}
.profile-grid dd { margin: 0; color: var(--ink); font-size: var(--step-0); }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--step--1); font-weight: 560;
  padding: 4px 11px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.chip--ok { background: var(--ok-dim); border-color: oklch(0.760 0.150 156 / 0.4); color: var(--ok); }
.chip--warn { background: var(--gold-dim); border-color: oklch(0.820 0.130 86 / 0.4); color: var(--gold); }

/* ───────────────── chat interview ───────────────── */
.chat { display: flex; flex-direction: column; gap: 16px; }
.chat__log { display: flex; flex-direction: column; gap: 12px; min-height: 40px; }
.bubble {
  max-width: 84%;
  padding: 12px 15px;
  border-radius: var(--r-lg);
  line-height: 1.5;
  animation: bubbleIn 320ms var(--ease) both;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bubble--bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
}
.bubble--me {
  align-self: flex-end;
  background: var(--primary);
  color: var(--primary-ink);
  border-bottom-right-radius: 5px;
}
.bubble--typing { display: inline-flex; gap: 5px; padding: 15px; }
.bubble--typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite both;
}
.bubble--typing i:nth-child(2) { animation-delay: 0.2s; }
.bubble--typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.composer {
  position: sticky;
  bottom: 12px;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.composer__input {
  flex: 1; min-width: 0;
  background: none; border: 0; color: var(--ink);
  font: inherit; padding: 8px 10px;
}
.composer__input::placeholder { color: var(--faint); }
.composer__input:focus { outline: none; }
.composer__send { padding: 10px 13px; flex: none; }

/* ───────────────── handle input ───────────────── */
.field__label {
  display: block; font-size: var(--step--1); color: var(--muted);
  font-weight: 560; margin-bottom: 8px;
}
.handle-add {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: 4px 4px 4px 12px;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.handle-add:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.handle-add__at { color: var(--faint); font-weight: 600; }
.handle-add__input {
  flex: 1; min-width: 0; background: none; border: 0; color: var(--ink);
  font: inherit; padding: 9px 0;
}
.handle-add__input:focus { outline: none; }
.handle-add__input::placeholder { color: var(--faint); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.handle-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); font-size: var(--step--1); color: var(--ink-dim);
  animation: bubbleIn 260ms var(--ease) both;
}
.handle-chip b { color: var(--ink); font-weight: 560; }
.handle-chip__x {
  display: grid; place-items: center; width: 20px; height: 20px;
  border: 0; border-radius: 50%; background: var(--surface-hi);
  color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1;
  transition: background var(--dur), color var(--dur);
}
.handle-chip__x:hover { background: var(--danger-dim); color: var(--danger); }
.chips:empty { display: none; }

/* ───────────────── run bar / toggle ───────────────── */
.run-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-top: 8px;
}
.run-bar__meta { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: var(--step--1); color: var(--muted); }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  width: 40px; height: 23px; border-radius: var(--r-pill);
  background: var(--surface-hi); border: 1px solid var(--border-strong);
  position: relative; transition: background var(--dur) var(--ease), border-color var(--dur);
}
.toggle__thumb {
  position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: var(--muted);
  transition: transform var(--dur) var(--ease), background var(--dur);
}
.toggle input:checked + .toggle__track { background: var(--primary); border-color: transparent; }
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(17px); background: var(--primary-ink); }
.toggle input:focus-visible + .toggle__track { box-shadow: 0 0 0 3px var(--ring); }

/* ───────────────── skeleton ───────────────── */
.analysis-skeleton { margin-top: 24px; display: grid; gap: 12px; }
.sk-line {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hi) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-line--title { height: 22px; width: 55%; margin-top: 8px; }
.sk-line--short { width: 70%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.analysis-skeleton__note { color: var(--muted); font-size: var(--step--1); text-align: center; margin: 8px 0 0; }

/* ───────────────── result ───────────────── */
.result { margin-top: 22px; animation: viewIn 400ms var(--ease) both; }
.result__bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}

/* prose — the rendered plan */
.prose { color: var(--ink-dim); line-height: 1.68; }
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--ink); line-height: 1.25; font-weight: 660; letter-spacing: -0.015em;
  margin: 1.9em 0 0.6em; text-wrap: balance;
}
.prose h1 { font-size: var(--step-3); }
.prose h2 {
  font-size: var(--step-2); padding-bottom: 8px; border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px;
}
.prose h2::before {
  content: ""; width: 7px; height: 7px; border-radius: 2px;
  background: var(--gold); flex: none; transform: translateY(-2px) rotate(45deg);
}
.prose h3 { font-size: var(--step-1); color: var(--primary-bright); }
.prose h4 { font-size: var(--step-0); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.prose p { margin: 0.85em 0; max-width: 70ch; }
.prose strong { color: var(--ink); font-weight: 630; }
.prose em { color: var(--ink); }
.prose a { color: var(--primary-bright); text-underline-offset: 3px; }
.prose ul, .prose ol { margin: 0.85em 0; padding-left: 1.35em; }
.prose li { margin: 0.4em 0; }
.prose li::marker { color: var(--primary-bright); }
.prose ul li::marker { color: var(--gold); }
.prose code {
  font-family: var(--mono); font-size: 0.88em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 6px; color: var(--ink);
}
.prose pre {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px; overflow-x: auto; margin: 1em 0;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: 0.85em; color: var(--ink-dim); }
.prose blockquote {
  margin: 1em 0; padding: 4px 16px; color: var(--muted);
  border-left: 2px solid var(--border-strong);
}
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
/* tables live inside a scroll wrapper so wide content scrolls the table,
   never the page, and never overflows a cell boundary */
.prose .table-wrap {
  margin: 1.2em 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  -webkit-overflow-scrolling: touch;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}
.prose th, .prose td {
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
  min-width: 8rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.prose th:last-child, .prose td:last-child { border-right: 0; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose th { background: var(--surface-2); color: var(--ink); font-weight: 600; }

/* ───────────────── banners / toast ───────────────── */
.banner {
  margin-top: 20px; padding: 14px 16px; border-radius: var(--r-md);
  font-size: var(--step-0);
}
.banner--error { background: var(--danger-dim); border: 1px solid oklch(0.680 0.185 24 / 0.45); color: oklch(0.86 0.10 24); }
.banner strong { color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  z-index: var(--z-toast);
  background: var(--surface-hi); border: 1px solid var(--border-strong);
  color: var(--ink); padding: 11px 18px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg); font-size: var(--step--1);
  opacity: 0; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  pointer-events: none;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ───────────────── footer ───────────────── */
.foot {
  max-width: var(--maxw); margin: 0 auto; width: 100%;
  padding: 20px clamp(16px, 5vw, 28px) calc(20px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; gap: 12px;
  color: var(--faint); font-size: var(--step--1);
  border-top: 1px solid var(--border);
}

/* ───────────────── landing page ───────────────── */
body.landing { min-height: 100dvh; }
.topbar--landing {
  background: transparent;
  backdrop-filter: none;
  border-bottom: 0;
}
.lp { flex: 1; width: 100%; }
/* hero fills the first screen; story sections scroll below it */
.lp-hero {
  min-height: calc(100dvh - 58px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 40rem;
  margin: 0 auto;
  padding: 24px clamp(20px, 6vw, 36px) 56px;
}

.lp-mark {
  color: var(--primary-bright);
  width: clamp(72px, 20vw, 104px);
  margin: 0 auto 28px;
  filter: drop-shadow(0 6px 26px oklch(0.635 0.190 274 / 0.5));
}
.lp-mark svg { width: 100%; height: auto; display: block; }
.lp-mark__spin { transform-origin: 16px 16px; animation: vortex 9s linear infinite; }
.lp-mark__ring { animation: ringPulse 4s ease-in-out infinite; transform-origin: 16px 16px; }
@keyframes vortex { to { transform: rotate(360deg); } }
@keyframes ringPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

.lp-kicker {
  margin: 0 0 16px;
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.lp-title {
  margin: 0 0 20px;
  font-size: clamp(2.1rem, 6.4vw, 3.4rem);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-wrap: balance;
}
.lp-sub {
  margin: 0 auto 32px;
  max-width: 40ch;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.6;
  text-wrap: pretty;
}
.btn--lg { padding: 15px 26px; font-size: var(--step-1); font-weight: 620; border-radius: var(--r-md); }
.lp-cta { box-shadow: 0 1px 0 oklch(1 0 0 / 0.14) inset, 0 10px 34px oklch(0.635 0.190 274 / 0.45); }
.lp-who {
  margin: 18px auto 0;
  max-width: 34ch;
  color: var(--faint);
  font-size: var(--step--1);
}

.lp-steps {
  list-style: none;
  margin: 44px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  color: var(--ink-dim);
  font-size: var(--step--1);
}
.lp-steps li { display: inline-flex; align-items: center; gap: 9px; }
.lp-steps__n {
  display: grid; place-items: center;
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  background: var(--primary-dim);
  border: 1px solid oklch(0.635 0.190 274 / 0.5);
  color: var(--primary-bright);
  font-size: 0.76rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.foot--landing a { color: var(--muted); text-decoration: none; }
.foot--landing a:hover { color: var(--ink-dim); }

/* "How it works" scroll cue at the bottom of the hero — bigger, commands attention */
.lp-scroll-cue {
  margin-top: 52px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  font-weight: 780;
  letter-spacing: -0.02em;
  text-shadow: 0 0 22px oklch(0.635 0.190 274 / 0.55), 0 0 44px oklch(0.710 0.170 274 / 0.35);
  animation: cueFloat 2.6s ease-in-out infinite;
}
.lp-scroll-cue__arrow { font-weight: 600; }
@keyframes cueFloat { 0%, 100% { transform: translateY(0); opacity: 0.7; } 50% { transform: translateY(6px); opacity: 1; } }

/* ───────────────── landing scroll story ───────────────── */
.story { padding: clamp(64px, 12vh, 132px) clamp(20px, 6vw, 36px); }
.story__inner {
  max-width: 62rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 6vw, 64px);
  align-items: center;
}
@media (min-width: 860px) {
  .story__inner { grid-template-columns: 1.05fr 0.95fr; }
  .story--reverse .story__visual { order: -1; }
}
.story__step {
  margin: 0 0 14px;
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.story__title {
  margin: 0 0 18px;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 680;
  color: var(--ink);
  text-wrap: balance;
}
.story__body {
  margin: 0;
  max-width: 44ch;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.65;
  text-wrap: pretty;
}
.story__visual { margin: 0; }

/* Section 1 — animated chat conversation (styled like the app's chat) */
.chat-demo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}
.cd-bubble {
  max-width: 85%;
  padding: 12px 15px;
  border-radius: var(--r-lg);
  line-height: 1.5;
  font-size: var(--step-0);
}
.cd-bubble--bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  color: var(--ink-dim);
}
.cd-bubble--me {
  align-self: flex-end;
  background: var(--primary);
  color: var(--primary-ink);
  border-bottom-right-radius: 6px;
}

/* Section 2 — abstract video thumbnails + the @handle channel card */
.thumbs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}
.thumb {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
}
.thumb__img {
  flex: none;
  width: 96px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}
.thumb__img--a { background: linear-gradient(135deg, oklch(0.62 0.17 30), oklch(0.44 0.14 300)); }
.thumb__img--b { background: linear-gradient(135deg, oklch(0.56 0.15 250), oklch(0.42 0.11 190)); }
.thumb__img--c { background: linear-gradient(135deg, oklch(0.6 0.16 150), oklch(0.46 0.14 80)); }
.thumb__meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.thumb__title { color: var(--ink); font-size: var(--step-0); font-weight: 560; }
.thumb__views { color: var(--faint); font-size: var(--step--1); }

.chan-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
}
.chan-card__avatar {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--primary), var(--gold), var(--primary-bright), var(--primary));
}
.chan-card__info { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.chan-card__name { color: var(--ink); font-weight: 640; font-size: var(--step-1); }
.chan-card__handle {
  color: var(--primary-bright);
  font-size: var(--step-0);
  font-weight: 560;
  background: var(--primary-dim);
  border: 1px solid oklch(0.635 0.190 274 / 0.45);
  padding: 1px 9px;
  border-radius: var(--r-pill);
}
.chan-card__caption { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: var(--step--1); }
.chan-card__caption b { color: var(--primary-bright); font-weight: 600; }

/* Section 3 — sample plan excerpt that parallaxes inside a masked window */
.plan-peek {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  height: clamp(320px, 48vh, 440px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}
.plan-peek__scroll { will-change: transform; padding: 8px 4px; }
.plan-peek .prose { font-size: var(--step-0); }
.plan-peek .prose h3 { margin-top: 1.3em; }

/* closing call to action */
.lp-close {
  text-align: center;
  padding: clamp(72px, 14vh, 150px) clamp(20px, 6vw, 36px) clamp(80px, 12vh, 132px);
}
.lp-close__title {
  margin: 0 0 28px;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-wrap: balance;
}

/* scroll reveals — only active once JS adds .reveal-ready (see landing.js).
   Without JS / reduced motion, content is fully visible. */
.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 620ms var(--ease-out-strong), transform 620ms var(--ease-out-strong);
  will-change: opacity, transform;
}
.reveal-ready .reveal--delay { transition-delay: 90ms; }
.reveal-ready .reveal.in { opacity: 1; transform: none; }

/* visual compositions: the container holds still; its pieces animate in */
.reveal-ready .story__visual.reveal { opacity: 1; transform: none; transition: none; }
.reveal-ready .story__visual .cd-bubble,
.reveal-ready .story__visual .thumb,
.reveal-ready .story__visual .chan-card,
.reveal-ready .story__visual .chan-card__caption {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 520ms var(--ease-out-strong), transform 520ms var(--ease-out-strong);
}
/* thumbnails drift in at a slight angle, then settle square */
.reveal-ready .story__visual .thumb { transform: translateY(20px) rotate(-1.2deg); }
.reveal-ready .story__visual .thumb:nth-of-type(2) { transform: translateY(20px) rotate(1.4deg); }
.reveal-ready .story__visual.reveal.in .cd-bubble,
.reveal-ready .story__visual.reveal.in .thumb,
.reveal-ready .story__visual.reveal.in .chan-card,
.reveal-ready .story__visual.reveal.in .chan-card__caption {
  opacity: 1;
  transform: none;
}
/* chat: messages arrive one after another */
.reveal-ready .story__visual.reveal.in .cd-bubble:nth-child(1) { transition-delay: 60ms; }
.reveal-ready .story__visual.reveal.in .cd-bubble:nth-child(2) { transition-delay: 200ms; }
.reveal-ready .story__visual.reveal.in .cd-bubble:nth-child(3) { transition-delay: 340ms; }
.reveal-ready .story__visual.reveal.in .cd-bubble:nth-child(4) { transition-delay: 480ms; }
.reveal-ready .story__visual.reveal.in .cd-bubble:nth-child(5) { transition-delay: 620ms; }
.reveal-ready .story__visual.reveal.in .cd-bubble:nth-child(6) { transition-delay: 760ms; }
/* thumbnails + channel card settle in sequence */
.reveal-ready .story__visual.reveal.in .thumb:nth-of-type(1) { transition-delay: 60ms; }
.reveal-ready .story__visual.reveal.in .thumb:nth-of-type(2) { transition-delay: 150ms; }
.reveal-ready .story__visual.reveal.in .thumb:nth-of-type(3) { transition-delay: 240ms; }
.reveal-ready .story__visual.reveal.in .chan-card { transition-delay: 370ms; }
.reveal-ready .story__visual.reveal.in .chan-card__caption { transition-delay: 470ms; }

/* ───────────────── accounts / forms ───────────────── */
.topbar__nav { display: flex; align-items: center; gap: 10px; }
.auth-email {
  color: var(--muted); font-size: var(--step--1);
  max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--ink);
  font: inherit;
  padding: 11px 13px;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.field { display: block; margin-bottom: 14px; }
.field .field__label { display: block; margin-bottom: 6px; }

.form-error {
  margin: 4px 0 14px;
  padding: 10px 13px;
  border-radius: var(--r-md);
  background: var(--danger-dim);
  border: 1px solid oklch(0.680 0.185 24 / 0.45);
  color: oklch(0.86 0.10 24);
  font-size: var(--step--1);
}

/* login page */
.auth-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  width: 100%; max-width: 30rem; margin: 0 auto;
  padding: 24px clamp(16px, 5vw, 28px) 60px;
}
.auth-card { width: 100%; }
.auth-card__title { margin: 0 0 6px; font-size: var(--step-3); font-weight: 680; letter-spacing: -0.02em; }
.auth-card__sub { margin: 0 0 22px; color: var(--muted); }
.auth-card__foot { margin: 18px 0 0; color: var(--muted); font-size: var(--step--1); text-align: center; }
.auth-card__foot a, .signup-card__foot a { color: var(--primary-bright); }

/* signup-after-plan card */
.signup-card { margin-top: 26px; border-color: oklch(0.635 0.190 274 / 0.4); }
.signup-card__head { margin-bottom: 18px; }
.signup-card__title { margin: 12px 0 6px; font-size: var(--step-2); font-weight: 660; letter-spacing: -0.02em; }
.signup-card__sub { margin: 0; color: var(--muted); max-width: 52ch; }
.signup-card__fields { display: grid; gap: 6px; }
@media (min-width: 520px) { .signup-card__fields { grid-template-columns: 1fr 1fr; gap: 14px; } }
.signup-card__foot { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: var(--step--1); }
.signup-card__done { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* verify-your-email banner (under the header) */
.verify-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; text-align: center;
  background: var(--gold-dim);
  border-bottom: 1px solid oklch(0.820 0.130 86 / 0.4);
  color: var(--gold); font-size: var(--step--1);
}
.verify-banner .btn { color: var(--gold); border-color: oklch(0.820 0.130 86 / 0.5); }

/* inline status note on auth pages */
.form-note { margin: 0 0 18px; padding: 10px 13px; border-radius: var(--r-md); font-size: var(--step--1); }
.form-note--ok { background: var(--ok-dim); border: 1px solid oklch(0.760 0.150 156 / 0.4); color: var(--ok); }
.form-note--err { background: var(--danger-dim); border: 1px solid oklch(0.680 0.185 24 / 0.45); color: oklch(0.86 0.10 24); }

/* ───────────────── dashboard ───────────────── */
.dash {
  flex: 1; width: 100%; max-width: 56rem; margin: 0 auto;
  padding: 20px clamp(16px, 5vw, 32px) 60px;
}
.dash__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 20px 0 26px;
}
.dash__head .display { font-size: var(--step-3); margin: 4px 0 0; }
.dash__head .eyebrow { margin: 0; }

.dash__grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .dash__grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.dash-card { display: flex; flex-direction: column; gap: 14px; }
.dash-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dash-card__title { margin: 0; font-size: var(--step-1); font-weight: 640; }
.dash-card__summary { margin: 0; color: var(--ink-dim); font-size: var(--step-0); }
.dash-card .profile-grid { gap: 12px; }
.dash-card .btn--block { margin-top: auto; }

.dash__plans { margin-top: 34px; }
.dash__plans-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.dash-section-title { margin: 0; font-size: var(--step-2); font-weight: 660; letter-spacing: -0.02em; }

.plan-list { display: grid; gap: 12px; }
.plan-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.plan-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.plan-card__main { min-width: 0; }
.plan-card__title { margin: 0 0 3px; font-size: var(--step-1); font-weight: 600; }
.plan-card__meta { margin: 0; color: var(--muted); font-size: var(--step--1); }
.plan-card__actions { display: flex; gap: 8px; flex: none; }
.plan-card__del { color: var(--muted); }
.plan-card__del:hover { color: var(--danger); border-color: oklch(0.680 0.185 24 / 0.5); }

.empty { color: var(--muted); font-size: var(--step--1); }
.empty a { color: var(--primary-bright); }
.empty--big { padding: 28px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }
.dim { color: var(--muted); }

/* plan viewer modal (native <dialog>) */
.plan-modal {
  width: min(680px, 92vw);
  max-height: 84vh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.plan-modal::backdrop { background: oklch(0 0 0 / 0.6); backdrop-filter: blur(3px); }
.plan-modal[open] { display: flex; flex-direction: column; animation: viewIn 260ms var(--ease) both; }
.plan-modal__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.plan-modal__title { margin: 0; font-size: var(--step-1); font-weight: 640; }
.plan-modal .prose { padding: 20px 24px 28px; overflow-y: auto; }

[hidden] { display: none !important; }

/* ───────────────── reduced motion ───────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .view.is-active, .result, .bubble, .handle-chip { animation: none; }
}

.field__hint { color: var(--faint); font-size: 13px; margin: 8px 0 10px; line-height: 1.5; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Section 2 — full channel-header cards + handle instructions */
.chan-card--full { margin-top: 0; align-items: flex-start; }
.chan-card--full .chan-card__info { gap: 4px; min-width: 0; }
.chan-card__check { color: var(--muted); vertical-align: -1px; margin-left: 2px; }
.chan-card__stats { color: var(--muted); font-size: var(--step--1); }
.chan-card__stats .chan-card__handle { font-size: var(--step--1); padding: 0 8px; }
.chan-card__desc { color: var(--faint); font-size: var(--step--1); line-height: 1.45; }
.chan-card__avatar--a { background: conic-gradient(from 210deg, oklch(0.62 0.17 30), oklch(0.75 0.13 86), oklch(0.62 0.17 30)); }
.chan-card__avatar--b { background: conic-gradient(from 40deg, oklch(0.56 0.15 250), oklch(0.44 0.14 300), oklch(0.56 0.15 250)); }
.chan-card__avatar--c { background: conic-gradient(from 120deg, oklch(0.6 0.16 150), oklch(0.46 0.14 80), oklch(0.6 0.16 150)); }
.chan-howto {
  margin-top: 8px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}
.chan-howto__title { margin: 0 0 6px; color: var(--ink); font-weight: 620; font-size: var(--step-0); }
.chan-howto__body { margin: 0; color: var(--muted); font-size: var(--step--1); line-height: 1.55; }
.chan-howto__body b { color: var(--primary-bright); font-weight: 600; }