/* ========== Table form ========== */
.form-wrapper {
  margin: 200px auto 0;
  padding: 8rem 3rem;
  max-width: 968px;
  background-color: #fff !important;
  background-attachment: scroll, fixed, scroll;
}

/* レスポンシブ：行を縦積み */
@media (max-width:768px) {
  .form-wrapper {
    margin-top: 80px;
    padding: 4rem 5px;
    width: 100%;
  }
}

.form-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e2e4e4;
}

.form-table tr+tr th,
.form-table tr+tr td {
  border: 1px solid #e2e4e4;
}

.form-table th {
  width: 220px;
  vertical-align: middle;
  background: #fafafa;
  border-right: 1px solid var(--line);
  padding: 16px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid #e2e4e4;
}

.form-table td {
  padding: 16px;
  border: 1px solid #e2e4e4;
}

/* ラベル内に「必須」を入れる */
.form-table .th-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  /* ラベルとバッジの間隔 */
}

/* バッジは内容幅だけ（帯にならない）*/
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  background: #d60000;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  width: auto;
  height: auto;
  white-space: nowrap;
}

/* 入力共通 */
input,
select,
textarea {
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-sizing: border-box;
}

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

input[type="radio"] {
  width: auto;
}

/* 郵便・電話の分割UI */
.split-grid {
  display: grid;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  grid-template-columns: 140px 72px 140px;
}

.split-grid.tel {
  grid-template-columns: 120px 48px 120px 48px 120px;
}

/* 見た目をバーにする */
.split-dash {
  display: block;
  width: 100%;
  height: 2px;
  background: #cbd5e1;
  border-radius: 2px;
  align-self: center;
}

/* ====== スマホで分割フィールドが枠に収まるようにする ====== */
@media (max-width: 768px) {

  /* 共通：グリッドを可変に＆親幅いっぱいへ */
  .split-grid {
    max-width: 100%;
    grid-template-columns: 1fr 24px 1fr;
    /* zip: [3桁] - [4桁] */
  }

  .split-grid.tel {
    max-width: 100%;
    grid-template-columns: 1fr 20px 1fr 20px 1fr;
    /* tel: [A]-[B]-[C] */
  }

  /* 中央のバーは列幅に合わせて伸縮（高さは薄め） */
  .split-dash {
    height: 2px;
    width: 100%;
  }

  /* 入力のパディングを少しだけ詰める（はみ出し防止） */
  .split-grid input {
    padding: 10px 10px;
    font-size: 16px;
    /* iOSの自動ズーム防止 */
  }
}

/* さらに狭い端末（～360px）向けの微調整：区切り幅を少し細く */
@media (max-width: 360px) {
  .split-grid {
    grid-template-columns: 1fr 18px 1fr;
  }

  .split-grid.tel {
    grid-template-columns: 1fr 16px 1fr 16px 1fr;
  }
}

#zip1,
#zip2,
#tel1,
#tel2,
#tel3 {
  text-align: center;
  letter-spacing: .04em;
}

.field-error {
  color: red;
  font-size: 12px;
  margin: .25rem 0 0;
  min-height: 1em;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: .25rem 0 0;
}

/* セクション見出しは現状のまま */
.section {
  background: #fff;
  width: 100%;
  margin: 0 auto;
}

.section+.section {
  margin-top: 18px;
}

.section-title {
  font-size: 20px;
  background: var(--accent);
  border-radius: 12px;
  color: #fff;
  padding: 10px;
  text-align: center;
  margin: 6px 0 14px;
}

/* レスポンシブ：行を縦積み */
@media (max-width:768px) {

  .form-table tbody,
  .form-table tr,
  .form-table th,
  .form-table td {
    display: block;
    width: 100%;
  }

  .form-table th {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

/* ===== 入力フィールドの枠線を明確に ===== */
.form-table input:not([type="radio"]),
.form-table select,
.form-table textarea {
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  background: #fff;
  border: 1px solid #cbd5e1;
  /* 見えやすいグレー */
  padding: 12px 14px;
  box-sizing: border-box;
}

/* 郵便番号/電話の分割入力も同じ枠線 */
.split-grid input {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 10px 12px;
}

/* ホバー時 */
.form-table input:not([type="radio"]):hover,
.form-table select:hover,
.form-table textarea:hover,
.split-grid input:hover {
  border-color: #94a3b8;
}

/* フォーカス時（アクセントカラーで強調） */
.form-table input:not([type="radio"]):focus,
.form-table select:focus,
.form-table textarea:focus,
.split-grid input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 122, 217, .15);
}

/* プレースホルダー色を少し淡く */
.form-table input::placeholder,
.form-table textarea::placeholder,
.split-grid input::placeholder {
  color: #9aa5b1;
}

/* 無効状態 */
.form-table input:disabled,
.form-table select:disabled,
.form-table textarea:disabled {
  background: #f3f4f6;
  color: #9aa5b1;
}

/* もしエラー状態のクラスを付ける場合（任意） */
.field-control.has-error input,
.field-control.has-error select,
.field-control.has-error textarea,
.field-error+input,
.field-error+textarea {
  border-color: #d60000;
}

/* 理由ラジオ：PCは2列×2行、スマホは1列 */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  /* default: 1列（スマホ） */
  gap: 12px 28px;
  /* 行間 / 列間 */
}

@media (min-width: 769px) {
  .options-grid {
    grid-template-columns: 1fr 1fr;
    /* PC: 2列に */
  }
}

/* 各ラジオの見た目調整（長文でも折り返し可） */
.options-grid .radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  /* 既存の margin-right を無効化 */
  white-space: normal;
  /* テキスト折り返し */
  line-height: 1.6;
}

/* 同意セクション */
.agree-section {
  text-align: center;
}

.policy-line {
  color: #333;
  line-height: 1.9;
  margin: 0 0 12px;
}

.policy-line a {
  color: inherit;
  text-decoration: underline;
}

/* チェックボックス行 */
.checkbox.agree-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  /* ← ここで「同意する」を改行させない */
}

/* ボタン：赤い大きめのピル型CTA */
.btn.cta {
  background: #e6002e;
  color: #fff;
  border-radius: 9999px;
  padding: 16px 32px;
  font-weight: 700;
  font-size: 16px;
}

/* 無効ボタンの見た目 */
.btn.cta:disabled {
  opacity: .5;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.btn.cta:hover {
  filter: brightness(.96);
}

.btn.cta .arrow {
  font-size: 20px;
  margin-left: 10px;
}

/* エラー文（既存とトーン合わせ） */
.agree-section .field-error {
  margin-top: 6px;
}

/* 修正する：グレーのピル型＋戻る矢印 */
#closePreview {
  background: #f3f4f6;
  font-weight: 700;
  font-size: 16px;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  /* pill */
  padding: 14px 24px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  /* 矢印との間隔 */
}

#closePreview:hover {
  filter: brightness(.98);
}

/* 左向きの戻る矢印（文字ベース） */
#closePreview::before {
  content: '‹';
  /* U+2039（小なりに似た戻る矢印）*/
  font-size: 20px;
  line-height: 1;
  transform: translateY(-1px);
  /* わずかに中央寄せ調整 */
}


/* ===== 確認モーダル（ふわっと表示） ===== */
.modal {
  position: fixed;
  inset: 0;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: saturate(120%) blur(3px);
  transition: opacity .28s ease;
  opacity: 0;
  z-index: 1;
}

.modal.open .modal__backdrop {
  opacity: 1;
}

.modal.open .modal__backdrop {
  opacity: 1;
}

.modal__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  width: min(720px, 92vw);
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .20);
  transition: transform .28s cubic-bezier(.2, .6, .2, 1), opacity .28s ease;
  z-index: 999;
}

.modal.open .modal__panel {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.modal__panel h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.preview-body {
  max-height: 55vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--gray);
  padding: 12px;
}

#previewList {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px 12px;
  margin: 0;
}

#previewList dt {
  font-weight: 700;
}

#previewList dd {
  margin: 0;
}

#previewList dt,
#previewList dd {
  min-width: 0;
  /* グリッド内でのはみ出し防止 */
  overflow-wrap: anywhere;
  /* スペースが無い英数列も任意位置で改行 */
  word-break: break-word;
  /* 互換 */
  white-space: pre-wrap;
  /* 入力の改行(\n)は保持しつつ折返し */
}

/* スマホ時は左列を少し細く（お好みで） */
@media (max-width: 768px) {
  #previewList {
    grid-template-columns: 150px minmax(0, 1fr);
  }
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

/* 送信CTA（モーダル用） */
.btn.cta {
  background: #e6002e;
  color: #fff;
  border-radius: 9999px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 16px;
  border: 1px solid transparent;
}

.btn.cta:hover {
  filter: brightness(.96);
}

.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

/* モーダル表示中は背面スクロールを止める */
body.modal-open {
  overflow: hidden;
}

/* 動きが苦手な利用者配慮 */
@media (prefers-reduced-motion: reduce) {

  .modal__panel,
  .modal__backdrop {
    transition: none !important;
  }
}

.warning-wrapper {
  text-align: center;
  /* 中央寄せ */
  margin: 0rem 0 3rem 0;
  /* 上下の余白 */
}

.warning-message {
  font-size: 1.75rem;
  font-weight: bold;
  display: inline-block;
  background: linear-gradient(transparent 60%, rgba(255, 255, 0, 0.6) 60%);
  padding: 0.5rem 1rem;
  line-height: 1.8;
  border-radius: 4px;
  /* ほんのり丸み */
}
/* ===== Spinner ===== */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .75);
  display: none;
  /* .show で表示 */
  place-items: center;
  z-index: 2000;
}

.spinner-overlay.show {
  display: grid;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid #cbd5e1;
  border-top-color: var(--accent);
  /* #2F7AD9 を想定 */
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.spinner-text {
  margin-top: 12px;
  color: #333;
  font-weight: 700;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* スピナー表示中は背面スクロールを止める */
body.sending {
  overflow: hidden;
}