* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f3f7;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

.form-container {
  width: min(92%, 680px);
  margin: 40px auto;
  padding: 36px 30px 42px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

h1 {
  margin: 0 0 36px;
  text-align: center;
  font-size: 26px;
  line-height: 1.6;
  font-weight: 700;
}

.form-group {
  margin-bottom: 28px;
}

label, legend {
  display: block;
  margin-bottom: 9px;
  font-size: 16px;
  font-weight: 700;
}

.required, .optional {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.required {
  background: #eee;
  color: #555;
}

.optional {
  background: #f3f3f3;
  color: #888;
}

input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  color: #333;
  font: inherit;
  font-size: 16px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #777;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
}

textarea {
  resize: vertical;
  min-height: 150px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-weight: 400;
  cursor: pointer;
}

.radio-label.selected {
  border-color: #777;
  background: #f7f7f7;
}

.radio-label input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}

.character-count {
  margin-top: 6px;
  text-align: right;
  color: #888;
  font-size: 12px;
}

button {
  display: block;
  width: 100%;
  margin-top: 36px;
  padding: 15px;
  border: 0;
  border-radius: 9px;
  background: #333;
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  opacity: 0.85;
}

@media (max-width: 600px) {
  .form-container {
    width: 94%;
    margin: 20px auto;
    padding: 28px 20px 34px;
    border-radius: 12px;
  }

  h1 {
    font-size: 22px;
  }
}
