:root {
  --teal: #0c4e54;
  --teal-2: #30686c;
  --teal-soft: #dfe8e7;
  --cream: #f7f6f2;
  --paper: #ffffff;
  --gold: #b58a2e;
  --gold-soft: #f1e6cc;
  --ink: #16201f;
  --muted: #55605f;
  --faint: #8d9796;
  --line: #dcdcd3;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --text-sm: clamp(0.85rem, 0.8rem + 0.2vw, 0.95rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --text-xl: clamp(1.6rem, 1.3rem + 1.4vw, 2.4rem);
  --text-2xl: clamp(2.3rem, 1.6rem + 3vw, 4.25rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: var(--sans); font-size: var(--text-base); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { width: min(100% - 2.5rem, 880px); margin-inline: auto; }
a { color: var(--teal); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* top bar */
.topbar { background: var(--teal); color: var(--cream); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; flex-wrap: wrap; padding-block: .5rem; }
.brand { font-size: var(--text-sm); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.brand-sep { opacity: .5; }
.brand-model { color: #e6c77f; }
.progress { list-style: none; display: flex; gap: .35rem; margin: 0; padding: 0; }
.progress li {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .78rem; font-weight: 600; border: 1px solid rgba(247,246,242,.35); color: rgba(247,246,242,.7);
}
.progress li.done { background: rgba(247,246,242,.15); color: var(--cream); }
.progress li.current { background: var(--gold); border-color: var(--gold); color: #fff; }

main { padding-block: clamp(2rem, 5vw, 4rem) 3rem; outline: none; }
.foot { border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; font-size: var(--text-sm); color: var(--muted); }

/* type */
.eyebrow { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin: 0 0 .75rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.08; margin: 0 0 1rem; color: var(--teal); }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
.lead { font-size: var(--text-lg); color: var(--muted); max-width: 40ch; line-height: 1.45; }
p { max-width: 68ch; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }

/* intro */
.hero { background: var(--teal); color: var(--cream); border-radius: 14px; padding: clamp(2rem, 6vw, 4rem); margin-bottom: 2.5rem; position: relative; overflow: hidden; }
.hero h1 { color: var(--cream); }
.hero .lead { color: rgba(247,246,242,.82); }
.hero-letters { position: absolute; right: clamp(1rem, 4vw, 3rem); bottom: -0.15em; font-family: var(--serif); font-size: clamp(6rem, 18vw, 13rem); line-height: 1; color: rgba(247,246,242,.08); letter-spacing: -.02em; pointer-events: none; user-select: none; }
.hero .btn { margin-top: 1.25rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; padding: 0; list-style: none; }
.steps li { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; }
.steps .n { font-family: var(--serif); font-size: 1.6rem; color: var(--gold); display: block; line-height: 1; margin-bottom: .4rem; }
.new-tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: var(--gold-soft); color: #7a5a14; padding: .1rem .5rem; border-radius: 99px; margin-left: .35rem; vertical-align: middle; }

/* quadrant step */
.q-head { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem 1.75rem; align-items: end; margin-bottom: 1.75rem; }
.q-letter { font-family: var(--serif); font-size: clamp(5rem, 14vw, 8.5rem); line-height: .8; color: var(--teal); }
.q-head h2 { margin: 0; }
.q-head .eyebrow { margin-bottom: .35rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: clamp(1.25rem, 3vw, 2rem); }
.question { font-family: var(--serif); font-size: var(--text-lg); color: var(--ink); margin: 0 0 1rem; line-height: 1.3; }
.prompts { margin: 0 0 1rem; padding-left: 1.1rem; color: var(--muted); }
.prompts li { margin-bottom: .3rem; }
.note { border-left: 3px solid var(--gold); padding: .2rem 0 .2rem .9rem; color: var(--muted); font-size: var(--text-sm); margin: 0 0 1.25rem; }
textarea {
  width: 100%; min-height: 220px; resize: vertical; border: 1px solid var(--line); border-radius: 8px;
  background: var(--cream); padding: .9rem 1rem; line-height: 1.55;
}
textarea:focus, input[type=text]:focus, input[type=email]:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.saved { font-size: .8rem; color: var(--faint); margin-top: .5rem; min-height: 1.2em; }

/* nav */
.nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.75rem; flex-wrap: wrap; }
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 99px; padding: .8rem 1.5rem; font-weight: 600; cursor: pointer;
  background: var(--gold); color: #fff; transition: background .18s var(--ease), transform .18s var(--ease); text-decoration: none; display: inline-flex; align-items: center; gap: .5rem;
}
.btn:hover { background: #9c7624; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--teal); border-color: var(--line); }
.btn-ghost:hover { background: var(--teal-soft); }
.btn-teal { background: var(--teal); }
.btn-teal:hover { background: #083a3f; }
.linkbtn { background: none; border: 0; color: var(--teal); text-decoration: underline; cursor: pointer; padding: 0; font-size: var(--text-sm); }

/* cross-read tagging */
.answers-peek { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: 0 0 1.75rem; }
.peek { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; font-size: var(--text-sm); color: var(--muted); max-height: 140px; overflow: auto; }
.peek b { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; color: var(--teal); display: block; line-height: 1; margin-bottom: .3rem; }
.attr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.attr { display: grid; grid-template-columns: 1fr auto auto; gap: .6rem; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .6rem .55rem .9rem; }
.attr input[type=text] { border: 0; background: transparent; padding: .4rem 0; min-width: 0; width: 100%; }
.attr input[type=text]:focus { box-shadow: none; }
.attr:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.chips { display: flex; gap: .3rem; }
.chip { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--cream); font-family: var(--serif); font-size: 1.2rem; color: var(--muted); cursor: pointer; transition: all .15s var(--ease); }
.chip[aria-pressed=true] { background: var(--teal); border-color: var(--teal); color: var(--cream); }
.chip:hover { border-color: var(--teal); }
.remove { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 1.3rem; width: 32px; height: 32px; border-radius: 6px; }
.remove:hover { color: var(--ink); background: var(--cream); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: var(--text-sm); color: var(--muted); margin: .25rem 0 1rem; }
.legend b { font-family: var(--serif); font-weight: 400; color: var(--teal); font-size: 1.1rem; }

/* results */
.results-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2rem; align-items: start; margin-bottom: 2rem; }
.map-card { position: sticky; top: 76px; }
.map svg { width: 100%; height: auto; display: block; }
.pattern { background: var(--teal); color: var(--cream); border-radius: 12px; padding: 1.4rem 1.5rem; margin-bottom: 2rem; }
.pattern h3 { color: var(--cream); margin-bottom: .4rem; }
.pattern p { margin: 0; color: rgba(247,246,242,.85); }
.pairs { display: grid; gap: .75rem; }
.pair { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; }
.pair-top { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; margin-bottom: .3rem; }
.pair-name { font-family: var(--serif); font-size: 1.3rem; color: var(--teal); }
.pair-code { font-size: .78rem; letter-spacing: .1em; color: var(--faint); font-weight: 600; margin-left: .4rem; }
.strength { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; }
.s-0 { background: #eceae4; color: var(--muted); }
.s-1 { background: var(--teal-soft); color: var(--teal); }
.s-2 { background: var(--gold-soft); color: #7a5a14; }
.pair p { margin: 0; font-size: var(--text-sm); color: var(--muted); }
.pair .via { margin-top: .4rem; font-size: .82rem; color: var(--ink); }
.levers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.lever { border: 1px solid var(--gold); background: #fffdf7; border-radius: 10px; padding: .9rem 1rem; }
.lever strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.25rem; color: var(--ink); }
.tags { display: inline-flex; gap: .2rem; margin-top: .3rem; }
.tags span { font-family: var(--serif); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: var(--teal); color: var(--cream); font-size: .9rem; }
.section { margin-top: 2.5rem; }
.synth { display: grid; gap: 1rem; }
.synth label { font-weight: 600; display: block; margin-bottom: .35rem; }
.synth .hint { font-weight: 400; color: var(--muted); font-size: var(--text-sm); display: block; }
.synth textarea { min-height: 110px; }

/* send */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: var(--text-sm); }
.field input { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--cream); padding: .75rem .9rem; }
.field.full { grid-column: 1 / -1; }
.check { display: flex; gap: .65rem; align-items: flex-start; font-size: var(--text-sm); color: var(--muted); margin-top: 1rem; }
.check input { margin-top: .25rem; accent-color: var(--teal); width: 18px; height: 18px; flex: none; }
.hp { position: absolute; left: -9999px; }
.msg { margin-top: 1rem; padding: .85rem 1rem; border-radius: 8px; font-size: var(--text-sm); }
.msg.ok { background: var(--teal-soft); color: var(--teal); }
.msg.err { background: #f8e3dc; color: #8a2b12; }
.err-text { color: #8a2b12; font-size: .82rem; margin-top: .25rem; }
.summary-block { margin-bottom: 1.25rem; }
.summary-block h3 { margin-bottom: .3rem; }
.summary-block .ans { white-space: pre-wrap; color: var(--ink); }
.empty { color: var(--faint); font-style: italic; }

@media (max-width: 760px) {
  .results-grid { grid-template-columns: 1fr; }
  .map-card { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .progress li { width: 26px; height: 26px; font-size: .7rem; }
  .q-head { gap: .5rem 1rem; }
}
@media (max-width: 460px) {
  .attr { grid-template-columns: 1fr auto; }
  .attr .chips { grid-column: 1 / -1; order: 3; }
  .chip { flex: 1; }
  .brand { font-size: .72rem; }
}

/* print: summary only */
.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .foot, .nav, .no-print, .hero .btn { display: none !important; }
  .print-only { display: block; }
  .card, .pair, .lever, .pattern { break-inside: avoid; }
  .pattern { background: #fff; color: var(--ink); border: 2px solid var(--teal); }
  .pattern h3 { color: var(--teal); }
  .pattern p { color: var(--ink); }
  .results-grid { grid-template-columns: 1fr 1fr; }
  .map-card { position: static; }
  main { padding: 0; }
  .wrap { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.embedded .topbar { position: static; } .embedded .map-card { position: static; }

/* badges */
.pair.has-badge { display: grid; grid-template-columns: 76px 1fr; gap: 1rem; align-items: start; }
.badge { width: 76px; height: 76px; border-radius: 50%; display: block; }
.badge.dim { filter: grayscale(1); opacity: .45; }
.threads { margin: 0 0 2rem; }
.badge-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; }
.badge-strip li { text-align: center; }
.badge-strip img { width: 100%; max-width: 110px; height: auto; aspect-ratio: 1; border-radius: 50%; display: block; margin: 0 auto .5rem; }
.t-name { display: block; font-family: var(--serif); font-size: 1.1rem; color: var(--teal); line-height: 1.15; }
.t-code { display: block; font-size: .72rem; color: var(--faint); margin-top: .15rem; }
@media (max-width: 760px) { .badge-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 400px) { .pair.has-badge { grid-template-columns: 56px 1fr; gap: .75rem; } .badge { width: 56px; height: 56px; } }
@media print { .badge.dim { opacity: .35; } }

/* ---------- Cross-read board ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.how { margin-top: -.25rem; }
.xr-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; margin-top: 1.25rem; }
.board-wrap { position: sticky; top: 72px; }
.embedded .board-wrap { position: static; }
.board { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.zone { background: var(--paper); border: 1.5px dashed #c9ccc6; border-radius: 12px; padding: .7rem; min-height: 170px; transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease); cursor: default; }
.zone.over, .dragging .zone:hover { border-color: var(--gold); border-style: solid; background: #fffbf1; box-shadow: 0 0 0 3px var(--gold-soft); }
.zone.flash { animation: flash .5s var(--ease); }
@keyframes flash { 0% { background: var(--gold-soft); } 100% { background: var(--paper); } }
.selmode .zone { cursor: pointer; }
.zone-h { display: flex; align-items: baseline; gap: .45rem; margin-bottom: .5rem; }
.zone-l { font-family: var(--serif); font-size: 2rem; line-height: .9; color: var(--teal); }
.zone-n { font-weight: 600; font-size: .85rem; color: var(--ink); }
.zone-c { margin-left: auto; font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--cream); border-radius: 99px; padding: .05rem .5rem; }
.zone-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.zone-empty { font-size: .8rem; color: var(--faint); padding: .4rem 0; }
.zchip { display: inline-flex; align-items: center; gap: .15rem; background: var(--teal); color: var(--cream); border-radius: 6px; font-size: .78rem; line-height: 1.25; padding: .25rem .2rem .25rem .5rem; max-width: 100%; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.zchip span { overflow: hidden; text-overflow: ellipsis; }
.untag { background: none; border: 0; color: rgba(247,246,242,.75); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .25rem; border-radius: 4px; }
.untag:hover { color: #fff; background: rgba(255,255,255,.15); }
.pool-group { margin-bottom: 1rem; }
.pool-h { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--gold); margin: 0 0 .4rem; }
.pool-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.acard { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .55rem; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .4rem .55rem .55rem; font-size: .9rem; line-height: 1.35; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), opacity .15s; }
.acard:hover { border-color: var(--teal-2); }
.acard.selected { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); background: #fffdf7; }
.acard.lifted, .zchip.lifted { opacity: .4; }
.grip { width: 8px; height: 16px; background-image: radial-gradient(circle, #a9b0ae 1.2px, transparent 1.4px); background-size: 4px 4px; }
.dots { display: inline-flex; gap: 2px; }
.dots i { font-style: normal; font-family: var(--serif); font-size: .78rem; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 4px; background: #eceae4; color: #b3b8b6; }
.dots i.on { background: var(--teal); color: var(--cream); }
.hide-card { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 1.15rem; width: 28px; height: 28px; border-radius: 6px; }
.hide-card:hover { color: var(--ink); background: var(--cream); }
.add-own { display: flex; gap: .5rem; margin-top: .25rem; }
.add-own input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: .6rem .8rem; }
.add-own .btn { padding: .6rem 1.1rem; }
.selbar { position: sticky; top: 64px; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--gold-soft); color: #5e4510; border-radius: 10px; padding: .6rem .9rem; font-size: .88rem; margin-top: .75rem; }
.embedded .selbar { position: static; }
.ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; max-width: 260px; background: var(--teal); color: var(--cream); font-size: .85rem; padding: .5rem .75rem; border-radius: 8px; box-shadow: 0 10px 30px rgba(12,78,84,.3); }
.dragging, .dragging * { cursor: grabbing !important; }
@media (max-width: 760px) {
  .xr-grid { grid-template-columns: 1fr; }
  .board-wrap { position: static; }
  .zone { min-height: 120px; padding: .55rem; }
  .zone-l { font-size: 1.6rem; }
}
@media print { .pool, .add-own, .selbar { display: none; } }
.quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding-top: .5rem; margin-top: .15rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.quick > span { margin-right: .2rem; }
.qbtn { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line); background: var(--cream); color: var(--ink); border-radius: 8px; padding: .35rem .55rem; font-family: var(--serif); font-size: 1.05rem; cursor: pointer; }
.qbtn .qn { font-family: var(--sans); font-size: .74rem; }
.qbtn[aria-pressed=true] { background: var(--teal); border-color: var(--teal); color: var(--cream); }
.quick .linkbtn { margin-left: auto; }
@media (max-width: 420px) { .qbtn .qn { display: none; } .qbtn { padding: .35rem .7rem; } }
.team-note { background: #fff; border: 1px solid var(--line, #e2dfd6); border-radius: 10px; padding: .85rem 1.1rem; margin: 1.25rem 0 0; font-size: var(--text-sm); color: var(--ink, #16201f); }
.team-note strong { color: var(--teal); letter-spacing: .04em; }
