/**
 * 倾诉区 · 四 Tab 参考稿布局（≥1024px）
 * 倾诉 58:42 | 广场侧栏+信息流 | 我的三卡 | 日签时间线
 */

.treehole-tab-lead {
  display: none;
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--qq-text-sub);
  line-height: 1.5;
}
.th-card {
  background: var(--qq-card);
  border: 1px solid var(--qq-border-light);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: none;
}
.th-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--qq-border-light);
}
.th-card-hd h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--qq-text);
}
.th-card-fold {
  border: none;
  background: rgba(61, 139, 122, 0.08);
  color: var(--qq-text-sub);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.th-card-fold:hover { color: var(--qq-primary); }
.th-card-bd { padding: 14px 18px 18px; }
.th-card.is-collapsed .th-card-bd { display: none; }

/* —— 倾诉：左宽右窄 —— */
.confide-my-aside,
.mine-dashboard,
.square-aside-rail { display: none; }

.square-search-bar { display: none; }

/* 二级 Tab 滚动悬浮（平板/PC，移动端用底栏） */
@media (min-width: 768px) {
  #pageTreehole {
    --th-nav-h: 52px;
    --th-badge-h: 0px;
    --th-tabs-h: 0px;
    --th-head-pad: 8px;
    --th-sticky-below-tabs: calc(var(--th-nav-h) + var(--th-badge-h) + var(--th-tabs-h) + var(--th-head-pad));
  }
  #pageTreehole .app-workspace-head {
    position: sticky;
    top: var(--lp-chrome-total, var(--th-nav-h));
    z-index: 540;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 8px;
  }
  #pageTreehole .anon-id-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 0 0 8px !important;
    margin: 0;
  }
  #pageTreehole .anon-id-bar #sidebarNoDisplay { display: none; }
  #pageTreehole .qq-main-tabs {
    max-width: 100%;
    justify-content: flex-start;
    margin-left: 0;
    margin-right: auto;
    padding: 0 !important;
  }
}

#pageTreehole.treehole-tab-square #feedPanel .category-tabs {
  display: none;
}
#pageTreehole.treehole-tab-square .square-aside-rail .category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 平板 / 窄窗口：单列堆叠，避免侧栏与信息流抢宽 */
@media (min-width: 768px) and (max-width: 1023px) {
  #pageTreehole #panelShuoshuo:not(.hidden) {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-width: 0;
  }
  #pageTreehole.treehole-tab-square .square-aside-rail {
    position: static;
    max-height: none;
    width: 100%;
  }
  #pageTreehole.treehole-tab-square #feedPanel {
    width: 100%;
    min-width: 0;
  }
}

@media (min-width: 1024px) {
  #pageTreehole {
    --th-badge-h: 0px;
    --th-tabs-h: 0px;
    --th-head-pad: 12px;
  }
  #pageTreehole .qq-three-col {
    max-width: 1200px;
    width: 100%;
  }
  #pageTreehole #panelShuoshuo:not(.hidden) {
    width: 100%;
    min-width: 0;
  }
  .treehole-tab-lead {
    display: block;
    grid-column: 1 / -1;
  }
  #pageTreehole.treehole-tab-shuoshuo .treehole-tab-lead,
  #pageTreehole.treehole-tab-square .treehole-tab-lead,
  #pageTreehole.treehole-tab-mine .treehole-tab-lead {
    display: block;
  }
  #pageTreehole.treehole-tab-daily .treehole-tab-lead { display: none; }

  #panelShuoshuo:not(.hidden) {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 20px 24px;
    align-items: start;
  }

  /* 倾诉 */
  #pageTreehole.treehole-tab-shuoshuo #panelShuoshuo {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
  #pageTreehole.treehole-tab-shuoshuo .confide-my-aside {
    display: block;
    grid-column: 2;
    grid-row: 2;
  }
  #pageTreehole.treehole-tab-shuoshuo #publishCard {
    grid-column: 1;
    grid-row: 2;
  }
  #pageTreehole.treehole-tab-shuoshuo #feedPanel {
    display: none !important;
  }
  #pageTreehole.treehole-tab-shuoshuo .quick-confide-input {
    min-height: 72px;
    max-height: 140px;
  }
  #pageTreehole.treehole-tab-shuoshuo .qq-btn-publish {
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(61, 139, 122, 0.32);
  }

  /* 广场：侧栏随容器变窄，最小 768px 宽时再双列 */
  #pageTreehole.treehole-tab-square #panelShuoshuo {
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    column-gap: clamp(12px, 2vw, 24px);
  }
  #pageTreehole.treehole-tab-square .square-aside-rail {
    display: block;
    grid-column: 1;
    grid-row: 2 / span 2;
    position: sticky;
    top: var(--th-sticky-below-tabs, 106px);
    z-index: 530;
    align-self: start;
    max-height: calc(100vh - var(--th-sticky-below-tabs, 106px) - 20px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #pageTreehole.treehole-tab-square #feedPanel {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    max-height: none;
    overflow-y: visible;
    margin-top: 0 !important;
    display: flex;
    flex-direction: column;
  }
  #pageTreehole.treehole-tab-square #feedPanel .post-waterfall {
    flex: 1;
    min-height: 0;
  }
  #pageTreehole.treehole-tab-square .square-search-bar {
    display: flex;
    margin-bottom: 0;
    padding-bottom: 12px;
  }
  #pageTreehole.treehole-tab-square #feedPanel .category-tabs {
    display: none;
  }
  #pageTreehole.treehole-tab-square .square-aside-rail .category-tabs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
  }
  #pageTreehole.treehole-tab-square .square-aside-rail .cat-tab {
    width: 100%;
    text-align: left;
    border-radius: 10px;
    padding: 9px 12px;
    justify-content: flex-start;
  }

  /* 我的 */
  #pageTreehole.treehole-tab-mine #panelShuoshuo {
    grid-template-columns: 1fr;
  }
  #pageTreehole.treehole-tab-mine .mine-dashboard {
    display: block;
    grid-column: 1 / -1;
    grid-row: 2;
    margin-bottom: 4px;
  }
  #pageTreehole.treehole-tab-mine #feedPanel {
    grid-column: 1;
    grid-row: 3;
    max-height: none;
  }
  .mine-dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .th-profile-card .th-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(61, 139, 122, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 10px;
  }
  .th-profile-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
  .th-profile-no { font-size: 13px; color: var(--qq-text-sub); font-family: monospace; }
  .mine-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }
  .mine-stat-cell {
    text-align: center;
    padding: 10px 6px;
    border-radius: 10px;
    background: rgba(61, 139, 122, 0.06);
    border: 1px solid rgba(61, 139, 122, 0.1);
  }
  .mine-stat-cell strong {
    display: block;
    font-size: 18px;
    color: var(--qq-primary);
    margin-bottom: 2px;
  }
  .mine-stat-cell span { font-size: 11px; color: var(--qq-text-sub); }
  .mine-mood-score {
    text-align: center;
    font-size: 13px;
    color: var(--qq-text-sub);
    padding-top: 8px;
    border-top: 1px solid var(--qq-border-light);
  }
  .mine-mood-score em {
    font-style: normal;
    font-size: 20px;
    font-weight: 700;
    color: var(--lp-accent);
  }
  .mine-link-list { display: flex; flex-direction: column; gap: 4px; }
  .mine-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: rgba(61, 139, 122, 0.05);
    color: var(--qq-text);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
  }
  .mine-link-item:hover { background: rgba(61, 139, 122, 0.1); }

  /* 通用卡片 */
  #pageTreehole.treehole-tab-shuoshuo #publishCard,
  #pageTreehole.treehole-tab-square #feedPanel,
  #pageTreehole.treehole-tab-mine #feedPanel {
    border-radius: 16px !important;
    box-shadow: none !important;
  }

  .treehole-tab-lead { grid-column: 1 / -1; grid-row: 1; }
}

/* 我的倾诉预览 */
.confide-preview-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(61, 139, 122, 0.05);
  border: 1px solid var(--qq-border-light);
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--qq-text);
  cursor: pointer;
}
.confide-preview-item:hover { border-color: rgba(61, 139, 122, 0.25); }
.confide-preview-item time {
  display: block;
  font-size: 11px;
  color: var(--qq-text-sub);
  margin-top: 4px;
}
.confide-preview-empty {
  font-size: 13px;
  color: var(--qq-text-sub);
  text-align: center;
  padding: 16px 8px;
  line-height: 1.6;
}

/* 情绪标签统一 */
.emotion-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--qq-border-light);
}
.emotion-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(61, 139, 122, 0.08);
  border: 1px solid rgba(61, 139, 122, 0.14);
  color: var(--qq-text-sub);
}
.emotion-tag-pill:nth-child(1) { background: rgba(90, 154, 136, 0.1); border-color: rgba(90, 154, 136, 0.18); }
.emotion-tag-pill:nth-child(2) { background: rgba(61, 139, 122, 0.1); border-color: rgba(61, 139, 122, 0.18); }
.emotion-tag-pill:nth-child(3) { background: rgba(107, 138, 154, 0.1); border-color: rgba(107, 138, 154, 0.16); }
.emotion-tag-pill:nth-child(4) { background: rgba(201, 168, 74, 0.1); border-color: rgba(201, 168, 74, 0.2); }
.emotion-tag-pill:nth-child(5) { background: rgba(168, 196, 184, 0.12); border-color: rgba(168, 196, 184, 0.18); }
.emotion-tag-pill strong { color: var(--qq-primary); font-weight: 600; }

/* 广场搜索 */
.square-search-bar {
  align-items: center;
  gap: 10px;
  padding: 0 4px 12px;
}
.square-search-input {
  flex: 1;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--qq-border-light);
  border-radius: 12px;
  font-size: 14px;
  background: var(--qq-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7c74' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.1a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 12px center;
  outline: none;
}
.square-search-input:focus {
  border-color: var(--qq-primary);
  box-shadow: 0 0 0 3px rgba(61, 139, 122, 0.08);
}
.square-filter-label {
  font-size: 12px;
  color: var(--qq-text-sub);
  margin-bottom: 8px;
  font-weight: 600;
}

@media (max-width: 1023px) {
  #pageTreehole.treehole-tab-square .square-search-bar {
    display: flex;
  }
  #pageTreehole.treehole-tab-square .square-aside-rail {
    display: block;
    margin-bottom: 14px;
  }
  #pageTreehole.treehole-tab-square .square-aside-rail .category-tabs {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  #pageTreehole.treehole-tab-shuoshuo .confide-my-aside {
    display: none !important;
  }
}

/* 信息流卡片规整 */
@media (min-width: 1024px) {
  #pageTreehole.treehole-tab-square .post-card.paper-note,
  #pageTreehole.treehole-tab-mine .post-card.paper-note {
    margin: 14px 16px;
    border-radius: 14px;
    transform: none;
    padding: 18px 20px;
  }
  .qq-feed-hd {
    padding: 4px 4px 10px;
  }
  .qq-feed-title {
    font-size: 17px;
    font-weight: 600;
  }
}

/* —— 日签墙 · 时间线 —— */
.daily-wall-lead {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--qq-text-sub);
  line-height: 1.5;
}

@media (min-width: 1024px) {
  #panelDaily {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }
  #panelDaily .daily-inline-section {
    max-width: none;
    margin: 0 auto 14px;
    border-radius: 14px;
  }
  #panelDaily .qq-panel {
    padding: 14px 16px 16px;
    margin-bottom: 12px;
    border-radius: 14px !important;
  }
  #panelDaily .qq-feed-hd {
    padding: 0 0 8px;
  }
  #panelDaily .qq-feed-title {
    font-size: 15px;
  }
  #panelDaily .daily-wall-lead {
    font-size: 12px;
    margin-bottom: 10px;
  }
  #panelDaily .daily-wall-sort {
    justify-content: flex-start;
    margin-bottom: 14px;
    gap: 8px;
  }
  #panelDaily .daily-wall-sort button {
    padding: 6px 14px;
    font-size: 12px;
  }
  .daily-timeline-wrap {
    position: relative;
    max-width: none;
    margin: 0;
    padding: 4px 0 8px 24px;
  }
  .daily-timeline-wrap::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(61, 139, 122, 0.35), rgba(61, 139, 122, 0.08));
    border-radius: 1px;
  }
  .daily-timeline-wrap .daily-wall-item {
    position: relative;
    margin-bottom: 20px;
    border-radius: 14px;
    overflow: hidden;
  }
  .daily-timeline-wrap .daily-wall-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 22px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--qq-primary);
    border: 2px solid var(--qq-card);
    box-shadow: 0 0 0 2px rgba(61, 139, 122, 0.2);
    z-index: 1;
  }
  .daily-timeline-date {
    font-size: 12px;
    color: var(--qq-text-sub);
    margin-bottom: 6px;
    padding-left: 2px;
  }
}
