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

[hidden] {
    display: none !important;
}

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f7f5f2;
    color: #333;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* 导航 */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

.nav-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 16px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.detail-nav .nav-back,
.nav-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #555;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.nav-back:hover {
    background: #ececec;
    color: var(--primary);
}

.detail-nav .nav-title {
    font-size: 17px;
    font-weight: 600;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar-btn {
    background: none;
    border: none;
    padding: 0;
    border-radius: 50%;
}

.avatar-btn img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: block;
    border: 1px solid #eee;
}

/* 头像弹窗 */
.avatar-menu {
    position: absolute;
    top: 58px;
    right: max(16px, calc((100vw - var(--content-width)) / 2 + 16px));
    width: 180px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    padding: 6px;
    z-index: 200;
    max-height: 288px;
    overflow-y: auto;
}

.avatar-menu a,
.avatar-menu .menu-toggle,
.avatar-menu .menu-search {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: none;
    font-size: 14px;
    color: #333;
    border-radius: 6px;
    text-align: left;
}

.avatar-menu a:hover,
.avatar-menu .menu-toggle:hover,
.avatar-menu .menu-search:hover {
    background: #f5f5f5;
    color: var(--primary);
}

.avatar-menu .arrow {
    font-size: 12px;
    color: #999;
    transition: transform .2s;
}

.avatar-menu .menu-sub {
    margin: 2px 0 4px 8px;
    border-left: 2px solid #eee;
    padding-left: 6px;
}

.avatar-menu .menu-sub a {
    font-size: 13px;
    color: #555;
}

/* 搜索弹窗 */
.search-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 300;
}

.search-pop {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(360px, 90vw);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
    padding: 16px;
    z-index: 310;
}

.search-pop form {
    display: flex;
    gap: 8px;
}

.search-pop input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.search-pop input:focus {
    border-color: var(--primary);
}

.search-pop button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0 20px;
    font-size: 14px;
}

.search-pop button:hover {
    opacity: .9;
}

/* 页面主体 */
.page-wrap {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 16px;
}

.intro-bar {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    font-size: 15px;
    color: #555;
}

.intro-bar .intro-name {
    color: var(--primary);
    font-weight: 600;
}

.batch-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

/* 列表 */
.book-list {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.book-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f2f2f2;
}

.book-item:last-child {
    border-bottom: none;
}

.book-item:hover {
    background: #faf6f0;
}

.book-check {
    margin-right: 10px;
}

.book-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.book-main {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: flex-start;
    gap: 14px;
}

.book-cover {
    width: 60px;
    height: 80px;
    border-radius: 4px;
    object-fit: cover;
    background: #eee;
    flex-shrink: 0;
}

.book-info {
    min-width: 0;
}

.book-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-item:hover .book-title {
    color: var(--primary);
}

.book-meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 6px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.tag {
    display: inline-block;
    padding: 1px 8px;
    font-size: 12px;
    color: var(--primary);
    background: rgba(0, 0, 0, .04);
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 4px;
}

.book-intro {
    font-size: 13px;
    color: #777;
    line-height: 1.7;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.del-one {
    border: 1px solid #ddd;
    background: #fff;
    color: #c0392b;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 13px;
    margin-left: 12px;
    flex-shrink: 0;
}

.del-one:hover {
    background: #fdecea;
    border-color: #e0a3a0;
}

.empty {
    padding: 60px 0;
    text-align: center;
    color: #999;
}

/* 我的评论 */
.my-comment-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.my-comment-main {
    flex: 1;
    min-width: 0;
    color: inherit;
}

.my-comment-content {
    font-size: 15px;
    line-height: 1.7;
    word-break: break-all;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.my-comment-meta {
    margin-top: 6px;
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.my-comment-meta .tag {
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12px;
}

.my-comment-item:hover .my-comment-content {
    color: var(--primary);
}

.my-comment-time {
    margin-left: auto;
}

/* 按钮 */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-primary:hover {
    opacity: .9;
}

.detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    margin-bottom: 15px;
}

.btn-plain {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: #555;
}

.btn-plain:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-plain.disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* 分页 */
.pager {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.pager a,
.pager span {
    min-width: 32px;
    padding: 6px 10px;
    text-align: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
}

.pager a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pager .current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* 书本详情 */
.detail-main {
    display: flex;
    gap: 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 14px;
}

.detail-cover img {
    width: 120px;
    height: 160px;
    border-radius: 6px;
    object-fit: cover;
    background: #eee;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.detail-title {
    font-size: 24px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #777;
    font-size: 14px;
    min-width: 0;
}

.detail-meta .tag {
    flex-shrink: 0;
}

.detail-meta span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.detail-counts {
    color: #999;
    font-size: 14px;
}

.detail-intro,
.detail-catalog {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.section-title {
    font-size: 17px;
    font-weight: 600;
    border-left: 4px solid var(--primary);
    padding-left: 10px;
    margin-bottom: 14px;
}

.detail-intro p {
    font-size: 14px;
    line-height: 1.9;
    color: #555;
}

.volume-title {
    font-size: 15px;
    font-weight: 600;
    color: #666;
    margin: 16px 0 10px;
    position: relative;
    padding-right: 24px;
    cursor: pointer;
    user-select: none;
}

.volume-title::after {
    content: '▾';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #999;
    transition: transform .2s;
}

.volume-title.collapsed::after {
    transform: translateY(-50%) rotate(-90deg);
}

.chapter-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    overflow: hidden;
}

@media (max-width: 480px) {
    .chapter-grid {
        grid-template-columns: 1fr;
    }
}

.chapter-grid li {
    min-width: 0;
    overflow: hidden;
}

.chapter-grid a {
    display: block;
    min-width: 0;
    padding: 8px 12px;
    font-size: 13px;
    color: #555;
    background: #fafafa;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-grid a:hover {
    color: var(--primary);
    background: #f7efe6;
}

/* 认证页面 */
.auth-wrap {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 60px 16px;
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 360px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-card h2 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 6px;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.auth-card input:focus {
    border-color: var(--primary);
}

.auth-card .btn-primary {
    width: 100%;
}

.auth-error {
    background: #fdecea;
    color: #c0392b;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
}

.auth-link {
    font-size: 13px;
    color: #888;
    text-align: center;
}

.auth-link a {
    color: var(--primary);
}

.auth-username {
    font-size: 14px;
    color: #666;
}

.auth-divider {
    border: none;
    border-top: 1px dashed #ddd;
    margin: 4px 0;
}

/* 页脚 */
.site-footer {
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 13px;
    color: #999;
}