/* TrafficBay Product 002 - AI Visibility Spot Check (validation build).
   Mobile-first, self-contained (no third-party assets), premium-clean.
   Deliberately distinct from EXP001's PriceSheet Pro theme while following
   the same conventions: big touch targets, one primary CTA per screen,
   system font stack, no external dependencies.

   Motion rules: restrained 150-300ms transitions, one reveal animation on
   the report, nothing that delays or hides the workflow, and everything
   disabled under prefers-reduced-motion. */

:root {
  --ink: #0f1222;
  --ink-soft: #3c4257;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7fb;
  --card: #ffffff;
  --accent: #4338ca;
  --accent-2: #7c6cf0;
  --accent-ink: #ffffff;
  --accent-soft: #eef0ff;
  --good: #0f7a4d;
  --good-soft: #e7f6ee;
  --bad: #b3261e;
  --bad-soft: #fdecea;
  --warn: #92600a;
  --warn-soft: #fdf3e0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 19, 34, 0.05), 0 10px 30px rgba(16, 19, 34, 0.07);
  --shadow-soft: 0 1px 2px rgba(16, 19, 34, 0.04);
  --dur: 200ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }

/* The [hidden] attribute must ALWAYS win over author display rules
   (.btn, .view-all-btn, media-query blocks...). Without this, a hidden
   "Next prompt" renders as a dead visible button on the engine-choose
   stage and its click corrupts the flow cursor - the same bug class as
   the EXP001 P0 live-QA freeze. UA [hidden] rules lose to ANY author
   display rule, so this guard is required and load-bearing. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 400px at 50% -100px, #eceafd 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 660px; margin: 0 auto; padding: 16px 16px 64px; }

/* --- header + progress --- */
.brandbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 2px 4px;
}
.brandbar .dot {
  width: 12px; height: 12px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: none;
}
.brandbar .brandname { font-weight: 700; letter-spacing: 0.01em; }
.brandbar .brandsub { color: var(--muted); font-size: 0.82rem; margin-left: auto; }

.progress-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.8rem; color: var(--muted); margin: 18px 0 6px;
}
.progress-track {
  height: 6px; border-radius: 999px; background: var(--line); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 20%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.3s var(--ease);
}

/* --- hero --- */
.hero { padding: 26px 4px 10px; }
.hero h1 {
  font-size: 1.66rem; line-height: 1.22; margin: 0 0 10px; letter-spacing: -0.015em;
  font-weight: 800;
}
.hero .sub { color: var(--ink-soft); font-size: 1.0rem; margin: 0 0 14px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.trust-chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 0.78rem; color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
}

/* --- what you get strip (show, don't explain) --- */
.get-strip { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 6px 0 4px; }
@media (min-width: 560px) { .get-strip { grid-template-columns: 1fr 1fr 1fr; } }
.get-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 2px;
}
.get-title { font-weight: 700; font-size: 0.86rem; }
.get-sub { color: var(--muted); font-size: 0.76rem; }

/* --- cards / screens --- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 16px; margin: 14px 0;
}
.card h2 { font-size: 1.14rem; margin: 0 0 4px; letter-spacing: -0.01em; }
.card h3 { font-size: 1.0rem; margin: 0 0 4px; }
.card .lede { color: var(--muted); font-size: 0.92rem; margin: 0 0 14px; }

.field { margin: 0 0 14px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 0.78rem; margin-top: 5px; }
.field-error { color: var(--bad); font-size: 0.78rem; margin-top: 5px; min-height: 0; }

input[type="text"], input[type="email"], input[type="url"], select, textarea {
  width: 100%; padding: 13px 14px; font-size: 16px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfbfd;
  font-family: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent);
}
textarea { resize: vertical; }

/* progressive-disclosure optional block */
.optional-block {
  border: 1px dashed var(--line); border-radius: 12px; padding: 4px 12px;
  margin: 2px 0 14px; background: #fbfbfe;
}
.optional-block summary {
  cursor: pointer; font-weight: 600; font-size: 0.88rem; color: var(--ink-soft);
  padding: 10px 0;
}
.optional-block summary:hover { color: var(--accent); }
.optional-block[open] summary { border-bottom: 1px solid var(--line); }

.competitor-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 520px) { .competitor-grid { grid-template-columns: 1fr 1fr 1fr; } }

.persona-row { display: grid; gap: 8px; }
.persona-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fbfbfd;
  cursor: pointer; font-size: 0.92rem;
  transition: border-color var(--dur) var(--ease);
}
.persona-option:hover { border-color: var(--accent-2); }
.persona-option input { margin-top: 3px; width: auto; }
.persona-option .persona-hint { color: var(--muted); font-size: 0.78rem; display: block; }

/* --- buttons --- */
.btn {
  display: block; width: 100%; border: none; border-radius: 12px;
  padding: 15px 18px; font-size: 1rem; font-weight: 600; cursor: pointer;
  font-family: inherit; text-align: center;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(67, 56, 202, 0.22);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.99); box-shadow: 0 2px 8px rgba(67, 56, 202, 0.18); }
.btn-primary:disabled { background: #a5a8d8; cursor: default; transform: none; box-shadow: none; }
.btn-ghost {
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  width: auto; padding: 12px 16px; font-size: 0.9rem; border-radius: 12px;
}
.btn-ghost:hover { background: var(--accent-soft); }
.btn-ghost:active { transform: scale(0.99); }
.btn-link {
  background: none; border: none; color: var(--muted); text-decoration: underline;
  font-size: 0.85rem; padding: 8px; cursor: pointer; width: 100%;
}
.btn-link:hover { color: var(--accent); }
.btn + .btn { margin-top: 10px; }
button:focus-visible, .btn-link:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* --- error banner --- */
.error-banner {
  background: var(--bad-soft); color: var(--bad); border: 1px solid #f2c4c1;
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.88rem; margin: 0 0 12px;
}

/* --- step 2: one-prompt-at-a-time flow --- */
.flow-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 2px;
}
.flow-head h2 { margin: 0; }
.flow-dots { display: flex; gap: 6px; flex: none; }
.flow-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line);
  transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.flow-dot.is-done { background: var(--good); }
.flow-dot.is-current {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-2);
}

.engine-stage { padding: 6px 0 2px; }
.engine-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.engine-row-default { margin: 14px 0 18px; }
.engine-chip {
  border: 1px solid var(--line); background: #fbfbfd; color: var(--ink-soft);
  border-radius: 999px; padding: 9px 14px; font-size: 0.84rem; cursor: pointer;
  font-family: inherit;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.engine-chip:hover { border-color: var(--accent-2); }
.engine-chip:active { transform: scale(0.97); }
.engine-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.mix-note {
  background: var(--warn-soft); color: var(--warn); border-radius: 10px;
  padding: 9px 12px; font-size: 0.8rem; margin: 0 0 10px;
}

.done-rows { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 12px; }
.done-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: #fbfbfd; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; cursor: pointer; font-family: inherit; font-size: 0.85rem;
  text-align: left;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.done-row:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.done-mark {
  width: 20px; height: 20px; border-radius: 50%; background: var(--good-soft);
  color: var(--good); display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; flex: none;
}
.done-label { font-weight: 600; color: var(--ink); }
.done-meta { color: var(--muted); font-size: 0.76rem; }
.done-edit { margin-left: auto; color: var(--accent); font-size: 0.78rem; font-weight: 600; }

.prompt-card { margin: 6px 0; }
.prompt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-block; border-radius: 999px; padding: 4px 10px;
  font-size: 0.72rem; font-weight: 600;
}
.badge-category { background: var(--accent-soft); color: var(--accent); }
.badge-branded { background: var(--warn-soft); color: var(--warn); }
.badge-echo { background: #f1f1f6; color: var(--ink-soft); }
.badge-priority { background: var(--warn-soft); color: var(--warn); margin-right: 8px; }

.btn-copy {
  border-radius: 8px;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn-copy.is-copied { background: var(--good-soft); border-color: var(--good); color: var(--good); }

.fresh-chat-note {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--accent-soft); border-radius: 10px;
  padding: 9px 12px; font-size: 0.82rem; color: var(--ink-soft);
  margin: 10px 0 4px;
}
.fresh-chat-note strong { color: var(--ink); }
.fresh-chat-note .fc-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800;
  font-size: 0.72rem; flex: none; margin-top: 1px;
}

.prompt-text {
  font-size: 1.02rem; font-weight: 600; color: var(--ink); margin: 10px 0 4px;
  letter-spacing: -0.005em;
}
.prompt-why { color: var(--muted); font-size: 0.8rem; margin: 0 0 6px; }

.field-engines { margin-top: 10px; }
.field-engines label { font-size: 0.82rem; }

.answer-input { margin-top: 10px; }
.evidence-status {
  margin: 8px 0 0; font-size: 0.8rem; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.evidence-status.is-added { color: var(--good); }
.evidence-status.is-pop { animation: pop 300ms var(--ease); }
@keyframes pop {
  0% { transform: scale(0.9); opacity: 0.4; }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}
.paste-helper { padding: 6px 8px; font-size: 0.8rem; width: auto; text-align: left; }

.flow-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 14px;
}
.flow-footer .btn { width: auto; }
.flow-footer .btn-primary { flex: 1; }

.evidence-progress { margin: 8px 0 12px; }
.evidence-progress .meter {
  height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0;
}
.evidence-progress .meter .fill {
  height: 100%; background: linear-gradient(90deg, var(--good), #34b37a); border-radius: 999px;
  width: 0; transition: width 0.25s var(--ease);
}
.evidence-progress .count { font-size: 0.84rem; font-weight: 600; color: var(--ink-soft); }
.analyze-hint { color: var(--muted); font-size: 0.8rem; margin: 12px 0 0; }

/* desktop escape hatch: View all (never the default experience) */
.view-all-btn { display: none; }
@media (min-width: 900px) { .view-all-btn { display: block; } }

/* --- results: led by AI DISCOVERY VISIBILITY --- */
.score-hero-card { text-align: center; padding: 26px 18px; }
.kicker {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem;
  font-weight: 800; color: var(--accent); margin: 0 0 10px;
}
.score-hero { display: flex; flex-direction: column; align-items: center; }
.score-ring {
  width: 156px; height: 156px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(closest-side, var(--card) 78%, transparent 79% 100%),
    conic-gradient(var(--accent) calc(var(--score, 0) * 1%), var(--line) 0);
}
.score-ring .num { font-size: 2.7rem; font-weight: 800; letter-spacing: -0.02em; }
.score-ring .ring-unit { font-size: 1.0rem; font-weight: 700; color: var(--muted); margin-left: 2px; }
.score-label { font-weight: 700; margin-bottom: 8px; }
.headline {
  font-size: 1.06rem; font-weight: 600; color: var(--ink);
  margin: 0 0 10px; max-width: 480px;
}
.confidence { color: var(--ink-soft); font-size: 0.82rem; margin: 0 0 6px; }
.disclaimer { color: var(--muted); font-size: 0.74rem; max-width: 460px; margin: 8px auto 0; }

/* report reveal: rewarding but instant content (opacity/transform only) */
.reveal-card { opacity: 0; transform: translateY(10px); }
.reveal-card.reveal-in {
  opacity: 1; transform: none;
  transition: opacity 350ms var(--ease), transform 350ms var(--ease);
}

.component-list, .plain-list { list-style: none; padding: 0; margin: 0; }
.component-list li {
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem;
}
.component-list li:last-child { border-bottom: none; }
.component-list .comp-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.component-list .comp-value { color: var(--accent); white-space: nowrap; }
.component-list .comp-note { color: var(--muted); font-size: 0.78rem; margin-top: 3px; }
.component-list .comp-excluded { color: var(--muted); font-weight: 500; }

.mark {
  display: inline-block; min-width: 72px; text-align: center; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; padding: 3px 8px; margin-right: 10px;
}
.mark-good { background: var(--good-soft); color: var(--good); }
.mark-bad { background: var(--bad-soft); color: var(--bad); }
.mark-na { background: var(--line); color: var(--muted); }

.plain-list li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.plain-list li:last-child { border-bottom: none; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* competitor bars (visual data over prose) */
.comp-list li.comp-row {
  display: flex; align-items: center; gap: 10px;
}
.comp-name { flex: 1 1 auto; font-weight: 600; min-width: 0; }
.comp-bar { flex: 3 1 120px; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.comp-bar-fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #c9c2f5, var(--accent-2));
  transition: width 0.4s var(--ease);
}
.comp-count { color: var(--muted); font-size: 0.8rem; flex: none; min-width: 28px; text-align: right; }

/* details cards (progressive disclosure for transparency blocks) */
.details-card summary {
  cursor: pointer; font-weight: 700; font-size: 1.0rem; padding: 2px 0;
}
.details-card summary:hover { color: var(--accent); }
.details-card[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }

.narrative p { margin: 0 0 10px; font-size: 0.94rem; }

/* --- contextual offer --- */
#offerContext { margin: 0 0 6px; }
.offer-context-intro { color: var(--ink-soft); font-size: 0.92rem; margin: 0 0 8px; }
.offer-context-list { margin: 0 0 10px; padding-left: 20px; }
.offer-context-list li { padding: 4px 0; font-size: 0.88rem; color: var(--ink-soft); }

/* --- offer --- */
.offer-price-row { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 10px; }
.offer-price { font-size: 2.2rem; font-weight: 800; }
.offer-strike { color: var(--muted); text-decoration: line-through; font-weight: 600; }
.offer-tag {
  background: var(--warn-soft); color: var(--warn); border-radius: 999px;
  padding: 4px 10px; font-size: 0.74rem; font-weight: 700;
}
.tier-list { list-style: none; padding: 0; margin: 10px 0 0; }
.tier-list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.tier-list li:last-child { border-bottom: none; }
.tier-list .tier-name { font-weight: 700; }
.tier-list .tier-future { color: var(--muted); font-weight: 600; font-size: 0.76rem; }

/* --- checkout --- */
.test-watermark {
  background: var(--warn-soft); color: var(--warn); border: 1px dashed #e0b96b;
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 0.8rem; font-weight: 600;
  text-align: center; margin-bottom: 14px;
}
.success-card h3 { color: var(--good); }

/* --- crawlable SEO copy + FAQ (below the tool, hides mid-funnel) --- */
.seo-card { margin-top: 20px; }
.seo-card p { color: var(--ink-soft); font-size: 0.9rem; }
.seo-card .faq-title { margin-top: 18px; }
.faq-item h3 { margin: 12px 0 2px; font-size: 0.94rem; }
.faq-item p { margin: 0 0 8px; }

/* --- misc --- */
hr.spacer { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
code { background: var(--accent-soft); border-radius: 6px; padding: 2px 6px; font-size: 0.82em; }

/* --- motion discipline: everything above collapses under reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal-card { opacity: 1; transform: none; }
  .evidence-status.is-pop { animation: none; }
}

/* --- post-report usefulness feedback (lightweight, never blocks) --- */
#feedbackCard .lede { margin-bottom: 10px; }
.feedback-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.feedback-chip {
  border: 1px solid var(--line); background: #fbfbfd; color: var(--ink-soft);
  border-radius: 999px; padding: 10px 16px; font-size: 0.86rem; cursor: pointer;
  font-family: inherit;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.feedback-chip:hover { border-color: var(--accent-2); }
.feedback-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.feedback-detail { margin-top: 10px; }
.feedback-q { font-weight: 600; font-size: 0.9rem; margin: 0 0 6px; }
.feedback-q .muted { font-weight: 400; }
.feedback-detail .btn { width: auto; padding: 12px 22px; }
.feedback-detail .btn-link { width: auto; display: inline-block; }
.feedback-thanks { margin: 8px 0 0; }

/* --- internal validation dashboard --- */
.dash-wrap { max-width: 900px; margin: 0 auto; padding: 20px 16px 64px; }
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-card .stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; margin: 2px 0; }
.stat-card .stat-sub { color: var(--muted); font-size: 0.78rem; }
.gate-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.gate-row:last-child { border-bottom: none; }
.gate-state { font-size: 0.8rem; font-weight: 800; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.gate-met { background: var(--good-soft); color: var(--good); }
.gate-open { background: var(--warn-soft); color: var(--warn); }
.gate-count { margin-left: auto; color: var(--muted); white-space: nowrap; }
table.kv { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
table.kv td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv td:last-child { text-align: right; white-space: nowrap; }
.refresh-note { color: var(--muted); font-size: 0.78rem; }

/* --- footer (policy links; crawlable, part of the public page) --- */
.p002-footer { max-width: 660px; margin: 26px auto 0; padding: 14px 16px 40px; border-top: 1px solid var(--line); font-size: 0.8rem; }
.p002-footer p { margin: 0; }
.p002-footer a { color: var(--accent-2); }
