body {
  font-family: Arial, sans-serif;
  background: #f8f8f8;
  margin: 0;
  padding: 20px;
}

.form-container {
  background: #ffffff;
  max-width: 700px;
  margin: auto;
  padding: 20px;
  border: 1px solid #ccc;
  box-shadow: 2px 2px 12px rgba(0,0,0,0.1);
}

h2 {
  text-align: center;
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ccc;
  padding: 10px 0;
  flex-wrap: wrap;
}

.form-row label {
  flex: 0 0 200px;
  background-color: #e6f0ff;
  padding: 5px 10px;
  margin-right: 10px;
  border-right: 1px solid #ccc;
  box-sizing: border-box;
  word-wrap: break-word;
  white-space: normal;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row input[type="date"],
.form-row select {
  flex: 1;
  min-width: 0; /* Chromeでの横並び崩れ防止 */
  padding: 8px;
  background-color: #ffffff;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.form-row textarea {
  flex: 1;
  min-width: 0; /* Chromeでの横並び崩れ防止 */
  padding: 8px;
  background-color: #ffffff;
  border: 1px solid #ccc;
  box-sizing: border-box;
  resize: vertical;
}

.form-row input[type="checkbox"],
.form-row input[type="radio"] {
  margin-left: 5px;
  margin-right: 3px;
}

/* YES/NO ラジオボタン間隔調整 */
.radio-group {
  display: flex;
  align-items: center;
  gap: 8px; /* 間隔を狭める */
}

/* Details リンク */
.form-row a {
  margin-left: 10px;
  color: #0066cc;
  text-decoration: none;
}

.form-row a:hover {
  text-decoration: underline;
}

.buttons {
  justify-content: center;
  margin-top: 20px;
  border: none;
}

.buttons button {
  padding: 10px 20px;
  margin: 0 10px;
  font-size: 1em;
  cursor: pointer;
  border: none;
  background-color: #007BFF;
  color: #fff;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.buttons button:hover {
  background-color: #0056b3;
}

/* ▼▼ バリデーションエラーメッセージ用 ▼▼ */
.error-message {
  color: red;
  font-size: 0.9em;
  margin-top: 4px;
  margin-left: 2px;
  width: 100%;
  display: block;       /* 横並びにせず必ず下に表示 */
  white-space: normal;
  word-break: break-word;
}

/* 入力欄エラー時の背景赤＆枠線 */
.error-field {
  background-color: #ffcccc !important;
  border: 1px solid red;
}

/* ラジオ・チェックボックスグループのエラーメッセージ位置 */
.form-row .error-message {
  margin-left: 0; /* ラジオボタン横にずれないように調整 */
}

/* ▼▼ NO 選択時の追加項目の見た目 ▼▼ */
.hidden-section {
  display: none;
  width: 100%;
}

.hidden-section.active {
  display: flex;
  flex-direction: column;
}

/* Responsive */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row label {
    flex: none;
    width: 100%;
    margin-bottom: 5px;
    border-right: none;
  }

  .radio-group {
    flex-direction: row;
    gap: 5px;
  }

  .buttons {
    flex-direction: column;
    align-items: center;
  }

  .buttons button {
    margin: 10px 0;
  }
}

/* 「Please specify the type of data you need in detail」専用スタイル（方法2適用） */
#yes-other-data input[type="text"],
#no-other-data input[type="text"] {
  flex: 1;             /* 横並びを維持 */
  min-width: 0;        /* Chromeでの横並び崩れ防止 */
  width: auto;         /* 100%固定を解除 */
  max-width: 100%;
  height: 120px;       /* 縦幅を広く */
  box-sizing: border-box;
}

/* 横並びのまま入力欄だけ広げる調整（全体適用） */
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  flex: 1;
  min-width: 0; /* Chrome対策 */
  width: 100%;
  max-width: 100%;
}

/* 「Please specify the type of data you need in detail」専用の高さ調整 */
textarea[name="data_detail"] {
  height: 120px; /* 縦幅を広く */
  resize: vertical; /* ユーザーによる調整も可能 */
}
