:root {
  color-scheme: light;
  --bg: #f7f3ff;
  --surface: #ffffff;
  --surface-strong: #eef3ff;
  --text: #172033;
  --muted: #5c667a;
  --primary: #5b3df5;
  --primary-dark: #3720a8;
  --accent: #00a88f;
  --accent-soft: #e6fbf6;
  --warning-soft: #fff7ed;
  --border: #ddd7ef;
  --danger: #b42318;
  --success: #137a3a;
  --focus: #ffbf47;
  --shadow: 0 24px 70px rgba(45, 31, 96, 0.14);
  --shadow-soft: 0 10px 24px rgba(45, 31, 96, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, rgba(91, 61, 245, 0.2), transparent 26rem),
    radial-gradient(circle at 85% 12%, rgba(0, 168, 143, 0.16), transparent 28rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(238, 243, 255, 0.72)),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 10;
  transform: translateY(-200%);
  border-radius: 999px;
  background: var(--text);
  color: white;
  padding: 0.75rem 1rem;
}

.skip-link:focus {
  transform: translateY(0);
}

.hero,
main {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 1rem;
}

.hero {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
}

.hero h1 {
  margin: 0.2rem 0 0.75rem;
  max-width: 15ch;
  font-size: clamp(2rem, 7vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero p {
  max-width: 60rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-card,
.panel,
.progress-card {
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.2rem;
  align-content: center;
  min-height: 7rem;
  padding: 1.25rem;
}

.hero-card::after {
  position: absolute;
  right: -2rem;
  top: -2rem;
  width: 6rem;
  height: 6rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0, 168, 143, 0.25), transparent 70%);
  content: "";
}

.hero-card strong {
  color: var(--primary-dark);
  font-size: 1.7rem;
}

.hero-card span,
.eyebrow,
.hint,
.form-note,
.error {
  color: var(--muted);
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--primary-dark);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-card,
.panel {
  padding: 1rem;
}

.progress-card {
  margin-bottom: 1rem;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.progress-track {
  overflow: hidden;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 260ms ease;
}

.section-heading {
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  line-height: 1.1;
}

.section-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.questions {
  display: grid;
  gap: 1rem;
}

.question {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 251, 255, 0.96)),
    var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.question:focus-within {
  border-color: rgba(91, 61, 245, 0.45);
  box-shadow: 0 0 0 4px rgba(91, 61, 245, 0.1), var(--shadow-soft);
  transform: translateY(-1px);
}

.question-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.question-type,
.required-badge,
.optional-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.question-type {
  background: var(--surface-strong);
  color: var(--primary-dark);
}

.required-badge {
  background: #fff1f1;
  color: #9f1239;
}

.optional-badge {
  background: var(--accent-soft);
  color: #006b5e;
}

.question legend {
  width: auto;
  margin-bottom: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
}

.question-error {
  border-color: rgba(180, 35, 24, 0.6);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08);
}

.error {
  min-height: 1.4rem;
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-weight: 700;
}

.option-list,
.ranking,
.budget,
.matrix,
.semantic {
  display: grid;
  gap: 0.75rem;
}

.option,
.ranking-row,
.budget label {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  min-height: 3.2rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.8rem;
  background: #fbfcff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.option:hover,
.ranking-row:hover,
.budget label:hover {
  border-color: rgba(91, 61, 245, 0.45);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.option:has(input:checked) {
  border-color: rgba(91, 61, 245, 0.75);
  background: linear-gradient(135deg, rgba(91, 61, 245, 0.12), rgba(0, 168, 143, 0.1));
  box-shadow: 0 0 0 3px rgba(91, 61, 245, 0.1), var(--shadow-soft);
}

.option:has(input:checked)::after {
  display: grid;
  place-items: center;
  justify-self: end;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  content: "✓";
  font-weight: 900;
}

.option input[type="radio"],
.option input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--primary);
}

.other-option {
  grid-template-columns: auto auto 1fr;
}

.other-choice {
  display: contents;
  cursor: pointer;
}

.text-input,
textarea,
select,
.budget input {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.7rem 0.8rem;
  background: white;
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.text-input:hover,
textarea:hover,
select:hover,
.budget input:hover {
  border-color: rgba(91, 61, 245, 0.42);
}

.text-input:focus,
textarea:focus,
select:focus,
.budget input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91, 61, 245, 0.1);
}

textarea {
  resize: vertical;
}

.scale-labels,
.semantic-row {
  display: grid;
  gap: 0.5rem;
}

.scale-labels {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0.75rem;
  color: var(--muted);
}

.scale-labels span:last-child {
  text-align: right;
}

.scale-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(2.75rem, 1fr));
  gap: 0.45rem;
}

.scale-options label {
  display: grid;
  place-items: center;
}

.scale-options input {
  position: absolute;
  opacity: 0;
}

.scale-options span {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 3.25rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #fbfcff;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.scale-options label:hover span {
  border-color: rgba(91, 61, 245, 0.5);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.scale-options input:checked + span {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  box-shadow: 0 10px 22px rgba(91, 61, 245, 0.24);
}

.matrix-row,
.semantic-row {
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  background: linear-gradient(180deg, #fbfcff, #ffffff);
}

.matrix-row p {
  margin: 0 0 0.75rem;
  font-weight: 750;
}

.matrix-options {
  display: grid;
  gap: 0.5rem;
}

.matrix-options label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: center;
  min-height: 2.5rem;
  border-radius: 0.8rem;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  transition: background 160ms ease;
}

.matrix-options label:hover,
.matrix-options label:has(input:checked) {
  background: var(--surface-strong);
}

.semantic-row {
  grid-template-columns: 1fr;
}

.semantic-row > span {
  font-weight: 750;
}

.compact {
  width: 100%;
}

.ranking-row {
  grid-template-columns: 1fr minmax(8rem, 12rem);
}

.ranking-preview,
.ranking-empty {
  margin: 0;
  border-radius: 1rem;
  padding: 0.9rem 1rem;
}

.ranking-preview {
  display: grid;
  gap: 0.5rem;
  padding-left: 2.25rem;
  background: linear-gradient(135deg, var(--accent-soft), rgba(91, 61, 245, 0.08));
  color: #075e54;
  font-weight: 800;
}

.ranking-empty {
  background: var(--surface-strong);
  color: var(--muted);
}

.budget label {
  grid-template-columns: 1fr 7rem;
}

.budget-meter {
  display: grid;
  gap: 0.65rem;
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: var(--warning-soft);
  color: #9a3412;
  font-weight: 800;
}

.budget-meter.ok {
  background: #ecfdf3;
  color: var(--success);
}

.budget-meter-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.budget-track {
  overflow: hidden;
  height: 0.7rem;
  border-radius: 999px;
  background: rgba(154, 52, 18, 0.14);
}

.budget-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fb923c, var(--accent));
  transition: width 220ms ease;
}

.budget-meter.ok .budget-track {
  background: rgba(19, 122, 58, 0.14);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  border-radius: 0 0 1rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  padding: 0.85rem 0 0;
  backdrop-filter: blur(10px);
}

.button {
  min-height: 3rem;
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.1rem;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(91, 61, 245, 0.22);
  transition:
    box-shadow 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.button:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 14px 28px rgba(91, 61, 245, 0.26);
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-secondary {
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  box-shadow: none;
}

.button-secondary:hover,
.button-ghost:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.button-ghost {
  background: transparent;
  color: var(--primary-dark);
  box-shadow: none;
}

.summary-grid {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}

.summary-grid article {
  display: grid;
  gap: 0.2rem;
  border-radius: 1rem;
  background: var(--surface-strong);
  padding: 1rem;
}

.summary-grid strong {
  color: var(--primary-dark);
  font-size: 2rem;
}

details {
  margin-top: 1rem;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

pre {
  overflow: auto;
  max-height: 24rem;
  border-radius: 1rem;
  background: #101828;
  color: #f8fafc;
  padding: 1rem;
  font-size: 0.85rem;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel {
  animation: panel-in 260ms ease both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (min-width: 760px) {
  .hero,
  main {
    padding: 1.5rem 2rem;
  }

  .hero {
    grid-template-columns: 1fr 18rem;
    align-items: end;
  }

  .panel,
  .progress-card {
    padding: 1.5rem;
  }

  .form-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .semantic-row {
    grid-template-columns: minmax(8rem, 1fr) 2fr minmax(8rem, 1fr);
    align-items: center;
  }
}

@media (min-width: 1024px) {
  .matrix-options {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* UX polish layer: mobile-first response patterns and stronger WCAG states. */
:root {
  --surface-muted: #f8f9ff;
  --surface-tint: #f4f1ff;
  --ring: rgba(91, 61, 245, 0.18);
  --danger-soft: #fff1f1;
}

html {
  scroll-padding-top: 1rem;
}

body {
  min-height: 100vh;
}

.hero,
main {
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.hero {
  align-items: stretch;
  min-height: auto;
  padding-top: clamp(1rem, 4vw, 3rem);
  padding-bottom: 0.75rem;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 1rem;
}

.hero h1 {
  max-width: 12ch;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero-points li,
.progress-percent,
.section-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border: 1px solid rgba(91, 61, 245, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--primary-dark);
  padding: 0.3rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 800;
}

.hero-actions {
  display: grid;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.25rem;
}

.hero-actions span,
.progress-caption,
.scale-helper,
.matrix-helper,
.budget-meter p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.hero-cta {
  width: 100%;
}

.hero-card {
  align-self: center;
  min-height: auto;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(238, 243, 255, 0.88)),
    var(--surface);
}

.hero-card-label {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.progress-card {
  position: sticky;
  top: 0.5rem;
  z-index: 2;
  box-shadow: var(--shadow-soft);
}

.progress-row strong {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.progress-percent {
  min-height: 1.7rem;
  background: var(--accent-soft);
  color: #006b5e;
}

.progress-track,
.budget-track {
  outline: 1px solid rgba(23, 32, 51, 0.04);
}

.progress-caption {
  margin-top: 0.55rem;
}

.section-heading {
  display: grid;
  gap: 0.75rem;
}

.section-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-summary span:last-child {
  background: var(--accent-soft);
  color: #006b5e;
}

.question {
  scroll-margin: 1rem;
}

.question legend {
  max-width: 62rem;
  font-size: clamp(1.04rem, 2vw, 1.22rem);
}

.question-topline {
  align-items: center;
}

.hint {
  max-width: 65ch;
}

.option-list {
  grid-template-columns: 1fr;
}

.option {
  grid-template-columns: auto 1fr;
  align-items: start;
  min-height: 3.5rem;
  padding: 0.9rem;
}

.option input[type="radio"],
.option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-marker {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  border: 2px solid #9a8fd0;
  background: white;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.option-list-radio .option-marker {
  border-radius: 999px;
}

.option-list-checkbox .option-marker {
  border-radius: 0.45rem;
}

.option-content {
  align-self: center;
  font-weight: 720;
  line-height: 1.35;
}

.option:has(input:checked)::after {
  display: none;
  content: none;
}

.option:has(input:checked) .option-marker {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}

.option-list-radio .option:has(input:checked) .option-marker::after {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: white;
  content: "";
}

.option-list-checkbox .option:has(input:checked) .option-marker::after {
  color: white;
  content: "✓";
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
}

.option:has(input:focus-visible),
.ranking-row:has(select:focus-visible),
.budget label:has(input:focus-visible),
.matrix-options label:has(input:focus-visible),
.scale-options label:has(input:focus-visible) span {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.other-option {
  grid-template-columns: auto auto minmax(0, 1fr);
}

.other-option .text-input {
  grid-column: 1 / -1;
}

.scale-control {
  display: grid;
  gap: 0.65rem;
}

.scale-labels {
  gap: 1rem;
  font-weight: 750;
}

.scale-options {
  grid-template-columns: repeat(5, minmax(2.75rem, 1fr));
  padding: 0.15rem;
  border-radius: 1.15rem;
  background: linear-gradient(90deg, rgba(180, 35, 24, 0.08), rgba(0, 168, 143, 0.12));
}

.scale-options span {
  min-height: 3.45rem;
  background: rgba(255, 255, 255, 0.92);
}

.matrix,
.semantic {
  gap: 0.9rem;
}

.matrix-helper {
  border-radius: 1rem;
  background: var(--surface-strong);
  padding: 0.85rem 1rem;
}

.matrix-row,
.semantic-row {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.matrix-row p {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  line-height: 1.35;
}

.matrix-row p span {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-weight: 900;
}

.matrix-options {
  grid-template-columns: 1fr;
}

.matrix-options label {
  min-height: 3rem;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.72);
}

.matrix-options input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
}

.matrix-options label:has(input:checked) {
  border-color: rgba(91, 61, 245, 0.35);
  background: var(--surface-tint);
  color: var(--primary-dark);
  font-weight: 800;
}

.semantic-row {
  gap: 0.8rem;
}

.semantic-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  font-weight: 800;
}

.semantic-labels span:last-child {
  text-align: right;
}

.ranking-panel {
  display: grid;
  gap: 0.75rem;
  border: 1px solid rgba(0, 168, 143, 0.22);
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--accent-soft), rgba(91, 61, 245, 0.08));
  padding: 0.9rem;
}

.ranking-preview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  padding: 0;
  background: transparent;
  color: var(--text);
  list-style: none;
}

.ranking-preview li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
  min-height: 2.4rem;
  border: 1px dashed rgba(7, 94, 84, 0.28);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.62);
  padding: 0.45rem 0.6rem;
  color: var(--muted);
  font-weight: 700;
}

.ranking-preview li span {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: white;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.ranking-preview li.filled {
  border-style: solid;
  border-color: rgba(0, 168, 143, 0.3);
  color: #075e54;
}

.ranking-row {
  grid-template-columns: 1fr;
}

.ranking-row.is-ranked {
  border-color: rgba(0, 168, 143, 0.42);
  background: var(--accent-soft);
}

.ranking-row > span {
  font-weight: 760;
}

.budget {
  gap: 0.85rem;
}

.budget label {
  grid-template-columns: 1fr;
  cursor: default;
}

.budget label > span {
  font-weight: 760;
}

.budget input {
  max-width: 12rem;
  justify-self: stretch;
  font-weight: 800;
}

.budget-meter {
  order: -1;
  border: 1px solid rgba(154, 52, 18, 0.18);
}

.budget-meter.over {
  border-color: rgba(180, 35, 24, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.budget-meter.ok {
  border-color: rgba(19, 122, 58, 0.22);
}

.budget-meter-top {
  flex-wrap: wrap;
}

.budget-meter.over .budget-track {
  background: rgba(180, 35, 24, 0.16);
}

.budget-meter.over .budget-track span {
  background: linear-gradient(90deg, #ef4444, #b42318);
}

.textarea-control {
  display: grid;
  gap: 0.55rem;
  max-width: 52rem;
}

textarea {
  min-height: 9rem;
  line-height: 1.55;
}

.textarea-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: space-between;
}

.char-count {
  color: var(--primary-dark);
}

.summary .section-heading {
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--accent-soft), rgba(91, 61, 245, 0.08));
  padding: 1rem;
}

details {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface-muted);
  padding: 0.85rem 1rem;
}

summary {
  min-height: 2.75rem;
  align-content: center;
}

pre {
  max-width: 100%;
}

@media (min-width: 560px) {
  .hero-actions {
    grid-template-columns: max-content 1fr;
  }

  .hero-cta {
    width: auto;
  }

  .option-list-checkbox {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ranking-row,
  .budget label {
    grid-template-columns: 1fr minmax(9rem, 13rem);
    align-items: center;
  }

  .other-option .text-input {
    grid-column: auto;
  }
}

@media (min-width: 760px) {
  .hero {
    min-height: auto;
  }

  .progress-card {
    top: 0.75rem;
  }

  .option-list-radio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ranking-preview {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .ranking-preview li {
    align-content: start;
    grid-template-columns: 1fr;
  }

  .budget input {
    justify-self: end;
  }

  .semantic-row {
    grid-template-columns: minmax(10rem, 1fr) minmax(18rem, 2fr);
    align-items: center;
  }

  .semantic-labels {
    grid-template-columns: 1fr;
  }

  .semantic-labels span:last-child {
    text-align: left;
  }
}

@media (min-width: 1024px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 20rem;
  }

  .option-list-checkbox {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .matrix-options {
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  }
}

/* Research formats inspired by Likert, MaxDiff and semantic distance scales. */
.matrix-column-heads {
  display: none;
}

.matrix-frequency .matrix-helper {
  background: linear-gradient(135deg, var(--surface-strong), var(--accent-soft));
}

.scale-options {
  grid-template-columns: repeat(auto-fit, minmax(2.55rem, 1fr));
}

.semantic-scale-heads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  border-radius: 1rem;
  background: var(--surface-strong);
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-weight: 850;
}

.semantic-scale-heads span:last-child {
  text-align: right;
}

.semantic-distance .semantic-row {
  background:
    linear-gradient(90deg, rgba(180, 35, 24, 0.05), rgba(0, 168, 143, 0.08)),
    #ffffff;
}

.semantic-distance .compact {
  grid-template-columns: repeat(auto-fit, minmax(2.35rem, 1fr));
}

.maxdiff {
  display: grid;
  gap: 0.85rem;
}

.maxdiff-status {
  display: grid;
  gap: 0.5rem;
  border: 1px solid rgba(91, 61, 245, 0.16);
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--surface-strong), rgba(255, 255, 255, 0.88));
  padding: 0.85rem 1rem;
  color: var(--primary-dark);
  font-weight: 850;
}

.maxdiff-grid {
  display: grid;
  grid-template-columns: minmax(4.75rem, 0.8fr) minmax(0, 1.6fr) minmax(4.75rem, 0.8fr);
  gap: 0.45rem;
  align-items: stretch;
}

.maxdiff-head {
  display: grid;
  place-items: center;
  min-height: 2.8rem;
  border-radius: 0.85rem;
  background: var(--surface-strong);
  color: var(--primary-dark);
  padding: 0.45rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.feature-head {
  background: var(--accent-soft);
  color: #006b5e;
}

.maxdiff-feature,
.maxdiff-choice {
  min-height: 3.4rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.maxdiff-feature {
  display: grid;
  align-items: center;
  border-radius: 0.9rem;
  padding: 0.75rem;
  font-weight: 800;
  line-height: 1.3;
}

.maxdiff-choice {
  display: grid;
  place-items: center;
  border-radius: 0.9rem;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.maxdiff-choice:hover {
  border-color: rgba(91, 61, 245, 0.45);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.maxdiff-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.maxdiff-choice span {
  display: grid;
  place-items: center;
  width: min(100%, 6.6rem);
  min-height: 2.25rem;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 0.35rem 0.55rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.maxdiff-least.is-selected {
  border-color: rgba(180, 35, 24, 0.38);
  background: var(--danger-soft);
}

.maxdiff-most.is-selected {
  border-color: rgba(19, 122, 58, 0.34);
  background: #ecfdf3;
}

.maxdiff-least.is-selected span {
  background: #fee2e2;
  color: var(--danger);
}

.maxdiff-most.is-selected span {
  background: #dcfce7;
  color: var(--success);
}

.maxdiff-choice:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.46;
}

.maxdiff-choice:has(input:focus-visible) {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 479px) {
  .maxdiff-grid {
    grid-template-columns: 1fr 1fr;
  }

  .maxdiff-head {
    display: none;
  }

  .maxdiff-feature {
    grid-column: 1 / -1;
    min-height: auto;
    margin-top: 0.35rem;
  }

  .maxdiff-least {
    grid-column: 1;
  }

  .maxdiff-most {
    grid-column: 2;
  }
}

@media (min-width: 760px) {
  .scale-options {
    grid-template-columns: repeat(var(--scale-count, 5), minmax(2.55rem, 1fr));
  }

  .matrix {
    gap: 0.55rem;
  }

  .matrix-column-heads {
    display: grid;
    grid-template-columns: minmax(14rem, 1.35fr) repeat(var(--matrix-columns, 5), minmax(6rem, 1fr));
    gap: 0.35rem;
    align-items: stretch;
  }

  .matrix-column-heads span {
    display: grid;
    place-items: center;
    min-height: 3rem;
    border-radius: 0.75rem;
    background: var(--surface-strong);
    color: var(--primary-dark);
    padding: 0.45rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1.2;
  }

  .matrix-row {
    display: grid;
    grid-template-columns: minmax(14rem, 1.35fr) minmax(0, 5fr);
    gap: 0.35rem;
    align-items: stretch;
    padding: 0;
    overflow: hidden;
  }

  .matrix-row p {
    align-items: center;
    margin: 0;
    background: rgba(255, 255, 255, 0.72);
    padding: 0.85rem;
  }

  .matrix-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
    gap: 0.35rem;
    padding: 0.45rem;
  }

  .matrix-options label {
    grid-template-columns: 1fr;
    place-items: center;
    text-align: center;
  }

  .matrix-options label span {
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .maxdiff-status {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1120px) {
  .matrix-options label span {
    font-size: 0.86rem;
  }
}

@media (max-width: 479px) {
  .maxdiff-grid {
    grid-template-columns: minmax(4.2rem, 0.8fr) minmax(0, 1.5fr) minmax(4.2rem, 0.8fr);
  }

  .maxdiff-head {
    display: grid;
    font-size: 0.7rem;
  }

  .maxdiff-feature {
    grid-column: auto;
    margin-top: 0;
    padding-inline: 0.55rem;
    font-size: 0.9rem;
  }

  .maxdiff-choice span {
    min-height: 2rem;
    padding-inline: 0.35rem;
    font-size: 0.68rem;
  }
}
