/*--------------------------------------------------------------
デザイントークン
  ブランド色は --scb-accent の1変数だけ差し替えれば全体に伝わる。
  テーマや管理画面から :root で上書きできるよう、既定値はここに置く。
--------------------------------------------------------------*/
:root {
  --scb-accent: #1f6feb;
  --scb-accent-strong: #1a5fd0;
  --scb-accent-soft: rgba(31, 111, 235, 0.10);
  --scb-accent-ink: #ffffff;
  --scb-surface: #ffffff;
  --scb-surface-sub: #f4f6f9;
  --scb-text: #12161b;
  --scb-text-muted: #68727d;
  --scb-line: #e3e7ec;
  /* 影は色を持たせない。色付きの影は安っぽく見える最大の原因になる */
  --scb-shadow-accent: rgba(16, 24, 40, 0.22);
  --scb-shadow-accent-hover: rgba(16, 24, 40, 0.28);
  --scb-shadow-lift: 0 10px 28px -8px rgba(16, 24, 40, 0.28), 0 2px 6px rgba(16, 24, 40, 0.06);
}

/*--------------------------------------------------------------
chat box profile frame
--------------------------------------------------------------*/
#chat-box-profile-frame {
  display: block;
  position: fixed;
  top: 0px;
  padding: 0;
  margin: 0;
  left: -100vw;
  width: 100vw;
  height: 100vh;
  /* iOS Safari の 100vh はURLバーを含むため実際の表示領域より背が高くなり、
     入力欄がブラウザUIの下に隠れる。対応ブラウザでは dvh を使う。 */
  height: 100dvh;
  background-color: #252222;
  z-index: 3007;
  transition: left 0.6s ease-in-out;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
#chat-box-profile-frame::-webkit-scrollbar {
  display: none;
}
#chat-box-profile-frame.active {
  left: 0;
}
#chat-box-profile-frame .profile-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
#chat-box-profile-frame .profile-area .account-icon {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0;
  cursor: pointer;
  border: 2px solid #ccc;
  transition: border-color 0.3s;
}
#chat-box-profile-frame .profile-area .account-icon:hover {
  border-color: #0073aa;
}
#chat-box-profile-frame .profile-area .account-icon img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}
#chat-box-profile-frame .profile-area #profile-account {
  margin-top: 0.75rem;
  font-weight: bold;
  font-size: 14px;
}
#chat-box-profile-frame .profile-area #profile-text {
  margin-top: 0.25rem;
  font-size: 14px;
  color: #555;
}
#chat-box-profile-frame #profile-frame-close {
  background-color: #0073aa;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1.2rem;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s;
}
#chat-box-profile-frame #profile-frame-close:hover {
  background-color: #005d8f;
}

/*--------------------------------------------------------------
chat box post frame
--------------------------------------------------------------*/
.chat-box-post-frame {
  display: block;
  position: relative;
  top: 0px;
  padding: 0;
  margin: 0;
  left: 0;
  width: 100%;
  background-color: #252222;
  z-index: 3007;
  transition: left 0.6s ease-in-out;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.chat-box-post-frame::-webkit-scrollbar {
  display: none;
}
.chat-box-post-frame.active {
  left: 0;
}
.chat-box-post-frame #chat-box-message-input-frame {
  display: flex;
}
.chat-box-post-frame #chat-box-message-input-frame #chat-box-user-frame {
  display: block;
}
.chat-box-post-frame #chat-box-message-input-frame #chat-box-user-frame #btn-chat-box-image-select {
  margin: 0;
  padding: 0;
  width: 68px;
  height: 68px;
}
.chat-box-post-frame #chat-box-message-input-frame #chat-box-user-frame #btn-chat-box-image-select img {
  margin: 8px;
  padding: 0;
  width: 50px;
  height: 50px;
  max-width: none;
  border-radius: 50%;
  -o-object-fit: cover;
     object-fit: cover;
}
.chat-box-post-frame #chat-box-message-input-frame #chat-box-user-frame #chat-box-user-name {
  margin: 0;
  margin-top: 20px;
  padding: 0;
  height: 20px;
  font-size: 14px;
  text-align: center;
}
.chat-box-post-frame #chat-box-message-input-frame #chat-box-message-input {
  flex: 1;
  resize: none;
  min-height: 80px;
  padding: 0.75rem;
  /* 16px 未満だと iOS Safari がフォーカス時にページを勝手に拡大する */
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  line-height: 1.4;
  background-color: #f9f9f9;
  margin-top: 4px;
  margin-right: 4px;
}
.chat-box-post-frame #chat-box-message-input-frame #chat-box-message-input:focus {
  outline: none;
  border-color: #0073aa;
  background-color: #fff;
}
.chat-box-post-frame #chat-box-post-input-frame {
  text-align: center;
  margin: 8px;
}
/* ⚠ このID指定は .chat-box-container 側の同じボタンの指定より詳細度が高く、
   放置すると黒背景で上書きされてヘッダーの配色と食い違う（実機で発覚）。
   見た目はアクセント色に揃え、ここではサイズだけを担当させる。 */
.chat-box-post-frame #chat-box-post-input-frame #btn-chat-box-send-message {
  border-radius: 99px;
  color: var(--scb-accent-ink);
  background: var(--scb-accent);
  padding: 9px 24px;
  min-width: 160px;
  font-weight: 700;
  cursor: pointer;
}
.chat-box-post-frame #chat-box-post-input-frame #btn-chat-box-send-message:hover {
  background: rgb(31, 30, 31);
}
.chat-box-post-frame #chat-box-image-upload-frame {
  text-align: center;
}
.chat-box-post-frame #chat-box-image-upload-frame label {
  display: inline-block;
  width: 48px;
  height: 48px;
  cursor: pointer;
}
.chat-box-post-frame #chat-box-image-upload-frame label svg {
  width: 100%;
  height: 100%;
  fill: #666;
  transition: fill 0.3s;
}
.chat-box-post-frame #chat-box-image-upload-frame label svg:hover {
  fill: #0073aa;
}
.chat-box-post-frame #chat-box-image-upload-frame #chat-box-file-name {
  margin-top: 0.5rem;
  font-size: 14px;
  color: #555;
}

/*--------------------------------------------------------------
chat box floating toggle button
  位置は --scb-offset-right/bottom（CHAT-BOX 設定の表示位置）に追従する。
  常駐キャラを出しているテーマではキャラの復帰トグルと同じ隅に来るため、
  PHP 側が --scb-toggle-stack を渡して段積みする。
--------------------------------------------------------------*/
.scb-chat-toggle {
  position: fixed;
  right: var(--scb-offset-right, 20px);
  bottom: calc(var(--scb-offset-bottom, 20px) + var(--scb-toggle-stack, 0px));
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  /* 単色ベタ塗りではなく、上を明るく落とす。円が球に見えて安さが消える */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 60%),
    var(--scb-accent);
  color: var(--scb-accent-ink);
  /* 影に色を乗せない。距離の違う2枚重ねで浮遊感を出す */
  box-shadow:
    0 10px 24px -6px var(--scb-shadow-accent),
    0 2px 6px rgba(16, 24, 40, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3006;
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.22s ease, opacity 0.18s ease;
}
.scb-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 30px -8px var(--scb-shadow-accent-hover),
    0 3px 8px rgba(16, 24, 40, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.scb-chat-toggle:active {
  transform: translateY(0) scale(0.96);
}
.scb-chat-toggle:focus-visible {
  outline: 2px solid var(--scb-accent);
  outline-offset: 3px;
}
.scb-chat-toggle svg {
  width: 26px;
  height: 26px;
  /* 光源を上に置いた影。アイコンが面から浮く */
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}
/* 枠が開いている間は引っ込める */
.scb-chat-toggle.is-hidden {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}
@media (max-width: 480px) {
  .scb-chat-toggle {
    width: 52px;
    height: 52px;
  }
  .scb-chat-toggle svg {
    width: 24px;
    height: 24px;
  }
}

/*--------------------------------------------------------------
chat box main frame
--------------------------------------------------------------*/
/*--------------------------------------------------------------
チャットパネル（右下からせり上がる枠）

  以前は画面全体を覆うオーバーレイだった。訪問者が「サイトを見ながら聞く」
  という使い方に合わないため、隅に置くパネルに作り替えている。
  中の並びは HTML を変えず flex の order で入れ替える
  （元の順は 入力欄 → メッセージ で、チャットとしては逆だった）。
--------------------------------------------------------------*/
#chat-box-main-frame {
  position: fixed;
  right: var(--scb-offset-right, 20px);
  bottom: var(--scb-offset-bottom, 20px);
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - var(--scb-offset-bottom, 20px) - 24px);
  /* iOS Safari の 100vh はURLバーを含み実際の表示領域より背が高くなる */
  max-height: calc(100dvh - var(--scb-offset-bottom, 20px) - 24px);
  z-index: 3007;
  display: flex;
  padding: 0;
  margin: 0;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.24s cubic-bezier(0.34, 1.4, 0.64, 1);
}
#chat-box-main-frame.active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* スマホは画面いっぱいに近づける（余白だけ残す） */
@media (max-width: 480px) {
  #chat-box-main-frame {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    height: auto;
    top: 8px;
    max-height: none;
  }
}

.heart-wrapper {
  display: inline-block;
  margin-left: 5px;
  position: relative;
}

.heart-pop {
  animation: pop 0.5s ease-out forwards;
}

@keyframes pop {
  0% {
    transform: scale(3) translateY(0);
  }
  50% {
    transform: scale(0.5) translateY(0);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}
.chat-box-container {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background-color: var(--scb-surface, #ffffff);
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 16px;
  box-shadow: var(--scb-shadow-lift, 0 8px 30px rgba(0, 0, 0, 0.12));
  overflow: hidden;
  border: 1px solid var(--scb-line, #eff3f4);
  box-sizing: border-box;
  /* パネルの縦積み。中身の並び替えは order で行う */
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 見た目の並び順（HTMLの順序は変えない）
   ヘッダー → タブ → メッセージ → 相談バー → 入力欄 */
.chat-box-container .navbar-head        { order: 0; flex: 0 0 auto; }
.chat-box-container .chat-box-mode-switch { order: 1; flex: 0 0 auto; }
.chat-box-container #chat-box-window    { order: 2; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.chat-box-container .scb-handoff-bar    { order: 3; flex: 0 0 auto; }
.chat-box-container .chat-box-post-frame { order: 4; flex: 0 0 auto; border-top: 1px solid var(--scb-line, #eff3f4); }
.chat-box-container *,
.chat-box-container *::before,
.chat-box-container *::after {
  box-sizing: border-box;
}
.chat-box-container p {
  margin: 0;
  line-height: 1.5;
}
.chat-box-container img {
  max-width: 100%;
  display: block;
}
.chat-box-container .navbar-head {
  background: var(--scb-accent);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.05em;
}
.chat-box-container .navbar-head div {
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.chat-box-container .navbar-head div:hover {
  background: rgba(255, 255, 255, 0.2);
}
.chat-box-container .navbar-head i {
  font-size: 18px;
}
.chat-box-container .chat-box-post-frame {
  background: #ffffff;
  padding: 20px;
  border-bottom: 1px solid #eff3f4;
}
.chat-box-container .chat-box-post-frame #chat-box-message-input-frame {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.chat-box-container .chat-box-post-frame #chat-box-user-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 60px;
  flex-shrink: 0;
}
.chat-box-container .chat-box-post-frame #chat-box-user-frame .account-icon {
  display: block;
  margin: 0;
  padding: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #eee;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: opacity 0.2s;
}
.chat-box-container .chat-box-post-frame #chat-box-user-frame .account-icon:hover {
  opacity: 0.8;
}
.chat-box-container .chat-box-post-frame #chat-box-user-frame .account-icon img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  display: block;
  border: none;
  margin: 0;
}
.chat-box-container .chat-box-post-frame #chat-box-user-frame #chat-box-user-name {
  font-size: 10px;
  color: #536471;
  margin-top: 4px;
  font-weight: 600;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-box-container .chat-box-post-frame textarea {
  flex-grow: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 16px;
  padding: 10px 0;
  min-height: 80px;
  color: #0f1419;
}
.chat-box-container .chat-box-post-frame textarea::-moz-placeholder {
  color: rgb(132.7755102041, 151.1632653061, 165.2244897959);
}
.chat-box-container .chat-box-post-frame textarea::placeholder {
  color: rgb(132.7755102041, 151.1632653061, 165.2244897959);
}
.chat-box-container .chat-box-post-frame #chat-box-post-input-frame {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #eff3f4;
  padding-top: 12px;
}
.chat-box-container .chat-box-post-frame #chat-box-post-input-frame button {
  background: var(--scb-accent);
  color: #fff;
  border: none;
  padding: 8px 24px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.16);
}
.chat-box-container .chat-box-post-frame #chat-box-post-input-frame button:hover {
  background: var(--scb-accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--scb-shadow-accent);
}
.chat-box-container .chat-box-post-frame #chat-box-post-input-frame button:active {
  transform: scale(0.98);
}
.chat-box-container #chat-box-window {
  background: #ffffff;
}
.chat-box-container #chat-box-window .post-table {
  width: 100%;
  border-collapse: collapse;
  border-bottom: 1px solid #eff3f4;
  transition: background-color 0.2s;
}
.chat-box-container #chat-box-window .post-table:hover {
  background-color: #f7f9fa;
}
.chat-box-container #chat-box-window .post-table td {
  padding: 0 16px 0 12px;
  vertical-align: top;
}
.chat-box-container #chat-box-window .post-table td[rowspan="3"] {
  width: 68px;
  padding: 16px 0 0 16px;
}
.chat-box-container #chat-box-window .post-table td[rowspan="3"] .user-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  -o-object-fit: cover;
     object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.chat-box-container #chat-box-window .post-table tr:first-child td {
  padding-top: 16px;
}
.chat-box-container #chat-box-window .post-table tr:first-child td:nth-child(2) {
  font-size: 15px;
  font-weight: 700;
  color: #0f1419;
}
.chat-box-container #chat-box-window .post-table tr:first-child td:nth-child(2):hover {
  text-decoration: underline;
  cursor: pointer;
}
.chat-box-container #chat-box-window .post-table tr:first-child td:nth-child(3) {
  font-size: 13px;
  color: #536471;
  text-align: right;
  white-space: nowrap;
}
.chat-box-container #chat-box-window .post-table tr:first-child td:last-child {
  width: 30px;
  text-align: right;
}
.chat-box-container #chat-box-window .post-table tr:first-child td:last-child svg {
  fill: #536471;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s;
}
.chat-box-container #chat-box-window .post-table tr:first-child td:last-child svg:hover {
  background: var(--scb-accent-soft);
  fill: var(--scb-accent);
}
.chat-box-container #chat-box-window .post-table tr:nth-child(2) td {
  padding-top: 4px;
  padding-bottom: 8px;
}
.chat-box-container #chat-box-window .post-table tr:nth-child(2) td p {
  font-size: 15px;
  color: #0f1419;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-box-container #chat-box-window .post-table tr:last-child td {
  padding-bottom: 16px;
}
.chat-box-container #chat-box-window .post-table tr:last-child td .like-button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #536471;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-left: -8px;
  border-radius: 99px;
  transition: all 0.2s;
}
.chat-box-container #chat-box-window .post-table tr:last-child td .like-button:hover {
  color: #f91880;
  background: rgba(249, 24, 128, 0.1);
}
.chat-box-container #chat-box-window .post-table tr:last-child td .like-button:hover .heart-wrapper img {
  transform: scale(1.2);
}
.chat-box-container #chat-box-window .post-table tr:last-child td .like-button .heart-wrapper {
  display: inline-flex;
  align-items: center;
}
.chat-box-container #chat-box-window .post-table tr:last-child td .like-button .heart-wrapper img.emoji {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/*--------------------------------------------------------------
  image-select
--------------------------------------------------------------*/
.image-select-frame {
  display: block;
  position: fixed;
  top: 0;
  left: -100vw;
  width: 100vw;
  height: 100vh;
  /* iOS Safari の 100vh はURLバーを含むため実際の表示領域より背が高くなり、
     入力欄がブラウザUIの下に隠れる。対応ブラウザでは dvh を使う。 */
  height: 100dvh;
  z-index: 3008;
  background-color: rgba(13, 13, 14, 0.6);
  backdrop-filter: blur(4px);
  transition: left 0.3s ease-out;
}
.image-select-frame.active {
  left: 0;
}

.image-select-frame {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background-color: #ffffff;
  color: #0f1419;
  width: 100%;
  max-width: 400px;
  margin: 40px auto;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid #eff3f4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  box-sizing: border-box;
}
.image-select-frame *, .image-select-frame *::before, .image-select-frame *::after {
  box-sizing: border-box;
}
.image-select-frame .navbar-head {
  background-color: #ffffff;
  border-bottom: 1px solid #eff3f4;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.image-select-frame .navbar-head svg:first-child {
  width: 32px;
  height: 32px;
  fill: var(--scb-accent);
  margin-right: 12px;
}
.image-select-frame .navbar-head #btn-image-select-close {
  width: 24px;
  height: 24px;
  fill: #536471;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s, fill 0.2s;
  margin-left: auto;
}
.image-select-frame .navbar-head #btn-image-select-close:hover {
  background-color: rgba(15, 20, 25, 0.1);
  fill: #0f1419;
}
.image-select-frame .name-input-container {
  padding: 20px 20px 10px;
  background-color: #ffffff;
  flex-shrink: 0;
}
.image-select-frame .name-input-container label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #0f1419;
  margin-bottom: 8px;
}
.image-select-frame .name-input-container input[type=text] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #eff3f4;
  border-radius: 8px;
  font-size: 15px;
  color: #0f1419;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
  background-color: #f7f9fa;
  font-family: inherit;
}
.image-select-frame .name-input-container input[type=text]::-moz-placeholder {
  color: #8a99a8;
}
.image-select-frame .name-input-container input[type=text]::placeholder {
  color: #8a99a8;
}
.image-select-frame .name-input-container input[type=text]:focus {
  border-color: var(--scb-accent);
  background-color: #ffffff;
}
.image-select-frame #image-select-gallery {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 16px;
  overflow-y: auto;
  flex-grow: 1;
}
.image-select-frame #image-select-gallery::-webkit-scrollbar {
  width: 6px;
}
.image-select-frame #image-select-gallery::-webkit-scrollbar-track {
  background: transparent;
}
.image-select-frame #image-select-gallery::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.image-select-frame #image-select-gallery img {
  width: 100%;
  aspect-ratio: 1/1;
  -o-object-fit: cover;
     object-fit: cover;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
  background-color: #f7f9fa;
}
.image-select-frame #image-select-gallery img:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1;
}
.image-select-frame #image-select-gallery img:active {
  transform: scale(0.95);
  border-color: var(--scb-accent);
}
@media (max-width: 480px) {
  .image-select-frame {
    width: 100%;
    height: 100vh;
  /* iOS Safari の 100vh はURLバーを含むため実際の表示領域より背が高くなり、
     入力欄がブラウザUIの下に隠れる。対応ブラウザでは dvh を使う。 */
  height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .image-select-frame #image-select-gallery {
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: 40px;
  }
}

/*--------------------------------------------------------------
chat box mode switch (掲示板 / AIチャット)
--------------------------------------------------------------*/
.chat-box-container .chat-box-mode-switch {
  display: flex;
  background: #ffffff;
  border-bottom: 1px solid #eff3f4;
}
.chat-box-container .chat-box-mode-switch .chat-box-mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 700;
  color: #536471;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.chat-box-container .chat-box-mode-switch .chat-box-mode-btn:hover {
  color: var(--scb-accent);
}
.chat-box-container .chat-box-mode-switch .chat-box-mode-btn.active {
  color: var(--scb-accent);
  border-bottom-color: var(--scb-accent);
}

/*--------------------------------------------------------------
chat bot conversation (#chat-bot-window)
--------------------------------------------------------------*/
.chat-box-container #chat-bot-window {
  background: #ffffff;
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}
.chat-box-container #chat-bot-window .bot-balloon {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}
.chat-box-container #chat-bot-window .bot-balloon.right {
  flex-direction: row-reverse;
}
.chat-box-container #chat-bot-window .bot-icon {
  margin: 0;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}
.chat-box-container #chat-bot-window .bot-icon img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  -o-object-fit: cover;
     object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: block;
  margin: 0 auto;
  max-width: none;
}
.chat-box-container #chat-bot-window .bot-icon figcaption {
  font-size: 10px;
  color: #536471;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44px;
}
.chat-box-container #chat-bot-window .bot-bubble {
  position: relative;
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-box-container #chat-bot-window .bot-balloon.left .bot-bubble {
  background: #f0f3f5;
  color: #0f1419;
  border-top-left-radius: 4px;
}
.chat-box-container #chat-bot-window .bot-balloon.right .bot-bubble {
  background: var(--scb-accent);
  color: #ffffff;
  border-top-right-radius: 4px;
}
.chat-box-container #chat-bot-window .bot-bubble p {
  margin: 0;
}
.chat-box-container #chat-bot-window .bot-bubble .chat-template-frame {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chat-box-container #chat-bot-window .bot-bubble .btn-template {
  background: #ffffff;
  color: var(--scb-accent);
  border: 1px solid var(--scb-accent);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.chat-box-container #chat-bot-window .bot-bubble .btn-template:hover {
  background: var(--scb-accent);
  color: #ffffff;
}
/* サイト内検索の関連記事カード */
.chat-box-container #chat-bot-window .bot-bubble .chat-articles {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-box-container #chat-bot-window .bot-bubble .chat-article {
  display: block;
  padding: 8px 10px;
  border: 1px solid #e1e8ed;
  border-radius: 10px;
  background: #ffffff;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.chat-box-container #chat-bot-window .bot-bubble .chat-article:hover {
  background: #f5f9ff;
  border-color: var(--scb-accent);
}
.chat-box-container #chat-bot-window .bot-bubble .chat-article-title {
  display: block;
  color: var(--scb-accent);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
}
.chat-box-container #chat-bot-window .bot-bubble .chat-article-snippet {
  display: block;
  color: #657786;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 3px;
}
/* リッチカード（Flex相当・Web表示） */
.chat-box-container #chat-bot-window .bot-bubble .chat-rich-card {
  border: 1px solid #e1e8ed; border-radius: 12px; overflow: hidden;
  background: #fff; max-width: 300px; margin-top: 8px;
}
.chat-box-container #chat-bot-window .bot-bubble .chat-rich-card .rc-image { width: 100%; height: auto; display: block; }
.chat-box-container #chat-bot-window .bot-bubble .chat-rich-card .rc-title { font-weight: 700; font-size: 14px; padding: 8px 10px 0; color: #1a2733; }
.chat-box-container #chat-bot-window .bot-bubble .chat-rich-card .rc-text { font-size: 12px; color: #657786; padding: 4px 10px; }
.chat-box-container #chat-bot-window .bot-bubble .chat-rich-card .rc-button {
  display: block; text-align: center; margin: 8px 10px 10px; padding: 8px;
  background: var(--scb-accent); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 13px;
}

/* --- プラグイン化に伴う追加: Font Awesome を同梱インライン SVG に置換した分のサイズ調整 --- */
.chat-box-container .navbar-head .scb-icon {
  width: 18px;
  height: 18px;
  display: block;
}

/* --- 有人引き継ぎフォーム（chat-lead.js） --- */
.scb-handoff-offer {
  margin: 10px 12px;
  padding: 12px 14px;
  background: #f0f7ff;
  border: 1px solid #cfe3fb;
  border-radius: 10px;
}
.scb-handoff-offer p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.6;
  color: #1d3557;
}
.scb-handoff-btn,
.scb-lead-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: var(--scb-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.scb-handoff-btn:hover,
.scb-lead-actions button:hover {
  background: #1a8cd8;
}
.scb-lead-actions .scb-lead-cancel {
  background: #8899a6;
}
.scb-lead-actions .scb-lead-cancel:hover {
  background: #6b7b87;
}

.scb-lead-form {
  margin: 10px 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #dfe4e8;
  border-radius: 10px;
}
.scb-lead-form .scb-lead-title {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 14px;
  color: #0f1419;
}
.scb-lead-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: #536471;
}
.scb-lead-form input,
.scb-lead-form textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #cfd9de;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.scb-lead-form textarea {
  resize: vertical;
}
.scb-lead-actions {
  display: flex;
  gap: 8px;
}
.scb-lead-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #d93025;
  min-height: 1em;
}

/* 常設の「担当者に相談する」バー */
.scb-handoff-bar {
  padding: 8px 12px;
  text-align: right;
  background: #f7f9fa;
  border-bottom: 1px solid #eff3f4;
}
.scb-handoff-bar button {
  padding: 6px 14px;
  border: 1px solid var(--scb-accent);
  border-radius: 999px;
  background: #fff;
  color: var(--scb-accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.scb-handoff-bar button:hover {
  background: var(--scb-accent);
  color: #fff;
}

/* 掲示板の削除アイコン（自作 SVG） */
#chat-box-post-list-frame .scb-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* AIチャット表示のときの入力まわり（掲示板用のアバター・名前は出さない）
   ⚠ 既存ルールが `.chat-box-post-frame #chat-box-message-input-frame #chat-box-user-frame`
      のようにID2つを含み詳細度が高い。同じ深さまで書かないと効かない。 */
.chat-box-container.is-bot .chat-box-post-frame #chat-box-message-input-frame #chat-box-user-frame {
  display: none;
}
.chat-box-container.is-bot .chat-box-post-frame #chat-box-message-input-frame #chat-box-message-input {
  min-height: 54px;
  margin-top: 0;
  margin-right: 0;
}
.chat-box-container.is-bot .chat-box-post-frame {
  padding: 10px 12px 12px;
}

/* メッセージ欄のスクロールバー。
   OS既定の太いスクロールバー（矢印つき）はパネルの中で古く見えるので、
   細く目立たないものに置き換える。 */
.chat-box-container #chat-box-window {
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 24, 40, 0.22) transparent;
  overscroll-behavior: contain;
}
.chat-box-container #chat-box-window::-webkit-scrollbar {
  width: 8px;
}
.chat-box-container #chat-box-window::-webkit-scrollbar-track {
  background: transparent;
}
.chat-box-container #chat-box-window::-webkit-scrollbar-thumb {
  background: rgba(16, 24, 40, 0.22);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.chat-box-container #chat-box-window::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 24, 40, 0.34);
  background-clip: content-box;
}
/* 矢印ボタンを出さない（Windowsの既定では出る） */
.chat-box-container #chat-box-window::-webkit-scrollbar-button {
  display: none;
}

/* AIチャットのときは入力欄と送信ボタンを横に並べる。
   縦に積むと、600pxのパネルで入力欄だけが3割近くを占めてしまう。 */
.chat-box-container.is-bot .chat-box-post-frame {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-box-container.is-bot .chat-box-post-frame #chat-box-message-input-frame {
  flex: 1 1 auto;
  min-width: 0;
}
.chat-box-container.is-bot .chat-box-post-frame #chat-box-post-input-frame {
  flex: 0 0 auto;
  margin: 0;
  text-align: right;
  /* 縦積み時代の区切り線。横並びにすると入力欄の脇に浮いた線として残るので消す */
  border-top: 0;
  padding-top: 0;
}
.chat-box-container.is-bot .chat-box-post-frame #chat-box-post-input-frame #btn-chat-box-send-message {
  width: auto;
  min-width: 0;
  padding: 10px 18px;
}
