/* =========================================
   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: 72px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 24px;

  border-bottom: 1px solid #e8e8e8;
}

.sh-live-panel__header h3 {
  margin: 0;

  font-size: 20px;
  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:20px;

    border-bottom:1px solid #eee;

    background:#fff;
}

.sh-live-stat{

    display:flex;
    align-items:center;

    gap:12px;
}

.sh-live-stat__icon{

    font-size:28px;
}

.sh-live-stat small{

    display:block;

    color:#888;

    font-size:12px;
}

.sh-live-stat strong{

    display:block;

    margin-top:2px;

    font-size:26px;

    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(2,1fr);
    gap:12px;
}

.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;
}