:root {
  --ink: #20242b;
  --muted: #68717d;
  --paper: #f7f3e8;
  --paper-deep: #eee4d0;
  --surface: #fffdf8;
  --line: #ded5c1;
  --seal: #9f2f28;
  --seal-dark: #76201d;
  --indigo: #274463;
  --jade: #4c7b68;
  --gold: #b6893c;
  --shadow: 0 16px 40px rgba(40, 38, 31, .10);
  --soft-shadow: 0 8px 24px rgba(40, 38, 31, .08);
  --radius: 8px;
  --font-sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

* {
  letter-spacing: 0;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-sans);
  background:
    linear-gradient(90deg, rgba(32, 36, 43, .035) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(0deg, rgba(32, 36, 43, .025) 1px, transparent 1px) 0 0 / 30px 30px,
    var(--paper);
}

a {
  color: var(--indigo);
}

a:hover {
  color: var(--seal);
}

.app-nav {
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid rgba(159, 47, 40, .14);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: #fff;
  background: var(--seal);
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.app-nav .nav-link {
  color: #343941;
  font-size: .95rem;
  border-radius: 999px;
  padding: .45rem .8rem;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
  color: var(--seal);
  background: rgba(159, 47, 40, .08);
}

.app-nav .nav-alert {
  color: var(--seal);
  font-weight: 700;
}

.reader-link {
  border: 1px solid rgba(39, 68, 99, .18);
  background: rgba(39, 68, 99, .06);
}

.reader-link.muted {
  color: var(--muted);
}

.page-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.page-hero {
  position: relative;
  display: grid;
  gap: 18px;
  margin-bottom: 28px;
  padding: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: repeating-linear-gradient(
    to bottom,
    var(--seal) 0,
    var(--seal) 18px,
    transparent 18px,
    transparent 26px
  );
}

.hero-kicker {
  margin: 0 0 .45rem;
  color: var(--seal);
  font-size: .78rem;
  font-weight: 800;
}

.hero-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 4.2rem);
  font-weight: 900;
  line-height: 1.05;
}

.hero-copy {
  max-width: 680px;
  margin: .8rem 0 0;
  color: #4d535d;
  line-height: 1.8;
}

.hero-actions,
.toolbar-line {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  align-items: center;
}

.library-card,
.book-card,
.reflection-card,
.profile-panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

.library-card {
  padding: 14px;
  height: 100%;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.library-card:hover {
  transform: translateY(-3px);
  border-color: rgba(159, 47, 40, .32);
  box-shadow: var(--shadow);
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--paper-deep);
  border-radius: 6px;
  box-shadow: 0 10px 20px rgba(32, 36, 43, .13);
}

.book-title {
  display: -webkit-box;
  min-height: 2.8em;
  margin: .9rem 0 .3rem;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-meta {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}

.book-detail-grid {
  display: grid;
  grid-template-columns: minmax(170px, 260px) 1fr;
  gap: 28px;
  align-items: start;
}

.book-detail-cover {
  max-width: 260px;
  margin: 0 auto;
}

.detail-list {
  display: grid;
  gap: .45rem;
  margin: 1rem 0;
  color: #3e4650;
}

.detail-list strong {
  color: var(--ink);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 900;
}

.section-kicker {
  color: var(--muted);
  font-size: .86rem;
}

.reflection-card,
.profile-panel,
.form-panel,
.book-card {
  padding: 20px;
}

.narrow-panel {
  max-width: 720px;
}

.wide-panel {
  max-width: 820px;
}

.page-number-input {
  width: 86px;
}

.recommendation-heading {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
}

.is-collapsed {
  display: none;
}

.reflection-card + .reflection-card {
  margin-top: 14px;
}

.reflection-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.reflection-title {
  margin: 0 0 .35rem;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 900;
}

.reflection-content {
  margin: .8rem 0 0;
  color: #363c44;
  line-height: 1.8;
  white-space: pre-wrap;
}

.reflection-meta {
  color: var(--muted);
  font-size: .85rem;
}

.comment-area {
  margin-top: 1rem;
  padding: 14px;
  background: rgba(238, 228, 208, .36);
  border: 1px solid rgba(222, 213, 193, .85);
  border-radius: var(--radius);
}

.comment-list {
  max-height: 280px;
  overflow-y: auto;
}

.comment-item {
  padding: .7rem .8rem;
  margin-bottom: .6rem;
  background: #fff;
  border: 1px solid rgba(222, 213, 193, .8);
  border-radius: 8px;
}

.comment-input-group {
  margin-top: .7rem;
}

.btn {
  border-radius: 7px;
  font-weight: 700;
}

.btn-primary,
.btn-success,
.btn-info {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--seal);
  --bs-btn-border-color: var(--seal);
  --bs-btn-hover-bg: var(--seal-dark);
  --bs-btn-hover-border-color: var(--seal-dark);
  --bs-btn-focus-shadow-rgb: 159, 47, 40;
}

.btn-outline-primary {
  --bs-btn-color: var(--indigo);
  --bs-btn-border-color: rgba(39, 68, 99, .46);
  --bs-btn-hover-bg: var(--indigo);
  --bs-btn-hover-border-color: var(--indigo);
}

.btn-outline-secondary {
  --bs-btn-color: #46505c;
  --bs-btn-border-color: rgba(70, 80, 92, .35);
}

.form-control,
.form-select {
  border-color: #d5cbb8;
  border-radius: 7px;
  background-color: #fffefa;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--seal);
  box-shadow: 0 0 0 .2rem rgba(159, 47, 40, .12);
}

.input-group .form-control {
  min-height: 44px;
}

.page-link {
  color: var(--indigo);
  border-color: #d8cfbd;
  background: var(--surface);
}

.page-item.active .page-link {
  background: var(--seal);
  border-color: var(--seal);
}

.status-badge {
  border-radius: 999px;
  padding: .35rem .55rem;
  font-size: .78rem;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 253, 248, .72);
  border: 1px dashed #cfc3ad;
  border-radius: var(--radius);
}

.admin-list {
  display: grid;
  gap: 14px;
}

@media (max-width: 768px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .page-hero,
  .reflection-card,
  .profile-panel,
  .form-panel,
  .book-card {
    padding: 16px;
  }

  .book-detail-grid {
    grid-template-columns: 1fr;
  }

  .book-detail-cover {
    max-width: 210px;
  }

  .reflection-head {
    display: block;
  }

  .toolbar-line {
    align-items: stretch;
  }

  .toolbar-line > * {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
