:root {
  --lm-purple:        #933DC4;
  --lm-purple-dark:   #682C8C;
  --lm-purple-tint:   #E9DDF4;
  --lm-dot:           rgba(147, 61, 196, 0.22);
  --lm-lavender:      #F4F4FE;
  --lm-surface:       #FFFFFF;
  --lm-ink:           #222222;
  --lm-text:          #444444;
  --lm-muted:         #666666;
  --lm-border:        #D9D6E8;
  --lm-black:         #00040D;
  --lm-warning:       #8A5A00;
  --lm-warning-bg:    #FFF5E0;
  --lm-error:         #B3261E;

  --lm-font: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --lm-radius: 2px;
  --lm-tap: 48px;
  --lm-maxw: 680px;
  --nav-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--lm-font);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--lm-text);
  background: var(--lm-lavender);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; outline: none; }

a { color: var(--lm-purple-dark); text-underline-offset: 2px; }
a:hover { color: var(--lm-purple); }

strong { color: var(--lm-ink); font-weight: 700; }

:focus-visible {
  outline: 3px solid var(--lm-purple-dark);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  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: 8px; top: -60px;
  background: var(--lm-surface); color: var(--lm-purple-dark);
  padding: 10px 14px; z-index: 100; font-weight: 700;
}
.skip-link:focus { top: 8px; }

[hidden] { display: none !important; }

/* Header ------------------------------------------------------------------ */

.site-header {
  background: var(--lm-surface);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--lm-border);
}
.site-logo { display: block; height: 44px; width: auto; }
.site-header a { display: block; }
.site-tag {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--lm-ink);
  text-align: right;
}
.test-badge {
  display: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--lm-warning); background: var(--lm-warning-bg);
  padding: 3px 8px; border: 1px solid var(--lm-warning);
}
body.is-test .test-badge { display: inline-block; }

/* Layout ------------------------------------------------------------------ */

.hero, .section {
  position: relative;
  overflow: hidden;
  padding: 28px 16px 40px;
}
.card {
  position: relative;
  z-index: 1;
  max-width: var(--lm-maxw);
  margin: 0 auto;
  background: var(--lm-surface);
  border-radius: var(--lm-radius);
  padding: 24px 20px 28px;
  box-shadow: 0 1px 2px rgba(34, 34, 34, 0.04);
}
.card > p:last-child { margin-bottom: 0; }

.step-title {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--lm-ink);
  margin: 0 0 18px;
  outline: none;
}
.lead { font-size: 18px; color: var(--lm-ink); }
.muted { color: var(--lm-muted); }
.small { font-size: 14px; }

/* Decorative circles (logo motif) */
.circles { position: absolute; right: -40px; bottom: -40px; width: 260px; height: 320px; pointer-events: none; z-index: 0; }
.circle { position: absolute; border-radius: 50%; background: var(--lm-dot); }
.circle.c1 { width: 160px; height: 160px; right: 30px; bottom: 30px; }
.circle.c2 { width: 90px; height: 90px; right: 90px; bottom: 210px; }
.circle.c3 { width: 46px; height: 46px; right: 112px; bottom: 316px; }
.hero { padding-bottom: 120px; }

/* Intro ------------------------------------------------------------------- */

.privacy-note {
  font-size: 15px;
  color: var(--lm-text);
  border-left: 4px solid var(--lm-purple-tint);
  padding-left: 12px;
  margin: 22px 0;
}
.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--lm-border);
  background: var(--lm-lavender);
  margin-bottom: 22px;
}
.consent label { font-size: 16px; color: var(--lm-ink); cursor: pointer; }
.checkbox {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  margin: 2px 0 0;
  accent-color: var(--lm-purple);
  cursor: pointer;
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions-stack { flex-direction: column; }
.actions-stack .btn { width: 100%; }

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: stretch;
  min-height: var(--lm-tap);
  padding: 0;
  border: 2px solid var(--lm-purple);
  border-radius: var(--lm-radius);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-label { display: flex; align-items: center; justify-content: center; padding: 0 20px; flex: 1; }
.btn-icon { display: flex; align-items: center; justify-content: center; width: 46px; flex: 0 0 46px; }
.btn-primary { background: var(--lm-purple); color: #fff; }
.btn-primary .btn-icon { background: var(--lm-purple-dark); }
.btn-primary:hover, .btn-primary:active { background: var(--lm-purple-dark); border-color: var(--lm-purple-dark); color: #fff; }
.btn-secondary { background: var(--lm-surface); color: var(--lm-purple-dark); border-color: var(--lm-purple); }
.btn-secondary .btn-icon { border-right: 2px solid var(--lm-purple-tint); }
.btn-secondary:hover, .btn-secondary:active { background: var(--lm-purple-tint); color: var(--lm-purple-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--lm-purple); border-color: var(--lm-purple); }

.link-button {
  background: none; border: 0; padding: 8px 0;
  font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer; min-height: 44px;
}
.link-inline { color: var(--lm-purple-dark); font-size: 15px; text-align: left; }

/* Progress ---------------------------------------------------------------- */

.progress { margin-bottom: 14px; }
.progress-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--lm-purple-dark);
}
.progress-track { height: 6px; background: var(--lm-purple-tint); }
.progress-fill { height: 100%; width: 0; background: var(--lm-purple); transition: width 0.3s ease; }

/* Questions --------------------------------------------------------------- */

.scale-intro {
  font-size: 15px; color: var(--lm-muted);
  margin: -6px 0 18px;
}
.step-body > * + * { margin-top: 22px; }
.q-heading {
  font-size: 18px; font-weight: 700; line-height: 1.35;
  color: var(--lm-ink);
  margin: 30px 0 4px;
  padding-top: 18px;
  border-top: 1px solid var(--lm-border);
}
.step-body > .q-heading:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.q-text {
  display: block;
  font-size: 18px; font-weight: 600; line-height: 1.4;
  color: var(--lm-ink);
  margin: 0 0 14px;
  padding: 0;
}
.q-sub { font-size: 17px; font-weight: 500; }
.hint { font-size: 15px; color: var(--lm-muted); margin: -4px 0 10px; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

.input {
  font: inherit;
  font-size: 16px;
  color: var(--lm-ink);
  background: var(--lm-surface);
  border: 2px solid var(--lm-border);
  border-radius: var(--lm-radius);
  min-height: var(--lm-tap);
  padding: 10px 12px;
  width: 100%;
}
.input:hover { border-color: #b9b3d3; }
.input:focus { border-color: var(--lm-purple-dark); outline: 3px solid var(--lm-purple-tint); outline-offset: 0; }
.input-number { width: 6.5em; text-align: right; font-variant-numeric: tabular-nums; }
.textarea { resize: vertical; min-height: 9em; line-height: 1.5; }
.counter { font-size: 14px; color: var(--lm-muted); margin: 4px 0 0; text-align: right; min-height: 0; }
.counter:empty { display: none; }

.input-wrap, .inline-input { display: inline-flex; align-items: center; gap: 8px; }
.suffix { color: var(--lm-text); font-size: 16px; }

.q-inline { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 8px; }
.q-inline .q-text { margin: 0; }
.q-inline .suffix { font-size: 18px; font-weight: 600; color: var(--lm-ink); }

.pct-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0;
}
.pct-label { font-size: 17px; color: var(--lm-ink); }
.q-group-q11 + .q-group-q11 { margin-top: 4px; }
.qt-percent .input-number { width: 5em; }
.pct-total { margin-top: 10px !important; }
.pct-sum {
  margin: 0; padding: 10px 0 0; border-top: 2px solid var(--lm-ink);
  font-weight: 700; color: var(--lm-ink); text-align: right;
}
.pct-sum .check { color: var(--lm-purple-dark); }

/* Choice controls */
.choice-grid { display: grid; gap: 8px; }
.choices-yesno .choice-grid { grid-template-columns: 1fr 1fr; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.choice-box {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--lm-tap);
  padding: 10px 44px 10px 14px;
  border: 2px solid var(--lm-border);
  border-radius: var(--lm-radius);
  background: var(--lm-surface);
  color: var(--lm-ink);
  font-size: 16px;
  line-height: 1.3;
  position: relative;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.choice:hover .choice-box { border-color: #b9b3d3; }
.choice input:checked + .choice-box {
  background: var(--lm-purple-tint);
  border-color: var(--lm-purple);
  font-weight: 500;
}
.choice input:checked + .choice-box::after {
  content: "";
  position: absolute; right: 16px; top: 50%;
  width: 7px; height: 13px;
  margin-top: -9px;
  border: solid var(--lm-purple-dark);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.choice input:focus-visible + .choice-box { outline: 3px solid var(--lm-purple-dark); outline-offset: 2px; }
.opt-num { font-weight: 700; color: var(--lm-purple-dark); }
.opt-sep { margin-left: -6px; margin-right: -6px; }

.choice-extras { margin-top: 8px; }
.choice-extra .choice-box {
  border-style: dashed;
  color: var(--lm-muted);
  background: transparent;
  font-size: 15px;
}

.choice-with-other { display: grid; gap: 8px; }
.other-field { padding-left: 14px; border-left: 3px solid var(--lm-purple-tint); }
.q-other { margin: 0 !important; }

.qt-likert, .qt-severity {
  border: 1px solid var(--lm-border);
  padding: 14px;
  background: var(--lm-surface);
}
.qt-likert .q-text { font-size: 17px; }

.choices-grade .choice-grid { grid-template-columns: repeat(5, 1fr); }
.choices-grade .choice-box { justify-content: center; padding: 10px 6px; font-weight: 700; font-size: 18px; }
.choices-grade input:checked + .choice-box::after { display: none; }
.choices-grade input:checked + .choice-box { background: var(--lm-purple); color: #fff; border-color: var(--lm-purple); }
.grade-hints { display: flex; justify-content: space-between; font-size: 14px; color: var(--lm-muted); margin-top: 6px; }

/* Messages */
.field-error, .field-warning { margin: 6px 0 0; font-size: 15px; }
.field-error:empty, .field-warning:empty { display: none; }
.field-error { color: var(--lm-error); font-weight: 500; }
.field-error::before { content: "! "; font-weight: 700; }
.field-warning {
  color: var(--lm-warning);
  background: var(--lm-warning-bg);
  padding: 8px 12px;
  border-left: 4px solid var(--lm-warning);
}
.has-error .choice-box, .has-error .input { border-color: var(--lm-error); }

.notice {
  padding: 12px 14px;
  background: var(--lm-lavender);
  border-left: 4px solid var(--lm-purple);
  color: var(--lm-ink);
  margin: 0 0 18px;
}
.notice-error { border-left-color: var(--lm-error); }
.notice-route { background: var(--lm-warning-bg); border-left-color: var(--lm-warning); color: var(--lm-warning); }
#submit-status { margin-top: 18px; border-left-color: var(--lm-error); }

.reveal { animation: reveal 0.35s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.turnstile { margin-top: 18px; }
.turnstile:empty { margin: 0; }

/* Step navigation (fixed to the bottom, thumb zone) ----------------------- */

body[data-screen="step"] main { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.step-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--lm-border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.step-nav-inner {
  max-width: var(--lm-maxw); margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr; gap: 12px;
}
.step-nav .btn-secondary .btn-label { padding: 0 14px; }

/* Thanks ------------------------------------------------------------------ */

.thanks-card { text-align: left; }
.thanks-logo { display: block; width: 160px; height: auto; margin: 0 0 18px; }
.colofon { font-size: 14px; color: var(--lm-muted); margin-top: 24px; }
.colofon strong, .colofon em { color: var(--lm-muted); }

/* Prose (privacy) --------------------------------------------------------- */

.prose h2 { font-size: 18px; font-weight: 700; color: var(--lm-ink); margin: 26px 0 6px; }
.prose p { margin: 0 0 12px; }
.todo { background: var(--lm-warning-bg); color: var(--lm-warning); font-weight: 500; padding: 0 4px; }

/* Admin ------------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 20px; }
.stats div { background: var(--lm-lavender); padding: 12px; }
.stats dt { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--lm-muted); text-transform: uppercase; }
.stats dd { margin: 2px 0 0; font-size: 28px; font-weight: 700; color: var(--lm-purple-dark); }
.downloads { display: grid; gap: 10px; margin: 20px 0; }

/* Footer ------------------------------------------------------------------ */

.footer-band { background: var(--lm-purple); color: #fff; padding: 22px 20px; }
.footer-inner { max-width: var(--lm-maxw); margin: 0 auto; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.footer-brand { color: #fff; font-size: 18px; }
.footer-band a { color: #fff; }
.footer-bar {
  background: var(--lm-black); color: #fff;
  font-size: 13px;
  padding: 10px 20px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 16px;
}
.footer-bar a, .footer-bar .link-button { color: #fff; font-size: 13px; }
body[data-screen="step"] .footer-bar { justify-content: center; }

/* Wider screens ----------------------------------------------------------- */

@media (min-width: 600px) {
  .step-title { font-size: 32px; }
  .card { padding: 36px 40px 40px; }
  .hero, .section { padding: 48px 24px 64px; }
  .hero { padding-bottom: 140px; }
  .site-header { padding: 12px 32px; }
  .site-tag { font-size: 13px; }

  .choices-scale .choice-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .choices-scale .choice:not(.choice-extra) .choice-box {
    flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 10px 6px; text-align: center; height: 100%;
  }
  .choices-scale .opt-sep { display: none; }
  .choices-scale .choice:not(.choice-extra) .opt-num { font-size: 22px; line-height: 1.1; }
  .choices-scale .choice:not(.choice-extra) .opt-label { font-size: 12.5px; line-height: 1.25; color: var(--lm-text); hyphens: auto; }
  .choices-scale .choice:not(.choice-extra) input:checked + .choice-box::after { display: none; }
  .choices-scale .choice input:checked + .choice-box { background: var(--lm-purple-tint); }
  .choices-scale .choice-extras .choice { display: inline-block; }

  .choices-grade .choice-grid { grid-template-columns: repeat(10, 1fr); gap: 6px; }

  .downloads { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .footer-inner { flex-direction: row; justify-content: space-between; }

  .qt-likert, .qt-severity { padding: 18px; }
}

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