/* ============================================================
   Nir & Far tool widgets — styled to match nirandfar.com.
   Tokens pulled from the live site:
   Questrial (headings/UI), Open Sans (body), Noto Serif (accent);
   gold #A38755 accent, ink #2C2E2F, warm paper #F2F1ED.
   Self-contained and embeddable. No site chrome, no gate.
   ============================================================ */
:root {
  --q: "Questrial", Helvetica, Arial, sans-serif;
  --body: "Open Sans", Helvetica, Arial, sans-serif;
  --serif: "Noto Serif", Georgia, serif;

  --gold: #A38755;
  --gold-d: #8b7043;
  --ink: #2C2E2F;
  --text: #33342f;
  --muted: #6f7069;
  --paper: #F2F1ED;
  --paper-2: #eae8e1;
  --brown: #3A2F27;
  --blue: #0066CC;
  --line: #e2e0d9;
  --white: #ffffff;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  color: var(--text);
  background: var(--white);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.nf-wrap { max-width: 760px; margin: 0 auto; padding: 28px 22px 40px; }

/* headings */
h1, h2, h3, h4 { font-family: var(--q); color: var(--ink); font-weight: 400; margin: 0; line-height: 1.15; }
.nf-kicker { font-family: var(--q); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; }
.nf-title { font-size: clamp(28px, 5vw, 40px); letter-spacing: -0.5px; }
.nf-intro { color: var(--muted); margin: 12px 0 0; max-width: 60ch; }
.nf-serif-i { font-family: var(--serif); font-style: italic; }
.nf-head { margin-bottom: 26px; }

/* buttons — match his gold CTA */
.nf-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--q); font-size: 16px; letter-spacing: .3px;
  padding: 12px 30px; border-radius: var(--radius); border: 1px solid var(--gold);
  background: var(--gold); color: var(--white); text-decoration: none;
  transition: background .18s, border-color .18s, transform .15s;
}
.nf-btn:hover { background: var(--gold-d); border-color: var(--gold-d); transform: translateY(-1px); }
.nf-btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.nf-btn.ghost:hover { background: var(--paper); border-color: var(--gold); color: var(--ink); }
.nf-submit { margin-top: 30px; }
.nf-note { margin-top: 14px; font-size: 14px; color: var(--muted); min-height: 20px; }
.nf-note.ok { color: var(--gold-d); }

/* ---------- scorecard form ---------- */
.q { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 24px 0; }
.q legend { font-family: var(--q); font-size: 20px; color: var(--ink); padding: 0; display: flex; gap: 12px; align-items: baseline; line-height: 1.3; }
.q-n { font-size: 14px; color: var(--gold); min-width: 20px; }
.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 16px; max-width: 420px; }
.lk { position: relative; }
.lk input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.lk span { display: grid; place-items: center; height: 46px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); font-family: var(--q); color: var(--muted); cursor: pointer; transition: all .15s; }
.lk:hover span { border-color: var(--gold); }
.lk input:checked + span { background: var(--gold); color: #fff; border-color: var(--gold); }
.lk input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.likert-ends { display: flex; justify-content: space-between; max-width: 420px; margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ---------- result card ---------- */
.result-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 4vw, 40px); margin-top: 8px; }
.rc-top { display: grid; grid-template-columns: 1fr auto; gap: 26px; align-items: center; }
.rc-num { font-family: var(--q); font-size: clamp(52px, 9vw, 84px); line-height: .95; color: var(--ink); }
.rc-num em { font-style: normal; font-size: .3em; color: var(--muted); }
.rc-band { font-family: var(--serif); font-style: italic; font-size: clamp(20px, 3vw, 26px); color: var(--gold); margin-top: 6px; }
.rc-note { margin-top: 18px; color: var(--text); max-width: 60ch; }
.rc-bars { margin-top: 24px; display: grid; gap: 13px; }
.rc-bar { display: grid; grid-template-columns: 160px 1fr 34px; gap: 12px; align-items: center; font-size: 14px; }
.rc-lab { color: var(--muted); }
.rc-track { height: 8px; background: var(--paper-2); border-radius: 100px; overflow: hidden; }
.rc-fill { display: block; height: 100%; border-radius: 100px; }
.rc-fill.behavior, .rc-fill.ink { background: var(--gold); }
.rc-fill.attention { background: var(--blue); }
.rc-fill.belief { background: var(--brown); }
.rc-v { font-family: var(--q); text-align: right; color: var(--ink); }
.rc-plan { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.rc-plan h3 { font-size: clamp(20px, 3vw, 26px); }
.rc-plan h3 .mk { color: var(--gold); font-family: var(--serif); font-style: italic; }
.rc-plan h4 { font-family: var(--q); font-size: 17px; margin-top: 22px; text-transform: capitalize; color: var(--ink); }
.rc-plan p { margin-top: 9px; color: var(--text); max-width: 62ch; }
.rc-actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.rc-fine { margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* radar */
.radar { width: clamp(190px, 30vw, 240px); height: auto; }
.radar-ring, .radar-axis { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-fill { fill: rgba(163, 135, 85, .22); stroke: var(--gold); stroke-width: 2; }
.radar-dot { fill: var(--gold); }
.radar-lab { font-family: var(--q); font-size: 11px; letter-spacing: .4px; fill: var(--muted); text-transform: uppercase; }

/* ---------- matrix ---------- */
.mx-wrap { display: grid; grid-template-columns: 1fr .9fr; gap: clamp(24px, 4vw, 44px); align-items: start; }
.mx-svg { width: 100%; height: auto; }
.mx-cell { fill: var(--paper); stroke: #fff; stroke-width: 2; transition: fill .2s; }
.mx-cell.on.fac { fill: rgba(163,135,85,.30); }
.mx-cell.on.ent { fill: rgba(0,102,204,.16); }
.mx-cell.on.ped { fill: rgba(58,47,39,.14); }
.mx-cell.on.deal { fill: rgba(58,47,39,.30); }
.mx-clabel { font-family: var(--q); font-size: 13px; fill: var(--ink); }
.mx-axtitle { font-family: var(--body); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; fill: var(--muted); }
#mx-dot { fill: var(--gold); stroke: #fff; stroke-width: 3; transition: cx .12s, cy .12s; }
.mx-controls { margin-top: 22px; display: grid; gap: 20px; }
.mx-ctrl label { display: flex; justify-content: space-between; font-family: var(--q); font-size: 15px; margin-bottom: 10px; color: var(--ink); }
.mx-ctrl label b { color: var(--gold); }
.mx-ctrl input[type=range] { width: 100%; accent-color: var(--gold); }
.mx-read { margin-top: 4px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: clamp(20px, 3vw, 28px); }
.mx-read.q-ent { border-left-color: var(--blue); }
.mx-read.q-ped, .mx-read.q-deal { border-left-color: var(--brown); }
.mx-qname { font-family: var(--q); font-size: clamp(24px, 3.4vw, 32px); color: var(--ink); }
.mx-read p { margin-top: 10px; color: var(--text); }
.mx-copy { margin-top: 18px; }

/* ---------- belief ---------- */
.bl-field { border-top: 1px solid var(--line); padding: 24px 0; }
.bl-field:first-child { border-top: 0; padding-top: 0; }
.bl-field label { display: block; font-family: var(--q); font-size: 20px; color: var(--ink); }
.bl-field .hint { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.bl-field input, .bl-field textarea, #bl-newbelief {
  width: 100%; margin-top: 12px; padding: 13px 15px; border: 1px solid var(--line);
  background: #fff; border-radius: var(--radius); font-family: var(--body); font-size: 16px; color: var(--ink);
  outline: none; transition: border-color .18s; resize: vertical;
}
.bl-field input:focus, .bl-field textarea:focus, #bl-newbelief:focus { border-color: var(--gold); }
.bl-tag { font-family: var(--q); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); display: block; }
.bl-old { margin-top: 18px; }
.bl-old p { font-family: var(--serif); font-style: italic; font-size: clamp(21px, 3.2vw, 30px); margin-top: 8px; color: var(--ink); line-height: 1.25; }
.bl-powers { margin-top: 16px; display: grid; gap: 12px; }
.bl-power { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: 18px 20px; }
.bl-pk { font-family: var(--q); font-size: 18px; color: var(--gold); }
.bl-lens { margin-top: 7px; color: var(--muted); font-size: 14.5px; }
.bl-ans { margin-top: 9px; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--ink); }
.bl-ans.bl-empty { color: var(--muted); font-style: normal; font-family: var(--body); font-size: 14px; }
.bl-new { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
#bl-newbelief { font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2.6vw, 25px); line-height: 1.3; margin-top: 12px; }
.bl-exp { margin-top: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.bl-exp p { margin-top: 9px; color: var(--text); }

/* ---------- timebox ---------- */
.tb-domain { border-top: 1px solid var(--line); padding: 22px 0; }
.tb-domain:first-of-type { border-top: 0; padding-top: 0; }
.tb-domain h3 { font-size: 22px; }
.tb-domain .hint { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.tb-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 14px; }
.tb-inputs label { display: block; font-family: var(--q); font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.tb-inputs label b { color: var(--gold); float: right; }
.tb-inputs input[type=range] { width: 100%; accent-color: var(--gold); }
.tb-hrs { display: flex; align-items: center; gap: 10px; }
.tb-hrs input[type=number] { width: 92px; padding: 11px 13px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); font-family: var(--q); font-size: 20px; color: var(--ink); outline: none; }
.tb-hrs input:focus { border-color: var(--gold); }
.tb-hrs span { font-size: 13px; color: var(--muted); }
.tb-total { margin-top: 20px; font-family: var(--q); font-size: 18px; color: var(--ink); }
.tb-left { color: var(--blue); } .tb-over { color: var(--brown); }
.tb-bar { display: flex; height: 26px; border-radius: 100px; overflow: hidden; margin-top: 12px; background: var(--paper-2); border: 1px solid var(--line); }
.tb-seg { height: 100%; }
.tb-seg.behavior { background: var(--gold); } .tb-seg.attention { background: var(--blue); } .tb-seg.belief { background: var(--brown); }
.tb-legend { display: flex; gap: 18px; margin-top: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.tb-legend span { display: inline-flex; align-items: center; gap: 7px; }
.tb-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.tb-dot.behavior { background: var(--gold); } .tb-dot.attention { background: var(--blue); } .tb-dot.belief { background: var(--brown); }
.tb-rows { margin-top: 24px; display: grid; gap: 10px; }
.tb-row { display: flex; align-items: center; gap: 12px; font-size: 15px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.tb-name { font-family: var(--q); min-width: 110px; color: var(--ink); }
.tb-vs { color: var(--muted); } .tb-vs b { font-family: var(--q); color: var(--ink); }
.tb-delta { margin-left: auto; font-family: var(--q); font-size: 12px; padding: 4px 10px; border-radius: 100px; }
.tb-delta.over { background: rgba(58,47,39,.12); color: var(--brown); }
.tb-delta.under { background: rgba(163,135,85,.16); color: var(--gold-d); }
.tb-delta.ok { background: rgba(0,102,204,.12); color: var(--blue); }

@media (max-width: 720px) {
  .mx-wrap, .rc-top, .tb-inputs { grid-template-columns: 1fr; }
  .rc-bar { grid-template-columns: 120px 1fr 30px; }
}

/* ---------- guided playbook (wizard) ---------- */
.pb-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; }
.pb-progress .seg { height: 4px; flex: 1; background: var(--paper-2); border-radius: 100px; overflow: hidden; }
.pb-progress .seg i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .35s ease; }
.pb-progress .seg.done i, .pb-progress .seg.on i { width: 100%; }
.pb-progress .seg.on i { width: 55%; }
.pb-count { font-family: var(--q); font-size: 13px; color: var(--muted); white-space: nowrap; }

.pb-stage { min-height: 340px; }
.pb-step { animation: pb-in .35s ease both; }
@keyframes pb-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pb-q { font-family: var(--q); font-size: clamp(24px, 4vw, 34px); color: var(--ink); line-height: 1.2; }
.pb-help { color: var(--muted); margin: 10px 0 22px; font-size: 15.5px; }
.pb-choices { display: grid; gap: 10px; }
.pb-choice {
  text-align: left; width: 100%; cursor: pointer; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; font-family: var(--body); transition: border-color .15s, background .15s, transform .12s;
  display: flex; align-items: baseline; gap: 12px;
}
.pb-choice:hover { border-color: var(--gold); transform: translateY(-1px); }
.pb-choice.selected { border-color: var(--gold); background: rgba(163,135,85,.08); box-shadow: inset 0 0 0 1px var(--gold); }
.pb-choice .cl { font-family: var(--q); font-size: 18px; color: var(--ink); }
.pb-choice .cd { display: block; color: var(--muted); font-size: 14px; margin-top: 3px; }
.pb-choice .rad { flex: none; width: 18px; height: 18px; border-radius: 100px; border: 1.5px solid var(--line); margin-top: 3px; position: relative; transition: border-color .15s; }
.pb-choice.selected .rad { border-color: var(--gold); }
.pb-choice.selected .rad::after { content: ""; position: absolute; inset: 3px; border-radius: 100px; background: var(--gold); }
.pb-extra { margin-top: 16px; }
.pb-extra label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.pb-extra input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--body); font-size: 15px; color: var(--ink); outline: none; }
.pb-extra input:focus { border-color: var(--gold); }
.pb-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; gap: 12px; }
.pb-back { background: none; border: 0; color: var(--muted); font-family: var(--q); font-size: 15px; cursor: pointer; padding: 8px 4px; }
.pb-back:hover { color: var(--ink); }
.pb-back[disabled] { visibility: hidden; }

.pb-intro { text-align: left; }
.pb-intro .nf-title { margin-bottom: 12px; }

/* playbook result */
.pb-section { border-top: 1px solid var(--line); padding: 22px 0; }
.pb-section:first-of-type { border-top: 0; padding-top: 6px; }
.pb-section .pb-sn { font-family: var(--q); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }
.pb-section h4 { font-family: var(--q); font-size: 20px; color: var(--ink); margin-top: 6px; }
.pb-section p { margin-top: 8px; color: var(--text); }
.pb-section a.readmore { display: inline-block; margin-top: 10px; color: var(--blue); font-size: 14px; text-decoration: none; }
.pb-section a.readmore:hover { text-decoration: underline; }
.pb-identity { background: var(--brown); color: #f3ede2; border-radius: var(--radius); padding: 22px 24px; margin-top: 24px; font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2.8vw, 24px); }

/* ---------- live one-page tools (all questions + sticky graphic) ---------- */
.live-wrap { display: grid; grid-template-columns: 1fr 320px; gap: clamp(22px, 4vw, 44px); align-items: start; }
.live-wrap .q:first-child { border-top: 0; padding-top: 0; }
.live-side { position: sticky; top: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; text-align: center; }
.ls-label { font-family: var(--q); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.live-num { font-family: var(--q); font-size: 56px; line-height: 1; color: var(--ink); margin-top: 4px; }
.live-num em { font-style: normal; font-size: .3em; color: var(--muted); }
.live-band { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--gold); min-height: 26px; }
.live-radar { margin-top: 6px; }
.live-radar .radar { width: 100%; max-width: 240px; height: auto; transition: opacity .2s; }
.live-prog { margin-top: 8px; font-size: 13px; color: var(--muted); }
.live-weak { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); text-align: left; font-size: 14px; }
.live-weak b { font-family: var(--q); color: var(--ink); font-size: 15px; }
@media (max-width: 820px) {
  .live-wrap { grid-template-columns: 1fr; }
  .live-side { position: sticky; top: 0; z-index: 6; order: -1; text-align: left;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px;
    box-shadow: 0 12px 22px -16px rgba(58,47,39,.5); }
  .live-radar { order: -1; margin: 0; flex: none; }
  .live-radar .radar { max-width: 72px; }
  .ls-head { flex: 1; text-align: left; }
  .live-num { font-size: 32px; margin: 0; display: inline; }
  .live-band { display: inline; margin-left: 10px; font-size: 15px; min-height: 0; }
  .live-prog { flex-basis: 100%; margin: 0; }
  .live-weak { display: none; }
}

/* ---------- one-page question controls ---------- */
.qblock { border-top: 1px solid var(--line); padding: 18px 0; }
.qblock:first-child { border-top: 0; padding-top: 0; }
.qblock .ql { font-family: var(--q); font-size: 17px; color: var(--ink); }
.qblock .qh { color: var(--muted); font-size: 13px; margin-top: 3px; }
.qblock .qinput { width: 100%; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); font-family: var(--body); font-size: 15.5px; color: var(--ink); outline: none; }
.qblock .qinput:focus { border-color: var(--gold); }
.optset { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.opt { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 10px 14px; font-family: var(--q); font-size: 14.5px; color: var(--ink-soft); transition: all .15s; text-align: left; }
.opt:hover { border-color: var(--gold); }
.opt.on { border-color: var(--gold); background: rgba(163,135,85,.10); color: var(--ink); box-shadow: inset 0 0 0 1px var(--gold); }
.opt .od { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; font-family: var(--body); }
.live-side .live-cta { margin-top: 16px; display: grid; gap: 8px; }
.live-hint { color: var(--muted); font-size: 12.5px; margin-top: 12px; text-align: center; }

/* Hook loop diagram */
.loop { position: relative; width: 100%; max-width: 260px; aspect-ratio: 1; margin: 4px auto 0; }
.loop svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.loop-ring { fill: none; stroke: var(--line); stroke-width: 1.4; stroke-dasharray: 3 3; }
.loop-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-family: var(--q); font-size: 12px; color: var(--muted); max-width: 40%; text-align: center; line-height: 1.15; }
.loop-node { position: absolute; transform: translate(-50%,-50%); width: 42%; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; text-align: center; }
.loop-node.on { border-color: var(--gold); background: rgba(163,135,85,.12); }
.loop-node .nt { font-family: var(--q); font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.loop-node.on .nt { color: var(--gold-d); }
.loop-node .nv { font-family: var(--q); font-size: 12px; color: var(--ink); margin-top: 1px; line-height: 1.15; min-height: 14px; }
.n-top { left: 50%; top: 8%; } .n-right { left: 92%; top: 50%; } .n-bottom { left: 50%; top: 92%; } .n-left { left: 8%; top: 50%; }
.loop-eth { margin-top: 16px; font-family: var(--q); font-size: 15px; color: var(--muted); padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.loop-eth.on { color: var(--ink); border-color: var(--gold); background: rgba(163,135,85,.08); }

/* Belief card */
.bcard { text-align: left; }
.bc-tag { font-family: var(--q); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-top: 12px; }
.bc-old { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--ink); margin-top: 4px; }
.bc-new { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--gold-d); margin-top: 4px; }
.bc-powers { margin-top: 12px; display: grid; gap: 6px; }
.bc-row { display: grid; grid-template-columns: 84px 1fr; gap: 8px; font-size: 13px; opacity: .5; transition: opacity .2s; }
.bc-row.on { opacity: 1; }
.bc-k { font-family: var(--q); color: var(--gold-d); }
.bc-v { color: var(--ink); }
.bc-ev { margin-top: 10px; font-size: 13px; color: var(--muted); font-style: italic; }

/* Playbook plan card */
.plan-card { text-align: left; }
.pm-row { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); opacity: .5; transition: opacity .2s; }
.plan-card .pm-row:first-child { border-top: 0; }
.pm-row.on { opacity: 1; }
.pm-n { font-family: var(--serif); font-style: italic; color: var(--gold); }
.pm-t { font-family: var(--q); font-size: 13px; color: var(--muted); }
.pm-v { font-size: 14px; color: var(--ink); margin-top: 1px; }
.pm-identity { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--paper-2); color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 15px; opacity: .5; transition: opacity .2s, background .2s, color .2s; }
.pm-identity.on { opacity: 1; background: var(--brown); color: #f3ede2; }
