:root {
  --gallery-gap: 1rem;
}

/* 头部 */
.gallery-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.gallery-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.gallery-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* 搜索 */
.search-box {
  position: relative;
  margin-bottom: 1.25rem;
}

.search-box .search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--gold);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* 横向滚动筛选条 */
.filter-row-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  padding-left: 0.125rem;
}

.filter-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  padding: 0.45rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.filter-chip.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 500;
}

/* 题目卡片 */
.topic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.topic-card-featured {
  border-color: rgba(201, 169, 110, 0.48);
  background: linear-gradient(145deg, rgba(201, 169, 110, 0.1), var(--bg-card));
}

.featured-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(201, 169, 110, 0.16);
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.topic-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.topic-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.topic-icon svg {
  display: block;
}

.topic-arrow svg {
  display: block;
}

.topic-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.375rem;
  line-height: 1.4;
}

.topic-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.topic-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.tag-genre {
  background: rgba(201, 169, 110, 0.15);
  color: var(--gold);
}

.topic-arrow {
  align-self: flex-end;
  margin-top: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state .emoji {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* 加载 */
.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* 底部安全区 */
main {
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 640px) {
  .gallery-header h1 {
    font-size: 1.5rem;
  }

  .topic-card {
    padding: 0.875rem;
    border-radius: 1rem;
  }

  .topic-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
}
