/* ============================================
   应用坞 - 页面布局（三栏 + 导航 + 页脚）
   ============================================ */

/* ========== 星空背景橙白头部 ========== */
/* //【头部样式新增】星空粒子背景+橙色搜索+6标签 */
.starry-header {
  position: relative;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  overflow: hidden;
  padding: 32px 0 28px;
  min-height: 320px;
}
.starry-canvas {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.starry-header-inner {
  position: relative; z-index: 1;
  max-width: 900px; margin: 0 auto;
  display: flex; flex-direction: column;
  align-items: center; gap: 20px;
  padding: 0 28px;
}
.starry-title {
  font-size: 36px; font-weight: 700;
  color: #FFFFFF; letter-spacing: 2px;
  text-shadow: 0 2px 12px rgba(255,107,53,0.3);
}
/* //【分类标签样式】选中下划线 + 各类别快捷标签排版，对标截图尺寸间距 */
.starry-nav {
  display: flex; align-items: center; gap: 6px;
  background: transparent;
  padding: 0;
}
.starry-nav-item {
  position: relative;
  padding: 10px 22px; border-radius: 0;
  font-size: 15px; font-weight: 500;
  color: rgba(255,255,255,0.6);
  transition: all 0.2s ease;
  background: transparent;
}
.starry-nav-item:hover { color: #fff; background: transparent; }
/* //【修复】选中态仅显示橙色底部短下划线，去除圆角背景 */
.starry-nav-item.active {
  color: #fff; font-weight: 600;
  background: transparent;
}
.starry-nav-item.active::after {
  content: ''; position: absolute;
  bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 2px;
  background: #FF6B35;
}
/* 搜索框 */
.starry-search-wrap {
  display: flex; align-items: center;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,107,53,0.4);
  border-radius: 30px; padding: 0 6px 0 24px;
  height: 52px; width: 620px; max-width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.starry-search-wrap:focus-within {
  border-color: #FF6B35;
  box-shadow: 0 0 0 4px rgba(255,107,53,0.15);
}
.starry-search-input {
  flex: 1; background: transparent; height: 100%;
  color: #fff; font-size: 16px;
}
.starry-search-input::placeholder { color: rgba(255,255,255,0.45); }
.starry-search-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #FF6B35, #FF8C42);
  color: #fff; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
  transition: all 0.2s ease;
}
.starry-search-btn:hover { filter: brightness(1.1); transform: scale(1.04); }
/* //【分类标签样式】切换分类时JS动态渲染的搜索快捷标签 */
.search-quick-tags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
/* 小圆角标签行 */
.quick-tags-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.quick-tag-btn {
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 13px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}
.quick-tag-btn:hover {
  background: rgba(255,107,53,0.18);
  color: #FF8C42;
}
/* 大方块快捷按钮行（社区/购物分类专属） */
.quick-blocks-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.quick-block-btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.06);
}
.quick-block-btn:hover {
  background: rgba(255,107,53,0.15);
  border-color: rgba(255,107,53,0.3);
  color: #FF8C42;
}

/* ========== 主体三栏 ========== */
.main-body {
  padding: 24px 28px;
  background: var(--bg-body);
}

.main-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
}

/* 左侧导航 */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 128px; /* //顶部导航栏44px + 原84px */
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.sidebar-panel {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 10px 8px;
  margin-bottom: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.sidebar-item:hover {
  background: var(--border-light);
}

.sidebar-item.active {
  background: var(--brand-soft-bg, #EEF4FE);
  color: var(--accent-orange);
  border: 1px solid var(--accent-orange);
}
/* //【树形侧边栏样式】一二层级区分、展开折叠箭头样式 */
.sidebar-parent {
  cursor: pointer;
  user-select: none;
}
.sidebar-arrow {
  display: inline-block;
  width: 14px;
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.sidebar-arrow.open {
  transform: rotate(90deg);
  color: var(--accent-orange);
}
.sidebar-children {
  padding-left: 12px;
  margin: 2px 0 4px;
  border-left: 2px solid var(--border-light);
}
.sidebar-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.sidebar-child:hover {
  background: var(--border-light);
  color: var(--accent-orange);
}
.sidebar-child.active {
  background: var(--brand-soft-bg, #EEF4FE);
  color: var(--accent-orange);
  font-weight: 600;
}
/* //【空置分类置灰样式】无软件数据的子分类灰色禁用 */
.sidebar-child-empty {
  color: var(--text-tertiary);
  cursor: default;
  pointer-events: none;
}
.sidebar-child-empty:hover {
  background: none;
  color: var(--text-tertiary);
}
.sidebar-child-count {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--border-light);
  padding: 1px 6px;
  border-radius: 10px;
}
.sidebar-child-empty .sidebar-child-count {
  opacity: 0.5;
}
/* //【侧边栏样式新增】汉堡按钮 */
.sidebar-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  margin-bottom: 12px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.sidebar-toggle-btn:hover { border-color: var(--accent-orange); color: var(--accent-orange); }
/* 侧边栏折叠态 */
.sidebar.collapsed { display: none; }
/* 小屏下始终显示汉堡按钮，侧边栏默认隐藏 */
@media (max-width: 1199px) {
  .sidebar-toggle-btn { display: flex; }
  .sidebar:not(.show) { display: none; }
  .sidebar.show { display: block; width: 100%; }
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* //【布局修复新增】中间内容区：三栏弹性布局隔离 + 宽度约束 + 溢出拦截，杜绝卡片穿透右侧栏 */
.main-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* 右侧栏 */
.rail {
  width: 300px;
  flex-shrink: 0;
}

/* //【首页隐藏右侧栏】仅 body.no-rail 时隐藏右侧信息栏，下载页不受影响 */
body.no-rail .rail {
  display: none;
}

/* ========== 分类板块 ========== */
/* //【布局修复新增】分类板块容器隔离 + 溢出隐藏，确保所有板块统一不越界 */
.category-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.category-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 20px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-orange), var(--accent-orange-light));
}

.category-count {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* 子分类标签 */
/* //【修复二级分类默认灰色】正常标签可点击样式，取消全局灰色 */
.subcat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.subcat-tag {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-body);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.subcat-tag:hover {
  background: #e4e9f0;
  border-color: var(--border-color);
}

.subcat-tag.active {
  background: var(--accent-orange);
  color: #fff;
  border-color: var(--accent-orange);
}

/* //【空置分类置灰样式】仅无软件数据的二级分类灰色禁用 */
.subcat-empty {
  color: var(--text-tertiary) !important;
  background: var(--border-light) !important;
  cursor: default;
  pointer-events: none;
}
.subcat-empty:hover {
  background: var(--border-light) !important;
  border-color: transparent !important;
  color: var(--text-tertiary) !important;
}

/* //【修复暗色模式二级分类标签hover白底】硬编码 #e4e9f0 在暗色下近乎纯白，替换为半透明深灰底+高对比文字 */
[data-theme="dark"] .subcat-tag:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: #fff;
}
/* 暗色下选中态不变 — 保持蓝色底白色字 */
[data-theme="dark"] .subcat-empty:hover {
  background: var(--border-light) !important;
  border-color: transparent !important;
}

/* //【软件卡片UI改版】对标截图：方形白底圆角卡片，左圆形图标+右双层文字，文字按需截断 */
/* //【修复单卡占满整行】固定5列均分，minmax防塌缩，overflow:hidden防撑开 */
.software-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.sw-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.sw-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--accent-orange);
}

/* 圆形白底图标容器 */
.sw-card-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex; align-items: center;
  justify-content: center; overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sw-card-icon img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%;
}

/* 图标占位（无图片时）：圆形白底 + 灰色文字首字 */
.sw-card-icon-text {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex; align-items: center;
  justify-content: center;
  color: #999; font-size: 18px; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sw-card-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  gap: 4px;
}

/* 粗体主标题：单行截断省略号 */
.sw-card-name {
  font-size: 14px; font-weight: 700;
  color: #222;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

/* 浅灰色副标题小字：单行截断省略号 */
.sw-card-desc {
  font-size: 12px; color: #AAAAAA;
  line-height: 1.4;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

/* 暗色主题适配 */
[data-theme="dark"] .sw-card-name {
  color: #E0E0E0;
}
[data-theme="dark"] .sw-card-desc {
  color: #777;
}
[data-theme="dark"] .sw-card-icon {
  background: #2A2A2E;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
[data-theme="dark"] .sw-card-icon-text {
  background: #2A2A2E;
  color: #777;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* 空状态 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ========== 右侧模块 ========== */
.rail-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.rail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.rail-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rail-card-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-orange), var(--accent-orange-light));
}

.rail-card-more {
  font-size: 12px;
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}
.rail-card-more:hover { color: var(--accent-orange); }

/* 排行项 */
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.rank-item:hover { background: var(--border-light); }

.rank-num {
  width: 24px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.rank-num.top1 { color: #F5A623; }
.rank-num.top2 { color: #8B94A3; }
.rank-num.top3 { color: #C0825A; }

.rank-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.rank-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.rank-info {
  flex: 1; min-width: 0;
}

.rank-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.rank-stat {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* 更新项 */
.update-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.update-item:hover { background: var(--border-light); }

.update-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.update-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.update-info {
  flex: 1; min-width: 0;
}

.update-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.update-date {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.update-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.update-badge.new {
  background: #E8F8F0;
  color: #10B981;
}

.update-badge.updated {
  background: #EEF4FE;
  color: var(--accent-orange);
}

/* //【使用帮助FAQ样式新增】右侧栏静态帮助模块 */
.help-faq {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.help-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.help-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.help-q {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.help-a {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.help-a code {
  background: var(--border-light);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent-orange);
  font-family: monospace;
}

/* ========== 页脚 ========== */
.site-footer {
  background: #1a1f2e;
  padding: 40px 32px 20px;
  color: var(--text-secondary);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
}

.footer-columns {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 28px;
}

.footer-info p {
  font-size: 13px;
  line-height: 1.7;
  color: #8D97A8;
  margin-top: 10px;
}

.footer-logo {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.footer-col-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: #8D97A8;
  padding: 4px 0;
  transition: color var(--transition-fast);
}

.footer-col a:hover { color: #fff; }

.footer-divider {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 16px;
  font-size: 12px;
  color: #6B7688;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================
   响应式
   ============================================ */

/* 768-1199px */
@media (max-width: 1199px) {
  .software-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main-inner { flex-wrap: wrap; }
  .rail { width: 100%; display: flex; gap: 20px; }
  .rail-card { flex: 1; }
}

/* <768px */
@media (max-width: 767px) {
  .starry-nav { gap: 2px; padding: 3px; }
  .starry-nav-item { padding: 7px 12px; font-size: 12px; }
  .sidebar-toggle-btn { display: flex; }
  .sidebar { display: none; }
  .sidebar.show { display: block; width: 100%; }
  .sidebar-panel {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .sidebar-item {
    padding: 8px 14px;
    font-size: 13px;
  }
  .main-inner { flex-direction: column; }
  .software-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail { flex-direction: column; }
  .footer-columns { grid-template-columns: 1fr 1fr; }
}

/* <480px */
@media (max-width: 479px) {
  .software-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-columns { grid-template-columns: 1fr; }
  .starry-header-inner { padding: 0 14px; }
  .main-body { padding: 16px 10px; }
}

/* //【修复暗色模式二级分类hover文字消失】暗色背景下改用半透明浅色底 + 高对比文字 */
[data-theme="dark"] .sidebar-child:hover {
  background: rgba(255,255,255,0.08);
  color: #69B1FF;
}
[data-theme="dark"] .sidebar-child.active {
  background: rgba(64,150,255,0.15);
  color: #69B1FF;
}
