/* =============================================================
   COMPONENTS — 组件样式
   顺序：
     1. 左侧导航（展开态）
     2. 主内容区（Composer / Chip / Feed）
     3. 右侧栏（快捷看板 / 区块 / 链接行）
     4. 公共交互态（hover / focus-visible）
     5. 折叠 / 展开过渡动画
     6. 左侧导航（折叠态）
   ============================================================= */


/* ─────────────────────────────────────────────────────────────
   1. 左侧导航 — 展开态
   所有尺寸与间距严格对应设计稿标注
   ───────────────────────────────────────────────────────────── */

/* 侧边栏整体折叠按钮：16×16，margin: 20px 0 0 20px */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 20px 0 0 20px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

/* 分组容器："创建/管理" margin-top 16px，"加入的星球" margin-top 32px */
.nav-group {
  margin-top: 16px;
}

.nav-group--joined {
  margin-top: 32px;
}

/* 分组标题行：280×20，margin-left 20px，space-between 布局 */
.group-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 280px;
  height: 20px;
  margin: 0 0 0 20px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}

.group-toggle strong {
  font-size: 14px;
  font-family: PingFangSC-Semibold, "PingFang SC", sans-serif;
  font-weight: 600;
  color: rgba(15, 20, 25, 1);
  white-space: nowrap;
}

/* 星球列表：纵向排列，列表顶部 16px，相邻项间距 8px */
.planet-list {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
}

.planet-list .planet-item:not(:first-child) {
  margin-top: 8px;
}

/* 星球项基础：304×64，margin-left 8px，圆角 16px */
.planet-item {
  display: flex;
  align-items: center;
  width: 304px;
  height: 64px;
  margin-left: 8px;
  border-radius: 16px;
  color: rgba(15, 20, 25, 1);
  text-decoration: none;
  position: relative;
  flex-shrink: 0;
}

/* 当前激活星球：浅灰背景 */
.planet-item--active {
  background-color: rgba(245, 247, 250, 1);
}

/*
  加入的星球使用 position: relative，
  为其绝对定位的 .badge--abs 提供定位父级。
  （.planet-item 已有 position: relative，此类是语义标记，无额外样式）
*/
.planet-item--rel {
  position: relative;
}

/* 星球头像：40×40，圆角 10px，左对齐距左边 12px，顶部对齐距顶 12px */
.planet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
  margin: 12px 0 0 12px;
  align-self: flex-start;
}

/* 文字区：距顶 13px、距左 12px，flex-start 对齐，超长文本截断 */
.planet-meta {
  flex: 1;
  min-width: 0;
  margin: 13px 0 0 12px;
  align-self: flex-start;
}

.planet-name {
  display: block;
  font-size: 14px;
  font-family: PingFangSC-Semibold, "PingFang SC", sans-serif;
  font-weight: 600;
  color: rgba(15, 20, 25, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 20px;
}

.planet-sub {
  display: block;
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  font-weight: normal;
  color: rgba(153, 153, 153, 1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 17px;
  margin-top: 2px;
}

/* badge 单位数（1位数）：圆形 24×24 */
.badge--sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(26, 26, 26, 0.08);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(77, 77, 77, 1);
  flex-shrink: 0;
  margin: 20px 12px 0 auto;
  align-self: flex-start;
}

/* badge 双位数（2位数）：胶囊形 27×24 */
.badge--md {
  width: 27px;
  height: 24px;
  border-radius: 12px;
  border: 1px solid rgba(26, 26, 26, 0.08);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(77, 77, 77, 1);
  flex-shrink: 0;
  margin: 20px 12px 0 auto;
  align-self: flex-start;
}

/*
  加入的星球 badge：绝对定位于 .planet-item 右侧。
  left: 268px = 8px(item margin-left) + 260px(icon+meta 宽度)，top: 20px。
*/
.badge--abs {
  position: absolute;
  left: 268px;
  top: 20px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(26, 26, 26, 0.08);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(77, 77, 77, 1);
}


/* ─────────────────────────────────────────────────────────────
   2. 主内容区
   ───────────────────────────────────────────────────────────── */

/* 2-1. 星球标题行（在 planet-composer 面板内） */
.planet-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 20px 0;
}

/* 星球名称包裹为 button，去除所有原生样式 */
.planet-title-btn {
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.planet-title {
  margin: 0;
  font-size: 26px;
  font-family: PingFangSC-Semibold, "PingFang SC", sans-serif;
  font-weight: 600;
  color: rgba(15, 20, 25, 1);
  line-height: 37px;
}

.planet-info-btn {
  border: 0;
  background: transparent;
  color: var(--subtext);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* 星球资料弹框：position:fixed 突破 backdrop-filter 层叠上下文，位置由 JS 动态注入 */
.planet-info-popup {
  position: fixed;
  width: 420px;
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(15, 20, 25, 0.03);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(15, 20, 25, 0.12);
  z-index: 1000;
  padding: 24px;
}

.planet-info-popup[hidden] {
  display: none;
}

.planet-info-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* 标题：16px Medium，rgba(15,20,25,1)，行高22px */
.planet-info-popup-title {
  font-size: 16px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  color: rgba(15, 20, 25, 1);
  line-height: 22px;
}

.planet-info-popup-close {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* 正文：14px Regular，rgba(77,77,77,1)，行高22px */
.planet-info-popup-body {
  margin: 0;
  font-size: 14px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(77, 77, 77, 1);
  line-height: 22px;
}

/* 后台管理入口：右对齐，w=94 h=32 radius=8，源自蓝湖「编组备份10」 */
.planet-admin-btn {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 94px;
  height: 32px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(15, 20, 25, 0.08);
  border-radius: 8px;
  font-size: 13px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  color: rgba(51, 51, 51, 1);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.planet-admin-btn:hover {
  border-color: rgba(15, 20, 25, 0.16);
  color: rgba(15, 20, 25, 1);
}

/* 2-2. Composer（发帖框） */

/* 灰色容器：包裹输入区 + 工具栏，margin 20px 四周 */
.composer-box {
  margin: 20px;
  background: rgba(245, 247, 250, 1);
  border-radius: 16px;
  border: 1px solid rgba(15, 20, 25, 0.06);
}

.composer-top {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px 20px 0;
}

/* 通用圆形头像基础 */
.avatar {
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.avatar--lg {
  width: 40px;
  height: 40px;
}

.avatar--xl {
  width: 48px;
  height: 48px;
}

/* 发帖输入框伪按钮：点击后打开真实编辑器 */
.composer-input {
  flex: 1;
  height: 60px;
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(15, 20, 25, 0.08);
  border-radius: 16px;
  outline: none;
  padding: 0 16px;
  color: rgba(153, 153, 153, 1);
  font-size: 14px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  text-align: left;
  cursor: text;
}

/* 工具栏：左对齐，内部子按钮水平排列，缩进 84px 与头像右侧对齐 */
.composer-tools {
  display: flex;
  align-items: center;
  padding: 16px 20px 20px 84px;
  flex-wrap: nowrap;
}

/* 工具栏内竖向分隔线 */
.composer-divider {
  width: 1px;
  height: 12px;
  background: rgba(15, 20, 25, 0.08);
  margin: 0 10px;
  flex-shrink: 0;
}

/* 2-3. 主题筛选栏 */
.chip-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
}

.chip-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 筛选栏 chip：圆角边框胶囊样式（topic-chip 专用） */
.topic-chip {
  padding: 0 12px;
  height: 32px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(15, 20, 25, 0.08);
  color: rgba(51, 51, 51, 1);
  font-size: 15px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* 工具栏按钮（布置作业 / 写文章）：无边框，纯图标+文字 */
.tool-chip {
  padding: 0;
  height: 16px;
  border: 0;
  background: transparent;
  color: rgba(77, 77, 77, 1);
  font-size: 13px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 操作栏按钮（点赞 / 评论 / 收藏）：无边框，纯图标+文字 */
.action-pill {
  padding: 0;
  height: 20px;
  border: 0;
  background: transparent;
  color: rgba(153, 153, 153, 1);
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* 筛选项激活态：黑底白字 Semibold */
.topic-chip.active,
.topic-chip[aria-pressed="true"] {
  background: rgba(15, 20, 25, 1);
  color: rgba(255, 255, 255, 1);
  border-color: rgba(15, 20, 25, 1);
  font-weight: 600;
  font-family: PingFangSC-Semibold, "PingFang SC", sans-serif;
}

/* 发布打卡按钮：32×32 圆形背景 */
.chip-more-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(245, 245, 243, 1);
  border: 0;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 2-4. Feed 主题流 */
.feed {
  display: grid;
  gap: 16px;
}

.feed-card {
  padding: 24px 24px 16px;
}

/* 卡片头部：用户信息（左）+ 操作区（右） */
.feed-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.feed-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* 用户行：头像 + 姓名/时间 */
.user-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.user-text {
  display: flex;
  flex-direction: column;
}

.user-text strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 19px;
  font-family: PingFangSC-Semibold, "PingFang SC", sans-serif;
  font-weight: 600;
}

.user-text span {
  color: var(--subtext);
  font-size: 12px;
  line-height: 16px;
}

/* 星主/嘉宾等身份标签：高度固定 18px，宽度随文字自适应，radius=4 */
.user-text .user-label {
  display: inline-flex;
  align-items: center;
  width: auto;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid rgba(26, 26, 26, 0.08);
  color: rgba(253, 169, 86, 1);
  font-size: 12px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  line-height: 1;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
  white-space: nowrap;
}

/* AI 总结按钮：渐变背景胶囊 */
.ai-summary-btn {
  border: 0;
  padding: 0 8px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(270deg, rgba(235, 255, 252, 1) 0%, rgba(241, 247, 255, 1) 100%);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ai-summary-text {
  font-size: 10px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(15, 20, 25, 1);
  white-space: nowrap;
}

/* 更多操作按钮（三点菜单）：与 ai-summary-btn 同行，需 flex 居中保证图标不偏移 */
.feed-more-btn {
  border: 0;
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* 文章标题 */
.feed-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-family: PingFangSC-Medium, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 500;
  line-height: 28px;
}

.feed-card p,
.feed-card li {
  color: var(--text-muted);
  line-height: 24px;
  font-size: 14px;
  margin: 0 0 12px;
}

.feed-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

/* 话题标签列表 */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  background: rgba(65, 183, 140, 0.05);
  border: 1px solid rgba(65, 183, 140, 0.2);
  color: rgba(22, 185, 152, 1);
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  font-weight: 400;
}

/* 卡片内水平分隔线 */
.feed-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.05);
  margin: 12px 0 0;
}

/* 无标签时：p/ul 直接紧接 divider，消除 p 的 margin-bottom（防折叠），
   divider 独立承担全部 20px 间距 */
.feed-card p + .feed-divider,
.feed-card ul + .feed-divider {
  margin-top: 20px;
}

.feed-card p:has(+ .feed-divider) {
  margin-bottom: 0;
}

/* 操作栏：点赞、评论、收藏 */
.feed-footer {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* 收藏激活态：星形图标变橙色 */
.action-pill--active {
  color: rgba(246, 147, 62, 1);
}

/* 图文卡片：图片网格 */
.feed-media {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.feed-media-img {
  border-radius: 8px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

/* 单图：宽铺满，高 220px */
.feed-media--single .feed-media-img {
  width: 100%;
  height: 220px;
}

/* 双图：各占一半 */
.feed-media--double .feed-media-img {
  width: calc(50% - 3px);
  height: 160px;
}

/* 三图：等宽 */
.feed-media--triple .feed-media-img {
  width: calc(33.333% - 4px);
  height: 140px;
}


/* ─────────────────────────────────────────────────────────────
   3. 右侧栏
   ─────────────────────────────────────────────────────────────

   布局层次：
     rightbar（panel 容器）
       ├── rightbar-title      快捷看板标题
       ├── quick-grid          2×2 宫格
       ├── side-block          向他们提问（含成员列表）
       └── side-block--links   快捷链接（专栏 / 精华 / 文件）
   ───────────────────────────────────────────────────────────── */

/* 快捷看板大标题：margin-top 24px，左对齐 */
.rightbar-title {
  margin: 24px 0 0 20px;
  font-size: 15px;
  font-family: PingFangSC-Semibold, "PingFang SC", sans-serif;
  font-weight: 600;
  color: rgba(15, 20, 25, 1);
  line-height: 1;
}

/* 快捷看板：2×2 宫格，gap 6px，左右 padding 20px */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 16px 20px 0;
}

/*
  每张卡片：144×73px，填充色 rgba(247,249,251,1)，
  圆角 16px，padding 16px 12px 对齐标注。
  16(top) + 18(title) + 6(gap) + 17(sub) + 16(bottom) = 73px
*/
.quick-card {
  width: 144px;
  height: 73px;
  background: rgba(247, 249, 251, 1);
  border: 1px solid rgba(15, 20, 25, 0.06);
  border-radius: 16px;
  padding: 16px 12px;
  box-sizing: border-box;
}

/* 卡片标题：13px / Medium 500 / line-height 18px */
.quick-card strong {
  display: block;
  font-size: 13px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  color: rgba(51, 51, 51, 1);
  line-height: 18px;
  margin-bottom: 6px;
}

/* 卡片副文本：display:block 确保高度精确为 line-height 17px，不继承父级 line-height */
.quick-card span {
  display: block;
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(153, 153, 153, 1);
  line-height: 17px;
}

/* 通用区块容器（向他们提问、快捷链接） */
.side-block {
  margin: 24px 20px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(15, 20, 25, 0.06);
  border-radius: 16px;
}

/*
  区块头部：标题（左）+ 操作链接（右）。
  margin-bottom: 4px，加上 member-row 的 padding-top: 16px，
  合计 20px，对齐设计稿标注。
*/
.side-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

/* 区块内标题：15px / Semibold 600 */
.side-block-title {
  margin: 0;
  font-size: 15px;
  font-family: PingFangSC-Semibold, "PingFang SC", sans-serif;
  font-weight: 600;
  color: rgba(15, 20, 25, 1);
  line-height: 1;
}

/* "全部" / "查看" 蓝色链接按钮：13px / rgba(84,144,194,1) */
.side-block-more {
  border: 0;
  background: transparent;
  color: rgba(84, 144, 194, 1);
  font-size: 13px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 成员行：头像 + 姓名/简介 + 问按钮，上下 padding 各 16px */
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 0;
}

/*
  行内水平分隔线。
  向他们提问：rgba(0,0,0,0.05)
  快捷链接：rgba(15,20,25,0.04)（由父容器修饰符控制）
*/
.side-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.05);
}

/* 快捷链接区块内分隔线颜色更浅 */
.side-block--links .side-divider {
  background: rgba(15, 20, 25, 0.04);
}

/* 成员行左侧：头像 + 文字，超长文本截断 */
.member-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.member-left div {
  min-width: 0;
}

/* 迷你头像：40×40 圆形 */
.mini-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

/* 成员姓名：14px / Medium，超长截断 */
.member-left strong {
  display: block;
  font-size: 14px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  color: rgba(15, 20, 25, 1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 20px;
}

/* 成员简介：12px / rgba(153,153,153,1)，超长截断 */
.member-left span {
  display: block;
  font-size: 12px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(153, 153, 153, 1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 17px;
  margin-top: 2px;
}

/* 透明图标按钮（"问"按钮等），不影响行高 */
.link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

/* 快捷链接区块：左右 padding 16px，上下各 4px（+ 首/末行自身 padding-top/bottom 12px = 16px） */
.side-block--links {
  padding: 4px 16px;
}

/* 快捷链接行：上下 padding 12px */
.quick-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

/* 链接行主标题：15px / Medium 500 / rgba(15,20,25,1) */
.quick-link-text strong {
  display: block;
  font-size: 15px;
  font-family: PingFangSC-Medium, "PingFang SC", sans-serif;
  font-weight: 500;
  color: rgba(15, 20, 25, 1);
  line-height: 21px;
}

/* 链接行副文本：13px / rgba(153,153,153,1) */
.quick-link-text span {
  display: block;
  font-size: 13px;
  font-family: PingFangSC-Regular, "PingFang SC", sans-serif;
  color: rgba(153, 153, 153, 1);
  line-height: 18px;
  margin-top: 2px;
}


/* ─────────────────────────────────────────────────────────────
   4. 公共交互态 — hover / focus-visible
   ───────────────────────────────────────────────────────────── */

.topic-chip:hover,
.composer-input:hover {
  transform: translateY(-1px);
}

.tool-chip:hover,
.action-pill:hover,
.link-btn:hover {
  opacity: 0.7;
}

/* 统一移除 outline，焦点环已由 base.css 的 box-shadow 处理 */
.group-toggle:focus-visible,
.planet-item:focus-visible,
.tool-chip:focus-visible,
.topic-chip:focus-visible,
.action-pill:focus-visible,
.link-btn:focus-visible,
.composer-input:focus-visible {
  outline: none;
}

/* 分组折叠时隐藏列表（由 JS 切换 .collapsed 类） */
.collapsed .planet-list {
  display: none;
}


/* ─────────────────────────────────────────────────────────────
   5. 折叠 / 展开过渡动画
   transition 统一放在折叠态规则之前，确保任意状态下均生效
   ───────────────────────────────────────────────────────────── */

/* 头像：宽高、圆角、margin 均参与过渡（折叠时从 40px → 56px） */
.planet-avatar {
  transition: width 0.3s ease, height 0.3s ease,
              border-radius 0.3s ease, margin 0.3s ease;
}

/* 文字区、badge、分组标题：透明度 + 宽度渐变淡出 */
.planet-meta,
.badge--sm,
.badge--md,
.badge--abs,
.group-toggle {
  transition: opacity 0.2s ease, width 0.3s ease, margin 0.3s ease;
}

/* 星球项背景色切换（激活态 ↔ 透明） */
.planet-item {
  transition: background-color 0.2s ease;
}

/* Toggle 箭头旋转 */
.sidebar-toggle img {
  transition: transform 0.3s ease;
}

/* 分组折叠箭头：展开时朝上（^），折叠时朝下（v）*/
.group-toggle img {
  transition: transform 0.3s ease;
}
.group-toggle[aria-expanded="false"] img {
  transform: rotate(180deg);
}


/* ─────────────────────────────────────────────────────────────
   6. 左侧导航 — 折叠态
   覆盖规则的特异性说明：
   - 展开态 `.planet-list .planet-item:not(:first-child)` → 特异性 0,2,1
   - 折叠态使用 `.sidebar--collapsed .planet-list .planet-item:not(:first-child)` → 特异性 0,3,1
   - 确保折叠态间距 24px 能覆盖展开态的 8px
   ───────────────────────────────────────────────────────────── */

/* 折叠时隐藏横向溢出（头像缩进时防止出现水平滚动条） */
.sidebar--collapsed {
  overflow: hidden;
}

/* 折叠态移除所有分组间距（nav-group 的 16px / 32px margin-top） */
.sidebar--collapsed .nav-group,
.sidebar--collapsed .nav-group--joined {
  margin-top: 0;
}

/*
  折叠态隐藏：分组标题、文字区、各类 badge。
  ⚠️ 使用 opacity + height: 0 而非 display: none：
     - display: none 会切断 CSS transition，导致收起时无动画
     - height: 0 确保元素退出文档流垂直占位，使 planet-item 总高 = avatar 高度（56px）
     - 若缺 height: 0，planet-meta 和 badge 的隐形高度会导致头像间距不均匀
*/
.sidebar--collapsed .group-toggle,
.sidebar--collapsed .planet-meta,
.sidebar--collapsed .badge--sm,
.sidebar--collapsed .badge--md,
.sidebar--collapsed .badge--abs {
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  line-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* 折叠态星球列表：移除顶部间距（展开态 margin-top: 16px） */
.sidebar--collapsed .planet-list {
  margin-top: 0;
}

/*
  折叠态星球项：切换为 block 布局，清除展开态的 flex / 固定宽高。
  height: auto 使高度由内容（avatar 56px）决定，配合 height: 0 的子元素，
  保证每项总高精确为 56px。
*/
.sidebar--collapsed .planet-item {
  display: block;
  width: auto;
  height: auto;
  margin-left: 8px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.sidebar--collapsed .planet-item--active {
  background: transparent;
}

/* 第一个星球项：距 toggle 按钮 16px（与展开态 planet-list margin-top 保持一致） */
.sidebar--collapsed .planet-list .planet-item:first-child {
  margin-top: 16px;
}

/*
  第二分组（加入的星球）的第一个星球项：24px。
  特异性（0,4,1）> 上方 first-child 规则（0,3,1），确保能覆盖 16px。
  两个分组之间的视觉间距与组内各项保持一致。
*/
.sidebar--collapsed .nav-group--joined .planet-list .planet-item:first-child {
  margin-top: 24px;
}

/* 非第一项间距 24px（特异性 0,3,1，覆盖展开态 8px 规则） */
.sidebar--collapsed .planet-list .planet-item:not(:first-child) {
  margin-top: 24px;
}

/*
  折叠态头像：56×56，圆角 14px，左边距 12px（与展开态保持一致）。
  display: block 使 img 变为块级，margin-left 才能正常生效。
*/
.sidebar--collapsed .planet-avatar {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin: 0 0 0 12px;
  align-self: auto;
}

/*
  折叠态 toggle：位置与展开态完全相同（margin: 20px 0 0 20px），
  只通过 JS 旋转箭头图标方向，不改变位置。
*/
.sidebar--collapsed .sidebar-toggle {
  margin: 20px 0 0 20px;
  align-self: flex-start;
}
