/* 公開フォームテーマ（pages/form-public.html） */
/* 背景は画面いっぱい（body）、フォーム本体は中央カード。テーマ別の背景色は body に付与（JSで fm-theme-* を body へ） */
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: #eef4fb;
}
body.fm-theme-standard { background: linear-gradient(180deg, #eef4fb 0%, #dbe8f6 100%); }
body.fm-theme-minimal  { background: #ffffff; }
body.fm-theme-card     { background: #e6ebf2; }
body.fm-theme-custom1  { background: #ebebeb; }

.fm-root {
  --fm-primary: #378add;
  --fm-accent: #185fa5;
  font-family: "ヒラギノ角ゴ ProN", "Hiragino Kaku Gothic ProN", "游ゴシック", YuGothic, Meiryo, sans-serif;
  color: #334155;
  line-height: 1.5;
  max-width: 620px;
  margin: 40px auto;
  padding: 24px 16px 48px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 30px rgba(15, 23, 42, 0.10);
  overflow: hidden; /* ヘッダーロゴ/色帯バナーの角丸クリップ */
}
/* スタンダード: 定番・白カード・青アクセント・枠線入力（＝ベース既定） */
.fm-root.fm-theme-standard {
  background: #fff;
}
/* ミニマル: フラット（影・角丸・枠なし）。入力は下線のみ・モノトーン */
.fm-root.fm-theme-minimal {
  background: #fff;
  box-shadow: none;
  border-radius: 0;
}
/* カード型: 浮いたカード（強い影・大きな角丸）＋色帯ヘッダー・塗り入力・ピルボタン */
.fm-root.fm-theme-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.16);
  border: none;
}
.fm-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fm-accent);
  margin: 0 0 8px;
}
.fm-headline {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 20px;
}
/* カスタムヘッダー（ロゴ画像 / 色帯バナー）。fm-root の padding(24px 16px) を打ち消して端まで表示 */
.fm-hd-logo {
  margin: -24px -16px 6px;
  padding: 16px 20px 0;
}
.fm-hd-logo img {
  max-height: 54px;
  max-width: 80%;
  object-fit: contain;
  vertical-align: middle;
}
.fm-hd-banner {
  margin: 0 -16px 18px;
  padding: 20px 24px;
}
.fm-hd-banner .fm-title {
  margin: 0;
}
/* 角丸テーマでバナーがはみ出さないように */
.fm-root.fm-theme-card,
.fm-root.fm-theme-minimal {
  overflow: hidden;
}
.fm-field {
  margin-bottom: 16px;
}
.fm-note {
  margin-top: 6px;
  padding: 2px 0;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}
.fm-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.fm-row > .fm-field {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}
/* 単独半幅は半分のみ占有 */
.fm-row > .fm-field:only-child {
  max-width: calc(50% - 4px);
}
.fm-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #475569;
}
.fm-api-display {
  padding: 10px 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #065f46;
}
.fm-input,
.fm-textarea,
.fm-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
}
.fm-textarea {
  min-height: 100px;
  resize: vertical;
}
.fm-divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 20px 0;
}
.fm-divider-section {
  margin: 24px 0 8px;
}
.fm-divider-section .fm-divider {
  margin: 8px 0 0;
}
.fm-divider-text {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  margin: 0 0 4px;
}
.fm-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--fm-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
}
.fm-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.fm-done {
  padding: 20px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  color: #166534;
  font-weight: 600;
}
.fm-error {
  padding: 12px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.fm-privacy {
  margin: 20px 0 8px;
  padding: 14px 16px;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #475569;
}
.fm-privacy a {
  color: #2563eb;
  text-decoration: underline;
}
.fm-privacy strong {
  font-weight: 700;
}
.fm-footer {
  margin: 18px 0 8px;
  padding: 12px 14px;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #475569;
}
.fm-footer a {
  color: #2563eb;
  text-decoration: underline;
}
.fm-footer strong {
  font-weight: 700;
}
.fm-radio-row,
.fm-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
/* 選択肢の横並び（ラジオ／チェック）。5段階評価などに */
.fm-opts-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 28px;
}
.fm-opts-inline .fm-radio-row,
.fm-opts-inline .fm-check-row {
  flex: 0 0 auto;
  margin-bottom: 4px;
}
/* 段階評価（両端ラベル付き）: 選択肢を全幅に均等配置し、両端ラベルと揃える */
.fm-scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}
.fm-opts-inline.fm-scale {
  justify-content: space-between;
  gap: 6px 8px;
}
.fm-confirm-table {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.fm-confirm-row {
  display: flex;
  border-bottom: 1px solid #f1f5f9;
}
.fm-confirm-row:last-child {
  border-bottom: none;
}
.fm-confirm-label {
  width: 200px;
  flex-shrink: 0;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
}
.fm-confirm-value {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #1e293b;
  word-break: break-word;
}
.fm-date-selects {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.fm-date-y { width: 100px; }
.fm-date-m { width: 70px; }
.fm-date-d { width: 70px; }
.fm-date-sep {
  font-size: 0.85rem;
  color: #475569;
  flex-shrink: 0;
}
/* 複数チェックボックス: 既定は1列（プレビューと一致・長文の選択肢もそのまま1行ずつ）。
   従来は width:50% で強制2列になり、プレビュー(1列)と食い違い、かつ「横並び」トグルも
   .fm-check-group .fm-check-row に上書きされて効かなかった。 */
.fm-check-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* 「選択肢を横並びにする」ON時のみ横に流す（5段階評価など短い選択肢向け）。
   詳細度を .fm-check-group より高くして確実に効かせる。 */
.fm-check-group.fm-opts-inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px 28px;
}
.fm-check-group.fm-opts-inline .fm-check-row {
  flex: 0 0 auto;
  width: auto;
  margin-bottom: 4px;
}
/* ── ミニマルテーマ: モノトーン・下線入力・フラット ── */
.fm-theme-minimal .fm-title {
  color: #111827;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.fm-theme-minimal .fm-headline { color: #9ca3af; }
.fm-theme-minimal .fm-label { color: #374151; font-weight: 500; }
.fm-theme-minimal .fm-input,
.fm-theme-minimal .fm-textarea,
.fm-theme-minimal .fm-select {
  border: none;
  border-bottom: 1.5px solid #d1d5db;
  border-radius: 0;
  background: transparent;
  padding: 8px 2px;
}
.fm-theme-minimal .fm-input:focus,
.fm-theme-minimal .fm-textarea:focus,
.fm-theme-minimal .fm-select:focus {
  outline: none;
  border-bottom-color: #111827;
}
.fm-theme-minimal .fm-submit {
  background: #111827;
  border-radius: 2px;
}

/* ── カードテーマ: 色帯ヘッダー・塗り入力・ピルボタン ── */
/* ロゴ/バナー未使用時(=タイトルが先頭)だけ色帯にする。ロゴ/バナー時は素通し */
.fm-theme-card .fm-title:first-child {
  background: var(--fm-primary);
  color: #fff;
  margin: -24px -16px 0;
  padding: 22px 20px 6px;
}
.fm-theme-card .fm-title:first-child + .fm-headline {
  background: var(--fm-primary);
  color: rgba(255, 255, 255, 0.9);
  margin: 0 -16px 18px;
  padding: 0 20px 20px;
}
.fm-theme-card .fm-input,
.fm-theme-card .fm-textarea,
.fm-theme-card .fm-select {
  border: none;
  background: #eef2f7;
  border-radius: 10px;
}
.fm-theme-card .fm-input:focus,
.fm-theme-card .fm-textarea:focus,
.fm-theme-card .fm-select:focus {
  outline: 2px solid var(--fm-primary);
  outline-offset: 1px;
  background: #fff;
}
.fm-theme-card .fm-submit {
  border-radius: 999px;
  padding: 13px 40px;
  display: block;
  margin: 22px auto 0;
}

/* ── カスタム１テーマ ── */
.fm-root.fm-theme-custom1 {
  --fm-primary: #27ae60;
  --fm-accent: #2c3e50;
  background: #fff;
  max-width: 640px;
}
.fm-theme-custom1 .fm-title {
  text-align: center;
  color: #2c3e50;
  font-size: 1.5rem;
  padding: 24px 0 16px;
  border-bottom: 2px solid #2c3e50;
  margin-bottom: 20px;
}
.fm-theme-custom1 .fm-headline {
  color: #555;
  font-size: 0.85rem;
}
.fm-theme-custom1 .fm-label {
  color: #333;
  font-size: 0.85rem;
  font-weight: 600;
}
.fm-theme-custom1 .fm-label .fm-req {
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 700;
}
.fm-theme-custom1 .fm-input,
.fm-theme-custom1 .fm-textarea,
.fm-theme-custom1 .fm-select {
  border: none;
  border-bottom: 1px solid #ccc;
  border-radius: 0;
  background: transparent;
  padding: 8px 4px;
  font-size: 0.95rem;
}
.fm-theme-custom1 .fm-input:focus,
.fm-theme-custom1 .fm-textarea:focus,
.fm-theme-custom1 .fm-select:focus {
  outline: none;
  border-bottom-color: #2c3e50;
}
.fm-theme-custom1 .fm-submit {
  background: #27ae60;
  border-radius: 24px;
  padding: 14px 48px;
  font-size: 1rem;
  display: block;
  margin: 24px auto 0;
}
.fm-theme-custom1 .fm-submit:hover {
  background: #219a52;
}
.fm-theme-custom1 .fm-field {
  margin-bottom: 20px;
  padding-bottom: 4px;
}
.fm-theme-custom1 .fm-check-row {
  display: inline-flex;
  min-width: 180px;
  margin-bottom: 6px;
}

/* ── 確認ページボタンコンテナ ── */
.fm-confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* ── モバイル対応: 確認ページ・完了ページ ── */
@media (max-width: 600px) {
  .fm-confirm-row {
    flex-direction: column;
  }
  .fm-confirm-label {
    width: 100% !important;
    padding: 8px 12px 4px;
    font-size: 0.75rem;
  }
  .fm-confirm-value {
    padding: 4px 12px 10px;
    font-size: 0.85rem;
  }
  .fm-confirm-buttons {
    flex-direction: column;
    gap: 10px;
  }
  .fm-confirm-buttons .fm-submit {
    width: 100%;
    padding: 14px 16px;
    box-sizing: border-box;
  }
  .fm-done {
    padding: 16px;
    font-size: 0.9rem;
    word-break: break-word;
  }
}

/* ── モバイル: カードを端まで広げる（浮いた余白を作らない） ── */
@media (max-width: 640px) {
  .fm-root,
  .fm-root.fm-theme-standard,
  .fm-root.fm-theme-minimal,
  .fm-root.fm-theme-card,
  .fm-root.fm-theme-custom1 {
    max-width: 100%;
    margin: 0 auto;
    border-radius: 0;
    box-shadow: none;
  }
}
