/* src/engine/form.css */
/* The engine hides steps, errors and panels with [hidden]; no host or engine display rule may undo that. */
.mf-form [hidden], .mf-success[hidden], .mf-modal[hidden] { display: none !important; }
.mf-form { font: inherit; }
.mf-field { margin-bottom: 16px; }
.mf-field label { display: block; margin-bottom: 6px; font-weight: 600; }
/* v4: --mf-pad-y sets the field height for inputs and choice buttons together, so a row lines up. */
.mf-form input:not([type=checkbox]):not([type=radio]), .mf-form select {
  width: 100%; box-sizing: border-box; font-size: 16px; padding: var(--mf-pad-y, 14px) 16px; line-height: 1.25;
  border: 2px solid #8b929c; border-radius: 12px; background: #fff; color: #111827;
}
/* v4: the field in use gets a 2px black border; a field in error keeps its red. */
.mf-form input:not([type=checkbox]):not([type=radio]):focus, .mf-form select:focus { outline: none; border-color: #000; }
.mf-form [aria-invalid="true"] { border-color: #b91c1c; }
/* v4: the red border, specific enough to beat the input rule above (on /v1 to /v3 it never drew; only the message did). */
.mf-form input[aria-invalid="true"]:not([type=checkbox]):not([type=radio]), .mf-form select[aria-invalid="true"] { border-color: #b91c1c; }
/* v4: zip and a choice side by side; the choice drops below, full width, when its question would wrap.
   Top-aligned: both labels are one line here, so the controls line up, and a two-line message under zip cannot lift it. */
.mf-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.mf-row > .mf-field { margin-bottom: 0; }
.mf-row > .mf-field:first-child { flex: 0 0 40%; min-width: 0; }
.mf-row > .mf-field:last-child { flex: 1 1 max-content; }
.mf-choice { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.mf-choice legend { float: left; width: 100%; padding: 0; margin-bottom: 6px; font-weight: 600; }
.mf-opts { clear: both; display: flex; gap: 8px; }
.mf-field .mf-opt { flex: 1; position: relative; margin: 0; font-weight: 600; }
.mf-opt input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; }
.mf-opt span { display: block; box-sizing: border-box; text-align: center; font-size: 16px; line-height: 1.25; padding: var(--mf-pad-y, 14px) 0;
  border: 2px solid #8b929c; border-radius: 12px; background: #fff; color: #000; cursor: pointer; }
.mf-opt input:focus + span { border-color: #000; }
.mf-choice[aria-invalid="true"] .mf-opt span { border-color: #b91c1c; }
.mf-form .mf-opt input:checked + span { background: #000; border-color: #000; color: #fff; }
/* A keyboard ring on any option, chosen, unchosen or in error, without changing its fill or border. */
.mf-form .mf-opt input:focus-visible + span { outline: 2px solid #000; outline-offset: 2px; }
.mf-error { display: block; margin-top: 6px; color: #b91c1c; font-weight: 600; font-size: 15px; }
.mf-summary { margin-bottom: 16px; padding: 12px 16px; border-radius: 12px; background: #fef2f2; color: #991b1b; font-weight: 600; }
.mf-consent label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.mf-consent input { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.mf-submit, .mf-next { width: 100%; min-height: 52px; font-size: 18px; font-weight: 700; border: 0; border-radius: 999px; cursor: pointer; }
.mf-submit:disabled { opacity: .65; }
.mf-back { background: none; border: 0; text-decoration: underline; min-height: 44px; font-size: 16px; }
.mf-policy, .mf-disclosure { font-size: 13px; line-height: 1.5; color: #6b7280; text-align: center; }
.mf-modal { position: fixed; inset: 0; z-index: 2147483000; }
.mf-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.mf-dialog { position: relative; margin: 0 auto; max-width: 480px; max-height: 100dvh; overflow-y: auto; overflow-x: hidden; background: #fff; padding: 56px 20px 24px; box-sizing: border-box; }
.mf-close { position: absolute; top: 8px; right: 8px; z-index: 20; width: 44px; height: 44px; font-size: 28px; background: none; border: 0; cursor: pointer; }
html.mf-open { overflow: hidden; }
@media (min-width: 600px) { .mf-dialog { margin-top: 5vh; max-height: 90dvh; border-radius: 16px; } }

/* v6 quiz: the question count is read aloud and drawn as a bar; Back is an arrow. The page lays out the card. */
.mf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mf-segs { display: flex; gap: 6px; }
.mf-segs i { flex: 1; height: 4px; border-radius: 2px; background: #d1d5db; }
.mf-segs i.on { background: #000; }
.mf-back svg { width: 22px; height: 22px; fill: currentColor; }
