/**===============================
 * アンケート全体に対する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;
}

/* HTML質問はタイトル行を持たず(hasTitle=false)、本文が質問コンテンツ(.sd-question__content)内に
   描画されるため、`.sd-body--responsive .sd-question__content` の左インデントが本文自体に当たって
   しまう。HTML質問だけインデント対象から除外し、通常の質問のタイトルと左位置を揃える。
   sd-question--html は survey-core v2.3.4 の css定義 html.mainRoot でHTML質問ルート要素に付与される。 */
.sd-body--responsive .sd-question--html .sd-question__content {
  padding-left: 0;
}

/* Creator側は回答画面と違い 0 にしてはいけない。vendor(survey-creator-core v2.3.4)が
   `.svc-question__content:not(...--composite-question) .sd-question__content` に
   margin-left: calc(-5 * base) を当てており、ラッパー .svc-question__content 側の
   padding-left: calc(5 * base) と相殺する構造になっている。ここを 0 にすると負マージンだけが残り、
   本文がタイトル行より 5*base 分だけ左へ飛び出す。よって同じ calc 値で打ち消す。
   固定px(40px)にすると theme_json の cssVariables で --sjs-base-unit を変えた際に
   vendor の負マージンだけが追従してズレが再発するため、必ず変数計算で揃える。 */
.svc-question__content .sd-question--html .sd-question__content {
  padding-left: calc(5 * (var(--sjs-base-unit, var(--base-unit, 8px)))) !important;
}

/* Creatorモバイル幅では vendor の負マージンが calc(-3 * base) に切り替わるため、相殺値も合わせる。 */
.svc-creator--mobile .svc-question__content .sd-question--html .sd-question__content {
  padding-left: calc(3 * (var(--sjs-base-unit, var(--base-unit, 8px)))) !important;
}

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

/* 枠外要素（aboveTitleHtml＝タイトルの上／outsideTitleHtml＝タイトルの下）と
 * タイトル・選択肢の間の隙間 */
.sv-above-title-html,
.sv-outside-title-html {
  margin-bottom: 1em;
}

/* aboveTitleHtml/outsideTitleHtmlの幅はみ出し対策（ENQ-978 → ENQ-1100でスコープ撤廃）
 * これらは素のdivを挿入するだけで幅・折り返しの制約を自前で持たず親要素に依存する。
 * ENQ-978では編集タブ(.svc-question__content)限定で対処したが、プレビュー・回答画面は
 * .svc-question__content を経由しないため対象外のままだった。実機DOM計測の結果、
 * これらの画面では親の .sd-row__question が持つ vendor の
 * `white-space: nowrap`（ENQ-1048と同じ発生源）を継承し、長文HTMLが折り返されず
 * 右方向へはみ出すことを確認した。編集タブ・プレビュー・回答画面・モバイル幅のすべてで
 * 同じ折り返しにするため、スコープを付けず両クラスへ適用する。
 *
 * white-space / overflow-wrap は継承プロパティのため、対象クラス自身へ直接指定するだけで
 * 継承値に勝てる（継承値は詳細度・読み込み順の競合に参加しない）。配下への `*` と
 * !important は付けない。付けると枠外要素内のHTMLが持つ指定
 * （customCSS・同梱<style>・インラインstyle・<pre>のブラウザ既定値）まで黙って潰し、
 * 回避手段が無くなるため。枠外要素は作成者が任意HTMLを書ける唯一の場所で、
 * ツールボックスの「参加同意」テンプレートも outsideTitleHtml 内に <style> を同梱している。
 *
 * 画像(<img>)や固定幅テーブルの横はみ出しは本指定では解決しない（max-width は枠外要素
 * 自身にしか効かないため）。再発時は配下要素側への指定（例: `... img { max-width: 100% }`）
 * が別途必要。ENQ-1100の対応範囲外として意図的に見送っている。 */
.sv-above-title-html,
.sv-outside-title-html {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

/* ENQ-1083 HTML質問等で、span/div/p/td の祖先タグ（b/strong/見出し/code等）
 * からの文字装飾の継承がCSSで打ち消される問題への対処。
 * SurveyJSの既定(v2.3.4)は .sd-html(html要素)内の td/span/div/p へ
 * font-size:16px, font-weight:400, font-family, letter-spacing, line-height,
 * text-indent を直接指定するため、<b><span>あ</span></b> や
 * <h1><span>あ</span></h1> の形では祖先タグの装飾が継承でしか届かず
 * 打ち消される（<span><b>あ</b></span> の順だけ効く非対称）。
 * 装飾を与える祖先タグ配下の該当4要素に限り inherit で継承へ戻す。装飾タグを
 * 挟まない素の span/div/p/td にはvendorのリセットを従来どおり残す。
 * 完了・回答済み・ローディング画面(.sd-completedpage等)にも同型のリセットが
 * あるが、本アプリでは completedHtml/loadingHtml 等を配信時に削除しており
 * (survey_creator_json_refactor.js)ユーザーHTMLが載らないため対象は.sd-htmlのみ。
 * font-style/text-transform/text-decoration はvendor側フォールバック値が
 * "normal" 等の引用符付き＝不正値で無効化されており継承が生きるため対象外
 * （em/i/u/s/del/ins は元から壊れない）。
 * さらに div.stitle/div.hline はカスタムCSSの既定値(全アンケートに載る)で
 * font-weight:bold を持ち、太字が消える不具合になるため、これらの中の
 * span/div/p/td にも継承させるべく装飾を与える祖先として同リストに加える。
 * クラスセレクタは大文字小文字を区別するので、customCSS側の定義に合わせて
 * .STITLE/.HLINE の大文字版も併記する。
 * div.tarea は同じくカスタムCSSの既定値だが line-height:1.3em のみで太字が
 * 消える不具合ではなく、加えると既存アンケートの行間が変わる(28px→20.8px)
 * ため対象外とする（ENQ-1083のスコープ外。tarea直下に b 等の装飾タグを挟む
 * 場合は b が祖先リストに残るため従来どおり継承される）。
 * div.stitle 等のクラスセレクタ(0-1-1)を含めた結果、全体の詳細度は 0-2-2 と
 * なるが、vendorのリセット(0-1-1)より高いままのため既存の動作に影響はなく、
 * レイアウトごとのCSS読み込み順に依らず勝つ。 */
.sd-html
  :is(b, strong, th, h1, h2, h3, h4, h5, h6, big, small, font, sup, sub, code, tt, kbd, samp, var, pre, div.stitle, div.STITLE, div.hline, div.HLINE)
  :is(span, div, p, td) {
  font-size: inherit;
  font-family: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-indent: inherit;
}

 /* カスタムエディタのバリデーションエラー */
[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法テーブルは左右項目の文字数に応じて列幅を伸ばし、max-width(300px)で折り返す。
   共通の .create-matrix-table{ width:50%; max-width:100% }(310-315) を継承したままだと、
   table-layout:auto の列分配がテーブル使用幅(50%かつ包含ブロック幅にクランプ)に収めようと
   左右テキスト列を max-content 未満へ比例圧縮し、セル max-width:300px に伸びる前に
   min-width:150px 付近で早期折り返ししてしまう(＝文字長が列幅に反映されない)。
   SD法のみテーブルを内容幅(max-content)でレイアウトすることで各列が自列の max-content まで
   伸び、左右テキスト列は td の max-width:300px で頭打ち＆折り返す。テーブルが包含ブロックを
   超えた分は .matrix-sd-container{ overflow-x:auto }(245-251) が横スクロールで吸収する。
   モバイル(<=768px)は 609-621 の @media が左右セルを 120px 固定にするため、
   min-width:769px でガードしてデスクトップのみに適用する(縦書き表頭 th・SA/MA/mix も非対象)。 */
@media (min-width: 769px) {
  .sd-matrix-table {
    width: max-content;
    max-width: none;
  }
}

.sd-matrix-table th:last-child,
.sd-matrix-table td:last-child{
  background-color: #f8f9fa;
  min-width: 150px;
  max-width: 300px;
  word-break: break-word;
  overflow-wrap: break-word;
}

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

/* SD法の左右項目セル：survey-core の .sd-row__question{white-space:nowrap} が継承され、
   brタグを含まない長文が折り返さず表からはみ出す。デスクトップでも white-space:normal で
   継承を遮断して折り返しを許可する（縦書き表頭 th は対象外なので影響なし）。
   これで既存の max-width:300px / word-break / overflow-wrap が「300pxで折り返す」意図どおり働く。
   モバイル(<=768px)は 609-621 の @media 側で対処済み。 */
.sd-matrix-table td:first-child,
.sd-matrix-table td:last-child {
  white-space: normal;
}

/* SD法の左列を右列(th/td:last-child)と対称にする。右項目 td:last-child は width 指定が無く
   max-content(<=300px)まで伸びて折り返すが、左列は共通の
   .create-matrix-table th:first-child, td:first-child(369-374)から width:150px を継承する。
   table-layout:auto では明示 width が「列の目標幅」として働くため、td だけ width:auto にしても
   同じ左列の表頭 th:first-child が width:150px で列を 150px に固定し続け、左列は伸びない
   (＝右と非対称のまま)。SA/MA/mix 共通の 369-374 は変更できないので、SD法の左列だけ
   th/td 両方の width ピンを外す。min-width:150(下限)は据え置き、max-width:300(上限)を右と同じく
   与え、内容幅に追従して 300px で折り返させる。
   ※ th:first-child は縦書き表肩(「A」等)だが writing-mode/height には触れず width のみ変更するため
   縦書き表示は不変。 */
.sd-matrix-table th:first-child,
.sd-matrix-table td:first-child {
  width: auto;
  max-width: 300px;
}
.sd-matrix-table td:first-child {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ENQ-1092「表側を非表示」対応。
   表側(左端の見出し列)を消すと、先頭のデータセル(ラジオ/入力)や先頭の列見出しが
   td:first-child / th:first-child に一致してしまい、表側用の幅(150px/モバイル120px)・
   max-width・text-align:left・折り返し指定がデータセル/列見出しへ誤適用される。
   table に付与した .matrix-hide-side を鍵に、これら先頭セル専用スタイルを打ち消して
   通常のデータセル/列見出しの見た目へ戻す。背景は各データセルの #fff !important 側で
   担保済みのため触れない(列見出し th の灰色背景も維持する)。
   ※ .matrix-hide-side が付かない(＝表側表示)ときは一切影響しない。 */
.create-matrix-table.matrix-hide-side td:first-child,
.matrix-text-container .create-matrix-table.matrix-hide-side td:first-child {
  width: auto;
  min-width: 60px;
  max-width: none;
  text-align: center;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

/* 先頭の列見出し(th)は幅ピンのみ解除して他の列見出しと同幅にする(背景等の th 既定は維持) */
.create-matrix-table.matrix-hide-side th:first-child {
  width: auto;
  min-width: 60px;
  max-width: none;
}

/* モバイル(<=768px)の 120px 固定(!important) を打ち消す */
@media (max-width: 768px) {
  .create-matrix-table.matrix-hide-side td:first-child,
  .create-matrix-table.matrix-hide-side th:first-child {
    width: auto;
    min-width: 36px;
    max-width: none !important;
  }
}

.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;
}

/* 絞り込み（selectableIf）による無効化状態（FA形式セル: text / comment 等） */
/* MA/SA の選択肢（上の #b0b0b0）よりも意図的に薄い #e0e0e0 にしている。
   FA は入力欄そのものを塗るため、同じ濃さだと入力済みの文字が読めなくなるため。 */
.selectable-if-disabled-cell input,
.selectable-if-disabled-cell textarea,
.selectable-if-disabled-cell select {
  background-color: #e0e0e0 !important;
  color: #777 !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;
}

/**===============================
 * プロパティグリッドのヘルプ文(?アイコンで展開される説明文)のテキスト選択許可
 * SurveyJS Creatorのデフォルト(.svc-creator__area の user-select: none を継承)を
 * 上書きし、説明文に載せた入力例をコピーして使えるようにする
 ================================*/
.spg-question__description,
.spg-question__description .sv-string-viewer {
  -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;
}

/*===============================
 * JSONエディタタブ（ENQ-1051 → ENQ-1177）
 * ENQ-1051 でエラー一覧をテキストエリアの上部へ移動（vendor 標準は下＝ページ下部で気付けない）。
 * ENQ-1177 でタブの描画自体を custom_survey_creator/json_editor_tab.js の自前コンポーネントへ
 * 差し替えたため、対象セレクタも vendor の .svc-json-editor-tab__errros_list から
 * 自前の .enq-json-* へ移した。上部配置は描画順（エラー一覧を先に出す）で満たしているため
 * order 指定は不要になった。
 ================================*/

/* エラー一覧。枠色は vendor のエラーアイコン色（.svc-json-error__icon）に合わせる。
   高さは vendor 既定（5行分）から広げ、多数のエラーでも一覧できるようにする（ENQ-1051 の踏襲）。 */
.enq-json-errors {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: 30vh;
  margin: 8px 8px 0;
  border: 2px solid #e50a3e;
  border-radius: 4px;
  background: var(--ctr-code-viewer-background-color, #fff);
}

.enq-json-errors__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(229, 10, 62, 0.3);
  background: rgba(229, 10, 62, 0.08);
  color: var(--ctr-code-viewer-text-color, #333);
  font-size: 13px;
  font-weight: 600;
}

.enq-json-errors__copy {
  flex: 0 0 auto;
  padding: 2px 10px;
  border: 1px solid #b9b9b9;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.enq-json-errors__copy:hover {
  background: #f2f2f2;
}

/* 書式エラーで検査が打ち切られていることの但し書き（json_editor_tab.js の PARSE_ERROR_NOTE） */
.enq-json-errors__note {
  flex: 0 0 auto;
  padding: 4px 8px 6px;
  border-top: 1px solid #ececec;
  color: #777;
  font-size: 12px;
  line-height: 1.5;
}

.enq-json-errors__list {
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.enq-json-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-top: 1px solid #ececec;
}

.enq-json-error:first-child {
  border-top: none;
}

/* ジャンプ先の行を出しているエラー行。どのエラーで飛んだのかを見失わないようにする */
.enq-json-error--active {
  background: rgba(229, 10, 62, 0.08);
}

/* vendor アイコンの寸法・色はそのまま使い、行頭の位置だけ揃える。
   詳細度 (0,2,0) が vendor の (0,1,0) に勝つため !important 不要。 */
.enq-json-error .svc-json-error__icon {
  flex: 0 0 auto;
  margin-top: 3px;
}

/* エラー文はドラッグして選択・コピーできること自体が要件
   （vendor は .svc-json-errors__item に pointer-events: none を当てていて選択できない）。 */
.enq-json-error__body {
  flex: 1 1 auto;
  color: var(--ctr-code-viewer-text-color, #333);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  user-select: text;
}

.enq-json-error__jump {
  margin-right: 6px;
  padding: 0 6px;
  border: 1px solid #b9b9b9;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.enq-json-error__jump:hover {
  background: #f2f2f2;
}

/* 英語原文（検索や外部での調査に使えるよう残す） */
.enq-json-error__en {
  display: block;
  margin-top: 2px;
  color: #777;
  font-family: var(--ctr-font-family-code, monospace);
  font-size: 12px;
  word-break: break-word;
}

/* 行番号カラム＋テキストエリアの横並び */
.enq-json-editor__body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* 行番号カラム。フォント指標（font-family/size/line-height）を
   vendor の .svc-json-editor-tab__content-area と同一の custom property で揃えないと行がずれる。
   色も同じ --ctr-code-viewer-* を先に見る（v2.3.4 のCSSはこれらを定義していないので、
   いまはフォールバック側＝従来の色がそのまま出る）。ハードコードのままだと、テーマがこれらを
   定義したときにテキストエリアだけ色が変わり、行番号カラムだけ浮くため。
   padding-top もテキストエリアと同値にすること（1行目の開始位置を合わせるため）。
   padding-bottom はテキストエリア側に出る横スクロールバーの分の余白
   （これが無いと最下部までスクロールしたとき行番号側だけ手前で止まる）。 */
.enq-json-editor__gutter {
  flex: 0 0 auto;
  overflow: hidden;
  padding: 8px 8px 24px 12px;
  border-right: 1px solid var(--ctr-code-viewer-code-error-row-border-color, var(--sjs-border-25, #dcdcdc));
  background: var(--ctr-code-viewer-background-color, #f7f7f7);
  color: var(--ctr-code-viewer-text-color, #999);
  font-family: var(--ctr-font-family-code, monospace);
  font-size: var(--ctr-font-code-size, var(--sjs-font-size-x2));
  line-height: var(--ctr-font-code-line-height, var(--sjs-line-height-x3));
  text-align: right;
  white-space: pre;
  user-select: none;
}

.enq-json-editor__gutter-line--error {
  color: #e50a3e;
  font-weight: 700;
}

.enq-json-editor__gutter-line--active {
  background: #e50a3e;
  color: #fff;
}

/* 行番号と行を1対1で対応させるため折り返さない（長い行は横スクロール）。
   併せてサイズ指定を「行番号カラムとの横並び」で成立する形へ上書きする
   （vendor は width/height 100% + content-box のため、そのままだと横並びで溢れる）。
   詳細度 (0,2,0) が vendor の .svc-json-editor-tab__content-area (0,1,0) に勝つため !important 不要。 */
.enq-json-editor .svc-json-editor-tab__content-area {
  flex: 1 1 auto;
  width: auto;
  height: auto;
  box-sizing: border-box;
  padding: 8px 12px;
  overflow: auto;
  white-space: pre;
  resize: none;
}

/* ENQ-1203: 通知バナー（.svc-notifier）をビューポート固定にする。
   vendor(survey-creator-core v2.3.4) は position: absolute;
   bottom/left: var(--sjs-base-unit, var(--base-unit, 8px))（変数未定義時に 8px。vendor 側に
   --sjs-base-unit の定義は無く theme_json の cssVariables 等で注入される前提のため、px 値では書かない）;
   z-index: 1600 を当て、positioned 祖先 .svc-creator__area の下端を基準に置く（ルートの
   .svc-creator も relative だが最近接は __area）。Creator のマウント先のうち
   survey_creators/_form_creator.html.erb と theme_templates/_form_theme.html.erb は高さ上限が無く
   ページ全体がスクロールするため、アンケートが長いとエリア下端＝ページ最下部となり、失敗通知
   （保存不可・sanitize失敗等の永続バナー）がスクロールしないと見えない。
   position だけを fixed に上書きすると、vendor の bottom/left 宣言がビューポート基準に読み替わり、
   スクロール位置に関わらず常に画面左下へ表示される（他の宣言は vendor のまま生かす）。
   同じ要素は自動消滅する info/success 通知（creator.notify）にも共用されるため、それらも同様に固定される。
   survey/preview 等（survey_private_controller）のマウント先は h-screen で元々ビューポート下端付近のため
   見た目は変わらない。
   詳細度: vendor の .svc-notifier は (0,1,0) で、読み込み順はレイアウトにより逆転する
   （layouts/application.html.erb は :app→vendor、layouts/private_survey.html.erb は vendor→custom_survey_js）。
   順序に依存させないため .svc-creator を前置して (0,2,0) で勝たせる（!important 不要）。
   モバイル用 .svc-creator--mobile .svc-notifier は position を宣言しない（bottom/width/z-index のみ
   上書きし z-index は 1000 へ降格）ため、本ルールの fixed がそのまま効く。
   注意: 祖先に transform / filter / perspective / will-change / contain が付くと fixed の含有ブロックが
   ビューポートからその祖先へ移り、エラーも出ないまま本修正が無効化される（= ENQ-1203 の再発）。
   通知バナーは vendor の z-index:1600 のままなので、アプリ側モーダル（_form_creator.html.erb の
   z-[1100]〜z-[1300]）より手前に出る。 */
.svc-creator .svc-notifier {
  position: fixed;
}
