/* ============================================================
   颜色变量 —— 想调色只改这里
   ============================================================ */
:root {
  --bg: #eef2f5;
  --card: #ffffff;
  --ink: #1f2d3d;
  --ink-light: #6b7c8f;
  --accent: #2f7a6f;
  --accent-soft: #e8f1ee;
  --border: #d8e0e8;
  --shadow: rgba(0, 0, 0, 0.08);

  /* 诗词列表四种色块（日间） */
  --poem-0: #e8f1ee;
  --poem-1: #eaf0f7;
  --poem-2: #f3efe6;
  --poem-3: #f0eaf0;
}

body.dark {
  --bg: #263245;
  --card: #252f3d;
  --ink: #e8eef7;
  --ink-light: #8fa3bf;
  --accent: #5fc8ba;
  --accent-soft: #23342f;
  --border: #3a4658;
  --shadow: rgba(0, 0, 0, 0.35);

  --poem-0: #23342f;
  --poem-1: #233040;
  --poem-2: #332f26;
  --poem-3: #2f2630;
}

/* ============================================================
   基础
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  padding: 0 16px;
  transition: background 0.25s, color 0.25s;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 0 0;
}

a { color: var(--accent); }

/* ============================================================
   顶部栏（背景图 + 语言/主题切换）
   ============================================================ */
.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  height: 200px;
  background-image: url("/static/images/logo.png");
  background-size: cover;
  background-position: left center;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  padding: 16px 20px 0 0;
  border-radius: 0 0 12px 12px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.logo a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.logo img {
  width: 700px;
  height: 150px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  color: var(--ink-light);
}
.lang-switch {
  cursor: pointer;
  user-select: none;
}
.lang-switch span {
  padding: 2px 6px;
  border-radius: 4px;
}
.lang-switch .active {
  color: var(--accent);
  font-weight: 700;
}
.theme-switch {
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  user-select: none;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background 0.15s;
}
.theme-switch:hover {
  background: var(--border);
}

/* ============================================================
   搜索区
   ============================================================ */
.search-box {
  display: flex;
  margin: 0 0 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}
.search-box select {
  border: none;
  background: transparent;
  padding: 0 16px;
  font-size: 14px;
  color: var(--ink-light);
  border-right: 1px solid var(--border);
  outline: none;
  cursor: pointer;
  font-family: inherit;
}
.search-box input {
  flex: 1;
  border: none;
  padding: 14px 16px;
  font-size: 15px;
  background: transparent;
  outline: none;
  font-family: inherit;
  color: var(--ink);
}
.search-box input::placeholder {
  color: var(--ink-light);
}
.search-box button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 0 28px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.search-box button:hover { opacity: 0.88; }

/* ============================================================
   分类导航
   ============================================================ */
.cat-rows {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 40px;
}
.cat-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.cat-label {
  flex: 0 0 68px;
  font-size: 14px;
  color: var(--ink-light);
  line-height: 32px;
  letter-spacing: 1px;
  white-space: nowrap;
}
.cat-tags {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  display: inline-block;
  padding: 4px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  line-height: 22px;
  color: var(--ink);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tag.more {
  color: var(--ink-light);
  border-style: dashed;
}

/* ============================================================
   面包屑（统一一套类名）
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-light);
  margin: 12px 0 16px;
}
.breadcrumb a {
  color: var(--ink-light);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover {
  color: var(--accent);
}
.breadcrumb .sep,
.breadcrumb .breadcrumb-sep {
  color: var(--ink-light);
  opacity: 0.6;
  user-select: none;
}
.breadcrumb .current,
.breadcrumb .breadcrumb-current {
  color: var(--ink);
}

/* ============================================================
   页面标题区
   ============================================================ */
.page-header {
  margin: 12px 0 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.page-title {
  font-size: 24px;
  margin: 0 0 6px;
  color: var(--ink);
  font-weight: 700;
}
.page-subtitle,
.page-sub {
  font-size: 13px;
  color: var(--ink-light);
}

/* 诗词列表页头部（baseline 对齐版） */
.list-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   随机诗词卡片（首页）
   ============================================================ */
.poem-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 44px 32px;
  text-align: center;
  position: relative;
  margin-top: 8px;
}
.poem-card::before {
  content: "随机一首";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  padding: 2px 12px;
  border-radius: 999px;
  letter-spacing: 1px;
}
.poem-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}
.poem-meta {
  font-size: 14px;
  color: var(--ink-light);
  margin-bottom: 24px;
}
.poem-content {
  font-size: 17px;
  line-height: 2.2;
}
.poem-content p {
  margin: 4px 0;
}

/* ============================================================
   诗词列表（每首一个色块）
   ============================================================ */
.poem-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.poem-item {
  display: block;
  border-radius: 14px;
  padding: 24px 28px;
  text-decoration: none;
  color: var(--ink);
  transition: all 0.15s;
  border: 1px solid transparent;
}
.poem-item.color-0 { background: var(--poem-0); }
.poem-item.color-1 { background: var(--poem-1); }
.poem-item.color-2 { background: var(--poem-2); }
.poem-item.color-3 { background: var(--poem-3); }

.poem-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow);
}

.poem-item-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.poem-item:hover .poem-item-title {
  color: var(--accent);
}
.poem-item-content {
  font-size: 15px;
  line-height: 2;
  color: var(--ink);
}
.poem-item-content p { margin: 0; }
.poem-item-excerpt {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.7;
  margin-top: 6px;
}
.poem-more { color: var(--ink-light); }

/* ============================================================
   搜索结果页
   ============================================================ */
.search-summary {
  margin: 16px 0;
  color: var(--ink-light);
  font-size: 14px;
}
.search-summary strong { color: var(--accent); }

mark {
  background: #ffe58f;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}
body.dark mark {
  background: #6b5b1f;
  color: #ffe58f;
}

/* ============================================================
   诗人列表
   ============================================================ */
.author-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.author-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.author-item:hover {
  border-color: var(--accent);
}
.author-name {
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.author-name:hover { color: var(--accent); }
.author-dynasty {
  font-size: 12px;
  color: var(--ink-light);
  flex-shrink: 0;
}
.author-count {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ============================================================
   分页（统一一套）
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 36px 0 24px;
  font-size: 14px;
  text-align: center;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
  transition: all 0.15s;
}
.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.pagination .ellipsis {
  border: none;
  background: transparent;
  color: var(--ink-light);
}
.pagination .disabled {
  color: var(--ink-light);
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   诗词详情页
   ============================================================ */
.poem-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  position: relative;
}
.poem-detail-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.poem-detail-meta {
  font-size: 14px;
  color: var(--ink-light);
  margin-bottom: 32px;
}
.poem-detail-content {
  font-size: 19px;
  line-height: 2.4;
  color: var(--ink);
}
.poem-detail-content p { margin: 4px 0; }

.detail-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 32px;
  font-size: 14px;
}
.detail-actions a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  transition: opacity 0.15s;
}
.detail-actions a:hover { opacity: 0.75; }

/* ============================================================
   空状态（统一）
   ============================================================ */
.empty-tip,
.empty-result {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-light);
  font-size: 14px;
}
.empty-tip p { margin: 8px 0; }
.empty-sub a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}

/* ============================================================
   底部
   ============================================================ */
.footer {
  margin-top: 64px;
  padding: 32px 0 40px;
  border-top: 1px solid var(--border);
}
.footer-desc {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  line-height: 1.9;
  color: var(--ink-light);
  font-size: 13px;
}