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

:root {
  --bg: #faf8f3;
  --text: #2a2622;
  --muted: #6b6358;
  --accent: #8b1a1a;
  --border: #e5dfd0;
  --card-bg: #fffdf7;
}

body {
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "Source Han Serif CN", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  font-size: 22px;
  font-weight: bold;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.search-form {
  flex: 1;
  display: flex;
  gap: 8px;
}

.search-form input,
.hero-search input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  background: var(--card-bg);
  font-family: inherit;
}

.search-form button,
.hero-search button {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}

.search-form button:hover,
.hero-search button:hover {
  opacity: 0.9;
}

.lang-switch select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.lang-switch select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.main-content {
  padding: 40px 20px;
  min-height: calc(100vh - 200px);
}

.hero {
  text-align: center;
  padding: 60px 0;
}

.hero h1 {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 16px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 32px;
  font-size: 17px;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
}

.dynasty-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.dynasty-nav a {
  padding: 6px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.dynasty-nav a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.recent h2,
.list-page h1,
.search-results h1,
.poet-page h2,
.poem-detail h2 {
  font-size: 22px;
  margin-bottom: 20px;
  color: var(--text);
}

.poem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.poem-card,
.poem-row {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s;
}

.poem-card:hover,
.poem-row:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.poem-card h3,
.poem-row h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.poem-card .author,
.poem-row .author {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.poem-card .preview,
.poem-row .preview {
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.poem-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.poem-detail {
  max-width: 720px;
  margin: 0 auto;
}

.poem-header h1 {
  font-size: 32px;
  margin-bottom: 8px;
  text-align: center;
}

.author-line {
  text-align: center;
  color: var(--muted);
  margin-bottom: 32px;
}

.author-line a {
  color: var(--accent);
  text-decoration: none;
}

.poem-content {
  text-align: center;
  font-size: 20px;
  line-height: 2.2;
  padding: 24px 0 32px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.poem-content p {
  margin: 4px 0;
}

.poem-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.poem-actions button {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

.poem-actions button:hover {
  background: var(--card-bg);
}

.block {
  margin-bottom: 32px;
}

.block h2 {
  font-size: 18px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.block p {
  color: var(--text);
  font-size: 15px;
}

.author-box {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.author-box h3 {
  margin-bottom: 8px;
}

.author-box h3 a {
  color: var(--accent);
  text-decoration: none;
}

.poet-header {
  text-align: center;
  margin-bottom: 32px;
}

.poet-header h1 {
  font-size: 36px;
  margin-bottom: 8px;
}

.poet-header .dynasty {
  color: var(--muted);
}

.result-count {
  color: var(--muted);
  margin-bottom: 24px;
}

.back-home {
  margin-bottom: 16px;
}

.back-home a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.back-home a:hover {
  text-decoration: underline;
}

.static-page {
  max-width: 720px;
  margin: 0 auto;
}

.static-page h1 {
  font-size: 28px;
  margin-bottom: 24px;
  color: var(--accent);
}

.static-page .content-block {
  margin-bottom: 28px;
}

.static-page .content-block h2 {
  font-size: 18px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.static-page .content-block p {
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 8px;
}

.static-page .content-block ul {
  padding-left: 24px;
  font-size: 15px;
  line-height: 1.8;
}

.static-page .content-block a {
  color: var(--accent);
  text-decoration: none;
}

.static-page .content-block a:hover {
  text-decoration: underline;
}

.empty {
  text-align: center;
  padding: 60px 0;
  color: var(--muted);
}

.not-found {
  text-align: center;
  padding: 80px 20px;
}

.not-found h1 {
  font-size: 96px;
  color: var(--accent);
  margin-bottom: 16px;
}

.not-found p {
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 24px;
}

.not-found .back-link {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
}

.not-found .back-link:hover {
  opacity: 0.9;
}

.poet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.poet-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
}

.poet-card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.poet-card h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--accent);
}

.poet-card .dynasty {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.poet-card .desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 32px 0;
}

.pagination a,
.pagination .pg-current {
  min-width: 36px;
  padding: 6px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}

.pagination a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination .pg-current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: default;
}

.pagination .pg-edge {
  padding: 6px 12px;
}

.pagination .pg-ellipsis {
  padding: 6px 4px;
  color: var(--muted);
}

.pagination .pg-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  color: var(--muted);
  font-size: 14px;
}

.pagination .pg-jump input {
  width: 56px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  background: var(--card-bg);
  color: var(--text);
}

.pagination .pg-jump input:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 600px) {
  .pagination .pg-jump {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer .container {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

@media (max-width: 640px) {
  .hero h1 { font-size: 32px; }
  .hero { padding: 40px 0; }
  .site-header .container {
    flex-direction: column;
    gap: 12px;
  }
  .search-form { width: 100%; }
  .lang-switch { align-self: flex-end; }
  .poem-content { font-size: 17px; }
  .poem-header h1 { font-size: 24px; }
}
