/* =========================================
   SiteHub Live Panel
========================================= */

/* 右下の開くボタン */
.sh-live-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;

  width: 64px;
  height: 64px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  background: #111;
  color: #fff;

  font-size: 28px;
  line-height: 1;

  cursor: pointer;
  z-index: 9998;

  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);

  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.sh-live-toggle:hover {
  transform: translateY(-3px);
}

/* 右側パネル本体 */
.sh-live-panel {
  position: fixed;
  top: 0;
  right: 0;

  width: 400px;
  max-width: 92vw;
  height: 100vh;

  background: #fff;
  color: #111;

  z-index: 9999;

  display: flex;
  flex-direction: column;

  box-shadow: -14px 0 40px rgba(0, 0, 0, 0.2);

  transform: translateX(105%);
  transition: transform 0.35s ease;

  overflow: hidden;
}

/* 開いた状態 */
.sh-live-panel.is-open {
  transform: translateX(0);
}

/* パネル表示中は右下ボタンを少し隠す */
.sh-live-panel.is-open + .sh-live-toggle {
  opacity: 0;
  pointer-events: none;
}

/* ヘッダー */
.sh-live-panel__header {
  min-height: 48px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 16px;

  border-bottom: 1px solid #e8e8e8;
}

.sh-live-panel__header h3 {
  margin: 0;

  font-size: 16px;
  font-weight: 700;
}

/* 閉じるボタン */
.sh-live-close {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 0;
  background: transparent;
  color: #222;

  font-size: 28px;
  line-height: 1;

  cursor: pointer;
}

/* タブ */
.sh-live-panel__tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);

  padding: 0 20px;

  border-bottom: 1px solid #e8e8e8;
}

.sh-live-panel__tabs button {
  position: relative;

  padding: 18px 8px 14px;

  border: 0;
  background: transparent;
  color: #777;

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
}

.sh-live-panel__tabs button.is-active {
  color: #111;
}

.sh-live-panel__tabs button.is-active::after {
  content: "";

  position: absolute;
  left: 15%;
  right: 15%;
  bottom: 0;

  height: 3px;

  border-radius: 999px;
  background: #2271b1;
}

/* 本文 */
.sh-live-panel__body {
  flex: 1;

  padding: 24px;

  overflow-y: auto;
  background: #fff;
}

.sh-live-comments {
  min-height: 200px;
}

/* スマホ */
@media (max-width: 767px) {
  .sh-live-toggle {
    right: 16px;
    bottom: 16px;

    width: 58px;
    height: 58px;
  }

  .sh-live-panel {
    top: auto;
    right: 0;
    bottom: 0;

    width: 100%;
    max-width: none;
    height: 78vh;

    border-radius: 20px 20px 0 0;

    transform: translateY(105%);
  }

  .sh-live-panel.is-open {
    transform: translateY(0);
  }
}

/* =========================================
   Live Panel コメント一覧
========================================= */

.sh-live-comments {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sh-live-comment {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sh-live-comment__avatar {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  background: #e8f2ff;
  color: #1769aa;

  font-size: 15px;
  font-weight: 700;
}

.sh-live-comment__content {
  flex: 1;
  min-width: 0;
}

.sh-live-comment__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sh-live-comment__meta strong {
  color: #111;
  font-size: 14px;
  font-weight: 700;
}

.sh-live-comment__meta span {
  color: #999;
  font-size: 12px;
}

.sh-live-comment__content p {
  margin: 0;
  color: #222;
  font-size: 15px;
  line-height: 1.6;
}

body.admin-bar .sh-live-panel {
  top: 32px;
  height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
  body.admin-bar .sh-live-panel {
    top: 46px;
    height: calc(100vh - 46px);
  }
}

/* パネル全体 */
.sh-live-panel{
    display:flex;
    flex-direction:column;
}

/* コメント一覧 */
.sh-live-panel__body{
    flex:1;
    overflow-y:auto;
}

/* 入力欄 */
.sh-live-panel__footer{

    padding:16px;
    border-top:1px solid #eee;
    background:#fff;

    flex-shrink:0;
}

#sitehub-danmaku-form-live{

    display:flex;
    gap:10px;
}

#sitehub-danmaku-input-live{

    flex:1;
    height:42px;
}

#sitehub-danmaku-submit-live{

    width:72px;
}

.sh-live-comment--mine {
  padding: 12px;
  border-radius: 12px;
  background: #f2f8ff;
}

.sh-live-comment--mine .sh-live-comment__avatar {
  background: #2271b1;
  color: #fff;
}

/* ===============================
   Live Stats
=============================== */

.sh-live-panel__stats{

    display:flex;
    justify-content:space-around;

    padding:8px 16px;

    border-bottom:1px solid #eee;

    background:#fff;
}

.sh-live-stat{

    display:flex;
    align-items:center;

    gap:6px;
}

.sh-live-stat__icon{

    font-size:17px;
}

.sh-live-stat small{

    display:block;

    color:#888;

    font-size:9px;
}

.sh-live-stat strong{

    display:block;

    margin-top:1px;

    font-size:15px;

    font-weight:700;

    color:#111;
}

/* ===============================
   Live Panel 開閉ボタンの件数
=============================== */

.sh-live-toggle {
  flex-direction: column;
  gap: 1px;
}

.sh-live-toggle__icon {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.sh-live-toggle__count {
  display: block;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* ==========================
   Photo
========================== */

.sh-live-photo-grid{

    display:grid;

    grid-template-columns:repeat(2,1fr);

    gap:12px;

}

.sh-live-photo{

    aspect-ratio:1;

    background:#f4f4f4;

    border-radius:12px;

    display:flex;

    align-items:center;

    justify-content:center;

    font-size:40px;

    cursor:pointer;

    transition:.25s;
}

.sh-live-photo:hover{

    transform:scale(1.03);

}

/*==========================
Lightbox
==========================*/

.sh-live-lightbox{

    position:fixed;

    inset:0;

    background:rgba(0,0,0,.85);

    display:none;

    align-items:center;

    justify-content:center;

    z-index:99999;

}

.sh-live-lightbox img{

    max-width:90%;

    max-height:90%;

    border-radius:12px;

}

.sh-live-lightbox__close{

    position:absolute;

    top:25px;

    right:30px;

    color:#fff;

    font-size:36px;

    cursor:pointer;

}

/*=========================
Photo Upload
==========================*/

.sh-live-photo-upload{

    margin-bottom:20px;

}

.sh-live-photo-upload__button{

    display:inline-flex;

    align-items:center;

    justify-content:center;

    padding:12px 18px;

    background:#2271b1;

    color:#fff;

    border-radius:10px;

    cursor:pointer;

    font-weight:600;

    transition:.25s;

}

.sh-live-photo-upload__button:hover{

    background:#135e96;

}

.sh-live-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sh-live-photo {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
}

.sh-live-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sh-live-photo{
    aspect-ratio:1/1;
    overflow:hidden;
    border-radius:12px;
}

.sh-live-photo img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}

.sh-live-panel__body{
    overflow-y:auto;
    overflow-x:hidden;
}

.sh-live-panel__tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  padding: 0 20px;
  border-bottom: 1px solid #e8e8e8;
}

.sh-live-panel__tabs button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 52px;
  padding: 0 8px;

  border: 0;
  background: transparent;
  color: #777;

  font-size: 14px;
  font-weight: 600;
  line-height: 1;

  cursor: pointer;
}

.sh-live-panel__tabs button.is-active {
  color: #111;
}

.sh-live-panel__tabs button.is-active::after {
  content: "";
  position: absolute;

  left: 20%;
  right: 20%;
  bottom: 0;

  height: 3px;
  border-radius: 999px;
  background: #2271b1;
}

/* Back to TOP */
#page-top,
.pagetop,
.back-to-top{
    right: 24px;
    bottom: 110px;   /* 今より上へ */
    z-index: 900;
}

/* Live Panel */
.sh-live-toggle{
    right: 24px;
    bottom: 24px;
    z-index: 1000;
}

body:has(.sh-live-toggle) #page-top{
    bottom:110px;
}

/* Live Panel表示時のBack to Top位置調整 */
.sh-live-toggle ~ #backToTop,
body #backToTop {
  right: 24px !important;
  bottom: 105px !important;
}

/* ========================================
   LIVE PANEL 新着コメント
======================================== */

.sh-live-comment--new {
  animation: shLiveCommentIn 0.45s ease-out both;
}

@keyframes shLiveCommentIn {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.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;
}



/* ========================================
   LIVE PANEL OPEN - PC
======================================== */

@media (min-width: 768px) {

  body.sh-live-panel-open .sh-video-hero {
    width: calc(100% - 400px) !important;

    min-height: 100vh !important;
    height: 100vh !important;

    transition: width 0.35s ease;
  }

}

/* ========================================
   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: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.sh-hitos__character.is-compact .sh-hitos__status {
  font-size: 11px;
}

/* ========================================
   LIVE PANEL
   コメント一覧 コンパクト1行表示
======================================== */

/* コメント一覧全体 */
.sh-live-comments {
  padding: 6px 14px 8px !important;
}


/* コメント1件 */
.sh-live-comment {
  display: flex !important;
  align-items: center !important;

  gap: 8px !important;

  width: 100%;
  min-height: 34px !important;

  margin: 0 !important;
  padding: 5px 4px !important;

  box-sizing: border-box;

  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}


/* ========================================
   アバター
======================================== */

.sh-live-comment__avatar {
  width: 26px !important;
  height: 26px !important;

  flex: 0 0 26px !important;

  display: flex;
  align-items: center;
  justify-content: center;

  margin: 0 !important;

  border-radius: 50%;

  font-size: 10px !important;
  line-height: 1 !important;
}


/* ========================================
   投稿者・時間・コメントを横1列
======================================== */

.sh-live-comment__content {
  display: flex !important;
  align-items: center !important;

  flex: 1;
  min-width: 0;

  gap: 7px !important;

  margin: 0 !important;
  padding: 0 !important;
}


/* 投稿者＋時間 */
.sh-live-comment__meta {
  display: flex !important;
  align-items: center !important;

  flex: 0 0 auto;

  gap: 5px !important;

  margin: 0 !important;
  padding: 0 !important;
}


/* 投稿者名 */
.sh-live-comment__meta strong {
  margin: 0 !important;

  font-size: 11px !important;
  line-height: 1.2 !important;
  font-weight: 700;

  white-space: nowrap;
}


/* 投稿日時 */
.sh-live-comment__meta span {
  margin: 0 !important;

  font-size: 9px !important;
  line-height: 1.2 !important;

  white-space: nowrap;

  opacity: 0.5;
}


/* ========================================
   コメント本文
======================================== */

.sh-live-comment__content p {
  flex: 1;
  min-width: 0;

  margin: 0 !important;
  padding: 0 !important;

  font-size: 11px !important;
  line-height: 1.35 !important;

  /* 長文は最大2行 */
  white-space: normal;
  overflow: hidden;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}


/* コメント同士の余白をなくす */
.sh-live-comment + .sh-live-comment {
  margin-top: 0 !important;
}

/* ========================================
   LIVE PANEL
   Tablet / Mobile = Hero直下
======================================== */

@media (max-width: 1024px) {

  .sh-live-panel,
  body.admin-bar .sh-live-panel {

    position: relative !important;

    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;

    width: 100% !important;
    max-width: 100% !important;

    height: auto !important;
    max-height: none !important;

    transform: none !important;

    border-radius: 0 !important;

    box-shadow: none !important;

    display: flex !important;

    z-index: 1 !important;
  }

  /* 閉じる必要なし */
  .sh-live-close {
    display: none !important;
  }

  /* 右下のLIVEボタンも非表示 */
  .sh-live-toggle {
    display: none !important;
  }

  /* コメント領域 */
  .sh-live-panel__body {
    height: 190px !important;
    max-height: 190px !important;

    overflow-y: auto !important;
  }

  /* 入力欄 */
  .sh-live-panel__footer {
    position: relative !important;
    bottom: auto !important;
  }

}

