/* ===== 公共样式：基础重置 / 导航栏 / 通用按钮 ===== */

/* 基础重置（各页面行高在自身 style 中单独声明） */
* {
  margin: 0;
  padding: 0;
  outline: none;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: #fafafa;
  line-height: 1.5;
  color: #333;
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

.flex-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 导航栏（吸顶，统一 64px 高度，内容区最大 1366px 并与正文居中对齐） */
.navbar-wrap {
  text-align: center;
  background-color: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar {
  display: flex;
  max-width: 1366px;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  margin: 0 auto;
}

.logo {
  font-size: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-img {
  height: 64px;
  float: left;
}

/* 右下角悬浮操作：私信 + 回到顶部 */
.floating-actions {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.float-action {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid #e3e3e3;
  border-radius: 50%;
  background: #fff;
  color: #555;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.float-action:hover {
  border-color: #bbb;
  background: #fafafa;
  color: #111;
}

.float-message {
  color: #4f46e5;
}

.float-message-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  line-height: 1;
  pointer-events: none;
}

.float-back-top {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.float-back-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}


/* 通用按钮（导航区胶囊样式，表单类页面可自行覆盖） */
.btn {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  border: none;
}

.btn-primary {
  background-color: #000;
  color: #fff;
}

/* ===== 多页共用组件：导航链接 / 页面标题区 / 页签 / 应用卡片 ===== */

/* 导航链接 */
.nav-left {
  display: flex;
  align-items: center;
  gap: 40px;
}

.nav-links {
  display: flex;
  gap: 24px;
  font-size: 16px;
  color: #555;
}

.nav-links a.active {
  color: #000;
  font-weight: 600;
  position: relative;
}

.nav-links a.active::after {
  content: '';
  width: 100%;
  height: 2px;
  background-color: #000;
  position: absolute;
  bottom: -5px;
  left: 0;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 导航栏右侧按钮统一高度 */
.nav-right .btn {
  height: 36px;
  padding: 0 16px;
}

/* 导航栏登录入口（描边胶囊，与发布按钮等高，不填充背景） */
.nav-auth {
  font-size: 14px;
  color: #555;
}

.nav-auth:hover {
  color: #000;
}

.nav-right .nav-auth {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: transparent;
  transition: all 0.2s;
}

.nav-right .nav-auth:hover {
  border-color: #000;
}

/* 页面标题区 */
.hero {
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.hero p {
  font-size: 14px;
  color: #666;
  display: inline-block;
}

/* 类型页签 */
.tabs {
  display: flex;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  border: 1px solid #eee;
}

.tab {
  padding: 6px 16px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
}

.tab.active {
  background-color: #f0f0f0;
  color: #000;
  font-weight: 500;
}

/* 应用卡片网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 15px;
}

.card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.bg-blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.bg-green {
  background: linear-gradient(135deg, #10b981, #059669);
}

.bg-purple {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.card-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

.verified-icon {
  color: #3b82f6;
  display: inline-flex;
}

.card-tags {
  display: flex;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f4ff;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid #e0e7ff;
}

.card-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: #888;
  border-top: 1px solid #f9f9f9;
  padding-top: 12px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 开发者主页链接：高亮色显示，悬停加深并下划线 */
.dev-link {
  color: #3b82f6;
  text-decoration: none;
}

/* 卡片底部的图标：与文字垂直居中 */
.dev-link svg,
.stat svg {
  flex: none;
}

.dev-link svg {
  vertical-align: -2px;
  margin-right: 4px;
}

.dev-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* 移动端底部 Tabbar（由 common.js 注入，桌面端不显示） */
.mobile-tabbar {
  display: none;
}

/* 移动端底部有 tabbar，悬浮操作上移避免被遮挡 */
@media (max-width: 768px) {
  .floating-actions {
    right: 16px;
    bottom: calc(62px + env(safe-area-inset-bottom, 0px) + 16px);
  }
}

/* 多页通用的移动端适配 */
@media (max-width: 768px) {
  .navbar {
    height: 60px;
  }

  .nav-left {
    gap: 0;
  }

  .nav-links {
    display: none;
  }

  .logo {
    font-size: 18px;
  }

  .nav-right {
    gap: 8px;
  }

  .nav-right .btn {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .nav-right .nav-auth {
    display: none;
  }

  .hero h1 {
    font-size: 24px;
  }

  .hero p {
    font-size: 13px;
    margin-top: 8px;
    display: block;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* 为固定底栏预留空间，并兼容 iPhone 底部安全区 */
  .has-mobile-tabbar {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e8e8e8;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .mobile-tabbar a {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 10px;
    color: #888;
    font-size: 11px;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tabbar a.active {
    color: #4f46e5;
    font-weight: 500;
  }

  .mobile-tabbar a.active svg {
    stroke-width: 2.2;
  }

  .mobile-tabbar a:active {
    background: #f5f5f5;
  }
}

@media (max-width: 380px) {
  .navbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .nav-right .btn {
    padding: 0 10px;
    font-size: 12px;
  }
}

/* 全局页脚：备案信息 + 版权声明 */
.site-footer {
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}
.site-footer-inner {
  max-width: 1366px;
  margin: 0 auto;
  padding: 16px 20px;
  text-align: center;
  font-size: 13px;
  color: #999;
  line-height: 1.8;
}
.site-footer-links a {
  color: #999;
  text-decoration: none;
}
.site-footer-links a:hover {
  color: #4f46e5;
}
.site-footer-sep {
  margin: 0 10px;
  color: #ddd;
}
/* 移动端：固定底栏会遮挡页脚，预留底部空间并兼容安全区 */
@media (max-width: 768px) {
  .site-footer-inner {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
}