.personality-test {
  max-width: 820px;
  margin: 0 auto;
}

.test-stage {
  min-height: 31rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.test-screen[hidden] {
  display: none;
}

.test-start,
.test-question,
.test-result {
  animation: test-fade-in 180ms ease-out;
}

.test-start {
  display: grid;
  min-height: 25rem;
  place-items: center;
  text-align: center;
}

.test-start-inner {
  max-width: 620px;
}

.test-illustration,
.result-icon {
  display: grid;
  place-items: center;
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto 1.25rem;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 24px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  font-size: 2.75rem;
  line-height: 1;
}

.test-start h2,
.test-result h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.6rem, 5vw, 2.25rem);
}

.test-lead {
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.8;
}

.test-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0 1.5rem;
  padding: 0;
  list-style: none;
}

.test-meta li {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.test-start .button {
  min-width: min(100%, 18rem);
}

.test-progress-wrap {
  margin-bottom: 1.75rem;
}

.test-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.test-progress {
  overflow: hidden;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
}

.test-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffb84d);
  transition: width 180ms ease-out;
}

.test-question-kicker {
  margin: 0 0 0.45rem;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.test-question h2 {
  margin: 0;
  font-size: clamp(1.35rem, 4.5vw, 1.8rem);
  line-height: 1.45;
}

.answer-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.answer-button {
  width: 100%;
  min-height: 3.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.answer-button:hover,
.answer-button:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  transform: translateY(-1px);
}

.answer-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.test-nav {
  display: flex;
  justify-content: flex-start;
  margin-top: 1.25rem;
}

.test-nav .button {
  min-width: 8rem;
}

.result-hero {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.result-eyebrow {
  margin: 0 0 0.4rem;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.result-catchphrase {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-weight: 700;
}

.result-description {
  margin: 1.25rem 0 0;
  line-height: 1.9;
  text-align: left;
  overflow-wrap: anywhere;
}

.score-bars {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--surface-2);
}

.score-row {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.score-label {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.score-track {
  overflow: hidden;
  height: 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.score-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.score-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.result-sections {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.result-section {
  min-width: 0;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
}

.result-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.trait-list,
.action-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.2rem;
}

.trait-list li,
.action-list li {
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.hobby-grid {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.hobby-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.hobby-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.hobby-card p {
  margin: 0.3rem 0;
  color: var(--muted);
  line-height: 1.6;
}

.hobby-card strong {
  color: var(--text);
}

.test-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.test-actions .button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.test-live {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 720px) {
  .result-sections,
  .hobby-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 479px) {
  .test-stage {
    min-height: 28rem;
    padding: 1rem;
    border-radius: 22px;
  }

  .test-actions {
    grid-template-columns: 1fr;
  }

  .test-actions .button {
    width: 100%;
  }

  .test-actions .button:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .score-row {
    grid-template-columns: minmax(4.5rem, auto) minmax(0, 1fr) 2.7rem;
    gap: 0.5rem;
  }
}

@keyframes test-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .test-start,
  .test-question,
  .test-result,
  .test-progress-fill,
  .answer-button {
    animation: none;
    transition: none;
  }
}
