:root {
  --ink: #111;
  --bg: #fff;
  --line: #111;
  --mut: #666;
  --hair: #e2e2e2;
  --paper-warm: #faf9f6;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.view { flex: 1 0 auto; }
[hidden] { display: none !important; }

h1 {
  font-weight: 600;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
}

h2 {
  font-weight: 600;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  line-height: 1.15;
  margin: 0 0 1.2rem;
}

h3 {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 2.4rem 0 0.8rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.step {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 0 0 1.6rem;
}

.lead { margin: 0 0 2rem; }
.lead.small { font-size: 0.95rem; color: var(--mut); margin-bottom: 1.2rem; }

.fine {
  font-size: 0.82rem;
  color: var(--mut);
  margin-top: 1.6rem;
}

.btn {
  /* Кнопка лишається кнопкою, навіть коли вона <a>. У кабінеті дві дії ведуть на іншу
     сторінку, тож розмітка там — посилання; підкреслення від посилання робило з них
     напівкнопку-напівлінк і суперечило власній формі (*Афорданс*: контрол виглядає тим,
     чим є). Підкреслення лишається тому, що справді читається як посилання. */
  text-decoration: none;
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.98rem;
  color: var(--bg);
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.75rem 1.6rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
/* ----- A control owes four states: rest, hover, focus, press (technical/DESIGN.md —
   *Answering Affordance*). The cursor is the affordance; these are the ANSWER. A control
   that sits still under the pointer leaves the person unsure it heard them, and they hold
   watch over it — the forced vigilance *Attention Is Sovereign* forbids.
   Two rules bind every state below: hover is wrapped in `@media (hover: hover)` so it
   never sticks to a finger on touch, and no state drops contrast under AA. ----- */
@media (hover: hover) {
  .btn:hover { opacity: 0.82; }
}
.btn:active { transform: translateY(1px); } /* the press answers before the result does */
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
/* Посилання не має :disabled, а виглядати вимкненим мусить так само — інакше воно
   обіцяє дію, якої не буде (афорданс: клікабельне виглядає клікабельним, і навпаки). */
/* Група аудитів одного продукту: заголовок тримає око, рядки під ним — відступом,
   щоб зв'язок був видний без рамок і ліній (простір ізолює). */
.audit-group-head { margin: 1.4rem 0 0.3rem; }
.audit-group-row { margin: 0.15rem 0 0.15rem 1.1rem; }

.btn.is-off { opacity: 0.4; cursor: default; transform: none; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn.ghost {
  color: var(--ink);
  background: var(--bg);
}

.row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.field {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
  width: 100%;
  display: block;
  margin-bottom: 1rem;
  transition: border-color 0.12s ease;
}
/* A field is a control too: it had focus but stood still under the pointer. The border
   warms — no contrast is spent, and the box says «this one takes your words». */
@media (hover: hover) {
  .field:hover { border-color: var(--mut); }
}
.field:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.area { resize: vertical; line-height: 1.5; }

/* The pay panel: examples link, then «name your value» — a narrow amount field beside the
   pay button, so the sum and the act sit on one line. The floor is the input's own min. */
.paybox { margin-top: 1.2rem; }
.pay-row { align-items: center; margin-top: 0.8rem; }
.pay-amt {
  width: auto;
  max-width: 9rem;
  margin-bottom: 0;
  text-align: right;
}
.pay-status:empty { display: none; }

.out {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 1rem;
  line-height: 1.62;
  min-height: 2rem;
}

#refineBox { margin-top: 2.4rem; }

.foot {
  flex-shrink: 0;
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hair);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--mut);
}

.thinking { color: var(--mut); }

/* Links inside the prose — the copy's own, arriving through i18n. They carried colour and
   an underline and answered nothing. Same idiom as .linkbtn: the underline thickens, so a
   small line never trades contrast for feedback. */
a {
  color: var(--ink);
  text-underline-offset: 2px;
  transition: text-decoration-thickness 0.12s ease, opacity 0.12s ease;
}
@media (hover: hover) {
  a:hover { text-decoration-thickness: 2px; }
}
a:active { opacity: 0.6; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
code { font-size: 0.92em; }

/* ----- PDF deliverable via the browser's print → Save as PDF ----- */
#report { display: none; }

@media print {
  .wrap { display: none !important; }
  #report {
    display: block;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }
  #report h1 { font-size: 19pt; margin: 0 0 0.2rem; letter-spacing: -0.01em; }
  #report .rdate { color: #555; font-size: 9pt; margin: 0 0 1.4rem; }
  #report h2 {
    font-size: 13pt;
    margin: 1.5rem 0 0.5rem;
    padding-top: 0.6rem;
    border-top: 1px solid #000;
  }
  #report .rbody { white-space: pre-wrap; word-wrap: break-word; }
  @page { margin: 18mm; }
}

/* ----- feedback modal ----- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}
.modal-card {
  background: var(--bg);
  border: 1px solid var(--line);
  max-width: 32rem;
  width: 100%;
  padding: 1.75rem;
}
.modal-card h3 { margin: 0 0 0.5rem; }
.fbcheck {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.75rem 0;
}
.fbcheck input { margin-top: 0.2rem; }

/* ----- contributors / suggestion fields ----- */
#fbWho .field { margin-top: 0.5rem; }
.credits { margin-top: 2.5rem; border-top: 1px solid var(--hair); padding-top: 1rem; }
.credits-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.9rem;
  color: var(--mut);
}
.credits-list a { color: var(--mut); }

/* ----- working spinner (visible while the AI streams) ----- */
.spinner {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  vertical-align: -0.05em;
  border: 2px solid var(--hair);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- inline text button (footer links, toggles) ----- */
.linkbtn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: text-decoration-thickness 0.12s ease, opacity 0.12s ease;
}
/* The most-used control in the product, and it answered nothing: 12 of them, underlined
   and pointer-cursored, dead still under the pointer. The underline THICKENS rather than
   fading — a link is small text, and dimming it is the one hover that can cost contrast. */
@media (hover: hover) {
  .linkbtn:hover { text-decoration-thickness: 2px; }
}
.linkbtn:active { opacity: 0.6; }
.linkbtn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
/* ----- progressive birth: spent step yields, next is born in its place ----- */
@keyframes grow {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.grow { animation: grow 0.5s cubic-bezier(0.2, 0, 0, 1) both; }
.yield { transition: opacity 0.25s ease; opacity: 0; }
.askpeek { display: inline-block; margin-bottom: 1.5rem; font-size: 0.85rem; color: var(--mut); }
.histtoggle { display: inline-block; margin-top: 1rem; font-size: 0.85rem; color: var(--mut); }
.history { margin-top: 1.5rem; padding-top: 0.5rem; border-top: 1px solid var(--hair); }
.history-item { margin-bottom: 1.75rem; }
.history-item .out { color: var(--mut); font-size: 0.95rem; }
.history-item .corr { font-style: italic; }
#thanksBox { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--hair); }
@media (prefers-reduced-motion: reduce) {
  .grow { animation: none; }
  .yield { transition: none; }
}

/* ----- audit as law: a finding stands on a named canon (basis → loss → fix), challengeable ----- */
.lawnote {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--mut);
  margin: 0 0 0.5rem;
}
/* language switch — top right, quiet: a tool, not an announcement. The chosen
   language is shown by ink weight, never by colour alone (*Perceivable Affordance*). */
.brand { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.langpick { display: inline-flex; gap: 2px; flex: none; }
.langbtn {
  appearance: none;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--mut);
  transition: color 0.12s ease, background-color 0.12s ease;
}
/* Colour alone could not answer here: the SELECTED language is already --ink, so hovering
   it changed nothing — the one button most likely to be pointed at sat dead still. The
   background carries the answer instead: neither state owns it at rest, so both reply. */
@media (hover: hover) {
  .langbtn:hover { color: var(--ink); background: var(--paper-warm); }
}
.langbtn:active { transform: translateY(1px); }
.langbtn[aria-pressed="true"] { color: var(--ink); font-weight: 600; border-color: var(--hair); }
.langbtn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* the author names their audience — one quiet optional field, never a panel */
.audiencebox { margin: 1.2rem 0; }
.audiencebox label { display: block; margin-bottom: 0.4rem; }
.audiencebox .field { margin-bottom: 0.4rem; }
.mine-toggle { margin-top: 0.4rem; }
/* weight — what to touch first. Quiet, not a traffic light: it is a fact, not an
   alarm (*Синергія Шарів — Спокій, а не Оборона*). Rank shows by ink, not colour. */
.weight {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 2px 7px;
  margin-bottom: 0.6rem;
  color: var(--mut);
}
.weight-0 { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.weight-1 { color: var(--ink); }

/* a finding the human accepted as their nature — kept, not a loss */
.finding.accepted { opacity: 0.62; }
.finding.accepted .finding-head { text-decoration: line-through; text-decoration-thickness: 1px; }

.finding {
  border-top: 1px solid var(--hair);
  padding-top: 1.5rem;
  margin-top: 1.8rem;
}
/* first finding sits right under the section-head line — no second divider */
.audit-section-body > .finding:first-child { border-top: 0; padding-top: 0; margin-top: 1rem; }
.finding-head {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 0.6rem;
  padding: 0;
  border: none;
}
.finding-obs { margin: 0 0 1rem; }
.finding-line {
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0.4rem 0;
  color: var(--ink);
}
.finding-label { font-weight: 600; }
.finding-rule { font-style: italic; color: var(--ink); }
.keep {
  background: var(--paper-warm);
  border: 1px solid var(--hair);
  padding: 1.3rem 1.4rem;
  margin-top: 1.8rem;
}
.keep-tag {
  font-weight: 600;
  font-size: 0.8rem;
  margin: 0 0 0.6rem;
  color: var(--ink);
}
.challenge { margin-top: 0.9rem; }
.challenge-toggle { font-size: 0.85rem; color: var(--mut); }
.challenge-box { margin-top: 0.6rem; }
.challenge-intro { margin: 0 0 0.5rem; }
.challenge-done { font-size: 0.85rem; color: var(--mut); font-style: italic; margin-top: 0.9rem; }

/* ----- brand / logo (click → home) ----- */
.brand { margin-bottom: 2.5rem; }
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: opacity 0.12s ease;
}
@media (hover: hover) {
  .brand-link:hover { opacity: 0.7; }
}
.brand-link:active { opacity: 0.55; }
.brand-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 3px; }
.brand-mark { flex: none; }
.brand-dot { color: var(--mut); }

/* ----- transitions: things appear and recede, like in life ----- */
body.modal-open { overflow: hidden; } /* the popup scrolls, not the page behind it */

@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes card-rise-in { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes card-rise-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(0.99); } }

.modal { animation: modal-fade-in 0.18s ease both; }
.modal .modal-card { animation: card-rise-in 0.24s cubic-bezier(0.2, 0, 0, 1) both; }
.modal.closing { animation: modal-fade-out 0.16s ease both; }
.modal.closing .modal-card { animation: card-rise-out 0.16s ease both; }

/* ----- mobile: every popup is a full, self-scrolling sheet ----- */
@media (max-width: 640px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-card { max-width: none; width: 100%; height: 100%; max-height: 100vh; overflow-y: auto; border: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal, .modal .modal-card, .modal.closing, .modal.closing .modal-card { animation: none; }
}

/* ----- error line inside a streamed block (portrait fetch failed, etc.) ----- */
.out .err, .audit-err {
  color: var(--ink);
  font-size: 0.95rem;
}

/* ----- 404 / not-found page reuses .wrap + .view ----- */
.notfound { text-align: left; min-height: 58vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.notfound h1 { margin-bottom: 1rem; }
.nf-mark { margin: 0 0 1.6rem; color: var(--ink); line-height: 0; }
.nf-mark svg { width: 52px; height: 52px; }
.notfound .code {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 0 0 1.6rem;
}

/* ----- audit picker: choose which audits to run (₴200 each) ----- */
#auditPick {
  border: 1px solid var(--hair);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
  margin: 0 0 1.6rem;
  background: var(--paper-warm);
}
.pickrow {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  line-height: 1.5;
  cursor: pointer;
}
.pickrow + .pickrow { border-top: 1px solid var(--hair); }
.pickrow input { margin-top: 0.25rem; flex: 0 0 auto; }
.pickrow span { font-size: 0.95rem; }
#auditTotal {
  font-weight: 600;
  color: var(--ink);
  margin: 0.9rem 0 0.9rem;
}

/* ----- one section per audit type in the result ----- */
.audit-section + .audit-section { margin-top: 2.4rem; }
.audit-section-head {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mut);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
  margin: 0 0 0.6rem;
}


/* two entries on the landing: text audit vs the visual gaze */
.modechoose { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 2px; }

/* Погляд — visual gaze stage */
#gazeStage { margin-top: 18px; }
.gaze-wrap { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.gaze-frame { position: relative; flex: 1 1 420px; min-width: 280px; max-height: 72vh; overflow: auto; border: 1px solid rgba(0,0,0,.14); border-radius: 8px; background: #fff; }
.gaze-img { display: block; width: 100%; height: auto; }
.gaze-canvas { position: absolute; top: 0; left: 0; pointer-events: none; }
.gaze-rail { flex: 0 1 320px; min-width: 240px; max-height: 72vh; overflow: auto; background: rgba(18,18,22,.95); color: #eee; border-radius: 8px; padding: 14px; font: 14px/1.5 system-ui, sans-serif; }
.gaze-rail-head { font-weight: 700; opacity: .7; margin-bottom: 10px; font-size: 13px; letter-spacing: .04em; }
.gaze-row { margin: 0 0 12px; padding: 8px 10px; border-left: 3px solid #5a8cff; background: rgba(255,255,255,.05); border-radius: 4px; }
.gaze-felt { display: inline-block; padding: 1px 9px; border-radius: 10px; color: #111; font-weight: 700; font-size: 12px; }
.gaze-why { opacity: .88; margin-top: 5px; }
.gaze-note { color: #ffb0b0; margin-top: 5px; }
.gaze-hint { color: #bfe3ff; margin-top: 3px; }
.gaze-next { margin-top: 14px; }
.gaze-level { margin: 22px 0 8px; font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mut, #666); border-top: 1px solid rgba(0,0,0,.1); padding-top: 12px; }
.gaze-level:first-child { border-top: 0; padding-top: 0; margin-top: 4px; }

/* attention-simulation video + text plan */
.gaze-video { display: block; width: 100%; max-height: 72vh; border-radius: 8px; border: 1px solid rgba(0,0,0,.14); background: #000; }
.gaze-plan { margin-top: 14px; }
.gaze-plan .gaze-row { background: rgba(0,0,0,.03); color: var(--ink); }
.gaze-plan .gaze-why { opacity: 1; color: var(--ink); }
.gaze-plan .gaze-note { color: #c0392b; }
.gaze-plan .gaze-hint { color: #2b6cb0; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; opacity: .6; border: 1px solid currentColor; border-radius: 6px; padding: 1px 6px; margin-left: 6px; }

/* trust badge block on step 1 */
/* The badge is a real offer, not a footnote. It was a bare underlined .linkbtn
   under the primary button — and the founder himself missed it twice. Given the
   grounded catalog (USABILITY-AUDIT.md): an element with no focus and no frame
   is scanned past. So: framed, headed, with a real control — but GHOST, never
   primary: one focal point stays with «Так, оце воно» (візуальна ієрархія). */
.badgeblock {
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 10px;
  background: rgba(0,0,0,.015);
}
.badge-head { margin: 0 0 6px; font-size: 1rem; font-weight: 600; }
