* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, 'Microsoft YaHei', 'PingFang SC', sans-serif; background: #f5f2ed; color: #2c2c2c; min-height: 100vh; }

#app { max-width: 900px; margin: 0 auto; padding: 0 16px 40px; }

/* loading overlay */
#loading-overlay {
  position: fixed; inset: 0; background: #f5f2ed; display: flex;
  align-items: center; justify-content: center; z-index: 1000;
  transition: opacity .3s;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-content { text-align: center; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 4px solid #d4c9b8; border-top-color: #8b7355;
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 15px; color: #8b7355; }

/* top nav */
#top-nav {
  display: flex; align-items: center; gap: 0;
  padding: 12px 0; border-bottom: 1px solid #d4c9b8;
  flex-wrap: wrap; position: sticky; top: 0;
  background: #f5f2ed; z-index: 100;
}
#top-nav .nav-item {
  position: relative; padding: 6px 14px; cursor: pointer;
  font-size: 15px; color: #5a4a3a; user-select: none;
  white-space: nowrap; border-radius: 4px;
}
#top-nav .nav-item:hover, #top-nav .nav-item.active { background: #e8dfd0; color: #2c2c2c; }
#top-nav .nav-item .arrow { font-size: 10px; margin-left: 4px; }
#top-nav .dropdown {
  display: none; position: absolute; top: 100%; left: 0;
  background: #fff; border: 1px solid #d4c9b8; border-radius: 6px;
  min-width: 120px; box-shadow: 0 4px 12px rgba(0,0,0,.1); z-index: 200;
  max-height: 300px; overflow-y: auto;
}
#top-nav .nav-item:hover .dropdown { display: block; }
#top-nav .dropdown-item {
  padding: 8px 16px; cursor: pointer; font-size: 14px; color: #5a4a3a;
}
#top-nav .dropdown-item:hover { background: #f0e9de; }
#top-nav .nav-spacer { flex: 1; }

/* search bar */
#search-bar {
  padding: 10px 0; border-bottom: 1px solid #d4c9b8; margin-bottom: 16px;
}
#search-bar input {
  width: 100%; padding: 8px 14px; border: 1px solid #d4c9b8;
  border-radius: 20px; font-size: 14px; outline: none;
  background: #fff; transition: border-color .2s;
}
#search-bar input:focus { border-color: #8b7355; }

/* stats link */
.stats-link {
  margin-left: auto; font-size: 13px; color: #8b7355;
  cursor: pointer; padding: 6px 10px; border-radius: 4px;
  text-decoration: none;
}
.stats-link:hover { background: #e8dfd0; }

/* main content */
#main-content { min-height: 60vh; }

/* poem card */
.poem-card {
  padding: 16px 0; border-bottom: 1px solid #e8dfd0; cursor: pointer;
  transition: background .15s; border-radius: 4px; padding-left: 8px; padding-right: 8px;
}
.poem-card:hover { background: #ede6da; }
.poem-card .card-title { font-size: 17px; font-weight: 600; color: #2c2c2c; }
.poem-card .card-meta {
  font-size: 13px; color: #8b7355; margin-top: 4px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.poem-card .card-meta span { background: #e8dfd0; padding: 1px 8px; border-radius: 3px; }
.poem-card .card-excerpt {
  font-size: 14px; color: #6b5b4b; margin-top: 6px;
  line-height: 1.6; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* detail page */
.detail-container { padding: 20px 0; max-width: 700px; margin: 0 auto; }
.detail-title {
  font-size: 24px; font-weight: 700; color: #2c2c2c;
  text-align: center; margin-bottom: 4px;
}
.detail-meta {
  text-align: center; font-size: 14px; color: #8b7355;
  margin-bottom: 24px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
}
.detail-meta span { background: #e8dfd0; padding: 2px 10px; border-radius: 3px; }
.detail-content {
  font-size: 16px; line-height: 2; color: #2c2c2c;
  text-align: center; white-space: pre-wrap;
  padding: 16px; background: #faf8f5; border-radius: 8px; margin-bottom: 24px;
}
.detail-image {
  text-align: center; margin-bottom: 24px;
}
.detail-image img {
  max-width: 100%; height: auto; border-radius: 6px;
  display: inline-block;
}
.detail-appreciation {
  font-size: 15px; line-height: 1.9; color: #3a3a3a;
  padding: 16px; background: #faf8f5; border-radius: 8px;
}
.detail-appreciation h2 {
  font-size: 18px; font-weight: 600; margin-bottom: 12px; color: #2c2c2c;
}

/* detail breadcrumb & nav */
.detail-breadcrumb { font-size: 13px; color: #8b7355; margin-bottom: 16px; }
.detail-breadcrumb a { color: #8b7355; text-decoration: none; }
.detail-breadcrumb a:hover { text-decoration: underline; }
.detail-nav-bar {
  display: flex; justify-content: space-between; margin-top: 24px; gap: 12px;
}
.detail-nav-left { flex: 1; text-align: left; }
.detail-nav-right { flex: 1; text-align: right; }
.detail-nav { color: #5a4a3a; text-decoration: none; font-size: 14px; }
.detail-nav:hover { text-decoration: underline; }
.detail-nav.disabled { color: #b8a898; cursor: default; }
.detail-nav.disabled:hover { text-decoration: none; }

/* search page */
.search-page { padding: 16px 0; }
.search-page .search-info { font-size: 14px; color: #8b7355; margin-bottom: 12px; }
.search-page mark { background: #f7e5b8; padding: 0 2px; }

/* stats page */
.stats-page { padding: 24px 0; }
.stats-page h2 { font-size: 20px; color: #2c2c2c; margin-bottom: 16px; text-align: center; }
.stats-page .stats-summary {
  display: flex; gap: 16px; justify-content: center; margin-bottom: 32px; flex-wrap: wrap;
}
.stats-page .stats-summary .stat-box {
  background: #faf8f5; border-radius: 8px; padding: 16px 24px; text-align: center;
  min-width: 120px; border: 1px solid #e8dfd0;
}
.stat-box .num { font-size: 28px; font-weight: 700; color: #5a4a3a; }
.stat-box .label { font-size: 13px; color: #8b7355; margin-top: 4px; }
.chart-container { margin-bottom: 36px; text-align: center; }
.chart-container h3 { font-size: 16px; color: #5a4a3a; margin-bottom: 12px; }
.chart-container svg { max-width: 100%; }

/* responsive */
@media (max-width: 600px) {
  #app { padding: 0 10px 24px; }
  #top-nav { gap: 0; }
  #top-nav .nav-item { padding: 6px 10px; font-size: 14px; }
  .detail-title { font-size: 20px; }
  .detail-content { font-size: 15px; }
  .stats-page .stats-summary .stat-box { min-width: 80px; padding: 12px 16px; }
}

/* page title */
.page-title { font-size: 20px; font-weight: 600; margin-bottom: 16px; color: #2c2c2c; }

/* footer stats */
#stats-footer {
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid #e8dfd0;
  text-align: center;
  font-size: 14px;
  color: #8b7355;
}
#stats-footer .stats-row {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}
#stats-footer .stats-row span {
  white-space: nowrap;
}
