/* ==========================================================================
   Help me get better (#better): the invite panel and the feedback window.
   The window is a native <dialog> (js/feedback.js): blue glass, centered,
   never full size, its own scroll. Motion is transform and opacity only,
   and none at all under prefers-reduced-motion.
   ========================================================================== */

/* ---------- the invite panel ---------- */
.fb-invite {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; align-items: flex-start; gap: 20px;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line-hi); border-radius: 24px;
  background:
    radial-gradient(90% 110% at 100% 0%, rgba(90, 168, 255, .20), transparent 60%),
    radial-gradient(80% 80% at 0% 100%, rgba(46, 95, 138, .30), transparent 62%),
    var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(212, 233, 255, .12);
}
.fb-invite-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--glass-hi);
  border: 1px solid var(--line-hi);
  box-shadow: inset 0 1px 0 rgba(212, 233, 255, .14), 0 10px 24px -14px rgba(90, 168, 255, .7);
}
.fb-invite-icon .ic { width: 28px; height: 28px; }
.fb-invite-icon .ic * { vector-effect: non-scaling-stroke; }
.fb-invite-title {
  font-family: var(--f-display); font-weight: 500;
  font-size: clamp(23px, 2.2vw, 29px); line-height: 1.22; letter-spacing: -.015em;
  color: #fff; text-wrap: balance;
}
.fb-invite-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fb-invite-list li {
  position: relative; padding-left: 30px;
  font-size: 16px; line-height: 1.5; color: var(--text);
}
.fb-invite-list li::before {
  content: ""; position: absolute; left: 0; top: .2em;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(90, 168, 255, .16); border: 1px solid rgba(140, 196, 255, .45);
}
.fb-invite-list li::after {
  content: ""; position: absolute; left: 6.5px; top: calc(.2em + 4px);
  width: 4px; height: 8px;
  border: solid var(--blue-200); border-width: 0 1.75px 1.75px 0;
  transform: rotate(45deg);
}
.fb-invite-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 6px; width: 100%; }
.fb-open { min-height: 52px; padding-left: 30px; padding-right: 30px; font-size: 16px; }
.fb-invite-note { font-size: 14.5px; line-height: 1.5; color: var(--text-dim); text-wrap: balance; }
@media (max-width: 560px) {
  .fb-invite-cta { flex-direction: column; align-items: stretch; text-align: center; }
  .fb-open { width: 100%; }
}

/* ---------- the window ---------- */
.fb {
  --fb-err: #ffb4ab;                       /* light red, about 8:1 on the window */
  --fb-err-bg: rgba(255, 120, 108, .10);
  --fb-err-line: rgba(255, 164, 152, .55);
  --fb-field: rgba(3, 11, 29, .55);
  --fb-field-focus: rgba(3, 11, 29, .78);
  --fb-field-line: rgba(168, 203, 230, .42);
  --fb-pad: clamp(18px, 4.2vw, 30px);

  position: fixed; inset: 0; margin: auto;
  width: calc(100% - 32px); max-width: 580px;
  height: fit-content; max-height: min(86svh, 880px);
  padding: 0;
  color: var(--text);
  border: 1px solid rgba(168, 203, 230, .38);
  border-radius: 24px;
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(90, 168, 255, .22), transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(46, 95, 138, .34), transparent 60%),
    linear-gradient(180deg, rgba(15, 40, 84, .80) 0%, rgba(6, 18, 42, .88) 100%);
  -webkit-backdrop-filter: blur(26px) saturate(1.45); backdrop-filter: blur(26px) saturate(1.45);
  box-shadow:
    inset 0 1px 0 rgba(212, 233, 255, .20),
    inset 0 0 0 1px rgba(140, 196, 255, .05),
    0 2px 6px rgba(2, 8, 22, .45),
    0 30px 60px -24px rgba(2, 8, 22, .92),
    0 60px 140px -40px rgba(61, 143, 230, .55);
  overflow: hidden;
  overscroll-behavior: contain;
}
.fb[open] { display: flex; flex-direction: column; }
.fb::backdrop {
  background: rgba(3, 11, 29, .64);
  -webkit-backdrop-filter: blur(6px) saturate(1.1); backdrop-filter: blur(6px) saturate(1.1);
}
.fb [hidden] { display: none !important; }

/* opening and closing: opacity and transform only */
.fb[open] { animation: fbIn .34s var(--ease-out) both; }
.fb[open]::backdrop { animation: fbFade .3s ease-out both; }
.fb.is-closing { animation: fbOut .2s ease-in both; }
.fb.is-closing::backdrop { animation: fbFadeOut .2s ease-in both; }
@keyframes fbIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fbOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes fbFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fbFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* locks the page behind the window */
html.fb-lock { overflow: hidden; }

.fb-form {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0; margin: 0;
}

/* ---------- head: title, step count, close ---------- */
.fb-head {
  flex: none;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: calc(var(--fb-pad) - 4px) calc(var(--fb-pad) - 8px) 14px var(--fb-pad);
  border-bottom: 1px solid var(--line);
}
.fb-head-text { min-width: 0; display: grid; gap: 6px; padding-top: 4px; }
.fb-title {
  font-family: var(--f-body); font-weight: 500;
  font-size: 12px; line-height: 1.4; letter-spacing: .18em; text-transform: uppercase;
  color: var(--blue-300);
}
.fb-progress { font-size: 13.5px; line-height: 1.4; color: var(--text-dim); }
.fb-bars { display: flex; gap: 6px; margin-top: 2px; }
.fb-bars span {
  position: relative; overflow: hidden;
  width: 44px; height: 4px; border-radius: 4px;
  background: rgba(168, 203, 230, .22);
}
.fb-bars span::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--accent-metal);
  transform-origin: 0 50%; transform: scaleX(0);
  transition: transform .35s var(--ease-out);
}
.fb-bars span.is-on::after { transform: scaleX(1); }
.fb.is-done .fb-progress, .fb.is-done .fb-bars { display: none; }
.fb.is-done .fb-head { align-items: center; }

.fb-x {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(168, 203, 230, .32);
  background: rgba(168, 203, 230, .07); color: var(--sky-100);
  cursor: pointer;
  transition: transform .18s var(--ease-out);
}
.fb-x:hover { border-color: var(--blue-300); background: rgba(90, 168, 255, .16); color: #fff; transform: rotate(90deg); }
.fb-x:active { transform: rotate(90deg) scale(.92); }
.fb-x:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 3px; }

/* ---------- body: the steps, scrolls on its own ---------- */
.fb-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 22px var(--fb-pad) 26px;
  scrollbar-width: thin; scrollbar-color: rgba(168, 203, 230, .35) transparent;
}
.fb-step { display: flex; flex-direction: column; gap: 22px; }
.fb-step.is-entering { animation: fbStepIn .3s var(--ease-out) both; }
.fb-step.is-entering.is-back { animation-name: fbStepBack; }
@keyframes fbStepIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes fbStepBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

.fb-step-title {
  font-size: clamp(26px, 3.4vw, 32px); line-height: 1.12;
  text-wrap: balance;
}
.fb-step-title:focus { outline: none; }
.fb-lede { margin-top: -10px; font-size: 16px; line-height: 1.6; color: var(--text-dim); text-wrap: pretty; }

/* ---------- fields ---------- */
.fb-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
fieldset.fb-field { border: 0; margin: 0; padding: 0; }
.fb-label { padding: 0; font-size: 15px; font-weight: 500; line-height: 1.45; color: #fff; }
legend.fb-label { margin-bottom: 10px; }
.fb-label b { color: var(--blue-300); font-weight: 600; margin-left: 2px; }
.fb-opt { margin-left: 2px; white-space: nowrap; font-size: 12.5px; font-weight: 400; letter-spacing: .02em; color: var(--text-dim); }
.fb-hint { font-size: 13.5px; line-height: 1.5; color: var(--text-dim); }

.fb input[type="text"],
.fb input[type="email"],
.fb textarea,
.fb select {
  display: block; width: 100%;
  min-height: 48px; margin: 0;
  padding: 11px 14px;
  font-family: var(--f-body); font-size: 16px; font-weight: 400; line-height: 1.5; color: #fff;
  background: var(--fb-field);
  border: 1px solid var(--fb-field-line);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 3px rgba(2, 8, 22, .45);
  caret-color: var(--blue-300);
  -webkit-appearance: none; appearance: none;
}
.fb textarea { min-height: 96px; resize: vertical; }
.fb input::placeholder, .fb textarea::placeholder { color: #8fa9c6; opacity: 1; }
.fb input[type="text"]:hover, .fb input[type="email"]:hover, .fb textarea:hover, .fb select:hover { border-color: rgba(168, 203, 230, .68); }
.fb input[type="text"]:focus, .fb input[type="email"]:focus, .fb textarea:focus, .fb select:focus {
  background-color: var(--fb-field-focus);
  border-color: var(--blue-300);
  outline: 3px solid rgba(90, 168, 255, .55);
  outline-offset: 1px;
}
.fb input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 1000px #0a1a3a inset; }
.fb input[aria-invalid="true"], .fb textarea[aria-invalid="true"] { border-color: var(--fb-err); }
.fb input[aria-invalid="true"]:focus, .fb textarea[aria-invalid="true"]:focus { border-color: var(--fb-err); outline-color: rgba(255, 140, 128, .38); }

/* select with a drawn chevron */
.fb-select { position: relative; }
.fb select { padding-right: 44px; cursor: pointer; }
.fb select option { background: var(--blue-900); color: #fff; }
.fb-select::after {
  content: ""; position: absolute; right: 18px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border: solid var(--sky-300); border-width: 0 1.75px 1.75px 0;
  transform: rotate(45deg); pointer-events: none;
}
.fb select:active { transform: scale(.995); }

.fb-error {
  display: flex; align-items: flex-start; gap: 8px; margin: 0;
  font-size: 14px; font-weight: 400; line-height: 1.45; color: var(--fb-err);
}
.fb-error::before {
  content: "!"; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  background: var(--fb-err); color: #3a0906;
  font-size: 12px; font-weight: 600; line-height: 1;
}

/* ---------- the 18+ check ---------- */
.fb-check {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 14px 18px;
  border: 1px solid var(--line-hi); border-radius: 16px;
  background: var(--glass);
  box-shadow: inset 0 1px 0 rgba(212, 233, 255, .06), 0 10px 24px -18px rgba(2, 8, 22, .9);
  cursor: pointer;
  transition: transform .18s var(--ease-out);
  -webkit-user-select: none; user-select: none;
}
.fb-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fb-check-box {
  position: relative; flex: none;
  width: 24px; height: 24px; border-radius: 7px;
  border: 1.5px solid rgba(168, 203, 230, .75);
  background: rgba(3, 11, 29, .5);
}
.fb-check-box::after {
  content: ""; position: absolute; left: 7.5px; top: 3px;
  width: 6px; height: 12px;
  border: solid var(--on-accent); border-width: 0 2.25px 2.25px 0;
  transform: rotate(45deg) scale(.4); opacity: 0;
  transition: transform .2s var(--ease-out), opacity .15s;
}
.fb-check-text { font-size: 16px; font-weight: 500; line-height: 1.4; color: #fff; }
.fb-check:hover { border-color: var(--blue-300); background: rgba(90, 168, 255, .12); }
.fb-check:active { transform: scale(.99); }
.fb-check input:focus-visible + .fb-check-box { outline: 2px solid var(--blue-300); outline-offset: 3px; }
@supports selector(:has(*)) {
  .fb-check input:focus-visible + .fb-check-box { outline: none; }
  .fb-check:has(input:focus-visible) { outline: 2px solid var(--blue-300); outline-offset: 3px; }
}
.fb-check input:checked + .fb-check-box { background: var(--accent-metal); border-color: transparent; box-shadow: 0 6px 14px -6px rgba(90, 168, 255, .8); }
.fb-check input:checked + .fb-check-box::after { opacity: 1; transform: rotate(45deg) scale(1); }
.fb-check:has(input:checked) { border-color: rgba(140, 196, 255, .6); background: var(--glass-hi); }

/* ---------- anonymous or named cards ---------- */
.fb-mode-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 520px) { .fb-mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fb-mode { position: relative; display: flex; cursor: pointer; }
.fb-mode input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fb-mode-card {
  position: relative;
  display: flex; flex-direction: column; gap: 6px; width: 100%;
  min-height: 104px; padding: 18px 50px 18px 18px;
  border: 1px solid rgba(168, 203, 230, .36); border-radius: 18px;
  background: rgba(120, 175, 240, .06);
  box-shadow: inset 0 1px 0 rgba(212, 233, 255, .05), 0 10px 24px -18px rgba(2, 8, 22, .9);
  transition: transform .18s var(--ease-out);
  -webkit-user-select: none; user-select: none;
}
.fb-mode-card::before {
  content: ""; position: absolute; right: 18px; top: 20px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid rgba(168, 203, 230, .7); background: transparent;
}
.fb-mode-name { font-size: 17px; font-weight: 500; line-height: 1.3; color: #fff; }
.fb-mode-desc { font-size: 14px; line-height: 1.5; color: var(--text-dim); }
.fb-mode:hover .fb-mode-card { border-color: var(--blue-300); background: rgba(90, 168, 255, .12); transform: translateY(-1px); }
.fb-mode:active .fb-mode-card { transform: translateY(0) scale(.985); }
.fb-mode input:focus-visible + .fb-mode-card { outline: 2px solid var(--blue-300); outline-offset: 3px; }
.fb-mode input:checked + .fb-mode-card {
  border-color: rgba(140, 196, 255, .85);
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(90, 168, 255, .24), transparent 60%),
    var(--glass-hi);
  box-shadow: inset 0 1px 0 rgba(212, 233, 255, .14), 0 0 0 1px rgba(90, 168, 255, .35), 0 14px 30px -16px rgba(90, 168, 255, .7);
}
.fb-mode input:checked + .fb-mode-card::before { border: 6px solid var(--accent); background: #fff; box-shadow: 0 0 10px rgba(90, 168, 255, .7); }

.fb-named { display: grid; gap: 18px; }
.fb-named.is-entering { animation: fbDrop .28s var(--ease-out) both; }
@keyframes fbDrop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- pills: the 1 to 5 scale and yes / maybe / not yet ---------- */
.fb-scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.fb-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fb-pill { position: relative; display: flex; cursor: pointer; }
.fb-pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fb-pill > span {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 48px; padding: 8px 6px;
  border: 1px solid rgba(168, 203, 230, .38); border-radius: 14px;
  background: rgba(120, 175, 240, .07); color: var(--text);
  font-size: 16px; font-weight: 500; line-height: 1.2; text-align: center;
  box-shadow: 0 1px 0 rgba(212, 233, 255, .05) inset, 0 6px 14px -10px rgba(2, 8, 22, .8);
  transition: transform .18s var(--ease-out);
  -webkit-user-select: none; user-select: none;
}
.fb-pill:hover > span { border-color: var(--blue-300); background: rgba(90, 168, 255, .14); color: #fff; transform: translateY(-1px); }
.fb-pill:active > span { transform: translateY(0) scale(.96); }
.fb-pill input:focus-visible + span { outline: 2px solid var(--blue-300); outline-offset: 3px; }
.fb-pill input:checked + span {
  background: var(--accent-metal) border-box; border-color: transparent; color: var(--on-accent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 8px 20px -8px rgba(90, 168, 255, .75);
}
.fb-scale-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 1.4; color: var(--text-dim); }
#fb-clarity[aria-invalid="true"] .fb-pill > span { border-color: var(--fb-err); }

/* ---------- honeypot, note ---------- */
.fb-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.fb-note { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); text-wrap: pretty; }
.fb-note a, .fb-status a { position: relative; display: inline-block; transition: transform .18s var(--ease-out); }
.fb-note a::after, .fb-status a::after {
  content: ""; position: absolute; left: -6px; right: -6px; top: 50%;
  height: 44px; transform: translateY(-50%);
}
.fb-note a { color: var(--blue-300); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.fb-note a:hover { color: #fff; }
.fb-note a:active, .fb-status a:active { transform: scale(.97); }
.fb-note a:focus-visible, .fb-status a:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 2px; border-radius: 3px; }

/* ---------- foot: status, Back / Next ---------- */
.fb-foot {
  flex: none;
  display: grid; gap: 10px;
  padding: 14px var(--fb-pad) calc(var(--fb-pad) - 6px);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(6, 18, 42, .10), rgba(6, 18, 42, .45));
}
.fb-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.fb-actions .btn { min-height: 48px; padding: 12px 24px; }
.fb-back { margin-right: auto; }
.fb-next:disabled, .fb-send:disabled { cursor: not-allowed; opacity: .5; transform: none; box-shadow: none; }
.fb-send:disabled { cursor: progress; opacity: .72; }
.fb-next:disabled::after, .fb-send:disabled::after { opacity: 0; }
.fb .btn:focus-visible { outline: 2px solid var(--blue-300); outline-offset: 3px; }
.fb-next-hint { text-align: right; }
@media (max-width: 480px) {
  .fb-actions .btn { flex: 1 1 0; padding-left: 14px; padding-right: 14px; }
  .fb-back { margin-right: 0; }
  .fb-next-hint { text-align: center; }
}

.fb-status:empty { display: none; }
.fb-status {
  font-size: 14.5px; line-height: 1.55; color: var(--text);
  padding: 12px 16px;
  background: var(--fb-err-bg);
  border: 1px solid var(--fb-err-line);
  border-radius: var(--radius-sm);
}
.fb-status strong { color: var(--fb-err); font-weight: 600; }
.fb-status a {
  color: #fff; font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--accent);
  text-underline-offset: 3px; text-decoration-thickness: 2px;
}
.fb-status a:hover { color: var(--blue-200); }

/* ---------- thank you ---------- */
.fb-thanks { align-items: flex-start; padding: 8px 0 6px; }
.fb-thanks .fb-lede { margin-top: -8px; }
.fb-thanks-mark {
  position: relative;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-metal);
  box-shadow: var(--glow-accent);
}
.fb-thanks-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 13px; height: 24px; margin: -15px 0 0 -6.5px;
  border: solid var(--on-accent); border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

/* ---------- small phones ---------- */
@media (max-width: 380px) {
  .fb { --fb-pad: 16px; }
  .fb-mode-card { min-height: 0; }
  .fb-bars span { width: 36px; }
}

/* ---------- reduced motion: no movement at all ---------- */
@media (prefers-reduced-motion: reduce) {
  .fb[open], .fb[open]::backdrop, .fb.is-closing, .fb.is-closing::backdrop,
  .fb-step.is-entering, .fb-named.is-entering { animation: none; }
  .fb-bars span::after, .fb-x, .fb-check, .fb-check-box::after, .fb-mode-card, .fb-pill > span,
  .fb-note a, .fb-status a { transition: none; }
  .fb-x:hover, .fb-x:active, .fb-check:active, .fb-mode:hover .fb-mode-card, .fb-mode:active .fb-mode-card,
  .fb-pill:hover > span, .fb-pill:active > span, .fb select:active { transform: none; }
}
