body {
  font-family: Arial, sans-serif;
  background: #f8f8f8;
  margin: 0;
  padding: 20px;
  overflow-x: hidden;
}

.form-container {
  background: #ffffff;
  width: 100%;
  max-width: 700px;
  margin: auto;
  padding: 20px;
  box-sizing: border-box;
}

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;
  padding: 10px;
  font-size: 16px;
  background-color: #ffffff;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

.form-row textarea {
  flex: 1;
  min-width: 0;
  padding: 10px;
  font-size: 16px;
  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;
  transform:scale(1.2);
}

/* Data period */
.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.date-range input[type="date"] {
    flex: 1;
    min-width: 0;
}

.date-label {
    font-weight: bold;
    white-space: nowrap;
}


/* YES/NO ラジオボタン間隔調整 */
.radio-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  flex: 1;
  min-width: 0;
}

.form-row .radio-label {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    width: auto !important;
    flex: none !important;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Details リンク */
.form-row a {
  margin-left: 10px;
  color: #0066cc;
  text-decoration: none;
}

.form-row a:hover {
  text-decoration: underline;
}

.buttons {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  border: none;
}

.buttons button {
  padding: 10px 20px;
  margin: 0 10px;
  min-height: 48px;
  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;
  overflow-wrap: anywhere;
}

/* 入力欄エラー時の背景赤＆枠線 */
.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: 768px) {

  body {
    padding: 5px;
  }

  .form-container {
    max-width: 100%;
    padding: 10px;
    margin: 0 auto;
    border-radius: 4px;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0;
  }

  .form-row label {
    flex: none;
    width: 100%;
    margin-right: 0;
    margin-bottom: 5px;
    border-right: none;
    padding: 5px 8px;
    font-size: 14px;
  }

  .form-row input:not([type="radio"]):not([type="checkbox"]),
  .form-row select,
  .form-row textarea {
    width: 100%;
    font-size: 16px;
    padding: 10px;
  }

.radio-group {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    width: 100%;
}

.form-row .radio-label {
    width: auto !important;
    flex: none !important;
    margin: 0;
    padding: 0;
}

  .buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .buttons button {
    width: 100%;
    max-width: none;
    margin: 6px 0;
  }
  
  .date-range {
    flex-direction: column;
    align-items: stretch;
}

.date-label {
    margin-top: 6px;
}

}

/* 「Please specify the type of data you need in detail」専用スタイル */
#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; /* ユーザーによる調整も可能 */
}

/* 全要素のサイズ計算を統一 */
* {
  box-sizing: border-box;
}

/* 画像のレスポンシブ対応 */
img {
  max-width: 100%;
  height: auto;
}

.confirm-value {
    flex: 1;
    min-width: 0;
    padding: 10px;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}