/* 漫圈 feed / post / search (htmltibiu416/community/{index,post,search}.html).
 * Phone: one white full-bleed column, sticky tab bar, round compose button.
 * Wide (>= 1000px): 600px timeline between hairlines + 340px sticky rail (search, 热议, 推荐关注). */

body.cm-body { background: var(--tb-surface) !important; }
.cm { --cm-main: 600px; --cm-rail: 340px; color: var(--tb-ink); }
.cm-layout { display: flex; justify-content: center; gap: 28px; margin: 0 auto; }
.cm-main { flex: 0 1 var(--cm-main); min-width: 0; min-height: calc(100vh - 64px); padding-bottom: 96px; }
.cm-rail { display: none; }
.cm [hidden] { display: none !important; }
.cm-pad { padding: 12px var(--tb-gutter); }
.cm-center { margin: -24px 0 0; padding-bottom: 32px; text-align: center; }

/* ---------- Sticky bar: tabs (feed), search field + tabs (search) ---------- */
.cm-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--tb-divider);
  background: rgb(255 255 255 / 92%);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}
.cm-tabs { display: grid; flex: 1 1 auto; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 0; }
.cm-tabs > .tb-tab { justify-content: center; height: 50px; font-size: 15px; }
@media (hover: hover) { .cm-tabs > .tb-tab:hover { background: var(--tb-press); } }
.cm-bar__search { margin-right: 4px; }
.cm-bar--search { flex-direction: column; align-items: stretch; }
.cm-searchbar { display: flex; align-items: center; gap: 4px; padding: 6px var(--tb-gutter) 2px 4px; }
.cm-searchbar__form { flex: 1 1 auto; }

.cm-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px var(--tb-gutter);
  border-bottom: 1px solid var(--tb-divider);
  font-size: 14px;
}
.cm-scope__title { min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cm-scope__all { flex: none; color: var(--tb-primary); text-decoration: none; }

/* Wide screens: inline "有什么新鲜事？" row; phones use the round button instead. */
.cm-compose { display: none; }
.cm-fab {
  position: fixed;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tb-btn-primary);
  color: #fff;
  box-shadow: 0 6px 16px rgb(0 0 0 / 18%);
  -webkit-tap-highlight-color: transparent;
}
.cm-fab ti-icon { --ti-icon-size: 26px !important; width: 26px; height: 26px; }
.cm-fab:active { transform: scale(.96); }

/* ---------- Feed ---------- */
.cm-feed > :is(.tbs-post, .tbs-user, .cm-trend) + :is(.tbs-post, .tbs-user, .cm-trend) { border-top: 1px solid var(--tb-divider); }
.cm-feed > :is(.tbs-post, .tbs-user, .cm-trend):last-of-type { border-bottom: 1px solid var(--tb-divider); }
.cm-more {
  display: block;
  width: 100%;
  height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--tb-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.cm-more[aria-busy="true"] { font-size: 0; }
.cm-more[aria-busy="true"]::before { content: "加载中…"; font-size: 13px; }

/* ---------- Post page ---------- */
.cm-topbar .tb-topbar__inner { width: auto; margin: 0; padding: 0 var(--tb-gutter); }
.cm-topbar .tb-topbar__title { font-weight: 700; }
.cm-post { min-height: 120px; }
.cm-replies { border-top: 1px solid var(--tb-divider); }
.cm-detail-skeleton { padding-top: 4px; }

/* ---------- Rail ---------- */
.cm-card { margin-top: 16px; overflow: hidden; border: 1px solid var(--tb-divider); border-radius: 16px; }
.cm-card__title { margin: 0; padding: 12px var(--tb-gutter) 6px; font-size: 18px; font-weight: 700; line-height: 1.4; }
.cm-card__empty { margin: 0; padding: 12px var(--tb-gutter) 16px; color: var(--tb-muted); font-size: 14px; }
.cm-card .tbs-user { background: transparent; }
.cm-card > div > :last-child { margin-bottom: 4px; }
.cm-trend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--tb-gutter);
  color: var(--tb-ink);
  text-decoration: none;
}
@media (hover: hover) { .cm-trend:hover { background: #fafafa; } }
.cm-trend__rank { flex: none; width: 18px; color: var(--tb-muted); font-size: 14px; font-variant-numeric: tabular-nums; text-align: center; }
.cm-trend__icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tb-fill);
  color: var(--tb-ink-2);
}
.cm-trend__icon ti-icon { --ti-icon-size: 20px !important; width: 20px; height: 20px; }
.cm-trend__body { display: grid; gap: 1px; min-width: 0; }
.cm-trend__name { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.cm-trend__meta { color: var(--tb-muted); font-size: 13px; }

@media (min-width: 761px) {
  .cm-compose {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px var(--tb-gutter);
    border-bottom: 1px solid var(--tb-divider);
    color: var(--tb-muted);
    text-decoration: none;
  }
  .cm-compose > .tb-avatar { --tb-avatar: 40px; }
  .cm-compose__text { flex: 1 1 auto; font-size: 18px; }
  .cm-fab { display: none; }
  .cm-bar__search { display: none; }
}

@media (min-width: 1000px) {
  .cm-main { border-right: 1px solid var(--tb-divider); border-left: 1px solid var(--tb-divider); }
  .cm-rail {
    position: sticky;
    top: 0;
    display: block;
    flex: 0 0 var(--cm-rail);
    align-self: flex-start;
    max-height: 100vh;
    padding: 8px 0 24px;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .cm-rail::-webkit-scrollbar { display: none; }
  .cm-rail__search { height: 44px; }
}
