:root {
  --font-sans:
    'M PLUS 1p', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'YuGothic', Meiryo, sans-serif;

  --font-serif:
    'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', 'YuMincho', 'MS PMincho', serif;
}

html,
body {
  font-family: var(--font-sans);
  -webkit-text-size-adjust: 100%;
}

* {
  margin: 0;
  padding: 0;
  color: #333;
}

body {
  height: 100vh;
  position: relative;
}

.logoWrap {
  text-align: left;
  position: fixed;
  z-index: -1;
}

.logo {
  margin: 40px;
  width: 55px;
}

#contents {
  background: url(../img/step_bg.png) left top/cover no-repeat;
}

/* index.php：中央寄せ */
#contents:not(.s_page) form {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  max-width: 300px;
}

/* 共通ボタンデザイン＆ファイル選択ボタン */
.file-input-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#contents:not(.s_page) form button:not(.link-toggle),
.file-label {
  background-color: #222222;
  color: #fff;
  width: 300px;
  height: 70px;
  line-height: 70px;
  cursor: pointer;
  text-align: center;
  display: inline-block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: bold;
  border: 1px solid #222;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.12);
}

/* size.php の「作品台選択」ボタンだけアイコンスペースを空ける */
#contents form button#selectBase:not(.link-toggle) {
  padding-left: 40px;
}

/* ホバー時（ボタン＆ファイルラベル共通） */
#contents form button:not(.link-toggle):hover,
.file-label:hover {
  background-color: #fff;
  color: #222;
  border: 1px solid #ddd;
}

/* ボタン・ラベル共通のアイコン枠 */
#contents form button:not(.link-toggle)::before,
.file-label::before {
  content: '';
  display: inline-block;
  width: 50px;
  height: 48px;
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background-position: left center;
  background-size: contain;
  background-repeat: no-repeat;
}

/* ファイルアップロード（カメラアイコン） */
.file-label::before {
  background-image: url(../img/icon_camera_wht.png);
}

/* index.php の「サイズ入力」ボタン（定規アイコン） */
#contents form button#input-size:not(.link-toggle)::before {
  background-image: url(../img/icon_meajur_wht.png);
}

/* size.php の「作品台選択」ボタン（シミュレーションアイコン流用） */
#contents form button.selectSize:not(.link-toggle)::before,
#contents form button#selectBase:not(.link-toggle)::before {
  background-image: url(../img/icon_simulation_wht.png);
  width: 46px;
  height: 36px;
}

/* ホバーでアイコンを黒版に */
.file-label:hover::before {
  background-image: url(../img/icon_camera_blk.png);
}

#contents:not(.d_page) form button#input-size:hover::before {
  background-image: url(../img/icon_meajur_blk.png);
}

#contents form button#selectBase:not(.link-toggle):hover::before {
  background-image: url(../img/icon_simulation_blk.png);
}

/* 説明テキスト（index / size 共通） */
#contents p.txt {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
}

#contents p.txt strong {
  color: #fff;
}

/* ファイル名エリア（今回はテキストは非表示運用だけど念のため残す） */
.file-name {
  margin-top: 10px;
  color: #333;
  font-size: 14px;
}

.icon-wrapper {
  text-align: center;
  margin-bottom: 8px;
}

.icon-wrapper img {
  margin: 0;
}

h1.mail-ttl {
  font-family: var(--font-serif);
  color: #fff;
  margin-bottom: 30px;
  font-weight: 500;
  margin-left: -20px;
  margin-right: -20px;
  text-align: center;
  letter-spacing: 5px;
}

p.copy {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 12px;
  font-family: var(--font-serif);
  text-align: center;
  letter-spacing: 1px;
}

/* 画像プレビューボックス */
.image-preview {
  width: 298px;
  height: 298px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  text-align: center;
  background: #fff;
  border: 1px solid #dddddd;
}

.image-preview img {
  max-width: 75%;
  max-height: 75%;
  display: block;
  box-sizing: border-box;
  transition:
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

/* ▼落し：凹んで見える（エンボス風） */
.image-preview .preview-art.base-otoshi {
  display: block;
  box-sizing: border-box;
  max-width: 75%;
  max-height: 75%;
  margin: 0 auto;
  padding: 5px;
  background-color: #f7f7f7;

  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.4),
    inset 4px 4px 11px rgba(0, 0, 0, 0.5),
    inset -8px -8px 16px rgba(255, 255, 255, 0.7) !important;
}

/* base.php：#previewArt を作品比率にする（image-previewは触らない） */
#contents.base #previewArt.preview-art {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  width: 1px; /* JSで上書きされる前提のダミー */
  height: 1px; /* JSで上書きされる前提のダミー */
  max-width: 100%;
  max-height: 100%;
}

#contents.base #previewArt.preview-art.base-beta,
#contents.base #previewArt.preview-art.base-ukashi {
  max-width: 75%;
  max-height: 75%;
}

/* 新しめ：aspect-ratio */
@supports (aspect-ratio: 1 / 1) {
  #contents.base #previewArt.preview-art {
    aspect-ratio: var(--ar, 1 / 1);
  }
}

/* 古い環境：padding-top フォールバック */
@supports not (aspect-ratio: 1 / 1) {
  #contents.base #previewArt.preview-art {
    height: 0;
    padding-top: var(--pt, 100%);
  }
}

/* 背景がボーダーの下に回り込まないようにする */
.base #previewArt,
.base .image-preview #previewArt {
  background-clip: padding-box; /* 背景はborderの内側まで */
  background-origin: padding-box; /* 位置基準も内側に */
}

.base #previewArt {
  overflow: hidden; /* 角丸などの時にも効く */
}

.preview-art.base-otoshi {
  display: block;
  box-sizing: border-box;
  margin: 0 auto;

  padding: 8px;
  background-color: #f7f7f7;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0),
    inset 4px 4px 10px rgba(0, 0, 0, 0.5),
    inset -8px -8px 16px rgba(255, 255, 255, 0);
}

/* base.php のプレビューを select.php と同じ「div背景方式」にする */
.image-preview .preview-art {
  width: 75%;
  height: 75%;
  background-size: contain;
  background-repeat: no-repeat;
  box-sizing: border-box;
}

/* ▼浮し：浮き上がって見える */
.preview-art.base-ukashi,
.image-preview img.base-ukashi {
  background: #ffffff;
  border: 1px solid #ddd;
  box-shadow:
    0 4px 4px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.7);
  transform: translateY(-1px);
  background-size: contain;
}

/* ▼ベタ：指定どおり border のみ */
.preview-art.base-beta,
.image-preview img.base-beta {
  background: #ffffff;
  border: 1px solid #ccc;
  box-shadow: none;
  transform: none;
  background-size: contain;
}

/* 実ファイル入力は隠す */
#imageInput {
  display: none;
}

/* ---- size.php 用 ---- */

.size-form {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 320px;
  width: 90%;
  display: grid;
  gap: 2px;
}

.size-inputs {
  display: grid;
  gap: 8px;
}

.size-inputs label {
  display: grid;
  gap: 0;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
}

.size-inputs input[type='number'] {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.size-alert {
  color: #c00;
  font-size: 14px;
  font-weight: 700;
}

.size-form .image-preview {
  margin-bottom: 5px;
}

.size-form button {
  margin-top: 6px !important;
}

.size-form p.txt {
  margin-top: 3px;
}

/* ===== base.php 用：作品台ラジオボタン ===== */

.base-form .image-preview {
  margin-bottom: 10px;
}

.base-form {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 320px;
  width: 90%;
  display: grid;
  gap: 6px;
}

.base-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #fff;
}

.base-option-wrap {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 10px;
}

.base-options {
  display: grid;
}

.base-option {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  margin-right: 20px;
}

/* ネイティブのラジオは視覚的に隠す */
.base-option input[type='radio'] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* 外側の大きめの丸 */
.base-radio-circle {
  inline-size: 26px;
  block-size: 26px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #ddd;
  box-sizing: border-box;
  position: relative;
}

/* チェック時の内側の○（#90b3ad） */
.base-radio-circle::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #90b3ad;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

/* checked のときだけ内側の○を出す */
.base-option input[type='radio']:checked + .base-radio-circle::after {
  opacity: 1;
}

.base-label {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
}

/* 送信ボタン（入口ページとテイスト合わせ） */
.base-submit {
  background-color: #222222;
  color: #fff;
  width: 300px;
  height: 70px;
  line-height: 70px;
  cursor: pointer;
  text-align: center;
  display: inline-block;
  margin: 10px auto 0;
  font-size: 14px;
  font-weight: bold;
  border: 1px solid #222;
  transition: all 0.2s ease;
  position: relative;
  justify-self: center;
}

.base-submit:hover {
  background-color: #fff;
  color: #222;
  border: 1px solid #ddd;
}

/* ===============================
   select.php 用レイアウト
   =============================== */

.select-layout {
  display: flex;
  height: 100vh;
}

/* 左カラム：サイズ一覧 */
.select-list {
  position: relative;
  max-width: 300px;
  width: 100%;
  height: 100vh;
  box-sizing: border-box;
  padding: 18px 12px 0;
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid #dddddd;
  overflow-y: auto;
  scrollbar-color: #90b3ad #fff;
  scrollbar-width: thin;
}

.select-list-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.select-list-title {
  font-size: 15px;
  font-weight: 700;
}

.select-list-empty {
  font-size: 14px;
  color: #c00;
}

/* 一覧リスト */
.select-size-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.select-size-item {
  padding: 8px 4px 10px;
  border-bottom: 1px solid #e0e0e0;
}

.size-name {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

/* ==== select.php 左カラム専用：小さめカスタムラジオ ==== */

.size-orientation-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.size-radio-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.size-radio-option input[type='radio'] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.size-radio-circle {
  inline-size: 18px;
  block-size: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #bbb;
  box-sizing: border-box;
  position: relative;
}

.size-radio-circle::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #90b3ad;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.size-radio-option input[type='radio']:checked + .size-radio-circle::after {
  opacity: 1;
}

.size-radio-label {
  font-size: 15px;
}

.select-go-form {
  position: sticky;
  bottom: 0;
  padding: 12px 0;
  background: #fff;
  border-top: 1px solid #eee;
}

.select-next-button {
  width: 100%;
  padding: 10px 12px;
  background: #222;
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.select-next-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  pointer-events: none;
}

/* 右カラム：プレビュー */
.select-preview {
  flex: 1;
  height: 100vh;
  position: relative;
  box-sizing: border-box;
  padding: 70px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.select-preview-inner {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.select-preview-message {
  font-size: 16px;
  color: #666;
  text-align: center;
}

.preview-box {
  max-width: 80%;
  max-height: 80%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-frame {
  position: relative;
  box-sizing: border-box;
  background: #fdfdfd;
  margin: 0 auto;
  --frame-border: 12px; /* JSが上書きする */
  clip-path: none;
}

/* 四隅の留め線 */
.preview-frame .frame-miter {
  position: absolute;
  width: var(--frame-border, 12px);
  height: var(--frame-border, 12px);
  pointer-events: none;
  z-index: 5; /* 枠（inset shadow）より前に */
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* TL と BR は同じ向き（外角→内角） */
.preview-frame .frame-miter--tl {
  top: 0;
  left: 0;
  background-image: linear-gradient(
    45deg,
    transparent 47%,
    rgba(0, 0, 0, 0.35) 49.6%,
    rgba(0, 0, 0, 0.35) 51%,
    transparent 50.4%
  );
}

.preview-frame .frame-miter--br {
  right: 0;
  bottom: 0;
  background-image: linear-gradient(
    45deg,
    transparent 47%,
    rgba(0, 0, 0, 0.35) 49.6%,
    rgba(0, 0, 0, 0.35) 51%,
    transparent 50.4%
  );
}

/* TR と BL は逆向き */
.preview-frame .frame-miter--tr {
  top: 0;
  right: 0;
  background-image: linear-gradient(
    -45deg,
    transparent 47%,
    rgba(0, 0, 0, 0.35) 49.6%,
    rgba(0, 0, 0, 0.35) 51%,
    transparent 50.4%
  );
}

.preview-frame .frame-miter--bl {
  left: 0;
  bottom: 0;
  background-image: linear-gradient(
    -45deg,
    transparent 47%,
    rgba(0, 0, 0, 0.35) 49.6%,
    rgba(0, 0, 0, 0.35) 51%,
    transparent 50.4%
  );
}

.preview-art {
  box-sizing: border-box;
  border-color: #666;
}

/* 影は外側ラッパーにだけ付ける */
.d_page .frame-shadow,
.s_page .frame-shadow {
  display: inline-block;
  position: relative;
  overflow: visible; /* 影を切らない */
}

/* 内側のフレームは“描画を切る役” */
.d_page .frame-shadow > .preview-frame,
.s_page .frame-shadow > .preview-frame {
  overflow: hidden; /* 留線を外に出さない */
  clip-path: inset(0); /* 念のため（角あり） */
}

/* 角丸フレームの時だけ丸で切る（今のクラスに合わせる） */
.d_page .frame-shadow > .preview-frame.frame-type-sumimaru,
.s_page .frame-shadow > .preview-frame.frame-type-sumimaru {
  border-radius: 22px; /* ←今の角丸に合わせて調整 */
  clip-path: inset(0 round 22px);
}

/* =========================================================
   フレーム内側シャドウ（インナー）
   - 外側shadow(frame-shadow)とは別
   - 枠なし(frame-mode-nashi)では出さない
   ========================================================= */
.preview-frame {
  position: relative; /* 念のため */
}

.preview-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 0 !important;
  /* 内側の陰影 + ほんのり内側ライン */
  box-shadow:
    rgba(255, 255, 255, 0.4) 0px 0px 0px 0px inset,
    rgba(0, 0, 0, 0.3) 4px 4px 10px 0px inset,
    rgba(255, 255, 255, 0.1) -8px -8px 16px 0px inset !important;
  /* 留め線(miter-layer)等が上にある想定：必要なら数字だけ調整 */
  z-index: 4;
}

/* 枠なしモードでは内側シャドウは消す */
.preview-frame.frame-mode-nashi::after {
  display: none;
}

/* 右上の作品サイズ情報 */
.select-size-info {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #dddddd;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
  box-sizing: border-box;
}

.select-size-info-title {
  font-weight: 500;
  margin-bottom: 2px;
  text-align: left;
}

.select-size-info-row {
  white-space: nowrap;
}

.select-size-info-row-cm {
  font-weight: 600;
}

.select-size-info-row-mm {
  font-size: 11px;
  color: #777;
}

/* select.php 共通：SP専用トグル/黒幕の初期状態（PCでは非表示） */
.select-list-toggle,
.select-list-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .select-layout {
    height: 100vh;
  }

  .select-list {
    position: fixed;
    top: 0;
    left: 0;
    width: 200px;
    max-width: 80%;
    height: 100vh;
    padding: 30px 10px 0;
    background: rgba(255, 255, 255, 0.9);
    border-right: 1px solid #dddddd;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .select-list-inner {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-bottom: 100px;
    box-sizing: border-box;
  }

  .select-list.is-open {
    transform: translateX(0);
  }

  .select-go-form {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    padding: 10px;
    background: #fff;
    border-top: 1px solid #eee;
    z-index: 1;
    touch-action: pan-x;
    overscroll-behavior: contain;
  }

  .select-go-form::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -100px;
    height: 100px;
    background: #fff;
  }

  .select-preview {
    padding: 16px 10px 16px;
    height: 100vh;
  }

  .preview-box {
    max-width: 95%;
    max-height: 95%;
  }

  .select-list-toggle {
    display: block;
    position: fixed;
    left: 0;
    top: 50%;
    transform: translate(-10%, -50%);
    padding: 25px 14px;
    background: #222;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    border: none;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.1em;
    z-index: 10;
    cursor: pointer;
  }

  .select-list-toggle.is-open {
    background: #444;
  }

  .select-list-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-out;
    z-index: 15;
  }

  .select-list-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  .logo {
    width: 40px;
    margin: 25px;
  }
  .size-name {
    font-size: 13px;
  }
  .size-radio-label {
    font-size: 13px;
  }
  .size-radio-circle {
    inline-size: 16px;
    block-size: 16px;
  }
  .size-orientation-options {
    gap: 6px 12px;
  }
  .select-next-button {
    font-size: 13px;
    padding: 12px;
  }
  .select-size-list {
    padding: 0 0 46px;
  }
}

/* ============================================================
   display.php（額装）専用 : .d_page に完全隔離
   - ここから下は display.css + 軸装移植分を統合
   - 他ページへは一切漏れない（必ず .d_page スコープ）
   ============================================================ */

/* --- display専用 変数（グローバル :root は使わない） --- */
.d_page {
  --editor-btn-h: 42px;
  --vv-bottom: 0px;
  --acc-open-pad-y: 5px;
  --sliderBoxH: 220px;
}

/* --- スクロールロック（モーダル/エディタ開閉用） --- */
html.no-scroll,
body.no-scroll {
  overflow: hidden;
  height: 100%;
}
body.no-scroll {
  position: fixed;
  width: 100%;
}

/* ---------- z-index レイヤー ---------- */
.d_page .edit-icon {
  position: fixed;
  z-index: 120;
}
.d_page .quick-menu,
.d_page .size-info-wrap,
.d_page #zoomSliderBox {
  z-index: 110;
}
.d_page .editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.d_page .style-editor {
  position: fixed;
  z-index: 220;
}
.d_page .sub-editor {
  position: fixed;
  z-index: 215;
}
.d_page .layout-editor {
  position: fixed;
  z-index: 210; /* ★style-editor の後ろ */
}

/* ---------- zoomistを全画面として成立させる ---------- */
.d_page #zoomist {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.d_page #zoomist .zoomist-wrapper,
.d_page #zoomist .zoomist-image {
  width: 100%;
  height: 100%;
  background: #fff;
}

/* frame-stage が高さを持たないと preview-frame が潰れる */
.d_page .frame-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* displayでは selectの .preview-box を上書き（親100%高さ前提） */
.d_page .preview-box {
  width: 100%;
  height: 100%;
  max-width: 80%;
  max-height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SP は少し広げる */
@media (max-width: 768px) {
  .d_page .preview-box {
    max-width: 95%;
    max-height: 95%;
  }
}

/* ---------- editor-backdrop ---------- */
.d_page .editor-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}
.d_page .editor-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================================
   STYLE EDITOR
   ========================================================= */
.d_page .style-editor {
  top: 0;
  left: 0;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: -webkit-fill-available;

  width: 210px;
  max-width: 86vw;

  background: rgba(238, 238, 238, 0.75);
  border-right: 1px solid #ddd;
  transform: translateX(-105%);
  transition: transform 0.25s ease-out;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;

  padding-bottom: calc(
    var(--editor-btn-h, 44px) + 12px + max(8px, env(safe-area-inset-bottom)) + var(--vv-bottom)
  );
}

.d_page .style-editor.is-open {
  transform: translateX(0);
}

/* --- heading --- */
.d_page .style-editor .editor-heading {
  margin: 0;
  padding: 12px 36px 12px 16px;
  background-color: #323334;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-align: left;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;

  border: 0;
  width: 100%;
  display: block;
  background-clip: padding-box;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  box-sizing: border-box;
}

.d_page .style-editor .editor-heading:focus,
.d_page .style-editor .editor-heading:focus-visible {
  outline: none;
}

.d_page .style-editor .editor-heading::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 1px solid #fff;
  border-bottom: 1px solid #fff;
  transform: translateY(-80%) rotate(45deg);
  transition: transform 0.3s ease;
}
.d_page .style-editor .editor-heading.is-open::after {
  transform: translateY(-30%) rotate(-135deg);
}

.d_page .style-editor .editor-body + .editor-heading {
  margin-top: 2px;
}

/* --- ボタン --- */
.d_page .style-editor .editor-btn {
  position: relative;
  width: 100%;
  height: 42px;
  background: #fff !important;
  color: #222 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 42px 0 10px;
  font-size: 15px;
  font-weight: 700;
  outline: none;
  border: 1px solid #fff;

  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}
.d_page .style-editor .editor-btn::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 19px;
  height: 19px;
  background: #90b3ad;
  border-radius: 50%;
  pointer-events: none;
}
.d_page .style-editor .editor-btn::before {
  content: '';
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #fff;
  pointer-events: none;
  z-index: 1;
}
.d_page .style-editor .editor-btn:hover,
.d_page .style-editor .editor-btn:focus {
  border-color: #90b3ad !important;
  outline: none;
}

.d_page .style-editor .editor-btn.frame-type-btn {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid #acacac !important;
  color: #333;
  box-shadow: none;
}

.d_page .style-editor .editor-btn.frame-type-btn.last {
  margin-bottom: 5px;
  border: none !important;
}

.d_page .style-editor .editor-btn.frame-type-btn:hover,
.d_page .style-editor .editor-btn.frame-type-btn.is-active {
  background: #fff !important;
  border-bottom: solid 1px #90b3ad !important;
}

.d_page .style-editor .editor-btn.frame-type-btn:before,
.d_page .style-editor .editor-btn.frame-type-btn:after {
  display: none !important;
}

.editor-palette.frame-type-list {
  gap: 0px;
}

/* --- backlink --- */
.d_page .style-editor .editor-backlink {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 70px;
  z-index: 10060;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  background: transparent;
  color: #333;
  text-decoration: none;
  box-sizing: border-box;

  border: 0;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
}
.d_page .style-editor .editor-backlink:hover {
  opacity: 0.75;
}
.d_page .style-editor .editor-backlink .icon {
  width: 0.8em;
  height: 0.8em;
  pointer-events: none;
}
.d_page .style-editor .editor-backlink span {
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

.d_page .style-editor .editor-backlink_d {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid #aaa;
  color: #333;
  text-decoration: none;
  box-sizing: border-box;
  pointer-events: auto;
  touch-action: manipulation;
}
.d_page .style-editor .editor-backlink_d:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: #90b3ad;
}
.d_page .style-editor .editor-backlink_d .icon {
  width: 0.8em;
  height: 0.8em;
  pointer-events: none;
}
.d_page .style-editor .editor-backlink_d span {
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

/* --- アコーディオン --- */
.d_page .style-editor .editor-heading + .editor-body {
  display: block !important;
}
/* --- アコーディオン（grid方式：カクつき防止） --- */
.d_page .style-editor .editor-heading + .editor-body {
  display: grid !important;
}

.d_page .style-editor .editor-body {
  /* heightを触らない */
  grid-template-rows: 0fr;
  transition:
    grid-template-rows 0.32s cubic-bezier(0.35, 0.1, 0.15, 1),
    opacity 0.24s ease-out;
  opacity: 0;

  /* 左右は従来どおり */
  padding-left: 5px;
  padding-right: 5px;

  /* 重要：中身はinner側で隠す */
  overflow: hidden;
}

.d_page .style-editor .editor-body.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

/* JSが作るinner（中身をここに入れる） */
.d_page .style-editor .editor-body > .editor-body-inner {
  min-height: 0; /* grid折りたたみ必須 */
  overflow: hidden; /* 0fr時に中身が見えないように */
}

/* --- アコーディオン（grid方式：カクつき防止） --- */
.d_page .style-editor .editor-heading + .editor-body {
  display: grid !important;
}

.d_page .style-editor .editor-body {
  /* heightを触らない */
  grid-template-rows: 0fr;
  transition:
    grid-template-rows 0.32s cubic-bezier(0.35, 0.1, 0.15, 1),
    opacity 0.24s ease-out;
  opacity: 0;

  /* 左右は従来どおり */
  padding-left: 5px;
  padding-right: 5px;

  /* 重要：中身はinner側で隠す */
  overflow: hidden;
}

.d_page .style-editor .editor-body.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  padding-top: 5px;
  padding-bottom: 5px;
}

/* JSが作るinner（中身をここに入れる） */
.d_page .style-editor .editor-body > .editor-body-inner {
  min-height: 0; /* grid折りたたみ必須 */
  overflow: hidden; /* 0fr時に中身が見えないように */
}

.seg-radio .seg-items.cols-2 {
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.seg-radio .seg-items {
  display: grid;
  grid-auto-rows: 42px;
  width: 100%;
  margin-bottom: 5px;
}

.seg-radio .seg-item {
  width: 100%;
  height: 100%;
  padding: 0 14px;
  background: #acacac;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  border: none !important;
}

.seg-radio .seg-item.is-active {
  background: #fff;
  color: #333;
  border: solid 1px #90b3ad !important;
}

/* =========================================================
   額縁（あり/なし）UI：表示切替
   ========================================================= */
.d_page .style-editor .editor-body.e_frame .frame-pane {
  display: none;
}
.d_page .style-editor .editor-body.e_frame.is-frame-ari .frame-pane--ari {
  display: block;
}
.d_page .style-editor .editor-body.e_frame.is-frame-nashi .frame-pane--nashi {
  display: block;
}

/* 額縁：ボタンの“選択中”表示（軸線っぽく） */
.d_page .style-editor .editor-body.e_frame .editor-btn.is-active {
  border-color: #90b3ad !important;
}

/* =========================================================
   額縁「あり」：26型隅丸 → preview-frame を角丸に
   ※ preview-frame は clip-path: inset(0) があるので、隅丸時は解除
   ========================================================= */
.d_page .preview-frame.frame-type-sumimaru {
  clip-path: none !important;
  border-radius: 18px;
  overflow: visible !important;
}

/* 26型隅丸：留め線を角丸の内側に収める */
.d_page .preview-frame.is-round {
  clip-path: none !important;
  overflow: hidden !important;
}

.d_page .preview-frame.frame-type-sumimaru .miter-layer,
.d_page .preview-frame.is-round .miter-layer {
  display: none !important;
}

/* =========================================================
   額縁「あり」相当：= 「なし」じゃない時に外側へ影
   ========================================================= */
.d_page .preview-frame:not(.frame-mode-nashi) {
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.38)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}

/* =========================================================
   アクリル鏡面：常時（あり/なし共通のベース）
   目的：
   - 額縁（内側シャドウ/留め線/FX）より下
   - 作品/台紙/マットより上
   - 「なし」は従来どおり強めに上書き
   ========================================================= */

/* まず stacking の前提を固定（安全） */
.d_page .preview-frame,
.s_page .preview-frame {
  position: relative;
}

/* 中身（作品/台紙/マット）が frame-clip 配下なら、そこを下層に固定 */
.d_page .preview-frame .frame-clip,
.s_page .preview-frame .frame-clip {
  position: relative;
  z-index: 1;
}

/* ★常時アクリル（=「あり」時はここが効く） */
.d_page .preview-frame > .acryl-overlay,
.s_page .preview-frame > .acryl-overlay {
  position: absolute;

  /* 「額縁の下に入り込む」＝枠の内側だけに出す
     select.php では --frame-border があるのでそれ優先、なければ 12px */
  inset: var(--acryl-inset, var(--frame-border, 12px));

  pointer-events: none;

  /* frame の内側シャドウ(::after z-index:4) や留め線(z=5)より “下”
     かつ作品より “上” */
  z-index: 2;

  /* 「あり」時は控えめ（好みで 0.25〜0.45） */
  opacity: 0.75;

  /* はみ出しで“ぷっつり”を防ぐ（三角もここで確実に収める） */
  overflow: hidden;
  border-radius: none;

  /* 既存の見た目を流用（必要ならここはあなたの好みに寄せてOK） */
  background:
    var(--acryl-extra, none),
    radial-gradient(120% 100% at 30% 20%, rgba(180, 215, 255, 0.18) 0%, rgba(180, 215, 255, 0) 55%),
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.1) 0%,
      rgba(0, 0, 0, 0) 18%,
      rgba(0, 0, 0, 0) 82%,
      rgba(0, 0, 0, 0.1) 100%
    ),
    linear-gradient(
      to right,
      rgba(0, 0, 0, 0.1) 0%,
      rgba(0, 0, 0, 0) 18%,
      rgba(0, 0, 0, 0) 82%,
      rgba(0, 0, 0, 0.1) 100%
    );
}

/* ★鏡面（三角ハイライト）＝左上固定の共通三角
   - 2等辺の一辺 = “短辺×2/3”
   - JSが --acryl-tri を px で入れる（CSSだけだと短辺参照が厳密にできない）
   - テイスト（グラデ）は現状のまま */
.d_page .preview-frame > .acryl-overlay::before,
.s_page .preview-frame > .acryl-overlay::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;

  /* ★ここがサイズ：JSが px を入れる。無い場合の保険で 66.666% */
  width: var(--acryl-tri, 66.666%);
  height: var(--acryl-tri, 66.666%);

  /* 左上の直角二等辺三角形 */
  clip-path: polygon(0 0, 100% 0, 0 100%);

  /* テイストは触らない（元の三角と同じグラデ） */
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0) 21%,
    rgba(255, 255, 255, 0.07) 41%,
    rgba(255, 255, 255, 0.25) 100%
  );

  opacity: 0.7; /* あり時は控えめ */
}

/* =========================================================
   額縁「なし」：アクリル板オーバーレイ（常時表示・fixに負けない版）
   - ★アクリルは .acryl-overlay 要素に集約
   - ★鏡面（三角）は 共通三角（上と同じ）でOK
   ========================================================= */

/* なし：ベース */
.d_page .preview-frame.frame-mode-nashi {
  border-width: 0 !important;
  border-color: transparent !important;
  overflow: visible !important;
  clip-path: none !important;
  position: relative;
  filter: none !important;

  --acryl-extra: none;
}

/* ★もう ::after では描かない（fix側の ::after と衝突しないように） */
.d_page .preview-frame.frame-mode-nashi::after {
  content: none !important;
}

/* アクリル本体（常にこれが上に乗る） */
.d_page .preview-frame.frame-mode-nashi > .acryl-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;

  /* 何が来てもアクリルが最前に残るように強め */
  z-index: 999;

  /* なしでも三角が切れないように */
  overflow: hidden;

  background:
    var(--acryl-extra),
    radial-gradient(120% 100% at 30% 20%, rgba(180, 215, 255, 0.18) 0%, rgba(180, 215, 255, 0) 55%),
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.1) 0%,
      rgba(0, 0, 0, 0) 18%,
      rgba(0, 0, 0, 0) 82%,
      rgba(0, 0, 0, 0.1) 100%
    ),
    linear-gradient(
      to right,
      rgba(0, 0, 0, 0.1) 0%,
      rgba(0, 0, 0, 0) 18%,
      rgba(0, 0, 0, 0) 82%,
      rgba(0, 0, 0, 0.1) 100%
    );

  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 0 0 2px rgba(255, 255, 255, 0.12);

  opacity: 0.85;
}

/* なしの三角だけ少し強め（テイストは同じ、濃さだけ） */
.d_page .preview-frame.frame-mode-nashi > .acryl-overlay::before {
  opacity: 1;
}

/* 既存の後段指定は維持 */
.d_page .preview-frame.frame-mode-nashi {
  box-shadow: none !important;
  border: 3px solid #eee !important;
}

.d_page .preview-frame.frame-mode-nashi .miter-layer {
  display: none !important;
}

.d_page .preview-frame.frame-mode-nashi {
  border-radius: 0 !important;
}

/* ---------------------------------------------------------
   なし：共通（既存の後段指定を維持）
   --------------------------------------------------------- */
.d_page .preview-frame.frame-mode-nashi {
  box-shadow: none !important;
  border: 3px solid #eee !important;
}

.d_page .preview-frame.frame-mode-nashi .miter-layer {
  display: none !important;
}

.d_page .preview-frame.frame-mode-nashi {
  border-radius: 0 !important;
}

/* =========================================================
   なし：角留め（4角分割）
   - 各角ごとに“内側方向”へ drop-shadow
   - 光沢(::after)とは競合しない（角留めは子要素）
   ========================================================= */
.d_page .preview-frame.frame-mode-nashi.frame-fix-kadodome {
  position: relative;
  overflow: visible; /* 外側に少し出すので */
}

/* 角留めパーツ（共通） */
.d_page .preview-frame.frame-mode-nashi.frame-fix-kadodome > .kadodome {
  position: absolute;
  pointer-events: none;
  z-index: 6; /* 光沢より上に出したいなら高め（必要なら 1〜6 で調整） */

  /* 調整 */
  --t: 10px; /* 線の太さ */
  --len: 44px; /* L字の長さ */
  --out: 2px; /* 外側へ出す量 */

  width: var(--len);
  height: var(--len);

  /* L字（横 + 縦） */
  background:
    linear-gradient(#b4b4b4, #b4b4b4) 0 0 / var(--len) var(--t) no-repeat,
    linear-gradient(#b4b4b4, #b4b4b4) 0 0 / var(--t) var(--len) no-repeat;

  /* 角が少しだけ丸い方が金具っぽい（不要なら消してOK） */
  border-radius: 2px;
}

/* 位置 + 反転（同じ絵をflipして4角へ） */
.d_page .preview-frame.frame-mode-nashi.frame-fix-kadodome > .kd-tl {
  top: calc(var(--out) * -1);
  left: calc(var(--out) * -1);
  transform: none;
  /* 影は右下（＝内側） */
  filter: drop-shadow(2px 2px 1px rgba(0, 0, 0, 0.08));
}

.d_page .preview-frame.frame-mode-nashi.frame-fix-kadodome > .kd-tr {
  top: calc(var(--out) * -1);
  right: calc(var(--out) * -1);
  transform: scaleX(-1);
  /* 影は左下（＝内側） */
  filter: drop-shadow(2px 2px 1px rgba(0, 0, 0, 0.08));
}

.d_page .preview-frame.frame-mode-nashi.frame-fix-kadodome > .kd-bl {
  bottom: calc(var(--out) * -1);
  left: calc(var(--out) * -1);
  transform: scaleY(-1);
  /* 影は右上（＝内側） */
  filter: drop-shadow(2px 2px 1px rgba(0, 0, 0, 0.08));
}

.d_page .preview-frame.frame-mode-nashi.frame-fix-kadodome > .kd-br {
  bottom: calc(var(--out) * -1);
  right: calc(var(--out) * -1);
  transform: scale(-1);
  /* 影は左上（＝内側） */
  filter: drop-shadow(2px 2px 1px rgba(0, 0, 0, 0.08));
}

/* =========================================================
   なし：ビス留め（中心の透け防止・完全版）
   ========================================================= */

.d_page .preview-frame.frame-mode-nashi.frame-fix-bisudome::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;

  --r: 24px;
  --in: 45px;

  --bisu-core: #dedede; /* 中心：透け防止 */
  --bisu-mid: #b7b7b7;
  --bisu-edge: #9a9a9a;
  --bisu-rim: #9a9a9a;

  background-image:
    /* ①ハイライト（小さく、外側は透明のまま） */
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 42%),
    /* ②本体（中心を塗りつぶして透け防止） */
      radial-gradient(
        circle farthest-side at 50% 50%,
        var(--bisu-core) 0%,
        var(--bisu-core) 30%,
        var(--bisu-mid) 56%,
        var(--bisu-edge) 78%,
        var(--bisu-rim) 100%,
        rgba(0, 0, 0, 0) 100%
      ),
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 42%),
    radial-gradient(
      circle farthest-side at 50% 50%,
      var(--bisu-core) 0%,
      var(--bisu-core) 30%,
      var(--bisu-mid) 56%,
      var(--bisu-edge) 78%,
      var(--bisu-rim) 100%,
      rgba(0, 0, 0, 0) 100%
    ),
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 42%),
    radial-gradient(
      circle farthest-side at 50% 50%,
      var(--bisu-core) 0%,
      var(--bisu-core) 30%,
      var(--bisu-mid) 56%,
      var(--bisu-edge) 78%,
      var(--bisu-rim) 100%,
      rgba(0, 0, 0, 0) 100%
    ),
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 42%),
    radial-gradient(
      circle farthest-side at 50% 50%,
      var(--bisu-core) 0%,
      var(--bisu-core) 30%,
      var(--bisu-mid) 56%,
      var(--bisu-edge) 78%,
      var(--bisu-rim) 100%,
      rgba(0, 0, 0, 0) 100%
    );

  background-repeat: no-repeat;
  background-size: var(--r) var(--r);

  /* 8枚分（ハイライト＋本体 ×4） */
  background-position:
    left var(--in) top var(--in),
    left var(--in) top var(--in),
    right var(--in) top var(--in),
    right var(--in) top var(--in),
    left var(--in) bottom var(--in),
    left var(--in) bottom var(--in),
    right var(--in) bottom var(--in),
    right var(--in) bottom var(--in);

  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.18)) drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.22));
}

/* =========================================================
   なし：ボックス（グラデ無しで“ガチっと立体感”）
   - 共通アクリル(::after)はそのまま
   - ボックスは ::before で“透明ケースの縁/厚み”を作る
   ========================================================= */

/* まず共通の「なし」指定に負けないように box の見た目を上書き */
.d_page .preview-frame.frame-mode-nashi.frame-fix-box {
  border: 2px solid #eee !important;

  box-shadow:
    /* 外側の落ち影（現状維持） */
    0 10px 14px rgba(0, 0, 0, 0.22),
    0 4px 6px rgba(0, 0, 0, 0.14),
    /* 輪郭の白（現状維持） */ inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    /* ---- 内側：上下左右を分離（角で濃くならない） ---- */ /* 上：影（距離を伸ばす） */ inset
      0 -10px 8px rgba(0, 0, 0, 0.14),
    /* 左：影（距離を伸ばす） */ inset -10px 0 8px rgba(0, 0, 0, 0.14),
    /* 下：影（距離を伸ばす） */ inset 0 10px 8px rgba(0, 0, 0, 0.14),
    /* 右：影（距離を伸ばす） */ inset 10px 0 8px rgba(0, 0, 0, 0.14) !important;

  position: relative;
  z-index: 1;
}

/* “透明ケースの縁/厚み” */
.d_page .preview-frame.frame-mode-nashi.frame-fix-box::before {
  content: '';
  position: absolute;
  pointer-events: none;

  /* ケースが一回り大きい */
  inset: 16px;

  /* グラデ禁止なので単色の超薄い面 */
  background: rgba(255, 255, 255, 0.035);

  /* 縁の輪郭（カチッと） */
  border: 1px solid rgba(255, 255, 255, 0.3);
  outline: 1px solid rgba(238, 238, 238, 0.3);

  border-radius: 0px; /* 角の硬さ */
  z-index: 1; /* 本体の上 */
}

/* ★これが肝：box のときだけ preview-box を shrink-to-fit にする */
.d_page .frame-stage .preview-box:has(.preview-frame.frame-mode-nashi.frame-fix-box) {
  --box-floor: 11px; /* 影の高さと同じにする */

  /* shrink-to-fit は維持 */
  display: block !important; /* inline-blockによるズレも回避 */
  width: fit-content !important;
  max-width: 100% !important;
  margin: 0 auto !important;

  /* ★ここが肝：絶対配置の影ぶんの“床”をレイアウトに加える */
  padding-bottom: var(--box-floor) !important;

  /* flex親に伸ばされる事故の保険 */
  flex: 0 0 auto !important;
  height: auto !important;

  position: relative !important;
  overflow: visible !important;
  line-height: 0 !important;
}

.d_page .frame-stage .preview-box:has(.preview-frame.frame-mode-nashi.frame-fix-box) .frame-shadow {
  position: relative;
  overflow: visible; /* 影を外に出す */
  z-index: 0; /* stacking context */
  display: block !important;
  margin: 0 !important;
}

/* ★影は “床(padding-bottom)” の中に置く：top:100% をやめる */
.d_page .frame-stage .preview-box:has(.preview-frame.frame-mode-nashi.frame-fix-box)::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0; /* ★これで常にフレーム直下に付く */
  height: var(--box-floor);
  background: rgba(0, 0, 0, 0.1);
  pointer-events: none;
  z-index: 0;
  clip-path: polygon(0% 0%, 100% 0%, 97% 100%, 3% 100%);
}

/* 本体は影より上（念のため） */
.d_page
  .frame-stage
  .preview-box:has(.preview-frame.frame-mode-nashi.frame-fix-box)
  .frame-shadow
  .preview-frame {
  position: relative;
  z-index: 1;
}

/* 本体は影より上 */
.d_page
  .frame-stage
  .preview-box:has(.preview-frame.frame-mode-nashi.frame-fix-box)
  .preview-frame {
  position: relative;
  z-index: 1;
}

/* =========================================================
   LAYOUT EDITOR
   - PC: 左ドック
   - SP: 下ボトムシート（高さ260px）
   ========================================================= */
/* ===============================
   layout-editor
   =============================== */

.layout-editor {
  position: fixed;
  top: 0;
  left: 0;
  width: 420px;
  height: 100vh;
  background: rgba(144, 179, 173, 0.75);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 10020;
  visibility: hidden;
  padding: 67px 64px 20px 20px;
  box-sizing: border-box;
}

/* 追加：リンク（連動）トグルの見た目 */
.layout-editor .link-toggle {
  position: absolute;
  right: 22px;
  width: 36px;
  height: 54px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
  transition:
    transform 0.12s ease,
    opacity 0.12s ease;
  z-index: 2;
  background-color: transparent;
  border: none;
}

.layout-editor .link-toggle.link-toggle--lr {
  top: 129px;
}

.layout-editor .link-toggle.link-toggle--tb {
  top: 221px;
}

/* パネルごとの個別配置は JS で top を算出して当てる */

.layout-editor .editor-body h3 {
  font-size: 20px;
  font-weight: normal;
  margin-bottom: 20px;
}

.layout-editor.is-open {
  transform: translateX(210px);
  visibility: visible;
}

.editor-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 70px;
  height: 70px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.editor-close::before,
.editor-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 1px;
  background: #fff;
  transform-origin: center;
}
.editor-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.editor-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.style-editor,
.layout-editor {
  will-change: transform;
}

/* ====== レンジUI ====== */
.margin-editor {
  width: 100%;
}

.me-title {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
  color: #000;
}

.margin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  margin-bottom: 16px;
}

.margin-row label {
  width: 1em;
  font-size: 20px;
  color: #fff;
  text-align: center;
}

.me-range {
  flex: 1 1 auto;
  height: 26px;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  border: 1px solid #c9c9c9;
  outline: none;
  touch-action: pan-y;
}

.me-range::-webkit-slider-runnable-track {
  height: 26px;
  background: #fff;
  border: none;
}
.me-range::-moz-range-track {
  height: 26px;
  background: #fff;
  border: none;
  border-radius: 4px;
}

:root {
  --thumb-line-inset-y: 8px; /* 上下余白（大きいほど線が短く） */
  --thumb-line-inset-x: 7px; /* 左右の位置 */
  --thumb-line-thickness: 1px; /* 線の太さ */
}

.me-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 26px;
  background: #323334;
  border: none;
  position: relative;
  cursor: pointer;
  background-image: linear-gradient(#fff, #fff), linear-gradient(#fff, #fff);
  background-size:
    var(--thumb-line-thickness) calc(100% - (var(--thumb-line-inset-y) * 2)),
    var(--thumb-line-thickness) calc(100% - (var(--thumb-line-inset-y) * 2));
  background-position:
    var(--thumb-line-inset-x) var(--thumb-line-inset-y),
    calc(100% - var(--thumb-line-inset-x)) var(--thumb-line-inset-y);
  background-repeat: no-repeat;
}

.me-range::-moz-range-thumb {
  width: 18px;
  height: 26px;
  background: #000;
  border: none;
  cursor: pointer;
  background-image: linear-gradient(#fff, #fff), linear-gradient(#fff, #fff);
  background-size:
    var(--thumb-line-thickness) calc(100% - (var(--thumb-line-inset-y) * 2)),
    var(--thumb-line-thickness) calc(100% - (var(--thumb-line-inset-y) * 2));
  background-position:
    var(--thumb-line-inset-x) var(--thumb-line-inset-y),
    calc(100% - var(--thumb-line-inset-x)) var(--thumb-line-inset-y);
  background-repeat: no-repeat;
}

.me-input {
  width: 47px;
  height: 26px;
  font-size: 17px;
  text-align: center;
  border: 1px solid #c9c9c9;
  background: #fff;
  outline: none;
  padding-left: 2px;
}
.margin-row span {
  color: #fff;
  font-size: 20px;
}

.me-alert {
  margin-top: 8px;
  color: #c00;
  font-weight: 500;
  font-size: 14px;
  margin-right: -36px;
}

/* =========================================================
   SUB EDITOR
   ========================================================= */
.sub-editor {
  position: fixed;
  top: 0;
  left: 0; /* 画面原点に固定 */
  width: 210px; /* 実幅はJSで上書き */
  height: 100vh;
  background: rgba(255, 255, 255, 0.75);
  /* ★閉時は style-editor と同位置で“真下”に隠す（裏側を通る） */
  transform: translateX(0);
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 0.3s ease,
    visibility 0s linear 0.3s;
  z-index: 215;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.15);
}
.sub-editor.is-open {
  /* ★開時だけ style-editor 幅分右へスライド（＝右側に現れる） */
  transform: translateX(var(--se-offset, 210px));
  /* すぐ可視＆操作可へ */
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.3s ease; /* 閉時の visibility 遅延は不要 */
}

.sub-editor .sub-body {
  flex: 1 1 auto; /* 残り高さを占有 */
  min-height: 0; /* ★ flex 子のオーバーフローを許可する重要プロパティ */
  overflow-y: auto; /* ここでスクロール */
  -webkit-overflow-scrolling: touch; /* iOS 慣性スクロール */
  padding: 5px;
  color: #fff;
}

/* hidden のときに確実に消す（既存の [hidden] を尊重） */
.sub-editor .sub-body[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .sub-editor {
    height: calc(100vh - var(--vv-bottom)); /* 既存の style-editor と同等の高さ確保 */
  }
}

.editor-palette {
  display: grid;
  grid-template-columns: 1fr; /* vertical list */
  gap: 5px;
  align-items: stretch;
}

.editor-palette .palette-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
}

.sub-editor .editor-palette .palette-item.item_upload {
  position: relative;
  display: block;
  border: 1px solid #bbbbbb;
  cursor: pointer;
  color: #222;
  font-size: 14px;
  background: #fff;
}

.sub-editor .editor-palette .palette-item.item_upload::after {
  background: transparent;
}

.sub-editor .editor-palette .palette-item.item_upload:hover {
  border-color: #90b3ad !important;
  background: #fff !important;
}

.sub-editor .editor-palette .palette-item.item_upload .pu-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  background: no-repeat center / contain url(../img/icon_upload_grn.png);
  pointer-events: none;
}

.sub-editor .editor-palette .palette-item.item_upload .pu-label {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  line-height: 1;
  font-weight: 700;
  color: #222;
  pointer-events: none;
}

/* =========================================================
   パレット
   ========================================================= */
.palette-item {
  display: block;
  width: 100%;
  height: 66px; /* height can be synced by JS */
  box-sizing: border-box;
  border: 1px solid #bbb;
  background-color: #f7f7f7;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.palette-item::after {
  content: '';
  font-size: 14px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  background: rgba(34, 34, 34, 0.5);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  letter-spacing: 0.5px;
}
.palette-item:hover::after,
.palette-item.is-selected::after {
  opacity: 1;
}

.palette-item.is-selected::after {
  content: '選択中';
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  padding-bottom: 8px;
}

.palette-item.is-selected:not(.upload_item)[data-kiji-name]:not([data-kiji-name=''])::before {
  content: attr(data-kiji-name);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13px;
  text-align: center;
  font-size: 11px;
  color: #ffffff;
  line-height: 1.2;
  z-index: 1;
}

.palette-item.upload_item.is-selected::before {
  content: '';
}
.palette-item.upload_item.is-selected::after {
  padding-bottom: 0;
}
.editor-palette .coming-soon {
  font-size: 90%;
  padding-left: 12px;
  color: #666;
}

/* =========================================================
   右上クイックメニュー
   ========================================================= */
.d_page .quick-menu {
  position: fixed;
  top: 20px;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  pointer-events: auto;
}

.d_page .qm-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: 69px;
  height: 67px;
  padding: 6px 4px;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.d_page .qm-item.soudan {
  margin-top: -8px;
}
.d_page .qm-item.soudan .qm-label {
  margin-top: 6px;
}

.d_page .qm-label {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

.d_page .qm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  opacity: 0.7;
}
.d_page .qm-icon img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* =========================================================
   モーダル共通
   ========================================================= */
.d_page .qm-modal {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}
.d_page .qm-modal[hidden] {
  display: none !important;
}

.d_page .qm-modal-inner {
  position: relative;
  inset: 0;
  padding: 48px 20px;
  color: #fff;
  max-width: min(500px, 96vw);
  width: 100%;
}

.d_page .qm-modal-close {
  position: absolute;
  top: 0;
  right: 0;
  background: #303435;
  border: none;
  cursor: pointer;
  width: 64px;
  height: 64px;
  z-index: 5010;
}
.d_page .qm-modal-close::before,
.d_page .qm-modal-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 1px;
  background: #fff;
  transform-origin: center;
}
.d_page .qm-modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.d_page .qm-modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.d_page .qm-modal .btnWrap {
  text-align: center;
}
.d_page .qm-modal .p-button {
  width: 200px;
  height: 50px;
  background: #303435;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.d_page .qm-modal .p-button:hover {
  color: #303435;
  background: #fff;
  border: 1px solid #ddd;
  outline: none;
}
.d_page .qm-modal .n-button {
  color: #888;
  font-size: 16px;
  font-weight: 600;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.d_page .qm-modal .n-button:hover {
  opacity: 0.75;
}

.d_page .qm-pane {
  width: 100%;
  margin: 0;
}
.d_page .qm-save-pane--list {
  max-height: calc(100vh - 200px);
  overflow: auto;
}
.d_page .qm-pane-ttl {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 2px;
  margin: 0 0 25px;
  color: #303435;
  border-bottom: 1px solid #ccc;
  padding-bottom: 3px;
  position: relative;
}

.d_page .qm-pane-ttl small {
  display: inline-block;
  position: absolute;
  right: 0;
  top: 3px;
  font-weight: normal;
  font-size: 0.7;
}

.d_page .qm-pane-sub-ttl {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 5px;
}

.d_page .qm-menu-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.d_page .qm-menu-list li {
  margin: 0 0 12px;
}

.d_page .qm-pane textarea::placeholder,
.d_page .qm-pane input::placeholder {
  color: #888;
}
.d_page .qm-pane .ast {
  line-height: 1.1;
}

/* ===== 金額計算UI ===== */
.d_page .qm-kingaku ul {
  margin-bottom: 20px;
}
.d_page .qm-kingaku ul li {
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 6px 0;
  border-bottom: 1px solid #ccc;
}
.d_page .qm-kingaku ul li span {
  font-size: 18px;
  color: #888;
}
.d_page .qm-kingaku-total {
  margin-bottom: 10px;
}
.d_page .qm-kingaku-total #kingakuTotal small {
  font-weight: 400;
}
.kgk-shipping-note {
  margin-top: -5px;
}
.d_page .qm-kingaku-total #kingakuTotal {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}
.d_page .qm-kingaku-note {
  margin-bottom: 20px;
  color: #a33;
}

/* ===== 保存UI ===== */
.d_page .qm-save-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.d_page .qm-save-tab {
  background: #555;
  color: #fff;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
}
.d_page .qm-save-tab.is-active {
  background: #777;
}

.d_page .qm-save-label {
  display: block;
  margin-bottom: 12px;
}
.d_page .qm-save-label input {
  width: min(520px, 100%);
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #666;
  background: #222;
  color: #fff;
}

.d_page .qm-save-actions {
  margin-bottom: 8px;
}
.d_page .qm-save-actions .qm-save-do {
  background: #08c;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.d_page .qm-save-note {
  opacity: 0.75;
  margin-bottom: 16px;
}

.d_page .qm-save-table {
  width: 100%;
  border-collapse: collapse;
  background: #222;
}
.d_page .qm-save-table th,
.d_page .qm-save-table td {
  border: 1px solid #555;
  padding: 8px;
}
.d_page .qm-save-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.d_page .qm-copy-input {
  width: min(420px, 100%);
  background: #111;
  color: #fff;
  border: 1px solid #555;
  padding: 6px;
}
.d_page .qm-save-empty {
  margin: 8px 0 0;
}

.d_page #qmPaneSoudan textarea,
.d_page #qmPaneSoudan input[type='email'],
.d_page #qmPaneSoudan input[type='text'],
.d_page #qmPaneSave input[type='text'] {
  width: 100%;
  font-size: 18px;
  padding: 12px;
  color: #303435;
  background: #f5f5f5;
  border: 1px solid #cccccc;
  border-radius: 0;
  margin-bottom: 20px;
  box-sizing: border-box;
}
.d_page #qmPaneSoudan textarea {
  min-height: 200px;
}

.d_page #qmSoudanSavedTableWrap,
.d_page .qm-save-pane--list {
  max-height: 250px;
  overflow-y: auto;
  scrollbar-color: #90b3ad #f5f5f5;
  scrollbar-width: thin;
  background: #f5f5f5;
  padding-left: 8px;
  padding-right: 8px;
}

.d_page #qmSoudanSavedTableWrap #qmSoudanSavedTable,
.d_page .qm-save-pane--list .qm-saved-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.d_page #qmSoudanSavedTableWrap #qmSoudanSavedTable thead,
.d_page .qm-save-pane--list .qm-saved-table thead {
  display: none;
}

.d_page .qm-save-pane--list .u-button {
  display: none;
}
.d_page .qm-save-pane--list .d-button {
  background: none;
  border: none;
  outline: none;
  vertical-align: middle;
}

.d_page #qmSoudanSavedTableWrap #qmSoudanSavedTable td,
.d_page .qm-save-pane--list .qm-saved-table td {
  text-align: center;
  padding: 10px;
  border-bottom: 1px solid #ccc;
}

.d_page #qmSoudanSavedTableWrap #qmSoudanSavedTable td.qm-saved-td-name,
.d_page .qm-save-pane--list .qm-saved-table td.qm-saved-td-name {
  text-align: left;
  width: 80%;
  line-height: 1.4;
}

.d_page #qmSoudanSavedTableWrap #qmSoudanSavedTable td.qm-saved-td-name a,
.d_page .qm-save-pane--list .qm-saved-table td.qm-saved-td-name a {
  color: #90b3ad;
  text-decoration: none;
}

.d_page #qmSoudanSavedTableWrap,
.d_page .qm-pane--saved {
  margin-top: 10px;
  margin-bottom: 20px;
}

.d_page .qm-saved-td-date {
  font-size: 90%;
  color: #888;
}

/* 相談一覧のチェックボックス */
.d_page td.qm-soudan-td-check {
  padding: 6px 0 !important;
}
.d_page .qm-soudan-td-check input[type='checkbox'] {
  -webkit-appearance: none;
  appearance: none;
  width: 35px;
  height: 35px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 2px;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  margin: 0;
  position: relative;
}
.d_page .qm-soudan-td-check input[type='checkbox']::after {
  content: '';
  width: 10px;
  height: 18px;
  border-right: 4px solid #90b3ad;
  border-bottom: 4px solid #90b3ad;
  transform: rotate(45deg);
  opacity: 0;
  margin-top: -2px;
}
.d_page .qm-soudan-td-check input[type='checkbox']:checked::after {
  opacity: 1;
}

.d_page .qm-kingaku ul li {
  border-bottom: none;
}

.d_page .qm-kingaku ul li.kgk-row {
  border-bottom: 1px solid #ccc;
}

/* =========================================================
   Zoomist UI（縦スライダー + %表示）
   ========================================================= */
.d_page #zoomist .zoomist-zoomer {
  position: fixed;
  top: initial;
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(
    max(8px, env(safe-area-inset-bottom)) + var(--vv-bottom) + var(--sliderBoxH, 220px) + 40px
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.d_page .zoomist-zoomer,
.d_page .zoomist-zoomer-button {
  touch-action: manipulation;
}

.d_page .zoomist-zoomer-button {
  background: #eee !important;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.d_page #zoomSliderBox,
.d_page #zoomSliderMount,
.d_page #zoomSliderMount .zoomist-slider,
.d_page #zoomSliderMount .zoomist-slider__track,
.d_page #zoomSliderMount .zoomist-slider__thumb {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@supports (bottom: constant(safe-area-inset-bottom)) {
  .d_page #zoomSliderBox {
    right: max(8px, constant(safe-area-inset-right));
    bottom: calc(max(8px, constant(safe-area-inset-bottom)) + var(--vv-bottom));
  }
  .d_page #zoomist .zoomist-zoomer {
    right: max(8px, constant(safe-area-inset-right));
    bottom: calc(
      max(8px, constant(safe-area-inset-bottom)) + var(--vv-bottom) + var(--sliderBoxH) + 12px
    );
  }
}

.d_page #zoomSliderBox {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + var(--vv-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.35);
  padding: 8px 14px 8px;
  width: 48px;
  box-sizing: border-box;
}

.d_page #zoomPercent {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  color: #333;
  min-width: 4ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  margin-bottom: 10px;
}

.d_page #zoomSliderMount {
  --zoomist-slider-padding-y: 0 !important;
  --zoomist-slider-padding-x: 0 !important;
  --zoomist-slider-bar-size: 200px !important;
  --zoomist-slider-bar-side: 4px !important;
  --zoomist-slider-bar-border-radius: 8px !important;
  --zoomist-slider-button-size: 26px !important;
}

.d_page #zoomSliderMount .zoomist-slider {
  padding: 0 !important;
  height: var(--zoomist-slider-bar-size) !important;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.d_page #zoomSliderMount .zoomist-slider__track {
  height: 100% !important;
  width: var(--zoomist-slider-bar-side) !important;
  margin: 0 auto !important;
  border-radius: var(--zoomist-slider-bar-border-radius) !important;
}

.d_page #zoomSliderMount .zoomist-slider-bar {
  width: 1px;
  height: 100%;
  margin: 0 auto;
  border-radius: 8px;
  background-color: #ddd;
}

.d_page .zoomist-slider-vertical .zoomist-slider-wrapper {
  background: none;
}

.d_page #zoomSliderMount .zoomist-slider-button {
  width: 26px;
  height: 26px;
}

.d_page #zoomSliderMount .zoomist-slider-button::before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.25);
  left: -11px;
}

/* =========================================================
   左のランチャー（edit-icon）
   ========================================================= */
.d_page .edit-icon {
  top: 50%;
  left: 0;
  transform: translateY(-50%);

  width: 48px;
  height: 170px;
  background: #222;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  box-sizing: border-box;
}

.d_page .edit-icon > span {
  position: absolute;
  top: 50%;
  left: 50%;
  color: #fff;

  --glyph-nudge: 0px;
  transform: translate(calc(-50% - var(--glyph-nudge)), -50%);

  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  font-kerning: none;
  font-variant-east-asian: proportional-width;
  font-feature-settings: 'palt' 1;
  pointer-events: none;
}

.d_page .edit-icon:hover {
  background: #eee;
}
.d_page .edit-icon:hover span {
  color: #222 !important;
}

.d_page .edit-icon.is-hidden {
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
}

.d_page .size-info-wrap {
  position: fixed;
  top: 10px;
  left: 10px;
}

/* 画面左上サイズ表示 */
.d_page .size-info {
  font-size: 12px;
  color: #333;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 8px;
  border-radius: 4px;
  line-height: 1.4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  display: inline-block;
}

.color-ast {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.4;
}

/* =========================================================
   editor-backdrop が active の時だけ
   size-info / edit-icon を「下に潜らせる」
   ========================================================= */
.d_page:has(.editor-backdrop.is-active) .size-info-wrap,
.d_page:has(.editor-backdrop.is-active) .edit-icon {
  z-index: 0 !important;
  pointer-events: none !important;
}

/* =========================================================
   額装(d_page) : style-editor の戻るリンクを最下部に固定（軸装と同じ）
   ========================================================= */
.d_page .style-editor .editor-backlink {
  bottom: calc(max(8px, env(safe-area-inset-bottom, 0px)) + var(--vv-bottom, 0px)) !important;
}

/* =========================================================
   ========================================================= */

/* sub-editor: モードに応じて sub-body を切り替え */
.sub-editor.is-mode-mat .sub-body.e_fukurin {
  display: none;
}
.sub-editor.is-mode-fukurin .sub-body.e_mat {
  display: none;
}

.sub-editor.is-mode-toso .sub-body.e_mat,
.sub-editor.is-mode-toso .sub-body.e_fukurin {
  display: none;
}

/* =========================================================
   スタイルエディター布設定
   ========================================================= */
#daishiBox.preview-dai-shi,
.preview-frame {
  background-repeat: repeat !important;
  background-position: center top !important;
  background-size: min(400px, 100%) auto !important; /* ← max → min */
}

#daishiBox {
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
}

#daishiBox,
.preview-dai-shi {
  background-color: #ccc;
}

.palette-ttl {
  font-size: 14px;
  padding: 0;
  margin-top: 6px;
  margin-bottom: 3px;
  border-bottom: 1px solid #90b3ad;
}

.d_page .style-editor .is-frame-nashi .note:not([data-panel-mat-top-note='1']) {
  font-size: 13px;
  font-weight: 600;
  display: none;
  margin-top: 5px;
  margin-left: 2px;
}

.d_page
  .style-editor
  .is-frame-nashi
  .is-fix-all-disabled
  .note:not([data-panel-mat-top-note='1']) {
  display: block;
}

.d_page .style-editor .is-frame-nashi .note[data-panel-mat-top-note='1'] {
  font-size: 13px;
  font-weight: 600;
  margin-top: 5px;
  margin-left: 2px;
  margin-bottom: 5px !important;
}

/* HGの「※対応不可」だけは強制表示 */
.d_page .sub-editor .e_mat [data-panel-mat-hg-na='1'] {
  display: block !important;
}

.d_page .sub-editor .note {
  font-size: 13px;
  margin: 0 !important;
}

.greyout {
  opacity: 0.35;
  pointer-events: none;
}

.greyout a {
  pointer-events: none !important;
}

.greyout .size-radio-circle {
  display: none;
}

.palette-na {
  font-size: 13px;
}

/* =========================================================
   SP：layout-editor は下ボトムシート（高さ260px）
   ========================================================= */
@media (max-width: 768px) {
  .d_page .layout-editor {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: 290px;
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    transform: translateY(105%);
    padding: 50px 56px 17px 17px;
  }

  .d_page .layout-editor.is-open {
    transform: translateY(0);
  }

  .d_page .style-editor {
    width: 150px;
    max-width: 88vw;
  }
  .d_page .style-editor .editor-heading {
    padding: 10px 36px 10px 12px;
    font-size: 14px;
  }
  .d_page .style-editor .editor-heading::after {
    width: 8px;
    height: 8px;
  }
  .d_page .style-editor .editor-backlink {
    padding: 0 6px;
    gap: 10px;
    pointer-events: auto;
    touch-action: manipulation;
    height: 20px;
  }
  .d_page .style-editor .editor-backlink .icon {
    width: 0.5em;
    height: 0.5em;
  }
  .d_page .style-editor .editor-backlink span {
    font-size: 10px;
  }

  .d_page .quick-menu {
    gap: 13px;
  }
  .d_page .qm-item {
    width: 55px;
    height: 54px;
    margin-right: 3px;
  }
  .d_page .qm-item.scene {
    margin-top: -5px;
  }
  .d_page .qm-label {
    font-size: 10px;
    margin-top: 6px;
  }

  .d_page .qm-modal-close {
    width: 55px;
    height: 55px;
  }
  .d_page .qm-modal-close::before,
  .d_page .qm-modal-close::after {
    width: 35px;
  }
  .d_page .qm-modal-inner {
    padding: 0 15px;
  }
  .d_page .qm-pane-ttl {
    font-size: 18px;
    margin: 0 0 12px;
    letter-spacing: 1px;
  }
  .d_page .qm-kingaku ul li span {
    font-size: 15px;
  }
  .d_page .qm-modal .p-button {
    width: 180px;
    height: 46px;
    font-size: 15px;
  }
  .d_page .qm-modal .n-button {
    font-size: 15px;
  }
  .d_page #qmPaneSoudan textarea,
  .d_page #qmPaneSoudan input[type='email'],
  .d_page #qmPaneSoudan input[type='text'],
  .d_page #qmPaneSave input[type='text'] {
    font-size: 16px;
    padding: 10px;
    margin-bottom: 12px;
  }
  .d_page #qmPaneSoudan textarea {
    min-height: 120px;
  }
  .d_page .qm-save-pane--list {
    max-height: 180px;
  }

  .d_page #zoomSliderMount {
    --zoomist-slider-bar-size: 185px !important;
  }
  .d_page #zoomist .zoomist-zoomer {
    bottom: calc(
      max(8px, env(safe-area-inset-bottom)) + var(--vv-bottom) + var(--sliderBoxH, 220px) + 18px
    );
  }
  .d_page #zoomPercent {
    margin-bottom: 5px;
  }
  .d_page .zoomist-zoomer-button {
    width: 44px !important;
    height: 44px !important;
  }
  .d_page #zoomSliderBox {
    width: 44px;
  }

  .d_page .edit-icon {
    width: 44px;
    height: 160px;
  }
  .d_page .edit-icon > span {
    font-size: 14px;
  }
  .d_page .preview-frame,
  .d_page .preview-art {
    max-width: 100%;
    max-height: 100%;
  }
  .d_page .preview-box {
    max-width: 80%; /* ← ここを好みで 85〜92% くらいで調整 */
    max-height: 95%; /* 高さはそのままでもOK（幅制限で全体が縮む） */
  }
  .d_page .frame-stage {
    transform: scale(0.9); /* ここを 0.85〜0.95 で調整 */
    transform-origin: 50% 50%;
    will-change: transform;
  }
  .sub-editor {
    width: 138px !important;
  }
  .palette-item {
    height: 58px !important;
  }
  .sub-editor .editor-palette .palette-item.item_upload {
    height: 42px !important;
    font-size: 13px;
  }
  .sub-editor .editor-palette .palette-item.item_upload .pu-icon {
    width: 18px;
    height: 18px;
    left: 10px;
  }
  .sub-editor .editor-palette .palette-item.item_upload .pu-label {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    line-height: 1;
    font-weight: 700;
    color: #222;
    pointer-events: none;
  }
  .palette-item.item_upload .pu-label {
    font-size: 13px;
    padding-left: 25px;
  }
  .layout-editor .editor-close {
    width: 60px;
    height: 60px;
  }
  .layout-editor .editor-body h3 {
    font-size: 18px;
    margin-bottom: 15px;
  }
  .layout-editor .margin-row {
    display: grid !important;
    grid-template-columns: 20px minmax(0, 1fr) 48px auto !important;
    align-items: center !important;
    column-gap: 6px !important;
    row-gap: 6px !important;
    margin-bottom: 10px !important;
    position: relative !important;
  }
  .layout-editor .margin-row > label {
    font-size: 14px !important;
    color: #fff !important;
    text-align: left !important;
    width: auto !important;
    margin-left: 2px;
  }
  .layout-editor .editor-body input[type='range'] {
    touch-action: pan-x !important;
    pointer-events: auto;
    -webkit-user-select: none;
    user-select: none;
  }
  .layout-editor .me-range {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 24px !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background: #fff !important;
    border: 1px solid #c9c9c9 !important;
    outline: none !important;
    overflow: hidden !important;
    border-radius: 0;
  }
  .layout-editor .me-input {
    width: 48px !important;
    height: 24px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-align: center !important;
    padding: 0 !important;
    border: 1px solid #c9c9c9 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    border-radius: 0;
  }
  .layout-editor .me-range::-webkit-slider-runnable-track {
    height: 24px !important;
    background: transparent !important;
    border: none !important;
  }
  .layout-editor .me-range::-moz-range-track {
    height: 24px !important;
    background: transparent !important;
    border: none !important;
  }
  :root {
    --thumb-line-inset-y: 8px; /* 上下余白（大きいほど線が短く） */
    --thumb-line-inset-x: 6px; /* 左右の位置 */
    --thumb-line-thickness: 1px; /* 線の太さ */
  }
  .layout-editor .me-range::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 16px !important;
    height: 24px !important;
    border: none !important;
    position: relative !important;
    cursor: pointer !important;
  }
  .layout-editor .me-range::-moz-range-thumb {
    width: 16px !important;
    height: 24px !important;
    border: none !important;
    cursor: pointer !important;
  }
  .layout-editor .me-input {
    width: 48px !important;
    height: 24px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-align: center !important;
    padding: 0 !important;
    border: 1px solid #c9c9c9 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    border-radius: 0;
  }
  .layout-editor .margin-row > span {
    font-size: 14px !important;
    color: #fff !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
  }
  .layout-editor .editor-body {
    overflow-y: auto !important;
    position: relative;
  }
  .layout-editor .editor-close {
    pointer-events: auto;
    z-index: 101;
  }
  .editor-close::before,
  .editor-close::after {
    width: 45px;
  }
  .style-editor.is-open,
  .layout-editor.is-open {
    touch-action: none;
  }

  .style-editor .editor-body,
  .layout-editor .editor-body {
    touch-action: pan-y;
    overscroll-behavior: contain;
  }
  /* --- FIX: レイアウトエディタ内のスライダーを横ドラッグ可能に --- */
  .layout-editor.is-open {
    touch-action: auto !important;
  }
  .layout-editor .editor-body {
    touch-action: auto !important;
  }
  .layout-editor .editor-body input[type='range'] {
    touch-action: pan-x !important; /* 横ドラッグを許可 */
    pointer-events: auto;
    -webkit-user-select: none;
    user-select: none;
  }
  .layout-editor .link-toggle {
    position: absolute;
    display: block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    z-index: 5; /* 見出しや×ボタンより手前に */
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    right: -40px;
  }
  .layout-editor .le-panel.is-active > .editor-body {
    overflow: visible !important;
  }
  .layout-editor .link-toggle.link-toggle--lr {
    top: 45px;
  }
  .layout-editor .link-toggle.link-toggle--tb {
    top: 112px;
  }
  .palette-ttl {
    font-size: 14px;
    margin-top: 3px;
    margin-bottom: 0;
  }
  .d_page .style-editor .is-frame-nashi .note {
    font-size: 10px;
  }
  .seg-radio .seg-item {
    font-size: 13px;
  }
  .palette-item.is-selected:not(.upload_item)[data-kiji-name]:not([data-kiji-name=''])::before {
    bottom: 9px;
  }
  .daishi-pane .seg-radio .seg-item,
  .e_art .seg-radio .seg-item {
    padding: 0 2px;
    letter-spacing: -0.2px;
  }
  .editor-btn-d_fukurin,
  .editor-btn-daishi-kire {
    padding: 0 38px 0 10px !important;
  }
  .palette-na {
    font-size: 12px;
  }
  .d_page .style-editor .is-frame-nashi .note[data-panel-mat-top-note='1'] {
    font-size: 10px;
  }
  .icon-wrapper {
    margin-bottom: 0;
  }
  .icon-wrapper img {
    width: 120px;
  }
  h1.mail-ttl {
    font-size: 28px;
    margin-bottom: 15px;
    letter-spacing: 3px;
  }
  p.copy {
    bottom: 10px;
    font-size: 10px;
  }
  .color-ast {
    margin-top: 4px;
    font-size: 9px;
  }
  .me-alert {
    font-size: 12px;
    margin-right: -36px;
  }
  .d_page .style-editor .editor-body.e_frame.is-frame-nashi .frame-pane--nashi .editor-btn {
    font-size: 14px;
    padding: 0 30px 0 10px;
  }
  .seg-radio .seg-item {
    padding: 0 10px;
  }
  .kgk-shipping-note {
    font-size: 14px;
  }
}

/* iOS Safari 実機で右寄りに見える補正 */
@supports (-webkit-touch-callout: none) {
  .d_page .edit-icon > span {
    --glyph-nudge: 8px;
  }
}
