:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e2e5e9;
  --text: #33383d;
  --muted: #6b8a99;
  --hint: #7d94a1;
  --accent: #2f6f8f;
  --accent-dark: #245a75;
  --dot: #7a8794;
  --dot-fill: #2b2f33;
  --zebra: #f7f8fa;
  --error: #c0392b;
  --error-bg: #fdecea;
  --req: #c0392b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.5;
  font-size: 16px;
}

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

h1 {
  font-size: 1.6rem;
  font-weight: 400;
  margin: 8px 0 20px;
}
h1 strong {
  font-weight: 700;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 12px;
}

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

.hint {
  color: var(--hint);
  margin: 0 0 12px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.req {
  color: var(--req);
  margin-left: 2px;
}

.required-note {
  color: var(--hint);
  font-size: 0.85rem;
  margin: 16px 0 0;
}

/* ---------- Diferencial semântico ---------- */
.pairs {
  margin-top: 8px;
}

.scale-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  margin: 0;
  padding: 10px 8px;
  border-radius: 4px;
}
.pairs .scale-row:nth-child(odd) {
  background: var(--zebra);
}

.pole {
  flex: 0 0 22%;
  color: var(--text);
  font-size: 0.95rem;
}
.pole-left {
  text-align: right;
}
.pole-right {
  text-align: left;
}

.scale {
  flex: 1 1 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

/* Esconde o input nativo, mantém acessível/focável */
.scale input[type="radio"],
.likert input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.dot {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--dot);
  border-radius: 50%;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  flex: 0 0 auto;
}
.dot:hover {
  border-color: var(--accent);
}
.scale input[type="radio"]:checked + .dot {
  border-color: var(--dot-fill);
  background:
    radial-gradient(circle, var(--dot-fill) 0 45%, #fff 46% 100%);
}
.scale input[type="radio"]:focus-visible + .dot {
  box-shadow: 0 0 0 3px rgba(47, 111, 143, 0.35);
}

/* Exemplo estático da introdução */
.example {
  margin: 8px 0 16px;
}
.scale-row.is-example .dot.is-on {
  border-color: var(--dot-fill);
  background: radial-gradient(circle, var(--dot-fill) 0 45%, #fff 46% 100%);
}

/* ---------- Perguntas de experiência ---------- */
.questions {
  margin-top: 8px;
}
.question {
  padding: 14px 8px;
  border-radius: 4px;
}
.question + .question {
  border-top: 1px solid var(--border);
}
.q-text {
  color: var(--muted);
  margin: 0 0 10px;
}

.likert {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.likert-option {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  transition: all 0.12s ease;
  user-select: none;
}
.likert-option:hover {
  border-color: var(--accent);
}
.likert input[type="radio"]:checked + .likert-option {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.likert input[type="radio"]:focus-visible + .likert-option {
  box-shadow: 0 0 0 3px rgba(47, 111, 143, 0.35);
}

.open-answer {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  resize: vertical;
  min-height: 90px;
}
.open-answer:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 143, 0.18);
}

/* ---------- Erros ---------- */
.has-error {
  background: var(--error-bg) !important;
  outline: 1px solid var(--error);
}
.error-summary {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* ---------- Ações ---------- */
.actions {
  display: flex;
  justify-content: flex-end;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 12px 28px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.12s ease;
}
.btn-primary:hover {
  background: var(--accent-dark);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.thanks h2 {
  color: var(--accent);
}

/* Facilita a rolagem até um item com erro */
.scale-row,
.question {
  scroll-margin-top: 16px;
}

/* ---------- Responsivo ---------- */
@media (max-width: 620px) {
  body {
    font-size: 17px;
  }
  .page {
    padding: 16px 12px 96px;
  }
  .card {
    padding: 18px 14px;
  }
  h1 {
    font-size: 1.4rem;
  }

  .scale-row {
    flex-wrap: wrap;
    gap: 4px;
    padding: 14px 8px;
  }
  /* Realça o par sendo respondido, um de cada vez */
  .pairs .scale-row:nth-child(odd) {
    background: var(--zebra);
  }
  .pole {
    flex: 1 1 40%;
    font-size: 0.98rem;
    font-weight: 500;
  }
  .pole-left {
    order: 1;
    text-align: left;
  }
  .pole-right {
    order: 2;
    text-align: right;
  }
  .scale {
    order: 3;
    flex: 1 1 100%;
    justify-content: space-between;
    padding: 10px 2px 4px;
  }
  /* Alvo de toque generoso: círculo grande dentro de área clicável maior */
  .dot {
    width: 30px;
    height: 30px;
    border-width: 2px;
  }

  .likert {
    gap: 8px;
  }
  .likert-option {
    padding: 10px 16px;
    font-size: 0.95rem;
  }

  .open-answer {
    min-height: 110px;
    font-size: 1rem;
  }

  .question + .question {
    padding-top: 18px;
  }

  /* Botão de envio fixo e fácil de tocar */
  .actions {
    position: sticky;
    bottom: 0;
    margin: 8px -12px -96px;
    padding: 12px;
    background: linear-gradient(to top, var(--bg) 70%, rgba(244, 245, 247, 0));
  }
  .btn-primary {
    width: 100%;
    padding: 16px;
    font-size: 1.05rem;
    box-shadow: 0 4px 14px rgba(47, 111, 143, 0.3);
  }
}
