.sh-hitos__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 9px 14px;

  border: 1px solid #222;
  border-radius: 999px;

  background: #fff;
  color: #111;

  font-size: 13px;
  font-weight: 700;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.sh-hitos__action:hover {
  background: #111;
  color: #fff;
  transform: translateY(-1px);
}

/* ========================================
   人OS 会話吹き出し
======================================== */

.sh-hitos__exchange {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}


/* 共通 */
.sh-hitos__message {
  max-width: 88%;
}

.sh-hitos__message strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  opacity: 0.65;
}

.sh-hitos__message p {
  margin: 0;
  padding: 11px 14px;

  border-radius: 16px;

  font-size: 14px;
  line-height: 1.7;
}


/* ==============================
   ユーザー
============================== */

.sh-hitos__message--user {
  align-self: flex-end;
  text-align: right;
}

.sh-hitos__message--user p {
  background: #222;
  color: #fff;

  border-bottom-right-radius: 4px;

  text-align: left;
}


/* ==============================
   人OS
============================== */

.sh-hitos__message--ai {
  align-self: flex-start;
}

.sh-hitos__message--ai p {
  background: #f2f3f5;
  color: #111;

  border-bottom-left-radius: 4px;
}

/* 人OS：考え中 */
.sh-hitos__character[data-state="thinking"] .sh-hitos__avatar {
  animation: shHitosThinking 0.8s ease-in-out infinite alternate;
}

@keyframes shHitosThinking {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-4px);
  }
}


/* 人OS：回答中 */
.sh-hitos__character[data-state="answering"] .sh-hitos__avatar {
  animation: shHitosAnswering 0.35s ease-in-out infinite alternate;
}

@keyframes shHitosAnswering {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.05);
  }
}

.sh-hitos__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ========================================
   AIキャラクター
======================================== */

.sh-hitos__avatar {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
}

.sh-hitos__avatar-image {
  width: 84px;
  height: 84px;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  display: block;
}

/* ========================================
   AIキャラクター：通常
======================================== */

.sh-hitos__character {
  transition: all 0.3s ease;
}

.sh-hitos__avatar {
  width: 84px;
  height: 84px;
  transition: all 0.3s ease;
}

.sh-hitos__avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  display: block;
}


/* ========================================
   AIキャラクター：会話開始後
======================================== */

.sh-hitos__character.is-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.sh-hitos__character.is-compact .sh-hitos__avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
}

.sh-hitos__character.is-compact .sh-hitos__status {
  font-size: 11px;
}

/* ========================================
   人OS 独立型：基本レイアウト
======================================== */

.sh-hitos-standalone {
  display: block;
  width: 420px !important;
  max-width: calc(100vw - 16px) !important;
  box-sizing: border-box;
  margin: 0 !important;
}

/* 開いた状態 */
.sh-hitos-standalone:not(.sh-hitos-is-compact) {
  width: 420px !important;
  max-width: calc(100vw - 16px) !important;
}

/* 閉じた状態 */
.sh-hitos-standalone.sh-hitos-is-compact {
  width: 80px !important;
  max-width: 80px !important;
}

/* 内側のレイアウト */
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-live-hitos,
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-hitos {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* 閉じた状態の内側 */
.sh-hitos-standalone.sh-hitos-is-compact
.sh-live-hitos,
.sh-hitos-standalone.sh-hitos-is-compact
.sh-hitos {
  width: fit-content !important;
  max-width: none !important;
}

/* ========================================
   キャラクター
======================================== */

.sh-hitos-standalone .sh-hitos__character {
  user-select: none;
  -webkit-user-select: none;
  margin-bottom: 4px !important;
}

/* 田中の画像 */
.sh-hitos-standalone .sh-hitos__avatar,
.sh-hitos-standalone .sh-hitos__avatar-image {
  width: 60px !important;
  height: 60px !important;
}

.sh-hitos-standalone .sh-hitos__avatar {
  flex: 0 0 60px !important;
}

/* 展開方向はJavaScriptで決定 */
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-hitos__character {
  width: 80px !important;
  margin-right: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ========================================
   会話エリア
======================================== */

.sh-hitos-standalone .sh-live-hitos,
.sh-hitos-standalone .sh-hitos,
.sh-hitos-standalone .sh-hitos__conversation {
  background: transparent !important;
}

.sh-hitos-standalone .sh-hitos__conversation {
  margin-bottom: 14px !important;
  padding-bottom: 0 !important;
}

.sh-hitos-standalone .sh-hitos__exchange {
  gap: 8px;
  margin-bottom: 16px;
}

.sh-hitos-standalone .sh-hitos__message {
  width: fit-content;
  max-width: min(78%, 420px);
  margin-bottom: 0 !important;
}

/* AI側の吹き出し */
.sh-hitos-standalone .sh-hitos__message--ai p {
  background: #fff;
  color: #111;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 9px 12px;
}

/* ユーザー側の吹き出し */
.sh-hitos-standalone .sh-hitos__message--user p {
  padding: 9px 12px;
}

/* ========================================
   質問ボタン
======================================== */

.sh-hitos-standalone .sh-hitos__suggestions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-start !important;
  align-items: center;
  gap: 12px !important;
  width: fit-content !important;
  max-width: 100%;
  margin-top: 14px !important;
  margin-bottom: 8px !important;
}

.sh-hitos-standalone .sh-hitos__suggestions button {
  margin: 0 !important;
  flex: 0 0 auto;
}

/* ========================================
   入力フォーム
======================================== */

.sh-hitos-standalone .sh-live-footer-form--hitos {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  width: 320px !important;
  max-width: 100% !important;
  box-sizing: border-box;
  margin-left: 0 !important;
  margin-right: auto !important;
  margin-bottom: 24px !important;
  gap: 8px !important;
}

.sh-hitos-standalone .sh-live-footer-form--hitos input {
  flex: 1 1 auto;
  width: 0 !important;
  min-width: 0;
}

.sh-hitos-standalone .sh-live-footer-form--hitos button {
  flex: 0 0 auto;
  margin: 0 !important;
}

/* ========================================
   開閉制御
======================================== */

.sh-hitos-standalone.sh-hitos-is-compact
.sh-hitos__conversation,
.sh-hitos-standalone.sh-hitos-is-compact
.sh-hitos__suggestions,
.sh-hitos-standalone.sh-hitos-is-compact
.sh-live-footer-form--hitos {
  display: none !important;
}

/* ========================================
   すりガラス背景
======================================== */

/* 展開中：フォームも含めて背景を表示 */
.sh-hitos-standalone:not(.sh-hitos-is-compact) {
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 14px;
  box-sizing: border-box;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

/* 内側は透明 */
.sh-hitos-standalone .sh-hitos {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* 閉じた状態では背景なし */
.sh-hitos-standalone.sh-hitos-is-compact {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* =====================================
   独立型人OS：会話履歴スクロール
===================================== */

/* 人OS全体を画面内に収める */
.sh-hitos-standalone:not(.sh-hitos-is-compact) {
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 会話パネルは縮小可能にする */
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-live-hitos {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

/* 田中・会話・質問ボタンを縦に並べる */
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-hitos {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

/* 会話履歴だけスクロール */
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-hitos__conversation {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* 田中と質問ボタンは縮めない */
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-hitos__character,
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-hitos__suggestions {
  flex-shrink: 0;
}

/* 入力フォームは下部に残す */
.sh-hitos-standalone:not(.sh-hitos-is-compact)
.sh-live-footer-form--hitos {
  flex-shrink: 0;
  margin-bottom: 0 !important;
}

/* ========================================
   人OS：閉じた状態
   キャラクターの下にステータスを表示
======================================== */

.sh-hitos-standalone.sh-hitos-is-compact
.sh-hitos__character {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center;
    gap: 5px;
    width: 80px !important;
    text-align: center;
}

/* 待機中・考え中など */
.sh-hitos-standalone.sh-hitos-is-compact
.sh-hitos__status {
    display: block;
    width: 100%;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}