/* ============================================
   Material Design 风格 - 主样式表
   移动端优先设计
   ============================================ */

:root {
  --md-primary: #1976D2;
  --md-primary-dark: #1565C0;
  --md-primary-light: #42A5F5;
  --md-accent: #FF4081;
  --md-surface: #FFFFFF;
  --md-background: #F5F5F5;
  --md-on-primary: #FFFFFF;
  --md-on-surface: #212121;
  --md-on-surface-secondary: #757575;
  --md-divider: #E0E0E0;
  --md-shadow-1: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
  --md-shadow-2: 0 3px 6px rgba(0,0,0,.16), 0 3px 6px rgba(0,0,0,.23);
  --md-shadow-3: 0 10px 20px rgba(0,0,0,.19), 0 6px 6px rgba(0,0,0,.23);
  --md-radius: 8px;
  --md-radius-sm: 4px;
  --md-transition: all .3s cubic-bezier(.25,.8,.25,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans CJK SC', sans-serif;
  background: var(--md-background);
  color: var(--md-on-surface);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--md-primary); text-decoration: none; transition: var(--md-transition); }
a:hover { color: var(--md-primary-dark); }
img { max-width: 100%; height: auto; display: block; }

/* ---- 顶部导航栏 ---- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--md-primary);
  color: var(--md-on-primary);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: var(--md-shadow-2);
}

.app-bar-title {
  font-size: 1.125rem;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.app-bar-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px;
  border: none; background: none;
  color: #fff; cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: var(--md-transition);
}
.icon-btn:hover { background: rgba(255,255,255,.15); }

/* ---- 底部导航栏（移动端） ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--md-surface);
  display: flex;
  box-shadow: 0 -2px 8px rgba(0,0,0,.12);
  height: 56px;
}

.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  color: var(--md-on-surface-secondary);
  font-size: .625rem;
  cursor: pointer;
  transition: var(--md-transition);
  text-decoration: none;
  padding: 6px 0;
}
.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--md-primary);
}
.bottom-nav-item .material-icons { font-size: 22px; }
.bottom-nav-item span:last-child { font-size: .625rem; }

/* ---- 主内容区 ---- */
.main-content {
  padding-bottom: 72px; /* 留底部导航高度 */
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 12px;
}

/* ---- Card 卡片 ---- */
.card {
  background: var(--md-surface);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow-1);
  overflow: hidden;
  transition: var(--md-transition);
  margin-bottom: 12px;
}
.card:hover {
  box-shadow: var(--md-shadow-2);
  transform: translateY(-2px);
}

.card-media {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--md-primary-light), var(--md-primary));
}

.card-body { padding: 14px 16px; }

.card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--md-on-surface);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-text {
  font-size: .875rem;
  color: var(--md-on-surface-secondary);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: .75rem;
  color: var(--md-on-surface-secondary);
}
.card-meta .material-icons { font-size: 14px; vertical-align: middle; }

/* ---- 列表项（横向布局） ---- */
.list-item {
  background: var(--md-surface);
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-divider);
  transition: var(--md-transition);
  text-decoration: none;
  color: inherit;
  gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover, .list-item:active { background: rgba(25,118,210,.06); }
.list-item-thumb {
  width: 80px; height: 60px;
  border-radius: var(--md-radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--md-background);
}
.list-item-content { flex: 1; overflow: hidden; }
.list-item-title {
  font-size: .9375rem;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-item-meta {
  font-size: .75rem;
  color: var(--md-on-surface-secondary);
  margin-top: 4px;
}
.list-item-arrow {
  color: var(--md-on-surface-secondary);
  flex-shrink: 0;
  font-size: 16px;
}

/* ---- Emoji 图标样式 ---- */
.material-icons {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  text-align: center;
  line-height: 1.2;
  font-size: 1.2em;
}
.download-icon .material-icons,
.download-btn .material-icons {
  font-size: 24px;
  width: auto;
  height: auto;
}

/* ---- 分区标题 ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--md-on-surface);
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px; height: 18px;
  background: var(--md-primary);
  border-radius: 2px;
}
.section-more {
  font-size: .8125rem;
  color: var(--md-primary);
}

/* ---- Banner 轮播区 ---- */
.banner-wrap {
  position: relative;
  background: linear-gradient(135deg, var(--md-primary), var(--md-primary-dark));
  overflow: hidden;
  height: 200px;
}
.banner-bg {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .8;
}
.banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.5) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
}
.banner-title {
  color: #fff;
  font-size: 1.125rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ---- 标签/芯片 ---- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  background: rgba(25,118,210,.1);
  color: var(--md-primary);
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 500;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 36px;
  border-radius: 4px;
  border: none;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--md-transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--md-primary);
  color: #fff;
  box-shadow: var(--md-shadow-1);
}
.btn-primary:hover {
  background: var(--md-primary-dark);
  box-shadow: var(--md-shadow-2);
  color: #fff;
}
.btn-outline {
  background: transparent;
  color: var(--md-primary);
  border: 1px solid var(--md-primary);
}
.btn-outline:hover {
  background: rgba(25,118,210,.08);
  color: var(--md-primary);
}
.btn-block { width: 100%; }
.btn-fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--md-accent);
  color: #fff;
  box-shadow: var(--md-shadow-2);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--md-transition);
  position: fixed;
  right: 20px; bottom: 76px;
  z-index: 90;
}
.btn-fab:hover { box-shadow: var(--md-shadow-3); transform: scale(1.05); }

/* ---- 文章详情 ---- */
.article-header { padding: 16px; background: var(--md-surface); margin-bottom: 8px; }
.article-title { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
.article-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 10px;
  font-size: .8125rem; color: var(--md-on-surface-secondary);
  align-items: center;
}
.article-content {
  background: var(--md-surface);
  padding: 16px;
  font-size: .9375rem;
  line-height: 1.8;
  color: #333;
}
.article-content img { border-radius: var(--md-radius-sm); margin: 12px 0; }
.article-content p { margin-bottom: 1em; }
.article-content h2, .article-content h3 { margin: 1.2em 0 .6em; font-weight: 600; }
.article-content ul, .article-content ol { padding-left: 1.5em; margin-bottom: 1em; }
.article-content blockquote {
  border-left: 4px solid var(--md-primary);
  background: rgba(25,118,210,.06);
  padding: 8px 12px;
  margin: 12px 0;
  border-radius: 0 var(--md-radius-sm) var(--md-radius-sm) 0;
}

/* ---- 下载卡片 ---- */
.download-card {
  background: var(--md-surface);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow-1);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  transition: var(--md-transition);
}
.download-card:hover { box-shadow: var(--md-shadow-2); }
.download-icon {
  width: 48px; height: 48px;
  border-radius: var(--md-radius);
  background: linear-gradient(135deg, var(--md-primary-light), var(--md-primary));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.download-icon .material-icons { color: #fff; font-size: 26px; }
.download-info { flex: 1; overflow: hidden; }
.download-name {
  font-size: .9375rem;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.download-meta { font-size: .75rem; color: var(--md-on-surface-secondary); margin-top: 3px; }
.download-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--md-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--md-shadow-1);
  transition: var(--md-transition);
}
.download-btn:hover { background: var(--md-primary-dark); box-shadow: var(--md-shadow-2); color: #fff; }
.download-btn .material-icons { font-size: 20px; }

/* ---- 分页 ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 20px 16px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px; height: 36px;
  border-radius: var(--md-radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px;
  background: var(--md-surface);
  color: var(--md-on-surface);
  box-shadow: var(--md-shadow-1);
  font-size: .875rem;
  transition: var(--md-transition);
  text-decoration: none;
}
.page-btn.active {
  background: var(--md-primary);
  color: #fff;
}
.page-btn:hover:not(.active) {
  background: rgba(25,118,210,.1);
  color: var(--md-primary);
}

/* ---- 搜索框 ---- */
.search-bar {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.2);
  border-radius: 20px;
  padding: 0 12px;
  height: 36px;
  gap: 6px;
  flex: 1;
  max-width: 280px;
}
.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: .875rem;
  width: 100%;
}
.search-bar input::placeholder { color: rgba(255,255,255,.7); }
.search-bar .material-icons { color: rgba(255,255,255,.8); font-size: 18px; }

/* ---- 空状态 ---- */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--md-on-surface-secondary);
}
.empty-state .material-icons { font-size: 64px; opacity: .3; display: block; margin-bottom: 12px; }
.empty-state p { font-size: .9375rem; }

/* ---- Snackbar 通知 ---- */
#snackbar {
  position: fixed;
  bottom: 72px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: #fff;
  padding: 12px 20px;
  border-radius: 4px;
  font-size: .875rem;
  transition: transform .3s ease;
  z-index: 200;
  max-width: calc(100% - 32px);
  text-align: center;
  box-shadow: var(--md-shadow-2);
}
#snackbar.show { transform: translateX(-50%) translateY(0); }

/* ---- 加载动画 ---- */
.loading {
  display: flex;
  justify-content: center;
  padding: 32px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--md-divider);
  border-top-color: var(--md-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 响应式：平板以上显示网格 ---- */
@media (min-width: 600px) {
  .card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .card { margin-bottom: 0; }
  .card-media { height: 160px; }
  .bottom-nav { display: none; }
  .main-content { padding-bottom: 16px; }

  .app-bar { height: 64px; padding: 0 24px; }
  .app-bar-title { font-size: 1.25rem; }

  /* 桌面顶部导航 */
  .desktop-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 24px;
  }
  .desktop-nav a {
    color: rgba(255,255,255,.85);
    font-size: .9375rem;
    padding: 6px 14px;
    border-radius: 4px;
    transition: var(--md-transition);
  }
  .desktop-nav a:hover,
  .desktop-nav a.active {
    background: rgba(255,255,255,.15);
    color: #fff;
  }
}

@media (min-width: 960px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .container { padding: 0 24px; }
}

/* 移动端隐藏桌面导航 */
.desktop-nav { display: none; }
@media (min-width: 600px) { .desktop-nav { display: flex; } }
