/* AI Accuracy Lab · "Send feedback" panel
   Load on every page (public and signed-in), AFTER site.css and hball.css.
   Every class here is new and prefixed fb-, except .ftr-fb (the footer trigger, which sits beside .ftr-links a).
   Uses the site's own tokens (--ink, --muted, --hairline, --ground, --surface, --link, --cta) and classes
   (.btn, .btn-primary, .btn-secondary, .hdot, .sr-only). Nothing in site.css is overridden. */

/* ---------- Footer trigger: looks exactly like the other footer links ---------- */
.ftr-fb{-webkit-appearance:none;appearance:none;margin:0;padding:0;border:0;background:none;font:inherit;line-height:inherit;
  color:var(--muted);min-height:32px;display:inline-flex;align-items:center;cursor:pointer;text-align:left}
.ftr-fb:hover{color:var(--link)}

/* ---------- Page lock while the panel is open ---------- */
html.fb-lock,html.fb-lock body{overflow:hidden}

/* ---------- Layer, backdrop, panel ---------- */
.fb-root{position:fixed;inset:0;z-index:1000}
.fb-root[hidden]{display:none}
.fb-backdrop{position:absolute;inset:0;background:rgba(29,29,31,.32)}
.fb-panel{position:absolute;top:0;right:0;bottom:0;width:440px;max-width:100%;
  background:var(--surface,#fff);color:var(--ink);border-radius:24px 0 0 24px;
  box-shadow:-24px 0 60px rgba(29,29,31,.18);display:flex;flex-direction:column;outline:none}

/* Slide only when the visitor allows motion. With prefers-reduced-motion the panel simply appears. */
@media (prefers-reduced-motion:no-preference){
  .fb-backdrop{opacity:0;transition:opacity .22s ease}
  .fb-panel{transform:translateX(100%);transition:transform .26s cubic-bezier(.2,.8,.2,1)}
  .fb-root.fb-open .fb-backdrop{opacity:1}
  .fb-root.fb-open .fb-panel{transform:none}
}

/* ---------- Header ---------- */
.fb-handle{display:none}
.fb-head{flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:22px 20px 14px 28px}
.fb-titlewrap{display:flex;align-items:center;gap:12px;min-width:0}
.fb-icon{flex:none;display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:12px;background:var(--ground)}
.fb-title{margin:0;font-size:24px;line-height:1.2;letter-spacing:-.02em;font-weight:800}
.fb-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;
  border-radius:50%;border:0;background:transparent;color:var(--ink);cursor:pointer}
.fb-close:hover{background:var(--ground)}

/* ---------- Form ---------- */
.fb-form{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
.fb-form[hidden]{display:none}
.fb-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 28px 20px;
  display:flex;flex-direction:column;gap:20px}
.fb-field{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;border:0;min-width:0}
fieldset.fb-field{display:block}
.fb-label{padding:0;font-size:15px;font-weight:700;line-height:1.4}
.fb-opt{font-weight:400;color:var(--muted)}

/* Rating: five real radios, drawn as pills. Selected = ink fill. */
.fb-pills{margin-top:12px;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
.fb-pill{position:relative;display:flex;align-items:center;justify-content:center;min-height:44px;border-radius:999px;
  background:#fff;box-shadow:inset 0 0 0 1px #D2CEC6;font-size:15px;font-weight:600;cursor:pointer;
  -webkit-user-select:none;user-select:none}
.fb-pill:hover{box-shadow:inset 0 0 0 1.5px var(--ink)}
.fb-pill input{position:absolute;opacity:0;width:1px;height:1px;margin:0;pointer-events:none}
.fb-pill.is-checked{background:var(--ink);color:#fff;box-shadow:none}
.fb-pill:has(input:focus-visible){outline:3px solid var(--link);outline-offset:3px}
.fb-ends{margin-top:8px;display:flex;justify-content:space-between;font-size:13px;color:var(--muted)}

/* Text fields */
.fb-input,.fb-select,.fb-textarea{display:block;width:100%;border:1px solid #D2CEC6;border-radius:10px;
  font:inherit;font-size:15px;color:var(--ink);background:#fff}
.fb-input,.fb-select{min-height:44px;padding:0 12px}
.fb-select{-webkit-appearance:none;appearance:none;padding-right:40px;font-weight:500;cursor:pointer;
  background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231D1D1F' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center}
.fb-textarea{min-height:132px;padding:12px;line-height:1.5;resize:vertical}
.fb-input::placeholder,.fb-textarea::placeholder{color:#8A8780;opacity:1}
.fb-input:hover,.fb-select:hover,.fb-textarea:hover{border-color:#A8A39A}
.fb-input:focus-visible,.fb-select:focus-visible,.fb-textarea:focus-visible{outline-offset:1px}
.fb-input[readonly]{background:var(--ground);border-color:var(--hairline);cursor:default}
.fb-input[aria-invalid="true"],.fb-textarea[aria-invalid="true"]{border:1.5px solid #B4152B}

.fb-row{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.fb-err{margin:0;display:flex;align-items:center;gap:6px;font-size:13.5px;font-weight:600;line-height:1.4;color:#B4152B}
.fb-err[hidden]{display:none}
.fb-err svg{flex:none}
.fb-count{margin:0 0 0 auto;font-size:13px;color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}
.fb-note{margin:0;font-size:13px;color:var(--muted)}
.fb-check{margin-top:4px;display:flex;align-items:center;gap:10px;min-height:44px;font-size:15px;cursor:pointer}
.fb-check input{flex:none;width:18px;height:18px;margin:0;accent-color:var(--ink);cursor:pointer}

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). Never visible, never focusable. */
.fb-hp{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}

/* Page context and privacy line */
.fb-meta{display:flex;flex-direction:column;gap:8px;font-size:13.5px;line-height:1.5;color:var(--muted)}
.fb-meta p{margin:0}
.fb-context{display:flex;align-items:flex-start;gap:8px}
.fb-context svg{flex:none;margin-top:2px}
.fb-meta a{color:var(--link);font-weight:600;text-decoration:none}
.fb-meta a:hover{text-decoration:underline}

/* ---------- Footer row: Send + Cancel, and the "couldn't send" message ---------- */
.fb-foot{flex:none;padding:16px 28px 24px;border-top:1px solid var(--hairline);display:flex;flex-wrap:wrap;gap:12px}
.fb-fail{flex:1 1 100%;margin:0;display:flex;align-items:flex-start;gap:10px;padding:12px 14px;border-radius:12px;
  background:#FFF4F2;box-shadow:inset 0 0 0 1px #F1C9C3;font-size:14px;line-height:1.5;color:var(--ink)}
.fb-fail:empty{display:none}
.fb-fail svg{flex:none;margin-top:2px}
.fb-fail a{color:var(--link);font-weight:600}

/* ---------- Sent ---------- */
.fb-done{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:0 44px 72px}
.fb-done[hidden]{display:none}
.fb-done-icon{display:inline-flex;align-items:center;justify-content:center;width:88px;height:88px;border-radius:50%;background:var(--ground)}
.fb-done-title{margin:26px 0 0;font-size:28px;line-height:1.15;letter-spacing:-.025em;font-weight:800;outline:none}
.fb-done-text{margin:12px 0 0;max-width:300px;font-size:16px;line-height:1.55;color:var(--muted)}
.fb-done .btn{margin-top:28px;padding:0 32px}

/* ---------- Phones: bottom sheet ---------- */
@media (max-width:600px){
  .fb-panel{top:auto;left:0;right:0;bottom:0;width:auto;max-height:90vh;max-height:90dvh;
    border-radius:20px 20px 0 0;box-shadow:0 -16px 48px rgba(29,29,31,.18)}
  .fb-handle{flex:none;display:flex;justify-content:center;padding-top:8px}
  .fb-handle span{width:36px;height:4px;border-radius:999px;background:#D2CEC6}
  .fb-head{padding:8px 8px 10px 20px;gap:10px}
  .fb-titlewrap{gap:10px}
  .fb-icon{width:36px;height:36px;border-radius:11px}
  .fb-icon svg{width:24px;height:24px}
  .fb-title{font-size:22px}
  .fb-body{padding:4px 20px 18px;gap:18px}
  .fb-pills{margin-top:10px}
  .fb-ends{margin-top:6px}
  .fb-input,.fb-select,.fb-textarea{font-size:16px}  /* 16px stops iOS zooming into the field */
  .fb-textarea{min-height:112px}
  .fb-check input{width:20px;height:20px}
  .fb-foot{flex-wrap:wrap;gap:10px;padding:12px 20px calc(16px + env(safe-area-inset-bottom,0px))}
  .fb-foot .btn{padding:0 22px}
  .fb-foot .btn-primary{flex:1 1 auto;padding:0 16px}
  .fb-done{flex:none;padding:28px 28px calc(40px + env(safe-area-inset-bottom,0px))}
}
@media (prefers-reduced-motion:no-preference) and (max-width:600px){
  .fb-panel{transform:translateY(100%)}
}

/* Windows contrast themes: keep the selected rating visible */
@media (forced-colors:active){
  .fb-pill{border:1px solid CanvasText}
  .fb-pill.is-checked{background:Highlight;color:HighlightText;forced-color-adjust:none}
}
