/**===============================
 * アンケート全体に対するCSS
 ================================*/

/* SurveyJSのスクロールラッパーに横スクロールを追加 */

/* 回答画面のみ */
/* 質問コンテンツエリア（入力欄・選択肢など）の左インデント。タイトル行には影響しない */
.sd-body--responsive .sd-question__content {
  padding-left: 30px;
}

/* 編集エリア（Creator）のみ */
/* SurveyJS Creatorがデフォルトで設定するpadding(40px)を上書き。 */
.svc-question__content .sd-question__content {
  padding-left: 70px !important;
}

.sv-scroll__scroller {
  overflow-x: auto !important;
}

/* 枠外要素（outsideTitleHtml）と選択肢の間の隙間 */
.sv-outside-title-html {
  margin-bottom: 1em;
}

/* Creator編集タブ限定：outsideTitleHtmlの幅はみ出し対策（ENQ-978）
 * outsideTitleHtmlは素のdivを挿入するだけで幅・折り返しの制約を自前で持たず親要素に依存する。
 * 回答画面・プレビューは親(.sd-question)が幅を制約するため折り返すが、編集タブは
 * .sv-scroll__scroller { overflow-x:auto } の影響で幅が制約されず長い一文がカード右にはみ出す。
 * Creator専用ラッパー(.svc-question__content)配下に限定し、回答画面・プレビューには影響させない。 */
.svc-question__content .sv-outside-title-html {
  min-width: 0;
  max-width: 100%;
}
.svc-question__content .sv-outside-title-html,
.svc-question__content .sv-outside-title-html * {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ENQ-977 リンク(aタグ)の既定色をパネル(.sd-html)内と統一する。
 * SurveyJSの既定では .sd-html a だけにブランド色が当たり、質問文(.sd-question__title)・
 * outsideTitleHtml(.sv-outside-title-html)・設問description(.sd-question__description)・
 * ページ/パネルのdescription(.sd-description) のリンクは a { color: inherit } のまま
 * 黒字になる。同じ色指定を本文の各コンテキストへ広げ、インラインstyleの直書きを不要にする。
 * 色値は SurveyJS v2.3.4 時点で .sd-html a と同一（アップグレード時は要再確認）のため、
 * テーマのプライマリ色を変えても自動で揃う。 */
.sv-outside-title-html a,
.sd-question__title a,
.sd-question__description a,
.sd-description a {
  color: var(--sjs-primary-backcolor, var(--primary, #19b394));
}

 /* カスタムエディタのバリデーションエラー */
[data-name="hideButton"] .spg-question__erbox .sv-string-viewer,
[data-name="subquestionsGroup"] .spg-question__erbox .sv-string-viewer,
[data-name="columnsGroup"] .spg-question__erbox .sv-string-viewer,
[data-name="rowsGroup"] .spg-question__erbox .sv-string-viewer,
[data-name="choicesGroup"] .spg-question__erbox .sv-string-viewer,
[data-name="questionRandomRanges"] .spg-question__erbox .sv-string-viewer {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  line-height: 1.5 !important;
}

.sv-components-container-contentBottom{
  background-color: var(--sjs-footer-backcolor, transparent);
}

.sl-table__cell .svc-action-button .svc-question-link__set-button {
  overflow: visible !important;
  display: block !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: unset !important;
}

/* プログレスボタンページタイトルのカスタムスタイル */
 .sd-progress-buttons__page-title { 
  font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "ＭＳ Ｐゴシック", "MS P Gothic", sans-serif !important;
  font-weight: 400 !important;  /* 通常のフォントウェイト、太字を避ける */
  height: 20px !important;
  padding: 0px !important;
  width: 250px !important;
  margin: 0 0 0 auto !important;  /* margin-left: auto を使用して右端に配置 */
  color: #00761c !important;
  font-size: 120% !important;  /* 元の80%から1.5倍に拡大 */
  flex-grow: 0 !important;  /* 残りのスペースを占有しない */
  justify-content: flex-end !important;  /* コンテンツを右揃え */
}

/*コンポーネントコンテナのホバー（固定）効果をキャンセル */
.sv-components-container-center,
.sv-root--sticky-top .sv-components-container-center {
  position: static !important;
  box-shadow: none !important;
  z-index: auto !important;
  transition: none !important;
  animation: none !important;
  transform: none !important;
  will-change: auto !important;
  border-left: none !important;
  border-right: none !important;
}

.sd-navigation__prev-btn,
.sd-navigation__next-btn{
  border: 1px solid #525252 !important;
  box-shadow: 1px 2px 2px #ccc, 0 1px 1px #fff inset !important;
  background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#fff)) !important;
  color: #363636 !important;
}

.sd-body.sd-body--static{
  padding-bottom: calc(6 * (var(--sjs-base-unit, var(--base-unit, 8px)))) !important;
}

/* Header を参考に作成している、オリジナルのもの */
.sv-footer__content--static{
  max-width:calc(90*(var(--sjs-base-unit, var(--base-unit, 8px))));
  margin-left:auto;
  margin-right:auto;
}

/**===============================
 * SAに関するCSS(マトリクスのSAはマトリクスの箇所に記載)
 ================================*/

/* SAの外枠 */
.sd-radio__decorator{
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  width: 25px !important;
  height: 25px !important;
  margin-right: 4px !important;
  vertical-align: middle !important;
  box-shadow: 0 1px 3px -1px #eee !important;
  -webkit-box-shadow: 0px 0px 3px #555, 1px 1px 2px #aaa inset !important;
  -webkit-border-radius: 15px !important;
  border: #fff 1px solid !important;
}
/* SAの選択の要素 通常時は非表示でないと常に表示された状態になる */
.sd-radio__decorator::before,
.sd-radio__decorator::after {
  content: "" !important;
  display: none !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 15px !important;
  height: 15px !important;
  background: #000 !important;
  border-radius: 50% !important;
  -webkit-border-radius: 50% !important;
}

/* チェック状態の時のみ黒丸を表示 */
.sd-item--checked.sd-radio--checked .sd-radio__decorator::before,
.sd-item--checked .sd-radio__decorator::before {
  display: block !important;
}

/* decoratorを相対位置に設定 */
.sd-radio__decorator {
  position: relative !important;
}

/* SAチェックに関する背景色 */
.sd-item--checked .sd-radio__decorator{
  background: #fff !important;
}

/**===============================
 * MAに関するCSS(マトリクスのMAはマトリクスの箇所に記載)
 ================================*/

/* MAの外枠 */
.sd-checkbox__decorator{
  -webkit-appearance: none !important;
  width: 25px !important;
  height: 25px !important;
  margin-right: 2px !important;
  vertical-align: middle !important;
  -webkit-box-shadow: 0px 0px 3px #555, 1px 1px 2px #aaa inset !important;
  -webkit-border-radius: 2px !important;
  border: #fff 1px solid !important;
}
.sd-checkbox__svg {
  display: none !important;
}

/* MAの選択の要素 通常時は非表示 */
.sd-checkbox__decorator::before {
  content: "" !important;
  display: none !important;
  position: relative !important;
  top: -2px !important;
  left: 0px !important;
  width: 12px !important;
  height: 22px !important;
  border-bottom: #333 6px solid !important;
  border-right: #333 6px solid !important;
  -webkit-transform: rotate(45deg) !important;
  transform: rotate(45deg) !important;
}


/* チェック状態の時のみ表示 */
.sd-item--checked.sd-checkbox--checked .sd-checkbox__decorator::before,
.sd-item--checked .sd-checkbox__decorator::before {
  display: block !important;
}

/* MAチェックに関する背景色 */
.sd-item--checked .sd-checkbox__decorator{
  background: #fff !important;
}

/**===============================
 * 必須エラー時の選択肢配色（SA/MA共通）
 ================================*/

/* ENQ-894: 必須エラー時に先頭の選択肢だけエラー色（薄赤）が付かない問題の修正。
   SurveyJS v2.3.4 標準テーマの内部CSSに依存（アップグレード時は要再確認）。
   バリデーション失敗時、SurveyJSは最初の未回答設問の先頭入力に自動でフォーカスを当てる。
   このとき SurveyJS標準テーマの
     .sd-item__control:focus + .sd-item__decorator { background: #fff }（詳細度 0,3,0）
   が
     .sd-item--error .sd-item__decorator { background: 薄赤 }（詳細度 0,2,0）
   に勝つため、フォーカス中の先頭項目だけ白く残ってしまう。
   エラー中はフォーカス時も薄赤を維持する（詳細度 0,4,0 で勝つため !important 不要）。
   .sd-item ベースのため SA(radiogroup)・MA(checkbox) 双方に適用される。 */
.sd-item--error .sd-item__control:focus + .sd-item__decorator {
  background: var(--sjs-special-red-light, var(--red-light, rgba(230, 10, 62, 0.1)));
}

/**===============================
 * マトリクスに関するCSS
 ================================*/

.matrix-ma-container,
.matrix-sa-container,
.matrix-sd-container,
.matrix-mix-container {
  overflow-x: auto;
  max-width: 100%;
}

/* グループラベルのスタイル */
/* 表肩の左上は表頭表側どちらにもかかわってくるものなので、heightとwidthどちらも設定しなければいけない */
.group-label-empty {
  border: none !important;
  background-color: transparent !important;
  height: 20px !important;
  min-height: 20px !important;
  width: 30px !important;
  min-width: 30px !important;
}

.group-label-cell {
  text-align: center;
  font-weight: bold;
  height: 20px !important;
  min-height: 20px !important;
}

.row-group-label-empty {
  border: none !important;
  background-color: transparent !important;
  width: 30px !important;
  min-width: 30px !important;
}

.row-group-label-cell {
  text-align: center !important;
  vertical-align: middle;
  width: 30px !important;
  min-width: 30px !important;
}

.row-group-label-top-cell {
  padding: 8px;
  text-align: left;
  border-bottom: 2px solid #ddd;
}

/* マトリクス（文字）のスタイルで必要 */
.sd-table__cell textarea.sd-comment,
.sd-table__cell input.sd-input{
  /* テキストエリア自体の設定 */
  margin: 0 auto; /* 左右の余白を自動で均等に */
  display: block; /* ブロック要素として表示 */
  background-color: white;
}

/* マトリクス（文字）のスタイルで必要 */
.sd-table__cell textarea.sd-comment {
  width: 100% !important;
}

.matrix-text-container {
  width: auto !important;
  overflow-x: auto;
}

.create-matrix-table {
  width: 50%;
  max-width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}

.matrix-text-container .create-matrix-table {
  table-layout: auto !important;
}

/* 左列は内容に応じて伸びる */
.matrix-text-container .create-matrix-table th:first-child,
.matrix-text-container .create-matrix-table td:first-child {
  width: 150px;
  min-width: 150px;
  white-space: nowrap;
}

.matrix-text-container .create-matrix-table th {
  white-space: normal;
}

.create-matrix-table th,
.create-matrix-table td {
  border: 1px solid #ddd;
  padding: 4px 4px;
  text-align: center;
  font-size: 0.9em;
  min-width: 60px;
}

.create-matrix-table th {
  background-color: #f8f9fa;
  font-weight: normal;
  height: 120px;
  vertical-align: middle;
  text-orientation: upright;
  white-space: nowrap;
  padding: 4px 10px;
}

/* ENQ-821: Firefoxは height:120px を固定として扱いセルが拡張されないため、
   縦書き表頭（.header-cell-container を子に持つ th）のみ auto+min-height に上書きする */
.create-matrix-table th:has(> .header-cell-container) {
  height: auto;
  min-height: 120px;
}

.vertical-text {
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  min-height: 100px;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.create-matrix-table th:first-child,
.create-matrix-table td:first-child{
  background-color: #f8f9fa;
  width: 150px;
  min-width: 150px;
}

/* SurveyJS Creator v2.3.4 の内部 CSS に依存（アップグレード時は要再確認）。
   SurveyJS Creatorのロジックエディタ(.sl-table)が
   `.sl-table thead th:first-child / :last-child` に
   `position: absolute; transform: translateX(±100%)` を当てているため、
   ロジックの「質問の値を設定する」内に表示されるカスタムマトリクスの
   表肩セル(first-child)と最終列ヘッダー(last-child)が表の外に飛び出す。
   カスタムマトリクスの thead では絶対配置を打ち消して通常のテーブルセルに戻す。 */
.sl-table .create-matrix-table thead th:first-child,
.sl-table .create-matrix-table thead th:last-child {
  position: static !important;
  transform: none !important;
  left: auto !important;
  right: auto !important;
}

/* SurveyJS Creator v2.3.4 の内部 CSS に依存（アップグレード時は要再確認）。
   SurveyJS Creatorのロジックテーブル(.sl-table)は
   `td:first-of-type` / `:last-of-type` に padding-left/right を入れているため、
   ネストしたカスタムマトリクスのセルにも継承される。
   行ごとにグループラベルセルの有無で先頭セルが変わると、
   選択肢の x 位置がズレて見える。カスタムマトリクスのベース padding に揃える。 */
.sl-table .create-matrix-table th:first-of-type,
.sl-table .create-matrix-table th:last-of-type,
.sl-table .create-matrix-table td:first-of-type,
.sl-table .create-matrix-table td:last-of-type {
  padding-left: 4px !important;
  padding-right: 4px !important;
}

.sd-matrix-table th:last-child,
.sd-matrix-table td:last-child{
  background-color: #f8f9fa;
  width: 150px;
  min-width: 150px;
  max-width: 200px;
}

.create-matrix-table td:first-child,
.sd-matrix-table td:last-child{
  text-align: left;
}

.create-matrix-row {
  left: 0;
  z-index: 50;
  background-color: #f8f9fa;
}

/* Sticky有効時のコンテナスタイル */
.matrix-height {
  overflow-y: auto;
  max-height: 400px;
}

/* Sticky有効時のヘッダースタイル */
.matrix-header-sticky {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Sticky無効時のヘッダースタイル */
.matrix-header-static {
  position: static;
}

/* マトリクスのデータセル背景色（白） */
.matrix-cell-white {
  background-color: #fff !important;
}

/* 混合マトリクスのデータセル背景色（白） */
.matrix-mix-container .create-matrix-table tbody td:not(.row-group-label-cell):not(.row-group-label-top-cell) {
  background-color: #fff !important;
}

/* マトリクス（テキスト）のデータセル背景色（白） */
.sd-table__cell {
  background-color: #fff !important;
}

/*====
 * マトリクスのSAのスタイル
 ====*/

/* マトリクス内のラジオボタンに同じスタイルを適用 */
.radio-input {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  width: 25px !important;
  height: 25px !important;
  margin-right: 4px !important;
  vertical-align: middle !important;
  box-shadow: 0 1px 3px -1px #eee !important;
  -webkit-box-shadow: 0px 0px 3px #555, 1px 1px 2px #aaa inset !important;
  -webkit-border-radius: 15px !important;
  border: #fff 1px solid !important;
  position: relative !important;
  cursor: pointer !important;
  transform: scale(1.0) !important;
  background-color: white;
}

/* 選択状態の背景色 */
.radio-input:checked {
  background: #fff !important;
}

/* チェック状態の黒丸 */
.radio-input::before {
  content: "" !important;
  display: none !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 15px !important;
  height: 15px !important;
  background: #000 !important;
  border-radius: 50% !important;
  -webkit-border-radius: 50% !important;
}

/* チェック状態の時のみ黒丸を表示 */
.radio-input:checked::before {
  display: block !important;
}

/* 絞り込み（selectableIf）による無効化状態 */
.checkbox-input.selectable-if-disabled,
.radio-input.selectable-if-disabled {
  background-color: #b0b0b0 !important;
  -webkit-box-shadow: 0px 0px 3px #555, 1px 1px 2px #888 inset !important;
  cursor: not-allowed !important;
}

/*====
 * マトリクスのMAのスタイル
 ====*/
/* チェックボックスの基本スタイル */
.checkbox-input {
  -webkit-appearance: none !important;
  width: 25px !important;
  height: 25px !important;
  margin-right: 2px !important;
  vertical-align: middle !important;
  -webkit-box-shadow: 0px 0px 3px #555, 1px 1px 2px #aaa inset !important;
  -webkit-border-radius: 2px !important;
  border: #fff 1px solid !important;
  position: relative !important;
  cursor: pointer !important;
  transform: scale(1.0) !important;
  background-color: white;
}

/* 選択状態の背景色 */
.checkbox-input:checked {
  background: #fff !important;
}

/* チェックマーク（通常時は非表示） */
.checkbox-input::before {
  content: "" !important;
  display: none !important;
  position: relative !important;
  top: -2px !important;
  left: 6px !important;
  width: 12px !important;
  height: 22px !important;
  border-bottom: #333 6px solid !important;
  border-right: #333 6px solid !important;
  -webkit-transform: rotate(45deg) !important;
  transform: rotate(45deg) !important;
}

/* チェック状態の時のみチェックマークを表示 */
.checkbox-input:checked::before {
  display: block !important;
}

.checkbox-wrapper {
  margin-bottom: 5px;
}

/* ヘッダーセルのレイアウト調整 */
.header-cell-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  min-height: 100%;
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .create-matrix-table {
    font-size: 0.85em;
  }

  .create-matrix-table th,
  .create-matrix-table td {
    padding: 8px 4px;
    min-width: 36px;
  }

  .create-matrix-table th {
    height: 100px;
    font-size: 0.9em;
    padding: 4px 2px;
  }

  .create-matrix-table th:first-child,
  .create-matrix-table td:first-child,
  .sd-matrix-table th:last-child,
  .sd-matrix-table td:last-child{
    width: 120px;
    min-width: 120px;
    max-width: 120px !important;
    padding: 8px 6px;
    line-height: 1.3;
    word-break: break-word !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
  }

  .radio-input {
    transform: scale(1.0) !important;
  }
  .radio-cell {
    padding: 10px 4px;
  }
}


/**===============================
 * SA/MA選択肢グループラベルのCSS
 ================================*/

/* 全体コンテナ */
.choices-grouped-list {
  width: 100%;
}

/* グループセクション */
.choice-group-section {
  margin-bottom: 8px;
}

/* グループラベル（見出し） */
.choice-group-label {
  font-weight: bold;
  padding: 4px 0;
  margin-bottom: 2px;
  font-size: 0.95em;
}

/* グループラベルなし（空白時の余白） */
.choice-group-label-spacer {
  height: 12px;
}

/* グループ内・グループなし選択肢リスト */
.choice-group-items,
.choice-nogroup-items {
  padding-left: 0;
}

/**===============================
 * TextareaにかかわるCSS
 ================================*/

textarea.sd-input {
  width: auto !important;
}

.checkbox-textarea-container {
  display: flex;
  flex-direction: column;
}

.textarea-container {
  display: block;
  gap: 5px;
}

.textarea-container textarea{
  display: block;
  margin-bottom: 10px;
}

.matrix-input-text {
  border: 1px solid #000 !important;
  border-radius: 6px !important;
  resize: none;
}

/* 縦書きテキストエリアのスタイル */
.vertical-writing-textarea {
  writing-mode: vertical-rl;
  text-orientation: upright;
  resize: none;
  font-family: sans-serif;
  line-height: 1.5;
  padding: 8px;
  margin-left: 10px;
  border: 1px solid #000 !important;
  border-radius: 6px !important;
}

/* 縦書きラベル */
.vertical-text-label {
  writing-mode: vertical-rl;
  text-orientation: upright;
  min-width: 1em;
  align-items: center;
  justify-content: center;
}

/* テキストエリアコンテナの調整 */
.textarea-container.vertical {
  display: flex;
  flex-direction: row; /* 横に並べる */
  gap: 10px;
  min-height: 120px;
  margin-left: 10px;
}

/* 縦書きプレースホルダーテキストの調整 */
.vertical-writing-textarea::placeholder {
  writing-mode: vertical-rl;
  text-orientation: upright;
}

/* MA設問のテキストエリア */
.radio-input-text ,
.checkbox-input-text {
  resize: none;
  padding: 8px;
  margin-left: 10px;
  border: 1px solid #000 !important;
  border-radius: 6px !important;
}

@media (max-width: 768px) {
  .vertical-writing-textarea {
    width: 60px;
    font-size: 0.9em;
    padding: 5px;
  }
}

/**===============================
 * コピーダイアログのスタイル（copy専用）
 ================================*/

/* コピーダイアログのサイズ調整 */

.sv-popup.sv-property-editor.choices-copy-dialog > .sv-popup__container {
  min-width: 600px !important;
  max-width: 900px !important;
  width: 600px !important;
}

.sv-popup.sv-property-editor.choices-copy-dialog > .sv-popup__container > .sv-popup__body-content {
  min-width: 600px !important;
  max-width: 800px !important;
  width: 100% !important;
}


/* ダイアログ内のsurveyコンテナ */
.sv-popup.sv-property-editor.choices-copy-dialog .sd-root-modern,
.sv-popup.sv-property-editor.choices-copy-dialog .sd-body {
  min-width: 500px !important;
  white-space: normal;
  word-break: break-all;
}

/* ダイアログ内のチェックボックスリストのスタイル */
.sv-popup.sv-property-editor.choices-copy-dialog .sd-selectbase {
  max-height: 300px;
  overflow-y: auto;
}

/* ダイアログ内の質問要素のスタイル */
.sv-popup.sv-property-editor.choices-copy-dialog .sd-question__content {
  min-width: 400px;
}

/* ダイアログ内のドロップダウンのスタイル */
.sv-popup.sv-property-editor.choices-copy-dialog .sd-dropdown {
  min-width: 400px;
}

/* 確認メッセージの文字色を黒に */
.sv-popup.sv-property-editor.choices-copy-dialog .sd-page__description {
  color: #000000 !important;
  white-space: pre-line;
}

/**===============================
 * プレビュー画面でのテキスト選択許可
 * SurveyJS Creatorのデフォルト(user-select: none)を上書き
 ================================*/
.svc-creator__area .svd-simulator,
.svc-creator__area .sd-root-modern {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/**===============================
 * モーダル表示対象の画像にポインターカーソルを適用
 ================================*/
img[onclick*="big("] {
  cursor: pointer !important;
}

/**===============================
 * 条件エディタの!チェックボックスのラベルを左に表示
 ================================*/
.svc-expression-editor .sd-boolean--checkbox.sd-boolean {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/**===============================
 * スクロール完読ゲート
 * このクラスを付けた要素は最下部までスクロールするまで「次へ」ボタンが非表示になる
 ================================*/
.scroll-next-gate {
  max-height: 300px;
  overflow-y: auto;
}

/* ============================================================
   ENQ-942: パネルを使わなくても、ページ内の全要素（HTML含む）を
   1枚の白背景コンテナにまとめる
   PO承認(2026-06-09): 1ページ=1枚の白背景でOK
   （1ページ内で白背景ブロックを複数に分けるケースは無し）

   方式: 個別カードのborder結合ではなく、ページ(.sd-page)自体を
   1枚の白背景コンテナにし、内部の各カードの個別の背景・影・枠・角丸を
   解除してフラットに乗せる。これにより html / image など withFrame:""
   で枠を持たない要素も、同じ白背景の上に乗る（＝パネルと同じ見た目）。
   :has() やブラウザ依存の結合ロジックは使わない。
   ============================================================ */

/* 1) ページ自体を1枚の白背景コンテナにする（パネルの外箱を再現）。
      標準の .sd-page は横paddingのみ(0 40px)なので、上下の余白も付与する。 */
.sd-page {
  background: var(--sjs-questionpanel-backcolor, var(--sjs-general-backcolor, var(--background, #fff))) !important;
  box-shadow: var(--sjs-shadow-small, 0px 1px 2px 0px rgba(0, 0, 0, 0.15)) !important;
  border-radius: var(--sjs-corner-radius, 4px) !important;
  padding: calc(3*(var(--sjs-base-unit, var(--base-unit, 8px)))) calc(4*(var(--sjs-base-unit, var(--base-unit, 8px)))) !important;
}

/* 2) トップレベル質問行の上マージンをゼロに
      （質問間の縦の余白は、各カードが元から持つ padding で確保する） */
.sd-page__row.sd-row {
  margin-top: 0 !important;
}

/* 3) 内部の各カード（枠あり質問）をフラット化する。
      個別の白背景・影・枠・角丸を解除し、ページの白背景に直接乗せる。
      左右 padding も 0 にして、枠なしの html 等と左端を揃える。
      （上下 padding は質問間の余白として温存する） */
.sd-page__row.sd-row .sd-element--with-frame {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* 4) 補足: 上記1〜3は「回答画面（プレビュー/公開）」向けの密着表示。
      Creator の編集（デザイン）タブでは、これらが2つの副作用を生むため打ち消す。
      `.svc-row` / `.svc-page__content` は Creator のデザイン面にしか存在しない
      （回答画面・プレビューには無い）ため、回答側の密着表示には影響しない。

   4-1) 質問カードが密着して重なり気持ち悪い問題:
        デザイン面の質問間ギャップ（Creator 既定の `.svc-row > .sd-row.sd-page__row`
        margin-top:2×base-unit=16px）をルール2が !important で 0 に潰しているのを、
        より高い詳細度＋!important で元に戻す。 */
.svc-row > .sd-row.sd-page__row {
  margin-top: calc(2*(var(--sjs-base-unit, var(--base-unit, 8px)))) !important;
}

/* 4-2) ページの白枠化（ルール1）が、デザイン面ではページタイトルや「設問を追加」
        ボタンを枠の外に追い出し、次ページ用に作るように見えてしまう問題:
        デザイン面では `.sd-page` の白背景・影・角丸を打ち消し、Creator 標準の
        余白に戻す（白枠が消えれば「設問を追加」もページの流れの一部に見える）。
        ルール1の `.sd-page`(詳細度1) を `.svc-page__content .sd-page`(詳細度2)＋
        !important で上書きする。padding は Creator 既定値に戻す。 */
.svc-page__content .sd-page {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: var(--sjs-base-unit, var(--base-unit, 8px)) calc(3*(var(--sjs-base-unit, var(--base-unit, 8px)))) 0 !important;
}

/**===============================
 * ENQ-601 スマホ画面対応（テキストサイズ）
 *  - スマホ幅でアンケートタイトル・ナビゲーションボタンを縮小
 *  - 回答者がフォントサイズ（小/中/大）を切り替えられる
 ================================*/

/* 文字サイズ切替: 祖先要素のクラスで SurveyJS の --sjs-font-size を上書きする。
   applyTheme が .sd-root-modern に inline で書くテーマ既定値に勝つため !important を付ける
   （!important 方式なのでテーマ既定値が何であっても成立する）。
   レンダリング完了タイミングに依存せず安定して適用される。 */
.font-size-small .sd-root-modern {
  --sjs-font-size: 14px !important;
}
.font-size-large .sd-root-modern {
  --sjs-font-size: 20px !important;
}

/* 文字サイズ切替ツールバーの体裁と表示制御。
   既定は非表示。表示は後段の @media (hover: none) and (pointer: coarse) に集約する
   （タッチ端末で判定する理由は同メディアクエリのコメント参照）。 */
.answer-font-size-toolbar {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
}
.answer-font-size-toolbar__label {
  font-size: 13px;
  color: #525252;
}
.answer-font-size-toolbar__btn {
  border: 1px solid #525252;
  border-radius: 9999px;
  background: linear-gradient(#fff, #eee);
  color: #363636;
  line-height: 1;
  cursor: pointer;
  padding: 6px 12px;
}
.answer-font-size-toolbar__btn[aria-pressed="true"] {
  background: #23b8bc;
  border-color: #23b8bc;
  color: #fff;
}
/* 小/中/大ボタンのフォント差で押しやすさと直感性を出す */
.answer-font-size-toolbar__btn--small { font-size: 12px; }
.answer-font-size-toolbar__btn--medium { font-size: 14px; }
.answer-font-size-toolbar__btn--large { font-size: 17px; }

/* スマホ等タッチ端末向けの表示調整（ENQ-601）。
   従来は @media (max-width: 768px) で幅判定していたが、スマホ横向き・大型機・折りたたみ
   （幅768px以上）でスマホ向け調整が外れてしまうため、入力方式（タッチ主体）で判定する。
   タッチ＋マウス併用のノートPC等は hover: hover を返すため対象外となり、PCの見た目は変わらない。 */
@media (hover: none) and (pointer: coarse) {
  .answer-font-size-toolbar {
    display: flex;
  }

  /* アンケートタイトルを小さく表示する（advanced header のタイトル。既定40px と大きい） */
  .sv-header__title .sd-title {
    font-size: 24px !important;
  }

  /* 「次へ」「前へ」（完了も同クラス）ボタンのサイズを小さくする */
  .sd-root-modern .sd-navigation__prev-btn,
  .sd-root-modern .sd-navigation__next-btn,
  .sd-root-modern .sd-navigation__complete-btn {
    padding: 8px 16px !important;
    font-size: 0.85em !important;
    min-width: auto !important;
  }
}

/* ============================================================
   FastEntry（一括入力）ダイアログの横幅を広げる。
   vendor の showModalPropertyEditor は cssClass 固定でダイアログを開くため
   生成時に識別クラスを渡せないが、モード切替 UI（.fast-entry-mode-switcher）は
   このダイアログ内にしか無いので :has() で特定できる。JS でのクラス付与や
   style タグ注入は不要（他のプロパティ編集ポップアップには影響しない）。
   幅を変えたいときは下の min() 内の 1200px / 94vw を調整する。
   ============================================================ */
.sv-popup__body-content:has(.fast-entry-mode-switcher) {
  /* min-width は「床」。表形式モードの .fast-entry-table は w-max（自然幅）なので、
     表が 1200px より広いときはモーダルが表幅に追従して広がり内側横スクロールが出ない。
     94vw に達したらそこで頭打ちし、従来どおり内側スクロールへフォールバックする。
     このセレクタの詳細度は 0,2,0（.sv-popup__body-content + :has() 内 1 クラス）。
     対する vendor は 2 本のルールで宣言する:
       survey-core:         .sv-popup--modal-popup > .sv-popup__container > .sv-popup__body-content        （0,3,0）
       survey-creator-core: .svc-creator-popup.sv-popup--modal-popup > .sv-popup__container > .sv-popup__body-content（0,4,0）
     いずれにも詳細度で勝てないため各プロパティに !important が必要。
     実効ルールはプロパティごとに違う: gap/padding は 4 クラス側、min-width は 3 クラス側が実効
     （「クラスを 3 つ並べれば !important を外せる」わけではない）。 */
  min-width: min(1200px, 94vw) !important;
  gap: 12px !important; /* タイトル「選択肢」と本文の縦余白（vendor 既定 32px・SurveyJS v2.3.4 時点）を圧縮 */
  padding-left: 8px !important; /* body-content 自身の左右 padding（vendor 既定 32px・SurveyJS v2.3.4 時点）を圧縮 */
  padding-right: 8px !important;
}

.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-container-modern {
  max-width: none !important;
}

/* 枠だけ広げても survey 本体（.sd-body）は max-width・中央寄せ・左右 padding で
   追従しないため、幅チェーン（body→page→row→question→textarea）を枠いっぱいに広げる。
   これで入力欄が拡幅後のモーダル幅いっぱいまで伸びる。 */
.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-body {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
}

.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-page,
.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-row,
.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-question {
  max-width: none !important;
  width: 100% !important;
}

/* 左右インデントを詰めて入力領域に回す（.sd-page / 質問コンテンツの左右 padding）。 */
.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-page,
.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-question__content {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* テキスト入力モードの comment は sd-element--with-frame（vendor 既定 左右40px・SurveyJS v2.3.4 時点）が付くため詰める。 */
.sv-popup__body-content:has(.fast-entry-mode-switcher) .sd-element--with-frame {
  padding-left: 12px !important;
  padding-right: 12px !important;
}

/* テキスト入力モードの comment（textarea.sd-comment）だけを枠いっぱいに広げる。
   表形式モードで jspreadsheet がセル編集時に生成する textarea には効かせない
   （汎用 textarea を対象にするとセルエディタの寸法が壊れるため .sd-comment に限定）。 */
.sv-popup__body-content:has(.fast-entry-mode-switcher) textarea.sd-comment {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
