:root {
  --blue: #1677ff;
  --blue-soft: #e8f2ff;
  --blue-line: #b9d8ff;
  --green: #15965b;
  --ink: #20242a;
  --text: #4f5866;
  --muted: #8c95a3;
  --line: #e9edf4;
  --panel: rgba(255, 255, 255, .9);
  --white: #fff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f8f9fb;
  color: var(--ink);
  line-height: 1.6;
}

/* 顶部导航栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #0060d7);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
}

.nav-tab {
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-tab:hover {
  background: #f5f5f5;
  color: var(--ink);
}

.nav-tab.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.search-wrapper {
  flex: 1;
  max-width: 500px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #f5f5f5;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.search-wrapper:focus-within {
  background: white;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.search-icon {
  font-size: 16px;
}

.search-wrapper input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: var(--ink);
}

.kbd {
  padding: 2px 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: #f5f5f5;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.user-badge:hover {
  background: #e8e8e8;
}

/* 布局 */
.layout {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 24px;
  min-height: calc(100vh - 60px);
}

/* 侧边栏 */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}

.platform-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.platform-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.platform-item:hover {
  background: #f5f5f5;
}

.platform-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.platform-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.platform-name {
  flex: 1;
}

.platform-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.platform-item.active .platform-count {
  color: var(--blue);
}

.sidebar-promo,
.sidebar-notice {
  padding: 16px;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--line);
  font-size: 13px;
}

.promo-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--ink);
}

.sidebar-promo p,
.sidebar-notice p {
  color: var(--text);
  line-height: 1.6;
}

/* 主内容区 */
.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
}

/* 筛选器 */
.filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-group {
  display: flex;
  gap: 12px;
}

.filter-label {
  flex-shrink: 0;
  width: 80px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding-top: 8px;
}

.filter-options {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--blue-line);
  background: var(--blue-soft);
}

.filter-btn.active {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
  font-weight: 600;
}

/* 结果栏 */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.results-count {
  font-size: 14px;
  color: var(--text);
}

.results-count strong {
  font-weight: 700;
  color: var(--ink);
}

.sort-tabs {
  display: flex;
  gap: 4px;
}

.sort-tab {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-tab:hover {
  background: #f5f5f5;
}

.sort-tab.active {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

/* 应用网格 */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  padding-bottom: 40px;
}

.app-card {
  display: block;
  padding: 20px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

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

.app-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.app-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #fff, #f8f9fb);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  color: var(--blue);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.app-icon .icon-fallback {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
}

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

.app-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.app-developer {
  font-size: 13px;
  color: var(--muted);
}

.app-badge {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.app-description {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.app-tag {
  padding: 4px 8px;
  border-radius: 4px;
  background: #f5f5f5;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.app-tag:first-child {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}

.app-platforms {
  display: flex;
  gap: 4px;
  font-size: 14px;
}

.app-link {
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
  white-space: nowrap;
}

/* 响应式 */
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 220px 1fr;
  }

  .apps-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar-left {
    gap: 16px;
  }

  .nav-tabs {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar-container {
    padding: 0 16px;
  }

  .search-wrapper {
    max-width: none;
  }

  .layout {
    padding: 16px;
  }

  .apps-grid {
    grid-template-columns: 1fr;
  }
}
