* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Microsoft YaHei', sans-serif;
}

a {
  text-decoration: none;
}

body {
  background-color: #f5f5f5;
  color: #333;
}

/* 标题栏样式 */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 20px;
  background-color: #2c3e50;
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 20;
}

.logo {
  font-size: 22px;
  font-weight: bold;
  flex: 0 0 auto;
}

.logo a {
  text-decoration: none;
  color: white;
}

/* 搜索栏 — flex item, never absolute overlay */
.search-container {
  position: static;
  flex: 1 1 200px;
  min-width: 140px;
  max-width: 420px;
  z-index: auto;
}

.search-box {
  display: flex;
  width: 100%;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 20px 0 0 20px;
  outline: none;
  font-size: 14px;
}

.search-btn {
  padding: 10px 16px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 0 20px 20px 0;
  cursor: pointer;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.search-btn:hover {
  background-color: #2980b9;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.nav-btn {
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none !important;
  font-size: 14px;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s;
}

.nav-btn.nav-cat {
  /* fallback; per-category overrides below */
  background-color: #d6eaf8;
  color: #1a5276;
}

.nav-btn.nav-anime {
  background-color: #d6eaf8;
  color: #1a5276;
}

.nav-btn.nav-comic {
  background-color: #f5d0e6;
  color: #6c3483;
}

.nav-btn.nav-game {
  background-color: #d5f5e3;
  color: #196f3d;
}

.nav-btn.nav-video {
  background-color: #fdebd0;
  color: #9a7d0a;
}

.nav-btn.nav-cat:hover,
.nav-btn.nav-cat.active {
  filter: brightness(0.92);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.nav-btn.nav-user {
  background-color: #58d68d;
  color: #145a32;
}

.nav-btn.nav-user:hover {
  background-color: #28b463;
  color: #fff;
}

.nav-btn.nav-recharge {
  background-color: #e74c3c;
  color: #fff;
}

.nav-btn.nav-recharge:hover,
.nav-btn.nav-recharge:focus-visible {
  background-color: #c0392b;
  color: #fff;
}

/* legacy class kept for any leftover markup */
.category {
  padding: 8px 15px;
  background-color: #5dade2;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}

/* 主要内容区域 */
.main-content {
  display: flex;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 20px auto;
  gap: 20px;
}

/* 左侧内容区 */
.left-content {
  flex: 2 1 0;
  min-width: 0;
  order: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.right-content.tag-sidebar {
  flex: 1 1 240px;
  order: 3;
  min-width: 0;
}

.content-item {
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
  cursor: pointer;
  position: relative;
}

.content-item:hover {
  transform: translateY(-5px);
}

.item-image {
  height: 180px;
  background-color: #ecf0f1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.item-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.play-badge::after {
  content: '';
  position: absolute;
  left: 55%;
  top: 50%;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #fff;
  transform: translate(-40%, -50%);
}

.content-item:hover .play-badge {
  background: rgba(0, 0, 0, 0.7);
}

.item-text {
  height: 120px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.item-title {
  font-weight: bold;
  margin-bottom: 8px;
}

.item-description {
  color: #7f8c8d;
  font-size: 14px;
  line-height: 1.4;
}

/* 右侧内容区 */
.right-content {
  flex: 1;
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.daily-updates-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.update-list {
  list-style: none;
}

.update-item {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.update-item:last-child {
  border-bottom: none;
}

.update-content {
  margin-bottom: 5px;
}

.update-time {
  font-size: 12px;
  color: #95a5a6;
}

.page-btn:hover {
  background-color: #2980b9;
}

.page-btn:hover:not(.active) {
  background-color: #03497b;
}

.page-dots {
  padding: 5px;
}

.loading {
  text-align: center;
  padding: 20px;
  display: none;
}

.page-btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

/* 资源详情页样式补充 */
.resource-container {
  max-width: 1000px;
  margin: 30px auto;
  padding: 20px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 资源元信息样式 */
.resource-meta {
    margin: 10px 0;
    color: #666;
    font-size: 0.9em;
}

/* 资源描述样式 */
.resource-description {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.resource-description h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.resource-description p {
    margin-bottom: 0;
    line-height: 1.6;
}

.image-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* 2列布局 */
  gap: 15px;
  margin: 20px 0;
}

.image-gallery img {
  width: 100%;
  height: auto;
  /* 图片自适应 */
  object-fit: contain;
  border-radius: 6px;
  background: #f5f5f5;
}

.back-button {
  display: inline-block;
  width: auto;
  min-width: 120px;
  margin: 20px 0;
  padding: 12px 22px;
  background: #2c3e50;
  color: #ffffff !important;
  text-align: center;
  border-radius: 6px;
  text-decoration: none !important;
  font-weight: 600;
}

.back-button:hover {
  background: #1a252f;
  color: #ffffff !important;
}


.locked-content {
  background: #f5f5f5;
  padding: 20px;
  text-align: center;
  border-radius: 5px;
}

.btn-purchase {
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: white;
  margin: 15% auto;
  padding: 20px;
  width: 300px;
  border-radius: 5px;
}

.close {
  float: right;
  cursor: pointer;
}

.btn-confirm {
  padding: 8px 16px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.resource-content {
  padding: 20px;
  line-height: 1.6;
  font-size: 16px;
}

.resource-title {
  font-size: 24px;
  margin-bottom: 15px;
  color: #2c3e50;
}

/* 活跃分类样式 */
.category.active {
  background-color: #2c3e50;
}

/* 新增搜索相关样式 */
.search-results h2 {
  padding: 20px 0;
  border-bottom: 1px solid #eee;
  color: #2c3e50;
}

/* 搜索页专属样式 */
.search-header {
  grid-column: 1 / -1;
  padding: 20px 0;
  border-bottom: 1px solid #eee;
}

.search-header h2 {
  color: #2c3e50;
  margin-bottom: 5px;
}

.search-header p {
  color: #7f8c8d;
  font-size: 14px;
}

.item-category {
  display: inline-block;
  padding: 2px 8px;
  background: #ecf0f1;
  border-radius: 4px;
  font-size: 12px;
  color: #3498db;
}

.search-sidebar {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
}

/* 排序按钮样式 */
.sort-options {
  text-align: center;
  margin: 20px 0;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 翻页样式 */
.pagination-container {
  display: flex;
  justify-content: space-between;
  margin: 20px 200px;
  align-items: center;
}

.pagination {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  gap: 10px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-block;
  padding: 8px 15px;
  background-color: #3498db;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
  text-decoration: none;
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
}


.sort-btn {
  display: inline-block;
  padding: 10px 16px;
  margin: 0 5px;
  background: #ecf0f1;
  color: #333;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s;
  border: 1px solid #e1e1e1;
}

.sort-btn:hover {
  background-color: #f0f0f0;
}

.sort-btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.username {
  margin-right: 8px;
}

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

/* 下拉菜单样式 */
.dropdown-menu {
  display: none;
  position: absolute;
  background: white;
  min-width: 120px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
  border-radius: 4px;
  right: 20px;
  top: 60px;
}

.dropdown-menu a {
  display: block;
  padding: 10px 15px;
  color: #333;
  text-decoration: none;
}

.dropdown-menu a:hover {
  background: #f5f5f5;
}

#authDropdown:hover + #authMenu,
#authMenu:hover {
  display: block;
}

/* 目录样式 */
.directory-title {
    font-size: 20px;
    font-weight: bold;
    padding: 15px 20px;
    border-bottom: 1px solid #c7c6c6;
    background-color: #a9ffff;
    color: #333;
    margin-top: 15px;
}

.directory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
}

.directory-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.2s;
}

.directory-btn:hover {
    background: #e0e0e0;
}



















@media (max-width: 768px) {
  /* 全局调整 */
  body {
    font-size: 14px;
  }

  /* 标题栏：两行紧凑布局，降低总高度 */
  .header {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
    align-items: center;
  }

  .logo {
    font-size: 18px;
    margin-bottom: 0;
    text-align: left;
    flex: 0 0 auto;
  }

  .search-container {
    position: static;
    flex: 1 1 140px;
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 0;
    order: 0;
  }

  .search-box {
    width: 100%;
  }

  .search-input {
    padding: 8px 12px;
    font-size: 13px;
  }

  .search-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .categories {
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
    margin: 0;
    order: 0;
  }

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

  .category {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* 主内容区：窄屏侧栏在资源列表上方 */
  .main-content {
    flex-direction: column;
    margin: 10px;
  }

  .right-content.tag-sidebar {
    order: 1;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
  }

  .left-content {
    order: 2;
    flex: 0 0 auto;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* 资源项调整 */
  .content-item {
    margin-bottom: 15px;
  }

  .item-image {
    height: 150px;
  }

  /* 详情页优化 */
  .resource-container {
    margin: 15px;
    padding: 15px;
  }

  .image-gallery {
    grid-template-columns: 1fr;
  }

  /* 分页控件优化 */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
  }

  .page-btn {
    padding: 6px 10px;
    margin: 2px;
  }

  /* 排序按钮优化 */
  .sort-options {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .sort-btn {
    width: 100%;
    margin: 2px 0;
  }

  /* 下拉菜单调整 */
  .dropdown-menu {
    top: 50px;
    right: 10px;
  }

  /* 隐藏非必要元素 */
  .update-time {
    display: none;
  }
}


@media (max-width: 480px) {
  /* 进一步缩小文字 */
  body {
    font-size: 13px;
  }

  /* 资源图片高度减小 */
  .item-image {
    height: 120px;
  }

  /* 按钮尺寸优化 */
  .btn-purchase, .btn-confirm {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* 模态框优化 */
  .modal-content {
    width: 90%;
    margin: 30% auto;
  }
}

/* Site announcement — sits in right tag sidebar */
.tag-sidebar .announcement-bar {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: 6px 10px;
  min-height: calc(1rem + 12px);
  background: #fde8e8;
  color: #9b2c2c;
  border: 1px solid #f5c2c2;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.25;
}

.tag-sidebar .announcement-bar:hover {
  background: #fbd5d5;
}

.tag-sidebar .announcement-title {
  flex: 1 1 auto;
  font-weight: 700;
}

.announcement-modal[hidden] {
  display: none !important;
}

.announcement-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.announcement-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.announcement-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 24px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.announcement-modal-panel h2 {
  margin-bottom: 12px;
  font-size: 1.25rem;
  color: #1a5276;
  padding-right: 28px;
}

.announcement-topics {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcement-topic {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 2px solid #d6eaf8;
  background: #f4f9fc;
  color: #1a5276;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.announcement-topic-num {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1a5276;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.announcement-topic.topic-1 { border-color: #5dade2; background: #eaf4fb; }
.announcement-topic.topic-2 { border-color: #58d68d; background: #eafaf1; }
.announcement-topic.topic-3 { border-color: #f5b041; background: #fef5e7; }
.announcement-topic.topic-4 { border-color: #af7ac5; background: #f5eef8; }
.announcement-topic.topic-5 { border-color: #e74c3c; background: #fdedec; }

.announcement-topic.topic-1 .announcement-topic-num { background: #2874a6; }
.announcement-topic.topic-2 .announcement-topic-num { background: #1e8449; }
.announcement-topic.topic-3 .announcement-topic-num { background: #b9770e; }
.announcement-topic.topic-4 .announcement-topic-num { background: #6c3483; }
.announcement-topic.topic-5 .announcement-topic-num { background: #c0392b; }

.announcement-topic:hover {
  filter: brightness(0.97);
}

.announcement-back {
  margin: 0 0 12px;
  padding: 0;
  border: none;
  background: none;
  color: #2980b9;
  cursor: pointer;
  font-size: 0.9rem;
}

.announcement-video {
  display: none;
  width: 100%;
  max-height: 280px;
  margin: 0 0 14px;
  background: #111;
  border-radius: 6px;
}

.announcement-video:not([hidden]) {
  display: block;
}

.announcement-file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 4px;
}

.announcement-file {
  margin: 0;
}

.announcement-download {
  display: inline-block;
  padding: 8px 12px;
  background: #1a5276;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
}

.announcement-download:hover {
  background: #154360;
}

.announcement-file-note {
  margin: 8px 0 0;
  color: #555;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.announcement-modal-body {
  white-space: pre-wrap;
  line-height: 1.7;
  color: #333;
  font-size: 14px;
  margin-bottom: 14px;
}

.announcement-modal-body[hidden] {
  display: none !important;
}

.announcement-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

body.announcement-open {
  overflow: hidden;
}