* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    display: flex;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    flex-direction: row;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

#app {
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
}

.sidebar {
    width: 300px;
    min-width: 300px;
    background-color: #f5f5f5;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    overflow-x: hidden;
    overflow: visible;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    flex-shrink: 0;
    z-index: 2;
}

.sidebar-header {
    padding: 10px 10px 10px 5px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #eee;
    flex-shrink: 0;
}

.book-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-subtitle {
    margin-left: 8px;
    font-size: 14px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 5px 0px 5px;
    margin-top: 5px;
    margin-bottom: 5px;
}

.sidebar.collapsed {
    width: 0px;
    min-width: 0px;
    overflow: relative;
}

.sidebar.collapsed .sidebar-content,
.sidebar.collapsed .sidebar-header {
    padding: 0;
    opacity: 0;
    height: 0;
    overflow: hidden;
    border: none;
}

.toggle-btn {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 14px;
    height: 60px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    font-size: 16px;
    color: #555;
}

.toggle-btn:hover {
    background: #e9e9e9;
}

.toggle-btn:focus {
    outline: none;
}

.content {
    flex: 1;
    min-width: 0; /* 最重要修复 */
    overflow-y: auto;
    padding: 0px 40px 0px 40px;
    height: 100vh;
    background-color: #fff;
    position: relative;
    z-index: 1;
}

.chapter {
    margin-bottom: 5px;
}

.chapter-title {
    font-weight: bold;
    padding: 0px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-title a {
    color: #333;
    text-decoration: none;
    display: block;
    width: 100%;
    padding: 4px 10px;
    transition: all 0.2s ease;
}

.chapter-title a:hover {
    color: #1a73e8;
    background-color: #e9e9e9;
}

.chapter-title a:active {
    color: #0d5bbc;
}

.chapter-title:hover {
    background-color: #e9e9e9;
}

.chapter-title i {
    margin-right: 8px;
    transition: transform 0.3s ease;
    min-width: 16px;
    text-align: center;
}

.chapter-title.collapsed i {
    transform: rotate(-90deg);
}

.sections {
    padding-left: 5px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sections.collapsed {
    height: 0 !important;
    padding: 0;
}

.section {
    padding: 8px 5px;
    cursor: default;
    border-radius: 4px;
    margin: 2px 0;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

h1 {
    margin-bottom: 20px;
    color: #333;
}

p {
    line-height: 1.6;
    margin-bottom: 15px;
}

pre {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

#markdown-content {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

#markdown-content h1,
#markdown-content h2,
#markdown-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 600;
}

#markdown-content p {
  margin-bottom: 1em;
}

#markdown-content pre {
  background: #f5f5f5;
  padding: 1em;
  border-radius: 3px;
  overflow-x: auto;
}

#markdown-content code {
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
}

.footer-bar {
    padding: 10px 0;
    text-align: center;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
    line-height: 1.6;
    margin-top:60px;
}

.footer-bar p {
    margin: 10px 0;
    font-size: 14px;
}

.footer-bar a {
    text-decoration: none;
    color: #6c757d;
    transition: color 0.3s;
}
.footer-bar a:hover {
    color: #6ab0de !important;
}

/* 新增书本封面样式 */
.book-cover {
    width: 350px;
    margin: 20px auto;
    position: relative;
    perspective: 1000px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    transition: transform 0.3s ease;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.book-cover:hover {
    transform: translateY(-5px);
}

.book-cover:hover img {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 10%);
    z-index: 1;
    pointer-events: none;
}

.book-cover::after {
    content: '';
    position: absolute;
    top: 0;
    right: -10px;
    width: 10px;
    height: 100%;
    background: #f5f5f5;
    transform: skewY(45deg);
    transform-origin: left;
    z-index: -1;
}