.reader {
    max-width: 900px;
    margin: auto;
    padding: 30px;
}

.reader-breadcrumb {
    color: #aaa;
    margin-bottom: 20px;
}

    .reader-breadcrumb a {
        color: #b388ff;
        text-decoration: none;
    }

.reader-header {
    text-align: center;
    margin-bottom: 40px;
}

    .reader-header h1 {
        color: #fff;
        font-size: 34px;
    }

    .reader-header h2 {
        color: #c084fc;
        margin-top: 15px;
    }

    .reader-header p {
        color: #999;
    }

.reader-content {
    background: #fff;
    color: #333;
    padding: 45px 10px 45px 10px;
    border-radius: 12px;
    line-height: 1.2;
    font-size: 17px;
    box-shadow: 0 10px 35px rgba(0,0,0,.3);
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 35px;
}

.btn-nav {
    background: #8b5cf6;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
}

    .btn-nav:hover {
        background: #7c3aed;
    }

.btn-disable {
    background: #444;
    color: #999;
    padding: 12px 24px;
    border-radius: 8px;
}

.reader-top-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 25px 0 10px;
}

.reader-btn {
    background: #7c3aed;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: .2s;
}

    .reader-btn:hover {
        background: #6d28d9;
    }

.disable {
    opacity: .5;
    cursor: not-allowed;
}

.chapter-dropdown {
    position: relative;
}

.chapter-menu {
    position: absolute;
    top: 110%;
    left: 0;
    width: 220px;
    max-height: 350px;
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,.3);
    display: none;
    z-index: 1000;
}

    .chapter-menu a {
        display: block;
        padding: 12px 16px;
        color: #333;
        text-decoration: none;
    }

        .chapter-menu a:hover {
            background: #f2f2f2;
        }

.chapter-dropdown:hover .chapter-menu {
    display: block;
}

.chapter-menu {
    display: none;
}

    .chapter-menu.show {
        display: block;
    }

/* ── BOX CHỨA TOÀN BỘ ── */
.comment-section {
    margin-top: 60px;
}

.comment-box {
    background: #0f0f1a;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 24px;
}

.comment-title {
    color: #f3e8ff;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px;
}

/* ── FORM GỬI BÌNH LUẬN ── */
.comment-form {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: transparent;
    border-radius: 0;
    padding-top: 0;
}

    .comment-form form {
        flex: 1;
    }

    .comment-form textarea {
        width: 100%;
        background: #080812;
        border: 1px solid rgba(255,255,255,.15);
        border-radius: 10px;
        color: #f3e8ff;
        font-size: 13px;
        padding: 10px 14px;
        resize: vertical;
        outline: none;
        font-family: inherit;
        line-height: 1.6;
        min-height: 72px;
        transition: border-color .15s;
    }

        .comment-form textarea:focus {
            border-color: #a855f7;
        }

        .comment-form textarea::placeholder {
            color: rgba(255,255,255,.25);
        }

    .comment-form button {
        display: block;
        margin-top: 8px;
        margin-left: auto;
        background: #7c3aed;
        color: #fff;
        border: none;
        border-radius: 8px;
        padding: 7px 18px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        font-family: inherit;
        transition: background .12s;
    }

        .comment-form button:hover {
            background: #6d28d9;
        }

/* ── AVATAR (dùng chung form + list) ── */
.comment-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Avatar nhỏ hơn trong list */
.comment-list .comment-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 12px;
}

/* ── DANH SÁCH BÌNH LUẬN ── */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 0;
}

/* ── TỪNG COMMENT ── */
.comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

/* Hàng avatar + tên + thời gian */
.comment-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.comment-user {
    font-size: 12px;
    font-weight: 700;
    color: #d8b4fe;
}

.comment-time {
    font-size: 10px;
    color: rgba(255,255,255,.3);
    margin-left: auto;
}

/* Bubble — width co theo nội dung */
.comment-content {
    display: inline-block;
    background: linear-gradient(135deg, rgba(124,58,237,.35), rgba(168,85,247,.2));
    border: 1px solid rgba(168,85,247,.3);
    border-radius: 4px 14px 14px 14px;
    padding: 8px 14px;
    color: #f3e8ff;
    font-size: 11px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
    width: fit-content;
    margin-top: 0;
}

.reader-line {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
}

.line-number {
    width: 50px;
    text-align: right;
    color: #999;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

    .line-number:hover {
        color: #8b5cf6;
        font-weight: 700;
    }

.line-content {
    flex: 1;
}

.bookmark-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9999;
}

.bookmark-box {
    width: 450px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
}

    .bookmark-box textarea {
        width: 100%;
        min-height: 120px;
    }

.line-number {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bbb;
    border-radius: 6px;
    cursor: pointer;
    transition: .2s;
}

    .line-number.bookmarked {
        background: #8b5cf6;
        color: #fff;
        border-color: #8b5cf6;
        font-weight: bold;
    }

    .line-number:hover {
        transform: scale(1.05);
    }

    .line-number.bookmarked::after {
        content: "★";
        position: absolute;
        top: -6px;
        right: -4px;
        font-size: 10px;
        color: gold;
    }

.bookmark-focus {
    animation: blinkBookmark .8s ease-in-out 3;
}

@keyframes blinkBookmark {

    0% {
        transform: scale(1);
        box-shadow: 0 0 0 transparent;
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 15px #8b5cf6;
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 transparent;
    }
}

@media (max-width: 767.98px) {
    .reader { padding: 20px 12px; }
    .reader-breadcrumb { font-size: 12px; line-height: 1.7; margin-bottom: 14px; }
    .reader-header { margin-bottom: 24px; }
    .reader-header h1 { font-size: 24px; }
    .reader-header h2 { font-size: 18px; margin-top: 10px; }
    .reader-top-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .chapter-dropdown { grid-column: 1 / -1; order: -1; }
    .reader-btn { display: flex; align-items: center; justify-content: center; width: 100%; padding: 9px 10px; font-size: 12px; }
    .chapter-menu { width: 100%; max-height: min(50vh, 300px); }
    .reader-content { padding: 24px 12px; font-size: 16px; line-height: 1.65; }
    .reader-line { gap: 8px; margin-bottom: 10px; align-items: flex-start; }
    .line-number { flex: 0 0 18px; margin-top: 4px; }
    .line-content { min-width: 0; overflow-wrap: anywhere; }
    .comment-section { margin-top: 36px; }
    .comment-box { padding: 16px 12px; }
    .comment-form { gap: 8px; }
    .comment-avatar { width: 30px; height: 30px; min-width: 30px; font-size: 12px; }
    .comment-form textarea { font-size: 13px; }
    .comment-form button { width: 100%; margin-left: 0; }
    .bookmark-box { width: calc(100% - 24px); padding: 16px; }
}
