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

body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  font-size: 18px;
  line-height: 1.8;
  color: #333;
  background: #faf8f0;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  border-bottom: 2px solid #8b0000;
}

header h1 { font-size: 2.4rem; letter-spacing: 0.1em; }
header h1 a { color: #8b0000; text-decoration: none; }

/* Search */
#search-bar {
  max-width: 42em;
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
}

#search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #333;
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: #8b0000; }
#search-input::placeholder { color: #bbb; }

#search-results {
  max-width: 42em;
  margin: 0 auto;
  padding: 0 1rem;
}

#search-results .search-result {
  display: block;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: #333;
  transition: color 0.15s;
}
#search-results .search-result:hover { color: #8b0000; }
#search-results .result-title { font-weight: bold; }
#search-results .result-title mark { background: #fce4a8; color: inherit; }
#search-results .result-meta { font-size: 0.8rem; color: #888; font-family: sans-serif; }
#search-results .search-hint { padding: 0.5rem 0; color: #888; font-size: 0.9rem; }

#breadcrumb {
  max-width: 42em;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #666;
}
#breadcrumb a { color: #8b0000; text-decoration: none; }
#breadcrumb a:hover { text-decoration: underline; }
#breadcrumb .sep { margin: 0 0.4em; color: #ccc; }

#app {
  max-width: 42em;
  margin: 0 auto;
  padding: 1rem;
}

/* Home: series cards */
.series-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.series-card {
  display: block;
  background: #fff;
  border: 1px solid #e0d8c8;
  border-left: 4px solid #8b0000;
  border-radius: 4px;
  padding: 1.5rem;
  text-decoration: none;
  color: #333;
  transition: box-shadow 0.2s, transform 0.2s;
}
.series-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }
.series-order { font-size: 0.85rem; color: #888; font-family: sans-serif; }
.series-subtitle { font-size: 1.4rem; color: #8b0000; margin: 0.2rem 0; }
.series-meta { font-size: 0.85rem; color: #888; font-family: sans-serif; }

/* Section titles */
.section-title { font-size: 1.5rem; color: #8b0000; margin-bottom: 1.5rem; }

/* Series view: year sections with issue cards */
.year-section { margin-bottom: 2rem; }
.year-section h3 { font-size: 1.2rem; color: #555; border-bottom: 1px solid #ddd; padding-bottom: 0.3rem; margin-bottom: 1rem; }

.issue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.issue-card {
  display: block;
  background: #fff;
  border: 1px solid #e0d8c8;
  border-radius: 4px;
  padding: 1rem 0.75rem;
  text-align: center;
  text-decoration: none;
  color: #333;
  transition: box-shadow 0.2s, transform 0.2s;
}
.issue-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-2px); }
.issue-label { font-size: 1rem; color: #8b0000; }
.story-count { font-size: 0.8rem; color: #888; margin-top: 0.2rem; font-family: sans-serif; }

/* Issue TOC */
.toc-list { list-style: none; }
.toc-list li { border-bottom: 1px solid #eee; }
.toc-list a {
  display: block;
  padding: 0.8rem 0;
  color: #333;
  text-decoration: none;
  transition: color 0.15s;
}
.toc-list a:hover { color: #8b0000; }
.toc-list .order { color: #8b0000; margin-right: 0.5em; font-family: sans-serif; font-weight: bold; }

/* Reader */
.reader-title {
  font-size: 1.6rem;
  text-align: center;
  margin: 1.5rem 0;
  color: #8b0000;
}

.reader-body p {
  text-indent: 2em;
  margin-bottom: 0.6em;
}

.story-nav {
  display: flex;
  justify-content: space-between;
  margin: 2rem 0;
  font-size: 0.95rem;
}
.story-nav a { color: #8b0000; text-decoration: none; }
.story-nav a:hover { text-decoration: underline; }

/* Utility */
.loading, .error { text-align: center; padding: 3rem 1rem; color: #888; }
.error { color: #c00; }

@media (max-width: 600px) {
  header h1 { font-size: 1.8rem; }
  body { font-size: 16px; }
  .issue-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
