:root {
  color-scheme: light;

  /* Brand palette */
  --brand-green: #7daa43;
  --brand-teal: #246e63;
  --brand-dark: #262626;
  --brand-plum: #332b36;
  --brand-slate: #4b4a58;
  --brand-gray-mid: #626362;
  --brand-gray: #939598;
  --brand-gray-light: #d1d2d4;

  /* Scale gradient: gray (1) -> green (5), derived from brand-gray + brand-green */
  --scale-1: #939598;
  --scale-2: #8e9a83;
  --scale-3: #88a06e;
  --scale-4: #83a558;
  --scale-5: #7daa43;

  --scale-tint-1: #dfdfe0;
  --scale-tint-2: #dde1da;
  --scale-tint-3: #dbe3d4;
  --scale-tint-4: #dae4cd;
  --scale-tint-5: #d8e6c7;

  --bg: #eef0ee;
  --card: #ffffff;
  --text: #262626;
  --muted: #626362;
  --border: #e1e3e0;
  --error: #a3382f;
  --error-bg: #fbeceb;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-plum) 100%);
  color: #fff;
  padding: 18px 16px;
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.hero-logo {
  height: 46px;
  width: auto;
  flex-shrink: 0;
}

.hero-text h1 {
  font-size: 1.25rem;
  margin: 0 0 3px;
  font-weight: 700;
  line-height: 1.25;
}

.hero-text p {
  margin: 0;
  color: #cfd3d6;
  font-size: 0.85rem;
}

/* ---------- Sticky progress ---------- */

.progress-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.progress-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--brand-gray-light);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-teal), var(--brand-green));
  transition: width 0.25s ease;
}

.progress-label {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 600;
}

/* ---------- Side tracker (wide screens only) ---------- */

.side-tracker {
  display: none;
  position: fixed;
  top: 50%;
  right: 22px;
  transform: translateY(-50%);
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 20;
}

.side-tracker::before {
  content: "";
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 50%;
  width: 2px;
  background: var(--brand-gray-light);
  transform: translateX(-50%);
  z-index: -1;
}

.side-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-gray-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(38, 38, 38, 0.1);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.side-dot:hover {
  border-color: var(--brand-teal);
  transform: scale(1.12);
}

.side-dot.is-done {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: var(--brand-dark);
}

.side-dot.pulse {
  animation: side-dot-pulse 0.5s ease-out;
}

@keyframes side-dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(125, 170, 67, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(125, 170, 67, 0); }
  100% { box-shadow: 0 0 0 0 rgba(125, 170, 67, 0); }
}

@media (min-width: 900px) {
  .side-tracker {
    display: flex;
  }
}

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

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.04);
}

.instructions {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-teal);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.instructions h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--brand-teal);
}

.instructions ul {
  margin: 0;
  padding-left: 20px;
}

.error-banner {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-weight: 600;
}

/* ---------- Scale legend ---------- */

.scale-legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.scale-chip {
  border-radius: 10px;
  padding: 10px 10px;
  font-size: 0.78rem;
  color: var(--text);
}

@media (max-width: 620px) {
  .scale-legend {
    grid-template-columns: repeat(2, 1fr);
  }
}

.scale-chip strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

/* ---------- Fields ---------- */

.field {
  margin-bottom: 18px;
}

.field label,
.field legend {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type="text"]:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(36, 110, 99, 0.15);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 4px;
  font-weight: 600;
}

.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(36, 110, 99, 0.15);
}

.repeat-warning {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 9px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--brand-slate);
}

/* ---------- Category cards ---------- */

.category {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--brand-teal);
  border-radius: var(--radius);
  margin: 0 0 18px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(38, 38, 38, 0.04);
  scroll-margin-top: 72px;
}

.category.accent-teal { border-left-color: var(--brand-teal); }
.category.accent-green { border-left-color: var(--brand-green); }
.category.accent-slate { border-left-color: var(--brand-slate); }

.category legend {
  font-size: 1.1rem;
  padding: 0;
  display: block;
  width: 100%;
}

.category .cat-index {
  display: inline-block;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.category details {
  margin: 4px 0 16px;
}

.category summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand-teal);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.category summary::-webkit-details-marker {
  display: none;
}

.category summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s ease;
  font-size: 0.7rem;
}

.category details[open] summary::before {
  transform: rotate(90deg);
}

.category .points {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 10px 0 0;
  padding-left: 20px;
}

.category .points li {
  margin-bottom: 3px;
}

/* ---------- Score scale buttons ---------- */

.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

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

.scale label {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.scale label .num {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.scale label:nth-child(2) { background: var(--scale-tint-1); }
.scale label:nth-child(4) { background: var(--scale-tint-2); }
.scale label:nth-child(6) { background: var(--scale-tint-3); }
.scale label:nth-child(8) { background: var(--scale-tint-4); }
.scale label:nth-child(10) { background: var(--scale-tint-5); }

.scale label:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(38, 38, 38, 0.1);
}

.scale input:checked + label {
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(38, 38, 38, 0.18);
}

.scale input:nth-of-type(1):checked + label { background: var(--scale-1); }
.scale input:nth-of-type(2):checked + label { background: var(--scale-2); }
.scale input:nth-of-type(3):checked + label { background: var(--scale-3); }
.scale input:nth-of-type(4):checked + label { background: var(--scale-4); }
.scale input:nth-of-type(5):checked + label { background: var(--scale-5); }

.scale label::after {
  content: "";
}

.scale input:checked + label::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 7px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text);
}

.scale label:focus-within {
  outline: 2px solid var(--brand-teal);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .scale label {
    padding: 9px 3px;
    font-size: 0.68rem;
  }
  .scale label .num {
    font-size: 1rem;
  }
}

/* ---------- Honeypot ---------- */

.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

/* ---------- Submit ---------- */

.submit-bar {
  position: sticky;
  bottom: 0;
  padding: 14px 0 0;
  margin-top: 4px;
  background: linear-gradient(180deg, rgba(238, 240, 238, 0) 0%, var(--bg) 35%);
}

button.submit {
  background: var(--brand-teal);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 15px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(36, 110, 99, 0.3);
  transition: background 0.15s ease, transform 0.1s ease;
}

button.submit:hover {
  background: #1c5850;
}

button.submit:active {
  transform: translateY(1px);
}

button.submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

button.submit .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: submit-spin 0.7s linear infinite;
}

button.submit.is-loading .spinner {
  display: inline-block;
}

@keyframes submit-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Thank you / closed ---------- */

.thank-you {
  text-align: center;
  padding: 52px 24px;
}

.thank-you .icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-green);
  color: var(--brand-dark);
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.thank-you h1 {
  margin-bottom: 8px;
}

.thank-you p {
  color: var(--muted);
}

.button-link {
  display: inline-block;
  background: var(--brand-teal);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 10px;
  margin-top: 8px;
  transition: background 0.15s ease;
}

.button-link:hover {
  background: #1c5850;
}

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

footer.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 32px;
}
