/* maker側の文字を太く見せる */
.ihaimaker .image .text-element .el-text,
.ihaimaker .image .dyn-text .el-text {
  font-weight: 900 !important;
  -webkit-text-stroke: 0.5px currentColor;
  text-stroke: 0.5px currentColor;
}

/* スマホ: フォームモードで表裏を横並び表示（裏返しアニメ無し） */
@media (max-width: 840px) {
  .form-container .ihaimaker .image.omote,
  .form-container .ihaimaker .image.ura {
    position: relative !important;
    display: inline-block !important;
    width: 50% !important;
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
    float: left;
    margin-bottom: 1em;
  }
  .form-container .ihaimaker .image .uragaeshi {
    display: none !important;
  }
  .form-container .ihaimaker .image.omote,
  .form-container .ihaimaker .image.ura {
    pointer-events: none;
  }
  .preview-modal-overlay * {
    pointer-events: auto !important;
  }
  .ihaimaker {
    padding: 0 !important;
  }
}

/* 表裏プレビューのラッパー。
   通常は display:contents で透過させ、PC フォーム / チャット / 拡大モーダルの
   レイアウトには一切影響させない。スマホのフォームモードのみ下で実体化する。 */
.form-preview-wrap {
  display: contents;
}

/* スマホで sticky を機能させるため、スクロールコンテナを作らない clip を全幅で使う。
   overflow-x: hidden だと body がスクロールボックス化して position:sticky が無効になる。 */
html,
body {
  overflow-x: clip !important;
}

/* ===== スマホ: フォームモードのプレビューを上部に固定（チャットモードと同様） ===== */
@media (max-width: 840px) {
  .form-container .form-preview-wrap {
    display: flex !important;
    justify-content: center;
    align-items: flex-start; /* 上揃え。戒名など上部を見せ、下部ははみ出させてクロップ */
    gap: 0;
    position: sticky;
    top: 48px; /* maker-header (48px) の直下。狭幅では下のブロックで上書き */
    z-index: 5;
    background: #fff;
    aspect-ratio: 1 / 0.8; /* チャットモードのプレビューと同じ縦横比 */
    overflow: hidden; /* はみ出した下部をクロップ → チャット同様に文字を大きく表示 */
    margin: 0 0 0.6em;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.12);
  }
  /* 固定バンド内では表裏を幅50%（実寸スケール）で並べ、文字を拡大表示する。
     高さは aspect-ratio に従い自然に伸び、バンドからはみ出した分はクロップされる。 */
  .form-container .form-preview-wrap .image.omote,
  .form-container .form-preview-wrap .image.ura {
    float: none !important;
    width: 50% !important;
    height: auto !important;
    margin: 0 !important;
  }
  /* ソフトキーボード表示中は固定プレビューを隠して入力領域を確保 */
  body.keyboard-open .form-container .form-preview-wrap {
    display: none !important;
  }
}
@media (max-width: 480px) {
  .form-container .form-preview-wrap {
    top: 44px; /* maker-header 44px */
  }
}
@media (max-width: 400px) {
  .form-container .form-preview-wrap {
    top: 50px; /* maker-header 50px */
  }
}

/* ===== 位牌画像: layoutmakerと一致させるため 260:600 + cover で表示 ===== */
.ihaimaker .image.omote,
.ihaimaker .image.ura {
  display: block !important;
  aspect-ratio: 260 / 600 !important;
  height: auto !important;
  overflow: hidden !important;
  top: 0px;
}
body.chatmode .shared-preview .ihaimaker .image,
body.chatmode .shared-preview .ihaimaker .image.omote,
body.chatmode .shared-preview .ihaimaker .image.ura {
  width: 50% !important;
  display: inline-block !important;
  aspect-ratio: 260 / 600 !important;
  height: auto !important;
  overflow: hidden !important;
}
.ihaimaker .image.omote > img.ihaiimg,
.ihaimaker .image.ura > img.ihaiimg {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  max-width: none !important;
  max-height: none !important;
  display: block !important;
}

/* ===== PCフォームモード: 左右分割 ===== */
@media (min-width: 768px) {
  body,
  html {
    overflow-x: clip !important;
  }
  .page-container {
    overflow: visible !important;
  }
  .ihaimaker {
    display: flex !important;
    align-items: flex-start;
    overflow: visible !important;
  }
  .form-container {
    overflow: visible !important;
  }
  .ihaimaker .image {
    flex-shrink: 0;
    position: sticky !important;
    overflow: hidden !important;
    align-self: flex-start;
  }
  .form-right-col {
    flex: 1;
    min-width: 0;
    padding-left: 1em;
    overflow: visible !important;
  }
}
.form-right-col {
  /* スマホではそのまま */
}

/* ===== レイアウト・梵字選択（フォームモード） ===== */
.form-selectors {
  margin: 0.5em 0 1em;
}
.form-selector-group {
  margin-bottom: 0.8em;
}
.form-selector-label {
  padding-left: 5px;
  border-left: 5px solid #c6a261;
  margin-bottom: 0.5em;
  font-weight: bold;
}
.form-selector-label .tab-icon {
  width: 18px;
  height: 18px;
}
.form-selector-items {
  display: flex !important;
  flex-wrap: wrap;
  gap: 0.5em;
  padding: 0.3em 0;
  height: auto !important;
  white-space: normal !important;
  background: none !important;
  overflow: visible !important;
}
.form-selector-items .layout1,
.form-selector-items .bonji1 {
  flex-shrink: 0;
  width: 120px !important;
  height: auto !important;
  max-width: 31%;
  border: 2px solid #e0e0e0 !important;
  border-radius: 6px !important;
  padding: 4px !important;
  margin: 0 !important;
  cursor: pointer;
  background: #fafafa !important;
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition: border-color 200ms;
}
.form-selector-items .layout1 img,
.form-selector-items .bonji1 img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  filter: brightness(0.3);
}
.form-selector-items .bonji1 .bonji-label {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.25;
  color: #555;
  text-align: center;
  word-break: keep-all;
}
.form-selector-items .layout1.selected,
.form-selector-items .bonji1.selected {
  border-color: #c6a261 !important;
  background: #fffbf0 !important;
  box-shadow: 0 0 0 2px rgba(198, 162, 97, 0.3);
}
.form-selector-items .layout1:hover,
.form-selector-items .bonji1:hover {
  border-color: #c6a261 !important;
}

/* ===== 専用ヘッダー ===== */
.maker-header {
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 2px solid #c6a261;
  padding: 0 12px;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.maker-header-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.maker-header-logo img {
  height: 2em;
}
.maker-header-center {
  display: flex;
  margin: 0 auto;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #c6a261;
}
.maker-mode-tab {
  padding: 5px 18px;
  font-size: 0.85em;
  font-weight: bold;
  cursor: pointer;
  color: #c6a261;
  background: transparent;
  transition: all 200ms;
  user-select: none;
  white-space: nowrap;
}
.maker-mode-tab.active {
  color: #fff;
  background: #c6a261;
}
.maker-mode-tab:hover:not(.active) {
  background: rgba(198, 162, 97, 0.15);
}
.maker-header-right {
  flex-shrink: 0;
}
.maker-header-btn.btnchange {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 5px 14px;
  font-size: 0.8em;
  box-shadow: none;
}
/* 専用ヘッダーがある場合、共通ヘッダーを非表示 */
.maker-header ~ .page-container .site-header {
  display: none;
}
/* ヘッダー分のpage-container調整 */
.maker-header + .page-container {
  padding-top: 0;
}

@media (max-width: 480px) {
  .maker-header {
    padding: 0 8px;
    height: 44px;
  }
  .maker-mode-tab {
    padding: 4px 12px;
    font-size: 0.75em;
  }
  .maker-header-btn.btnchange {
    padding: 4px 10px;
    font-size: 0.7em;
  }
}
@media (max-width: 400px) {
  .maker-header {
    padding: 0 4px;
    height: 50px;
    gap: 4px;
  }
  .maker-header-logo img {
    height: 1.4em;
  }
  .maker-mode-tab {
    padding: 3px 8px;
    font-size: 0.7em;
  }
  .maker-header-btn.btnchange {
    padding: 3px 6px;
    font-size: 0.65em;
  }
}

/* ===== モード切替 ===== */
.mode-switcher {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  background: #f5f5f5;
  border-bottom: 2px solid #c6a261;
}
.mode-tab {
  flex: 1;
  text-align: center;
  padding: 0.5em;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  color: #888;
  background: #e8e8e8;
  transition: all 200ms;
  user-select: none;
}
.mode-tab.active {
  color: #fff;
  background: #c6a261;
}
.mode-tab:hover:not(.active) {
  background: #ddd;
}

/* ===== チャットモード ===== */
.chat-container {
  display: none;
  background: #fff;
  flex: 1;
  min-width: 0;
}
.chat-container.active {
  display: flex;
  flex-direction: column;
}
.form-container {
  display: none;
}
.form-container.active {
  display: block;
}

/* 共有プレビュー+チャット 横並びラッパー */
.chat-layout {
  display: none;
}
body.chatmode .chat-layout {
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  height: calc(100vh - 50px);
}

/* 共有プレビュー */
.shared-preview {
  display: none;
}
body.chatmode .shared-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 50%;
  min-width: 300px;
  background: #eee;
  padding: 0 1em 1em;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  height: calc(100vh - 48px);
}
body.chatmode .shared-preview .ihaimaker {
  text-align: center;
  width: 100%;
  padding: 0;
  margin: 0;
}
body.chatmode .shared-preview .ihaimaker .image {
  width: 50% !important;
  max-width: 100%;
}
body.chatmode .shared-preview .ihaimaker .image.ura {
  position: relative !important;
  display: inline-block !important;
  opacity: 1 !important;
  transform: none !important;
  width: 50% !important;
  max-width: 100%;
}
body.chatmode .shared-preview .ihaimaker .image.omote {
  position: relative !important;
  display: inline-block !important;
}

/* チャットモード時はフッター非表示 */
body.chatmode .site-footer {
  display: none !important;
}

/* チャット側 */
body.chatmode .chat-container.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  height: calc(100vh - 48px);
  position: relative;
}

/* 進捗バー: プレビュー下部に配置 */
.shared-preview .chat-progress {
  width: 100%;
  margin-top: 75px;
  position: relative;
  z-index: 1;
}

/* スマホ: 縦並び */
@media (max-width: 480px) {
  body.chatmode .chat-layout {
    flex-direction: column;
  }
  body.chatmode .shared-preview {
    width: 100%;
    min-width: 0;
    position: relative;
    max-height: none;
    height: auto;
    padding: 0;
  }
  .shared-preview .chat-progress {
    margin-top: 0 !important;
  }
  body.chatmode .shared-preview .ihaimaker {
    aspect-ratio: 1 / 0.8;
    overflow: hidden;
  }
  body.chatmode.keyboard-open .shared-preview .ihaimaker {
    height: 0 !important;
    overflow: hidden !important;
  }
  body.chatmode .shared-preview .ihaimaker .image,
  body.chatmode .shared-preview .ihaimaker .image.ura {
    width: 50% !important;
    max-width: none;
  }
  body.chatmode .chat-layout {
    height: calc(100dvh - 48px);
  }
  body.chatmode .chat-container.active {
    flex: 1;
    min-height: 0;
    max-height: none;
  }
  body.chatmode .shared-preview .ihaimaker .image .menmark {
    top: 0.3em;
  }
  body.chatmode .shared-preview .ihaimaker .image .menmark img {
    width: 2em;
  }
  body.chatmode .shared-preview .ihaimaker .image.omote .menmark {
    right: 0.3em;
  }
  body.chatmode .shared-preview .ihaimaker .image.ura .menmark {
    left: 0.3em;
  }
}

.chat-messages {
  padding: 1em;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  background: #fff;
}
.chat-msg {
  margin-bottom: 1.5em;
  margin-top: 2em;
  display: flex;
  align-items: flex-start;
}
.chat-msg.bot {
  justify-content: flex-start;
}
.chat-msg.user {
  justify-content: flex-end;
}
.chat-bubble {
  padding: 0.75em 0.5em 0.75em 0.75em;
  border-radius: 1em;
  line-height: 1.5;
  font-size: 0.95em;
  word-break: break-word;
  position: relative;
}

/* フォームモード上部: チャット最初の吹き出しと同じ案内 */
.form-ihai-info {
  display: none; /* 内容が入ったら JS が block に切替 */
  background: #eee;
  color: #333;
  border-radius: 1em;
  border-bottom-left-radius: 0.3em;
  padding: 0.9em 1em;
  margin: 0em auto 1em;
  max-width: 540px;
  font-size: 0.95em;
  line-height: 1.5;
}
.form-ihai-info.has-content { display: block; }
.chat-msg.bot .chat-bubble {
  background: #eee;
  color: #333;
  border-bottom-left-radius: 0.3em;
  margin-left: 0.6em;
}
.chat-msg.bot .chat-bubble::before {
  content: "";
  position: absolute;
  left: -0.5em;
  bottom: 0;
  width: 0;
  height: 0;
  border: 0.4em solid transparent;
  border-right-color: #eee;
  border-bottom-color: #eee;
}
.chat-msg.user .chat-bubble {
  background: #c6a261;
  color: #fff;
  border-bottom-right-radius: 0.3em;
  margin-right: 0.6em;
}
/* 過去ステップの自分の吹き出し: クリックで再入力可能 */
.chat-msg.user[data-step-index] .chat-bubble {
  cursor: pointer;
  transition: background 0.15s;
}
.chat-msg.user[data-step-index] .chat-bubble:hover {
  background: #b18f50;
}
.chat-msg.user[data-step-index] .chat-bubble:hover::after {
  border-left-color: #b18f50;
  border-bottom-color: #b18f50;
}
.chat-msg.user .chat-bubble::after {
  content: "";
  position: absolute;
  right: -0.5em;
  bottom: 0;
  width: 0;
  height: 0;
  border: 0.4em solid transparent;
  border-left-color: #c6a261;
  border-bottom-color: #c6a261;
}

/* やり直しボタン */
.chat-restart-btn {
  padding: 0.3em 0.75em;
  background: #ccc;
  border: 1px solid #ccc;
  border-radius: 2em;
  color: #000;
  font-size: 0.8em;
  cursor: pointer;
  transition: all 150ms;
  font-weight: bold;
}
.chat-restart-btn:hover {
  background: #eee;
  color: #000;
}

.chat-input-area {
  display: flex;
  padding: 0.75em 1em;
  border: none;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  outline: none;
  background: #f0ede8;
  align-items: center;
  gap: 0.5em;
}
.chat-input-area input[type="text"] {
  flex: 1;
  padding: 0.6em 1em;
  border: 1px solid #ccc;
  border-radius: 2em;
  font-size: 1em;
  outline: none;
}
.chat-input-area input[type="text"]::placeholder {
  color: #ccc;
}
.chat-input-area input[type="text"]:focus {
  border-color: #c6a261;
}
.chat-send-btn {
  padding: 0.6em 1.5em;
  background: #c6a261;
  color: #fff;
  border: none;
  border-radius: 2em;
  font-weight: bold;
  cursor: pointer;
  font-size: 1em;
}
.chat-send-btn:hover {
  opacity: 0.8;
}
@media screen and (max-width: 375px) {
  .chat-restart-btn { padding: 0.3em 0.5em; line-height: 1.2em; }
  .chat-send-btn { padding: 0.6em 1em; }
}
.chat-confirm-ihai-btn {
  display: none !important;
  padding: 0.6em 1.5em;
  background: #c6a261;
  color: #fff;
  border: none;
  border-radius: 2em;
  font-weight: bold;
  cursor: pointer;
  font-size: 1em;
  width: auto;
  position: absolute;
  right: 1em;
}
.chat-confirm-ihai-btn:hover {
  opacity: 0.8;
}

/* チャット選択肢ボタン */
.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-top: 0.5em;
}
.chat-option-btn {
  padding: 0.4em 1em;
  background: #fff;
  border: 2px solid #c6a261;
  border-radius: 2em;
  color: #c6a261;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 150ms;
}
.chat-option-btn:hover {
  background: #c6a261;
  color: #fff;
}

/* チャット画像選択肢 */
.chat-image-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em;
  margin-top: 0.5em;
}
.chat-image-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: #515151;
  border: 3px solid transparent;
  border-radius: 0.7em;
  padding: 0.5em;
  cursor: pointer;
  transition: all 150ms;
  width: 8em;
  box-sizing: border-box;
}
.chat-image-btn img {
  width: 100%;
  /*height: 5.5em;*/
  object-fit: contain;
}
.chat-image-btn .chat-img-label {
  color: #ddd;
  font-size: 0.75em;
  margin-top: 0.3em;
  text-align: center;
  line-height: 1.2;
  word-break: break-all;
}
.chat-image-btn:hover {
  border-color: #c6a261;
}
.chat-image-btn.selected {
  border-color: #c6a261;
  background: #5f5541;
}
.chat-image-btn.disabled {
  opacity: 0.4;
}
.chat-image-btn.disabled:hover {
  opacity: 0.7;
  cursor: pointer;
}

/* チャットファイルアップロード */
.chat-file-area {
  margin-top: 0.5em;
}
.chat-file-btn {
  display: inline-block;
  padding: 0.5em 1.2em;
  background: #fff;
  border: 2px solid #c6a261;
  border-radius: 2em;
  color: #c6a261;
  font-weight: bold;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 150ms;
}
.chat-file-btn:hover {
  background: #c6a261;
  color: #fff;
}
.chat-file-names {
  margin-top: 0.4em;
}
.chat-file-item {
  font-size: 0.85em;
  padding: 0.2em 0;
  color: #555;
}
.chat-file-done-btn,
.chat-file-buttons .chat-skip-btn {
  padding: 0.5em 1.2em;
  color: #fff;
  border: none;
  border-radius: 2em;
  font-weight: bold;
  font-size: 0.9em;
  cursor: pointer;
  line-height: 1.2;
  box-sizing: border-box;
  margin: 0;
}
.chat-file-done-btn {
  background: #c6a261;
}
.chat-file-buttons .chat-skip-btn {
  background: #aaa;
}
.chat-file-done-btn:hover,
.chat-file-buttons .chat-skip-btn:hover {
  opacity: 0.8;
}

/* チャットスキップ */
.chat-skip-btn {
  padding: 0.3em 0.8em;
  background: #aaa;
  color: #fff;
  border: none;
  border-radius: 1em;
  cursor: pointer;
  font-size: 0.85em;
  margin-top: 0.3em;
}
.chat-skip-btn:hover {
  opacity: 0.8;
}

/* ===== プレビュー拡大 ===== */
.preview-expand-btn {
  position: fixed;
  margin-top: 0.3em;
  padding: 0.4em 1.2em;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 1.5em;
  font-size: 0.8em;
  cursor: pointer;
  z-index: 10;
  transition: background 150ms;
}
.preview-expand-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}
/* フォームモードの拡大ボタンは、案内メッセージ追加で位置がズレないよう JS で top を上書きする
   （adjustExpandBtnPosition in maker.js）。CSS では fallback 値のみ指定。 */
.form-container .preview-expand-btn {
  top: 56px; /* JS が後で上書き。fallback: maker-header (48px) の直下 */
  left: 50%;
  transform: translate(-50%, 0);
}
@media (min-width: 481px) {
  .form-container .preview-expand-btn {
    left: 29.5%;
  }
}
@media (max-width: 480px) {
  .form-container .preview-expand-btn { top: 50px; }
}
@media (max-width: 400px) {
  .form-container .preview-expand-btn { top: 56px; }
}

/* 拡大モーダル */
.preview-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 99999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.preview-modal-overlay.show {
  display: flex;
}
.preview-modal-close {
  position: absolute;
  top: 1em;
  right: 1em;
  width: 2.5em;
  height: 2.5em;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  color: #fff;
  font-size: 1.2em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}
.preview-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
/* モーダル内の .ihaimaker はスマホフォームモードと同じ表示 */
.preview-modal-body {
  width: 95vw;
  max-width: 360px;
}
.preview-modal-body .ihaimaker {
  background: transparent !important;
  padding: 0 !important;
  max-width: 100% !important;
  position: relative !important;
}
.preview-modal-body .ihaimaker .image {
  width: 100% !important;
  display: block !important;
  overflow: hidden !important;
}
.preview-modal-body .ihaimaker .image.omote {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  left: 0 !important;
  top: 0 !important;
  transform: rotateY(0deg) !important;
  opacity: 1 !important;
  transition: transform 300ms 0s linear !important;
}
.preview-modal-body .ihaimaker .image.ura {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  display: block !important;
  width: 100% !important;
  transform: rotateY(180deg) !important;
  opacity: 0 !important;
  transition: transform 300ms 0s linear !important;
}
.preview-modal-body .ihaimaker.anime1 .image.omote {
  transform: rotateY(90deg) !important;
  opacity: 1 !important;
}
.preview-modal-body .ihaimaker.anime1 .image.ura {
  transform: rotateY(90deg) !important;
  opacity: 0 !important;
}
.preview-modal-body .ihaimaker.anime2 .image.omote {
  transform: rotateY(180deg) !important;
  opacity: 0 !important;
}
.preview-modal-body .ihaimaker.anime2 .image.ura {
  transform: rotateY(0deg) !important;
  opacity: 1 !important;
}
.preview-modal-body .ihaimaker.anime3 .image.omote {
  transform: rotateY(90deg) !important;
  opacity: 0 !important;
}
.preview-modal-body .ihaimaker.anime3 .image.ura {
  transform: rotateY(90deg) !important;
  opacity: 1 !important;
}
.preview-modal-body .ihaimaker .image .uragaeshi {
  display: block;
}
.preview-modal-hint {
  position: absolute;
  top: 1em;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.85em;
  text-align: center;
  z-index: 10;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.4em 1em;
  border-radius: 999px;
  white-space: nowrap;
}
.preview-modal-close {
  background: rgba(0, 0, 0, 0.5) !important;
  border-radius: 50% !important;
}

/* ===== チャット完了時の注文ボタン ===== */
.chat-order-area {
  display: none;
  max-width: 1280px;
  margin: 0 auto;
}
.chat-order-area.show {
  display: block;
}

/* ===== チャット進捗バー ===== */
.chat-progress {
  padding: 0em 0;
}
.chat-progress-bar {
  height: 6px;
  background: #e0ddd0;
  border-radius: 3px;
  overflow: hidden;
}
@media (min-width: 481px) {
  .chat-progress-bar {
    margin-top: -45px;
  }
}
.chat-progress-fill {
  height: 100%;
  background: #c6a261;
  border-radius: 3px;
  transition: width 300ms;
  width: 0%;
}
.chat-progress-text {
  font-size: 0.8em;
  color: #888;
  margin-top: 1em;
  /* text-shadow: 0 0 3px #fff, 0 0 6px #fff, 0 0 10px #fff; */
  position: absolute;
  top: auto;
  text-align: right;
  /* width: 100%; */
  font-weight: bold;
  padding: 0.25em 0.5em 0.25em 0.5em;
  right: 0.5em;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 0.5em;
}

/* ===== 初回（位牌未選択）案内ポップアップ =====
   フォント・背景画像・配色はトップ（newtop.css の FV）を踏襲する。
   - 本文: Noto Sans JP（角ゴ） / 見出し・キャッチ・実績値: Noto Serif JP（明朝）
   - 背景: kv_bg.webp + クリーム #faf5e9
   - キャッチ赤 #b1442b / 実績ラベル金 #b8935a / 実績数字 #8b6f47 / CTA金 #b8935a */
.welcomepopup {
  display: none;
}
.welcomepopup.show {
  display: block;
}
.welcomepopup .popupbg {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.55);
  z-index: 1110;
}
.welcomepopup .popupcontents {
  position: fixed;
  width: 34em;
  max-width: 90%;
  max-height: 88vh;
  /* 縦は内容が長い場合スクロール可、横は位牌透かしのはみ出しをクリップ */
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  /* トップ FV と同じ和紙風背景（kv_bg.webp）＋クリーム下地 */
  background: url("/assets/img/newtop/kv_bg.webp") center / cover no-repeat, #faf5e9;
  border: 1px solid #e6dfd0;
  border-radius: 1em;
  padding: 2.4em 2em 2em;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1111;
  text-align: center;
  color: #333;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", Meiryo, sans-serif;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
/* トップ FV の位牌（kv_oihai.webp）を背景の透かしとして右下に配置。
   負の z-index で和紙背景の上・テキストの下に描画し、可読性を損なわない。 */
.welcomepopup .welcome-ihai {
  position: absolute;
  right: -1.2em;
  bottom: 0;
  width: auto;
  height: 72%;
  max-width: 52%;
  object-fit: contain;
  object-position: bottom right;
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}
.welcomepopup .welcome-close {
  position: absolute;
  top: 0.4em;
  right: 0.55em;
  width: 1.6em;
  height: 1.6em;
  line-height: 1;
  font-size: 1.4em;
  color: #b8935a;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.welcomepopup .welcome-close:hover {
  color: #8b6f47;
}
.welcomepopup .welcome-headline {
  font-family: "Noto Serif JP", "游明朝", "Yu Mincho", YuMincho, "ヒラギノ明朝 ProN", serif;
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.05em;
  margin: 0 0 0.5em;
  color: #333;
}
.welcomepopup .welcome-headline sup {
  font-size: 0.5em;
  vertical-align: super;
}
.welcomepopup .welcome-catch {
  font-family: "Noto Serif JP", "游明朝", "Yu Mincho", YuMincho, "ヒラギノ明朝 ProN", serif;
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.05em;
  color: #b1442b;
  margin: 0 0 0.7em;
}
.welcomepopup .welcome-lead {
  font-size: 0.95em;
  line-height: 1.9;
  color: #333;
  margin: 0 0 1.3em;
}
.welcomepopup .welcome-features {
  display: flex;
  justify-content: center;
  gap: 0.8em;
  list-style: none;
  padding: 0;
  margin: 0 0 1.3em;
}
.welcomepopup .welcome-features li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid #e6dfd0;
  border-radius: 50%;
  padding: 0.5em 0.3em;
}
.welcomepopup .welcome-feature-label {
  display: block;
  font-size: 0.78em;
  color: #b8935a;
  margin-bottom: 0.25em;
}
.welcomepopup .welcome-feature-value {
  display: block;
  font-family: "Noto Serif JP", "游明朝", "Yu Mincho", YuMincho, "ヒラギノ明朝 ProN", serif;
  font-size: 1.15em;
  font-weight: 700;
  color: #8b6f47;
  line-height: 1.25;
}
.welcomepopup .welcome-feature-value small {
  font-size: 0.62em;
  font-weight: 700;
  margin-left: 1px;
}
.welcomepopup .welcome-guide {
  font-size: 0.9em;
  color: #555;
  margin: 0 0 0.3em;
}
.welcomepopup .buttons {
  text-align: center;
}
.welcomepopup .button1.welcome-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  background: #b8935a;
  color: #fff;
  font-weight: 700;
  font-size: 1.2em;
  letter-spacing: 0.05em;
  line-height: 1;
  border-radius: 100px;
  padding: 0.75em 2em;
  margin-top: 1em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(184, 147, 90, 0.3);
  transition: opacity 150ms;
}
.welcomepopup .button1.welcome-select:hover {
  opacity: 0.85;
}
.welcomepopup .welcome-cta-arrow {
  display: inline-block;
  width: 0.7em;
  height: 1em;
  background: url("/assets/img/newtop/icon_point.svg") no-repeat center / contain;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .welcomepopup .popupcontents {
    padding: 2.2em 1.2em 1.5em;
  }
  .welcomepopup .welcome-headline {
    font-size: 1.35em;
  }
  .welcomepopup .welcome-catch {
    font-size: 1.1em;
  }
  .welcomepopup .welcome-features {
    gap: 0.45em;
  }
  .welcomepopup .welcome-feature-label {
    font-size: 0.68em;
  }
  .welcomepopup .welcome-feature-value {
    font-size: 0.98em;
  }
}

/* ===== 注文ボタン下の電話ご案内 ===== */
.order-tel {
  max-width: 640px;
  margin: 1em auto 0;
  padding: 0.9em 1.1em;
  box-sizing: border-box;
  text-align: center;
  background: #faf6ec;
  border: 1px solid #e3d5ad;
  border-radius: 8px;
  color: #5b4a2a;
  line-height: 1.7;
}
.order-tel__lead {
  margin: 0 0 0.4em;
  font-size: 0.9em;
}
.order-tel__main {
  margin: 0 0 0.4em;
  font-weight: bold;
}
.order-tel__main a {
  color: #b1442b;
  font-size: 1.5em;
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.order-tel__main a::before {
  content: "\260E";
  margin-right: 0.2em;
  font-size: 0.9em;
}
.order-tel__hours {
  display: inline-block;
  margin-left: 0.6em;
  font-size: 0.82em;
  font-weight: normal;
  color: #6b5535;
}
.order-tel__note {
  margin: 0;
  font-size: 0.78em;
  color: #8a7647;
  line-height: 1.6;
}
@media (max-width: 480px) {
  .order-tel__hours {
    display: block;
    margin-left: 0;
    margin-top: 0.2em;
  }
}

/* ===== 発送予定バナー（select 画面のポップアップと同じ表示） =====
   通常＝赤バッジ「までに発送予定」／お急ぎ便＝金バッジ「までに発送可能（+3,000円）」 */
.ship-banner {
  margin: 0.6em 0 0.9em;
  padding: 0.7em 0.9em;
  background: #faf6ec;
  border: 1px solid #e3d5ad;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #5b4a2a;
  text-align: center;
  box-sizing: border-box;
}
.ship-banner:empty {
  display: none;
}
/* 2行を左揃えでそろえ、まとまりを中央に */
.ship-banner .ship-lines {
  display: inline-block;
  text-align: left;
}
.ship-banner .ship-label {
  display: inline-block;
  width: 5.2em;
  box-sizing: border-box;
  text-align: center;
  margin-right: 0.4em;
  padding: 0.08em 0.4em;
  border-radius: 3px;
  /* 通常 = 赤 */
  background: #cf453f;
  border: 1px solid #cf453f;
  color: #fff;
  font-size: 0.76rem;
  font-weight: bold;
}
/* お急ぎ便 = 金グラデ */
.ship-banner .ship-label--rush {
  background: linear-gradient(180deg, #f7e9a8 0%, #e3c368 48%, #cba63c 100%);
  color: #5a4a1c;
  border: 1px solid #b28f34;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}
.ship-banner .ship-date {
  font-weight: bold;
  font-size: 1.02rem;
  margin: 0 0.1em;
}
.ship-banner .ship-normal .ship-date {
  color: #cf453f;
}
.ship-banner .ship-oisogi {
  margin-top: 0.3em;
}
.ship-banner .ship-oisogi .ship-date {
  color: #a5822f;
}
.ship-banner .ship-plus {
  font-size: 0.78rem;
  color: #8a7647;
}
