* {
  box-sizing: border-box;
}

body {
  max-width: 760px;
  margin: 2rem auto;
  padding: 0 1rem;
  font: 16px/1.4 system-ui, sans-serif;
}

#item-list {
  display: grid;
  gap: 0.65rem;
}

.item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.item-card {
  display: grid;
  place-items: center start;
  flex: 1;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid #aaa;
  border-radius: 0.5rem;
  background: #f3f4f6;
  font-size: 1.5rem;
}

.item[data-state="no"] .item-card {
  background: #f8d7da;
}

.item[data-state="yes"] .item-card {
  background: #b7dfc7;
}

.item[data-state="indifferent"] .item-card {
  background: #F0FFF0;
}

.item[data-state="unknown"] .item-card {
  background: #e5e7eb;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  background: #fafafa;
  font-size: 1rem;
}

.choices {
  display: flex;
  flex: 0 0 auto;
  gap: 0.35rem;
}

.choice {
  position: relative;
  cursor: pointer;
}

/* Keep native radio inputs accessible while visually hiding them. */
.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice span {
  display: inline-block;
  width: 3rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid #888;
  border-radius: 0.35rem;
  background: white;
  text-align: center;
}

.choice input:checked + span {
  border-color: #222;
  box-shadow: 0 0 0 2px #222;
  font-weight: 700;
}

.choice input:focus-visible + span {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

button[type="submit"] {
  margin-top: 1rem;
  padding: 0.65rem 1.1rem;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 520px) {
  .item {
    flex-direction: column;
    align-items: stretch;
  }

  .choices {
    justify-content: center;
  }
}
