:root {
  --sidebar-bg: #2c3e50;
  --sidebar-text: #ecf0f1;
  --active-item: #3498db;
  --hover-item: #34495e;
  --error-text: #e74c3c;
  --content-bg: #f5f5f5;
  --paper-bg: white;
}

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

body {
  margin: 0;
  display: flex;
  font-family: 'Segoe UI', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  min-height: 100vh;
}

.container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

#sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 15px;
}

#sidebar h1 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#sidebar h1 a {
  color: var(--sidebar-text);
  text-decoration: none;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
}

#book-list {
  list-style: none;
  padding: 0;
}

#book-list li {
  position: relative;
  padding: 4px 5px;
  margin: 5px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

#book-list li:hover {
  background: var(--hover-item);
}

#book-list li.active {
  background: var(--active-item);
  color: white;
}

#book-list li.expanded > ul {
  display: block;
}

#book-list li.expandable {
  position: relative;
  padding-left: 20px;
}

#book-list li.expandable::before {
  content: '○';
  position: absolute;
  left: 0;
  width: 1em;
  display: inline-block;
  text-align: center;
  font-size: 1em;
  margin-right: 0.5em;
}

#book-list li.expandable.expanded::before {
  content: '●';
  position: absolute;
  left: 0;
  width: 1em;
  display: inline-block;
  text-align: center;
  font-size: 1em;
  margin-right: 0.5em;
}

#book-list li:not(.expandable) {
  padding-left: 20px;
}

#book-list ul {
  list-style: none;
  padding-left: 15px;
  margin: 5px 0;
  display: none;
}

#book-list a {
  text-decoration: none;
  color: inherit;
  display: inline-block;
  width: 100%;
  height: 100%;
}

#content {
  flex: 1;
  padding: 20px;
  background: var(--content-bg);
}

.paper {
  background: var(--paper-bg);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  max-width: 960px;
  min-height: 1360px;
  margin: 0 auto;
  font-family: "Liberation Mono", "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
  font-size: 14px;
  line-height: 1.2;
}

.paper h1 {
  text-align: center;
  margin-bottom: 1em;
}
.paper h2 {
  text-align: center;
  margin-bottom: 1em;
}
.paper h3 {
  text-align: center;
  margin-bottom: 1em;
}

.paper .indent {
  text-indent: 2em;
  margin-bottom: 1em;
}

.paper .paragraph {
  text-indent: 0;
  margin-bottom: 1em;
}

.error {
  color: var(--error-text);
  padding: 0;
  border-radius: 4px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  #sidebar {
    max-height: 60px;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  #sidebar.expanded {
    max-height: 1000px;
  }

  .mobile-toggle {
    display: block;
  }
}

@media (min-width: 769px) {
  .container {
    flex-direction: row;
  }

  #sidebar {
    width: 300px;
    min-height: 100vh;
  }
}
