
/* Определение цветовых переменных для темной и светлой тем */

:root {
    --bg-color: #111827;
    --text-color: #e5e7eb;
    --header-bg: #1f2937;
    /* --volume-bg: #1e2b3b78; */
    --volume-bg: #374151;
    --volume-bg-s: #374151;
    --volume-bg-b: #464f5e85;
    --modal-bg: #1f2937;
    --login-modal-bg: #1f2937e3;
    --chapter-hover-bg: #2b3440;
    --locked-bg: #7f1d1d;
    --card-bg: #1e2b3b78;
    /* --select-bg: #23344dc2; */
    --select-bg: #4b5563;
    --genre-bg: #4b5563;
    --circle-bg: #0000003b;
    --border-login-color: #7c7c7c80;
    --login-social-btn-bg: #4ba5ff40;
    --login-forgot-password: #3d84f5;
    --input-bg: #2b394f54;
    --commentdown-bg: #2b394f;
    --text-buttons-color: #339cff;
    --text-buttons-color-h: #7abfff;
}

html.light {
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --header-bg: #ffffff;
    --volume-bg: #f9fafb;
    --modal-bg: #ffffff;
    --login-modal-bg: #ffffffe3;
    --chapter-hover-bg: #bdbdbd;
    --locked-bg: #fee2e2;
    --card-bg: #ffffff;
    --genre-bg: #e4e4e4;
    --select-bg: #e4e4e4;
    --circle-bg: #0000003b;
    --border-login-color: #7c7c7c80;
    --login-social-btn-bg: #4ba5ff40;
    --input-bg: #ffffff;
}

/* Основные стили документа */

html {
    scrollbar-width: thin;
    scrollbar-color: #1e3a8a var(--bg-color);
}

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

html::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

html::-webkit-scrollbar-thumb {
    background: #1e3a8a;
    border-radius: 4px;
    transition: background 0.2s ease;
}

html::-webkit-scrollbar-thumb:hover {
    background: #172554;
}

html.light::-webkit-scrollbar-thumb {
    background: #1e3a8a;
}

html.light::-webkit-scrollbar-thumb:hover {
    background: #172554;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    height: 100dvh;
}

body.modal-open {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scrollbar-width: thin;
    scrollbar-color: transparent var(--bg-color);
}

body.modal-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

body.modal-open::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.modal-open::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

body.modal-open::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

@media (min-width: 1024px) {
    .custom-w-1-3 {
        width: 33.333333% !important;
        margin-top: 1rem;
    }
    .custom-w-2-3 {
        width: 66.666667% !important;
    }
}

@media (max-width: 1023.9px) {
    .custom-w-1-3,
    .custom-w-2-3 {
        width: 100% !important;
    }
}

/* Стили для шапки */


.wrapper {
    position: fixed;
    top: 0.5px;
    left: 0;
    right: 0;
    bottom: 0.5px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1e3a8a var(--bg-color);
}

@media (min-width: 1000px) {
    .wrapper {
        position: unset !important;
        top: unset !important;
        left: unset !important;
        right: unset !important;
        bottom: unset !important;
        overflow-x: unset !important;
        overflow-y: unset !important;
    }
}

header {
    background-color: var(--header-bg);
    max-height: 60px;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 40;
    box-sizing: border-box;
    transform: translateY(0); /* new */
    transition: background-color 0.3s ease, top 0.3s ease, transform 0.3s ease; /* new */
}

/* Стили для статистики(лайков...) */

.cs-layout-stats-item-short {
    padding: 0.25rem 0.75rem;
    /* background-color: var(--select-bg); */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cs-layout-stats-item-short.cs-layout-stats-likes {
    background-color: #3c83f6cc;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    border-top-right-radius: 15px;
    border-top-left-radius: 15px;
}

.delta {
    font-family: 'AlegreyaSC-Regular' !important;
    font-weight: normal !important;
    cursor: default;
    position: absolute;
    font-size: 24px;
}

.rating {
    font-family: 'AlegSC-R' !important;
    font-weight: 300 !important;
    cursor: pointer;
    font-size: 2.625rem;
    padding: 0rem 0rem !important;
    color: #42ff4c;
    position: absolute;
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Стили для аккордеона */

.accordion-content {
    max-height: none;
    overflow-y: visible;
}

.part .accordion-content ul {
    max-height: 50vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.part .accordion-content ul::-webkit-scrollbar {
    width: 8px;
}

.part .accordion-content ul::-webkit-scrollbar-track {
    background: var(--volume-bg);
    border-radius: 4px;
}

.part .accordion-content ul::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.part .accordion-content ul::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.part .accordion-content ul {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 var(--volume-bg);
}

html.light .part .accordion-content ul::-webkit-scrollbar-track {
    background: var(--volume-bg);
}

html.light .part .accordion-content ul::-webkit-scrollbar-thumb {
    background: #3b82f6;
}

html.light .part .accordion-content ul::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

html.light .part .accordion-content ul {
    scrollbar-color: #3b82f6 var(--volume-bg);
}

/* Стили для модальных окон */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--modal-bg);
    z-index: 99999;
    color: var(--text-color);
    padding: 2rem;
    border-radius: 12px;
    /* max-width: 90%; */
    width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.3s ease;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    text-align: center;
}

.modal-content label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
}

.modal-content input:not([type="file"]):not([type="checkbox"]),
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background-color: var(--modal-bg);
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-content input[type="file"] {
    display: none;
}

.modal-content .file-upload-label {
    position: relative;
    width: 100%;
    padding: 1rem;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    background-color: var(--modal-bg);
    color: var(--text-color);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.modal-content .file-upload-label:hover {
    border-color: #3b82f6;
    background-color: var(--chapter-hover-bg);
    transform: translateY(-1px);
}

.modal-content .file-upload-label .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-content .file-upload-label::before {
    content: '📁';
    font-size: 1rem;
    margin-right: 0.5rem;
}

html.light .modal-content .file-upload-label {
    border-color: #d1d5db;
}

html.light .modal-content .file-upload-label:hover {
    border-color: #3b82f6;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-content button {
    padding: 0.75rem 1.5rem;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    background-color: #3b82f6;
    color: white;
    transition: background-color 0.2s ease, transform 0.1s ease;
    cursor: pointer;
}

.modal-content button:hover {
    transform: translateY(-1px);
}

.modal-content .close-btn {
    position: absolute;
    top: 0rem;
    right: 0rem;
    background: none;
    color: var(--text-color);
    font-size: 2.2rem;
    margin-top: -0.6rem;
    margin-right: 0.3rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.modal-content .close-btn:hover {
    color: #3b82f6;
    transform: scale(1.1);
}

.modal-content::-webkit-scrollbar,
#edit-book-modal .modal-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.modal-content::-webkit-scrollbar-track,
#edit-book-modal .modal-content::-webkit-scrollbar-track {
    background: var(--modal-bg);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb,
#edit-book-modal .modal-content::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.modal-content::-webkit-scrollbar-thumb:hover,
#edit-book-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.modal-content,
#edit-book-modal .modal-content {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 var(--modal-bg);
}

html.light .modal-content::-webkit-scrollbar-track,
html.light #edit-book-modal .modal-content::-webkit-scrollbar-track {
    background: var(--modal-bg);
}

html.light .modal-content::-webkit-scrollbar-thumb,
html.light #edit-book-modal .modal-content::-webkit-scrollbar-thumb {
    background: #3b82f6;
}

html.light .modal-content::-webkit-scrollbar-thumb:hover,
html.light #edit-book-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

html.light .modal-content,
html.light #edit-book-modal .modal-content {
    scrollbar-color: #3b82f6 var(--modal-bg);
}

.date-modal-content {
    background: var(--modal-bg);
    color: var(--text-color);
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideIn 0.3s ease;
    transition: background-color 0.3s ease, color 0.3s ease;
    text-align: center;
}

.date-modal-content p {
    font-size: 0.875rem;
}

.date-modal-content .close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.date-modal-content .close-btn:hover {
    color: #3b82f6;
    transform: scale(1.1);
}

/* Стили для глав */

.volume {
    transition: background-color 0.3s ease;
    border: solid 1px #9ef7ff24;
}

.chapter {
    transition: background-color 0.2s;
}

.chapter:hover {
    background-color: var(--chapter-hover-bg);
}

.chapter-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

html.light .chapter-date {
    color: #6b7280;
}

@media (max-width: 500px) {
    .chapter-date {
        display: flex;
    }
}

@media (min-width: 640px) {
    .chapter-date {
        font-size: 0.875rem;
    }
}

/* Стили для перетаскивания */

.reorder-btn {
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.reorder-btn:hover {
    color: #10b981;
    transform: scale(1.1);
}

.reorder-btn.active {
    color: #10b981;
    transform: scale(1.2);
}

.reorder-active .chapter {
    cursor: move;
    user-select: none;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.reorder-active .accordion-content ul {
    min-height: 48px;
    border: 2px dashed transparent;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    position: relative;
    padding: 8px 0;
    max-height: 50vh;
    overflow-y: auto;
}

.reorder-active .accordion-content ul.draggable-hover-empty {
    border: 2px dashed #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
}

.chapter.dragging {
    opacity: 0.7;
    transform: scale(0.95);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background-color: var(--chapter-hover-bg);
    z-index: 100;
    border: 2px solid #3b82f6;
    border-radius: 8px;
}

.chapter.drag-between::before,
.chapter.drag-between-bottom::before {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    height: 4px;
    background-color: #3b82f6;
    border-radius: 2px;
    z-index: 50;
}

.chapter.drag-between::before {
    top: -6px;
}

.chapter.drag-between-bottom::before {
    bottom: -6px;
}

.chapter:not(.dragging) {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.reorder-active .accordion-content ul button.text-blue-600 {
    display: none;
}

.reorder-active .accordion-content ul.space-y-2 {
    margin: 0;
    padding: 8px 0;
}

.reorder-active .accordion-content ul.space-y-2 > * {
    margin-top: 0;
    margin-bottom: 0;
}

.reorder-active .accordion-content ul.space-y-2 > .chapter + .chapter {
    margin-top: 8px;
}

/* Стили для кнопок */

.read-btn {
    background-color: #3b82f6;
    color: white;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.read-btn:hover {
    background-color: #2563eb;
}

.edit-btn, .delete-btn {
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s;
}

.edit-btn:hover {
    color: #3b82f6;
}

.delete-btn:hover {
    color: #dc2626;
}

.toggle-all-parts {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.toggle-all-parts:hover {
    transform: scale(1.1);
}

.toggle-all-icon.rotate-180 {
    transform: rotate(180deg);
}

.admin-toggle-button, .dashboard-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.admin-toggle-button:hover, .dashboard-button:hover {
    transform: scale(1.15);
    background: rgba(59, 130, 246, 0.15);
}

html.light .admin-toggle-button .admin-inactive, html.light .dashboard-button svg {
    stroke: #6b7280;
}

html.dark .admin-toggle-button .admin-inactive, html.dark .dashboard-button svg {
    stroke: #9ca3af;
}

.admin-toggle-button .admin-active {
    stroke: #3b82f6;
}

.theme-toggle-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
}

html.dark .theme-toggle-button {
    color: #9ca3af;
}

.theme-toggle-button svg[data-theme="light"] {
    width: 28px;
    height: 28px;
    color: #6b7280;
}

.theme-toggle-button svg[data-theme="dark"] {
    width: 24px;
    height: 24px;
}

.read-icon {
    width: 16px;
    height: 16px;
    stroke: #9ca3af;
    transition: stroke 0.3s ease;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.read-container {
    position: relative;
    padding-left: 30px;
}

html.light .read-icon {
    stroke: #6b7280;
}

.read-icon:hover {
    stroke: #3b82f6;
}

/* Стиль FAQ */

.faq-link {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    position: relative;
    text-decoration: none;
    transition: color 0.2s ease;
}

html.light .faq-link {
    color: #000000;
}

html.dark .faq-link {
    color: #ffffff;
}

.faq-link:hover {
    color: #4b5563;
}

.faq-link-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1.5px;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

@media (max-width: 999px) {
    .faq-link-underline {
        transition: transform 0.1s ease;
    }
}

html.light .faq-link-underline {
    background-color: #000000;
}

html.dark .faq-link-underline {
    background-color: #ffffff;
}

.faq-link:hover .faq-link-underline {
    transform: scaleX(1);
}

/* Стили для уведомлений */

.locked-notice {
    background-color: #fef2f2;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

html.dark .locked-notice {
    background-color: rgba(239, 68, 68, 0.2);
}

@media (max-width: 640px) {
    .locked-notice {
        padding: 0.25rem 0.5rem;
        gap: 1rem;
    }
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(220, 38, 38, 0.1);
    border-radius: 4px;
    display: none;
}

/* Стили для пузырей жанров */

.genre-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background-color: var(--genre-bg);
    color: var(--text-color);
    border-radius: 9999px;
    font-weight: 500;
    cursor: default;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.genre-tag:hover {
    background-color: var(--chapter-hover-bg);
}

/* Стили для кастомного переключателя */

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: background-color 0.3s ease;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: transform 0.3s ease;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: #3b82f6;
}

.switch input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

html.light .switch input:not(:checked) + .slider {
    background-color: #d1d5db;
}

html.light .switch input:checked + .slider {
    background-color: #2563eb;
}

/* Стили для кнопки логина */

.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #3b82f6;
    color: white;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.login-button:hover {
    background-color: #2563eb;
    transform: translateY(0px);
}

.login-button-icon {
    width: 1.05rem;
    height: 1.25rem;
    margin-right: 0.3rem;
    margin-left: -0.3rem;
    transition: color 0.2s ease;
}

html.light .login-button-icon {
    color: #ffffff;
}

html.dark .login-button-icon {
    color: #ffffff;
}

/* Стили для модального окна входа */

.login-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeInLogin 0.3s ease;
}

.login-overlay.show {
    display: flex;
}

.login-window {
    background: var(--modal-bg);
    color: var(--text-color);
    padding: 2rem;
    border-radius: 12px;
    max-width: 400px;
    /* width: 90vw;  */
    margin-right: 1rem;
    margin-left: 1rem;
    margin-top: 60px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideInLogin 0.5s ease;
    text-align: center;
    overflow-y: auto;
    max-height: 90vh;
    height: 85vh;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.login-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(107, 114, 128, 0.15);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.login-close-btn:hover {
    background: rgba(107, 114, 128, 0.25);
    color: #3b82f6;
    transform: scale(1.1);
}

.login-form-fields {
    position: relative;
    transition: none;
}

.login-form-fields .form-content {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.login-form-fields.transition-out .form-content {
    animation: fadeSlideOut 0.3s ease forwards;
}

.login-form-fields.transition-in .form-content {
    animation: fadeSlideIn 0.3s ease forwards;
}

#auth-terms-text {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.75rem;
    color: var(--text-color);
    text-align: center;
    line-height: 1.5;
    transform: translateZ(0);
    will-change: contents;
}

#auth-terms-content {
    display: inline-block;
    backface-visibility: hidden;
}

.login-input-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.login-icon-label {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.login-icon {
    width: 1.25rem;
    height: 1.25rem;
    stroke: #ffffff;
    transition: filter 0.2s ease;
}

html.light .login-icon {
    filter: invert(50%);
}

html.dark .login-input-group:has(.login-input:valid) .login-icon {
    filter: invert(100%);
}

html.dark .login-icon {
    filter: invert(0%);
}

.login-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid var(--border-login-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background-color: var(--input-bg) !important;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-input::placeholder {
    color: var(--text-color);
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.login-input:focus,
.login-input:valid {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background-color: var(--input-bg) !important;
}

.login-input:focus::placeholder {
    opacity: 0;
}

html.dark .login-input {
    background-color: var(--input-bg) !important;
    color: var(--text-color);
    border-color: var(--border-login-color);
}

html.dark .login-input:focus,
html.dark .login-input:valid {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    background-color: var(--input-bg) !important;
}

.login-submit-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.login-submit-btn.disabled {
    opacity: 1;
    cursor: default;
    background-color: #3b82f62b;
    transform: none;
}

.login-submit-btn:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

.login-forgot-password {
    display: inline-block;
    margin-top: 0.75rem;
    color: #6b7280;
    font-size: 0.75rem;
    text-decoration: none;
    position: relative;
    transition: color 0.2s ease;
}

.login-forgot-password:hover {
    color: #3b82f6;
}

#forgot-password-modal .login-window {
    height: auto;
    max-height: none;
}

.login-divider {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    position: relative;
}

.login-divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--text-color) 80%, var(--text-color) 50%, transparent 100%);
    border: none;
    border-radius: 4px;
    opacity: 0.6;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.login-divider-line:first-child {
    background: linear-gradient(to left, transparent, var(--text-color) 80%, var(--text-color) 50%, transparent 100%);
}

.login-divider-text {
    margin: 0 1rem;
    color: var(--text-color);
    font-size: 0.875rem;
    white-space: nowrap;
    padding: 0 0.25rem;
    font-family: Arial;
}

.login-register-text {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-color);
    text-align: center;
}

.login-register-link {
    color: #3b82f6;
    text-decoration: none;
    position: relative;
    transition: text-decoration 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
}

.login-register-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #3b82f6;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.login-register-link:hover::after {
    transform: scaleX(1);
}

.login-social-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

.login-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48%;
    padding: 0.5rem;
    background-color: var(--login-social-btn-bg);
    border: 1px solid #ffffff1a;
    border-radius: 8px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.login-social-btn:hover {
    background-color: #4ba5ff98;
    border-color: #3b83f643;
    transform: translateY(-1px);
}

.login-social-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.login-social-btn:hover .login-social-icon {
    transform: scale(1.1);
}

html.dark .login-window {
    background: var(--login-modal-bg);
    color: var(--text-color);
}

html.dark .login-title {
    color: var(--text-color);
}

html.dark .login-close-btn {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-color);
}

html.dark .login-close-btn:hover {
    background: rgba(156, 163, 175, 0.25);
    color: #60a5fa;
}

html.dark .login-icon {
    stroke: var(--text-color);
}

html.dark .login-forgot-password {
    color: var(--text-color);
}

html.dark .login-forgot-password:hover {
    color: var(--login-forgot-password);
}

html.dark .login-divider-line {
    background: linear-gradient(to right, transparent, var(--text-color) 10%, var(--text-color) 50%, transparent 90%);
}

html.dark .login-divider-line:first-child {
    background: linear-gradient(to left, transparent, var(--text-color) 10%, var(--text-color) 50%, transparent 90%);
}

html.dark .login-social-icon {
    filter: brightness(1.2);
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    visibility: hidden; /* Скрываем по умолчанию */
}

.login-input-group:has(.login-input:not(:placeholder-shown)) .toggle-password {
    visibility: visible; /* Показываем, если поле не пустое */
}

.toggle-password-icon {
    width: 1.25rem;
    height: 1.25rem;
    /* stroke: #0000008c; */
    stroke: #0000008c;
    transition: filter 0.2s ease;
}

html.light .toggle-password-icon {
    filter: invert(50%);
}

html.dark .login-input-group:has(.login-input:valid) .toggle-password-icon {
    filter: invert(100%);
}

html.dark .login-input-group:has(.login-input:-webkit-autofill) .toggle-password-icon {
    filter: invert(20%);
}

.toggle-password {
    visibility: hidden;
}

.login-input-group:has(.login-input:not(:placeholder-shown)) .toggle-password {
    visibility: visible;
}

html.dark .toggle-password-icon {
    filter: invert(0%);
}

input[type="password"]::-ms-reveal,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
}

/* Стили для мигающей зелёной точки */

.status-dot {
    width: 6px;
    height: 6px;
    background-color: #22c55e;
    border-radius: 50%;
    animation: blink 2.5s infinite;
    margin-left: 0.4rem;
}

/* Анимации */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInRight {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0px); opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeInLogin {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLogin {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scaleX(1); }
    50% { opacity: 0.5; transform: scaleX(0.99); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes fadeSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideInComment {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.support-link {
    color: #3b82f6;
    text-decoration: none;
    position: relative;
    transition: text-decoration 0.2s ease;
}

.support-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #3b82f6;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.support-link:hover::after {
    transform: scaleX(1);
}

.login-submit-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-submit-btn .button-text {
    transition: opacity 0.2s ease;
}

.login-submit-btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.login-submit-btn.loading .button-text {
    opacity: 0;
}

.login-submit-btn.loading .spinner {
    display: block;
}

/* Стили для чекбокса "Запомнить меня" */

input[type="checkbox"] {
    accent-color: #3b82f6; /* Синий цвет для чекбокса */
}

html.light input[type="checkbox"] {
    accent-color: #2563eb;
}

.login-form-fields {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.login-form-fields.transition-out {
    animation: fadeSlideOut 0.3s ease forwards;
}

.login-form-fields.transition-in {
    animation: fadeSlideIn 0.3s ease forwards;
}

/* Стили для кнопки переключения сайдбара */

.sidebar-toggle-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.sidebar-toggle-button:hover {
    transform: scale(1.15);
    background: rgba(59, 130, 246, 0.15);
}

html.light .sidebar-toggle-button svg {
    stroke: #6b7280;
}

html.dark .sidebar-toggle-button svg {
    stroke: #9ca3af;
}

/* Анимация гамбургер-меню в крестик */

#sidebar-icon .hamburger-top,
#sidebar-icon .hamburger-middle,
#sidebar-icon .hamburger-bottom {
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

#sidebar-icon.active .hamburger-top {
    transform: rotate(90deg);
    transform-origin: center;
}

#sidebar-icon.active .hamburger-middle {
    transform: rotate(90deg);
    transform-origin: center;
}

#sidebar-icon.active .hamburger-bottom {
    transform: rotate(90deg);
    transform-origin: center;
}

/* Стили для сайдбара */

.sidebar {
    position: fixed;
    top: 60px;
    right: 0;
    width: 260px;
    height: calc(100% - 60px);
    background: var(--header-bg);
    color: var(--text-color);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 30;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.2);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-content {
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
}

.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: var(--header-bg);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.sidebar-content {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 var(--header-bg);
}

html.light .sidebar-content::-webkit-scrollbar-track {
    background: var(--header-bg);
}

html.light .sidebar-content::-webkit-scrollbar-thumb {
    background: #3b82f6;
}

html.light .sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

html.light .sidebar-content {
    scrollbar-color: #3b82f6 var(--header-bg);
}

.sidebar-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(107, 114, 128, 0.15);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.sidebar-close-btn:hover {
    background: rgba(107, 114, 128, 0.25);
    color: #3b82f6;
    transform: scale(1.1);
}

.sidebar-content a, .sidebar-content button {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-content a:hover, .sidebar-content button:hover {
    background: var(--chapter-hover-bg);
    transform: translateX(4px);
}

html.light .sidebar-content a, html.light .sidebar-content button {
    color: #1f2937;
}

html.dark .sidebar-content a, html.dark .sidebar-content button {
    color: #e5e7eb;
}

html.light .sidebar-content .admin-inactive {
    stroke: #6b7280;
}

html.dark .sidebar-content .admin-inactive {
    stroke: #9ca3af;
}

.sidebar-content .admin-active {
    stroke: #3b82f6;
}

/* Jinja-специфические стили */



.myc::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80%;
    background-image: linear-gradient(to bottom, #3a4866 0%, rgba(50, 66, 101, 0) 50%);
    z-index: -10;
}



/* .myc2 {
    box-shadow: 0 -4px 6px -1px rgb(44 60 61 / 47%), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
} */

.alt-myc1 {
    margin-top: 3rem;
    position: absolute;
    width: 75%;
    z-index: 10;
}

@media (min-width: 480px) {
    .alt-myc2 {
        opacity: 0 !important;
    }
}

.alt-myc2 {
    opacity: 0.5;
    filter: blur(0.5rem);
    margin-top: -35px;
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 15%, #111827 75%, #111827 100%);
}

.background-right {
    position: fixed;
    top: 0;
    right: 0;
    width: 70%;
    height: 600px;
    background-image: url(https://i.pinimg.com/736x/80/49/64/804964a226be1335a618e07c3a896406.jpg);
    background-size: cover;
    background-position: bottom;
    z-index: -1;
    overflow: hidden;
    opacity: 1;
    transform: scaleX(-1);
    filter: saturate(0.65);
    /* mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 20%, rgba(0, 0, 0, 0.2) 55.33%, rgba(0, 0, 0, 0) 100%), linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 40%, rgba(0, 0, 0, 0.2) 66.67%, rgba(0, 0, 0, 0) 100%); */
    mask-image: 
        linear-gradient(to bottom, 
            rgba(0, 0, 0, 1) 0%, 
            rgba(0, 0, 0, 0.5) 20%, 
            rgba(0, 0, 0, 0.2) 55.33%, 
            rgba(0, 0, 0, 0) 100%
        ),
        linear-gradient(to right, 
            rgba(0, 0, 0, 1) 0%, 
            rgba(0, 0, 0, 0.8) 40%, 
            rgba(0, 0, 0, 0.2) 66.67%, 
            rgba(0, 0, 0, 0) 100%
        );
    mask-composite: intersect;
    -webkit-mask-composite: source-in;
}

@media (min-width: 640px) {
    .background-left {
        position: absolute;
        top: 0;
        left: 0;
        width: 500px !important;
        height: 120vh !important;
        background-image: url(https://i.pinimg.com/1200x/b2/82/a5/b282a5f….jpg);
        background-size: cover;
        background-position-y: -3rem !important;
        background-position-x: -5rem !important;
        background-repeat: no-repeat !important;
        z-index: -1;
        overflow: hidden;
        opacity: 1;
        transform: scaleX(1);
        filter: saturate(0.5);
        mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 30%, rgba(0, 0, 0, 0) 53.33%, rgba(0, 0, 0, 0) 100%), linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0) 66.67%, rgba(0, 0, 0, 0) 100%);
        mask-composite: intersect;
        -webkit-mask-composite: source-in;
    }
}

@media (min-width: 500px) and (max-width: 1920px) {
    .background-right {
        /* filter: saturate(1) blur(5px) !important; */
        background-position: 15% !important;
    }
}

@media (min-width: 1024px) and (max-width: 1920px) {
    .background-right {
        /* filter: saturate(1) blur(5px) !important; */
        background-position: 15% !important;
        background-position-y: -20rem !important;
    }
}

.background-left {
    position: absolute;
    top: 0; 
    left: 0;
    width: 70%;
    height: 120vh;
    background-image: url(https://i.pinimg.com/1200x/b2/82/a5/b282a5f423b323c9d7f6456774aa171a.jpg);
    background-size: cover;
    background-position: 68%;
    background-position-y: -3rem;
    z-index: -1; 
    overflow: hidden; 
    opacity: 1;
    transform: scaleX(1);
    filter: saturate(0.5);
    mask-image: 
        linear-gradient(to bottom, 
            rgba(0, 0, 0, 1) 0%, 
            rgba(0, 0, 0, 0.5) 30%, 
            rgba(0, 0, 0, 0) 53.33%, 
            rgba(0, 0, 0, 0) 100%
        ),
        linear-gradient(to right, 
            rgba(0, 0, 0, 1) 0%, 
            rgba(0, 0, 0, 1) 40%, 
            rgba(0, 0, 0, 0) 66.67%, 
            rgba(0, 0, 0, 0) 100%
        );
    mask-composite: intersect;
    -webkit-mask-composite: source-in;
}

@media (max-width: 640px) {
    .modal-content {
        width: 100vw;
        padding: 1.5rem;
        margin-top: 60px;
        overflow-x: hidden;
        border-top-left-radius: 25px;
        border-top-right-radius: 25px;
    }

    .read-btn {
        width: 100%;
        text-align: center;
    }

    .admin-toggle-button, .dashboard-button {
        width: 28px;
        height: 28px;
    }

    .admin-toggle-button svg, .dashboard-button svg {
        width: 28px;
        height: 28px;
    }
}

/* Стили tab-switcher */

.tab-switcher {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    /* border-bottom: 1px solid var(--border-login-color); */
}

.tab-button {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    position: relative;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tab-button.active {
    color: #3b82f6;
}

.tab-button::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.tab-button.active::after {
    transform: scaleX(1);
    opacity: 1;
}

.tab-button:hover::after {
    transform: scaleX(1);
    opacity: 0.7;
}

.tab-content {
    transition: opacity 0.3s ease;
}

.tab-content.hidden {
    display: none;
    opacity: 0;
}

.tab-content:not(.hidden) {
    opacity: 1;
}

@media (max-width: 640px) {
    .tab-switcher {
        justify-content: center;
    }

    .tab-button {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Стили для блока комментариев */

.comments-container {
    margin-top: 2rem;
    padding: 0 1rem;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .comments-container.container {
        max-width: 1024px !important;
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 640px) {
    .comments-container {
        padding: 0 0.5rem !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .comment-item {
        /* padding-right: 0.25rem !important; */
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .comment-item p {
        font-size: 0.875rem !important; /* Уменьшаем размер шрифта для длинных комментариев на мобильных */
    }
    .comment-replies {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .comments-input-container {
        padding: 1rem !important;
    }

    .comment-item[data-depth="0"] .avatar-circle {
        width: 2.5rem !important; /* Уменьшенный размер для нулевого уровня на мобильных */
        height: 2.5rem !important;
        font-size: 0.875rem !important;
    }
    .comment-item[data-depth="1"] .avatar-circle,
    .comment-replies .avatar-circle {
        width: 2rem !important; /* Уменьшенный размер для ответов на мобильных */
        height: 2rem !important;
        font-size: 0.65rem !important;
    }
}

.comments-input-container {
    /* background-color: var(--card-bg); */
    transition: background-color 0.3s ease, color 0.3s ease;
    border-radius: 8px;
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
}

@media (min-width: 640px) {
    .comments-input-container {
        /* padding: 1.5rem; */
        /* padding-right: 1.5rem; */
        padding-top: 1.5rem;
    }
}

/* Стили для блока ввода комментариев */

.comment-input-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-radius: 8px;
    /* overflow: hidden; */
    background-color: var(--input-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    /* background-color: var(--modal-bg); */
}

.comment-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5); /* Подсветка при фокусе */
}

.comment-input-area {
    flex-grow: 1;
    position: relative;
}

#comment-input {
    min-height: 60px;
    /* max-height: 200px; */
    width: 100%;
    padding: 0.75rem;
    padding-bottom: 0;
    border: none;
    color: var(--text-color);
    resize: none;
    overflow-y: auto;
    transition: height 2.3s ease;
    box-sizing: border-box;
    line-height: 1.5;
}

#comment-input:focus {
    outline: none;
    box-shadow: none;
}

.comment-controls {
    display: flex;
    align-items: center;
    justify-content: end;
    min-height: 48px;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    padding-top: 0;
    /* background-color: var(--card-bg); */
    /* border-top: 1px solid var(--border-login-color); */
}

/* Кнопка отправки */

.comment-submit-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-submit-btn:hover,
.comment-submit-btn:active {
    background-color: #2563eb;
}

.comment-submit-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#comment-form .comment-submit-btn {
    display: none;
}

#comment-form .comment-submit-btn.visible {
    display: flex;
}

.reply-form-container .comment-submit-btn {
    display: none;
}

.reply-form-container .comment-submit-btn.visible {
    display: flex;
}

.comment-submit-btn .submit-icon {
    display: none;
    width: 1.5rem;
    height: 1.5rem;
    stroke: #ffffff;
    fill: none;
}

@media (max-width: 400.1px) {
    .comment-submit-btn {
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        border-radius: 50%;
    }
    .comment-submit-btn .submit-text {
        display: none;
    }
    .comment-submit-btn .submit-icon {
        display: block !important;
    }
}

/* Стили для полосы прокрутки текстового поля */

#comment-input::-webkit-scrollbar {
    width: 8px;
}

#comment-input::-webkit-scrollbar-track {
    background: var(--input-bg);
    border-radius: 4px;
}

#comment-input::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 4px;
    transition: background 0.2s ease;
}

#comment-input::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

#comment-input {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 var(--input-bg);
}

/* Общие стили для блока комментариев */

.comment-item .avatar-circle {
    background-color: var(--circle-bg);
    color: var(--text-color);
    font-weight: 600;
    border: solid #ffffff2b 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, color 0.3s ease;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 0.875rem;
}

.comment-item[data-depth="0"] .avatar-circle {
    width: 2.7rem;
    height: 2.7rem;
    font-size: 1rem;
}

.comment-item[data-depth="1"] .avatar-circle,
.comment-replies .avatar-circle {
    font-size: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
}

.comment-item {
    /* background-color: var(--card-bg); */
    border-radius: 8px;
    padding-top: 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.comment-item .comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comment-item .comment-meta {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.comment-item .username {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
}

.comment-item .comment-time {
    font-size: 0.75rem;
    color: var(--text-gray, #6b7280);
    display: inline-block;
    width: fit-content;
    cursor: pointer;
    transition: color 0.2s ease;
}

.comment-item .comment-time:hover {
    color: #60a5fa !important;
}

@media (max-width: 640px) {
    .comment-time {
        font-size: 0.65rem !important; 
        display: inline-block;
        width: fit-content;
        position: relative;
        cursor: default;
        transition: color 0.2s ease;
    }
    .comment-time:hover::after {
        content: attr(title);
        position: absolute;
        bottom: 80%;
        left: 100%;
        background-color: var(--modal-bg);
        color: var(--text-color);
        padding: 0.4rem 0.6rem;
        border-radius: 6px;
        font-size: 0.65rem;
        white-space: nowrap;
        z-index: 10;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        opacity: 1;
        transition: opacity 0.2s ease, transform 0.2s ease;
        transform: translateX(-10%) translateY(-4px);
    }
    .comment-time::after {
        opacity: 0;
        transform: translateX(-50%) translateY(0);
        transition: opacity 0.2s ease, transform 0.2s ease;
    }
}

.comment-item .comment-text {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}

@media (max-width: 640px) {
    .comment-item .comment-header {
        gap: 0.5rem !important;
    }

    .comment-item .avatar-circle {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 0.75rem !important;
    }

    .comment-item .username {
        font-size: 0.85rem !important;
    }

    .comment-item .comment-time {
        font-size: 0.65rem !important;
    }

    .comment-item .comment-text {
        font-size: 1rem !important;
        margin-top: 0.5rem !important;
        line-height: 1.6 !important;
        font-family: -apple-system, BlinkMacSystemFont, Open Sans, Roboto, Helvetica Neue, Helvetica, sans-serif;
    }
}

.comment-item p {
    word-break: break-word; /* Разбиваем длинные слова */
    white-space: normal; /* Обычный перенос текста */
    max-width: 100%;
}

.comment-item.comment-animate {
    animation: fadeSlideInComment 0.5s ease forwards;
}

.more-replies {
    color: var(--text-buttons-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

/* Кнопка "Ответить" */

.comment-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-left: -0.5rem;
    padding: 0.5rem;
    transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease;
    border-radius: 4px;
    touch-action: manipulation;
}

.comment-action-btn:hover,
.comment-action-btn:active {
    opacity: 1;
    background-color: var(--chapter-hover-bg);
}

@media (max-width: 640px) {
    .comment-action-btn {
        padding: 0.4rem;
    }
}

html.dark .comment-action-btn {
    color: #9ca3af;
}

/* Стили для спойлера */

.spoiler-blur {
    filter: blur(4px);
    transition: filter 0.2s ease;
    cursor: pointer;
    padding: 0 0.2rem;
    border-radius: 4px;
    display: inline-block;
}

.spoiler-blur:hover {
    filter: none;
}

.comment-item blockquote {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
    box-sizing: border-box;
}

/* Стили для формы ответа */

.reply-form-container {
    margin-top: 1rem;
    margin-left: 1.5rem;
    display: none;
}

.reply-form-container.show {
    display: block;
    animation: fadeInRight 0.2s ease;
}

.reply-form-container .comment-input-wrapper {
    width: 100%;
    max-width: calc(100% + 1.5rem);
}

.reply-form-container .comment-input-area {
    width: 100%;
}

.reply-form-container .comment-submit-icon {
    display: none;
    transform: scale(1.2);
}

.reply-form-container .comment-submit-icon.visible {
    display: block;
}

.reply-form-container textarea {
    min-height: 50px;
    width: 100%;
    padding: 0.75rem;
    padding-bottom: 0;
    border: none;
    color: var(--text-color);
    resize: none;
    overflow-y: auto;
    transition: height 0.3s ease;
    box-sizing: border-box;
    line-height: 1.5;
}

.reply-form-container textarea:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.reply-form-container textarea:focus {
    scroll-margin-top: 60px !important;
}

@media (max-width: 640px) {
    .reply-form-container textarea {
        min-height: 50px;
    }

    .reply-form-container {
        margin-left: 1rem;
    }

    .reply-form-container .comment-input-wrapper {
        width: 120vw;
        max-width: calc(100% + 1rem) !important;
    }

    .reply-form-container .comment-submit-icon {
        transform: scale(1.1);
        min-width: 50px;
    }
}

/* Кнопки "свернуть / n ответов" */

.toggle-replies-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem; 
    cursor: pointer;
    padding-left: 0.5rem;
    margin-right: 1rem;
    border-radius: 4px;
    transition: color 0.2s ease, opacity 0.2s ease;
    color: var(--text-buttons-color);
    opacity: 0.7;
    touch-action: manipulation;
}

.toggle-replies-btn:hover {
    opacity: 1;
}

@media (min-width: 640px) {
    .toggle-replies-btn:hover {
        color: var(--text-buttons-color-h);
    }
}

/* Значения ширины текстового поля ответа для уровней 0–4 */

@media (max-width: 640px) {
    .comment-item[data-depth="0"] .reply-form-container .comment-input-wrapper {
        max-width: calc(100vw - 3.2rem) !important;
    }

    .comment-item[data-depth="1"] .reply-form-container .comment-input-wrapper {
        max-width: calc(100vw - 4.2rem) !important;
    }

    .comment-item[data-depth="2"] .reply-form-container .comment-input-wrapper {
        max-width: calc(100vw - 5.4rem) !important;
    }

    .comment-item[data-depth="3"] .reply-form-container .comment-input-wrapper {
        max-width: calc(100vw - 6.4rem) !important;
    }

    .comment-item[data-depth="4"] .reply-form-container .comment-input-wrapper {
        max-width: calc(100vw - 7.5rem) !important;
    }
}

/* Left-border для уровней 0–3 и 3+ */

.comment-item {
    --comment-border: none;
}

.comment-item[data-depth="0"],
.comment-item[data-depth="1"],
.comment-item[data-depth="2"],
.comment-item[data-depth="3"] {
    --comment-border: 2px solid #3b83f631;
}

/* Отступы для уровней 0–3 и 3+ */

.comment-item {
    --comment-indent: 0rem; 
}

.comment-item[data-depth="0"],
.comment-item[data-depth="1"],
.comment-item[data-depth="2"],
.comment-item[data-depth="3"] {
    --comment-indent: 1rem;
}

@media (min-width: 640px) {
    .comment-item[data-depth="0"],
    .comment-item[data-depth="1"],
    .comment-item[data-depth="2"],
    .comment-item[data-depth="3"] {
        --comment-indent: 2.5rem !important;
    }
}

/* Стили появления ответов после отправки */

.comment-replies {
    border-left: var(--comment-border);
    padding-left: var(--comment-indent);
    border-radius: 0px 0px;
}

.comment-replies.show {
    max-height: none;
    opacity: 1;
    display: block;
    animation: fadeIn 0.8s ease;
}

.comment-replies.hidden {
    max-height: 0;
    opacity: 0;
    display: none;
}

/* Отростки от аватаров-ответов */

/* 
.comment-replies {
    position: relative; 
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
    border-left: var(--comment-border);
    padding-left: var(--comment-indent); 
    border-radius: 0px 0px;
    max-width: 100%;
    box-sizing: border-box;
}

.comment-replies::before {
    content: '';
    position: absolute;
    top: 0;
    left: calc(var(--comment-indent) - 1px); 
    right: auto; 
    height: 2rem; 
    width: calc(2.75rem + 0.75rem + 0.5rem); 
    border-bottom: 1px solid #3b82f6; 
    border-radius: 0 0 8px 0; 
    transform: translateY(-2rem); 
    z-index: 1; 
}

.comment-replies.hidden::before {
    display: none; 
}

@media (max-width: 640px) {
    .comment-replies::before {
        height: 1.5rem;
        width: calc(2.5rem + 0.5rem + 0.3rem);
        transform: translateY(-1.5rem);
    }
} */

/* Кнопки форматирования (Bold,Italic,Spoiler...) */

.format-btn {
    background: none;
    transition: background-color 0.2s ease, transform 0.3s ease;
}

.format-btn:hover {
    background-color: var(--chapter-hover-bg);
    transform: scale(1.1);
}

/* Кнопка отмены в ответе */

.cancel-reply-btn {
    background-color: #33333380;
    font-size: 0.875rem;
    transition: background-color 0.3s ease;
}

.cancel-reply-btn:hover,
.cancel-reply-btn:active {
    background-color: #4b4b4b;
}

.cancel-reply-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Меню форматирования */

@media (max-width: 500px) {
    .format-menu {
        transform: translateY(10px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .format-menu.hidden {
        pointer-events: none;
    }

    .format-menu:not(.hidden) {
        opacity: 1;
        transform: translateY(0);
    }

    .format-menu-btn {
        transition: background-color 0.2s ease, transform 0.2s ease;
    }

    .format-menu-btn:hover {
        background-color: var(--chapter-hover-bg);
        transform: scale(1.1);
    }
}

/* Всякое */

.toastify {
    display: none !important;
}

.comment-header {
    scroll-margin-top: 70px;
}

.ILogo {
    fill: black;
    /* fill: var(--text-color); */
}