/* Mastera Works survey styles. Tokens match public/index.html. */
:root {
  --bg: #020817;
  --bg-2: #050d1f;
  --card: rgba(8, 16, 40, 0.72);
  --border: rgba(59, 130, 246, 0.18);
  --border-strong: rgba(59, 130, 246, 0.55);
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --muted: #94a3b8;
  --blue: #3b82f6;
  --blue-300: #93c5fd;
  --cyan: #06b6d4;
  --cyan-300: #67e8f9;
  --error: #fca5a5;
  --error-bg: rgba(239, 68, 68, 0.1);
  --success: #6ee7b7;
  --radius: 1.25rem;
  --radius-sm: 0.75rem;
  --focus: 0 0 0 3px rgba(103, 232, 249, 0.85);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}
::selection { background: rgba(59, 130, 246, 0.3); }
h1, h2, h3 { font-family: var(--font-head); color: var(--text-strong); line-height: 1.2; letter-spacing: -0.01em; }
a { color: var(--blue-300); }
a:hover { color: var(--cyan-300); }
code { font-size: 0.9em; color: var(--blue-300); }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: 0.75rem 1rem; background: var(--blue); color: #fff; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }

:focus-visible { outline: none; box-shadow: var(--focus); }

/* Ambient background */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(110px); }
.orb-1 { width: 560px; height: 560px; top: -220px; right: -160px; background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 70%); }
.orb-2 { width: 480px; height: 480px; bottom: -140px; left: -160px; background: radial-gradient(circle, rgba(139, 92, 246, 0.13), transparent 70%); }

/* Layout */
.site-header, .shell, .site-footer { position: relative; z-index: 1; }
.site-header {
  max-width: 54rem; margin: 0 auto; padding: 1.25rem 1.25rem 0.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.logo-link img { height: 2.5rem; width: auto; display: block; }
.shell { max-width: 54rem; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.site-footer { text-align: center; color: #64748b; font-size: 0.8rem; padding: 0 1.25rem 2.5rem; }
.site-footer p { margin: 0.2rem 0; }
.legal-links { display: flex; justify-content: center; gap: 1rem; margin-top: 0.5rem !important; }
.legal-links a { color: #94a3b8; }

.card {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2.5rem);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.9rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em;
  background: rgba(59, 130, 246, 0.08); border: 1px solid rgba(59, 130, 246, 0.25); color: var(--blue-300);
}
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan-300); margin: 0 0 0.75rem; }
.grad-text { background: linear-gradient(135deg, #60a5fa 0%, #06b6d4 50%, #a78bfa 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

/* Intro */
.intro h1 { font-size: clamp(1.75rem, 5vw, 2.6rem); margin: 0 0 1.25rem; }
.intro p { margin: 0 0 1rem; }
.scope-note {
  margin: 1.25rem 0; padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(8, 145, 178, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.25); border-radius: var(--radius-sm);
}
.scope-note p { margin: 0; color: var(--text-strong); }
.privacy { margin: 1.25rem 0 0.5rem; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.02); }
.privacy summary { cursor: pointer; padding: 0.9rem 1.1rem; font-weight: 600; color: var(--blue-300); min-height: 44px; }
.privacy-body { padding: 0 1.1rem 0.5rem; font-size: 0.92rem; color: var(--muted); }
.privacy-body strong { color: var(--text); }
.pilot-banner { margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); background: rgba(250, 204, 21, 0.08); border: 1px solid rgba(250, 204, 21, 0.3); color: #fde68a; font-size: 0.9rem; }
.pilot-time { color: #fde68a; font-size: 0.9rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.75rem 1.5rem; border-radius: 0.875rem;
  font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.btn-primary { background: linear-gradient(135deg, #2563eb, #0891b2); border: 1px solid rgba(96, 165, 250, 0.4); color: #fff; box-shadow: 0 0 20px rgba(59, 130, 246, 0.28), 0 4px 24px rgba(0, 0, 0, 0.4); }
.btn-primary:hover { background: linear-gradient(135deg, #3b82f6, #06b6d4); box-shadow: 0 0 30px rgba(59, 130, 246, 0.45), 0 4px 24px rgba(0, 0, 0, 0.4); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.14); color: var(--text); font-weight: 600; }
.btn-ghost:hover { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.45); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.small-btn { min-height: 40px; padding: 0.4rem 1rem; font-size: 0.9rem; margin-top: 0.5rem; }
.link-btn {
  background: none; border: 0; padding: 0.5rem 0.25rem; min-height: 44px;
  color: var(--blue-300); font: inherit; font-size: 0.875rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-btn:hover { color: var(--cyan-300); }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* Progress */
.progress { margin-bottom: 1.5rem; }
.progress-labels { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.5rem; }
.progress-stage { color: var(--cyan-300); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; }
.progress-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #3b82f6, #06b6d4); transition: width 0.35s ease; }

/* Pages and transitions */
.page-title { font-size: clamp(1.4rem, 4vw, 1.9rem); margin: 0 0 0.5rem; }
.page-title:focus { box-shadow: none; }
.page-intro { color: var(--muted); margin: 0 0 1.25rem; }
.page-form { display: flex; flex-direction: column; gap: 1.75rem; margin-top: 1.25rem; }

@keyframes enter-forward { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes leave-forward { to { opacity: 0; transform: translateX(-12px); } }
@keyframes leave-back { to { opacity: 0; transform: translateX(12px); } }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.enter-forward { animation: enter-forward 0.26s ease-out both; }
.enter-back { animation: enter-back 0.26s ease-out both; }
.leave-forward { animation: leave-forward 0.14s ease-in both; }
.leave-back { animation: leave-back 0.14s ease-in both; }
.is-revealing { animation: reveal 0.22s ease-out both; }

/* Questions */
.question { border: 0; margin: 0; padding: 0; min-width: 0; }
.q-title { display: block; padding: 0; margin: 0 0 0.35rem; font-weight: 600; font-size: 1.08rem; color: var(--text-strong); }
.req { color: var(--cyan-300); font-weight: 500; font-size: 0.9rem; }
.optional { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.q-instruction { margin: 0 0 0.25rem; color: var(--blue-300); font-size: 0.9rem; font-weight: 500; }
.q-helper { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.92rem; }
.q-count { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }
.q-error { margin: 0.5rem 0 0; color: var(--error); font-size: 0.92rem; font-weight: 600; }
.has-error .options { outline: 1px solid rgba(252, 165, 165, 0.5); outline-offset: 6px; border-radius: var(--radius-sm); }
.followup { margin-left: clamp(0rem, 3vw, 1.25rem); padding-left: 1rem; border-left: 2px solid rgba(59, 130, 246, 0.35); }

.options { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.option { display: flex; flex-direction: column; }
.choice {
  position: relative; display: flex; align-items: flex-start; gap: 0.85rem;
  min-height: 52px; padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease;
}
.choice:hover { border-color: rgba(59, 130, 246, 0.4); background: rgba(59, 130, 246, 0.05); }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mark {
  flex: 0 0 auto; width: 1.3rem; height: 1.3rem; margin-top: 0.1rem;
  border: 2px solid rgba(148, 163, 184, 0.7); border-radius: 0.35rem; background: rgba(2, 8, 23, 0.6);
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s ease;
}
.choice input[type='radio'] + .mark { border-radius: 50%; }
.choice input:checked + .mark { border-color: var(--cyan); background: linear-gradient(135deg, #2563eb, #0891b2); }
.choice input[type='checkbox']:checked + .mark::after { content: ''; width: 0.38rem; height: 0.7rem; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.choice input[type='radio']:checked + .mark::after { content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #fff; }
.choice:has(input:checked) { border-color: rgba(6, 182, 212, 0.6); background: rgba(6, 182, 212, 0.08); }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
.choice-label { flex: 1; }
.choice-hint { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.85rem; }
.option-exclusive .choice { border-style: dashed; }
.option.is-disabled .choice { opacity: 0.45; cursor: not-allowed; }
.option.is-disabled .choice:hover { border-color: rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.03); }
.option-text { margin: 0.5rem 0 0.25rem 2.15rem; }
.option-text label, .field > label:not(.choice) { display: block; font-size: 0.88rem; color: var(--muted); margin-bottom: 0.35rem; }

.input {
  width: 100%; padding: 0.8rem 1rem; min-height: 48px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius-sm);
  color: var(--text-strong); font: inherit; font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
textarea.input { resize: vertical; margin-top: 0.5rem; }
.input:focus { border-color: rgba(59, 130, 246, 0.7); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); background: rgba(59, 130, 246, 0.04); outline: none; }

.optin { margin-top: 1rem; padding: 1rem; border-radius: var(--radius-sm); background: rgba(59, 130, 246, 0.06); border: 1px solid rgba(59, 130, 246, 0.25); }
.optin p { margin: 0 0 0.75rem; color: var(--text); font-size: 0.95rem; }

/* Mobile-friendly rows for E01, E04, E08 */
.matrix { display: flex; flex-direction: column; gap: 0.75rem; }
.row-card { border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-sm); padding: 0.9rem 1rem; background: rgba(255, 255, 255, 0.02); margin: 0; min-width: 0; }
/* Floating the legend keeps it inside the card instead of on the fieldset border. */
.row-card > legend { float: left; width: 100%; }
.row-card > legend + * { clear: both; }
.row-card.dual .pill-group + .pill-group { margin-top: 0.75rem; }
.pill-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.row-title { padding: 0; font-weight: 600; color: var(--text-strong); margin-bottom: 0.5rem; }
.scale-title { padding: 0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue-300); margin-bottom: 0.4rem; }
.pills { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.5rem 0.9rem;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.03);
  font-size: 0.92rem; line-height: 1.3; transition: all 0.15s ease;
}
.pill:hover span { border-color: rgba(59, 130, 246, 0.45); }
.pill input:checked + span { background: linear-gradient(135deg, #2563eb, #0891b2); border-color: rgba(103, 232, 249, 0.6); color: #fff; font-weight: 600; }
.pill input:focus-visible + span { box-shadow: var(--focus); }
.pill-group .clear-btn { min-height: 36px; padding: 0.25rem; margin-top: 0.25rem; }

/* Consent, errors, nav */
.error-box { padding: 0.9rem 1rem; border-radius: var(--radius-sm); background: var(--error-bg); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--error); }
.error-box p { margin: 0; }
.nav { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding-top: 0.5rem; border-top: 1px solid rgba(255, 255, 255, 0.06); margin-top: 0.25rem; }
.nav-right { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-left: auto; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Completion screens */
.saved, .done { text-align: left; }
.check {
  width: 3.25rem; height: 3.25rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: var(--success); background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); margin-bottom: 1rem;
}
.understanding, .help { margin-top: 1.75rem; padding: 1.25rem; border-radius: var(--radius-sm); border: 1px solid rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.02); }
.understanding h3, .help h3 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.understanding-item { padding-top: 0.9rem; margin-top: 0.9rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.understanding-item p { margin: 0.25rem 0; }
.u-q { font-weight: 600; color: var(--text-strong); }
.help-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.field-row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .field-row { grid-template-columns: 1fr; }
  .nav { flex-direction: column-reverse; align-items: stretch; }
  .nav > span:empty { display: none; }
  .nav-right { flex-direction: column-reverse; margin-left: 0; }
  .nav .btn, .stack-mobile .btn { width: 100%; }
  .stack-mobile { flex-direction: column; }
  .logo-link img { height: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .choice input:checked + .mark, .pill input:checked + span { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
