/*
 * Compatibility quizzes (/tools/roommate-compatibility-test, /tools/moving-in-together-quiz).
 * Question cards, answer options, importance toggles, the comparison list and the house rules box.
 * Builds on the "Free tools" block in site.css (.nk-input, .nk-text-btn, .nk-table …).
 */

/* ---- Questions ---- */
.cq-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  counter-reset: none;
}
.cq-q {
  position: relative;
  background: #fffdf9;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(59, 48, 43, 0.06);
  padding: clamp(20px, 2.6vw, 28px);
  scroll-margin-top: 16px;
  transition: box-shadow 0.2s ease;
}
.cq-q[data-missing] {
  box-shadow: 0 0 0 2px #ffb900;
}
.cq-q fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cq-q legend {
  padding: 0;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cq-q-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8b5e3c;
}
.cq-q-num {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 999px;
  background: #f2ebe0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0;
  color: #8b5e3c;
}
.cq-q[data-answered] .cq-q-num {
  background: #e5e6dc;
  color: #5f7a57;
}
.cq-q-text {
  font-size: clamp(18px, 2vw, 20px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: #2e2018;
  text-wrap: balance;
}

.cq-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cq-opt {
  position: relative;
  cursor: pointer;
  display: flex;
  min-width: 0;
}
.cq-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.cq-opt span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  box-sizing: border-box;
  padding: 9px 16px;
  border-radius: 14px;
  border: 1.5px solid #ddd5c8;
  background: #fffdf9;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  color: #3b302b;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.cq-opt:hover span {
  border-color: #c8bbae;
  background: #f7f1e8;
}
.cq-opt input:checked + span {
  background: #fbf3df;
  border-color: #8b5e3c;
  color: #2e2018;
  box-shadow: inset 0 0 0 1px #8b5e3c;
}
.cq-opt input:focus-visible + span {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}

.cq-imp {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding-top: 12px;
  border-top: 1px dashed #e5ddd2;
  font-size: 13px;
  color: #7a6a5c;
}
.cq-imp-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #e5ddd2;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #7a6a5c;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.cq-imp-btn:hover {
  color: #3b302b;
  border-color: #c8bbae;
}
.cq-imp-btn[aria-pressed='true'] {
  background: #3b302b;
  border-color: #3b302b;
  color: #fffdf9;
}
.cq-imp-btn:focus-visible,
.cq-btn:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}

/* ---- Status card ---- */
.cq-progress {
  height: 10px;
  border-radius: 999px;
  background: #ede5d8;
  overflow: hidden;
}
.cq-progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: #8fa98c;
  transition: width 0.3s ease;
}
.cq-share-url {
  font-size: 14px !important;
  font-weight: 400 !important;
  color: #3b302b !important;
  background: #f7f1e8 !important;
}
.cq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid #3b302b;
  background: transparent;
  color: #3b302b;
  transition: background-color 0.15s ease;
}
.cq-btn:hover {
  background: #f2ebe0;
  text-decoration: none;
}
.cq-btn--primary {
  border-color: #ffb900;
  background: #ffb900;
  color: #2e2018;
}
.cq-btn--primary:hover {
  background: #f2ad00;
}
.cq-btn[disabled] {
  cursor: not-allowed;
  border-color: #ddd5c8;
  background: #ede5d8;
  color: #9a8570;
}
.cq-summary {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.45;
}
.cq-summary li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #ede5d8;
}
.cq-summary li span:first-child {
  color: #7a6a5c;
  flex: none;
}
.cq-summary li span:last-child {
  color: #2e2018;
  text-align: right;
}
.cq-details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #8b5e3c;
  padding: 4px 0;
}
.cq-details[open] summary {
  margin-bottom: 8px;
}

/* ---- Comparison ---- */
.cq-score {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #2e2018;
  font-size: clamp(56px, 8vw, 80px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cq-status-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #ede5d8;
  gap: 2px;
}
.cq-status-bar > span {
  display: block;
  height: 100%;
}
.cq-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 14px;
  color: #3b302b;
}
.cq-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cq-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  display: inline-block;
}
[data-status='agree'] > .cq-dot,
.cq-dot[data-status='agree'] {
  background: #8fa98c;
}
[data-status='talk'] > .cq-dot,
.cq-dot[data-status='talk'] {
  background: #d6a06f;
}
[data-status='clash'] > .cq-dot,
.cq-dot[data-status='clash'] {
  background: #c17f5c;
}

.cq-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 24px;
  align-items: start;
}
.cq-topics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cq-topic {
  border-radius: 18px;
  background: #f7f1e8;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 4px solid #8fa98c;
}
.cq-topic[data-status='talk'] {
  border-left-color: #d6a06f;
}
.cq-topic[data-status='clash'] {
  border-left-color: #c17f5c;
  background: #f9efe9;
}
.cq-topic-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cq-topic-name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #2e2018;
}
.cq-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #3b302b;
  background: #e5e6dc;
  white-space: nowrap;
}
.cq-chip[data-status='talk'] {
  background: #f4e9e1;
}
.cq-chip[data-status='clash'] {
  background: #efddda;
}
.cq-answers {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 6px 16px;
  font-size: 14px;
  line-height: 1.4;
}
.cq-answers div {
  min-width: 0;
}
.cq-answers dt {
  font-size: 12px;
  font-weight: 600;
  color: #8b5e3c;
  overflow-wrap: anywhere;
}
.cq-answers dd {
  margin: 2px 0 0;
  color: #3b302b;
}
.cq-answers em {
  font-style: normal;
  font-size: 12px;
  color: #7a6a5c;
  white-space: nowrap;
}
.cq-try {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #3b302b;
}
.cq-try strong {
  color: #2e2018;
}

.cq-rules-text {
  margin: 0;
  padding: 18px 20px;
  border-radius: 16px;
  background: #f7f1e8;
  border: 1px dashed #ddd5c8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: #3b302b;
  max-height: 520px;
  overflow-y: auto;
}

.cq-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fffdf9;
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(59, 48, 43, 0.06),
    0 20px 50px rgba(59, 48, 43, 0.08);
  padding: 18px clamp(18px, 3vw, 28px);
}

@media (min-width: 960px) {
  .cq-sticky {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    border-radius: 22px;
  }
}
@media (max-width: 480px) {
  .cq-opt,
  .cq-opt span {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cq-progress > span,
  .cq-q,
  .cq-opt span {
    transition: none;
  }
}
[data-cq-root] [hidden] {
  display: none !important;
}
@media (max-width: 480px) { .cq-imp > span { flex-basis: 100%; } }
