:root {
  color-scheme: light;
  --bg: #f7f1e7;
  --bg-2: #efe4d4;
  --bg-3: #fff9f1;
  --ink: #2b241d;
  --muted: #6f6156;
  --accent: #b46a2e;
  --accent-2: #3f6f58;
  --accent-3: #c79a57;
  --line: #e2d4c2;
  --shadow: 0 12px 30px rgba(40, 28, 18, 0.12);
  --radius: 16px;
  --font-display: "ZCOOL XiaoWei", "STKaiti", "Kaiti SC", "KaiTi", "Songti SC", serif;
  --font-body: "LXGW WenKai", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: radial-gradient(1200px 800px at 12% 8%, #f6ead8 0%, rgba(246, 234, 216, 0.4) 55%, transparent 70%),
    radial-gradient(900px 650px at 85% 15%, #f0e0cc 0%, rgba(240, 224, 204, 0.3) 50%, transparent 65%),
    linear-gradient(135deg, #f9f4ed 0%, #f5eee4 55%, #f3e9dd 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.background-sheen {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: rgba(255, 249, 241, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 1px;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-stats {
  font-size: 13px;
  color: var(--muted);
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 22px;
  padding: 24px 28px 40px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: riseIn 0.6s ease both;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-panel .field {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.text-input,
.range-inputs input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fffdf9;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus,
.range-inputs input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(180, 106, 46, 0.15);
}

.range-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fffaf3;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip.is-active {
  border-color: var(--accent);
  color: var(--ink);
  background: rgba(180, 106, 46, 0.12);
}

.button-row {
  display: flex;
  justify-content: flex-end;
}

.ghost,
.accent {
  border-radius: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(180, 106, 46, 0.25);
}

.accent:hover {
  transform: translateY(-1px);
}

.results-panel {
  max-height: 260px;
  overflow: auto;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item {
  border-radius: 12px;
  padding: 10px 12px;
  background: #fffdf8;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.result-title {
  font-size: 14px;
  font-weight: 600;
}

.result-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.nav-panel {
  overflow: hidden;
}

.nav-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-group details {
  border-radius: 14px;
  background: #fffaf3;
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.nav-group summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(180, 106, 46, 0.08);
}

.nav-item.is-selected {
  color: var(--ink);
  background: rgba(63, 111, 88, 0.12);
  border: 1px solid rgba(63, 111, 88, 0.3);
}

.nav-item.is-hidden {
  display: none;
}

.reader {
  background: var(--bg-3);
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 24px 26px 30px;
  box-shadow: var(--shadow);
  animation: riseIn 0.7s ease both;
}

.reader-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.breadcrumbs {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

#content-title {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 8px 0 10px;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.summary .chip {
  font-size: 12px;
}

.reader-actions {
  display: flex;
  gap: 10px;
}

.meta-panel {
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: #fff7ed;
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-link {
  border: 1px solid rgba(63, 111, 88, 0.4);
  background: rgba(63, 111, 88, 0.12);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.meta-link:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.meta-plain {
  font-size: 12px;
  color: var(--ink);
}

.meta-panel.hidden {
  display: none;
}

.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.meta-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.meta-table td:first-child {
  color: var(--muted);
  width: 140px;
}

.content-body {
  line-height: 1.85;
  font-size: 16px;
}

.content-body h1,
.content-body h2,
.content-body h3 {
  font-family: var(--font-display);
  color: var(--ink);
}

.content-body p {
  margin-bottom: 1em;
}

.info-collapse {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf3;
  padding: 8px 12px;
  margin: 16px 0;
}

.info-collapse summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 16px;
  list-style: none;
}

.info-collapse summary::-webkit-details-marker {
  display: none;
}

mark {
  background: rgba(180, 106, 46, 0.22);
  color: inherit;
  padding: 0 2px;
  border-radius: 4px;
}

.placeholder {
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.progress-panel .progress-item {
  margin-bottom: 16px;
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(63, 111, 88, 0.12);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  transition: width 0.3s ease;
}

.progress-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.current-info {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.hidden {
  display: none;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .sidebar.right {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: 2;
  }
  .reader {
    order: 1;
  }
  .sidebar.right {
    order: 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
