.csbook-body {
  height: 100vh;
}

.csbook-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.csbook-toolbar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  width: 100%;
}

.csbook-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  width: 100%;
}

.csbook-toolbar .nav-link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}

.csbook-heading {
  flex: 1;
  min-width: 12rem;
}

.csbook-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.csbook-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.csbook-toolbar-top .result-count {
  margin-left: auto;
}

.result-count {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 5rem;
}

.csbook-layout {
  flex: 1;
  min-height: 0;
}

.csbook-sidebar {
  width: min(28rem, 42vw);
  overflow-y: auto;
  padding: 0.5rem 0;
}

.chapter-block {
  margin-bottom: 0.75rem;
}

.chapter-block h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0.5rem 0.75rem 0.35rem;
  font-weight: 600;
}

.exercise-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.exercise-btn:hover {
  background: #eef2ff;
}

.exercise-btn.active {
  background: #dbeafe;
  border-left: 3px solid var(--accent);
  padding-left: calc(0.75rem - 3px);
}

.exercise-btn .row1 {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.85rem;
}

.exercise-btn .id {
  font-weight: 700;
  color: var(--accent);
  min-width: 2.5rem;
}

.exercise-btn .page {
  font-size: 0.75rem;
  color: var(--muted);
}

.exercise-btn .bucket {
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
}

.exercise-btn .snippet {
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 0.25rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.csbook-viewer {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  align-items: stretch;
}

.csbook-page-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.csbook-pages.page-wrap {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}

.csbook-page-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.csbook-meta {
  padding: 0.5rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  min-height: 2.5rem;
}

.csbook-meta strong {
  color: var(--accent);
}
