/* ==============================================
   components.css — 共通UIパーツ
   ============================================== */

/* ========== ヘッダー ========== */
.app-header {
  top: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

/* ヘッダー上段
   2026-06-10 LINH 指示：grid（1fr auto 1fr）でタイトルをビューポート中央に固定。
   back-btn / cart-btn の幅に依存せず常に中央配置。 */
.app-header__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 16px;
}

.app-header__title {
  display: block;
  white-space: nowrap;
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 22px;
  font-weight: 500;
  color: #4a4a4a;
  letter-spacing: 0.08em;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .2s ease;
  text-align: center;
}
/* モバイル（pets の `@media (max-width: 600px)` と統一） */
@media (max-width: 600px) {
  .app-header__title {
    /* 2026-06-10 LINH 指示：モバイルも 4px 大きく（15 → 19） */
    font-size: 19px;
    letter-spacing: 0.05em;
  }
}
.app-header__title:hover {
  opacity: 0.7;
  text-decoration: none;
  color: inherit;
}
.app-header__title:focus-visible {
  outline: 2px solid #ff7e36;
  outline-offset: 2px;
  border-radius: 2px;
}


/* 2026-06-10 LINH 指示：トップへ戻るボタン（grid 左セル） */
.back-btn {
  justify-self: start;
  background: transparent;
  border: none;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  transition: opacity .2s ease;
}
.back-btn:hover { opacity: 0.7; }
.back-btn:focus-visible {
  outline: 2px solid #ff7e36;
  outline-offset: 2px;
  border-radius: 4px;
}
.back-btn__icon { font-size: 22px; }

/* モバイル：アイコンのみ表示（タップ領域は確保） */
@media (max-width: 600px) {
  .back-btn { padding: 6px; }
  .back-btn__label { display: none; }
}

/* cart-btn：grid 右セル。badge を絶対配置するため position: relative を維持 */
.cart-btn {
  position: relative;
  justify-self: end;
  background: transparent;
  border: none;
  padding: 4px;
}

.cart-btn__icon {
  font-size: 24px;
  color: var(--color-text);
}

.cart-btn__badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--color-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.cart-btn__badge.is-zero {
  display: none;
}

/* ステップナビ */
.step-nav {
  display: flex;
  background: #f1f5f9;
  padding: 0;
  overflow: hidden;
  border-top: 1px solid var(--color-border);
}

.step-nav__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 0 10px 15px;
  font-size: 10px;
  color: #94a3b8;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  clip-path: polygon(0% 0%, 92% 0%, 100% 50%, 92% 100%, 0% 100%, 8% 50%);
  margin-left: -2%;
}

.step-nav__item:first-child {
  margin-left: 0;
  padding-left: 0;
  clip-path: polygon(0% 0%, 92% 0%, 100% 50%, 92% 100%, 0% 100%);
}

.step-nav__item:last-child {
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 8% 50%);
}

.step-nav__item .material-symbols-outlined {
  font-size: 20px;
  opacity: 0.6;
}

.step-nav__item--active {
  background: var(--color-primary);
  color: #fff !important;
  z-index: 2;
}

.step-nav__item--active .material-symbols-outlined {
  opacity: 1;
}


.step-nav__item--done {
  background: rgba(43, 87, 154, 0.14);
  color: var(--color-primary);
  z-index: 1;
}


.step-nav__item--done .material-symbols-outlined {
  opacity: 0.85;
}

@media (min-width: 980px) {
  .step-nav__item {
    font-size: var(--fs-textpc);
  }

  .app-header__title {
    /* 2026-06-10 LINH 指示：PC も 4px 大きく（18 → 22） */
    font-size: 22px;
  }

}


/* ========== セクションヘッダー（トグル付き） ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-header__left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
}

.section-header__left .material-symbols-outlined {
  font-size: 16px;
  color: var(--color-orange);
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
}

.badge--required {
  background: #fff;
  color: var(--color-orange);
  border: 1px solid var(--color-orange);
}

.badge--optional {
  background: #ddd;
  color: #555;
}

/* トグルスイッチ */
.toggle-wrap {
  display: flex;
  align-items: center;
}

.toggle-input {
  display: none;
}

.toggle-label {
  display: inline-block;
  width: 46px;
  height: 26px;
  background: #ccc;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
}

.toggle-label::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}

.toggle-input:checked+.toggle-label {
  background: var(--color-green);
}

.toggle-input:checked+.toggle-label::after {
  left: 23px;
}

/* 記入内容 */

.section-box {
  background: var(--color-surface);
  padding: 14px;
}

/* =========================================
   共通：textarea + counter( + button/menu ) を同じ枠にまとめる
   対象：history-body / story-item__right / aisatsu-body / giftcomment-body
   ========================================= */
.section-box :is(.history-body, .story-item__right, .aisatsu-body, .giftcomment-body) {
  border: 1px solid var(--color-border);
  padding: 10px 12px 0;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 8px;
  column-gap: 12px;
}

.story-item__right,
.history-body {
  padding: 10px 12px !important;
}

/* focus時は外枠をオレンジに */
.section-box :is(.history-body, .story-item__right, .aisatsu-body, .giftcomment-body):focus-within {
  border-color: var(--color-orange);
}

.section-box :is(.aisatsu-body) .form-textareaformat {
  border: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  resize: none;
  background-image: none;
  font-size: var(--fs-textinputsp);
  line-height: 1.4;
  text-align: center;
  margin: auto;
  font-family: var(--font-mincho);
  white-space: pre;
}

.section-box :is(.history-body, ) .form-textareaformat {
  border: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  resize: none;
  background-image: none;
  font-size: var(--fs-textinputsp);
  line-height: 1.4;
  text-align: left;
  margin: auto;
  font-family: var(--font-mincho);
  white-space: pre;
}

.section-box :is(.story-item__right, .giftcomment-body) .form-textarea {
  border: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  resize: none;
  background-image: none;
}


/* grid area base */
.section-box :is(.history-body, .story-item__right, .aisatsu-body, .giftcomment-body)>.form-textarea,
.section-box :is(.history-body, .aisatsu-body)>.form-textareaformat {
  grid-area: ta;
}

/* counter base */
.section-box :is(.history-body, .story-item__right, .aisatsu-body, .giftcomment-body)>.form-counter {
  grid-area: cnt;
  justify-self: end;
  align-self: end;
  white-space: nowrap;
  margin: 0;
  color: var(--color-muted);
  transform: translateY(4px);
}

/* history / story： textarea + counter*/
.section-box :is(.history-body, .story-item__right) {
  grid-template-areas:
    "ta  ta"
    ".   cnt";
}

/* aisatsu / giftcomment： textarea + button + counter + menu */
.section-box :is(.aisatsu-body, .giftcomment-body) {
  grid-template-areas:
    "ta   ta"
    "btn  cnt"
    "menu menu";
}

/* button 文例 */
.section-box :is(.aisatsu-body, .giftcomment-body)>.btn-example {
  grid-area: btn;
  justify-self: start;
  align-self: center;
  display: inline-flex;
  margin: 0;
}

/* menu 文例 */
.section-box :is(.aisatsu-body, .giftcomment-body)>.example-menu {
  grid-area: menu;
  display: none;
  border-top: 1px solid var(--color-border);
  padding: 8px 0 10px;
}

/* open menu */
.section-box :is(.aisatsu-body, .giftcomment-body).is-examples-open>.example-menu {
  display: block;
}

/* item in menu */
.section-box .example-menu .example-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  /* 例文ボタン同士の間隔を広げる（旧 8px → 14px） */
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}

.section-box .example-menu .example-item:hover {
  background: #fafafa;
  border-color: #bbb;
}

.section-box .example-menu .example-item:first-child {
  margin-top: 0;
}

/* 「例文1 / 例文2」ラベル：太字で短く表示 */
.section-box .example-menu .example-item__label {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
}

/* 例文のプレビュー文：1行で省略表示（…） */
.section-box .example-menu .example-item__preview {
  flex: 1 1 auto;
  font-size: 12px;
  color: #777;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* モバイルではプレビュー文を改行可にしてラベルの下に表示 */
@media (max-width: 480px) {
  .section-box .example-menu .example-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .section-box .example-menu .example-item__preview {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    /* 2行までで省略 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* =============フォームパーツ ============ */

.form-input,
.form-select,
.form-textarea,
.form-textareaformat {
  width: 100%;
  border: 1px solid var(--color-border);
  padding: 12px 10px;
  font-size: 14px;
  background: #fff;
  color: var(--color-text);
  transition: border-color .2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.form-textareaformat:focus {
  outline: none;
  border-color: var(--color-orange);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
.form-textareaformat:disabled {
  background: #f0f0f0;
  color: #aaa;
  cursor: not-allowed;
}

.form-textarea,
.form-textareaformat {
  min-height: 160px;
  resize: none;
}

/* 御礼の品物へのコメント欄を半分の高さに縮小（compact モード） */
.section-box .giftcomment-body--compact .form-textarea {
  min-height: 80px;
}

.form-counter {
  text-align: right;
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 4px;
}

/* 文字数が上限に達した時のハイライト */
.form-counter > span.is-over {
  color: #d93025;
  font-weight: bold;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row>* {
  flex: 1;
}

.form-row .field-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.form-row--years {
  align-items: flex-start;
  justify-content: flex-start;
  width: fit-content;
  max-width: 100%;
  gap: 10px;
}

.form-row--years .field-col {
  flex: 0 0 clamp(140px, 18vw, 200px);
  max-width: 100px;
}

.form-row--years .sep {
  flex: 0 0 auto;
  padding: 0 6px;
}

.form-row--years #input-birthyear,
.form-row--years #input-deathyear {
  width: 100%;
}

/* 日付ピッカー用の最小幅指定（date input がアイコンを含めて表示できるように） */
.form-row--years .field-col--date {
  min-width: 130px;
}
.form-row--years .form-input--date {
  width: 100%;
  min-width: 130px;
}

/* ========== アップロードボックス ========== */
.uploader-box {
  background: #eee;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 6px;
  color: var(--color-muted);
  font-size: 12px;
  overflow: hidden;
  position: relative;
  border: 2px dashed var(--color-border);
  transition: border-color .2s;
}

.uploader-box__text {
  font-size: 11px;
}

.uploader-box:hover {
  border-color: var(--color-orange);
}

.uploader-box .material-symbols-outlined {
  font-size: 32px;
}

.uploader-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uploader-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ストーリーアイテム */
.story-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: flex-start;
}

.story-item .uploader-box {
  width: 140px;
  min-width: 100px;
  height: 127px;
}

.story-item__right {
  flex: 1;
}

@media (min-width: 460px) {
  .uploader-box__text {
    font-size: 13px;
  }

  .story-item .uploader-box {
    width: 156px;
    min-width: 100px;
    height: 127px;
  }
}


/* ========== ボタン ========== */
.btn-primary {
  display: block;
  width: 100%;
  background: var(--color-orange);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 20px;
  border-radius: var(--radius-btn);
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn-primary:hover {
  background: var(--color-orange-hover);
}

.btn-primary:active {
  transform: scale(.98);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* 「戻る」リンクボタン（a タグ）の見た目を button と揃える */
a.fixed-bottom-bar__back {
  text-decoration: none;
}

/* 送り先お名前入力画面の表示イメージ例パネル
   - PC: 画面右側にフローティング（fixed）し、スライドインで登場
   - 入力欄にフォーカスすると右へスライドアウトして隠れる（.is-hidden）
   - モバイル: 本文上部にインライン表示（fixed解除） */
.recipient-help-panel {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%) translateX(0);
  width: 300px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  z-index: 90;
  overflow: hidden;
  opacity: 1;
  /* 表示中はトランジション、初回はアニメーションで登場 */
  transition: transform .4s ease, opacity .4s ease;
  /* 初回登場アニメーション：右からスライドイン */
  animation: recipient-help-slide-in .5s ease both;
}

/* 非表示：登場アニメーションの逆方向（右へスライドアウト + フェードアウト） */
.recipient-help-panel.is-hidden {
  transform: translateY(-50%) translateX(120%);
  opacity: 0;
  pointer-events: none;
  /* 一度走った登場アニメーションをキャンセル（transform/opacity の transition を優先させる） */
  animation: none;
}

.recipient-help-panel__header {
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #333;
  text-align: center;
}

.recipient-help-panel__body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.recipient-help-panel__note {
  font-size: 12px;
  line-height: 1.6;
  color: #555;
  margin: 0;
  text-align: left;
}

.recipient-help-panel__body img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

@keyframes recipient-help-slide-in {
  from {
    transform: translateY(-50%) translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
}

/* 画面が狭い（メインコンテンツとパネルが重なる）ときはパネルを下寄せにする */
@media (max-width: 1280px) {
  .recipient-help-panel {
    width: 240px;
  }
}

/* モバイル：fixed をやめてインライン表示。アニメーションも fade のみ */
@media (max-width: 760px) {
  .recipient-help-panel {
    position: static;
    transform: none;
    width: auto;
    max-width: 100%;
    margin: 0 0 16px;
    animation: recipient-help-fade-in .4s ease both;
  }
  .recipient-help-panel.is-hidden {
    transform: none;
    display: none;
  }
  @keyframes recipient-help-fade-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

.btn-gray {
  display: block;
  width: 100%;
  background: var(--color-btn-gray);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 20px;
  border-radius: var(--radius-btn);
  text-align: center;
  border: none;
  cursor: pointer;
  transition: background .2s;
}

.btn-gray:hover {
  background: #333;
}

.btn-outline {
  display: inline-block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  transition: border-color .2s;
}

.btn-outline:hover {
  border-color: var(--color-orange);
  color: var(--color-orange);
}

.btn-example {
  background: #999;
  border: 1px solid #ddd;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 6px;
  transition: background .2s;
  border-radius: 50px;
  color: #fff;
}

.btn-example:hover {
  color: #999;
  background: #fff;
  border: 1px solid #999;
}

/* ========== 固定下部バー ========== */
.fixed-bottom-bar {
  width: min(var(--container-max), calc(100% - 2px));
  padding: 12px 16px;
  z-index: 100;
  display: flex;
  gap: 10px;
  border-radius: 12px 12px 0 0;
  /* main コンテナの外側に置かれた場合でも中央に表示されるよう左右 auto を指定 */
  /* 本文直下に表示するため、上に少しマージンを設けて区切る */
  margin: 16px auto 0;
}

.fixed-bottom-bar__back {
  flex: 0 0 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-btn-gray);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 0 10px;
  min-height: 48px;
  border-radius: var(--radius-btn);
  text-align: center;
  border: none;
  cursor: pointer;
}

.fixed-bottom-bar__next {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--color-orange);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 0 12px;
  min-height: 48px;
  border-radius: var(--radius-btn);
  text-align: center;
  border: none;
  cursor: pointer;
  line-height: 1.2;
}

@media (min-width: 760px) {
  .fixed-bottom-bar {
    padding: 34px 160px 10px;
    width: min(var(--container-max), calc(100% - 32px));
  }
}

/* ========== カートモーダル ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.modal-overlay.hidden {
  display: none;
}

.cart-modal {
  background: #fff;
  margin-top: 56px;
  margin-right: 8px;
  border-radius: var(--radius-card);
  width: min(320px, 90vw);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.cart-modal__header {
  background: var(--color-blue);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-modal__close {
  background: transparent;
  color: #fff;
  font-size: 20px;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.cart-modal__body {
  padding: 12px 14px;
}

.cart-modal__row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
}

.cart-modal__row--total {
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
  padding-top: 8px;
  font-weight: 700;
}

.cart-modal__title {
  font-weight: 700;
  font-size: 12px;
  color: #777;
  margin-bottom: 8px;
}

.cart-modal__row--subtotal {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

/* ========== アコーディオン（コース選択） ========== */
.accordion-item {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  margin-bottom: 8px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.accordion-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}

.accordion-trigger__icon {
  font-size: 22px;
  color: var(--color-orange);
  font-weight: 700;
  line-height: 1;
  transition: transform .2s;
}

.accordion-body {
  display: none;
  padding: 0 16px 16px;
}

.accordion-body.open {
  display: block;
}

/* 商品グリッド */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

/* 2026-06-10 LINH 指示：
   - 商品画像のサイズが揃っていなくても、カードのブロックサイズは完全に揃える
   - 将来 600x600px に統一する予定。それまでは contain で画像をクロップせず表示 */
.product-card {
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 商品カード：画像（STEP2：掲載商品例）
   aspect-ratio で常に正方形のブロックを確保 → 画像サイズに依存しない */
.product-card__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* img 内部：contain で画像全体を見せる（cover だと縦長/横長画像がクロップされる） */
.product-card__img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

/* 商品名：2行で揃える（短い名前と長い名前でカード高さがずれるのを防ぐ） */
.product-card__name {
  font-size: var(--fs-textsp);
  padding: 6px 8px 8px;
  color: var(--color-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* 2行分の高さを最低限確保 → どのカードも同じ高さになる */
  min-height: calc(1.3em * 2 + 14px);
  flex: 1 1 auto;
}

/* もっと見る */
.more-row {
  display: flex;
  justify-content: center;
  margin: 10px 0 0;
}

.btn-more {
  appearance: none;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .1s, border-color .2s, color .2s;
  color: #9f9fa9;
  ;
}

.btn-more:hover {
  border-color: var(--color-orange);
  color: var(--color-orange);
  filter: brightness(.99);
}

.btn-more:active {
  transform: scale(.98);
}

/* 数量+追加 */
.qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  justify-content: right;
}

.qty-row label {
  font-size: 14px;
  color: var(--color-muted);
}

.qty-select {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  background: #fff;
}

/* 数量ステッパー：[−] [数値入力] [＋] を一体化したコンポーネント */
.qty-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.qty-stepper__btn {
  width: 32px;
  border: none;
  background: #f5f5f5;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s;
}
.qty-stepper__btn:hover {
  background: #e7e7e7;
}
.qty-stepper__btn:active {
  background: #dcdcdc;
}
.qty-stepper__input {
  width: 48px;
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  padding: 6px 4px;
  font-size: 14px;
  text-align: center;
  background: #fff;
  color: #333;
  /* number 型のスピナー（上下矢印）を非表示 */
  -moz-appearance: textfield;
  appearance: textfield;
}
.qty-stepper__input::-webkit-outer-spin-button,
.qty-stepper__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-stepper__input:focus {
  outline: none;
  background: #fffbe8;
}

.btn-add {
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}

.btn-add:hover {
  background: var(--color-blue-dark);
}

/* 合計フッター */
.total-footer {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-top: 8px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* コース見出し：タイトル＋一言コメントバッジを縦並びで表示
   一言コメントはタイトルの上に、目立つオレンジのピル型バッジとして配置 */
.accordion-trigger__label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}
.accordion-trigger__title {
  display: inline-block;
}

/* 一言コメント：オレンジのピル型バッジで目立たせる */
.course-short-comment {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  background: linear-gradient(90deg, #ff7a18, #ff5a2c);
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(255, 90, 44, 0.25);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}
@media (max-width: 480px) {
  .course-short-comment {
    font-size: 11px;
    padding: 3px 12px;
  }
}

/* カート内訳：行ごとに区切り線、商品名／数量／価格を横並びで表示 */
.cart-summary {
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.cart-summary__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}
.cart-summary__row:last-child {
  border-bottom: none;
}
.cart-summary__name {
  flex: 1 1 auto;
  min-width: 0;
  color: #333;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-summary__qty {
  flex: 0 0 auto;
  color: #666;
  font-size: 13px;
  white-space: nowrap;
}
.cart-summary__price {
  flex: 0 0 auto;
  font-weight: 700;
  color: #333;
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}
/* 行末の削除ボタン（赤系、控えめサイズ） */
.cart-summary__remove {
  flex: 0 0 auto;
  margin-left: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #d93025;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color .15s;
}
.cart-summary__remove:hover {
  background: #b1271c;
}
/* モバイル：商品行は折り返さず 1 行に収める。各要素を圧縮表示する */
@media (max-width: 480px) {
  .cart-summary__row {
    padding: 8px 10px;
    gap: 6px;
    font-size: 12px;
    flex-wrap: nowrap;
  }
  .cart-summary__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    /* 長い商品名は…で省略 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cart-summary__qty {
    font-size: 11px;
  }
  .cart-summary__price {
    min-width: 56px;
    font-size: 12px;
  }
  .cart-summary__remove {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* 合計フッターの内訳（小計・税・合計）を右側に寄せて表示。
   ラベルと金額をフレックスで両端揃え、横幅は控えめ（240px）にしてカード右端へ密着させる。 */
.total-footer__breakdown {
  margin-left: auto;
  margin-right: 4px;
  width: 100%;
  max-width: 240px;
}
.total-footer__breakdown .bf-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: #333;
  padding: 2px 0;
}
.total-footer__breakdown .bf-row > span:last-child {
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}
.total-footer__breakdown .bf-row--total {
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
}
.total-footer__breakdown .bf-row--total > span:last-child {
  font-weight: 700;
}
.total-footer__breakdown .bf-divider {
  border-top: 1px solid #ddd;
  margin: 6px 0;
}
@media (max-width: 480px) {
  .total-footer__breakdown {
    max-width: 100%;
    margin-right: 0;
  }
}

.total-footer__row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
}


@media (min-width: 980px) {
  .accordion-trigger {
    font-size: var(--fs-p2textpc)
  }

  .product-card__name {
    font-size: var(--fs-textpc);
  }
}

/* =========================================
   掲載商品一覧モーダル（もっと見る）
   ========================================= */

/* overlay もっと見る */
#js-product-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .45);

  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

/* hidden state */
#js-product-modal.hidden {
  display: none;
}

/* modal box */
.product-modal {
  width: min(920px, 92vw);
  max-height: calc(100vh - 120px);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .20);

  display: flex;
  flex-direction: column;
}

/* header */
.product-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  background: #fff;
}

.product-modal__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.product-modal__close {
  appearance: none;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.product-modal__close:hover {
  filter: brightness(.98);
}

.product-modal__close:active {
  transform: scale(.98);
}

/* body (scroll area) */
.product-modal__body {
  padding: 12px 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* list wrapper */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* list item */
.product-list-item {
  display: flex;
  gap: 12px;
  padding: 12px;

  border: 1px solid #eee;
  border-radius: 14px;
  background: #fff;
}

/* item image */
.product-list-item__img {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;

  border-radius: 12px;
  overflow: hidden;
  background: #f2f2f2;
}

.product-list-item__img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* item text */
.product-list-item__meta {
  min-width: 0;
  flex: 1 1 auto;
}

.product-list-item__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-list-item__desc {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #555;

  white-space: pre-line;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* responsive */
@media (max-width: 480px) {
  #js-product-modal {
    padding: 10px;
  }

  .product-modal {
    width: 100%;
    max-height: calc(100vh - 80px);
  }

  .product-modal__header {
    padding: 12px 12px;
  }

  .product-modal__body {
    padding: 10px 12px;
  }

  .product-list-item {
    padding: 10px;
    border-radius: 12px;
  }

  .product-list-item__img {
    width: 80px;
    height: 80px;
    border-radius: 10px;
  }
}

/* ========== 送り先入力 ========== */
.recipient-section {
  margin-bottom: 16px;
}

.recipient-section__title {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 8px;
}

.recipient-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.recipient-item__no {
  font-weight: 700;
  font-size: 14px;
  min-width: 28px;
}

/* ========== 注文確認 ========== */
.confirm-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}

.confirm-card__header {
  background: var(--color-btn-gray);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}

.confirm-card__body {
  padding: 14px;
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
}

.confirm-row--indent {
  padding-left: 16px;
  color: var(--color-muted);
}

.confirm-row--subtotal {
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
  padding-top: 8px;
}

.confirm-row--total {
  font-weight: 700;
  font-size: 15px;
}

/* 挨拶状サムネ */
.greeting-thumb {
  position: relative;
  background: linear-gradient(to bottom, #e8f0f8, #f5f8fc);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  overflow: hidden;
  cursor: pointer;
}

.greeting-thumb__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .3);
  opacity: 0;
  transition: opacity .2s;
  cursor: pointer;
}

.greeting-thumb:hover .greeting-thumb__overlay {
  opacity: 1;
}

.greeting-thumb__overlay span {
  background: #fff;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

/* ========== 注文完了ページ ========== */
.complete-top {
  text-align: center;
  padding: 20px 16px 12px;
}

.complete-top__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.complete-top__order-no {
  font-size: 13px;
  color: var(--color-muted);
}

.complete-top__body {
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.7;
}

.alert-box {
  border: 1px solid var(--color-red);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--color-red);
  line-height: 1.7;
  margin-bottom: 12px;
}

.how-to-box {
  background: var(--color-blue);
  color: #fff;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.how-to-box__title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.how-to-box__body {
  font-size: 12px;
  line-height: 1.7;
}

.sample-msg-box {
  background: rgba(255, 255, 255, .15);
  padding: 10px 12px;
  font-size: 12px;
  margin-top: 10px;
  line-height: 1.7;
}

.gift-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
  overflow: hidden;
}

.gift-card__header {
  background: var(--color-btn-gray);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-weight: 700;
  font-size: 13px;
}

.gift-card__body {
  padding: 14px;
  text-align: center;
}

.gift-card__name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.gift-card__price {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 12px;
}

.btn-copy {
  display: block;
  width: 100%;
  background: #555;
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background .2s;
}

.btn-copy:hover {
  background: #333;
}

.btn-line {
  display: block;
  width: 100%;
  background: #06C755;
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background .2s;
}

.btn-line:hover {
  background: #05a848;
}

/* ========== テンプレートカルーセル ========== */

.template-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: 0;
}

.chip__dot {
  width: 56px;
  height: 56px;
  background: #bdbdbd;
  border: 3px solid #bdbdbd;
  border-radius: 50%;
}

.chip.active .chip__dot {
  border-color: var(--color-orange);
}

.chip__label {
  font-size: 12px;
  color: var(--color-muted);
}

.chip.active .chip__label {
  color: var(--color-text);
  font-weight: 700;
}

.template-carousel-wrap {
  position: relative;
}

/* carousel */
.template-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.template-carousel::-webkit-scrollbar {
  display: none;
}

.template-card {
  width: 160px;
  flex: 0 0 auto;
  border: 2px solid var(--color-border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: #fff;
  transition: border-color .2s;
}

.template-card.selected {
  border-color: var(--color-orange);
}

.template-card__sample {
  aspect-ratio: 40 / 90;
  width: 100%;
  background: #fff;
  position: relative;
}

.template-card__sample img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.template-card__badge {
  position: absolute;
  top: 0px;
  left: 0px;
  background: var(--color-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
}

.template-card__tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, .9);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
}

.template-card__name {
  text-align: center;
  font-size: 12px;
  padding: 8px 6px;
  font-weight: 600;
}

.template-card__zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
}

.template-card__zoom:active {
  transform: scale(.98);
}


.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, .95);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}

.carousel-nav--prev {
  left: 6px;
}

.carousel-nav--next {
  right: 6px;
}

.carousel-nav:active {
  transform: translateY(-50%) scale(.98);
}

/* ===============================
   PC layout scale up
================================ */

@media (min-width: 980px) {

  /* chips */
  .template-chips {
    gap: 12px;
    margin-bottom: 16px;
  }

  .chip__dot {
    width: 64px;
    height: 64px;
  }

  .chip__label {
    font-size: var(--fs-textpc);
  }


  /* carousel */
  .template-carousel {
    gap: 16px;
    padding-bottom: 12px;
  }

  .template-card {
    width: 200px;
  }


  /* sample preview */
  .template-card__sample {
    aspect-ratio: 40/90;
  }


  /* badge */
  .template-card__badge {
    font-size: var(--fs-textpc);
    padding: 3px 10px;
  }


  /* tag */
  .template-card__tag {
    font-size: var(--fs-textpc);
    padding: 3px 10px;
  }


  /* name */
  .template-card__name {
    font-size: var(--fs-textpc);
    padding: 10px 8px;
  }


  /* zoom icon */
  .template-card__zoom {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }


  /* navigation */
  .carousel-nav {
    width: 42px;
    height: 42px;
  }

}


/* ========== プレビューページ ========== */
/*  PANEL A1 — Memorial card= */
.panel-a1 {
  position: relative;
  background: linear-gradient(160deg, #e8f0f8 0%, #f5f8fc 55%, #eaf3f0 100%);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  aspect-ratio: 755 / 2000;
  padding: 28px 20px 28px;
  text-align: center;
  overflow: hidden;
}

/* テンプレート背景画像が設定されたら solid bg を消す */
.panel-a1[style*="background-image"],
.preview-mock--A1.panel-a1,
.preview-mock--B1.panel-a1,
.preview-mock--C1.panel-a1,
.preview-mock--D1.panel-a1 {
  background-color: transparent;
  background-image: inherit;
  /* preview-mock--X1 から継承 */
}

/* 挨拶状カード固定レイアウト内のパネル */
.greeting-card-fixed {
  width: 980px;
  margin: 0 auto;
}

.greeting-card-fixed .panel-a1 {
  width: 980px;
  aspect-ratio: 960 / 2540;
  padding: 5% 8%;
  box-sizing: border-box;
  background-size: 100% 100%;
}

.greeting-card-fixed .panel-a2 {
  width: 980px;
  aspect-ratio: 960 / 926;
  padding: 5% 8%;
  box-sizing: border-box;
  background-size: 100% 100%;
}

.greeting-card-fixed .panel-a3 {
  width: 980px;
  aspect-ratio: 960 / 991;
  padding: 5% 8%;
  box-sizing: border-box;
  background-size: 100% 100%;
}

.panel-a1__lily {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 140px;
  height: 150px;
  background: radial-gradient(ellipse at 15% 15%, rgba(200, 225, 215, .55) 0%, transparent 65%);
  pointer-events: none;
}

.panel-a1__memorial {
  font-size: 32px;
  font-style: italic;
  color: var(--color-inputtext);
  letter-spacing: 0.02em;
  margin-bottom: 18px;
  font-family: 'Playfair Display', serif;
}

.panel-a1__date {
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  letter-spacing: 0.08em;
  color: var(--color-inputtext);
}

.pa1-mourner {
  font-family: var(--font-mincho);
  font-size: var(--fs-p2titlesp);
  letter-spacing: 0.08em;
  color: var(--color-inputtext);
}

.panel-a1__photo {
  width: 146px;
  height: 205px;
  /* ハードな白枠・円形クリップ・影を外し、放射状マスクで縁を背景にふんわり溶け込ませる（image2 風） */
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #ccc, #999);
  background-size: cover;
  background-position: center;
  /* 中心は不透明、縁の近く（85%〜100%）だけ細くぼかす。85% を上げるとぼけがさらに薄く／下げると広がる */
  -webkit-mask-image: radial-gradient(ellipse closest-side, #000 85%, rgba(0, 0, 0, 0) 100%);
  mask-image: radial-gradient(ellipse closest-side, #000 85%, rgba(0, 0, 0, 0) 100%);
}

.panel-a1__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.panel-a1__years {
  font-size: var(--fs-textinputsp);
  font-style: italic;
  color: #7a8fa0;
  margin-bottom: 4px;
  font-family: var(--font-mincho);
}

.panel-a1__name {
  font-size: var(--fs-kanjismall);
  font-weight: 580;
  color: var(--color-inputtext);
  font-family: var(--font-mincho);
}

.panel-a1__wave {
  height: 40px;
  margin: 0 -20px 20px;
  background: linear-gradient(180deg, transparent, rgba(160, 200, 220, .18) 50%, transparent);
}

.panel-a1__gorei {
  font-size: var(--fs-kanjismall);
  font-weight: 580;
  color: var(--color-inputtext);
  font-family: var(--font-mincho);
}

.panel-a1__aisatsu {
  font-size: var(--fs-textinputssp);
  line-height: 1.5;
  color: var(--color-inputtext);
  text-align: center;
  margin: 0;
  font-family: var(--font-mincho);
  white-space: pre-wrap;
  word-break: break-word;
}

.panel-a1__footer {
  font-size: var(--fs-textinputsp);
  line-height: 2.3;
  color: var(--color-inputtext);
  text-align: center;
  font-family: var(--font-mincho);
}

@media (min-width: 430px) {
  .panel-a1__aisatsu {
    font-size: var(--fs-textinputsp);
    margin: 25px 10px;
  }
}

@media (min-width: 540px) {
  .panel-a1__memorial {
    font-size: 42px;
  }

  .panel-a1__years {
    font-size: var(--fs-textinputtb);
  }

  .panel-a1__gorei {
    font-size: var(--fs-kanjimedium);
  }

  .panel-a1__aisatsu {
    font-size: var(--fs-textinputtb);
    margin: 40px 10px;
    white-space: pre;
  }

  .panel-a1__footer {
    font-size: var(--fs-textinputtb);
  }

  .panel-a1__name {
    font-size: var(--fs-kanjimedium);
  }

  .panel-a1__photo {
    width: 290px;
    height: 430px;
  }

  .panel-a1__date {
    font-size: var(--fs-textinputtb);
    letter-spacing: 0.08em;
  }
}


@media (min-width: 980px) {
  .panel-a1__memorial {
    font-size: 68px;
  }

  .panel-a1__name {
    font-size: var(--fs-kanjibig);
  }

  .panel-a1__years {
    font-size: var(--fs-textinputpc);
  }

  .panel-a1__gorei {
    font-size: var(--fs-kanjibig);
  }

  .panel-a1__aisatsu {
    font-size: var(--fs-textinputpc);
    margin: 77px 10px;
    white-space: pre;
  }

  .panel-a1__footer {
    font-size: var(--fs-textinputpc);
  }

  .panel-a1__date {
    font-size: var(--fs-textinputpc);
  }

  .panel-a1__photo {
    width: 350px;
    height: 490px;
  }
}

/* ============================================================
       PANEL A2 — 略歴
       ============================================================ */
.panel-a2 {
  background: #efefef;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  aspect-ratio: 960 / 926;
  padding: 50px 36px;
  box-sizing: border-box;
}

.preview-mock--A2.panel-a2,
.preview-mock--B2.panel-a2,
.preview-mock--C2.panel-a2,
.preview-mock--D2.panel-a2 {
  background-color: transparent;
}

.panel-a2__title {
  text-align: center;
  font-size: var(--fs-kanjismall);
  font-weight: 580;
  color: var(--color-inputtext);
  font-family: var(--font-mincho);
  margin-bottom: 32px;
}

.panel-a2__text {
  font-size: var(--fs-textinputsp);
  line-height: 1.8;
  color: var(--color-inputtext);
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: .06em;
  font-family: var(--font-mincho);
}

@media (min-width: 540px) {
  .panel-a2 {
    padding: 50x 66px;
  }

  .panel-a2__text {
    font-size: var(--fs-textinputtb);
    white-space: pre;
    word-break: break-all;
  }

  .panel-a2__title {
    font-size: var(--fs-kanjimedium);
  }
}

@media (min-width: 980px) {
  .panel-a2__title {
    font-size: var(--fs-kanjibig);
  }

  .panel-a2__text {
    font-size: var(--fs-textinputpc);
    white-space: pre;
    word-break: break-all;
  }

  .panel-a2 {
    padding: 56px 110px;
  }
}


/* ============================================================
       PANEL A3 — ストーリー写真 レイヤー積み重ねレイアウト
       ============================================================ */
.panel-a3 {
  background: linear-gradient(160deg, #dce8f0 0%, #e8eff8 50%, #f0f5fa 100%);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  aspect-ratio: 960 / 991;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

.preview-mock--A3.panel-a3,
.preview-mock--B3.panel-a3,
.preview-mock--C3.panel-a3,
.preview-mock--D3.panel-a3 {
  background-color: transparent;
}

/* ── レイヤーコンテナ ── */
.story-layers {
  position: relative;
  margin: 30px;
  /* 高さはJSが slot数に応じて調整 */
}

/* 各レイヤーの基底スタイル */
.story-layer {
  display: flex;
  align-items: flex-start;
  position: relative;
  /* 重なりはmargin-topで調整 */
}

/* ── 1枚だけの場合: 中央寄せ ── */
.story-layers[data-count="1"] .story-layer {
  justify-content: center;
  padding: 20px 16px 20px;
}

.story-layers[data-count="1"] .story-layer__img {
  width: 72%;
}

.story-layers[data-count="1"] .story-layer__caption {
  position: absolute;
  right: 8px;
  top: 32px;
  font-family: var(--font-mincho);
  width: 34%;
}

/* ── 2枚の場合 ── */
.story-layers[data-count="2"] .story-layer:nth-child(1) {
  padding: 16px 0 0 12px;
  margin-bottom: -40px;
  /* 次の層と重なる */
  z-index: 2;
}

.story-layers[data-count="2"] .story-layer:nth-child(1) .story-layer__img {
  width: 50%;
}

.story-layers[data-count="2"] .story-layer:nth-child(1) .story-layer__caption {
  padding: 8px 10px;
  align-self: flex-start;
  margin-top: 10px;
  font-family: var(--font-mincho);
}

.story-layers[data-count="2"] .story-layer:nth-child(2) {
  flex-direction: row-reverse;
  padding: 0 12px 16px 0;
  z-index: 1;
}

.story-layers[data-count="2"] .story-layer:nth-child(2) .story-layer__img {
  width: 50%;
}

.story-layers[data-count="2"] .story-layer:nth-child(2) .story-layer__caption {
  padding: 8px 10px;
  align-self: flex-end;
  margin-bottom: 10px;
  font-family: var(--font-mincho);
}

/* ── 3枚の場合:── */
.story-layers[data-count="3"] .story-layer:nth-child(1) {
  padding: 14px 0 0 8px;
  margin-bottom: -22px;
  z-index: 1;
}

.story-layers[data-count="3"] .story-layer:nth-child(1) .story-layer__img {
  width: 50%;
}

.story-layers[data-count="3"] .story-layer:nth-child(1) .story-layer__caption {
  padding: 6px 10px;
  align-self: flex-start;
  margin: auto 2px;
  font-family: var(--font-mincho);
}

.story-layers[data-count="3"] .story-layer:nth-child(2) {
  flex-direction: row-reverse;
  padding: 0 8px 0 0;
  margin-bottom: -21px;
  z-index: 2;
}

.story-layers[data-count="3"] .story-layer:nth-child(2) .story-layer__img {
  width: 50%;
}

.story-layers[data-count="3"] .story-layer:nth-child(2) .story-layer__caption {
  padding: 6px 10px;
  align-self: center;
  font-family: var(--font-mincho);
}

.story-layers[data-count="3"] .story-layer:nth-child(3) {
  padding: 0 0 14px 8px;
  z-index: 3;
}

.story-layers[data-count="3"] .story-layer:nth-child(3) .story-layer__img {
  width: 50%;
}

.story-layers[data-count="3"] .story-layer:nth-child(3) .story-layer__caption {
  padding: 6px 10px;
  align-self: flex-end;
  margin: auto 3px;
  font-family: var(--font-mincho);
}


@media (min-width: 980px) {

  /* ── 1枚だけの場合: 中央寄せ ── */
  .story-layers[data-count="1"] .story-layer {
    justify-content: center;
    padding: 20px 16px 20px;
  }

  .story-layers[data-count="1"] .story-layer__img {
    width: 72%;
  }

  .story-layers[data-count="1"] .story-layer__caption {
    position: absolute;
    right: 8px;
    top: 32px;
    font-family: var(--font-mincho);
    width: 34%;
  }

  /* ── 2枚の場合 ── */
  .story-layers[data-count="2"] .story-layer:nth-child(1) {
    padding: 16px 0 0 12px;
    margin-bottom: -40px;
    /* 次の層と重なる */
    z-index: 2;
  }

  .story-layers[data-count="2"] .story-layer:nth-child(1) .story-layer__img {
    width: 50%;
  }

  .story-layers[data-count="2"] .story-layer:nth-child(1) .story-layer__caption {
    padding: 8px 10px;
    align-self: flex-start;
    margin-top: 10px;
    font-family: var(--font-mincho);
  }

  .story-layers[data-count="2"] .story-layer:nth-child(2) {
    flex-direction: row-reverse;
    padding: 0 12px 16px 0;
    z-index: 1;
  }

  .story-layers[data-count="2"] .story-layer:nth-child(2) .story-layer__img {
    width: 50%;
  }

  .story-layers[data-count="2"] .story-layer:nth-child(2) .story-layer__caption {
    padding: 8px 10px;
    align-self: flex-end;
    margin-bottom: 10px;
    font-family: var(--font-mincho);
  }

  /* ── 3枚の場合:── */
  .story-layers[data-count="3"] .story-layer:nth-child(1) {
    padding: 14px 0 0 8px;
    margin-bottom: -50px;
    z-index: 1;
  }

  .story-layers[data-count="3"] .story-layer:nth-child(1) .story-layer__img {
    width: 50%;
  }


  .story-layers[data-count="3"] .story-layer:nth-child(2) {
    flex-direction: row-reverse;
    padding: 0 8px 0 0;
    margin-bottom: -50px;
    z-index: 2;
  }

  .story-layers[data-count="3"] .story-layer:nth-child(2) .story-layer__img {
    width: 50%;
  }

  .story-layers[data-count="3"] .story-layer:nth-child(2) .story-layer__caption {
    padding: 6px 10px;
    align-self: center;
    font-family: var(--font-mincho);
  }

  .story-layers[data-count="3"] .story-layer:nth-child(3) {
    padding: 0 0 14px 8px;
    z-index: 3;
  }

  .story-layers[data-count="3"] .story-layer:nth-child(3) .story-layer__img {
    width: 50%;
  }

  .story-layers[data-count="3"] .story-layer:nth-child(3) .story-layer__caption {
    padding: 6px 10px;
    align-self: flex-end;
    margin: auto 8px;
  }
}

/* 共通: 画像ボックス */
.story-layer__img {
  aspect-ratio: 4/3;
  overflow: hidden;
  flex-shrink: 0;
  background: #c8d4dc;
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}

.story-layer__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 共通: キャプション */
.story-layer__caption {
  flex: 1;
  font-size: var(--fs-textinputsp);
  line-height: 1.8;
  color: var(--color-inputtext);
  letter-spacing: .06em;
  display: flex;
  align-items: center;
}

/* A3 info block */
.panel-a3__info {
  background: rgba(255, 255, 255, .55);
  padding: 22px 16px 20px;
  margin-top: 8px;
}

.panel-a3__info-row {
  font-size: var(--fs-textinputsp);
  line-height: 2.5;
  color: var(--color-inputtext);
  letter-spacing: .12em;
  display: flex;
  justify-content: center;
  gap: 18px;
}

.panel-a3__info-label {
  color: var(--color-inputtext);
  min-width: 44px;
}

@media (min-width: 540px) {
  .story-layer__caption {
    font-size: var(--fs-textinputtb);
  }

  .panel-a3__info-row {
    font-size: var(--fs-p2texttb);
  }
}

@media (min-width: 980px) {
  .story-layer__caption {
    font-size: var(--fs-textinputpc);
  }

  .panel-a3__info-row {
    font-size: var(--fs-p2textpc);
  }
}


/* ============================================================
   PANEL A4 — 俗名・戒名・逝去日
   ============================================================ */
.panel-a4 {
  padding: 28px 24px;
  box-sizing: border-box;
}

.panel-a4 {
  background-color: #ffffff;
}

.panel-a4__rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.panel-a4__row {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: var(--fs-textinputsp);
  line-height: 2.5;
  letter-spacing: .12em;
  font-family: var(--font-mincho);
  color: var(--color-inputtext);
}

.panel-a4__label {
  min-width: 44px;
  text-align: right;
  font-family: var(--font-mincho);
  color: var(--color-inputtext);
}

@media (min-width: 540px) {
  .panel-a4__row {
    font-size: var(--fs-textinputtb);
  }
}

@media (min-width: 980px) {
  .panel-a4__row {
    font-size: var(--fs-textinputpc);
  }
}

/* A4 info block */
.panel-a4__info {
  padding: 22px 16px 20px;
}

.panel-a4__info-row {
  font-size: var(--fs-textinputsp);
  line-height: 2.5;
  color: var(--color-inputtext);
  letter-spacing: .12em;
  display: flex;
  justify-content: center;
  gap: 18px;
  font-family: var(--font-mincho);
}

.panel-a4__info-label {
  color: var(--color-inputtext);
  min-width: 44px;
  text-align: right;
}

@media (min-width: 540px) {
  .panel-a4__info-row {
    font-size: var(--fs-textinputtb);
  }
}

@media (min-width: 980px) {
  .panel-a4__info-row {
    font-size: var(--fs-textinputpc);
  }
}

/* ============================================================
       GIFT BLOCK 1 — 写真アップロード
       ============================================================ */
.btn-upload-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1.5px solid #d0d8e0;
  border-radius: 999px;
  padding: 13px;
  font-size: 14px;
  color: #445;
  background: #fff;
  cursor: pointer;
  margin-bottom: 2px;
  transition: border-color .2s;
}

.btn-upload-photo:hover {
  border-color: #7a9aaa;
}

.btn-upload-photo .material-symbols-outlined {
  font-size: 18px;
  color: #7a9aaa;
}

/* ============================================================
        GIFT BLOCK 2 — 御礼の品物 (実画像グリッド)
============================================================ */
.panel-gift {
  background: #fff;
  margin-bottom: 16px;
  padding: 18px 16px 16px;
  text-align: center;
}

.panel-gift__head {
  padding: 4px 0 6px;
  border-bottom: none;
}

.panel-gift__title {
  font-size: var(--fs-p2titlesp);
  font-weight: 700;
  color: #333;
  margin-bottom: 15px;
}

.panel-gift__sub {
  font-size: var(--fs-p2textsp);
  color: #9aa3ad;
  line-height: 1.6;
}

.panel-gift__intro {
  font-size: var(--fs-p2textsp);
  color: #9aa3ad;
  line-height: 1.7;
  margin: 0 0 38px;
  padding: 0 8px;
}

.panel-gift__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 3px;
  max-width: 320px;
  margin: 0 auto 20px;
  padding: 0;
}

.panel-gift__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.panel-gift__circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  background: #eef1f4;
  box-shadow: none;
}

.panel-gift__circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.panel-gift__item-name {
  font-size: var(--fs-p2textsp);
  color: #8f98a3;
  text-align: center;
  line-height: 1.4;
}

.panel-gift__btn {
  display: block;
  width: min(240px, 88%);
  margin: 0 auto 6px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid #d0d8e0;
  border-radius: 999px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #66707a;
  cursor: pointer;
  transition: border-color .2s;
}

.panel-gift__btn:hover {
  border-color: #7a9aaa;
}

/* 注文者プレビュー：表示専用ボタン */
#js-gift-wrap .panel-gift__btn {
  pointer-events: none;
  cursor: default;
  transition: none;
}


@media (min-width: 540px) {
  .panel-gift__title {
    font-size: var(--fs-p2titletb);

  }

  .panel-gift__sub {
    font-size: var(--fs-p2texttb);

  }

  .panel-gift__intro {
    font-size: var(--fs-p2texttb);
  }

  .panel-gift__item-name {
    font-size: var(--fs-p2texttb);
  }

  .panel-gift__btn {
    font-size: 18px;
  }

  .panel-gift__circle {
    width: 165px;
    height: 165px;

  }

  .panel-gift__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 35px 55px;
    max-width: 340px;
    margin: 0 auto 20px;
    padding: 0;
  }

}

@media (min-width: 980px) {
  .panel-gift__title {
    font-size: var(--fs-p2titlepc);

  }

  .panel-gift__sub {
    font-size: var(--fs-p2textpc);

  }

  .panel-gift__intro {
    font-size: var(--fs-p2textpc);
  }

  .panel-gift__item-name {
    font-size: var(--fs-p2textpc);
  }

  .panel-gift__btn {
    font-size: 18px;
  }

  .panel-gift__circle {
    width: 200px;
    height: 200px;

  }

  .panel-gift__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 35px 57px;
    max-width: 430px;
    margin: 0 auto 20px;
    padding: 0;
  }
}



/* ============================================================
       Card-only mode 
       ============================================================ */
body.is-card-only #app-header,
body.is-card-only .page-header,
body.is-card-only .guide-text,
body.is-card-only #js-large-preview,
body.is-card-only .fixed-bottom-bar,
body.is-card-only .btn-upload-photo,
body.is-card-only .panel-gift {
  display: none !important;
}

body.is-card-only .page-body {
  padding-bottom: 0 !important;
}




.preview-mock {
  background: linear-gradient(to bottom, #e8f0f8, #f5f8fc);
  border-radius: 10px;
  padding: 24px 16px;
  margin-bottom: 16px;
  text-align: center;
}

.preview-mock__title {
  font-size: 22px;
  font-weight: 700;
  color: #334;
  margin-bottom: 4px;
}

.preview-mock__sub {
  font-size: 13px;
  font-style: italic;
  color: #667;
  margin-bottom: 12px;
}

.preview-mock__body {
  font-size: 12px;
  line-height: 1.9;
  color: #445;
  margin-bottom: 16px;
}

.preview-mock__photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ccc, #999);
  margin: 0 auto 8px;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.preview-mock__name {
  font-size: 15px;
  font-weight: 700;
  color: #334;
  margin-bottom: 4px;
}

.preview-mock__years {
  font-size: 12px;
  color: #778;
  margin-bottom: 16px;
}

.preview-mock__history-title {
  font-size: 16px;
  font-weight: 700;
  color: #334;
  margin: 12px 0 8px;
}

.preview-mock__history {
  font-size: 12px;
  line-height: 1.8;
  color: #445;
  text-align: left;
}

.preview-mock__story-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.preview-mock__story-img {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #bbb, #999);
  border-radius: 6px;
}

/* ギフト商品カテゴリ */
.gift-category {
  margin-top: 12px;
}

.gift-category__title {
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
}

.gift-category__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  margin-bottom: 12px;
  padding: 36px;
}

.gift-category__item {
  aspect-ratio: 1;
  border-radius: 999px;
  background: linear-gradient(135deg, #e0e8f0, #d0dce8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #445;
  text-align: center;
  padding: 8px;
}

/* Preview background theo templateSample A/B/C/D */

.preview-mock {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.template-bg {
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

/* greeting-card-fixed 内では画像をパネルにぴったり合わせる */
.greeting-card-fixed .template-bg {
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/* テンプレート背景画像適用時は lily/wave の CSS 装飾を非表示 */
[class*="preview-mock--"] .panel-a1__lily,
[class*="preview-mock--"] .panel-a1__wave {
  display: none;
}

/* panel 自身に preview-mock-- クラスが付いた場合 */
.panel-a1[class*="preview-mock--"] .panel-a1__lily,
.panel-a1[class*="preview-mock--"] .panel-a1__wave {
  display: none;
}

/* =========================
   　各TEMPLATEの設定
========================= */

/* ===== Template A / B / C / D : 「Cách B」スケール方式 =====
   ─ パネルをコンテナ化（container-type）し、子要素を cqw（パネル幅の1%）でサイズ指定。
   ─ どの画面幅でも「同じ見た目・同じ改行位置」になり、PC↔SP で崩れない（縮小コピーのように見える）。
   ─ 文字は white-space: pre（自動折り返しなし＝改行は手動の \n のみ）→ 行が増減しない。
   ─ 数値の意味：
       aspect-ratio  : 背景画像の縦横比（templateA.png = 960/1360）
       __photo width : 写真の大きさ（cqw＝パネル幅の%）。margin 上＝位置
       font-size cqw : 文字サイズ（パネル幅の%）。大きく/小さくしたいならこの数値
   ※ 設計基準幅 960px 換算：26px≒2.7cqw / 60px≒6.25cqw
*/
.preview-template--a .panel-a1,
.preview-template--b .panel-a1,
.preview-template--c .panel-a1,
.preview-template--d .panel-a1 {
  container-type: inline-size;
  /* 2026-06-10 LINH 指示：本文が長い時に背景が下まで届くよう、縦比を 1500 → 1530 に拡大 */
  aspect-ratio: 960 / 1530;
  background-size: 100% 100% !important;
  background-position: center top !important;
}

/* 写真（楕円）：位置・サイズとも幅基準でスケール */
.preview-template--a .panel-a1__photo,
.preview-template--b .panel-a1__photo,
.preview-template--c .panel-a1__photo,
.preview-template--d .panel-a1__photo {
  width: 36cqw;            /* 写真の幅（パネル幅の36%） */
  height: auto;
  aspect-ratio: 8 / 7;     /* 楕円の縦横比 */
  /* 旧 33% → 25%：写真と後続の本文・令和○年○月○日まで全体を上に詰める */
  margin: 27% auto 1%;
}

/* 挨拶文：cqw でスケール＋pre で折り返さない（改行が崩れない核心） */
.preview-template--a .panel-a1__aisatsu,
.preview-template--b .panel-a1__aisatsu,
.preview-template--c .panel-a1__aisatsu,
.preview-template--d .panel-a1__aisatsu {
  font-size: 2.7cqw;
  white-space: pre;
  /* 旧 4% → 2%：上下の余白を詰めて、令和○年○月○日もさらに上に */
  margin: 2% 0;
}

/* 名前 */
.preview-template--a .panel-a1__name,
.preview-template--b .panel-a1__name,
.preview-template--c .panel-a1__name,
.preview-template--d .panel-a1__name {
  font-size: 6.25cqw;
}

/* 年月（お誕生日〜お別れの日） */
.preview-template--a .panel-a1__years,
.preview-template--b .panel-a1__years,
.preview-template--c .panel-a1__years,
.preview-template--d .panel-a1__years {
  font-size: 2.7cqw;
}

/* 日付（令和○○年○○月） */
.preview-template--a .panel-a1__date,
.preview-template--b .panel-a1__date,
.preview-template--c .panel-a1__date,
.preview-template--d .panel-a1__date {
  font-size: 2.7cqw;
}

/* ============================================================
   差出月（panel-a1__date）— 全テンプレートで非表示
   ============================================================
   2026-06-10 上長指示で差出月の表示を一時停止。
   再表示する場合はこのブロック全体を削除してください。
   ※ data は引き続きセッション/Order に保存されます（管理画面で確認可）
   ※ DOM 上には残るが display:none で領域も消えるため
     「飼い主様のお名前」が自動的に上に詰まる
   ============================================================ */
.panel-a1__date {
  display: none !important;
}

/* 差出人（家族一同より） */
.preview-template--a .panel-a1__footer,
.preview-template--b .panel-a1__footer,
.preview-template--c .panel-a1__footer,
.preview-template--d .panel-a1__footer {
  font-size: 2.7cqw;
}

/* ===== Template E ===== */
.preview-template--e .panel-a1__gorei {
  margin-top: clamp(60px, 16.3vw - 3.5px, 156px);
}

.preview-template--e .panel-a1__footer {
  margin-bottom: clamp(27px, 36.1vw + 106.2px, 46px);
}

@media (min-width: 460px) {
  .preview-template--e .panel-a1__footer {
    margin-bottom: clamp(247px, 36.1vw + 106.2px, 460px);
  }
}


/* ===== Template I ===== */
.preview-template--i .panel-a1 {
  aspect-ratio: 752 / 1060;
}

.preview-template--i .panel-a1__aisatsu {
  margin: clamp(8px, 1.4vw + 2.7px, 16px);
}

.preview-template--i .panel-a1__gorei {
  margin-top: clamp(5px, 24.1vw - 5.9px, 24px)
}


@media (min-width: 460px) {
  .preview-template--i .panel-a1__gorei {
    margin-top: clamp(88px, 24.1vw - 5.9px, 230px);
  }
}

/* ===== Template M（＝ m/n/o/p + ml/nl/ol/pl 共通。すべて preview-template--m を使用）=====
   Template A と同じ「Cách B」スケール方式。
   ─ M系は写真アップロードが無い（写真なし）ため、背景画像（960×1360）の高さがそのまま合う
     → aspect-ratio は画像どおり 960/1360（A のような縦延長は不要）。
   ─ 文字は cqw でスケール＋white-space:pre で折り返さない → PC↔SP で改行が崩れない。
*/
.preview-template--m .panel-a1 {
  container-type: inline-size;
  aspect-ratio: 960 / 1360;   /* 背景画像の比率どおり（高さを足さない） */
  /* 背景画像を「切れずに完全表示」させる。M系のパネル比率(960/1360)はテンプレ画像と一致しているため、
     100% 100% にしても歪まず、かつどのプレビューサイズでも 100%同じ位置・同じ範囲 が表示される。 */
  background-size: 100% 100% !important;
  background-position: center top !important;
}

.preview-template--m .panel-a1__aisatsu {
  font-size: 2.7cqw;
  white-space: pre;
  margin: 38% 0 0;
}

/* L 系テンプレート（ML / NL / OL / PL = 写真あり大）のみ：挨拶文の開始位置を下げる
   （M系の 38% を 50% に上書き）。L 系は背景画像の上部に大きな写真スペースがあるため、
   挨拶文をより下から始める必要がある。
   panel-a1 に付与される preview-mock--XL1 クラスで特化指定する。
   M, N, O, P（写真なし）は引き続き 38% のまま。 */
.preview-template--m .preview-mock--ML1 .panel-a1__aisatsu,
.preview-template--m .preview-mock--NL1 .panel-a1__aisatsu,
.preview-template--m .preview-mock--OL1 .panel-a1__aisatsu,
.preview-template--m .preview-mock--PL1 .panel-a1__aisatsu {
  margin: 50% 0 0;
}

.preview-template--m .panel-a1__name {
  font-size: 6.25cqw;
}

.preview-template--m .panel-a1__years {
  font-size: 2.7cqw;
  margin: 0 auto 2%;
}

.preview-template--m .panel-a1__date {
  font-size: 2.7cqw;
  margin-top: 6%;
}

.preview-template--m .panel-a1__footer {
  font-size: 2.7cqw;
  margin-top: 2%;
}

/* ===== Template S ===== */
.preview-template--s .panel-a1 {
  aspect-ratio: 752 / 960;
}

.preview-template--s .panel-a1__gorei {
  margin: 0;
}

.preview-template--s .panel-a1__aisatsu {
  margin: 0;
}

@media (min-width: 460px) {
  .preview-template--s .panel-a1__gorei {
    margin-top: clamp(43px, 11.7vw - 2.6px, 112px);
  }

  .preview-template--s .panel-a1__aisatsu {
    margin: clamp(22px, 6.1vw - 1.8px, 58px) clamp(8px, 1.4vw + 2.7px, 16px);
  }
}



/* ============================================================
   Template Q — 縦書きレイアウト (mobile first)
   ※ layout は % ベースのため clamp 不要。
     font-size のみ var(--fs-*) で切り替え。
   ============================================================ */

/* ── PANEL A1 : mobile ── */
.preview-template--q .panel-a1 {
  aspect-ratio: 752 / 1025;
  padding: 20px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  position: relative;
  text-align: right;
}

.preview-template--q .panel-a1__gorei {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: var(--fs-kanjismall);
  font-family: var(--font-mincho);
  font-weight: 580;
  letter-spacing: -0.5em;
  color: var(--color-inputtext);
  position: absolute;
  top: 13%;
  right: 4%;
}

.preview-template--q .panel-a1__aisatsu {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  line-height: 1.4;
  color: var(--color-inputtext);
  letter-spacing: 0.06em;
  white-space: pre;
  text-align: start;
  margin: 0;
  padding-right: 12%;
  overflow: visible;
  flex: 1;
  align-self: flex-end;
}

.preview-template--q .panel-a1__date {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  letter-spacing: 0.08em;
  color: var(--color-inputtext);
  position: absolute;
  top: 14%;
  left: 13%;
}

.preview-template--q .panel-a1__footer {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  line-height: 2.2;
  color: var(--color-inputtext);
  text-align: start;
  position: absolute;
  top: 14%;
  left: 6%;
}

.preview-template--q .panel-a1__lily,
.preview-template--q .panel-a1__wave {
  display: none;
}

/* ── PANEL A2 : mobile ── */
.preview-template--q .panel-a2 {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0 4%;
  box-sizing: border-box;
  gap: none;
  aspect-ratio: 752 / 680;
}



.preview-template--q .panel-a2__title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: var(--fs-kanjismall);
  font-family: var(--font-mincho);
  font-weight: 580;
  letter-spacing: -0.5em;
  color: var(--color-inputtext);
  flex-shrink: 0;
  text-align: left;
  margin-top: 35px;
}

.preview-template--q .panel-a2__text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  line-height: 1.4;
  color: var(--color-inputtext);
  letter-spacing: 0.06em;
  white-space: pre;
  word-break: break-all;
  text-align: start;
  flex: 1;
}

@media (min-width: 400px) {

  .preview-template--q .panel-a1__aisatsu {
    padding-right: 14%;
  }

  .preview-template--q .panel-a1__gorei {
    top: 12%;
    right: 4%;
  }

  .preview-template--q .panel-a1__date {
    top: 12%;
    left: 13%;
  }

  .preview-template--q .panel-a1__footer {
    top: 12%;
    left: 6%;
  }
}

@media (min-width: 540px) {

  .preview-template--q .panel-a1 {
    aspect-ratio: 752 / 960;
  }

  .preview-template--q .panel-a2 {
    gap: 3%;
  }

  .preview-template--q .panel-a2__text {
    line-height: 1.7;
  }

  .preview-template--q .panel-a2 {
    padding: 8% 4%;
  }

  .preview-template--q .panel-a2__title {
    margin: 0;
  }
}


/* ── PANEL A4 : mobile ── */
.preview-template--q #panel-a4-wrap .panel-a4 {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6% 4%;
  box-sizing: border-box;
  min-height: 140px;
}

.preview-template--q .panel-a4__info {
  display: flex;
  flex-direction: row-reverse;
  gap: 16px;
  justify-content: flex-end;
  align-items: flex-start;
}

.preview-template--q .panel-a4__info-row {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  line-height: 2.2;
  letter-spacing: 0.1em;
  color: var(--color-inputtext);
  display: block;
}

.preview-template--q .panel-a4__info-label {
  display: inline;
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  color: var(--color-inputtext);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.preview-template--q .panel-a4__info-value {
  display: inline;
  font-family: var(--font-mincho);
  font-size: var(--fs-textinputsp);
  color: var(--color-inputtext);
  letter-spacing: 0.1em;
}

/* Template Q: textarea 縦書き */
body.is-template-q .aisatsu-body,
body.is-template-q .history-body {
  min-height: 420px;
  align-items: stretch;
}

body.is-template-q .section-box :is(.history-body, .aisatsu-body) .form-textareaformat {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: pre-wrap;
  line-break: strict;
  word-break: normal;
  text-align: start;
  line-height: 1.9;
  letter-spacing: 0.08em;
  font-family: var(--font-mincho);
  min-height: 380px;
  height: 380px;
  margin: 0;
  padding: 8px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  resize: none;
  align-self: center;
  width: auto;
  max-width: 620px;
}

body.is-template-q .section-box :is(.history-body, .aisatsu-body) .form-textareaformat::placeholder {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: pre-wrap;
  line-height: 1.9;
  letter-spacing: 0.08em;
  text-align: start;
}

body.is-template-q .aisatsu-body>.form-counter,
body.is-template-q .aisatsu-body>.btn-example,
body.is-template-q .history-body>.form-counter {
  align-self: start;
}

/* ── Template Q: font-size breakpoints (layout は % なので不要) ── */
@media (min-width: 540px) {
  .preview-template--q .panel-a1__gorei {
    font-size: var(--fs-kanjismall);
    top: 14%;
    right: 5%;
  }

  .preview-template--q .panel-a1__aisatsu {
    font-size: var(--fs-textinputtb);
    padding-top: 5%;
    padding-right: 8%;
    line-height: 1.9;
  }

  .preview-template--q .panel-a1__date {
    font-size: var(--fs-textinputtb);
    top: 14%;
    left: 14%;
  }

  .preview-template--q .panel-a1__footer {
    font-size: var(--fs-textinputtb);
    top: 15%;
    left: 7%;
  }

  .preview-template--q .panel-a2__title {
    font-size: var(--fs-kanjismall);
  }

  .preview-template--q .panel-a2__text {
    font-size: var(--fs-textinputtb);
    line-height: 1.9;
  }

  .preview-template--q .panel-a4__info {
    gap: 20px;
  }

  .preview-template--q #panel-a4-wrap .panel-a4 {
    min-height: 180px;
  }

  .preview-template--q .panel-a4__info-row,
  .preview-template--q .panel-a4__info-label,
  .preview-template--q .panel-a4__info-value {
    font-size: var(--fs-textinputtb);
  }

  .preview-template--q .panel-a4__info-label {
    margin-bottom: 12px;
  }
}

@media (min-width: 980px) {
  .preview-template--q .panel-a1__gorei {
    font-size: var(--fs-kanjibig);
    top: 15%;
    right: 5%;
  }

  .preview-template--q .panel-a1__aisatsu {
    font-size: var(--fs-textinputpc);
    padding-top: 10%;
    padding-right: 15%;
  }

  .preview-template--q .panel-a1__date {
    font-size: var(--fs-textinputpc);
    top: 16%;
    left: 16%;
  }

  .preview-template--q .panel-a1__footer {
    font-size: var(--fs-textinputpc);
    top: 16%;
    left: 9%;
  }

  .preview-template--q .panel-a2__title {
    font-size: var(--fs-kanjibig);
    padding-top: 8%;
  }

  .preview-template--q .panel-a2__text {
    font-size: var(--fs-textinputpc);
    line-height: 1.9;
  }

  .preview-template--q .panel-a4__info {
    gap: 28px;
  }

  .preview-template--q #panel-a4-wrap .panel-a4 {
    min-height: 220px;
    padding: 5% 6%;
  }

  .preview-template--q .panel-a4__info-row,
  .preview-template--q .panel-a4__info-label,
  .preview-template--q .panel-a4__info-value {
    font-size: var(--fs-textinputpc);
  }

  .preview-template--q .panel-a4__info-label {
    margin-bottom: 16px;
  }
}

/* =========================
   　大きな写真（挨拶文の下・縦4:6）
   has_large_photo テンプレートで {{large_photo_data_url}} を表示する枠
========================= */
.panel-largephoto {
  width: 100%;
  aspect-ratio: 6 / 4;      /* 横幅=挨拶文と同じ、横長（6:4） */
  overflow: hidden;
  background-color: #f0f0f0;
  margin: 0;
}
.panel-largephoto__photo {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
/* aspect-ratio 非対応ブラウザ向けフォールバック（高さ概算：横長6:4 = 高さ約66.6%） */
@supports not (aspect-ratio: 6 / 4) {
  .panel-largephoto { position: relative; padding-top: 66.66%; }
  .panel-largephoto__photo { position: absolute; inset: 0; }
}

/* 【非表示】お名前・お誕生日〜お別れの日（ML/NL/OL/PL）と、俗名・戒名・逝去日（全テンプレート）。
   2026-05：M系では名前・年月を表示しない方針、また panel-a4（白い空き枠）も全テンプレートで非表示にする。 */
.panel-ml-meta,
#panel-a4-wrap {
  display: none !important;
}

/* 大きな写真の下：お名前・お誕生日〜お別れの日（ML/NL/OL/PL）
   ※ 現在は上の display:none により非表示。再表示したい場合は上の指定を外す。 */
.panel-ml-meta {
  container-type: inline-size;
  text-align: center;
  padding: 9% 8% 14%;        /* 上下の余白を広げて白い空きスペースを活用 */
  background-color: #fff;
  box-sizing: border-box;
}
.panel-ml-meta__name {
  font-family: var(--font-mincho);   /* template A と同じ明朝体 */
  font-size: 4.5cqw;                 /* お名前（少し小さめ） */
  color: #333;
  margin-bottom: 4%;
  line-height: 1.4;
  word-break: break-word;
}
.panel-ml-meta__years {
  font-family: var(--font-mincho);   /* template A と同じ明朝体 */
  font-size: 2.4cqw;                 /* お誕生日 〜 お別れの日（小さめ） */
  color: #666;
  line-height: 1.6;
}

/* ===== 注文フォームの「大きな写真」アップローダ枠（横長・四角） =====
   .photo-uploader--large でスコープし、メイン写真/背景/思い出の枠には影響させない */
.photo-uploader--large .photo-frame {
  width: min(360px, calc(100vw - 60px));
  aspect-ratio: 6 / 4;       /* 横長プレビュー */
  border-radius: 0;          /* 四角（メイン写真の円形にしない） */
  background: #f1f4f7;
}
.photo-uploader--large .photo-frame__placeholder .material-symbols-outlined {
  font-size: 34px;
}
@media (min-width: 540px) {
  .photo-uploader--large .photo-frame {
    width: min(440px, calc(100vw - 120px));
  }
}

/* =========================
   　大きな写真テンプレート（ML/NL/OL/PL）の背景
   panel 1 の背景。ファイル名は templateML.png 等（接尾番号なし）
========================= */
.preview-mock--ML1 { background-image: url('../assets/templates/templateML.png') !important; background-color: transparent !important; }
.preview-mock--NL1 { background-image: url('../assets/templates/templateNL.png') !important; background-color: transparent !important; }
.preview-mock--OL1 { background-image: url('../assets/templates/templateOL.png') !important; background-color: transparent !important; }
.preview-mock--PL1 { background-image: url('../assets/templates/templatePL.png') !important; background-color: transparent !important; }

/* =========================
   　各TEMPLATEの背景
========================= */
/* Template A */
.preview-mock--A1 {
  background-image: url('../assets/templates/templateA.png') !important;
  background-color: transparent !important;
}

.preview-mock--A2 {
  background-image: url('../assets/templates/templateA2.png') !important;
  background-color: transparent !important;
}

.preview-mock--A3 {
  background-image: url('../assets/templates/templateA3.png') !important;
  background-color: transparent !important;
}

/* Template B */
.preview-mock--B1 {
  background-image: url('../assets/templates/templateB.png') !important;
  background-color: transparent !important;
}

.preview-mock--B2 {
  background-image: url('../assets/templates/templateB2.png') !important;
  background-color: transparent !important;
}

.preview-mock--B3 {
  background-image: url('../assets/templates/templateB3.png') !important;
  background-color: transparent !important;
}

/* Template C */
.preview-mock--C1 {
  background-image: url('../assets/templates/templateC.png') !important;
  background-color: transparent !important;
}

.preview-mock--C2 {
  background-image: url('../assets/templates/templateC2.png') !important;
  background-color: transparent !important;
}

.preview-mock--C3 {
  background-image: url('../assets/templates/templateC3.png') !important;
  background-color: transparent !important;
}

/* Template D */
.preview-mock--D1 {
  background-image: url('../assets/templates/templateD.png') !important;
  background-color: transparent !important;
}

.preview-mock--D2 {
  background-image: url('../assets/templates/templateD2.png') !important;
  background-color: transparent !important;
}

.preview-mock--D3 {
  background-image: url('../assets/templates/templateD3.png') !important;
  background-color: transparent !important;
}

/* Template E */
.preview-mock--E1 {
  background-image: url('../assets/templates/templateE1.png') !important;
  background-color: transparent !important;
}

.preview-mock--E2 {
  background-image: url('../assets/templates/templateE2.png') !important;
  background-color: transparent !important;
}

.preview-mock--E3 {
  background-image: url('../assets/templates/templateE3.png') !important;
  background-color: transparent !important;
}

/* Template F */
.preview-mock--F1 {
  background-image: url('../assets/templates/templateF1.png') !important;
  background-color: transparent !important;
}

.preview-mock--F2 {
  background-image: url('../assets/templates/templateF2.png') !important;
  background-color: transparent !important;
}

.preview-mock--F3 {
  background-image: url('../assets/templates/templateF3.png') !important;
  background-color: transparent !important;
}

/* Template G */
.preview-mock--G1 {
  background-image: url('../assets/templates/templateG1.png') !important;
  background-color: transparent !important;
}

.preview-mock--G2 {
  background-image: url('../assets/templates/templateG2.png') !important;
  background-color: transparent !important;
}

.preview-mock--G3 {
  background-image: url('../assets/templates/templateG3.png') !important;
  background-color: transparent !important;
}

/* Template H */
.preview-mock--H1 {
  background-image: url('../assets/templates/templateH1.png') !important;
  background-color: transparent !important;
}

.preview-mock--H2 {
  background-image: url('../assets/templates/templateH2.png') !important;
  background-color: transparent !important;
}

.preview-mock--H3 {
  background-image: url('../assets/templates/templateH3.png') !important;
  background-color: transparent !important;
}

/* Template I */
.preview-mock--I1test {
  background-image: url('../assets/templates/templateI1.png') !important;
  background-color: transparent !important;
}

.preview-mock--I2 {
  background-image: url('../assets/templates/templateI2.png') !important;
  background-color: transparent !important;
}

.preview-mock--I3 {
  background-image: url('../assets/templates/templateI3.png') !important;
  background-color: transparent !important;
}

/* Template J */

.preview-mock--J2 {
  background-image: url('../assets/templates/templateJ2.png') !important;
  background-color: transparent !important;
}

.preview-mock--J3 {
  background-image: url('../assets/templates/templateJ3.png') !important;
  background-color: transparent !important;
}

/* Template K */

.preview-mock--K2 {
  background-image: url('../assets/templates/templateK2.png') !important;
  background-color: transparent !important;
}

.preview-mock--K3 {
  background-image: url('../assets/templates/templateK3.png') !important;
  background-color: transparent !important;
}

/* Template L */

.preview-mock--L2 {
  background-image: url('../assets/templates/templateL2.png') !important;
  background-color: transparent !important;
}

.preview-mock--L3 {
  background-image: url('../assets/templates/templateL3.png') !important;
  background-color: transparent !important;
}

/* Template M */
.preview-mock--M1 {
  background-image: url('../assets/templates/templateM.png') !important;
  background-color: transparent !important;
}

.preview-mock--M2 {
  background-image: url('../assets/templates/templateM2.png') !important;
  background-color: transparent !important;
}

/* Template N */
.preview-mock--N1 {
  background-image: url('../assets/templates/templateN.png') !important;
  background-color: transparent !important;
}

.preview-mock--N2 {
  background-image: url('../assets/templates/templateN2.png') !important;
  background-color: transparent !important;
}

/* Template O */
.preview-mock--O1 {
  background-image: url('../assets/templates/templateO.png') !important;
  background-color: transparent !important;
}

.preview-mock--O2 {
  background-image: url('../assets/templates/templateO2.png') !important;
  background-color: transparent !important;
}

/* Template P */
.preview-mock--P1 {
  background-image: url('../assets/templates/templateP.png') !important;
  background-color: transparent !important;
}

.preview-mock--P2 {
  background-image: url('../assets/templates/templateP2.png') !important;
  background-color: transparent !important;
}

/* Template Q */
.preview-mock--Q1 {
  background-image: url('../assets/templates/templateQ1.png') !important;
  background-color: transparent !important;
}

.preview-mock--Q2 {
  background-image: url('../assets/templates/templateQ2.png') !important;
  background-color: transparent !important;
}

/* Template R */
.preview-mock--R1 {
  background-image: url('../assets/templates/templateR1.png') !important;
  background-color: transparent !important;
}

.preview-mock--R2 {
  background-image: url('../assets/templates/templateR2.png') !important;
  background-color: transparent !important;
}

/* Template S */
.preview-mock--S1 {
  background-image: url('../assets/templates/templateS1.png') !important;
  background-color: transparent !important;
}

.preview-mock--S2 {
  background-image: url('../assets/templates/templateS2.png') !important;
  background-color: transparent !important;
}

/* Template T */
.preview-mock--T1 {
  background-image: url('../assets/templates/templateT1.png') !important;
  background-color: transparent !important;
}

.preview-mock--T2 {
  background-image: url('../assets/templates/templateT2.png') !important;
  background-color: transparent !important;
}

/* Template IJKL ユーザーアップ */
.preview-mock--I1,
.preview-mock--J1,
.preview-mock--K1,
.preview-mock--L1 {
  background-color: transparent !important;
}

/* ===== Template I: soft white cloud over uploaded background ===== */
.preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__content-cloud {
  position: relative;
  z-index: 2;
  width: fit-content;
  max-width: calc(100% - 56px);
  margin: 140px auto 0;
  padding: 34px 30px 28px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  isolation: isolate;
}

.preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__content-cloud::before {
  content: "";
  position: absolute;
  inset: -22px -26px;
  z-index: -2;
  background:
    /* 中央 */
    radial-gradient(70% 60% at 50% 50%,
      rgba(255, 255, 255, .5) 100%,
      rgba(255, 255, 255, .65) 52%,
      rgba(255, 255, 255, .35) 76%,
      rgba(255, 255, 255, 0) 100%),
    /* 上部 */
    radial-gradient(28% 20% at 14% 18%,
      rgba(255, 255, 255, .4) 0%,
      rgba(255, 255, 255, 0) 100%),
    radial-gradient(28% 20% at 86% 16%,
      rgba(255, 255, 255, .4) 0%,
      rgba(255, 255, 255, 0) 100%),
    /* 下部*/
    radial-gradient(26% 16% at 18% 86%,
      rgba(255, 255, 255, .3) 0%,
      rgba(255, 255, 255, 0) 100%),
    radial-gradient(26% 16% at 82% 86%,
      rgba(255, 255, 255, .3) 0%,
      rgba(255, 255, 255, 0) 100%);
  filter: blur(18px);
  pointer-events: none;
}

.preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__content-cloud::after {
  content: "";
  position: absolute;
  inset: -8px -10px;
  z-index: -1;
  background: rgba(255, 255, 255, .14);
  border-radius: 999px;
  filter: blur(24px);
  pointer-events: none;
}

/* cloud wrapper 内に spacing を移動 */
.preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__gorei {
  margin-top: 0;
}

.preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__aisatsu {
  margin: 14px 0;
}

.preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__date {
  margin-top: 8px;
}

.preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__footer {
  margin-top: 8px;
}

@media (min-width: 540px) {
  .preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__content-cloud {
    margin-top: 170px;
    padding: 40px 40px 32px;
    max-width: calc(100% - 80px);
  }
}

@media (min-width: 980px) {
  .preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__content-cloud {
    margin-top: 250px;
    padding: 54px 58px 42px;
    max-width: 720px;
  }

  .preview-mock--I1.panel-a1.panel-a1--photo-bg .panel-a1__aisatsu {
    margin: 18px 0;
  }
}

/* ===== Template I-L 背景写真アップロード ===== */
.photo-bg-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #667085;
  text-align: center;
}

.panel-a1--photo-bg {
  position: relative;
  overflow: hidden;
}

.panel-a1--photo-bg .panel-a1__gorei,
.panel-a1--photo-bg .panel-a1__aisatsu,
.panel-a1--photo-bg .panel-a1__date,
.panel-a1--photo-bg .panel-a1__footer,
.panel-a1--photo-bg .panel-a1__years,
.panel-a1--photo-bg .panel-a1__name {
  position: relative;
  z-index: 1;
}

.panel-a1--photo-bg .panel-a1__photo {
  display: none !important;
}

.panel-a1--photo-bg .panel-a1__wave {
  position: relative;
  z-index: 1;
}

/* ========== 注文者情報フォーム ========== */
.form-field {
  margin-bottom: 16px;
}

.form-field__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.form-field__label .material-symbols-outlined {
  font-size: 16px;
}

.terms-box {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  height: 150px;
  overflow-y: auto;
  padding: 12px;
  font-size: 12px;
  color: var(--color-muted);
  line-height: 1.7;
  margin-bottom: 10px;
  background: #fafafa;
}

.agree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
}

.agree-row input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.help-text {
  margin: 6px 0 10px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.4;
}

.form-row--zip .field-col {
  flex: 1 1 auto;
  min-width: 0;
}

.form-row--zip>button,
.form-row--zip>.btn-secondary {
  flex: 0 0 auto;
  width: auto;
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  border: 1px solid #2563eb;
  font-weight: 700;
  margin-bottom: 8px;
}

.form-row--zip>button:hover,
.form-row--zip>.btn-secondary:hover {
  filter: brightness(0.95);
}

.form-input.is-error,
.form-select.is-error {
  border-color: var(--color-red);
  box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.12);
}


.form-error {
  margin-top: 6px;
  color: var(--color-red);
  font-size: 12px;
  line-height: 1.4;
}

/* ========== 注記テキスト ========== */
.note-text {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

/* ========== PC対応 ========== */
@media (min-width: 1024px) {
  .btn-primary {
    max-width: 400px;
    margin: 0 auto;
  }

  .btn-gray {
    max-width: 400px;
    margin: 0 auto;
  }


}

/* ================= Inline field errors ================= */
.field-error {
  margin: 6px 0 0;
  font-size: 12px;
  color: #d93025;
  line-height: 1.3;
  min-height: 1em;
}

.is-error {
  border-color: #d93025 !important;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, .12);
}

.field-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.form-row--years .sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

/* =====================================================================
   Photo uploader + ellipse editor (frontend-only, reusable)
   - Supports: main photo + story photos (confirm after edit)
   ===================================================================== */

.photo-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.photo-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.photo-preview {
  width: 100%;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.photo-frame {
  width: min(192px, 66vw);
  /* 実際の出力（A〜D テンプレートの .panel-a1__photo）は 8/7 の横長楕円。
     アップロードUI と編集モーダルもこれに合わせ、ユーザーが「切り取り＝最終表示形」を一致させる */
  aspect-ratio: 8 / 7;
  border-radius: 50%;
  overflow: hidden;
  background: #f3f3f3;
  border: 2px dashed var(--color-border, #e6e6e6);
  position: relative;
  cursor: pointer;
  display: block;
  padding: 0;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

@media (min-width: 540px) {
  .photo-frame {
    width: min(260px, 66vw);
  }
}



.photo-frame:hover {
  border-color: var(--color-orange, #ff6b1a);
}

.photo-uploader.has-photo .photo-frame {
  border-style: solid;
}

.photo-frame__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.photo-frame__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--color-muted, rgba(0, 0, 0, .55));
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

.photo-frame__placeholder .material-symbols-outlined {
  font-size: 32px;
}

.photo-uploader.has-photo .photo-frame__img {
  display: block;
}

.photo-uploader.has-photo .photo-frame__placeholder {
  display: none;
}

.photo-uploader--bg .photo-frame {
  width: min(300px, calc(100vw - 80px));
  aspect-ratio: 752 / 1060;
  border-radius: 0;
  background: #f1f4f7;
}

.photo-uploader--bg .photo-frame__placeholder {
  gap: 8px;
}

.photo-uploader--bg .photo-frame__placeholder .material-symbols-outlined {
  font-size: 34px;
}

@media (min-width: 540px) {
  .photo-uploader--bg .photo-frame {
    width: min(360px, calc(100vw - 120px));
  }
}

.photo-preview__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.photo-preview__actions .btn-secondary {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, .12);
  background: #fff;
  color: #111;
  transition: transform .06s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.photo-preview__actions .btn-secondary:hover {
  border-color: rgba(0, 0, 0, .18);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

.photo-preview__actions .btn-secondary:active {
  transform: translateY(1px);
}

/* Primary: 写真を選択 */
.photo-preview__actions label[for="input-photo"].btn-secondary,
.photo-preview__actions label[for="input-photo-bg"].btn-secondary {
  background: var(--color-orange, #ff6b1a);
  color: #fff;
  border-color: var(--color-orange, #ff6b1a);
}

/* Neutral: 編集する */
.photo-preview__actions .js-photo-edit.btn-secondary {
  background: #f3f3f3;
  color: #333;
}

/* Soft danger: 変更する */
.photo-preview__actions .js-photo-reset.btn-secondary {
  background: #fff;
  color: #b00020;
  border-color: rgba(176, 0, 32, .35);
}

.photo-preview__actions .btn-secondary:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Error highlight */
.photo-frame.is-error {
  border-color: #d93025 !important;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, .15);
  background: rgba(217, 48, 37, .04);
}

/* Story thumbnail in uploader-box */
.uploader-box {
  position: relative;
  overflow: hidden;
}

.uploader-box .story-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ================= Photo editor modal ================= */
.photo-editor {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 16px;
  box-sizing: border-box;
}

.photo-editor * {
  box-sizing: border-box;
}

.photo-editor__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
}

.photo-editor__panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(92vh, 760px);
  margin: 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.photo-editor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.photo-editor__title {
  font-size: 16px;
  font-weight: 700;
}

.photo-editor__close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
}

.photo-editor__stageWrap {
  padding: 12px 16px 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.photo-editor__stage {
  position: relative;
  width: min(420px, 92vw);
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid rgba(0, 0, 0, .12);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .10);
  touch-action: none;
  user-select: none;
}

.photo-editor__stage.is-dragging {
  cursor: grabbing;
}

.photo-editor__img {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  cursor: grab;
  max-width: none;
  max-height: none;
  display: block;
}

.photo-editor__mask {
  position: absolute;
  inset: 0;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35) inset;
  pointer-events: none;
}

.photo-editor--memorial .photo-editor__panel {
  width: min(460px, 100%);
}

.photo-editor__stage--memorial {
  /* 出力 (A〜D テンプレートの .panel-a1__photo) と同じ 8/7 横長楕円比率に揃え、
     編集中のクロップ枠＝最終表示の形を一致させる */
  width: min(320px, calc(100vw - 120px), calc((100vh - 280px) * 8 / 7));
  aspect-ratio: 8 / 7;
}

.photo-editor__mask--ellipse {
  box-shadow: none;
}

.photo-editor__mask--ellipse::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .96);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .36);
}

.photo-editor__controls {
  padding: 0 16px 12px;
  display: grid;
  gap: 8px;
  width: 100%;
}

.photo-editor__label {
  font-size: 13px;
  color: rgba(0, 0, 0, .7);
}

.photo-editor__range {
  width: 100%;
  max-width: 100%;
  display: block;
  margin: 0;
  accent-color: var(--color-orange, #ff6b1a);
}

.photo-editor__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(0, 0, 0, .08);
  margin-top: auto;
}

/* Apply button fit-content in modal */
.photo-editor__footer .btn-primary {
  width: auto !important;
  min-width: unset !important;
  padding: 10px 18px;
  white-space: nowrap;
}

@media (max-height: 720px) {
  .photo-editor {
    padding: 10px;
  }

  .photo-editor__panel {
    max-height: calc(100vh - 20px);
  }

  .photo-editor__stage {
    width: min(300px, calc(100vw - 52px));
  }

  .photo-editor__stage--memorial {
    width: min(240px, calc(100vw - 96px));
  }
}

@media (max-width:480px) {
  .photo-editor {
    padding: 10px;
  }

  .photo-editor__panel {
    width: 100%;
  }

  .photo-editor__stage {
    width: min(300px, calc(100vw - 52px));
  }

  .photo-editor__stage--memorial {
    width: min(250px, calc(100vw - 96px));
  }

  .photo-editor__stage--bg {
    width: min(280px, calc(100vw - 72px));
  }
}

.photo-editor--bg .photo-editor__panel {
  width: min(560px, 100%);
}

.photo-editor__stage--bg {
  width: min(320px, calc(100vw - 96px), calc((100vh - 280px) * 752 / 1060));
  aspect-ratio: 752 / 1060;
  background: #dfe5ea;
}

.photo-editor__mask--bg {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .38);
  border: 2.5px solid #66a8ff;
  pointer-events: none;
}

.photo-editor__mask--bg::before,
.photo-editor__mask--bg::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #66a8ff;
  border-style: solid;
}

.photo-editor__mask--bg::before {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
}

.photo-editor__mask--bg::after {
  right: -2px;
  bottom: -2px;
  border-width: 0 3px 3px 0;
}

/* =========================================================
   思い出の写真（story / panel-a3）の背景を全テンプレート共通化
   ─ 以前は各 templateX3.png 画像（「Memories」文字入り）を使用していたが、
     シンプルに CSS の単色背景に統一し、「Memories」は CSS で描画する。
   ─ ファイル末尾に置くことで preview-mock--X3 の画像指定（!important）を上書きする。
   ========================================================= */
.panel-a3 {
  background-image: none !important;
  background-color: #fcfcfc !important;   /* 淡い白（ほぼ白・やわらかめ） */
}
/* 「Memories」見出し（以前 panel-a1__memorial で使っていた Playfair Display 斜体を再利用） */
.panel-a3::before {
  content: "Memories";
  display: block;
  font-family: 'Playfair Display', 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 6vw, 34px);
  color: #9a9a9a;
  letter-spacing: 0.04em;
  text-align: center;
  margin: 0 0 18px;
}

/* =========================================================
   M系（preview-template--m ＝ m/n/o/p + ml/nl/ol/pl）専用
   思い出の写真（story / panel-a3）の縦並びレイアウト
   ─ A〜D 用の「斜め重ね（tilted overlap）」レイアウトは
     aspect-ratio 960/991 前提で M系では崩れるため、ここで上書き。
   ─ 写真は中央に縦積み、キャプションは写真の下に中央寄せ。
   ─ 高さは内容に合わせて自動（余白が出すぎないよう padding は控えめ）。
   ─ 文字サイズは cqw でカード幅にスケール（PC↔SP で崩れない）。
   ========================================================= */
.preview-template--a .panel-a3,
.preview-template--b .panel-a3,
.preview-template--c .panel-a3,
.preview-template--d .panel-a3,
.preview-template--m .panel-a3 {
  container-type: inline-size;
  aspect-ratio: auto;            /* 高さは内容なり（固定比率にしない） */
  padding: 7% 8% 9%;
  box-sizing: border-box;
}

/* Memories 見出しも cqw でスケール */
.preview-template--a .panel-a3::before,
.preview-template--b .panel-a3::before,
.preview-template--c .panel-a3::before,
.preview-template--d .panel-a3::before,
.preview-template--m .panel-a3::before {
  font-size: 7cqw;
  margin: 0 0 6%;
}

/* レイヤーコンテナ：縦並び（各行は左右交互＝ジグザグ）。重ね・回転を解除 */
.preview-template--a .panel-a3 .story-layers,
.preview-template--b .panel-a3 .story-layers,
.preview-template--c .panel-a3 .story-layers,
.preview-template--d .panel-a3 .story-layers,
.preview-template--m .panel-a3 .story-layers {
  position: static;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6%;
}

/* 各行：写真＋キャプションを横並び（nth-child の重ね指定を打ち消す） */
.preview-template--a .panel-a3 .story-layer,
.preview-template--b .panel-a3 .story-layer,
.preview-template--c .panel-a3 .story-layer,
.preview-template--d .panel-a3 .story-layer,
.preview-template--m .panel-a3 .story-layer {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100%;
  padding: 0 !important;
  margin: 0 !important;
  gap: 4%;
  z-index: auto !important;
  transform: none !important;
}

/* 偶数行は左右反転（＝写真が右側）→ ジグザグ（交互）配置 */
.preview-template--a .panel-a3 .story-layer:nth-child(even),
.preview-template--b .panel-a3 .story-layer:nth-child(even),
.preview-template--c .panel-a3 .story-layer:nth-child(even),
.preview-template--d .panel-a3 .story-layer:nth-child(even),
.preview-template--m .panel-a3 .story-layer:nth-child(even) {
  flex-direction: row-reverse !important;
}

/* 写真：横幅 56%・4:3・白いフォトフレーム（ポラロイド風）でかわいく */
.preview-template--a .panel-a3 .story-layer__img,
.preview-template--b .panel-a3 .story-layer__img,
.preview-template--c .panel-a3 .story-layer__img,
.preview-template--d .panel-a3 .story-layer__img,
.preview-template--m .panel-a3 .story-layer__img {
  width: 56% !important;
  flex: 0 0 56%;
  aspect-ratio: 4 / 3;
  box-sizing: border-box;
  background-clip: padding-box;    /* 写真を白フチの内側に収める */
  border: 1.6cqw solid #fff;        /* 白いフォトフレーム風のフチ（控えめに） */
  border-bottom-width: 2.4cqw;      /* 下だけ少しだけ太く＝ポラロイド風 */
  border-radius: 2px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .18);
}

/* かわいさUP：写真をほんの少し傾ける（左右交互） */
.preview-template--a .panel-a3 .story-layer:nth-child(odd) .story-layer__img,
.preview-template--b .panel-a3 .story-layer:nth-child(odd) .story-layer__img,
.preview-template--c .panel-a3 .story-layer:nth-child(odd) .story-layer__img,
.preview-template--d .panel-a3 .story-layer:nth-child(odd) .story-layer__img,
.preview-template--m .panel-a3 .story-layer:nth-child(odd) .story-layer__img {
  transform: rotate(-1.6deg);
}
.preview-template--a .panel-a3 .story-layer:nth-child(even) .story-layer__img,
.preview-template--b .panel-a3 .story-layer:nth-child(even) .story-layer__img,
.preview-template--c .panel-a3 .story-layer:nth-child(even) .story-layer__img,
.preview-template--d .panel-a3 .story-layer:nth-child(even) .story-layer__img,
.preview-template--m .panel-a3 .story-layer:nth-child(even) .story-layer__img {
  transform: rotate(1.6deg);
}

/* キャプション：写真の隣・上下中央・cqw でスケール */
.preview-template--a .panel-a3 .story-layer__caption,
.preview-template--b .panel-a3 .story-layer__caption,
.preview-template--c .panel-a3 .story-layer__caption,
.preview-template--d .panel-a3 .story-layer__caption,
.preview-template--m .panel-a3 .story-layer__caption {
  position: static !important;
  align-self: center !important;   /* 旧CSSの flex-start / flex-end を打ち消し、常に上下中央 */
  flex: 1 1 auto;
  width: auto !important;
  display: block;
  margin: 0 !important;
  padding: 0 !important;
  font-family: var(--font-mincho);
  font-size: 3.2cqw;
  line-height: 1.7;
  text-align: center;
  color: var(--color-inputtext);
  letter-spacing: .04em;
  white-space: pre-wrap;      /* 改行は残しつつ、長文は折り返す */
  word-break: break-word;
}

/* =========================================================
   略歴（panel-a2 ＝ ■ペットとの思い出）を story（panel-a3）と統一
   ─ 背景は story と同じ淡い白（#fcfcfc）。
   ─ container-query + cqw で文字サイズをカード幅にスケール（PC↔SP 同じ見た目）。
   ─ 本文は必ず自動折り返し（@media の white-space:pre を打ち消す）→ はみ出さない。
   ─ パネル高さは aspect-ratio:auto で「入力文字数に応じて」自動で増減。
   対象: Template A / B / C / D ＋ M系（m/n/o/p + ml/nl/ol/pl = preview-template--m）
   ========================================================= */
.preview-template--a .panel-a2,
.preview-template--b .panel-a2,
.preview-template--c .panel-a2,
.preview-template--d .panel-a2,
.preview-template--m .panel-a2 {
  container-type: inline-size;
  aspect-ratio: auto;                    /* 高さは内容なり（文字量で増減） */
  background-image: none !important;
  background-color: #F7F5F0 !important;  /* 温かみのあるアイボリー系（弔事の落ち着いた雰囲気に合わせる） */
  padding: 8% 9% 10%;
  box-sizing: border-box;
}

/* 見出し「略歴」 */
.preview-template--a .panel-a2__title,
.preview-template--b .panel-a2__title,
.preview-template--c .panel-a2__title,
.preview-template--d .panel-a2__title,
.preview-template--m .panel-a2__title {
  font-size: 5.6cqw;
  margin-bottom: 5%;
}

/* 本文：cqw でスケール＋必ず折り返す（はみ出し防止）。文字数に応じて高さが伸びる */
.preview-template--a .panel-a2__text,
.preview-template--b .panel-a2__text,
.preview-template--c .panel-a2__text,
.preview-template--d .panel-a2__text,
.preview-template--m .panel-a2__text {
  font-size: 3cqw;
  line-height: 1.9;
  white-space: pre-wrap !important;      /* @media の white-space:pre を打ち消す */
  word-break: break-word !important;
}