/* ═══════════════════════════════════════════════════════════════
   MVTLoop "Signal" participant theme — visual-only layer.
   Loaded after styles.css. Marketing-mode page is left untouched.
   ═══════════════════════════════════════════════════════════════ */
body:not(.marketing-mode) {
  font-family: var(--font-body);
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(var(--brand-rgb),.12), transparent 60%),
    radial-gradient(700px 420px at 0% 100%, rgba(var(--brand-rgb),.04), transparent 60%),
    var(--canvas);
}
body:not(.marketing-mode)::after { opacity: .5; }

/* progress */
#progress-bar-container { height: var(--progress-height); background: rgba(var(--brand-rgb),.12); }
#progress-bar { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)); border-radius: 0 4px 4px 0; box-shadow: 0 0 12px rgba(var(--brand-rgb),.35); }

/* card */
body:not(.marketing-mode) .card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 60px -32px rgba(17,19,58,.35), 0 2px 6px rgba(17,19,58,.05);
  padding: clamp(20px, 3vw, 32px);
}
body:not(.marketing-mode) .screen-title { font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em; line-height: 1.12; color: var(--ink); }
body:not(.marketing-mode) .screen-subtitle { color: var(--ink-soft); line-height: 1.6; }

/* step pill */
.step-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--accent-light); color: var(--brand-primary); border: 1px solid #D5D8F6;
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.step-indicator::before { background: var(--brand-primary); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.16); }

/* questions */
.question-block { margin-top: 26px; }
.question-label { font-weight: 600; font-size: 1.0625rem; line-height: 1.45; color: var(--ink); letter-spacing: -.005em; }
.question-label .required, .question-label span[aria-hidden] { color: var(--brand-secondary); }
.question-section-heading { font-family: var(--font-display); color: var(--brand-primary); letter-spacing: -.01em; }

/* single / multi choice: whole row is the tap target, clear selected state */
.choice-list { gap: 10px; }
.choice-item {
  display: flex; align-items: center; gap: 14px;
  min-height: 52px; padding: 13px 16px;
  background: #fff; border: 1.5px solid var(--border); border-radius: 14px;
  color: var(--ink); font-size: 1rem; cursor: pointer;
  box-shadow: 0 1px 2px rgba(17,19,58,.04);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}
.choice-item:hover { border-color: var(--brand-secondary); background: #F8F9FF; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.choice-item input { width: 20px; height: 20px; accent-color: var(--brand-primary); }
.choice-item.selected, .choice-item:has(input:checked) {
  border-color: var(--brand-primary); background: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(79,84,201,.16); font-weight: 600; color: var(--brand-ink);
}
.choice-item:focus-within { box-shadow: var(--ring); border-color: var(--brand-secondary); }

/* text inputs */
.text-input, body:not(.marketing-mode) textarea, body:not(.marketing-mode) input[type="text"], body:not(.marketing-mode) input[type="email"] {
  border: 1.5px solid var(--border-strong); border-radius: 12px; background: #fff; color: var(--ink);
  font: 400 1rem/1.5 var(--font-body); padding: 12px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.text-input:focus, body:not(.marketing-mode) textarea:focus, body:not(.marketing-mode) input[type="text"]:focus, body:not(.marketing-mode) input[type="email"]:focus {
  outline: none; border-color: var(--brand-secondary); box-shadow: var(--ring);
}
.field-error { color: var(--danger); font-weight: 500; }
.question-validation-summary { background: var(--danger-light); border: 1px solid #F5C2CA; color: #8E1B2D; border-radius: 12px; }

/* rating scale */
.scale-btn {
  min-width: 48px; min-height: 48px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; color: var(--ink-soft);
  font-weight: 600; transition: all var(--transition);
}
.scale-btn:hover { border-color: var(--brand-secondary); color: var(--brand-primary); transform: translateY(-2px); }
.scale-btn.selected, .scale-btn.active, .scale-btn[aria-pressed="true"] { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; box-shadow: 0 8px 18px -8px rgba(var(--brand-rgb),.8); }
.scale-labels { color: var(--ink-muted); font-size: .8125rem; }

/* footer + buttons */
.action-footer { border-top: 1px solid var(--border); margin-top: 30px; padding-top: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
body:not(.marketing-mode) .btn-primary {
  min-height: 48px; padding: 12px 26px; border-radius: 12px; font-size: 1rem; font-weight: 700;
  background-image: linear-gradient(180deg, var(--brand-secondary), var(--brand-primary)); border-color: var(--brand-primary);
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 12px 24px -10px rgba(var(--brand-rgb),.42);
}
body:not(.marketing-mode) .btn-primary:hover:not(:disabled) { background-image: linear-gradient(180deg, var(--brand-secondary), var(--brand-primary)); }
body:not(.marketing-mode) .btn-ghost { min-height: 48px; border-radius: 12px; border: 1px solid var(--border-strong); color: var(--ink-soft); }
.btn-back-inline, .participant-back-button { color: var(--ink-soft); border-radius: 10px; font-weight: 600; }
.btn-back-inline:hover, .participant-back-button:hover { color: var(--brand-primary); background: var(--accent-light); }

/* disclosure ("Check your answers") */
.review-summary, details > summary { cursor: pointer; font-weight: 600; color: var(--brand-primary); border-radius: 8px; }
details > summary:hover { color: var(--accent-hover); }
details > summary:focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: 3px; }
.review-row { border-bottom: 1px solid var(--border); }
.review-label { color: var(--ink-muted); } .review-value { color: var(--ink); font-weight: 500; }

/* intro / consent / task instructions */
.participant-intro-box, .consent-box, .task-instruction-box, .task-gate-note {
  background: linear-gradient(180deg, #F8F9FF, #fff); border: 1px solid #D5D8F6; border-radius: 16px;
}
.task-instruction-box { border-left: 4px solid var(--brand-primary); }
.participant-intro-title { font-family: var(--font-display); letter-spacing: -.02em; }
.agree-option { border-radius: 12px; }
.timer-badge { background: var(--brand-ink); color: #fff; border-radius: 999px; font-variant-numeric: tabular-nums; }
.prototype-ribbon { background: rgba(17,19,58,.92); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,.1); }
.task-instructions-float, .task-drawer { border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.prototype-tile, .preference-choice { border: 1.5px solid var(--border); border-radius: 16px; transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition); }
.prototype-tile:hover, .preference-choice:hover { border-color: var(--brand-secondary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.preference-choice.selected { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(79,84,201,.18); }
.spinner { border-top-color: var(--brand-primary); }
#error-toast { background: var(--brand-ink); color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); }

@media (max-width: 560px) {
  body:not(.marketing-mode) .card { border-radius: 18px; padding: 22px 18px; }
  .action-footer .btn { flex: 1 1 100%; }
  .choice-item { min-height: 56px; }
}

/* ── Exact brand colour on filled elements ──
   Brand-conscious studies need the chosen colour exactly, so filled controls use the
   solid brand colour (no gradient or gloss). Hover only darkens it slightly. */
.btn-primary,
body:not(.marketing-mode) .btn-primary {
  background: var(--brand-primary);
  background-image: none;
  border-color: var(--brand-primary);
}
.btn-primary::before { content: none; display: none; }
.btn-primary:hover:not(:disabled),
body:not(.marketing-mode) .btn-primary:hover:not(:disabled) {
  background: var(--accent-hover, var(--brand-primary));
  background-image: none;
}
.scale-btn.selected,
.scale-btn.active,
.scale-btn[aria-pressed="true"] { background: var(--brand-primary); background-image: none; }
#progress-bar,
.stimulus-loading-track::after,
.step-jump-meter span { background: var(--brand-primary); background-image: none; }

/* Closed study screen (renderClosedStudy in app.js) */
.closed-card { text-align: center; }
.closed-card .closed-text { max-width: 52ch; margin-left: auto; margin-right: auto; }
.closed-card .closed-contact { margin-top: 18px; color: var(--ink-soft); }
.closed-card .closed-contact a { color: var(--brand-primary); font-weight: 600; }

/* ── Prototype loading screen (staged, brand-coloured) ── */
.stimulus-loading { gap: 10px; }
.stimulus-loading strong { font-size: 1.05rem; color: var(--ink, #1d2433); }
.stimulus-loading-detail { max-width: 34ch; color: var(--ink-soft, #4a5568); line-height: 1.45; }
.figma-loading-art { position: relative; width: 132px; height: 92px; margin-bottom: 6px; }
.fla-screen { position: absolute; left: 6px; top: 8px; width: 78px; height: 70px; border-radius: 10px; background: #fff; border: 1px solid rgba(var(--brand-rgb), .22); box-shadow: 0 10px 24px -14px rgba(var(--brand-rgb), .55); display: flex; flex-direction: column; gap: 7px; padding: 10px; overflow: hidden; animation: fla-float 3.2s ease-in-out infinite; }
.fla-screen.fla-2 { left: 48px; top: 0; animation-delay: -1.6s; }
.fla-screen i { display: block; height: 7px; border-radius: 4px; background: linear-gradient(90deg, rgba(var(--brand-rgb), .10) 0%, rgba(var(--brand-rgb), .26) 50%, rgba(var(--brand-rgb), .10) 100%); background-size: 200% 100%; animation: fla-shimmer 1.6s linear infinite; }
.fla-screen i:nth-child(1) { width: 70%; height: 9px; background-color: rgba(var(--brand-rgb), .3); }
.fla-screen i:nth-child(3) { width: 55%; }
.fla-cursor { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--brand-primary); box-shadow: 0 0 0 6px rgba(var(--brand-rgb), .16); animation: fla-tap 3.2s ease-in-out infinite; }
.stimulus-loading-bar { display: block; width: min(260px, 70%); height: 6px; border-radius: 999px; background: rgba(var(--brand-rgb), .12); overflow: hidden; margin-top: 4px; }
.stimulus-loading-bar > span { display: block; height: 100%; width: 4%; border-radius: inherit; background: var(--brand-primary); transition: width 1s linear; }
.stimulus-loading-retry, .stimulus-loading-open { pointer-events: auto; margin-top: 6px; } /* the loading overlay ignores clicks, but these two must work */
.stimulus-loading-retry[hidden] { display: none !important; }
@keyframes fla-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes fla-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes fla-tap { 0% { left: 20px; top: 70px; transform: scale(1); } 40% { left: 92px; top: 44px; transform: scale(1); } 50% { transform: scale(.75); } 60% { transform: scale(1); } 100% { left: 20px; top: 70px; } }
@media (prefers-reduced-motion: reduce) { .fla-screen, .fla-screen i, .fla-cursor { animation: none; } .stimulus-loading-bar > span { transition: none; } }

/* Full-screen prototype viewer: the same staged loading screen as inline prototypes */
.embed-loader-figma { z-index: 3; background: linear-gradient(145deg, #fff 0%, #f5f7fc 100%); }
.embed-loader-figma .stimulus-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px; color: #30394e; }
.embed-loader-figma.hidden { visibility: hidden; transition: opacity var(--transition, .2s), visibility 0s linear .3s; }

/* ── Prototype viewer toolbar (2026-11-14): compact, light, uses the study's brand colours ── */
.prototype-overlay .prototype-ribbon {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px; flex-wrap: nowrap;
  width: auto; max-width: calc(100% - 20px); top: 10px; padding: 5px;
  border: 1px solid rgba(var(--brand-rgb), .16); border-radius: 14px;
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 8px 24px rgba(17, 19, 58, .12), 0 1px 2px rgba(17, 19, 58, .06);
  color: var(--ink); cursor: grab; transition: box-shadow .18s ease;
}
.prototype-overlay .prototype-ribbon.is-dragging { cursor: grabbing; box-shadow: 0 16px 40px rgba(17, 19, 58, .2); }
.prototype-overlay .prototype-ribbon-main { gap: 4px; min-width: 0; }
.prototype-overlay .prototype-ribbon .ribbon-grip { display: inline-grid; place-items: center; width: 22px; height: 32px; border-radius: 8px; color: rgba(var(--brand-rgb), .55); font-size: 1rem; letter-spacing: 0; cursor: grab; }
.prototype-overlay .prototype-ribbon .ribbon-grip:hover { background: var(--accent-light); color: var(--brand-primary); }
.prototype-overlay .prototype-ribbon .prototype-ribbon-title { color: var(--ink); font-weight: 600; font-size: .875rem; max-width: 22vw; margin: 0 4px; }
.prototype-overlay .prototype-ribbon .btn { min-height: 34px; padding: 0 12px; border-radius: 10px; font-size: .8125rem; font-weight: 600; line-height: 1; box-shadow: none; white-space: nowrap; }
.prototype-overlay .prototype-ribbon .btn-back-inline { background: transparent; border: 1px solid transparent; color: var(--brand-primary); padding: 0 10px 0 8px; }
.prototype-overlay .prototype-ribbon .btn-back-inline:hover { background: var(--accent-light); border-color: transparent; }
.prototype-overlay .prototype-ribbon .ribbon-btn-stuck { background: #fff; background-image: none; color: var(--brand-primary); border: 1px solid rgba(var(--brand-rgb), .35); }
.prototype-overlay .prototype-ribbon .ribbon-btn-stuck:hover { background: var(--accent-light); border-color: var(--brand-primary); }
.prototype-overlay .prototype-ribbon .ribbon-btn-finished { background: var(--brand-primary); background-image: none; color: var(--brand-on-primary, #fff); border: 1px solid var(--brand-primary); }
.prototype-overlay .prototype-ribbon .ribbon-btn-finished::before { content: none; }
.prototype-overlay .prototype-ribbon .ribbon-btn-finished:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.prototype-overlay .prototype-ribbon .btn:focus-visible,
.prototype-overlay .prototype-ribbon .ribbon-grip:focus-visible,
.prototype-overlay .prototype-ribbon .ribbon-collapse:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.prototype-overlay .overlay-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; width: auto; margin-left: 2px; padding-left: 8px; border-left: 1px solid rgba(var(--brand-rgb), .14); }
.figma-view-switch.is-toolbar { margin: 0 2px 0 0; padding: 2px; border: 1px solid rgba(var(--brand-rgb), .14); border-radius: 10px; background: rgba(var(--brand-rgb), .05); box-shadow: none; }
.figma-view-switch.is-toolbar button { min-height: 30px; padding: 0 10px; border-radius: 8px; color: var(--ink-soft); }
.figma-view-switch.is-toolbar button:hover { color: var(--brand-primary); background: #fff; }
.figma-view-switch.is-toolbar button[aria-pressed="true"] { background: var(--brand-primary); color: var(--brand-on-primary, #fff); }
.prototype-overlay .ribbon-collapse { display: inline-grid; place-items: center; flex: none; width: 30px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--brand-primary); cursor: pointer; }
.prototype-overlay .ribbon-collapse:hover { background: var(--accent-light); }
.prototype-overlay .ribbon-collapse svg { width: 16px; height: 16px; transition: transform .2s ease; }
.prototype-overlay .prototype-ribbon.is-collapsed .overlay-actions,
.prototype-overlay .prototype-ribbon.is-collapsed .prototype-ribbon-title { display: none; }
.prototype-overlay .ribbon-collapse-text { display: none; }
/* Collapsed: grip, Back, then a clearly labelled "Show controls" button (chevron points down: the bar unfolds). */
.prototype-overlay .prototype-ribbon.is-collapsed .ribbon-collapse { display: inline-flex; align-items: center; width: auto; gap: 6px; padding: 0 12px 0 10px; margin-left: 2px; border: 1px solid rgba(var(--brand-rgb), .3); background: var(--accent-light); font: 600 .8125rem/1 var(--font-body, inherit); }
.prototype-overlay .prototype-ribbon.is-collapsed .ribbon-collapse:hover { border-color: var(--brand-primary); }
.prototype-overlay .prototype-ribbon.is-collapsed .ribbon-collapse-text { display: inline; }
.prototype-overlay .ribbon-collapse:focus:not(:focus-visible) { outline: none; box-shadow: none; }
/* Full bar: a "–" minimise button. Minimised: a "⋯ Show controls" pill. */
.prototype-overlay .ribbon-collapse .ribbon-icon-more { display: none; }
/* Full bar: brand-filled button with a white left chevron ("roll the controls away"). */
.prototype-overlay .prototype-ribbon:not(.is-collapsed) .ribbon-collapse { width: 32px; height: 32px; margin-left: 2px; border-radius: 10px; background: var(--brand-primary); color: var(--brand-on-primary, #fff); box-shadow: 0 2px 6px rgba(var(--brand-rgb), .28); transition: background-color .15s ease, transform .15s ease; }
.prototype-overlay .prototype-ribbon:not(.is-collapsed) .ribbon-collapse:hover { background: var(--accent-hover); transform: translateX(-1px); }
.prototype-overlay .prototype-ribbon:not(.is-collapsed) .ribbon-collapse:active { transform: scale(.94); }
.prototype-overlay .ribbon-collapse .ribbon-icon-min { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) { .prototype-overlay .ribbon-collapse { transition: none !important; } }
.prototype-overlay .prototype-ribbon.is-collapsed .ribbon-collapse .ribbon-icon-min { display: none; }
.prototype-overlay .prototype-ribbon.is-collapsed .ribbon-collapse .ribbon-icon-more { display: block; width: 16px; height: 16px; }
.prototype-overlay .prototype-ribbon.is-collapsed .ribbon-collapse { border-radius: 999px; }

/* While dragging a panel, the prototype must not swallow the pointer. */
body.mvt-dragging iframe { pointer-events: none !important; }
body.mvt-dragging, body.mvt-dragging * { cursor: grabbing !important; user-select: none !important; }

/* Instructions in the viewer: the same card and "Show instructions" pill as every other task type. */
.prototype-overlay .task-drawer { padding: 0; width: min(340px, calc(100vw - 24px)); background: rgba(255, 248, 211, .96); border-color: rgba(157, 123, 27, .28); color: var(--ink); backdrop-filter: blur(12px); }
.prototype-overlay .task-drawer-head { margin: 0; }
.prototype-overlay .task-drawer-title-wrap { display: inline-flex; align-items: center; gap: 8px; }
.prototype-overlay .task-drawer-body { padding: 13px 14px 15px; }
.prototype-overlay .task-drawer-body p,
.prototype-overlay .task-drawer-body ul { color: var(--ink); font-size: .9rem; line-height: 1.5; }
.prototype-overlay .task-drawer-body ul { margin: 0 0 4px 18px; }
.prototype-overlay .task-drawer-head:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: -2px; }
body.viewer-screen-active .prototype-overlay .proto-instructions-dock:not([hidden]) { display: inline-flex !important; align-items: center; position: absolute; top: 72px; right: 20px; z-index: 6; }
.prototype-overlay .prototype-overlay-panel { position: relative; }

@media (max-width: 760px) {
  .prototype-overlay .prototype-ribbon { flex-wrap: wrap; row-gap: 6px; width: calc(100% - 20px); }
  .prototype-overlay .prototype-ribbon-main { flex: 1 1 auto; order: 0; }
  .prototype-overlay .prototype-ribbon .prototype-ribbon-title { max-width: none; flex: 1; }
  .prototype-overlay .ribbon-collapse { order: 1; }
  .prototype-overlay .overlay-actions { order: 2; flex: 1 1 100%; border-left: 0; padding: 0; margin: 0; }
  .prototype-overlay .overlay-actions .btn { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
  .prototype-overlay .prototype-ribbon.is-collapsed { width: auto; }
  .prototype-overlay .prototype-ribbon { width: calc(100% - 16px); }
  .prototype-overlay .overlay-actions { flex-wrap: nowrap; gap: 4px; }
  .prototype-overlay .overlay-actions .btn { min-width: 0; padding: 0 8px; font-size: .78rem; }
  .figma-view-switch.is-toolbar { flex: none; }
  .figma-view-switch.is-toolbar button { padding: 0 7px; }
  .prototype-overlay .task-drawer { bottom: auto; height: auto; max-height: 45vh; }
  body.viewer-screen-active .prototype-overlay .proto-instructions-dock:not([hidden]) { top: auto; bottom: 16px; right: 16px; }
  .figma-view-switch.is-toolbar span { display: none; }
}
/* The viewer covers the whole window (not the page's margins), on every screen size. */
.screen.prototype-screen-active { transform: none !important; animation: none !important; }
.prototype-overlay.open { position: fixed; inset: 0; width: auto; height: 100dvh; z-index: 1000; }
