/* ==========================================================================
   CROWD TESTS -- "ask the Arena crowd": the purpose block on the Research page, the test form, the results.
   Same Instrument tokens as styles.css / arena.css: plates, sunken wells, one signal colour, mono numerals.
   ========================================================================== */

.cr-kicker { display: inline-flex; align-items: center; gap: 8px; }
.cr-kicker .sk-led { --led: var(--signal); --led-glow: rgba(255,106,31,.6); }

/* ---- the purpose block ------------------------------------------------------ */
.cr-hero { display: flex; flex-direction: column; gap: 22px; }
.cr-hero-top { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.cr-hero-title { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; color: var(--g-50); }
.cr-hero-body { max-width: 62ch; font-size: 15px; line-height: 1.6; color: var(--g-300); }
.cr-hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.cr-gate { margin: 0; max-width: 62ch; font-size: 13px; line-height: 1.5; color: var(--g-400); }
.cr-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cr-step { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 12px; background: var(--well); border: 1px solid rgba(0,0,0,.6); box-shadow: var(--sh-well); }
.cr-step .sk-tile { align-self: flex-start; }
.cr-step-n { position: absolute; top: 14px; right: 16px; font-size: 22px; line-height: 1; color: var(--g-700); }
.cr-step-title { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--g-100); }
.cr-step-body { margin: 0; font-size: 13px; line-height: 1.5; color: var(--g-400); }
.cr-why { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; }
.cr-why li { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--g-200); }
.cr-why svg { color: var(--signal-hi); flex: none; }
.cr-usecases { margin: -6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--g-500); }

/* ---- my tests --------------------------------------------------------------- */
.cr-mine-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cr-mine-title { margin-top: 6px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--g-100); }
.cr-mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.cr-test { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.cr-test-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cr-test-main { min-width: 0; }
.cr-test-title { display: block; max-width: 100%; padding: 0; border: 0; background: none; text-align: left; font-size: 15px; font-weight: 600; color: var(--g-100); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-test-title:hover { text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); text-underline-offset: 3px; }
.cr-test-q { margin-top: 2px; font-size: 12.5px; color: var(--g-500); }
.cr-test-opts { display: flex; gap: 8px; }
.cr-test-prog { display: flex; align-items: center; gap: 12px; }
.cr-test-prog > :first-child { flex: 1; min-width: 0; }
.cr-test-count { flex: none; font-size: 12px; color: var(--g-300); }
.cr-test-verdict { margin: 0; font-size: 13px; line-height: 1.5; color: var(--g-300); }
.cr-test-verdict[data-state="winner"] { color: var(--g-50); }
.cr-test-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }

.cr-thumb { display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; border-radius: 9px; background: var(--well); border: 1px solid rgba(0,0,0,.6); box-shadow: var(--sh-well); }
.cr-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cr-thumb-text { font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--g-300); }

/* ---- the form --------------------------------------------------------------- */
.cr-create, .cr-results { display: flex; flex-direction: column; gap: 16px; max-width: 920px; }
.cr-back { display: flex; }
.cr-create-head h2, .cr-results-title h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--g-50); }
.cr-gate-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cr-gate-card p { margin: 0; max-width: 62ch; font-size: 13.5px; line-height: 1.5; color: var(--g-300); }
.cr-field { display: flex; flex-direction: column; gap: 10px; }
.cr-field-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.cr-field-label { font-size: 14px; font-weight: 500; color: var(--g-300); }
.cr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-chip {
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--g-300);
  background: var(--key); border: 1px solid rgba(0,0,0,.5); box-shadow: var(--sh-key); cursor: pointer;
  transition: color var(--sk-dur-fast), background var(--sk-dur-fast), box-shadow var(--sk-dur-fast);
}
.cr-chip:hover:not(:disabled) { color: #fff; background: var(--key-hover); }
.cr-chip[data-on="true"] { color: var(--signal-ink); background: var(--lit); border-color: rgba(0,0,0,.4); box-shadow: var(--sh-lit); }
.cr-chip:disabled { opacity: .55; cursor: default; }
.cr-question { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--well); border: 1px solid rgba(0,0,0,.6); box-shadow: var(--sh-well); font-size: 14.5px; color: var(--g-100); }

.cr-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.cr-opt { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: var(--plate); border: 1px solid var(--hair); box-shadow: var(--sh-plate-sm); }
.cr-opt-head { display: flex; align-items: center; justify-content: space-between; }
.cr-opt-letter { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 7px; font-size: 12px; color: var(--g-300); background: var(--well); border: 1px solid rgba(0,0,0,.6); box-shadow: var(--sh-well); }
.cr-opt-remove { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 7px; background: none; color: var(--g-500); cursor: pointer; transition: color var(--sk-dur-fast), background var(--sk-dur-fast); }
.cr-opt-remove:hover:not(:disabled) { color: #fb7185; background: rgba(255,255,255,.06); }
.cr-opt-slot { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--well); border: 1px dashed rgba(255,255,255,.14); }
.cr-opt-slot[data-has="true"] { border-style: solid; border-color: rgba(0,0,0,.6); box-shadow: var(--sh-well); }
.cr-opt-slot img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cr-opt-add { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; height: 100%; border: 0; background: none; font-size: 12.5px; color: var(--g-400); cursor: pointer; transition: color var(--sk-dur-fast); }
.cr-opt-add:hover:not(:disabled) { color: var(--g-50); }
.cr-opt-actions { display: flex; gap: 14px; }
.cr-link { padding: 0; border: 0; background: none; font-size: 12.5px; color: var(--g-400); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(255,255,255,.25); text-underline-offset: 3px; }
.cr-link:hover:not(:disabled) { color: var(--g-50); }
.cr-opt-error { margin: 0; font-size: 12.5px; line-height: 1.4; color: #fda4af; }
.cr-opt-new { align-items: center; justify-content: center; min-height: 160px; gap: 8px; border-style: dashed; border-color: rgba(255,255,255,.14); background: transparent; box-shadow: none; font-size: 13px; color: var(--g-400); cursor: pointer; transition: color var(--sk-dur-fast), border-color var(--sk-dur-fast); }
.cr-opt-new:hover:not(:disabled) { color: var(--g-50); border-color: rgba(255,255,255,.3); }
.cr-error { padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(251,113,133,.3); background: rgba(251,113,133,.08); font-size: 13.5px; color: #fda4af; }
.cr-rules { margin: 0; max-width: 72ch; font-size: 12.5px; line-height: 1.5; color: var(--g-500); }
.cr-create-foot { display: flex; justify-content: flex-start; padding-bottom: 8px; }

/* ---- results ---------------------------------------------------------------- */
.cr-results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cr-verdict { display: flex; flex-direction: column; gap: 12px; }
.cr-verdict-text { margin: 0; font-size: 17px; line-height: 1.45; font-weight: 500; color: var(--g-50); }
.cr-verdict[data-state="collecting"] .cr-verdict-text, .cr-verdict[data-state="empty"] .cr-verdict-text, .cr-verdict[data-state="close"] .cr-verdict-text { color: var(--g-200); }
.cr-verdict-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--g-400); }
.cr-res-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; }
.cr-res-row + .cr-res-row { border-top: 1px solid var(--hair); }
.cr-res-row[data-lead="true"] { background: var(--well); box-shadow: var(--sh-well); border-top-color: transparent; }
.cr-res-rank { width: 2ch; font-size: 16px; color: var(--g-400); text-align: right; }
.cr-res-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.cr-res-name { font-size: 14.5px; font-weight: 500; color: var(--g-100); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-res-tag { margin-left: 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--signal-hi); }
.cr-res-bar { position: relative; height: 8px; border-radius: 4px; background: #0b0b0d; box-shadow: var(--sh-well); }
.cr-res-bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(180deg, #6d707a, #565963); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.cr-res-row[data-lead="true"] .cr-res-bar > i { background: linear-gradient(180deg, #ff8f55, #ff6a1f); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.cr-res-ci { position: absolute; top: -3px; height: 14px; border-left: 2px solid rgba(255,255,255,.55); border-right: 2px solid rgba(255,255,255,.55); }
.cr-res-ci::after { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: rgba(255,255,255,.45); }
.cr-res-sub { font-size: 12px; color: var(--g-400); }
.cr-res-pct { flex: none; min-width: 4.4ch; font-size: 26px; text-align: right; color: var(--g-50); }
.cr-res-pct .sk-unit { font-size: 14px; }
.cr-pairs { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--g-300); }
.cr-note { margin: 0; max-width: 72ch; font-size: 12.5px; line-height: 1.5; color: var(--g-500); }
.cr-results-foot { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 8px; }

/* ---- Arena side: Stage 2 (research missions) ---- */
.ar-stage2 { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.ar-stage2[data-unlocked="false"] { opacity: .78; }
.ar-mi-head { display: flex; align-items: center; gap: 10px; }
.ar-mi-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--g-400); }
.ar-mi-list { display: flex; flex-direction: column; gap: 8px; }
.ar-mi-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; background: var(--well); box-shadow: var(--sh-well); }
.ar-mi-thumbs { display: flex; gap: 6px; flex: none; }
.ar-mi-main { flex: 1; min-width: 0; }
.ar-mi-title { font-size: 14px; font-weight: 600; color: var(--g-100); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-mi-sub { margin-top: 2px; font-size: 12px; color: var(--g-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-mi-xp { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--g-400); }
.ar-mi-xp > :nth-child(2) { flex: none; width: 160px; }

.ar-spec-art-free { display: grid; place-items: center; background: #0b0b0d; }
.ar-mi-art { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.ar-mi-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ar-mi-cap { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 6px 10px; border-radius: 8px; font-size: 13px; line-height: 1.3; text-align: center; color: var(--g-100); background: rgba(14,14,16,.82); }
.ar-mi-art-text { padding: 16px; }
.ar-mi-art-text b { display: block; max-width: 100%; font-size: clamp(20px, 3.2vw, 32px); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; text-align: center; color: var(--g-50); overflow-wrap: anywhere; }
.ar-mi-owner { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--g-400); }
.ar-mi-owner:hover span { color: var(--g-100); }
.ar-mi-foot-note { font-size: 12px; color: var(--g-500); }
.ar-mi-fail { color: #f0a3a3; }
.ar-mi-ask { font-size: 12.5px; color: var(--g-300); }
.ar-mi-report { font-size: 12px; color: var(--g-500); }
.ar-summary-top .ar-mi-note { grid-column: 1 / -1; }

/* ---- admins: reported tests ---- */
.cr-mod-list { display: flex; flex-direction: column; gap: 8px; }
.cr-mod-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; background: var(--well); box-shadow: var(--sh-well); }
.cr-mod-thumbs { display: flex; gap: 6px; flex: none; }
.cr-mod-main { flex: 1; min-width: 0; }
.cr-mod-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 600; color: var(--g-100); }
.cr-mod-sub { margin-top: 3px; font-size: 12px; color: var(--g-400); overflow-wrap: anywhere; }
.cr-mod-actions { display: flex; gap: 8px; flex: none; }

/* ---- "New research": choose what to start ---- */
.cr-choose { display: flex; flex-direction: column; gap: 10px; }
.cr-choice { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 14px; text-align: left; color: var(--g-300); background: var(--well); border: 1px solid rgba(0,0,0,.55); box-shadow: var(--sh-well); transition: border-color .15s, transform .15s; }
.cr-choice:hover { border-color: rgba(255,106,31,.6); color: #fff; }
.cr-choice:active { transform: translateY(1px); }
.cr-choice-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cr-choice-title { font-size: 15px; font-weight: 600; color: var(--g-50); }
.cr-choice-tag { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--signal-hi); }
.cr-choice-body { font-size: 13px; line-height: 1.5; color: var(--g-400); }

@media (max-width: 767px) {
  .cr-hero-title { font-size: 22px; }
  .cr-steps { grid-template-columns: minmax(0, 1fr); }
  .cr-mine-grid { grid-template-columns: minmax(0, 1fr); }
  .cr-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cr-res-row { gap: 10px; padding: 10px 8px; }
  .cr-res-pct { font-size: 20px; min-width: 3.6ch; }
  .ar-stage2 { padding: 14px; }
  .ar-mi-row { flex-wrap: wrap; gap: 10px; }
  .ar-mi-main { flex-basis: 100%; order: 3; }
  .ar-mi-row > .sk-btn { margin-left: auto; }
  .ar-mi-xp > :nth-child(2) { width: 100%; }
  .cr-mod-row { flex-wrap: wrap; }
  .cr-mod-main { flex-basis: 100%; order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .cr-chip, .cr-opt-remove, .cr-opt-add, .cr-opt-new, .cr-test-title { transition: none !important; }
}
