:root {
  --bg-canvas: #050505;
  --bg-sidebar: #0a0a0a;
  --border-subtle: #1c1c1f;
  --border-hover: #2e2e34;
  --text-primary: #ededed;
  --text-secondary: #9e9ea7;
  --text-muted: #63636e;
  --accent-gold: #d4a373;
  --accent-gold-hover: #faedcd;
  --code-bg: #111113;
  --sidebar-width: 320px;
  --font-serif: "Cinzel", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

html, body {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.book-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.book-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.75rem 1.5rem 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.book-brand {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.book-brand .book-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  text-transform: uppercase;
}

.book-brand .book-author {
  font-size: 0.8rem;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  flex: 1;
}

.nav-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 1.25rem 0.5rem 0.5rem 0.5rem;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-list a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.nav-list a.active {
  background: rgba(212, 163, 115, 0.12);
  color: var(--accent-gold);
  font-weight: 600;
}

.chapter-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Main Reading Area */
.book-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 4rem 2rem 6rem 2rem;
  overflow-y: auto;
}

.reading-area {
  max-width: 760px;
  width: 100%;
}

/* Typography & Content */
h1, h2, h3, h4 {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  line-height: 1.25;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

h3 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: #ececec;
}

p {
  margin-bottom: 1.4rem;
  color: #d1d1d6;
  font-size: 1.05rem;
}

ul, ol {
  margin-bottom: 1.4rem;
  padding-left: 1.5rem;
  color: #d1d1d6;
}

li {
  margin-bottom: 0.4rem;
}

blockquote {
  border-left: 2px solid var(--accent-gold);
  padding-left: 1.25rem;
  margin: 1.75rem 0;
  color: #b0b0b8;
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border-subtle);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

pre code {
  background: transparent;
  padding: 0;
  border: none;
}

/* Chapter Header */
.chapter-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.chapter-volume-badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.chapter-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-weight: 300;
}

.chapter-meta {
  display: flex;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* Navigation Footer */
.chapter-nav-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  gap: 1.5rem;
}

.nav-prev, .nav-next {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
  flex: 1;
}

.nav-next {
  text-align: right;
}

.nav-prev:hover, .nav-next:hover {
  border-color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.04);
}

.nav-arrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.nav-title {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
}

@media (max-width: 860px) {
  .book-container {
    flex-direction: column;
  }
  .book-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
}
