/* --------------------------------------------------------------------------
   1. SINGLE CHAP (templates/single-chap.php) - Modern Reader Styles
   -------------------------------------------------------------------------- */
html, body.single-chap {
    max-width: 100vw;
    overflow-x: clip;
}
#reader-container {
    max-width: 950px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}
.chapter-title { text-align: center; margin-bottom: 30px; font-weight: 800; line-height: 1.4; word-break: break-word; }
.chapter-content { font-size: 18px; line-height: 1.8; text-align: justify; word-break: break-word; }
.chapter-content p { margin-bottom: 1.5rem; }

/* Sticky Reader Header Bar */
.reader-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 8px 16px;
    transition: background 0.3s ease;
    width: 100%;
}
body.single-chap .reader-header {
    top: 0px !important;
}
.reader-header.is-stuck {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1050 !important;
}
body.admin-bar .reader-header.is-stuck {
    top: 32px !important;
}
@media (max-width: 782px) {
    body.admin-bar .reader-header.is-stuck {
        top: 46px !important;
    }
}
body.dark-mode .reader-header,
body.theme-dark .reader-header,
body.theme-midnight .reader-header {
    background: rgba(38, 38, 38, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .reader-header .reader-header-title a,
body.theme-dark .reader-header .reader-header-title a,
body.theme-midnight .reader-header .reader-header-title a {
    color: #f8fafc !important;
}

body.dark-mode .reader-header .reader-header-title span,
body.theme-dark .reader-header .reader-header-title span,
body.theme-midnight .reader-header .reader-header-title span {
    color: #94a3b8 !important;
}

/* Sepia Mode Header */
body.theme-sepia .reader-header {
    background: #f4ecd8 !important;
    border-bottom-color: #e3d3b6 !important;
}
body.theme-sepia .reader-header .reader-header-title a {
    color: #5f4b32 !important;
}
body.theme-sepia .reader-header .reader-header-title span {
    color: #8c7355 !important;
}

.reader-header-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.reader-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #495057;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
}
.reader-header-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--gdwp-primary, #fa7a41);
    transform: translateY(-1px);
}
.reader-header-btn.active {
    background: var(--gdwp-primary, #fa7a41);
    color: #fff !important;
}
.reader-header-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}
body.dark-mode .reader-header-btn,
body.theme-dark .reader-header-btn,
body.theme-midnight .reader-header-btn {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.08);
}
body.dark-mode .reader-header-btn:hover,
body.theme-dark .reader-header-btn:hover,
body.theme-midnight .reader-header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ff9f75;
}
body.theme-sepia .reader-header-btn {
    color: #5f4b32 !important;
    background: #fbf0d9 !important;
    border-color: #e3d3b6 !important;
}
body.theme-sepia .reader-header-btn:hover {
    background: #eedebd !important;
    color: #3d2e1e !important;
}

/* Scoped theme variables for #reader-outer-wrap only */
#reader-outer-wrap.theme-light { 
    --td-bg-body: #f6f6f6; 
    --td-text-color: #333333; 
    --td-card-bg: #ffffff; 
    --td-border-color: #eaeaea; 
    --td-bg-light: #f6f6f6; 
}
#reader-outer-wrap.theme-sepia { 
    --td-bg-body: #f4ecd8; 
    --td-text-color: #5b4636; 
    --td-card-bg: #fbf5e6; 
    --td-border-color: #d7cbb1; 
    --td-bg-light: #f4ecd8; 
}
#reader-outer-wrap.theme-dark { 
    --td-bg-body: #1a1a1a; 
    --td-text-color: #e2e8f0; 
    --td-card-bg: #242424; 
    --td-border-color: rgba(255, 255, 255, 0.1); 
    --td-bg-light: #242424; 
}

.color-option { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; display: inline-block; transition: transform 0.2s ease, border-color 0.2s ease; }
.color-option.selected { border-color: var(--gdwp-primary, #fa7a41); transform: scale(1.15); box-shadow: 0 2px 8px rgba(250, 122, 65, 0.4); }
.bg-opt-light { background-color: #f8f9fa; border: 1px solid #ccc; }
.bg-opt-sepia { background-color: #f4ecd8; border: 1px solid #d7cbb1; }
.bg-opt-dark { background-color: #1a1a1a; border: 1px solid #555; }

/* Reader Board Theme Overrides - Scoped inside #reader-outer-wrap */
.reader-board { background-color: #ffffff; color: #212529; transition: all 0.3s ease; }

/* 1. Theme Light inside #reader-outer-wrap */
#reader-outer-wrap.theme-light .reader-board { background-color: #ffffff !important; color: #212529 !important; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important; }
#reader-outer-wrap.theme-light .chapter-title { color: #212529 !important; }
#reader-outer-wrap.theme-light .chapter-content,
#reader-outer-wrap.theme-light .chapter-content p,
#reader-outer-wrap.theme-light #chapter-content-text { color: #212529 !important; }
#reader-outer-wrap.theme-light .reader-board .text-dark { color: #212529 !important; }
#reader-outer-wrap.theme-light .reader-board .text-secondary,
#reader-outer-wrap.theme-light .reader-board .text-muted { color: #64748b !important; }
#reader-outer-wrap.theme-light .reader-board hr { border-color: rgba(0, 0, 0, 0.08) !important; }
#reader-outer-wrap.theme-light .reader-board .bg-light { background-color: #f8f9fa !important; color: #212529 !important; }
#reader-outer-wrap.theme-light .chapter-comments-section.border-top { border-top-color: rgba(0, 0, 0, 0.08) !important; }
#reader-outer-wrap.theme-light .comments-title,
#reader-outer-wrap.theme-light #comments .comments-title,
#reader-outer-wrap.theme-light .chapter-comments-section #comments .comments-title { color: #212529 !important; }

/* 2. Theme Sepia inside #reader-outer-wrap */
#reader-outer-wrap.theme-sepia .reader-board { background-color: #fbf5e6 !important; color: #5b4636 !important; }
#reader-outer-wrap.theme-sepia .chapter-title { color: #5b4636 !important; }
#reader-outer-wrap.theme-sepia .chapter-content,
#reader-outer-wrap.theme-sepia .chapter-content p,
#reader-outer-wrap.theme-sepia #chapter-content-text { color: #5b4636 !important; }
#reader-outer-wrap.theme-sepia .chapter-comments-section.border-top { border-top-color: rgba(91, 70, 54, 0.15) !important; }
#reader-outer-wrap.theme-sepia .comments-title,
#reader-outer-wrap.theme-sepia #comments .comments-title,
#reader-outer-wrap.theme-sepia .chapter-comments-section #comments .comments-title { color: #433422 !important; }

/* 3. Theme Dark inside #reader-outer-wrap */
#reader-outer-wrap.theme-dark .reader-board { background-color: #242424 !important; color: #e2e8f0 !important; }
#reader-outer-wrap.theme-dark .chapter-title { color: #e2e8f0 !important; }
#reader-outer-wrap.theme-dark .chapter-content,
#reader-outer-wrap.theme-dark .chapter-content p,
#reader-outer-wrap.theme-dark #chapter-content-text { color: #e2e8f0 !important; }
#reader-outer-wrap.theme-dark .chapter-comments-section.border-top { border-top-color: rgba(255, 255, 255, 0.1) !important; }
#reader-outer-wrap.theme-dark .comments-title,
#reader-outer-wrap.theme-dark #comments .comments-title,
#reader-outer-wrap.theme-dark .chapter-comments-section #comments .comments-title { color: #e2e8f0 !important; }

/* 4. Default Dark Mode from Site */
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) .reader-board { background-color: #242424 !important; color: #e2e8f0 !important; }
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) .chapter-title { color: #e2e8f0 !important; }
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) .chapter-content,
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) .chapter-content p,
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) #chapter-content-text { color: #e2e8f0 !important; }
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) .chapter-comments-section.border-top { border-top-color: rgba(255, 255, 255, 0.1) !important; }
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) .comments-title,
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) #comments .comments-title,
body.dark-mode #reader-outer-wrap:not(.theme-light):not(.theme-sepia) .chapter-comments-section #comments .comments-title { color: #e2e8f0 !important; }

/* Settings Modal - Dark Themes */
body.dark-mode #settingsModal .modal-content,
body.theme-dark #settingsModal .modal-content,
body.theme-midnight #settingsModal .modal-content {
    background-color: #242426 !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
body.dark-mode #settingsModal .modal-header,
body.theme-dark #settingsModal .modal-header,
body.theme-midnight #settingsModal .modal-header {
    background-color: #1c1c1e !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
body.dark-mode #settingsModal .modal-title,
body.theme-dark #settingsModal .modal-title,
body.theme-midnight #settingsModal .modal-title {
    color: #f3f4f6 !important;
}
body.dark-mode #settingsModal .btn-close,
body.theme-dark #settingsModal .btn-close,
body.theme-midnight #settingsModal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
}
body.dark-mode #settingsModal .modal-body label,
body.dark-mode #settingsModal label.form-label,
body.dark-mode #settingsModal .text-muted,
body.dark-mode #settingsModal .text-secondary,
body.theme-dark #settingsModal .modal-body label,
body.theme-dark #settingsModal label.form-label,
body.theme-dark #settingsModal .text-muted,
body.theme-dark #settingsModal .text-secondary {
    color: #cbd5e1 !important;
}
body.dark-mode #settingsModal .form-select,
body.theme-dark #settingsModal .form-select {
    background-color: #1a1a1c !important;
    border-color: #38383c !important;
    color: #e2e8f0 !important;
}
body.dark-mode #settingsModal .btn-outline-secondary,
body.theme-dark #settingsModal .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #e2e8f0 !important;
}
body.dark-mode #settingsModal .btn-outline-secondary:hover,
body.theme-dark #settingsModal .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}
body.dark-mode #settingsModal .border-top,
body.theme-dark #settingsModal .border-top {
    border-top-color: rgba(255, 255, 255, 0.08) !important;
}
body.dark-mode #settingsModal .bg-light,
body.theme-dark #settingsModal .bg-light {
    background-color: #1c1c1e !important;
}
body.dark-mode #settingsModal div[style*="background: rgba(0,0,0,0.03)"],
body.theme-dark #settingsModal div[style*="background: rgba(0,0,0,0.03)"] {
    background: rgba(255, 255, 255, 0.06) !important;
}

/* Settings Modal - Sepia Theme */
body.theme-sepia #settingsModal .modal-content {
    background-color: #fbf0d9 !important;
    color: #5f4b32 !important;
    border: 1px solid #e3d3b6 !important;
}
body.theme-sepia #settingsModal .modal-header {
    background-color: #f4ecd8 !important;
    border-bottom-color: #e3d3b6 !important;
}
body.theme-sepia #settingsModal .modal-title {
    color: #5f4b32 !important;
}
body.theme-sepia #settingsModal .modal-body label,
body.theme-sepia #settingsModal label.form-label,
body.theme-sepia #settingsModal .text-muted,
body.theme-sepia #settingsModal .text-secondary {
    color: #786144 !important;
}
body.theme-sepia #settingsModal .form-select {
    background-color: #f4ecd8 !important;
    border-color: #e3d3b6 !important;
    color: #5f4b32 !important;
}
body.theme-sepia #settingsModal .btn-outline-secondary {
    border-color: #d4bf9c !important;
    color: #5f4b32 !important;
}
body.theme-sepia #settingsModal .btn-outline-secondary:hover {
    background-color: #e3d3b6 !important;
    color: #3d2e1e !important;
}
body.theme-sepia #settingsModal .border-top {
    border-top-color: #e3d3b6 !important;
}
body.theme-sepia #settingsModal .bg-light {
    background-color: #f4ecd8 !important;
}

/* Chap List Modal */
#gdwp-chap-list-content, #td-chap-list-content { max-height: 60vh; overflow-y: auto; }
.chap-item-active { background-color: var(--gdwp-primary, #fa7a41); color: #fff !important; }
.gdwp-chap-search-bar, .td-chap-search-bar { background-color: #fff; }
.gdwp-chap-search-input, .td-chap-search-input { background-color: #f8f9fa; }

body.dark-mode #gdwp-chap-list-modal .modal-content,
body.theme-dark #gdwp-chap-list-modal .modal-content {
    background-color: #242426 !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
body.dark-mode #gdwp-chap-list-modal .gdwp-chap-search-bar,
body.theme-dark #gdwp-chap-list-modal .gdwp-chap-search-bar {
    background-color: #242426 !important;
}
body.dark-mode #gdwp-chap-list-modal #gdwp-chap-search,
body.theme-dark #gdwp-chap-list-modal #gdwp-chap-search {
    background-color: #1a1a1c !important;
    color: #e2e8f0 !important;
    border: 1px solid #38383c !important;
}
body.dark-mode #gdwp-chap-list-modal .list-group-item,
body.theme-dark #gdwp-chap-list-modal .list-group-item {
    background-color: #242426 !important;
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
body.dark-mode #gdwp-chap-list-modal .list-group-item:hover,
body.theme-dark #gdwp-chap-list-modal .list-group-item:hover {
    background-color: #2c2c30 !important;
}


/* --------------------------------------------------------------------------
   7. CUSTOM CHAPTER SETTINGS PANEL (Image 2 Design)
   -------------------------------------------------------------------------- */
.chapters-fonts-settings {
    position: fixed;
    width: 350px;
    background-color: #151515;
    border: 1px solid #27272a;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    z-index: 1050;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-sizing: border-box;
    --drag-y: 0px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
}

.chapters-fonts-settings.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.chapters-fonts-settings.dragging {
    transition: none !important;
}

.chapters-fonts-settings-handle {
    width: 40px;
    height: 4px;
    background-color: #3f3f46;
    border-radius: 9999px;
    margin: -8px auto 12px auto;
    cursor: grab;
    display: block;
}

.chapters-fonts-settings-handle:active {
    cursor: grabbing;
}

.chapters-fonts-settings .inner-row {
    margin-bottom: 18px;
}

.chapters-fonts-settings .inner-row:last-child {
    margin-bottom: 0;
}

/* Theme buttons section */
.chapters-fonts-settings .font-size-16 {
    font-size: 12px;
    font-weight: 600;
    color: #e4e4e7;
    text-transform: none;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 12px;
    border-bottom: 1px solid #27272a;
    padding-bottom: 4px;
}

.chapters-fonts-settings .font-theme-buttons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.chapters-fonts-settings .font-button {
    background: transparent;
    border: none;
    color: #a1a1aa;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0;
    transition: color 0.2s;
}

.chapters-fonts-settings .font-button:hover {
    color: #ffffff;
}

.chapters-fonts-settings .font-button .icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid transparent;
    transition: all 0.2s;
}

/* Specific button styles */
.chapters-fonts-settings .font-button.night .icon {
    background-color: #000000;
    color: #e4e4e7;
    border-color: #27272a;
}
.chapters-fonts-settings .font-button.onyx .icon {
    background-color: #18181b;
    color: #f4f4f5;
    border-color: #3f3f46;
}
.chapters-fonts-settings .font-button.dusk .icon {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}
.chapters-fonts-settings .font-button.sepia .icon {
    background-color: #f4ecd8;
    color: #5b4636;
}
.chapters-fonts-settings .font-button.silver .icon {
    background-color: #cbd5e1;
    color: #1e293b;
}
.chapters-fonts-settings .font-button.frost .icon {
    background-color: #ffffff;
    color: #09090b;
    border-color: #e4e4e7;
}

/* Selected state for theme */
.chapters-fonts-settings .font-button.selected .icon {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}
.chapters-fonts-settings .font-button.selected {
    color: #ffffff;
    font-weight: 600;
}

/* Label styling for other rows */
.chapters-fonts-settings label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 0;
}

.chapters-fonts-settings .setting-label,
.chapters-fonts-settings label > span {
    font-size: 11px !important;
    font-weight: 500 !important;
    color: #9ca3af !important;
    text-transform: none !important;
    letter-spacing: 0.02em;
    display: inline-block;
}

/* Tăng khoảng cách dọc cho nhãn khi nằm trên điều khiển */
.chapters-fonts-settings label.flex-column .setting-label {
    margin-bottom: 6px !important;
}

/* Layout 2 cột */
.chapters-fonts-settings .two-cols-row {
    display: flex;
    gap: 24px;
    margin-bottom: 18px;
}
.chapters-fonts-settings .two-cols-row .col-item {
    flex: 1;
    min-width: 0;
}
.chapters-fonts-settings .two-cols-row .col-item.flex {
    display: flex;
}

/* Đồng bộ hóa select dropdown trong panel */
.chapters-fonts-settings select {
    width: 100%;
    background-color: #1c1c1e;
    border: 1px solid #27272a;
    border-radius: 6px;
    color: #ffffff;
    height: 24px;
    padding: 0 20px 0 8px;
    line-height: 22px;
    font-size: 10px;
    font-weight: 400;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.chapters-fonts-settings select:focus {
    outline: none;
    border-color: #6366f1;
}

.tts-voice-select-wrapper select {
    background: #1c1c1e;
    border: 1px solid rgb(171 171 171 / 17%);
    border-radius: 4px;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}

/* Font Family wrapper */
.chapters-fonts-settings .fontfamily-select-wrapper {
    position: relative;
    width: 100% !important;
}

.chapters-fonts-settings #chapters-fonts-family {
    width: 100%;
    background-color: #1c1c1e;
    border: 1px solid #27272a;
    border-radius: 6px;
    color: #ffffff;
    padding: 0 25px 0 8px;
    line-height: 22px;
    font-size: 10px;
    font-weight: 400;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    height: 24px;
}

.chapters-fonts-settings #chapters-fonts-family:focus {
    outline: none;
    border-color: #6366f1;
}

.chapters-fonts-settings .fontfamily-select-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #a1a1aa;
    pointer-events: none;
}

/* Adjust components (plus/minus counters) */
.chapters-fonts-settings .group-adjust {
    display: flex;
    gap: 6px;
    align-items: center;
}

.chapters-fonts-settings .group-adjust button {
    width: 24px;
    height: 24px;
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 4px;
    color: #a1a1aa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chapters-fonts-settings .group-adjust button:hover {
    background-color: #27272a;
    border-color: #3f3f46;
    color: #ffffff;
}

.chapters-fonts-settings .group-adjust button svg {
    width: 10px;
    height: 10px;
}

.chapters-fonts-settings .group-adjust input {
    width: 30px;
    height: 24px;
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 4px;
    color: #ffffff;
    text-align: center;
    font-weight: 400;
    font-size: 10px;
    outline: none;
}

.chapters-fonts-settings .group-adjust input::-webkit-outer-spin-button,
.chapters-fonts-settings .group-adjust input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.chapters-fonts-settings .group-adjust input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Alignment buttons */
.chapters-fonts-settings .alignment-buttons button {
    width: 28px;
    height: 24px;
    background-color: #18181b;
    border: 1px solid #27272a;
    border-radius: 4px;
    color: #a1a1aa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chapters-fonts-settings .alignment-buttons button:hover {
    color: #ffffff;
    background-color: #27272a;
}

.chapters-fonts-settings .alignment-buttons button.selected {
    background-color: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

/* Switch styling for Text Indent */
.chapters-fonts-settings .switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    margin-left: 10px !important; /* Tránh chạm sát nhãn */
}

.chapters-fonts-settings .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.chapters-fonts-settings .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #18181b;
    border: 1px solid #27272a;
    transition: .3s;
    border-radius: 18px;
}

.chapters-fonts-settings .slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: #a1a1aa;
    transition: .3s;
    border-radius: 50%;
}

.chapters-fonts-settings input:checked + .slider {
    background-color: #6366f1;
    border-color: #6366f1;
}

.chapters-fonts-settings input:checked + .slider:before {
    transform: translateX(16px);
    background-color: #ffffff;
}

/* Reset Button */
.chapters-fonts-settings .footer-button {
    width: 100%;
    background-color: #6366f1;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 6px;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.chapters-fonts-settings .footer-button:hover {
    background-color: #4f46e5;
}

/* Position classes */
.chapters-fonts-settings.position-bottom-right {
    bottom: 85px;
    right: 20px;
    transform: translateY(calc(30px + var(--drag-y, 0px)));
}
.chapters-fonts-settings.position-bottom-right.active {
    transform: translateY(var(--drag-y, 0px));
}

.chapters-fonts-settings.position-bottom-left {
    bottom: 85px;
    left: 20px;
    transform: translateY(calc(30px + var(--drag-y, 0px)));
}
.chapters-fonts-settings.position-bottom-left.active {
    transform: translateY(var(--drag-y, 0px));
}

.chapters-fonts-settings.position-bottom-center {
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(30px + var(--drag-y, 0px)));
}
.chapters-fonts-settings.position-bottom-center.active {
    transform: translateX(-50%) translateY(var(--drag-y, 0px));
}

.chapters-fonts-settings.position-center-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-40% + var(--drag-y, 0px)));
}
.chapters-fonts-settings.position-center-center.active {
    transform: translate(-50%, calc(-50% + var(--drag-y, 0px)));
}

/* Mobile responsive override */
@media (max-width: 576px) {
    .chapters-fonts-settings {
        width: auto !important;
        max-width: 400px !important;
        left: 12px !important;
        right: 12px !important;
        margin: 0 auto !important;
        bottom: 80px !important;
        transform: translateY(calc(120% + var(--drag-y, 0px))) !important;
        top: auto !important;
        max-height: calc(100vh - 95px) !important;
        overflow-y: auto !important;
        padding: 14px 12px 12px 12px !important;
        border-radius: 20px 20px 16px 16px !important;
        box-sizing: border-box !important;
    }
    .chapters-fonts-settings.active {
        transform: translateY(var(--drag-y, 0px)) !important;
    }
    .chapters-fonts-settings .two-cols-row {
        margin-bottom: 10px !important;
        gap: 20px !important;
    }
    .chapters-fonts-settings .inner-row {
        margin-bottom: 12px !important;
    }
    .chapters-fonts-settings .font-size-16 {
        margin-bottom: 14px !important;
    }
    .chapters-fonts-settings .font-theme-buttons {
        gap: 6px !important;
    }
    .chapters-fonts-settings .font-button {
        font-size: 10px !important;
    }
    .chapters-fonts-settings .font-button .icon {
        width: 28px !important;
        height: 28px !important;
        font-size: 11px !important;
    }
    .chapters-fonts-settings .group-adjust button {
        width: 24px !important;
        height: 24px !important;
    }
    .chapters-fonts-settings .group-adjust input {
        width: 30px !important;
        height: 24px !important;
        font-size: 10px !important;
        font-weight: 400 !important;
    }
    .chapters-fonts-settings .alignment-buttons button {
        width: 28px !important;
        height: 24px !important;
    }
    .chapters-fonts-settings select,
    .chapters-fonts-settings #chapters-fonts-family {
        height: 24px !important;
        font-size: 10px !important;
        font-weight: 400 !important;
        padding: 0 20px 0 8px !important;
        line-height: 22px !important;
    }
    .chapters-fonts-settings .switch {
        width: 34px !important;
        height: 18px !important;
    }
    .chapters-fonts-settings .slider:before {
        height: 10px !important;
        width: 10px !important;
        left: 3px !important;
        bottom: 3px !important;
    }
    .chapters-fonts-settings input:checked + .slider:before {
        transform: translateX(16px) !important;
    }
    /* Hide pagination text on mobile and make buttons circular */
    .reader-bottom-btn .nav-text {
        display: none !important;
    }
    .reader-bottom-btn i:first-child,
    .reader-bottom-btn i:last-child {
        margin: 0 !important;
        font-size: 0.95rem !important;
    }
    .reader-bottom-btn {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        padding: 0 !important;
    }
}

/* Further overrides for screen widths 425px and below */
@media (max-width: 425px) {
    .chapters-fonts-settings .font-size-16,
    .chapters-fonts-settings label > span,
    .chapters-fonts-settings .inner-row > div > span,
    .chapters-fonts-settings .inner-row .small {
        font-size: 11px !important;
        text-transform: none !important;
        letter-spacing: normal !important;
    }
    .chapters-fonts-settings .footer-button {
        text-transform: none !important;
        letter-spacing: normal !important;
    }
    /* Section titles adjustments */
    .bt-section-title,
    .related-stories-section h4 {
        font-size: 16px !important;
    }
    /* Trending & Related stories card adjustments on small screens */
    .trending-story-badge {
        font-size: 8px !important;
        padding: 2px 4px !important;
        border-radius: 4px !important;
    }
    .trending-story-title {
        font-size: 12px !important;
        height: 32px !important;
    }
    .trending-story-cats {
        font-size: 10px !important;
    }
    .trending-rank-number {
        font-size: 1.75rem !important;
    }
}

/* --------------------------------------------------------------------------
   8. NEW READING THEMES & TEXT INDENT
   -------------------------------------------------------------------------- */
body.theme-light { background-color: #f8f9fa !important; color: #212529 !important; color-scheme: light !important; }
body.theme-sepia { background-color: #f4ecd8 !important; color: #5b4636 !important; color-scheme: light !important; }
body.theme-dark { background-color: #1a1a1a !important; color: #d1d1d1 !important; color-scheme: dark !important; }
body.theme-night { background-color: #09090b !important; color: #e4e4e7 !important; color-scheme: dark !important; }
body.theme-onyx { background-color: #18181b !important; color: #f4f4f5 !important; color-scheme: dark !important; }
body.theme-dusk { background-color: #0f172a !important; color: #e2e8f0 !important; color-scheme: dark !important; }
body.theme-silver { background-color: #e2e8f0 !important; color: #18181b !important; color-scheme: light !important; }
body.theme-frost { background-color: #ffffff !important; color: #09090b !important; color-scheme: light !important; }

/* In dark/night/onyx/dusk themes, update elements to stay readable */
body.theme-night .reader-toolbar,
body.theme-onyx .reader-toolbar,
body.theme-dusk .reader-toolbar { background-color: #1c1c1e !important; border-color: #27272a !important; }

body.theme-night .reader-toolbar *,
body.theme-onyx .reader-toolbar *,
body.theme-dusk .reader-toolbar * { color: #e4e4e7 !important; }

body.theme-night #reader-container a,
body.theme-onyx #reader-container a,
body.theme-dusk #reader-container a { color: #6366f1 !important; }

/* Text Indent Style */
.chapter-content.text-indent-enabled p {
    text-indent: 2em;
}


/* --------------------------------------------------------------------------
   11. SINGLE CHAP REDESIGN: STICKY TOP HEADER & ACTIONS
   -------------------------------------------------------------------------- */
.reader-header {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.25s ease, background-color 0.25s ease;
}
.reader-header.hide-header {
    transform: translateY(-100%);
    box-shadow: none;
    pointer-events: none;
}
.reader-header.disable-sticky {
    position: relative !important;
    transform: none !important;
    pointer-events: auto !important;
}


.reader-bottom-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 40px 0;
}
.reader-bottom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: rgba(0, 0, 0, 0.02);
    color: #475569;
    text-decoration: none !important;
    transition: all 0.2s ease;
    cursor: pointer;
}
.reader-bottom-btn i {
    font-size: 0.8rem;
}
.reader-bottom-btn i:first-child {
    margin-right: 8px;
}
.reader-bottom-btn i:last-child {
    margin-left: 8px;
}
.reader-bottom-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Theme adaptations for bottom buttons */
body.theme-light .reader-bottom-btn { background-color: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: #475569; }
body.theme-light .reader-bottom-btn:hover { background-color: rgba(0,0,0,0.08); color: #0f172a; }

body.theme-sepia .reader-bottom-btn { background-color: rgba(91,70,54,0.06); border-color: rgba(91,70,54,0.15); color: #5b4636; }
body.theme-sepia .reader-bottom-btn:hover { background-color: rgba(91,70,54,0.12); color: #2d221a; }

body.theme-dark .reader-bottom-btn { background-color: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #cbd5e1; }
body.theme-dark .reader-bottom-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-night .reader-bottom-btn { background-color: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: #a1a1aa; }
body.theme-night .reader-bottom-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-onyx .reader-bottom-btn { background-color: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #a1a1aa; }
body.theme-onyx .reader-bottom-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-dusk .reader-bottom-btn { background-color: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); color: #94a3b8; }
body.theme-dusk .reader-bottom-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-silver .reader-bottom-btn { background-color: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); color: #334155; }
body.theme-silver .reader-bottom-btn:hover { background-color: rgba(0,0,0,0.1); color: #000000; }

body.theme-frost .reader-bottom-btn { background-color: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: #71717a; }
body.theme-frost .reader-bottom-btn:hover { background-color: rgba(0,0,0,0.08); color: #09090b; }

.reader-header-title {
    font-size: 0.95rem;
    font-weight: 600;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #0f172a;
}
.reader-header-title .story-title {
    opacity: 0.85;
}
.reader-header-title .chap-title {
    font-weight: 700;
}

.reader-header-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.reader-header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background-color: rgba(0, 0, 0, 0.02);
    color: #475569;
    text-decoration: none !important;
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 0;
}

.reader-header-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #0f172a;
}

.reader-header-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Theme Adaptations for Reader Header & Buttons */
body.theme-light .reader-header { background-color: #ffffff; border-color: #e2e8f0; }
body.theme-light .reader-header-title { color: #0f172a; }
body.theme-light .reader-header-btn { background-color: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.06); color: #475569; }
body.theme-light .reader-header-btn:hover { background-color: rgba(0,0,0,0.08); color: #0f172a; }

body.theme-sepia .reader-header { background-color: #f4ecd8; border-color: #e4dcc8; }
body.theme-sepia .reader-header-title { color: #5b4636; }
body.theme-sepia .reader-header-btn { background-color: rgba(91,70,54,0.06); border-color: rgba(91,70,54,0.12); color: #5b4636; }
body.theme-sepia .reader-header-btn:hover { background-color: rgba(91,70,54,0.12); color: #2d221a; }

body.theme-dark .reader-header { background-color: #1a1a1a; border-color: #2e2e2e; }
body.theme-dark .reader-header-title { color: #cbd5e1; }
body.theme-dark .reader-header-btn { background-color: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #cbd5e1; }
body.theme-dark .reader-header-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-night .reader-header { background-color: #09090b; border-color: #1f1f23; }
body.theme-night .reader-header-title { color: #e4e4e7; }
body.theme-night .reader-header-btn { background-color: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: #a1a1aa; }
body.theme-night .reader-header-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-onyx .reader-header { background-color: #18181b; border-color: #27272a; }
body.theme-onyx .reader-header-title { color: #f4f4f5; }
body.theme-onyx .reader-header-btn { background-color: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #a1a1aa; }
body.theme-onyx .reader-header-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-dusk .reader-header { background-color: #0f172a; border-color: #1e293b; }
body.theme-dusk .reader-header-title { color: #e2e8f0; }
body.theme-dusk .reader-header-btn { background-color: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.09); color: #94a3b8; }
body.theme-dusk .reader-header-btn:hover { background-color: rgba(255,255,255,0.12); color: #ffffff; }

body.theme-silver .reader-header { background-color: #cbd5e1; border-color: #94a3b8; }
body.theme-silver .reader-header-title { color: #0f172a; }
body.theme-silver .reader-header-btn { background-color: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.09); color: #334155; }
body.theme-silver .reader-header-btn:hover { background-color: rgba(0,0,0,0.1); color: #000000; }

body.theme-frost .reader-header { background-color: #ffffff; border-color: #e4e4e7; }
body.theme-frost .reader-header-title { color: #09090b; }
body.theme-frost .reader-header-btn { background-color: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: #71717a; }
body.theme-frost .reader-header-btn:hover { background-color: rgba(0,0,0,0.08); color: #09090b; }

/* Mobile styling for Sticky Header */
@media (max-width: 768px) {
    .reader-header {
        padding: 8px 12px;
    }
    .reader-header-title {
        font-size: 0.85rem;
        max-width: 50%;
    }
    .reader-header-title .story-title {
        display: block;
        font-size: 0.75rem;
        line-height: 1.2;
    }
    .reader-header-title .divider {
        display: none;
    }
    .reader-header-title .chap-title {
        display: block;
        font-size: 0.85rem;
        line-height: 1.2;
    }
    .reader-header-buttons {
        gap: 4px;
    }
    .reader-header-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* Hide main site header on single chap reading pages */
.single-chap .site-header,
.single-chap #headerSearch {
    display: none !important;
}

/* Optimize sticky header on extra small screens */
@media (max-width: 430px) {
    .reader-header {
        padding: 6px 8px;
    }
    .reader-header-title {
        font-size: 0.8rem;
        max-width: 40%;
    }
    .reader-header-title .story-title {
        font-size: 0.7rem;
    }
    .reader-header-title .chap-title {
        font-size: 0.75rem;
    }
    .reader-header-buttons {
        gap: 3px;
    }
    .reader-header-btn {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
        border-radius: 5px;
    }
}



/* --------------------------------------------------------------------------
   12. CHAPTER REACTIONS WIDGET STYLING
   -------------------------------------------------------------------------- */
.chap-reaction-container {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b;
    transition: all 0.3s ease;
    margin-top: 2rem !important;
    margin-bottom: 1rem !important;
}

body.theme-sepia .chap-reaction-container {
    background-color: #efe6d0;
    border-color: #e4dcc8 !important;
    color: #5b4636;
}

body.theme-dark .chap-reaction-container {
    background-color: #222222;
    border-color: #333333 !important;
    color: #cbd5e1;
}

body.theme-night .chap-reaction-container {
    background-color: #0c0c0e;
    border-color: #1f1f23 !important;
    color: #e4e4e7;
}

body.theme-onyx .chap-reaction-container {
    background-color: #1e1e21;
    border-color: #2d2d31 !important;
    color: #f4f4f5;
}

body.theme-dusk .chap-reaction-container {
    background-color: #0f172a;
    border-color: #1e293b !important;
    color: #e2e8f0;
}

body.theme-silver .chap-reaction-container {
    background-color: #d1d5db;
    border-color: #9ca3af !important;
    color: #111827;
}

body.theme-frost .chap-reaction-container {
    background-color: #fafafa;
    border-color: #eaeaea !important;
    color: #09090b;
}

#comments.mt-5 {
    margin-top: 1rem !important;
}
#comments.pt-4 {
    padding-top: 1.5rem !important;
}
.chapter-comments-section {
    padding-top: 1rem !important;
}

.reaction-buttons-wrapper {
    margin-top: 15px;
}

.btn-reaction-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent !important;
    border-radius: 12px;
    padding: 12px 18px;
    min-width: 80px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    color: inherit;
    cursor: pointer;
}

body.theme-sepia .btn-reaction-card { background-color: #f4ecd8; }
body.theme-dark .btn-reaction-card { background-color: #2a2a2a; }
body.theme-night .btn-reaction-card { background-color: #18181b; }
body.theme-onyx .btn-reaction-card { background-color: #27272a; }
body.theme-dusk .btn-reaction-card { background-color: #1e293b; }
body.theme-silver .btn-reaction-card { background-color: #e5e7eb; }
body.theme-frost .btn-reaction-card { background-color: #ffffff; border: 1px solid #eaeaea !important; }

.btn-reaction-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 12px rgba(0,0,0,0.1);
}

.btn-reaction-card.active {
    border-color: #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.08) !important;
}

body.theme-dark .btn-reaction-card.active,
body.theme-night .btn-reaction-card.active,
body.theme-onyx .btn-reaction-card.active,
body.theme-dusk .btn-reaction-card.active {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

.reaction-emoji {
    font-size: 2rem;
    margin-bottom: 5px;
    transition: transform 0.2s;
}

.btn-reaction-card:hover .reaction-emoji {
    transform: scale(1.15);
}

.reaction-count {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.reaction-label {
    font-size: 0.72rem;
    opacity: 0.65;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Adjust margins on content page to support sticky top header without overlap */
.admin-bar .reader-header {
    top: 32px;
}
@media (max-width: 782px) {
    .admin-bar .reader-header {
        top: 46px;
    }
}

/* Make reactions display in a single row on mobile */
@media (max-width: 575.98px) {
    .chap-reaction-container {
        padding: 15px 8px !important;
        margin-bottom: 10px !important;
    }
    .reaction-title {
        font-size: 14px !important;
        font-weight: 600 !important;
    }
    .reaction-total-count {
        font-size: 11px !important;
        margin-bottom: 0.5rem !important;
    }
    #comments.mt-5 {
        margin-top: 0.5rem !important;
    }
    #comments.pt-4 {
        padding-top: 1rem !important;
    }
    .chapter-comments-section {
        padding-top: 0.5rem !important;
        padding-bottom: 2rem !important;
    }
    .reaction-buttons-wrapper {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        margin-top: 10px !important;
    }
    .btn-reaction-card {
        min-width: 0 !important;
        padding: 8px 4px !important;
        border-radius: 8px !important;
    }
    .reaction-emoji {
        font-size: 1.35rem !important;
        margin-bottom: 2px !important;
    }
    .reaction-count {
        font-size: 0.75rem !important;
        margin-bottom: 1px !important;
    }
    .reaction-label {
        font-size: 0.55rem !important;
        letter-spacing: 0 !important;
    }
}

/* Fix invisible text in native select dropdown options inside dark reader settings panel */
.tts-voice-select-wrapper select option,
.chapters-fonts-settings select option {
    background-color: #151515 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   10. DECOUPLED READER TOOLBAR COLORS (FOLLOWS READING THEMES)
   ========================================================================== */

/* 1. Default (Light/Frost) */
body.theme-light .reader-toolbar,
body.theme-frost .reader-toolbar {
    background-color: #ffffff !important;
    border-color: #dee2e6 !important;
}
body.theme-light .reader-toolbar *,
body.theme-frost .reader-toolbar * {
    color: #212529 !important;
}
body.theme-light .reader-toolbar .text-muted,
body.theme-frost .reader-toolbar .text-muted {
    color: #6c757d !important;
}
body.theme-light .reader-toolbar .text-secondary,
body.theme-frost .reader-toolbar .text-secondary {
    color: #6c757d !important;
}

/* 2. Sepia */
body.theme-sepia .reader-toolbar {
    background-color: #f4ecd8 !important;
    border-color: #d7cbb1 !important;
}
body.theme-sepia .reader-toolbar * {
    color: #5b4636 !important;
}
body.theme-sepia .reader-toolbar .text-muted,
body.theme-sepia .reader-toolbar .text-secondary {
    color: #8c7b6e !important;
}

/* 3. Silver */
body.theme-silver .reader-toolbar {
    background-color: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
}
body.theme-silver .reader-toolbar * {
    color: #18181b !important;
}
body.theme-silver .reader-toolbar .text-muted,
body.theme-silver .reader-toolbar .text-secondary {
    color: #52525b !important;
}

/* 4. Dark/Night/Onyx/Dusk */
body.theme-dark .reader-toolbar,
body.theme-night .reader-toolbar,
body.theme-onyx .reader-toolbar,
body.theme-dusk .reader-toolbar {
    background-color: #1c1c1e !important;
    border-color: #27272a !important;
}
body.theme-dark .reader-toolbar *,
body.theme-night .reader-toolbar *,
body.theme-onyx .reader-toolbar *,
body.theme-dusk .reader-toolbar * {
    color: #e4e4e7 !important;
}
body.theme-dark .reader-toolbar .text-muted,
body.theme-night .reader-toolbar .text-muted,
body.theme-onyx .reader-toolbar .text-muted,
body.theme-dusk .reader-toolbar .text-muted,
body.theme-dark .reader-toolbar .text-secondary,
body.theme-night .reader-toolbar .text-secondary,
body.theme-onyx .reader-toolbar .text-secondary,
body.theme-dusk .reader-toolbar .text-secondary {
    color: #a1a1aa !important;
}

/* Keep audio play button icon white */
.reader-toolbar #btn-audio-play i,
.reader-toolbar #btn-audio-play * {
    color: #ffffff !important;
}

/* General Hover States */
.reader-toolbar a:hover,
.reader-toolbar a:hover i,
.reader-toolbar button:hover,
.reader-toolbar button:hover i {
    color: var(--gdwp-primary, #6366f1) !important;
}

/* Decouple chapter comments area from custom reader themes */
/* Theme-specific variables for comments in chapter page */

/* 1. Default (Light/Frost) */
/* 1. Default (Light/Frost) */
body.theme-light,
body.theme-frost {
    --comm-bg-main: #ffffff;
    --comm-bg-bubble: #f8f9fa;
    --comm-bg-list-item: #ffffff;
    --comm-bg-input: #f8f9fa;
    --comm-bg-input-wrapper: #f8f9fa;
    --comm-bg-toolbar: #ffffff;
    --comm-bg-footer: #f8f9fa;
    --comm-border: #dee2e6;
    --comm-border-sep: rgba(0, 0, 0, 0.05);
    --comm-text-main: #212529;
    --comm-text-muted: #6c757d;
    --comm-link-active: #dc3545;
    --comm-reply-bg: rgba(20, 184, 166, 0.1);
    --comm-reply-color: var(--gdwp-primary, #14b8a6);
    --comm-btn-sort-bg: transparent;
    --comm-btn-sort-border: #dee2e6;
    --comm-btn-sort-color: #6c757d;
    --comm-btn-sort-hover-bg: #f8f9fa;
    --comm-btn-sort-hover-color: #212529;
    --comm-btn-sort-active-bg: var(--gdwp-primary, #14b8a6);
    --comm-btn-sort-active-border: var(--gdwp-primary, #14b8a6);
    --comm-btn-sort-active-color: #ffffff;
    --comm-spoiler-bg: #f1f5f9;
    --comm-spoiler-color: #f1f5f9;
    --comm-spoiler-rev-bg: #f1f5f9;
    --comm-spoiler-rev-color: #0f172a;
}

/* 2. Sepia */
body.theme-sepia {
    --comm-bg-main: #f4ecd8;
    --comm-bg-bubble: #dfd3b9;
    --comm-bg-list-item: #f4ecd8;
    --comm-bg-input: #dfd3b9;
    --comm-bg-input-wrapper: #dfd3b9;
    --comm-bg-toolbar: #f4ecd8;
    --comm-bg-footer: #f4ecd8;
    --comm-border: #d7cbb1;
    --comm-border-sep: rgba(91, 70, 54, 0.15);
    --comm-text-main: #5b4636;
    --comm-text-muted: #8c7b6e;
    --comm-link-active: #b45309;
    --comm-reply-bg: rgba(91, 70, 54, 0.15);
    --comm-reply-color: #5b4636;
    --comm-btn-sort-bg: transparent;
    --comm-btn-sort-border: #d7cbb1;
    --comm-btn-sort-color: #8c7b6e;
    --comm-btn-sort-hover-bg: #dfd3b9;
    --comm-btn-sort-hover-color: #5b4636;
    --comm-btn-sort-active-bg: #5b4636;
    --comm-btn-sort-active-border: #5b4636;
    --comm-btn-sort-active-color: #f4ecd8;
    --comm-spoiler-bg: #dfd3b9;
    --comm-spoiler-color: #dfd3b9;
    --comm-spoiler-rev-bg: #dfd3b9;
    --comm-spoiler-rev-color: #5b4636;
}

/* 3. Silver */
body.theme-silver {
    --comm-bg-main: #e2e8f0;
    --comm-bg-bubble: #cbd5e1;
    --comm-bg-list-item: #e2e8f0;
    --comm-bg-input: #cbd5e1;
    --comm-bg-input-wrapper: #cbd5e1;
    --comm-bg-toolbar: #e2e8f0;
    --comm-bg-footer: #e2e8f0;
    --comm-border: #b8c5d6;
    --comm-border-sep: rgba(24, 24, 27, 0.1);
    --comm-text-main: #18181b;
    --comm-text-muted: #52525b;
    --comm-link-active: #b91c1c;
    --comm-reply-bg: rgba(24, 24, 27, 0.1);
    --comm-reply-color: #18181b;
    --comm-btn-sort-bg: transparent;
    --comm-btn-sort-border: #cbd5e1;
    --comm-btn-sort-color: #52525b;
    --comm-btn-sort-hover-bg: #cbd5e1;
    --comm-btn-sort-hover-color: #18181b;
    --comm-btn-sort-active-bg: #18181b;
    --comm-btn-sort-active-border: #18181b;
    --comm-btn-sort-active-color: #e2e8f0;
    --comm-spoiler-bg: #cbd5e1;
    --comm-spoiler-color: #cbd5e1;
    --comm-spoiler-rev-bg: #cbd5e1;
    --comm-spoiler-rev-color: #18181b;
}

/* 4. Dark / Night / Onyx / Dusk */
body.theme-dark,
body.theme-night,
body.theme-onyx,
body.theme-dusk {
    --comm-bg-main: #1c1c1e;
    --comm-bg-bubble: #27272a;
    --comm-bg-list-item: #141416;
    --comm-bg-input: #18181b;
    --comm-bg-input-wrapper: #1e2022;
    --comm-bg-toolbar: #242526;
    --comm-bg-footer: #242526;
    --comm-border: #27272a;
    --comm-border-sep: rgba(255, 255, 255, 0.05);
    --comm-text-main: #e4e4e7;
    --comm-text-muted: #a1a1aa;
    --comm-link-active: #f87171;
    --comm-reply-bg: rgba(14, 165, 233, 0.15);
    --comm-reply-color: #38bdf8;
    --comm-btn-sort-bg: transparent;
    --comm-btn-sort-border: #3d3e40;
    --comm-btn-sort-color: #9ca3af;
    --comm-btn-sort-hover-bg: #2d2e30;
    --comm-btn-sort-hover-color: #ffffff;
    --comm-btn-sort-active-bg: #0ea5e9;
    --comm-btn-sort-active-border: #0ea5e9;
    --comm-btn-sort-active-color: #ffffff;
    --comm-spoiler-bg: #475569;
    --comm-spoiler-color: #475569;
    --comm-spoiler-rev-bg: #334155;
    --comm-spoiler-rev-color: #f1f5f9;
}

/* Apply variables to comment elements within chapter-comments-section to override dark-mode */
.chapter-comments-section #comments {
    background-color: var(--comm-bg-main) !important;
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .comment-header-nav {
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .comment-header-nav h4 {
    color: var(--comm-text-main) !important;
}
.chapter-comments-section #comments .comment-sorting-tabs .gdwp-comment-sort-btn {
    background-color: var(--comm-btn-sort-bg) !important;
    border-color: var(--comm-btn-sort-border) !important;
    color: var(--comm-btn-sort-color) !important;
}
.chapter-comments-section #comments .comment-sorting-tabs .gdwp-comment-sort-btn:hover {
    background-color: var(--comm-btn-sort-hover-bg) !important;
    color: var(--comm-btn-sort-hover-color) !important;
}
.chapter-comments-section #comments .comment-sorting-tabs .gdwp-comment-sort-btn.active {
    background-color: var(--comm-btn-sort-active-bg) !important;
    border-color: var(--comm-btn-sort-active-border) !important;
    color: var(--comm-btn-sort-active-color) !important;
}
.chapter-comments-section #comments .gdwp-comment-editor-wrapper {
    border-color: var(--comm-border) !important;
    background-color: var(--comm-bg-input-wrapper) !important;
}
.chapter-comments-section #comments .gdwp-comment-editor-toolbar {
    background-color: var(--comm-bg-toolbar) !important;
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .comment-textarea-field {
    background-color: var(--comm-bg-input) !important;
    color: var(--comm-text-main) !important;
}
.chapter-comments-section #comments .gdwp-comment-textarea-container {
    background-color: var(--comm-bg-input) !important;
}
.chapter-comments-section #comments .gdwp-comment-editor-footer {
    background-color: var(--comm-bg-footer) !important;
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .gdwp-sticker-picker-popup {
    background-color: var(--comm-bg-toolbar) !important;
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .gdwp-sticker-picker-popup .tab-headers {
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .gdwp-sticker-item {
    background-color: var(--comm-bg-input) !important;
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .comment-list > li.depth-1 {
    background-color: var(--comm-bg-list-item) !important;
    border: 1px solid var(--comm-border) !important;
}
.chapter-comments-section #comments .comment-bubble {
    background-color: transparent !important;
    color: var(--comm-text-main) !important;
}
.chapter-comments-section #comments .bg-light.p-3.rounded-3 {
    background-color: var(--comm-bg-bubble) !important;
}
.chapter-comments-section #comments .comment-bubble h6 {
    color: var(--comm-text-main) !important;
}
.chapter-comments-section #comments .reply-target-name {
    background-color: var(--comm-reply-bg) !important;
    color: var(--comm-reply-color) !important;
}
.chapter-comments-section #comments .comment-actions-footer button,
.chapter-comments-section #comments .comment-actions-footer a,
.chapter-comments-section #comments .comment-actions-footer .comment-reply-link {
    color: var(--comm-text-muted) !important;
}
.chapter-comments-section #comments .comment-actions-footer button:hover,
.chapter-comments-section #comments .comment-actions-footer a:hover,
.chapter-comments-section #comments .comment-actions-footer .comment-reply-link:hover {
    color: var(--comm-btn-sort-active-bg) !important;
}
.chapter-comments-section #comments ul.children li.comment {
    border-top: 1px solid var(--comm-border-sep) !important;
}
.chapter-comments-section #comments .comment-spoiler {
    background-color: var(--comm-spoiler-bg) !important;
    color: var(--comm-spoiler-color) !important;
}
.chapter-comments-section #comments .comment-spoiler.revealed {
    background-color: var(--comm-spoiler-rev-bg) !important;
    color: var(--comm-spoiler-rev-color) !important;
}
.chapter-comments-section #comments .logged-in-as {
    background-color: var(--comm-bg-bubble) !important;
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #comments .logged-in-as * {
    color: var(--comm-text-main) !important;
}
.chapter-comments-section #comments .logged-in-as a {
    color: var(--comm-link-active) !important;
}
.chapter-comments-section #comments hr {
    border-color: var(--comm-border) !important;
    opacity: 1 !important;
}
.chapter-comments-section #comments *:not(.text-warning):not(.badge):not(.btn):not(.btn *):not(.fa-crown) {
    color: var(--comm-text-main) !important;
}
.chapter-comments-section #comments .text-muted,
.chapter-comments-section #comments .text-secondary {
    color: var(--comm-text-muted) !important;
}
.chapter-comments-section #comments .form-control {
    background-color: var(--comm-bg-input) !important;
    color: var(--comm-text-main) !important;
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #gdwp-comment-report-modal .modal-content {
    background-color: var(--comm-bg-main) !important;
    color: var(--comm-text-main) !important;
}
.chapter-comments-section #gdwp-comment-report-modal .modal-header,
.chapter-comments-section #gdwp-comment-report-modal .modal-footer {
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #gdwp-comment-report-modal label {
    border-color: var(--comm-border) !important;
}
.chapter-comments-section #gdwp-comment-report-modal label:hover {
    background-color: var(--comm-bg-bubble) !important;
}

/* Custom formatting for badges inside comments area to prevent solid-on-solid invisible text (globally for story & chap pages) */
#comments .badge.bg-primary {
    background-color: color-mix(in srgb, var(--gdwp-primary, #14b8a6) 15%, transparent) !important;
    color: var(--gdwp-primary, #14b8a6) !important;
    border: 1px solid color-mix(in srgb, var(--gdwp-primary, #14b8a6) 30%, transparent) !important;
}
#comments .badge.bg-secondary {
    background-color: rgba(108, 117, 125, 0.15) !important;
    color: #6c757d !important;
    border: 1px solid rgba(108, 117, 125, 0.3) !important;
}
/* In dark/night reading themes and general dark mode, make sure secondary badges are light enough */
.dark-mode #comments .badge.bg-secondary,
body.theme-dark #comments .badge.bg-secondary,
body.theme-night #comments .badge.bg-secondary,
body.theme-onyx #comments .badge.bg-secondary,
body.theme-dusk #comments .badge.bg-secondary {
    color: #a1a1aa !important;
    border-color: rgba(161, 161, 170, 0.3) !important;
}

/* Increase contrast for VIP user warning text in light/sepia backgrounds */
body.theme-light #comments .text-warning,
body.theme-frost #comments .text-warning,
body.theme-sepia #comments .text-warning,
body.theme-silver #comments .text-warning {
    color: #d97706 !important; /* Amber-600 color for readable contrast */
}

/* Bulk purchase calculation result box styling (Light & Dark mode) */
.gdwp-bulk-buy-result-box {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #475569;
}
.gdwp-bulk-buy-result-box span,
.gdwp-bulk-buy-result-box strong {
    color: #475569;
}
.gdwp-bulk-buy-result-box hr {
    border-color: #fde68a;
    opacity: 0.5;
}
.dark-mode .gdwp-bulk-buy-result-box {
    background-color: #1c273c !important;
    border-color: rgba(20, 184, 166, 0.2) !important;
    color: #94a3b8 !important;
}
.dark-mode .gdwp-bulk-buy-result-box span,
.dark-mode .gdwp-bulk-buy-result-box strong:not(.text-danger):not(.text-success) {
    color: #94a3b8 !important;
}
.dark-mode .gdwp-bulk-buy-result-box strong,
.dark-mode .gdwp-bulk-buy-result-box #gdwp-buy-count,
.dark-mode .gdwp-bulk-buy-result-box #gdwp-buy-original,
.dark-mode .gdwp-bulk-buy-result-box #gdwp-buy-balance {
    color: #f8fafc !important;
}
.dark-mode .gdwp-bulk-buy-result-box hr {
    border-color: rgba(255, 255, 255, 0.1) !important;
    opacity: 0.2 !important;
}
.dark-mode .gdwp-bulk-buy-result-box .text-success,
.dark-mode .gdwp-bulk-buy-result-box #gdwp-buy-discount {
    color: #2dd4bf !important; /* teal-400 */
}
.dark-mode .gdwp-bulk-buy-result-box #gdwp-buy-final {
    color: #f43f5e !important; /* rose-500 */
}

/* Custom spacing for reactions and comments wrapper */
.chap-reaction-container.my-5.p-4.rounded-4.border.text-center.shadow-sm {
    margin-bottom: 10px !important;
}

.chapter-comments-section.py-5.mt-0 {
    padding-top: 10px !important;
}


/* ==========================================================================
   PAGE MODE (CHẾ ĐỘ LẬT TRANG KAKAOPAGE)
   ========================================================================== */

/* Active state for Reading Mode buttons in Settings menu */
.chapters-fonts-settings .reading-mode-buttons button.selected {
    background-color: #27272a;
    color: #ffffff;
}

/* Lock scrolling on body when Page Mode is active */
body.page-mode-active {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 100vw !important;
    position: fixed !important;
}

/* Adjust reader container layout in Page Mode */
body.page-mode-active #reader-container {
    max-width: 100% !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    overflow: hidden !important;
    box-sizing: border-box;
}

/* Viewport wrapping chapter content */
body.page-mode-active #chapter-content-viewport {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden !important;
    position: relative;
    box-sizing: border-box;
    padding: 20px 20px !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 576px) {
    body.page-mode-active #chapter-content-viewport {
        padding: 15px 15px !important;
    }
}

/* Ensure normal scroll mode uses full container width and turns off CSS columns */
body:not(.page-mode-active) #chapter-content-text {
    column-width: auto !important;
    column-count: auto !important;
    column-gap: normal !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
}

/* Dynamic columns for paginating text horizontal layout */
body.page-mode-active #chapter-content-text {
    height: 100%;
    width: 100% !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    column-fill: auto;
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: visible; /* Let columns overflow horizontally */
    position: relative;
    box-sizing: border-box;
}

/* Ensure children fit strictly inside column width */
body.page-mode-active #chapter-content-text * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Images sizing in columns */
body.page-mode-active #chapter-content-text img {
    max-height: 90vh !important;
    max-width: 100% !important;
    object-fit: contain;
    break-inside: avoid;
    display: block;
    margin: 10px auto;
}

/* Prevent element split weirdly across columns */
body.page-mode-active #chapter-content-text p {
    break-inside: auto; /* Allow text paragraphs to flow naturally across pages */
    margin-bottom: 1.25em;
    text-align: justify;
    word-break: break-word;
    overflow-wrap: break-word;
}

body.page-mode-active #chapter-content-text h1,
body.page-mode-active #chapter-content-text h2,
body.page-mode-active #chapter-content-text h3,
body.page-mode-active #chapter-content-text .page-mode-title-card,
body.page-mode-active #chapter-content-text .page-mode-end-card {
    break-inside: avoid;
}

/* First Page Title Card */
.page-mode-title-card {
    padding-bottom: 25px;
    margin-bottom: 30px;
    border-bottom: 2px dashed rgba(128, 128, 128, 0.2);
}
.page-mode-title-card .story-title {
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 700;
    opacity: 0.6;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.page-mode-title-card .chap-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.3;
    margin: 0;
}

/* Styling for stackable final components in Page Mode columns */
body.page-mode-active .chap-reaction-container,
body.page-mode-active .chapter-comments-section,
body.page-mode-active .reader-bottom-nav {
    display: none !important;
}

/* Chapter End Card Style in Page Mode (Compact Inline) */
.page-mode-end-card {
    break-before: auto !important;
    break-inside: avoid !important;
    margin: 40px auto 20px auto !important;
    padding: 24px 16px !important;
    border: 1px dashed rgba(128, 128, 128, 0.3) !important;
    border-radius: 14px;
    text-align: center;
    max-width: 320px;
    box-sizing: border-box;
    display: block !important;
}
body.theme-light .page-mode-end-card { border-color: rgba(0, 0, 0, 0.15) !important; background-color: rgba(0, 0, 0, 0.02); }
body.theme-sepia .page-mode-end-card { border-color: rgba(91, 70, 54, 0.25) !important; background-color: rgba(91, 70, 54, 0.04); }
body.theme-dark .page-mode-end-card { border-color: rgba(255, 255, 255, 0.15) !important; background-color: rgba(255, 255, 255, 0.02); }
body.theme-night .page-mode-end-card { border-color: rgba(255, 255, 255, 0.15) !important; background-color: rgba(255, 255, 255, 0.03); }
body.theme-onyx .page-mode-end-card { border-color: rgba(255, 255, 255, 0.12) !important; background-color: rgba(255, 255, 255, 0.02); }

.page-mode-end-text {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
    opacity: 0.85;
}

.page-mode-actions-inline {
    display: flex !important;
    justify-content: center;
    gap: 12px;
    margin-bottom: 14px;
}
.page-mode-actions-inline .btn {
    font-size: 13px !important;
    padding: 6px 16px !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease !important;
}

/* Giao diện nền sáng */
body.theme-light .page-mode-actions-inline .btn {
    color: #212529 !important;
    border-color: #cbd5e1 !important;
    background-color: rgba(0, 0, 0, 0.03) !important;
}
body.theme-frost .page-mode-actions-inline .btn {
    color: #09090b !important;
    border-color: #cbd5e1 !important;
    background-color: rgba(0, 0, 0, 0.03) !important;
}
body.theme-silver .page-mode-actions-inline .btn {
    color: #18181b !important;
    border-color: #94a3b8 !important;
    background-color: rgba(0, 0, 0, 0.04) !important;
}
body.theme-sepia .page-mode-actions-inline .btn {
    color: #5b4636 !important;
    border-color: rgba(91, 70, 54, 0.35) !important;
    background-color: rgba(91, 70, 54, 0.05) !important;
}

/* Giao diện nền tối */
body.theme-dark .page-mode-actions-inline .btn,
body.theme-night .page-mode-actions-inline .btn,
body.theme-onyx .page-mode-actions-inline .btn,
body.theme-dusk .page-mode-actions-inline .btn {
    color: #e4e4e7 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Trạng thái hover */
.page-mode-actions-inline .btn:hover:not(:disabled) {
    background-color: var(--gdwp-primary, #6366f1) !important;
    color: #ffffff !important;
    border-color: var(--gdwp-primary, #6366f1) !important;
}

/* Trạng thái disabled */
.page-mode-actions-inline .btn:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background-color: transparent !important;
    border-color: rgba(128, 128, 128, 0.2) !important;
}

.page-mode-end-button-wrapper {
    display: flex;
    justify-content: center;
}
.page-mode-end-button-wrapper .btn {
    font-size: 13px !important;
    padding: 8px 18px !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
    width: 100%;
    max-width: 250px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Page footer showing page x of y */
.page-mode-footer {
    display: none;
    width: 100%;
    height: calc(40px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0.55;
    user-select: none;
    box-sizing: border-box;
    border-top: 1px solid rgba(128, 128, 128, 0.12);
    font-weight: 600;
    letter-spacing: 0.05em;
}
body.page-mode-active .page-mode-footer {
    display: flex !important;
}

/* Hide elements not needed in Page Mode */
body.page-mode-active .reader-header {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease;
    padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important;
}
body.page-mode-active .reader-header.hide-header {
    transform: translateY(-100%);
}

body.page-mode-active #reader-container > .mb-4.text-center,
body.page-mode-active #chapter-heading,
body.page-mode-active #back-to-top {
    display: none !important;
}

/* Touch swiping visual indicator overlays */
.page-mode-swipe-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.4);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 99;
}
.page-mode-swipe-hint.hint-left {
    left: 10px;
}
.page-mode-swipe-hint.hint-right {
    right: 10px;
}

/* Fix reading mode buttons style and prevent overlap */
.chapters-fonts-settings .group-adjust.reading-mode-buttons button {
    width: auto !important;
    height: 36px !important;
    padding: 0 12px !important;
    flex: 1 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.chapters-fonts-settings .group-adjust.reading-mode-buttons button.selected {
    background-color: #3f3f46 !important;
    border-color: #52525b !important;
    color: #ffffff !important;
}

/* Style cho đoạn văn đang được đọc AI */
.highlight-para {
    background-color: rgba(0, 123, 255, 0.12) !important;
    border-left: 4px solid var(--gdwp-primary, #007bff) !important;
    padding-left: 12px !important;
    border-radius: 4px;
    transition: background-color 0.25s ease, border-left-color 0.25s ease, padding-left 0.25s ease;
}

body.theme-night .highlight-para,
body.theme-onyx .highlight-para,
body.theme-dark .highlight-para,
body.theme-dusk .highlight-para {
    background-color: rgba(255, 235, 59, 0.15) !important;
    border-left-color: #ffeb3b !important;
}

.tts-voice-select-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.tts-audio-info {
    font-size: 11px;
    font-style: italic;
    opacity: 0.8;
}
