/* ============================================================
   User-test layer: entry modal (name + venue) + per-task
   feedback survey. Self-contained (only depends on tokens.css)
   so it can load on the homepage AND the editor pages.
   ============================================================ */

.fbm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: oklch(0.18 0.03 264 / 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  animation: fbm-fade 0.22s var(--ease-out) forwards;
}
.fbm-backdrop[hidden] { display: none; }
@keyframes fbm-fade { to { opacity: 1; } }

.fbm {
  width: min(480px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  transform-origin: center;
  animation: fbm-pop 0.32s var(--ease-out-quint) both;
}
@keyframes fbm-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .fbm-backdrop, .fbm { animation: none; opacity: 1; }
}

.fbm__head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-6) 0;
}
.fbm__title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.fbm__close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.fbm__close:hover { background: var(--surface-3); color: var(--ink); }

.fbm__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--sp-3) var(--sp-6) var(--sp-5); }

/* sticky footer holding the Submit button (tall surveys scroll the body) */
.fbm__footer {
  flex-shrink: 0;
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  border-top: 1px solid var(--border);
}
.fbm__footer[hidden] { display: none; }
.fbm__sub {
  font-size: var(--text-base);
  color: var(--ink-2);
  line-height: var(--lh-normal);
  margin-bottom: var(--sp-5);
  max-width: 60ch;
}

/* ---- form fields (entry modal) ---- */
.fbm-field { margin-bottom: var(--sp-4); }
.fbm-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.fbm-input {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--ink);
}
.fbm-input::placeholder { color: var(--ink-3); }
.fbm-input:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.fbm-textarea {
  width: 100%;
  min-height: 84px;
  padding: var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  line-height: var(--lh-normal);
  resize: vertical;
}
.fbm-textarea:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.fbm-count { margin-top: 4px; text-align: right; font-size: var(--text-xs); color: var(--ink-3); }
.fbm-count.is-near { color: var(--danger-ink); }

/* ---- survey question groups ---- */
.fbm-q { margin-bottom: var(--sp-5); }
.fbm-q__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-3);
}

/* rating scale (1-5) */
.fbm-scale { display: flex; gap: var(--sp-2); }
.fbm-scale__btn {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.fbm-scale__num { font-size: var(--text-md); font-weight: 700; line-height: 1; }
.fbm-scale__cap { font-size: 9px; line-height: 1; opacity: 0.7; text-align: center; }
.fbm-scale__btn:hover { border-color: var(--primary); }
.fbm-scale__btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.fbm-scale__btn.is-active .fbm-scale__cap { opacity: 0.85; }

/* segmented choice (Yes / No / Not sure) */
.fbm-choices { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.fbm-choice {
  padding: 9px var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-base);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.fbm-choice:hover { border-color: var(--primary); }
.fbm-choice.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* checkbox list */
.fbm-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 6px 0;
  font-size: var(--text-base);
  color: var(--ink);
  cursor: pointer;
}
.fbm-check input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.fbm-check__box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: #fff;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.fbm-check__box::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform var(--dur-fast) var(--ease-out);
}
.fbm-check input:checked + .fbm-check__box { background: var(--primary); border-color: var(--primary); }
.fbm-check input:checked + .fbm-check__box::after { transform: rotate(-45deg) scale(1); }

/* footer / actions */
.fbm__foot { margin-top: var(--sp-5); }
.fbm-btn {
  width: 100%;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: var(--text-md);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.fbm-btn:hover { background: var(--primary-hover); }
.fbm-btn:disabled { background: var(--border-strong); color: var(--ink-3); cursor: default; }

/* thank-you state */
.fbm--thanks { text-align: center; }
.fbm--thanks .fbm__body { padding: var(--sp-10) var(--sp-6); }
.fbm-thanks__title { font-size: var(--text-xl); font-weight: 700; color: var(--ink); margin-bottom: var(--sp-3); }
.fbm-thanks__sub { font-size: var(--text-base); color: var(--ink-2); margin-bottom: var(--sp-6); max-width: 44ch; margin-inline: auto; }
.fbm-thanks__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 var(--sp-8);
  border-radius: var(--r-md);
  background: var(--primary);
  color: #fff;
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
}
.fbm-thanks__btn:hover { background: var(--primary-hover); }

/* small sparkle eyebrow used in the entry modal */
.fbm__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ai-ink);
  margin-bottom: var(--sp-2);
}
.fbm__eyebrow svg { width: 14px; height: 14px; color: var(--ai); }

/* "Skip — I'm just testing" (entry modal, dev convenience) */
.fbm-skip {
  display: block;
  width: 100%;
  margin-top: var(--sp-3);
  padding: 6px;
  font-size: var(--text-sm);
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--dur-fast);
}
.fbm-skip:hover { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
