.app-shell {
  --spur-width-current: var(--spur-width-collapsed);
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.app-shell.spur-expanded {
  --spur-width-current: var(--spur-width-expanded);
}

.main-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  min-height: var(--topbar-height);
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  color: var(--text-muted);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb a {
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chapter-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  min-width: 36px;
  margin: 14px auto 8px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-weight: 700;
}

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

.chapter-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.main-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 0;
}

.content-region {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 42px 48px calc(96px + env(safe-area-inset-bottom));
}

.content-region.content-region--wide {
  max-width: 1480px;
}

.content-region.content-region--home {
  padding-top: 20px;
}

.slide-nav-host {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}

.slide-nav-host:empty {
  display: none;
  min-height: 0;
}

.chapter-spur {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 var(--spur-width-current);
  width: var(--spur-width-current);
  min-width: var(--spur-width-current);
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface-soft);
  transition: width 0.18s ease, min-width 0.18s ease, flex-basis 0.18s ease, box-shadow 0.18s ease;
}

.chapter-spur-backdrop {
  display: none;
}

.hub-view .chapter-spur {
  display: none;
}

.hub-view .chapter-spur-backdrop,
.hub-view .chapter-toggle,
.hub-view #chapter-spur-content {
  display: none;
}

.hub-view {
  display: flex;
}
