/* styles.css
   新增 .likes-badge 留言氣泡右下角顯示樣式
   buildLikesBadgeHTML() 產生對應 DOM
*/

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f0f2f5;
  color: #1c1e21;
}

.container {
  display: grid;
  grid-template-columns: 360px 1fr 360px;
  width: 100%;
  padding-top: 56px;
}

/* ── Header ── */
.header {
  background-color: #fff;
  color: #1c1e21;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  height: 56px;
}

.header-content {
  display: grid;
  grid-template-columns: 360px 1fr 360px;
  align-items: center;
  height: 100%;
  padding: 0 0.5rem;
  width: 100%;
}

/* 左區 */
.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
  padding-left: 0.5rem;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  -webkit-touch-callout: none;  /* iOS 阻擋長按選單 */
  user-select: none;            /* 阻擋文字選取 */
  -webkit-user-drag: none;      /* 阻擋圖片拖曳 */
  pointer-events: none;         /* 阻擋所有滑鼠互動（不可點擊、不可拖曳） */
}
/*
.search-bar {
  display: flex;
  align-items: center;
  background-color: #f0f2f5;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  width: 240px;
  flex-shrink: 0;
}

.search-bar i {
  margin-right: 0.5rem;
  color: #65676b;
  flex-shrink: 0;
}

.search-bar input {
  background: none;
  border: none;
  color: #1c1e21;
  outline: none;
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}

.search-bar input::placeholder {
  color: #65676b;
}
*/
.header-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #B15BFF;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}
/* 中區：頁籤 */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.nav-tab {
  background: none;
  border: none;
  cursor: pointer;
  color: #65676b;
  width: 112px;
  height: 48px;
  border-radius: 8px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s;
}

.nav-tab:hover {
  background: #f0f2f5;
  color: #1877f2;
}

.nav-tab.active {
  color: #1877f2;
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 3px;
  background: #1877f2;
  border-radius: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-right: 0.5rem;
}

.header-icon-btn {
  background: #e4e6eb;
  border: none;
  cursor: pointer;
  color: #1c1e21;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
}

.header-icon-btn:hover {
  background: #d8dadf;
}

/* Badge 數字 
.header-icon-btn.badge-btn::after {
  content: attr(data-badge);
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e41e3f;
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  min-width: unset;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  box-sizing: border-box;
}
*/

/* 個人頭像佔位 */
.header-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Left Sidebar */
.left-sidebar {
  width: 360px;
  padding: 0.5rem 0.75rem;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.left-sidebar:hover {
  scrollbar-color: #d4d6da transparent;
}

.left-sidebar::-webkit-scrollbar {
  width: 6px;
}

.left-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.left-sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}

.left-sidebar:hover::-webkit-scrollbar-thumb {
  background: #d4d6da;
}

/* Right Sidebar (Friends Online) */
.right-sidebar {
  width: 360px;
  padding: 0.5rem 0.75rem;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.right-sidebar:hover {
  scrollbar-color: #d4d6da transparent;
}

.right-sidebar::-webkit-scrollbar {
  width: 6px;
}

.right-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.right-sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}

.right-sidebar:hover::-webkit-scrollbar-thumb {
  background: #d4d6da;
}

/* Friends Online Section */
.friends-online-section {
  margin-bottom: 1rem;
}

.friends-online-header {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #65676b;
}

.friends-online-header i {
  font-size: 1.25rem;
  color: #1877f2;
  margin-right: 0.75rem;
}

.friends-online-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.friend-item {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.friend-item:hover {
  background: #e4e6eb;
}

.friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 0.75rem;
  position: relative;
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.online-indicator {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 12px;
  height: 12px;
  background: #31a24c;
  border: 2px solid white;
  border-radius: 50%;
  z-index: 2;
}

.friend-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #050505;
}

.sidebar-divider {
  height: 1px;
  background: #e4e6eb;
  margin: 1rem 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 52px;
}

.sidebar-item:hover {
  background: #e4e6eb;
}

.sidebar-item span {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #050505;
  line-height: 1.3;
}

.sidebar-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-icon-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.sidebar-icon-square {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e4e6eb;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 防止舊 icon 樣式干擾圓形圖示內的 <i> */
.sidebar-icon-circle i,
.sidebar-icon-square i {
  display: block;
  line-height: 1;
  margin: 0;
  padding: 0;
  width: auto;
  color: inherit;
  font-size: inherit;
}

/* Weshare AI */
.sidebar-icon-meta {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  border: 8px solid #a334fa;
  position: relative;
  box-sizing: border-box;
}

/* 分類標題 */
.sidebar-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1c1e21;
  padding: 0.5rem 0.5rem 0.25rem;
}

.contacts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
}

.contacts-header span {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #65676b;
}

.contacts-header-icons {
  display: flex;
  gap: 0.25rem;
}

.contacts-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #65676b;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.15s;
}

.contacts-icon-btn:hover {
  background: #e4e6eb;
}

/* Section Header */
.section-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: #65676b;
  padding: 0.75rem;
  margin-bottom: 0.25rem;
}

/* Main Content */
.main-content {
  padding: 1rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* Create Post Section */
.create-post {
  background: white;
  border-radius: 8px;
  padding: 0.625rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.create-post-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.create-post-header .user-avatar {
  margin-right: 0.75rem;
}

.post-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.1rem;
  padding: 0.75rem;
  background-color: #f0f2f5;
  border-radius: 20px;
  cursor: pointer;
}

.create-post-actions {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid #e4e6ea;
  padding-top: 0.375rem;
  padding-bottom: 0.125rem;
}

.action-btn {
  background: none;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  color: #65676b;
  font-weight: 600;
  font-size: 0.rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.action-btn:hover {
  background-color: #f0f2f5;
}

.action-btn i {
  font-size: 1.2rem;
}

.action-btn--red i {
  color: #e41e3f;
}

.action-btn--green i {
  color: #45bd62;
}

.action-btn--yellow i {
  color: #f7b928;
}

/* Posts Feed */
.post {
  background: white;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
}

.post.pinned {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid #e3f2fd;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
}

.post-header {
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.post-header .post-author {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}

.author-section {
  display: flex;
  align-items: center;
}

.author-section img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 0.75rem;
}

.author-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.author-info .post-time {
  font-size: 0.8rem;
  color: #65676b;
  font-weight: 600;
}

.post-menu {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #65676b;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.post-menu:hover {
  background-color: #f0f2f5;
}

.post-content {
  padding: 0;
}

.post-text {
  margin-bottom: 0.75rem;
  line-height: 1.4;
  white-space: pre-wrap;
  padding: 0.5rem 1rem 0;
  font-size: 0.95rem;
}

.post-image {
  width: 100%;
  display: block;
  max-height: 500px;
  object-fit: cover;
  cursor: pointer;
  margin: 0;
}

.post-stats {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e4e6ea;
  border-bottom: 1px solid #e4e6ea;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: #65676b;
}

.likes-count {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.likes-count i {
  margin-right: 0.25rem;
  color: #1877f2;
}

.comments-shares {
  display: flex;
  gap: 1rem;
}

.comments-shares span {
  cursor: pointer;
}

.comments-shares span:hover {
  text-decoration: underline;
}

.post-actions {
  padding: 0.5rem;
  display: flex;
  justify-content: space-around;
}

.post-action {
  background: none;
  border: none;
  padding: 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  color: #65676b;
  font-weight: 600;
  transition: background-color 0.2s;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  -webkit-touch-callout: none; /* iOS 阻擋長按圖片/連結選單 */
  user-select: none;           /* 阻擋文字選取 */
  font-size: 0.98rem;   /* 文字大小 */
  gap: 0.8rem;          /* icon 與文字間距 */
}

.post-action:hover {
  background-color: #f0f2f5;
}

.post-action.liked {
  color: #1877f2;
}

.post-action.reaction-like {
  color: #1877f2;
}

.post-action.reaction-love {
  color: #f33e58;
}

.post-action.reaction-care {
  color: #f7b125;
}

.post-action.reaction-haha {
  color: #f7b125;
}

.post-action.reaction-wa {
  color: #f7b125;
}

.post-action.reaction-sad {
  color: #46A3FF;
}

.post-action.reaction-angry {
  color: #e9710f;
}

.post-action i {
  margin-right: 0;
}

/* Comments Section */

.comments-section {
  padding: 1rem 1.25rem;
  background-color: #f8f9fa;
  border-top: 1px solid #e4e6ea;
}

.comment-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-right: 0.5rem;  /* 右側留給分享按鈕的呼吸空間 */
}

.comment-input img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.comment-input input {
  flex: 1;
  min-width: 0;           /* 防止 flex 子元素撐破容器 */
  border: 1px solid #e4e6ea;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  outline: none;
}

.comment {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.comment-main {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  position: relative;
}

.comment>.comment-main>img,
.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.comment-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible !important;
  position: relative;
  align-items: flex-start;
}

/* FB Style Comment Bubble */
.comment-bubble {
  background-color: #f0f2f5;
  border-radius: 18px;
  padding: 8px 12px;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-bottom: 0;
  -webkit-touch-callout: none; /* iOS 阻擋長按圖片/連結選單 */
  user-select: none;           /* 阻擋文字選取 */
}

.reply-comment .comment-bubble {
  display: inline-block;
}

.comment-author {
  font-weight: 600;
  font-size: 13px;
  color: #050505;
  margin-bottom: 2px;
  line-height: 1.2308;
}

/* 作者列：author + 釘選標籤水平排列 */
.comment-author-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 2px;
  line-height: 1.2308;
}

/* 釘選標籤整體 */
.comment-pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #8a8d91;
  font-size: 13px;
  font-weight: 700;
}

/* 圖釘 icon：旋轉使其視覺上像釘選 */
.comment-pin-badge .fas.fa-thumbtack {
  font-size: 11px;
  color: #166fe5;
  ;
  transform: rotate(45deg);
}

/* 分隔號 · */
.comment-pin-sep {
  color: #bcc0c4;
  font-weight: 400;
  font-size: 14px;
  margin: 0 2px;
  /* 左右各 4px 間距 */
}

/* 朋友 badge（group 2：author 旁；group 4：精選留言文字旁）*/
.comment-friend-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #050505;
  background: #e4e6eb;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
}

/* 平台精選留言 文字 */
.comment-pin-label {
  font-weight: 700;
  color: #166fe5;
}

/* 評論區頂部說明列（group 3 & 4） */
.pinned-section-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 2px 0 10px 0;
  flex-wrap: wrap;
}

.pinned-header-label {
  font-size: 16px;
  font-weight: 700;
  color: #166fe5;
}

.pinned-header-desc {
  font-size: 14px;
  font-weight: 550;
  color: #050505;
}

.comment-text {
  font-size: 15px;
  color: #050505;
  line-height: 1.3333;
  word-wrap: break-word;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 0;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
  margin-left: 8px;
  font-size: 15px;
  position: relative;
  z-index: 1;
  line-height: 1;
}

.comment-actions .comment-time {
  font-size: 15px;
  color: #65676b;
  line-height: 1;
  display: flex;
  align-items: center;
}

.comment-time {
  color: #65676b;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.comment-action-btn {
  background: none;
  border: none;
  color: #65676b;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  transition: color 0.2s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  position: relative;
  top: 1px;
  -webkit-touch-callout: none; /* iOS 阻擋長按圖片/連結選單 */
  user-select: none;        /* 阻擋文字選取 */   
}

.comment-action-btn:hover {
  text-decoration: underline;
}

.comment-action-btn.liked {
  color: #1877f2;
}

.comment-action-btn.replying {
  color: #1877f2;
}

.comment-action-btn.reaction-like {
  color: #1877f2;
}

.comment-action-btn.reaction-love {
  color: #f33e58;
}

.comment-action-btn.reaction-haha {
  color: #f7b125;
}

.comment-action-btn.reaction-wa {
  color: #f7b125;
}

.comment-action-btn.reaction-sad {
  color: #46A3FF;
}

.comment-action-btn.reaction-angry {
  color: #e9710f;
}

.comment-action-btn.like-btn {
  position: relative;
}

.reaction-option {
  cursor: pointer;
  transition: transform 0.15s ease;
  user-select: none;
  padding: 2px;
  line-height: 1;
  width: 40px !important;
  height: 40px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border-radius: 6px;
  position: relative;
}

.reaction-option img {
  width: 38px !important;
  height: 38px !important;
  object-fit: contain;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-drag: none;     /* 阻擋拖曳/儲存，不影響點擊 */
}

.reaction-option:hover {
  transform: scale(1.2);
}

.reaction-option::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10000;
}

.reaction-option:hover::after {
  opacity: 1;
}

/* Replies Container */
.replies-container {
  margin-left: 48px;
  margin-top: 8px;
  position: relative;
  display: none;
}

.replies-container.show {
  display: block;
}

.view-replies-trigger.collapsed {
  display: none;
}

.view-replies-trigger {
  margin-left: 48px;
  margin-top: 8px;
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.view-replies-trigger.hidden {
  display: none;
}

.view-replies-trigger::before {
  content: '';
  position: absolute;
  left: -28px;
  top: -8px;
  width: 20px;
  height: 14px;
  border-left: 2px solid #e4e6eb;
  border-bottom: 2px solid #e4e6eb;
  border-bottom-left-radius: 12px;
}

.view-replies-trigger::after {
  content: '';
  position: absolute;
  left: -28px;
  top: -87px;
  width: 2px;
  height: 79px;
  background-color: #e4e6eb;
  display: block;
}

.view-replies-text {
  color: #65676b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  top: -4px;
}

.view-replies-text:hover {
  text-decoration: underline;
}

.replies-container.show::after {
  content: '';
  position: absolute;
  left: -28px;
  top: -88px;
  width: 2px;
  height: calc(100% + 60px);
  background-color: #e4e6eb;
  z-index: 0;
}

.replies-container .reply-comment:last-of-type::after {
  content: '';
  position: absolute;
  left: -28px;
  top: 14px;
  width: 2px;
  height: 100vh;
  background-color: #f8f9fa;
  z-index: 0;
}

.replies-container .reply-comment {
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
  margin-top: 0;
}

.replies-container .reply-comment:last-child {
  margin-bottom: 0;
}

.replies-container .reply-comment::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 0px;
  width: 20px;
  height: 14px;
  border-left: 2px solid #e4e6eb;
  border-bottom: 2px solid #e4e6eb;
  border-bottom-left-radius: 12px;
  background-color: transparent;
}

.replies-container .comment-avatar {
  width: 40px;
  height: 40px;
}

/* Reply Input Row */
.reply-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  position: relative;
  padding-right: 0.5rem;  /* 右側留給分享按鈕的呼吸空間 */
}

.reply-input-row::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 0px;
  width: 20px;
  height: 14px;
  border-left: 2px solid #e4e6eb;
  border-bottom: 2px solid #e4e6eb;
  border-bottom-left-radius: 12px;
  background-color: transparent;
}

.reply-input-row .comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.reply-input-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e4e6ea;
  border-radius: 16px;
  padding: 6px 12px;
  outline: none;
  font-size: 13px;
  background-color: #f0f2f5;
}

.reply-input-row input:focus {
  background-color: white;
}

.inline-reply-input {
  margin-top: 8px;
  padding-left: 12px;
  position: relative;
}

.parent-collapsed-input {
  padding-left: 28px;
  margin-top: 0;
  margin-left: 0;
}

.parent-collapsed-input .reply-input-wrapper {
  position: relative;
}

.parent-collapsed-input .reply-input-wrapper::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 0px;
  width: 20px;
  height: 14px;
  border-left: 2px solid #e4e6eb;
  border-bottom: 2px solid #e4e6eb;
  border-bottom-left-radius: 12px;
  background-color: transparent;
  z-index: 0;
}

.parent-collapsed-input .reply-input-wrapper::after {
  content: '';
  position: absolute;
  left: -28px;
  top: 14px;
  width: 2px;
  height: 100vh;
  background-color: #f8f9fa;
  z-index: 0;
}

.child-reply-input {
  padding-left: 28px;
  margin-top: 8px;
  margin-left: 0;
}

.child-reply-input .reply-input-wrapper {
  position: relative;
}

.child-reply-input .reply-input-wrapper::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 10px;
  width: 20px;
  height: 14px;
  border-left: 2px solid #e4e6eb;
  border-bottom: 2px solid #e4e6eb;
  border-bottom-left-radius: 12px;
  background-color: transparent;
  z-index: 0;
}

.child-reply-input .reply-input-wrapper::after {
  content: '';
  position: absolute;
  left: -28px;
  top: 24px;
  width: 2px;
  height: 100vh;
  background-color: #f8f9fa;
  z-index: 0;
}

.reply-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-container input {
  width: 100%;
  border: 1px solid #e4e6ea;
  border-radius: 16px;
  padding: 6px 12px;
  outline: none;
  font-size: 13px;
  background-color: #f0f2f5;
}

.input-container input:focus {
  background-color: white;
}

.input-container .reply-post-btn {
  background: none;
  border: none;
  color: #8a8d91;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.input-container .reply-post-btn.active {
  color: #1877f2;
}

.input-container .reply-post-btn:disabled {
  cursor: not-allowed;
}

.reply-post-btn {
  background: none;
  border: none;
  color: #8a8d91;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  transition: color 0.2s ease;
  flex-shrink: 0;
  transform: rotate(45deg);
}

.reply-post-btn.active {
  color: #1877f2;
}

.reply-post-btn:disabled {
  cursor: not-allowed;
}

.reply-comment {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
  margin-top: 0;
}

.reply-comment-main {
  display: flex;
  gap: 0.5rem;
}

.reply-comment .comment-content {
  flex: 1;
  background-color: transparent;
  border-radius: 0;
  padding: 0;
}

.reply-comment .comment-actions {
  margin-left: 8px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.closing {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 750px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-bottom: 1px solid #e4e6ea;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  flex: 1;
}

.modal-close {
  background: #e4e6eb;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #65676b;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover {
  background: #f0f2f5;
}

.modal-body {
  padding: 0;
}

.modal-post .post-content {
  padding: 0;
}

.modal-post .post-text {
  padding: 0.75rem 1rem 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.modal-post .post-image {
  width: 100%;
  display: block;
  max-height: 500px;
  object-fit: cover;
  margin: 0;
}

.modal-post .post-stats {
  padding: 0.5rem 1rem;
}

.modal-comments-section {
  padding: 0 1rem 1rem;
}

.modal-post .post-author {
  width: 100%;
  padding: 0.75rem 1rem 0.5rem;
  position: relative;
}

.modal-post .post-menu {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #65676b;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-post .post-menu:hover {
  background-color: #f0f2f5;
}

.share-input-section {
  border-top: 1px solid #e4e6ea;
  padding: 1rem 0;
}

.share-text-input {
  width: 100%;
  border: 1px solid #e4e6ea;
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.share-submit-btn {
  background: #1877f2;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.share-submit-btn:hover {
  background: #166fe5;
}

.modal-comments-section {
  border-top: 1px solid #e4e6ea;
  display: flex;
  flex-direction: column;
  height: 380px;   /* modal 留言區總高度 */
  overflow: hidden;
}

.modal-comments-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem 0.5rem;
}

.modal-comment-input-fixed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e4e6ea;
  background: #fff;
  flex-shrink: 0;
}

.comment-text-input-modal {
  flex: 1;
  border: 1px solid #e4e6ea;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  outline: none;
  font-size: 0.9rem;
}

.comment-text-input-modal:focus {
  border-color: #1877f2;
}

/* .comments-list-modal 的捲動由父層 .modal-comments-scroll 控制，無需額外設定 */

.comment-action-btn.like-btn {
  position: relative;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  /* 手機版 modal：隱藏貼文內容，只留 header + 留言區 */
  .modal-post .post-author,
  .modal-post .post-content,
  .modal-post .post-stats,
  .modal-post .share-input-section {
    display: none;
  }

  .modal-comments-section {
    border-top: none;   /* 上方元素已隱藏，不需分隔線 */
  }

  /* ── Modal ───────────────────────────────────────────────── */
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .modal-header {
    padding: 0.75rem 1rem;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 0;
  }

  .share-input-section {
    padding: 0.75rem;
  }

  .comments-list-modal { 
    max-height: unset; 
  }

  .modal-comments-section {
    height: calc(60vh - 60px);  /* 手機版用視窗比例而非固定高度 */
    padding: 0;  
  }

  .modal-comments-scroll {
    padding: 0.75rem 0.75rem 0.5rem;      /* 唯一左右間距來源 */
  }

  .modal-comment-input-fixed {
    padding: 0.75rem;                     /* 輸入框左右間距對齊 */
  }

  /* ── 整體佈局：三欄 → 單欄 ───────────────────────────────── */
  .container {
    grid-template-columns: 1fr;
    padding-top: 96px;
  }

  .left-sidebar,
  .right-sidebar {
    display: none;
  }

  .main-content {
    padding: 0.5rem 0;
    padding-top: calc(0.5rem + 130px);
    /* 為固定聯絡人卡片預留空間，約 90px 高 */
    max-width: 100%;
  }

  .create-post {
    border-radius: 0;
    margin-bottom: 0.5rem;
  }

  .post {
    border-radius: 0;
    margin-bottom: 0.5rem;
  }

  /* ── Header：單列 → 兩列 ─────────────────────────────────── */
  .header {
    height: 96px;
  }

  .header-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 56px 40px;
    grid-template-areas:
      "left right"
      "nav  nav";
    padding: 0 0.75rem;
    align-items: start;
  }

  .header-left {
    grid-area: left;
    align-self: center;
    padding-left: 0;
  }

  .header-right {
    grid-area: right;
    align-self: center;
    padding-right: 0;
    gap: 0.2rem;
    flex-shrink: 0;
  }

  .header-right .header-icon-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .header-avatar-placeholder {
    width: 34px;
    height: 34px;
  }

  .header-avatar-img {
    width: 34px;
    height: 34px;
  }

  .header-nav {
    grid-area: nav;
    width: 100%;
    justify-content: space-around;
    gap: 0;
    border-top: 1px solid #e4e6eb;
    align-items: center;
    height: 40px;
  }

  .nav-tab {
    width: auto;
    flex: 1;
    height: 40px;
    font-size: 1.2rem;
  }

  .nav-tab.active::after {
    bottom: 0;
  }
  /*
  .search-bar {
    width: 120px;
    padding: 0.4rem 0.75rem;
  }
  */
  
  /* ── Setup Modal ─────────────────────────────────────────── */
  .setup-card {
    margin: 1rem 1.25rem;
    padding: 1.5rem 1.25rem 1.25rem;
    width: calc(100% - 2.5rem);
    max-width: none;
    box-sizing: border-box;
  }

  .setup-card--compact {
    padding: 1.1rem 1.25rem 1rem;
  }

  /* ── 問卷按鈕：置中、避免遮擋留言 ────────────────────────── */
  .survey-btn-wrap {
    bottom: 14px;
    left: 50%;
    right: auto;
    /* 不依賴 right: 0 */
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 420px;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  /* ── 向下箭頭（按鈕上方）────────────────────────────────── */
  .survey-arrow {
    display: none;
  }

  .survey-btn {
    width: 100%;
    max-width: 420px;
    font-size: 1rem;
    padding: 0.75rem 1rem 0.65rem;  /* 下方稍減，倒數列自帶間距 */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .survey-countdown-mobile {
    display: none;               /* 預設隱藏，由 JS 顯示 */
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);   /* 白色半透明，融入灰色按鈕 */
    line-height: 1;
  }

  .survey-countdown-mobile i {
    font-size: 1rem;
    line-height: 1;
  }

  /* 解鎖後隱藏倒數列（時間到時 JS 已處理，CSS 作為保險） */
  .survey-btn:not(.survey-btn--locked) .survey-countdown-mobile {
    display: none !important;
  }
}


/* ── 留言區收合按鈕（手機版專用）────────────────────────────── */
.comments-toggle-btn {
  display: none;
  /* 桌面版隱藏 */
}

.comments-collapse-btn {
  display: none;
  /* 桌面版隱藏 */
}

@media (max-width: 768px) {

  .survey-countdown {
      display: none !important;
    }

  /* 展開按鈕：顯示於貼文底部（留言區上方） */
  .comments-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: calc(100% - 2rem);
    margin: 0.5rem 1rem;
    padding: 0.6rem 1rem;
    background: #fff;
    border: 1.5px solid #d0d0d0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1c1e21;
    transition: background 0.15s;
  }

  .comments-toggle-btn:hover {
    background: #f0f2f5;
  }

  .comments-toggle-btn i {
    font-size: 0.9rem;
  }

  /* 收合按鈕：顯示於留言清單最下方 */
  .comments-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: calc(100% - 2rem);
    margin: 0.75rem 1rem 0.5rem;
    padding: 0.6rem 1rem;
    background: #fff;
    border: 1.5px solid #d0d0d0;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1c1e21;
    transition: background 0.15s;
  }

  .comments-collapse-btn:hover {
    background: #f0f2f5;
  }

  .comments-collapse-btn i {
    font-size: 0.9rem;
  }

  /* 手機版預設隱藏留言區 */
  .comments-section.mobile-collapsed .comments-list,
  .comments-section.mobile-collapsed .comment-input,
  .comments-section.mobile-collapsed .comments-collapse-btn {
    display: none;
  }

  /* 手機版展開時隱藏展開按鈕 */
  .comments-section:not(.mobile-collapsed) .comments-toggle-btn {
    display: none;
  }
}

/* ================================================================
   Likes Badge — 留言氣泡右下角顯示
   對應 buildLikesBadgeHTML() 規則：
     count=0 → 不顯示
     count=1 → 只顯示 emoji，無數字
     count>1 → 數字 + emoji
     emoji 種類 ≥ 3 → 前三種並排
   ================================================================ */



/* ================================================================
   PATCH：badge 定位、selector 位置、L型線、顏色
   ================================================================ */

/* comment-content 不裁切 badge */
.comment-content {
  position: relative;
  overflow: visible !important;
}

.comment-bubble-wrap {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 2px;
  align-self: flex-start;
}

.comment-bubble-wrap>.comment-bubble {
  margin-bottom: 0;
}

/* ── likes-badge：初始隱藏，由 JS 控制顯示與定位 ── */
.likes-badge {
  display: none;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  pointer-events: none;
}

.likes-badge .badge-emoji {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: inline-block;
}

.likes-badge .badge-count {
  font-size: 12px;
  color: #65676b;
  font-weight: 500;
  margin-left: 2px;
}

/* 回覆留言 badge 稍小 */
.replies-container .likes-badge .badge-emoji {
  width: 14px;
  height: 14px;
}

.replies-container .likes-badge .badge-count {
  font-size: 11px;
}

/* ── reaction-selector：固定在 .like-btn 正上方 ── */
.comment-action-btn.like-btn {
  position: relative;
}

/* Reaction Selector */
.reaction-selector {
  position: fixed;
  background: white;
  border-radius: 25px;
  padding: 6px 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  gap: 4px !important;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  white-space: nowrap;
  -webkit-touch-callout: none; /* iOS 阻擋長按圖片選單 */
  user-select: none;           /* 阻擋文字選取 */
}

.reaction-selector.show {
  display: flex !important;
  opacity: 1;
  transform: scale(1);
}

/* ── like-btn 顏色 ── */
.comment-action-btn.reaction-like {
  color: #1877f2;
}

.comment-action-btn.reaction-love {
  color: #f33e58;
}

.comment-action-btn.reaction-care {
  color: #f7b125;
}

.comment-action-btn.reaction-haha {
  color: #f7b125;
}

.comment-action-btn.reaction-wow {
  color: #f7b125;
}

.comment-action-btn.reaction-sad {
  color: #46A3FF;
}

.comment-action-btn.reaction-angry {
  color: #e9710f;
}

/* ── L型線預設隱藏 ── */
.view-replies-trigger.lines-hidden::before,
.view-replies-trigger.lines-hidden::after,
.replies-container.lines-hidden::after,
.replies-container .reply-comment.lines-hidden::before,
.replies-container .reply-comment.lines-hidden::after,
.reply-input-row.lines-hidden::before {
  display: none !important;
}

.view-replies-trigger.lines-visible::before,
.view-replies-trigger.lines-visible::after,
.replies-container.lines-visible::after,
.replies-container .reply-comment.lines-visible::before,
.replies-container .reply-comment.lines-visible::after,
.reply-input-row.lines-visible::before {
  display: block !important;
}

/* ══ Setup Modal ══════════════════════════════════════════════ */

/* 需求3：modal 開啟時背景不可滾動 */
body.setup-open {
  overflow: hidden;
}

.setup-overlay {
  position: fixed;
  inset: 0;
  /* 需求3：遮罩透明度 20% */
  background: rgba(0, 0, 0, 0.20);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.setup-overlay.hidden {
  display: none;
}

/* ── 共用 card ────────────────────────────────────────────── */
.setup-card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 2.5rem 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem auto;
}

/* 第二頁：方框更緊湊 */
.setup-card--compact {
  gap: 0.5rem;
}

/* ── 第一頁：標題文字 ─────────────────────────────────────── */
.setup-guide-title {
  width: 100%;
  font-size: 1.5rem;
  font-weight: 700;
  color: #B15BFF;
  margin: 0;
  text-align: center;
  line-height: 1.4;
}

.setup-guide-subtitle {
  width: 100%;
  font-size: 0.93rem;
  /* 與情境提示方框文字相同 */
  color: #1c1e21;
  margin: 0 0 0.25rem;
  text-align: center;
  line-height: 1.5;
}

.setup-interlude-label {
  width: 100%;
  font-size: 0.93rem;
  color: #1c1e21;
  text-align: center;
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

/* ── 引言方框（兩頁共用）────────────────────────────────── */
.setup-quote-block {
  width: 100%;
  background: #f9f9f9;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.setup-card--compact .setup-quote-block {
  padding: 0.9rem 1.3rem;
  gap: 0.35rem;
}

.setup-quote-icon {
  font-size: 2.2rem;
  line-height: 1;
  color: #7ecec4;
  font-family: Georgia, serif;
  font-weight: 900;
  margin-bottom: -0.2rem;
}

.setup-quote-text {
  font-size: 0.93rem;
  line-height: 1.75;
  color: #3a3a3a;
  text-align: left;
  margin: 0;
  width: 100%;
}

.setup-quote-text p {
  margin: 0 0 0.6rem;
}

.setup-quote-text p:last-child {
  margin-bottom: 0;
}

.setup-card--compact .setup-quote-text {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── 底部列（圓點 + 按鈕水平排列）────────────────────────── */
.setup-card-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
}

/* 第一頁 footer 左側佔位，寬度對齊右側按鈕，使圓點視覺置中 */
.setup-footer-spacer {
  min-width: 72px;
  flex-shrink: 0;
}

/* ── 輪播圓點（放在 footer 中間）────────────────────────── */
.setup-dots {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  align-items: center;
  flex: 1;
}

.setup-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d0d0d0;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px #bbb;
  display: inline-block;
  transition: background 0.2s;
}

.setup-dot--active {
  background: #1877f2;
  box-shadow: 0 0 0 1px #1877f2;
}

/* ── 下一頁 / 上一頁按鈕（共用輪廓樣式）────────────────── */
.setup-next-btn,
.setup-back-btn {
  padding: 0.5rem 1.1rem;
  background: #fff;
  color: #1877f2;
  font-size: 0.93rem;
  font-weight: 600;
  border: 1.5px solid #1877f2;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  min-width: 72px;
  width: auto;
  flex-shrink: 0;
  text-align: center;
}

.setup-next-btn:hover,
.setup-back-btn:hover {
  background: #1877f2;
  color: #fff;
}

.setup-divider {
  width: 100%;
  border: none;
  border-top: 1px solid #e4e6eb;
  margin: 0.1rem 0;
}

/* ── 標題 / 說明 ──────────────────────────────────────────── */
.setup-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1c1e21;
  margin: 0;
  align-self: center;
}

.setup-subtitle {
  font-size: 0.88rem;
  color: #1c1e21;
  margin: 0;
  align-self: center;
}

/* ── 輸入欄位 ─────────────────────────────────────────────── */
.setup-field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.setup-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1c1e21;
}

.setup-field input {
  padding: 0.55rem 0.9rem;
  border: 1.5px solid #ccd0d5;
  border-radius: 8px;
  font-size: 1rem;
  color: #1c1e21;
  outline: none;
  transition: border-color 0.15s;
}

.setup-field input:focus {
  border-color: #1877f2;
}

.setup-error {
  font-size: 0.85rem;
  color: #e53935;
  margin: 0;
  align-self: flex-start;
}

/* ── 進入網站按鈕（第二頁右下角）──────────────────────────── */
.setup-confirm-btn {
  padding: 0.5rem 1.1rem;
  background: #EE3A43;
  color: #fff;
  font-size: 0.93rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  min-width: 72px;
  text-align: center;
  width: auto;
  flex-shrink: 0;
}

.setup-confirm-btn:hover {
  background: #FF2D2D;
}

/* ══ 好友暱稱確認視窗 ══════════════════════════════════════ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10000;
  /* 高於 setup-overlay 的 9999 */
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem 2rem 1.5rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.confirm-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1c1e21;
  margin: 0;
  text-align: center;
}

.confirm-desc {
  font-size: 0.88rem;
  color: #e53935;
  margin: 0;
  text-align: center;
}

.confirm-names {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.confirm-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.confirm-name-label {
  color: #65676b;
  font-weight: 600;
}

.confirm-name-value {
  color: #1c1e21;
  font-weight: 700;
}

.confirm-footer {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.confirm-edit-btn,
.confirm-ok-btn {
  flex: 1;
  padding: 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
}

.confirm-edit-btn {
  background: #1877f2;
  color: #fff;
}

.confirm-edit-btn:hover {
  background: #1877f2;
}

.confirm-ok-btn {
  background: #fff;
  color: #EE3A43;
  border: 1.5px solid #EE3A43;
}

.confirm-ok-btn:hover {
  background: #FF2D2D;
  color: #fff;
}

.confirm-desc--hint {
  font-size: 0.83rem;
  color: #1c1e21;
  margin: 0;
  margin-bottom: 0.4rem;
  text-align: left;
}
/* ── 倒數計時器（箭頭上方，桌面版專用）────────────────────── */
.survey-countdown {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #bcc0c4;
  border-radius: 20px;
  padding: 10px 28px;
  font-size: 2.4rem;
  font-weight: 600;
  color: #65676b;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  width: fit-content;          /* 動態收縮，不撐滿容器 */
  align-self: center;          /* 在 column flex 中水平置中，對齊箭頭正上方 */
  transition: color 0.3s, border-color 0.3s;
}

.survey-countdown i {
  font-size: 2.2rem;
  color: #bcc0c4;
  line-height: 1;
  display: flex;
  align-items: center;
  position: relative;
  top: 1px;
}
/* ══ 問卷按鈕 ══════════════════════════════════════════════════ */
.survey-btn-wrap {
  position: fixed;
  bottom: 28px;
  right: 40px;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* ── 向下箭頭（按鈕上方）────────────────────────────────── */
.survey-arrow {
  display: flex;
  justify-content: center;
  /* 對準按鈕中心 */
  width: 100%;
  /* 撐滿 wrap 寬度（與按鈕同寬） */
  animation: arrow-bounce 1.2s ease-in-out infinite;
}

/* 預設灰色，由 .unlocked class 切換為藍色 */
.survey-arrow i {
  font-size: 3.6rem;
  font-weight: 900;
  color: #bcc0c4;   /* 預設灰色，與 disabled 按鈕一致 */
  line-height: 1;
  transition: color 0.3s ease;
}

/* survey-btn-wrap 加上 .unlocked 後，箭頭轉為藍色 */
.survey-btn-wrap.unlocked .survey-arrow i {
  color: #1877f2;
}

@keyframes arrow-bounce {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(8px);
  }

  100% {
    transform: translateY(0);
  }
}

.survey-btn {
  position: relative;
  padding: 1rem 2rem;
  background: #1877f2;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(24, 119, 242, 0.35);
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.survey-btn--locked {
  background: #bcc0c4;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.75;
}

.survey-btn:not(.survey-btn--locked):hover {
  background: #166fe5;
}

.survey-btn:not(.survey-btn--locked) {
  animation: ripple-inward 2s ease-in infinite;
}

/* 波紋動畫：多層 box-shadow 由外往內收縮融入邊框 */
@keyframes ripple-inward {
  0% {
    box-shadow:
      0 0 0 14px rgba(24, 119, 242, 0.2),
      0 0 0 8px rgba(24, 119, 242, 0.32),
      0 0 0 2px rgba(24, 119, 242, 0.5);
  }

  100% {
    box-shadow:
      0 0 0 2px rgba(24, 119, 242, 0),
      0 0 0 1px rgba(24, 119, 242, 0),
      0 0 0 0px rgba(24, 119, 242, 0);
  }
}

/* ── 分享成功 Toast ──────────────────────────────── */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

.share-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 0);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 99999;
  pointer-events: none;
  animation: toast-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.share-toast.hide {
  animation: toast-out 0.22s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.share-toast__icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #42b72a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.share-toast__icon svg {
  display: block;
}

.share-toast__text {
  font-size: 15px;
  font-weight: 600;
  color: #1c1e21;
  white-space: nowrap;
}

/* ══ 手機版聯絡人卡片（main-content 內，create-post 上方）══ */
.mobile-contacts-card {
  display: none;
  /* 桌面版預設隱藏 */
}

@media (max-width: 768px) {
  .mobile-contacts-card {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 96px;
    /* header 高度 */
    left: 0;
    right: 0;
    z-index: 900;
    /* 低於 header(1000)，高於貼文 */
    background: #fff;
    border-radius: 0;
    /* 固定滿版時去掉圓角 */
    padding: 0.35rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.10);
    gap: 0.2rem;
  }

  .mobile-contacts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 700;
    color: #65676b;
    margin-bottom: 0.25rem;
  }

  .mobile-friends-list {
    display: flex;
    flex-direction: row;
    gap: 1.2rem;           /* 固定間距，不依賴 space-around */
    align-items: flex-start;
    justify-content: flex-start;  /* 靠左排列 */
    width: 100%;
  }

  /* 手機版 friend-item：頭像 + 名稱垂直堆疊 */
  .mobile-friends-list .friend-item {
    display: flex;
    flex-direction: column;
    align-items: center;  /* 靠左對齊，名稱不再被強制置中 */
    gap: 0.3rem;
    flex-shrink: 0;
  }

  .mobile-friends-list .friend-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
  }

  .mobile-friends-list .friend-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1c1e21;
    white-space: nowrap;
    max-width: 80px;
    display: block;
    margin-left: -13px;     /* 微調向左，可依視覺效果調整此數值 */
  }

  .posts-feed {
    padding-bottom: 130px;     /* 為底部固定按鈕預留空間 */
  }

  /* 主留言框與回覆框右側補間距，確保分享按鈕可點擊 */
  .comment-input {
    padding-right: 0.75rem;
  }

  .reply-input-row {
    padding-right: 0.75rem;
  }
}