/* Unit u04 duo quiz engine (engine-u04-quiz-languages.js). Tokens only, so the dark mode in tools.css works.
   Each dimension has its own hue (--dim), set by [data-dim]. */
.tool.u4 { --c0: 190 40 120; --c1: 112 50 220; --c2: 186 92 8; --c3: 8 128 108; --c4: 30 95 200; gap: 14px; }
.tool.u4 [data-dim="0"] { --dim: var(--c0); } .tool.u4 [data-dim="1"] { --dim: var(--c1); } .tool.u4 [data-dim="2"] { --dim: var(--c2); }
.tool.u4 [data-dim="3"] { --dim: var(--c3); } .tool.u4 [data-dim="4"] { --dim: var(--c4); }
.tool.u4 button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tool .u4-screen { display: flex; flex-direction: column; }
.tool .u4-home, .tool .u4-q, .tool .u4-result, .tool .u4-handoff { display: flex; flex-direction: column; gap: 14px; }
.tool .u4-eyebrow { font-size: 13px; line-height: 18px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; color: var(--link); }
.tool .u4-h { font-size: 13px; line-height: 18px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--ink) / .55); }
.tool .u4-note { font-size: 13px; line-height: 19px; font-weight: 600; color: rgb(var(--ink) / .55); padding: 12px 14px; border-radius: 14px; background: rgb(var(--ink) / .04); }
.tool .u4-banner { padding: 12px 16px; border-radius: 16px; background: rgb(var(--accent) / .14); font-size: 15px; line-height: 22px; font-weight: 700; color: rgb(var(--ink)); }

/* Tabs (segmented control) */
.tool .u4-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 22px; background: rgb(var(--ink) / .06); overflow-x: auto; scrollbar-width: none; }
.tool .u4-tabs::-webkit-scrollbar { display: none; }
.tool .u4-tabs button { flex: 1 0 auto; min-height: 40px; padding: 0 14px; border-radius: 18px; font-size: 14px; font-weight: 800; color: rgb(var(--ink) / .6); background: transparent; white-space: nowrap; transition: background-color .2s ease, color .2s ease; }
.tool .u4-tabs button[aria-selected="true"] { background: var(--surface); color: rgb(var(--ink)); box-shadow: 0 1px 4px rgb(var(--ink) / .1); }
.tool .u4-tabs button:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: -2px; }
.tool .u4-panel { display: flex; flex-direction: column; gap: 14px; }

/* Duo board */
.tool .u4-board { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; }
.tool .u4-plus { align-self: center; font-size: 22px; font-weight: 900; color: rgb(var(--ink) / .3); }
.tool .u4-slot { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 12px 14px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.tool .u4-avatar { width: 56px; height: 56px; border-radius: 28px; display: grid; place-items: center; font-size: 22px; font-weight: 900; color: #fff; background: var(--ramp); }
.tool .u4-slot:not(.is-done) .u4-avatar { background: transparent; box-shadow: inset 0 0 0 2px rgb(var(--accent) / .45); }
.tool .u4-slot.is-done .u4-avatar[data-dim] { background: rgb(var(--dim)); }
.tool .u4-slot-who { font-size: 16px; line-height: 22px; font-weight: 850; color: rgb(var(--ink)); overflow-wrap: anywhere; }
.tool .u4-slot-top { font-size: 18px; line-height: 24px; font-weight: 900; color: rgb(var(--ink)); text-wrap: balance; margin-top: -4px; }
.tool .u4-slot-hint { font-size: 14px; line-height: 20px; font-weight: 650; color: rgb(var(--ink) / .55); }
.tool .u4-slot-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: auto; }
.tool .u4-slot-actions input { text-align: center; min-height: 44px; }
.tool .u4-slot-actions .btn { width: 100%; min-height: 48px; padding: 0 12px; font-size: 16px; }
.tool .u4-link { min-height: 44px; padding: 0 10px; border-radius: 20px; background: transparent; font-size: 15px; font-weight: 800; color: var(--link); display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.tool .u4-link.is-quiet { color: rgb(var(--ink) / .6); }
.tool .u4-link.is-inline { min-height: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.tool .u4-link .tool-icon { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) { .tool .u4-link:not(.is-inline):hover { background: rgb(var(--ink) / .06); } }
.tool .u4-meta { text-align: center; }
.tool .u4-pair-go .btn { width: 100%; }

/* Question */
.tool .u4-qhead { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.tool .u4-count { margin-left: auto; font-size: 14px; font-weight: 800; color: rgb(var(--ink) / .5); font-variant-numeric: tabular-nums; }
.tool .u4-who { font-size: 13px; font-weight: 850; padding: 4px 10px; border-radius: 12px; background: rgb(var(--accent) / .14); color: rgb(var(--ink)); }
.tool .u4-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 12px 0 4px; border-radius: 22px; font-size: 15px; font-weight: 800; color: rgb(var(--ink) / .6); background: transparent; }
.tool .u4-back .tool-icon { width: 20px; height: 20px; }
.tool .u4-progress { height: 6px; border-radius: 3px; background: rgb(var(--ink) / .08); overflow: hidden; }
.tool .u4-progress > span { display: block; height: 100%; background: var(--ramp); transform-origin: left; transition: transform .35s var(--ease-out); }
.tool .u4-prompt { font-size: 22px; line-height: 30px; font-weight: 900; letter-spacing: -.01em; color: rgb(var(--ink)); text-wrap: balance; min-height: 60px; display: flex; align-items: flex-end; }
.tool .u4-ask { font-size: 15px; line-height: 20px; font-weight: 750; color: rgb(var(--ink) / .55); margin-top: -8px; }
.tool .u4-opts { display: grid; gap: 10px; }
.tool .u4-opts.is-two .u4-opt { min-height: 96px; font-size: 18px; line-height: 26px; }
.tool .u4-opt {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 14px 16px; border-radius: 20px; text-align: left;
  background: var(--surface); color: rgb(var(--ink)); font-size: 16px; line-height: 23px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgb(var(--ink) / .08), 0 1px 2px rgb(var(--ink) / .04);
  transition: box-shadow .2s ease, background-color .2s ease, transform .16s var(--ease-out); user-select: none;
}
@media (hover: hover) and (pointer: fine) { .tool .u4-opt:hover { box-shadow: inset 0 0 0 2px rgb(var(--accent) / .45); } }
.tool .u4-opt:active { transform: scale(.98); }
.tool .u4-opt:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px rgb(var(--accent)), 0 0 0 4px rgb(var(--accent) / .2); }
.tool .u4-opt.is-picked { box-shadow: inset 0 0 0 2px rgb(var(--accent)); background: rgb(var(--accent) / .12); }
.tool .u4-key { flex: none; width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; font-size: 13px; font-weight: 900; background: var(--surface-2); color: rgb(var(--ink) / .55); transition: background-color .2s ease, color .2s ease; }
.tool .u4-opt.is-picked .u4-key { background: rgb(var(--accent)); color: #fff; }

/* Result */
.tool .u4-top { font-size: 40px; line-height: 44px; font-weight: 950; letter-spacing: -.03em; color: rgb(var(--ink)); text-wrap: balance; outline: 0; }
.tool .u4-top[data-dim], .tool .u4-top span[data-dim] { color: rgb(var(--dim)); }
.tool .u4-amp { color: rgb(var(--ink) / .35); }
.tool .u4-bars { display: grid; gap: 12px; padding: 16px; border-radius: 20px; background: var(--surface); }
.tool .u4-bars li { display: grid; gap: 5px; padding: 0; background: none; animation: u4-in .4s var(--ease-out) both; animation-delay: calc(var(--d) * 50ms); }
.tool .u4-bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; line-height: 20px; font-weight: 800; }
.tool .u4-bar-label b { font-variant-numeric: tabular-nums; color: rgb(var(--ink) / .6); white-space: pre; }
.tool .u4-bar { height: 10px; border-radius: 5px; background: rgb(var(--ink) / .07); overflow: hidden; }
.tool .u4-bar > span { display: block; height: 100%; border-radius: 5px; background: rgb(var(--dim)); transform: scaleX(0); transform-origin: left; transition: transform .7s var(--ease-out); }
.tool .u4-bar.is-other { height: 6px; }
.tool .u4-bar.is-other > span { background: rgb(var(--dim) / .4); }
.tool .u4-legend { display: flex; gap: 16px; font-size: 13px; font-weight: 800; color: rgb(var(--ink) / .6); margin-bottom: -6px; }
.tool .u4-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tool .u4-legend span::before { content: ''; width: 18px; height: 8px; border-radius: 4px; background: rgb(var(--ink) / .7); }
.tool .u4-legend .u4-key-them::before { height: 5px; background: rgb(var(--ink) / .3); }
@keyframes u4-in { from { opacity: 0; transform: translateY(6px); } }

.tool .u4-say, .tool .u4-ideabox { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px; background: var(--surface); }
.tool .u4-say ul { display: grid; gap: 8px; }
.tool .u4-say li { font-size: 16px; line-height: 23px; font-weight: 700; color: rgb(var(--ink)); padding-left: 12px; box-shadow: inset 3px 0 0 rgb(var(--accent) / .35); }
.tool .u4-ideahead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tool .u4-ideahead .tool-chips button { min-height: 34px; padding: 0 12px; font-size: 13px; }
.tool .u4-ideas { display: grid; gap: 8px; }
.tool .u4-ideas li { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; line-height: 23px; font-weight: 650; }
.tool .u4-ideas .tool-icon { flex: none; width: 18px; height: 18px; margin-top: 3px; color: rgb(var(--accent)); }
.tool .u4-ideabox > .u4-link { align-self: flex-start; margin-left: -10px; }
.tool .u4-iconbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; font-size: 14px; font-weight: 800; color: rgb(var(--ink) / .7); background: rgb(var(--ink) / .06); }
.tool .u4-iconbtn .tool-icon { width: 16px; height: 16px; }
.tool .u4-actions .btn { flex: 1 1 auto; }
.tool .u4-minor .u4-link { min-height: 44px; }
.tool .u4-minor { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-top: -4px; }

/* Pair result */
.tool .u4-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool .u4-duo-col { padding: 14px; border-radius: 20px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tool .u4-duo-col .u4-h { overflow-wrap: anywhere; }
.tool .u4-duo-col ol { display: grid; gap: 6px; counter-reset: r; }
.tool .u4-duo-col li { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; column-gap: 6px; row-gap: 4px; font-size: 14px; line-height: 19px; font-weight: 750; counter-increment: r; }
.tool .u4-duo-col li .u4-bar { grid-column: 2 / 4; height: 5px; }
.tool .u4-duo-col li::before { content: counter(r); grid-row: 1 / 3; width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff; background: rgb(var(--dim)); align-self: center; }
.tool .u4-duo-col li > span { min-width: 0; }
.tool .u4-duo-col li b { font-size: 12px; color: rgb(var(--ink) / .45); font-variant-numeric: tabular-nums; }
.tool .u4-pair { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.tool .u4-pair.is-new { animation: card-in .45s var(--ease-out) both; }
.tool .u4-pair-dots { display: flex; }
.tool .u4-pair-dots span { width: 28px; height: 28px; border-radius: 14px; background: rgb(var(--dim)); box-shadow: 0 0 0 3px var(--surface); }
.tool .u4-pair-dots span + span { margin-left: -8px; }
.tool .u4-pair-title { font-size: 22px; line-height: 28px; font-weight: 900; letter-spacing: -.01em; color: rgb(var(--ink)); text-wrap: balance; }
.tool .u4-pair-row { display: grid; gap: 4px; }
.tool .u4-pair-row p:not(.u4-h) { font-size: 16px; line-height: 24px; font-weight: 650; }
.tool .u4-pair-row.is-cupie { padding: 12px 14px; border-radius: 16px; background: rgb(var(--accent) / .1); }
.tool .u4-two { display: grid; gap: 12px; }

@media (min-width: 600px) {
  .tool .u4-two { grid-template-columns: 1fr 1fr; align-items: start; }
  .tool .u4-opts.is-two { grid-template-columns: 1fr 1fr; }
  .tool .u4-opts.is-two .u4-opt { min-height: 120px; flex-direction: column; align-items: flex-start; justify-content: flex-start; }
  .tool .u4-top { font-size: 48px; line-height: 52px; }
  .tool .u4-prompt { font-size: 26px; line-height: 34px; }
}
@media (max-width: 599px) {
  .tool .u4-board { grid-template-columns: 1fr 1fr; }
  .tool .u4-plus { display: none; }
  .tool .u4-top { font-size: 34px; line-height: 38px; }
  .tool .u4-slot { padding: 16px 10px 12px; }
  .tool .u4-actions .btn { width: 100%; }
  .tool .u4-duo { gap: 6px; }
  .tool .u4-duo-col { padding: 12px 10px; }
  .tool .u4-duo-col li { font-size: 13px; line-height: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool .u4-bar > span, .tool .u4-progress > span { transition: none; }
  .tool .u4-bars li, .tool .u4-pair.is-new { animation: none; }
}
@media (prefers-color-scheme: dark) {
  .tool.u4 { --c0: 240 120 180; --c1: 170 130 255; --c2: 245 160 80; --c3: 70 200 175; --c4: 110 165 255; }
  .tool .u4-opt.is-picked .u4-key { color: #12061F; }
  .tool .u4-slot.is-done .u4-avatar[data-dim], .tool .u4-duo-col li::before { color: #12061F; }
}

/* Print: only the result (or the paper sheet) */
.u4-sheet { display: none; }
@media print {
  body * { visibility: hidden !important; }
  .tool .u4-printable, .tool .u4-printable * { visibility: visible !important; }
  .tool .u4-printable { position: absolute; left: 0; top: 0; width: 100%; }
  .tool .u4-printable .u4-actions, .tool .u4-printable .u4-minor, .tool .u4-printable .u4-link, .tool .u4-printable .tool-chips, .tool .u4-printable .u4-iconbtn { display: none !important; }
  .u4-printing body > *:not(.u4-sheet) { display: none !important; }
  .u4-printing .u4-sheet, .u4-printing .u4-sheet * { visibility: visible !important; }
  .u4-printing .u4-sheet { display: block; font: 12px/1.4 system-ui, sans-serif; color: #000; }
  .u4-sheet ol { padding-left: 18px; }
  .u4-sheet li { break-inside: avoid; margin: 0 0 10px; }
  .u4-sheet table { width: 100%; border-collapse: collapse; margin-top: 4px; }
  .u4-sheet td, .u4-sheet th { border-bottom: 1px solid #ccc; padding: 3px 4px; text-align: left; }
  .u4-sheet td + td, .u4-sheet th + th { width: 56px; text-align: center; }
  .u4-sheet-title { font-size: 16px; font-weight: 800; margin: 8px 0; }
}

/* v2: start-screen question, quick pick, tie blurbs, send box */
.tool .u4-where { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.tool .u4-where .tool-chips button { min-height: 36px; padding: 0 14px; font-size: 14px; }
.tool .u4-slot .u4-avatar .tool-icon { width: 24px; height: 24px; color: rgb(var(--accent)); }
.tool .u4-slot.is-done .u4-avatar .tool-icon { color: #fff; }
.tool .u4-dot { background: rgb(var(--dim)) !important; width: 16px; height: 16px; margin: 0 7px; }
.tool .u4-blurb b { color: rgb(var(--dim)); }
.tool .u4-method { margin-top: -4px; }
.tool .u4-send { display: flex; flex-direction: column; gap: 12px; }
.tool .u4-pair-sub { font-size: 15px; line-height: 22px; font-weight: 700; color: rgb(var(--ink) / .6); margin-top: -8px; }
@media (min-width: 600px) {
  .tool .u4-opts.is-two .u4-opt { justify-content: flex-start; gap: 12px; }
}

/* v3: named two-person bars, clearer secondary buttons */
.tool .u4-bars.is-duo li { gap: 6px; }
.tool .u4-duo-row { display: grid; grid-template-columns: minmax(48px, 30%) 1fr auto; align-items: center; gap: 8px; }
.tool .u4-duo-name { font-size: 13px; line-height: 16px; font-weight: 800; color: rgb(var(--ink) / .65); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .u4-duo-row b { font-size: 13px; font-weight: 800; color: rgb(var(--ink) / .55); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.tool .u4-duo-row.is-other .u4-bar { height: 10px; }
.tool .u4-duo-row.is-other .u4-bar > span { background: repeating-linear-gradient(135deg, rgb(var(--dim)) 0 6px, rgb(var(--dim) / .55) 6px 9px); }
.tool.u4 .btn-secondary { box-shadow: inset 0 0 0 1.5px rgb(var(--ink) / .14); }
.tool .u4-where { padding: 8px 12px; border-radius: 18px; background: var(--surface); }

/* v4: phone landing stacks the two cards; pair card Cupie line reads as a footnote; chart-safe scroll offset */
.tool.u4 { scroll-margin-top: 88px; }
.tool .u4-where-hint { flex-basis: 100%; text-align: center; font-size: 12px; line-height: 16px; font-weight: 650; color: rgb(var(--ink) / .5); }
.tool .u4-pair-row.is-cupie { padding: 12px 0 0; border-radius: 0; background: transparent; box-shadow: inset 0 1px 0 rgb(var(--ink) / .08); }
.tool .u4-pair-row.is-cupie p:not(.u4-h) { font-size: 14px; line-height: 20px; color: rgb(var(--ink) / .6); }
@media (max-width: 599px) {
  .tool .u4-board { grid-template-columns: 1fr; gap: 10px; }
  .tool .u4-slot { display: grid; grid-template-columns: 48px 1fr; align-items: center; text-align: left; column-gap: 12px; row-gap: 2px; padding: 14px; }
  .tool .u4-slot .u4-avatar { width: 48px; height: 48px; grid-row: 1 / 3; }
  .tool .u4-slot-who { grid-column: 2; }
  .tool .u4-slot-top { grid-column: 2; margin-top: 0; }
  .tool .u4-slot-actions { grid-column: 1 / -1; margin-top: 10px; }
  .tool .u4-slot:not(.is-done) .u4-slot-who { grid-row: 1 / 3; }
  .tool .u4-slot-hint { text-align: left; }
}

/* v5: tie chips, home link, prompt focus */
.tool .u4-also { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: rgb(var(--ink) / .55); margin-top: -6px; }
.tool .u4-also-chip { padding: 3px 10px; border-radius: 12px; background: rgb(var(--dim) / .14); color: rgb(var(--dim)); }
.tool .u4-prompt:focus { outline: 0; }
.tool .u4-home-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--surface); text-align: left; color: rgb(var(--ink)); font-size: 14px; line-height: 20px; font-weight: 650; box-shadow: inset 0 0 0 1.5px rgb(var(--accent) / .3); }
.tool .u4-home-link b { font-size: 16px; font-weight: 850; }
.tool .u4-home-link .tool-icon { flex: none; color: var(--link); }
.tool .u4-scores-h { margin-bottom: -6px; }

/* v6: focus mode, script line, insights */
.u4-focus main.article > :not(.tool):not(script), .u4-focus .tool.u4 > .u4-tabs { display: none; }
.tool .u4-back[disabled] { opacity: .35; }
.tool .u4-qhead .u4-back + .u4-back { margin-left: -6px; }
.tool .u4-script { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: rgb(var(--accent) / .08); font-size: 16px; line-height: 23px; font-weight: 800; color: rgb(var(--ink)); }
.tool .u4-script span { font-size: 12px; line-height: 16px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; color: var(--link); }
.tool .u4-insights { display: grid; gap: 6px; padding: 14px 16px; border-radius: 18px; background: var(--surface); }
.tool .u4-insights li { font-size: 15px; line-height: 22px; font-weight: 650; }
.tool .u4-note { color: rgb(var(--ink) / .7); }
@media (min-width: 600px) { .tool .u4-slot { padding: 14px 12px 12px; gap: 6px; } .tool .u4-avatar { width: 48px; height: 48px; } }
.u4-focus .tool.u4 { min-height: calc(100dvh - 120px); }

/* v7: named pair headline, all-five fold-out, focus mode hides the footer */
.tool .u4-top-duo { display: grid; gap: 4px; }
.tool .u4-who-line { display: grid; }
.tool .u4-who-line small { font-size: 13px; line-height: 18px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--ink) / .5); }
.tool .u4-all { padding: 0 16px; border-radius: 18px; background: var(--surface); }
.tool .u4-all summary { min-height: 48px; display: flex; align-items: center; font-size: 15px; font-weight: 800; cursor: pointer; color: rgb(var(--ink)); }
.tool .u4-all ul { display: grid; gap: 10px; padding-bottom: 16px; }
.tool .u4-all li { font-size: 15px; line-height: 22px; font-weight: 600; }
.tool .u4-all li b { color: rgb(var(--dim)); }
.u4-focus footer, .u4-focus .footer { display: none; }

/* v8: best / watch lines, skip link, result link */
.tool .u4-all li { display: grid; gap: 2px; }
.tool .u4-bw { font-size: 14px; line-height: 20px; color: rgb(var(--ink) / .75); }
.tool .u4-bw i { font-style: normal; font-weight: 800; color: rgb(var(--ink) / .55); }
.tool .u4-skip { align-self: center; }
.tool .u4-scores .u4-bars { padding: 0 0 14px; background: none; }
.tool .u4-slot-hint { color: rgb(var(--ink) / .65); }
.tool.u4 .tool-sub { color: rgb(var(--ink) / .72); }
.tool.u4 .tool-note { color: rgb(var(--ink) / .68); }
