:root {
  --bg: #f3ecdf;
  --paper: #fffdf8;
  --ink: #2a241a;
  --muted: #736552;
  --line: #e6dbc8;
  --line-strong: #d8c8ad;
  --brand: #3f2e1f;
  --accent: #9d2b2b;
  --shadow: 0 10px 24px rgba(58, 43, 28, 0.08);
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-poem: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1100px 460px at 10% -10%, #f7eee0 0, transparent 60%),
    radial-gradient(900px 420px at 100% 0, #ece1cc 0, transparent 55%),
    var(--bg);
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1100px, 94vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 252, 246, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(7px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
}

.brand {
  font-family: var(--font-poem);
  font-size: 28px;
  letter-spacing: 0.06em;
  color: var(--brand);
  font-weight: 700;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.main-nav > a,
.menu-dropdown > summary {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  color: #4c3a26;
  border: 1px solid transparent;
}

.main-nav > a:hover,
.menu-dropdown > summary:hover {
  text-decoration: none;
  background: #f8f1e5;
  border-color: #eadcc8;
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown > summary::-webkit-details-marker {
  display: none;
}

.dropdown-panel {
  position: absolute;
  top: 112%;
  left: 0;
  min-width: 180px;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
}

.menu-dropdown[open] .dropdown-panel {
  display: grid;
  gap: 4px;
}

.dropdown-panel a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: #463624;
}

.dropdown-panel a:hover {
  background: #f5ecdc;
  text-decoration: none;
}

.page-main {
  display: grid;
  gap: 16px;
  padding: 20px 0 48px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(116, 89, 55, 0.05);
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  line-height: 1.45;
  color: #3f2f1f;
}

h1 {
  font-size: clamp(24px, 4.2vw, 34px);
}

h2 {
  font-size: clamp(20px, 3.2vw, 27px);
}

h3 {
  font-size: clamp(18px, 2.6vw, 22px);
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-form input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
}

.search-form input:focus {
  outline: none;
  border-color: #c9b190;
  box-shadow: 0 0 0 2px rgba(201, 177, 144, 0.22);
}

.search-form button {
  border: 0;
  border-radius: 10px;
  padding: 0 18px;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(180deg, #58402a 0%, #3d2d1d 100%);
  cursor: pointer;
}

.search-form button:hover {
  filter: brightness(1.05);
}

.list-wrap {
  display: grid;
  gap: 12px;
}

.poem-card h2 a,
.poem-card h3 a,
.poetry-detail h1 {
  font-family: var(--font-poem);
  letter-spacing: 0.025em;
}

.poem-body,
.poem-content {
  font-family: var(--font-poem);
  white-space: pre-line;
  letter-spacing: 0.03em;
  line-height: 2.15;
}

.poem-body {
  font-size: 18px;
}

.poem-content {
  font-size: 21px;
  border-left: 3px solid #d9c3a2;
  padding-left: 12px;
  margin: 12px 0 18px;
}

.article-body {
  font-family: var(--font-ui);
  line-height: 2.02;
  letter-spacing: 0.01em;
  color: #352a1e;
}

.article-body p {
  margin: 0 0 12px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 12px;
  padding-left: 0;
}

.article-body ul li,
.article-body ol li {
  position: relative;
  margin: 8px 0;
  padding-left: 1.9em;
}

.article-body ul {
  list-style: none;
}

.article-body ul li::before {
  content: "◈";
  position: absolute;
  left: 0;
  top: 0.12em;
  color: #927043;
  font-size: 0.84em;
}

.article-body ol {
  list-style: none;
  counter-reset: elegant-counter;
}

.article-body ol li {
  counter-increment: elegant-counter;
}

.article-body ol li::before {
  content: counter(elegant-counter);
  position: absolute;
  left: 0;
  top: 0.12em;
  width: 1.4em;
  height: 1.4em;
  border: 1px solid #ccb38f;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.74em;
  color: #6a5132;
  background: #fbf5ea;
}

.hot-list {
  margin: 0;
  padding-left: 1.6em;
  display: grid;
  gap: 9px;
  list-style: decimal-leading-zero;
}

.hot-list li::marker {
  color: #7a5632;
  font-family: var(--font-poem);
  font-size: 0.95em;
}

.result-tip {
  margin: 2px 0 4px;
  color: var(--muted);
}

mark.hl {
  background: #fde6d9;
  color: var(--accent);
  padding: 0 2px;
  border-radius: 4px;
}

.author-group .group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.more-link {
  color: #85593b;
  font-size: 14px;
}

.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.author-chip {
  display: block;
  text-align: center;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fcf8ef;
}

.author-chip:hover {
  text-decoration: none;
  background: #f6eddf;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.pagination a,
.pagination span {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffdf8;
  font-size: 14px;
}

.pagination a:hover {
  text-decoration: none;
  background: #f5ecdc;
}

@media (max-width: 780px) {
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand {
    font-size: 26px;
  }

  .main-nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .main-nav::-webkit-scrollbar {
    height: 4px;
  }

  .main-nav::-webkit-scrollbar-thumb {
    background: #d8c7ae;
    border-radius: 10px;
  }

  .menu-dropdown {
    position: static;
  }

  .dropdown-panel {
    position: fixed;
    left: 3vw;
    right: 3vw;
    top: 92px;
    max-height: 56vh;
    overflow-y: auto;
    z-index: 60;
  }

  .card {
    padding: 14px;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .search-form button {
    height: 42px;
  }

  .poem-body {
    font-size: 17px;
    line-height: 2.08;
  }

  .poem-content {
    font-size: 19px;
    line-height: 2.08;
  }
}

/* Nav dropdown and footer enhancements */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-main {
  flex: 1;
}

.menu-dropdown > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.menu-dropdown > summary::after {
  content: "▾";
  font-size: 12px;
  color: #7b6244;
  transition: transform 0.18s ease;
}

.menu-dropdown[open] > summary::after,
.menu-dropdown:hover > summary::after,
.menu-dropdown:focus-within > summary::after {
  transform: rotate(180deg);
}

.dropdown-panel {
  display: grid;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.menu-dropdown[open] .dropdown-panel,
.menu-dropdown:hover .dropdown-panel,
.menu-dropdown:focus-within .dropdown-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.92);
}

.footer-inner {
  padding: 14px 0 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.footer-inner a {
  color: #6c4c2c;
}

.footer-inner a:hover {
  color: #8b5d35;
  text-decoration: none;
}

@media (max-width: 780px) {
  .menu-dropdown > summary::after {
    font-size: 11px;
  }

  .site-footer {
    background: rgba(255, 252, 246, 0.96);
  }

  .footer-inner {
    padding: 12px 0 18px;
    font-size: 13px;
  }
}
