* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #1f1f1f;
  background: #f5f5f5;
}

a {
  color: #0645ad;
  text-decoration: underline;
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid #000;
  outline-offset: 3px;
}

/* Skip link */

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #000000;
  border: 2px solid #000000;
  font-weight: 700;
}

.skip-link:focus {
  top: 1rem;
}

/* Page structure */

.test-shell {
  width: min(100% - 2rem, 900px);
  margin: 0 auto;
  padding: 1.25rem;
  background: #ffffff;
}

.test-header,
.test-footer {
  text-align: center;
}

.test-header h1 {
  margin-bottom: 0.25rem;
}

.byline {
  margin-top: 0;
}

.instructions,
.results,
.disclaimer {
  border: 1px solid #777777;
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1.25rem 0;
}

.rating-key {
  padding-left: 1.5rem;
}

/* Error summary */

.error-summary {
  border: 3px solid #7a0000;
  padding: 1rem;
  margin: 1rem 0 1.5rem;
}

.error-summary h3 {
  margin-top: 0;
}

.error-summary a {
  font-weight: 700;
}

/* Questions */

.question-card {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #777777;
  border-radius: 0.5rem;
}

.question-card.has-error {
  border-width: 3px;
}

.question-card fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.question-card legend {
  width: 100%;
  margin-bottom: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.question-hint {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

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

.scale-choice {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;

  padding: 0.55rem;
  border: 1px solid #777777;
  border-radius: 0.35rem;

  cursor: pointer;
  text-align: center;
}

.scale-choice:hover {
  border-width: 2px;
}

.scale-choice:has(input:checked) {
  border-width: 3px;
  font-weight: 700;
}

.scale-choice:focus-within {
  outline: 3px solid #000000;
  outline-offset: 2px;
}

.scale-choice input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  flex: 0 0 auto;
}

.scale-number {
  font-weight: 700;
}

.scale-words {
  line-height: 1.2;
}

/* Buttons */

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

button {
  min-height: 44px;
  min-width: 44px;

  padding: 0.7rem 1rem;

  font: inherit;
  font-weight: 700;

  color: #000000;
  background: #ffffff;

  border: 2px solid #000000;
  border-radius: 0.35rem;

  cursor: pointer;
}

button:hover {
  text-decoration: underline;
}

button.secondary {
  border-width: 1px;
}

/* Results */

.results:focus {
  outline: 3px solid #000000;
  outline-offset: 4px;
}

.score-list {
  margin: 1rem 0;
}

.score-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid #cccccc;
}

.score-row:last-child {
  border-bottom: 0;
}

.score-row dt {
  font-weight: 700;
}

.score-row dd {
  margin: 0.2rem 0 0;
}

.type-result {
  font-size: 1.2rem;
  font-weight: 700;
}

.test-footer {
  margin-top: 2rem;
}

/* Reflow for smaller screens */

@media (max-width: 700px) {

  .test-shell {
    width: 100%;
    padding: 1rem;
  }

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

  .scale-choice {
    justify-content: flex-start;
    text-align: left;
  }

}

/* Respect reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

}