/* ===============================
   SWITCH（LEFT / RIGHT ボタン）
=============================== */

.top-switch{
  position: fixed;
  top: 160px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 32px;
  z-index: 3000;
}

.switch-tab{
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  letter-spacing: .12em;
  cursor: pointer;
}

.switch-tab.active{
  color: #b9d7ff;
}


/* ===============================
   RIGHT PANEL（被せ）
=============================== */

.miraba-right-panel{
  position: fixed;
  top: 140px;   /* header下 */
  left: 0;
  right: 0;
  bottom: 0;

  background: rgba(10,10,15,0.95);
  backdrop-filter: blur(14px);

  transform: translateX(100%);
  transition: transform .6s ease;
  z-index: 900;

  pointer-events: none; /* ← 重要 */
}

.miraba-right-panel.is-active{
  transform: translateX(0);
  pointer-events: auto;
}


/* ===============================
   RIGHT CONTENT（独立スクロール）
=============================== */

.miraba-right{
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 120px 0 160px;
  overscroll-behavior: contain;
}


/* ===============================
   TIMELINE １れつ
=============================== */

.timeline {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}


/* ===============================
   POST CARD（共通・横長固定）
=============================== */

.post-card{
  width: 100%;
  max-width: 960px;
  margin: 0 auto;

  padding: 28px 32px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);

  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===============================
   MAIN WRAPPER
=============================== */

.post-main{
  width: 100%;
}

/* ===============================
   TEXT ONLY
=============================== */

.post-card.text-only .post-main{
  display: block;
}

.post-card.text-only .post-text{
  max-width: 720px;
  line-height: 1.9;
  word-break: break-word;
}

/* ===============================
   IMAGE ONLY
=============================== */

.post-card.image-only .post-main{
  display: flex;
  justify-content: center;
}

.post-card.image-only .post-media{
  width: 100%;
  max-width: 420px;   /* ← ここが最重要 */
  aspect-ratio: auto;
}

.post-card.image-only .post-media img{
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* ===============================
   TEXT + IMAGE（左右分割）
=============================== */

.post-card.has-both .post-main{
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}

/* 左：コメント */
.post-content{
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card.has-both .post-actions{
  margin-top: auto;
}

/* 右：画像 */
.post-media{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}

.post-media > img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===============================
   ACTIONS
=============================== */

.post-actions{
  display: flex;
  gap: 24px;
}

.post-actions button{
  background: none;
  border: none;
  font-size: 12px;
  letter-spacing: .08em;
  color: #8fbaff;
  cursor: pointer;
}



/* ===============================
   POST HEADER（最終）
=============================== */

.post-header{
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  opacity: .7;
}

.post-user{
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-icon{
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;

  background: rgba(255,255,255,0.15);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 4px 12px rgba(0,0,0,0.35);
}

.user-name{
  font-size: 13px;
  letter-spacing: .08em;
  color: rgba(255,255,255,0.9);
}

.post-time{
  font-size: 11px;
  letter-spacing: .06em;
  opacity: .6;
}


/* text */
.post-text{
  margin-top: 18px;
  font-size: 14px;
  line-height: 1.9;
  color: rgba(255,255,255,0.9);
  white-space: pre-wrap;
}

/* image */
.post-image{
  margin-top: 18px;
  border-radius: 14px;
  overflow: hidden;
}

.post-image img{
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

/* actions */
.post-actions{
  margin-top: 20px;
  display: flex;
  gap: 24px;
}

.post-actions button{
  background: none;
  border: none;
  font-size: 12px;
  letter-spacing: .08em;
  color: #8fbaff;
  opacity: .7;
  cursor: pointer;
}

.post-actions button:hover{
  opacity: 1;
}


/* ===============================
   BODY CONTROL
=============================== */

body.right-open{
  overflow: hidden;
}

/* ===============================
   COMMENT PANEL
=============================== */

/* コメントパネル（RIGHT内表示・安定版） */
.comment-panel{
  position: relative;   /* post-card内 */
  right: auto;
  top: auto;
    box-sizing: border-box;

  width: 100%;
  height: auto;

  background: rgba(15,20,30,0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(120,190,255,0.25);
  border-radius: 14px;

  display: none;        /* 初期は閉 */
  flex-direction: column;
  padding: 16px;
  margin-top: 16px;

  opacity: 1;
  pointer-events: auto;
}

/* 開いた状態 */
.comment-panel.is-open{
  display: flex;
}

/* コメント一覧 */
.comment-list{
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 4px;
}




/* コメント一覧（独自スクロール） */
.comment-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}


/* 個別コメント */
/* ===============================
   COMMENT（SNS風・完成）
=============================== */

.comment-item{
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
/* 自分のコメント */
.comment-item.self{
  flex-direction: row-reverse;
  text-align: right;
  background: rgba(143,186,255,0.08);
  border-radius: 10px;
  padding: 6px;
}

.comment-item.self .comment-body{
  align-items: flex-end;
}


/* 本文 */
.comment-body{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comment-user-name{
  font-size: 11px;
  opacity: .6;
}

.comment-text{
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}


/* 入力欄 */
.comment-input{
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.comment-input input{
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  color: #fff;
}

.comment-input button{
  background: none;
  border: none;
  color: #8fbaff;
  font-size: 12px;
  cursor: pointer;
}

/* 投稿者 */
.post-user .user-name{
  font-weight: 500;
  color: #e6f0ff;
}

/* コメント者 */
.comment-user-name{
  font-size: 11px;
  opacity: .6;
}

.empty-state{
  margin-top: 120px;
  text-align: center;
  opacity: .6;
}

.empty-title{
  font-size: 16px;
  letter-spacing: .12em;
  margin-bottom: 16px;
}

.empty-sub{
  font-size: 13px;
  line-height: 1.9;
}

/* ===============================
   User Icon (shared)
=============================== */

.up-user-icon,
.my-user-icon,
.user-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(
    circle at top left,
    rgba(255,255,255,0.35),
    rgba(255,255,255,0.12)
  );
}

.up-user-icon img,
.my-user-icon img,
.user-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===============================
   User Name (shared)
=============================== */

.up-user-name,
.my-user-name,
.user-name {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.75);
}

/* ===============================
   IMAGE CAROUSEL (RIGHT)
=============================== */

.post-image-carousel{
  position: relative;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-image-frame{
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}

.post-image-frame img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ナビ */
.img-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10,15,25,0.6);
  border: none;
  color: #fff;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

.img-nav.prev{ left: -18px; }
.img-nav.next{ right: -18px; }

/* 1枚のときは非表示 */
.post-image-carousel[data-single="true"] .img-nav{
  display: none;
}

/* ===============================
   COMMENT ICON FIX（最重要）
=============================== */

.comment-user-icon{
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-user-icon img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.post-menu{
  display: flex;
  gap: 12px;
}

.post-menu button{
  background: none;
  border: none;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
}

.post-menu button:hover{
  color: #8fbaff;
}

.edit-textarea{
  width: 100%;
  min-height: 80px;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 10px;
  padding: 12px;
  color: #fff;
  font-size: 14px;
}

.comment-preview{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  opacity: .85;

  max-height: 220px;        /* ← ここが最重要 */
  overflow-y: auto;         /* ← スクロール有効 */
  padding-right: 4px;
}

/* スクロールバー（世界観維持・任意） */
.comment-preview::-webkit-scrollbar{
  width: 6px;
}

.comment-preview::-webkit-scrollbar-thumb{
  background: rgba(143,186,255,0.35);
  border-radius: 3px;
}
