    /* Container styles */
        .max-w-5xl {
            max-width: 64rem;
        }
        .mx-auto {
            margin-left: auto;
            margin-right: auto;
        }
        .bg-white {
            background-color: #fff;
        }
        .rounded-xl {
            border-radius: 0.75rem;
        }
        .shadow-2xl {
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        }
        .p-4 {
            padding: 1rem;
        }
        .sm\:p-6 {
            padding: 1.5rem;
        }
        .md\:p-8 {
            padding: 2rem;
        }

        /* Header styles */
        .mb-8 {
            margin-bottom: 2rem;
        }
        .text-3xl {
            font-size: 1.875rem; /* 30px */
            line-height: 2.25rem; /* 36px */
        }
        @media (min-width: 768px) { /* md: */
            .md\:text-4xl {
                font-size: 2.25rem; /* 36px */
                line-height: 2.5rem; /* 40px */
            }
        }
        .font-bold {
            font-weight: 700;
        }
        .text-center {
            text-align: center;
        }
        .text-sky-600 {
            color: #4285f4;
        }
        .text-slate-500 {
            color: #64748b;
        }

        /* User Message styles */
        #userMessage {
            margin-bottom: 1rem; /* mb-4 */
            padding: 0.75rem; /* p-3 */
            border-radius: 0.375rem; /* rounded-md */
            font-size: 0.875rem; /* text-sm */
            /* display: none; - Handled by .hidden class */
        }
        #userMessage.bg-red-100 { background-color: #fee2e2; }
        #userMessage.text-red-700 { color: #b91c1c; }
        #userMessage.bg-green-100 { background-color: #dcfce7; }
        #userMessage.text-green-700 { color: #15803d; }
        #userMessage.bg-blue-100 { background-color: #dbeafe; }
        #userMessage.text-blue-700 { color: #1d4ed8; }

        /* Drop Zone styles */
        #dropZone {
            border-width: 2px; /* border-2 */
            border-style: dashed; /* border-dashed */
            border-color: #38bdf8; /* border-sky-400 */
            border-radius: 0.5rem; /* rounded-lg */
            padding: 2rem; /* p-8 */
            text-align: center; /* text-center */
            cursor: pointer; /* cursor-pointer */
            transition-property: background-color, border-color; /* transition-colors */
            transition-duration: 200ms; /* duration-200 */
            margin-bottom: 1.5rem; /* mb-6 */
        }
        #dropZone:hover {
            background-color: #f0f9ff; /* hover:bg-sky-50 */
            border-color: #4285f4; /* hover:border-sky-500 */
        }
        #dropZone i {
            color: #4285f4; /* text-sky-500 */
            font-size: 2.25rem; /* text-4xl */
            margin-bottom: 0.75rem; /* mb-3 */
        }
        #dropZone .drop-message {
            display: block; /* block */
            font-weight: 500; /* font-medium */
            color: #475569; /* text-slate-600 */
        }
        #dropZone p {
            font-size: 0.75rem; /* text-xs */
            color: #94a3b8; /* text-slate-400 */
            margin-top: 0.25rem; /* mt-1 */
        }

        /* Controls section styles */
        #controls {
            /* display: none; - Handled by .hidden class */
            --tw-space-y-reverse: 0;
            margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
            margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); /* space-y-6 */
        }
        #controls > *:not([hidden]) ~ *:not([hidden]) {
            margin-top: 1.5rem; /* space-y-6 */
        }

        /* Control row styles */
        .flex { display: flex; }
        .flex-col { flex-direction: column; }
        @media (min-width: 640px) { /* sm: */
            .sm\:flex-row { flex-direction: row; }
            .sm\:items-center { align-items: center; }
            .sm\:justify-between { justify-content: space-between; }
        }
        .gap-4 { gap: 1rem; }
        .p-4 { padding: 1rem; }
        .bg-slate-50 { background-color: #f8fafc; }
        .rounded-lg { border-radius: 0.5rem; }
        .shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }

        /* Select/Button group styles */
        .flex-grow { flex-grow: 1; }
        .block { display: block; }
        .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
        .font-medium { font-weight: 500; }
        .text-slate-700 { color: #334155; }
        .mb-1 { margin-bottom: 0.25rem; }
        .w-full { width: 100%; }
        .p-2 { padding: 0.5rem; }
        .border { border-width: 1px; }
        .border-slate-300 { border-color: #cbd5e1; }
        .shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
        .focus\:ring-sky-500:focus { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #4285f4; } /* focus:ring-sky-500 */
        .focus\:border-sky-500:focus { border-color: #4285f4; } /* focus:border-sky-500 */

        /* Button styles */
        .bg-emerald-500 { background-color: #10b981; }
        .hover\:bg-emerald-600:hover { background-color: #059669; }
        .text-white { color: #fff; }
        .font-semibold { font-weight: 600; }
        .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
        .px-4 { padding-left: 1rem; padding-right: 1rem; }
        .rounded-md { border-radius: 0.375rem; }
        .transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
        .flex { display: flex; }
        .items-center { align-items: center; }
        .justify-center { justify-content: center; }
        .mr-2 { margin-right: 0.5rem; }
        @media (min-width: 640px) { /* sm: */
            .sm\:w-auto { width: auto; }
        }

        /* Download button styles */
        #downloadBtn {
            /* display: none; - Handled by .hidden class */
            background-color: #f43f5e; /* bg-rose-500 */
            padding-left: 1.5rem; /* px-6 */
            padding-right: 1.5rem; /* px-6 */
        }
        #downloadBtn:hover {
            background-color: #e11d48; /* hover:bg-rose-600 */
        }
        #downloadMessage {
            /* display: none; - Handled by .hidden class */
            margin-top: 0.5rem; /* mt-2 */
            color: #047857; /* text-emerald-600 */
            font-weight: 500; /* font-medium */
        }

        /* Signature Tools section */
        .p-4 { padding: 1rem; }
        .space-y-4 > *:not([hidden]) ~ *:not([hidden]) {
            margin-top: 1rem; /* space-y-4 */
        }
        .text-xl { font-size: 1.25rem; line-height: 1.75rem; }
        .text-sky-700 { color: #0369a1; }
        .border-b { border-bottom-width: 1px; }
        .pb-2 { padding-bottom: 0.5rem; }
        .mb-3 { margin-bottom: 0.75rem; }

        /* File input custom styling */
        input[type="file"] {
            color: #64748b; /* text-slate-500 */
            font-size: 0.875rem; /* text-sm */
        }
        input[type="file"]::file-selector-button {
            margin-right: 1rem; /* file:mr-4 */
            padding-top: 0.5rem; /* file:py-2 */
            padding-bottom: 0.5rem; /* file:py-2 */
            padding-left: 1rem; /* file:px-4 */
            padding-right: 1rem; /* file:px-4 */
            border-radius: 9999px; /* file:rounded-full */
            border-width: 0; /* file:border-0 */
            font-size: 0.875rem; /* file:text-sm */
            font-weight: 600; /* file:font-semibold */
            background-color: #f0f9ff; /* file:bg-sky-50 */
            color: #0369a1; /* file:text-sky-700 */
            cursor: pointer;
            transition: background-color 150ms ease-in-out;
        }
        input[type="file"]::file-selector-button:hover {
            background-color: #e0f2fe; /* hover:file:bg-sky-100 */
        }

        /* Grid layout for signature tools */
        .grid { display: grid; }
        @media (min-width: 768px) { /* md: */
            .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        }
        .gap-6 { gap: 1.5rem; }
        .items-start { align-items: flex-start; }
        .space-y-3 > *:not([hidden]) ~ *:not([hidden]) {
            margin-top: 0.75rem; /* space-y-3 */
        }

        /* Checkbox styles */
        input[type="checkbox"] {
            height: 1rem; /* h-4 */
            width: 1rem; /* w-4 */
            color: #4285f4; /* text-sky-600 */
            border-color: #cbd5e1; /* border-slate-300 */
            border-radius: 0.25rem; /* rounded */
        }
        input[type="checkbox"]:focus {
            box-shadow: 0 0 0 2px #fff, 0 0 0 4px #4285f4; /* focus:ring-sky-500 */
        }
        .ml-2 { margin-left: 0.5rem; }

        /* Signature Preview Box */
        .h-32 { height: 8rem; }
        .border-dashed { border-style: dashed; }
        .bg-white { background-color: #fff; }
        .overflow-hidden { overflow: hidden; }

        /* Slider styles */
        .font-normal { font-weight: 400; }
        input[type="range"] {
            height: 0.5rem; /* h-2 */
            background-color: #e2e8f0; /* bg-slate-200 */
            border-radius: 0.5rem; /* rounded-lg */
            -webkit-appearance: none; /* For Safari */
            appearance: none;
            cursor: pointer;
            accent-color: #4285f4; /* accent-sky-500 */
        }
        /* Specific thumb styles for range input (cross-browser compatibility) */
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 16px; /* Adjust as needed */
            height: 16px; /* Adjust as needed */
            border-radius: 50%;
            background: #4285f4; /* Tailwind blue-500 */
            border: 1px solid #4285f4;
            box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.4); /* Light blue shadow */
            margin-top: -5px; /* Adjust to center thumb vertically */
        }
        input[type="range"]::-moz-range-thumb {
            width: 16px; /* Adjust as needed */
            height: 16px; /* Adjust as needed */
            border-radius: 50%;
            background: #4285f4; /* Tailwind blue-500 */
            border: 1px solid #4285f4;
            box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.4); /* Light blue shadow */
        }
        input[type="range"]::-ms-thumb {
            width: 16px; /* Adjust as needed */
            height: 16px; /* Adjust as needed */
            border-radius: 50%;
            background: #4285f4; /* Tailwind blue-500 */
            border: 1px solid #4285f4;
            box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.4); /* Light blue shadow */
        }


        /* Action buttons in signature tools */
        .flex-1 { flex: 1 1 0%; }
        .bg-sky-500 { background-color: #4285f4; }
        .hover\:bg-sky-600:hover { background-color: #4285f4; }
        .bg-amber-500 { background-color: #f59e0b; }
        .hover\:bg-amber-600:hover { background-color: #d97706; }
        .mr-1 { margin-right: 0.25rem; }

        /* Signature History */
        .signature-history-container { margin-top: 1rem; /* mt-4 */ }
        #signatureHistory img, #mobileSignatureHistory img {
    max-width: 100%;
}
        .text-md { font-size: 1rem; line-height: 1.5rem; }
        #signatureHistory {
            display: flex; /* flex */
            flex-wrap: wrap; /* flex-wrap */
            gap: 0.5rem; /* gap-2 */
            padding: 0.5rem; /* p-2 */
            background-color: #e2e8f0; /* bg-slate-200 */
            border-radius: 0.375rem; /* rounded-md */
            min-height: 50px; /* min-h-[50px] */
        }
        #mobileSignatureHistory {
            display: flex; /* flex */
            flex-wrap: wrap; /* flex-wrap */
            gap: 0.5rem; /* gap-2 */
            padding: 0.5rem; /* p-2 */
            background-color: #e2e8f0; /* bg-slate-200 */
            border-radius: 0.375rem; /* rounded-md */
            min-height: 50px; /* min-h-[50px] */
            margin-top: 0.5rem; /* mt-2 */
        }
        @media (min-width: 768px) { /* md: */
            #mobileSignatureHistory {
                display: none; /* md:hidden */
            }
        }
        .desktop-sig-thumb, .mobile-sig-thumb {
            width: 6rem; /* w-24 */
            height: 3rem; /* h-12 */
            border: 1px solid #cbd5e1; /* border border-slate-300 */
            border-radius: 0.375rem; /* rounded-md */
            padding: 0.25rem; /* p-1 */
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition-property: all; /* transition-all */
            transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
            transition-duration: 150ms;
        }
        .desktop-sig-thumb:hover, .mobile-sig-thumb:hover {
            border-color: #4285f4; /* hover:border-sky-500 */
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* hover:shadow-md */
        }
        .desktop-sig-thumb.border-sky-500, .mobile-sig-thumb.border-sky-500 {
            border-color: #4285f4; /* border-sky-500 */
        }
        .desktop-sig-thumb.ring-2, .mobile-sig-thumb.ring-2 {
            box-shadow: 0 0 0 2px #7dd3fc; /* ring-2 ring-sky-300 */
        }

        /* Progress indicator */
        #progress {
            /* display: none; - Handled by .hidden class */
            text-align: center; /* text-center */
            padding-top: 0.75rem; /* py-3 */
            padding-bottom: 0.75rem; /* py-3 */
            color: #4285f4; /* text-sky-600 */
            font-weight: 500; /* font-medium */
        }

        /* Page Navigation */
        #pageNavigation {
            /* display: none; - Handled by .hidden class */
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem; /* gap-3 */
            padding-top: 0.75rem; /* py-3 */
            padding-bottom: 0.75rem; /* py-3 */
        }
        #pageNavigation button {
            padding-left: 1rem; /* px-4 */
            padding-right: 1rem; /* px-4 */
            padding-top: 0.5rem; /* py-2 */
            padding-bottom: 0.5rem; /* py-2 */
            background-color: #e2e8f0; /* bg-slate-200 */
            color: #334155; /* text-slate-700 */
            border-radius: 0.375rem; /* rounded-md */
            box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); /* shadow */
            font-size: 0.875rem; /* text-sm */
            transition-property: background-color; /* transition-colors */
            transition-duration: 200ms;
        }
        #pageNavigation button:hover {
            background-color: #cbd5e1; /* hover:bg-slate-300 */
        }
        #pageNavigation button:disabled {
            opacity: 0.5; /* disabled:opacity-50 */
            cursor: not-allowed; /* disabled:cursor-not-allowed */
        }
        #pageNavigation span {
            font-size: 0.875rem; /* text-sm */
            font-weight: 500; /* font-medium */
            color: #475569; /* text-slate-600 */
        }
        #pageNavigation i {
            margin-right: 0.25rem; /* mr-1 */
            margin-left: 0.25rem; /* ml-1 */
        }

        /* Output Preview Container */
        .output-container { margin-top: 1.5rem; /* mt-6 */ }
        #outputPreview {
            border: 1px solid #cbd5e1; /* border border-slate-300 */
            border-radius: 0.5rem; /* rounded-lg */
            box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06); /* shadow-inner */
            background-color: #f8fafc; /* bg-slate-50 */
            min-height: 500px; /* min-h-[500px] */
            position: relative; /* relative */
            overflow: hidden; /* overflow-hidden */
        }
        @media (min-width: 768px) { /* md: */
            #outputPreview {
                min-height: 700px; /* md:min-h-[700px] */
            }
        }

        /* Canvas specific styles */
        .canvas-container {
            width: 100%; /* w-full */
            height: 100%; /* h-full */
            overflow-x: hidden; /* Prevent horizontal scroll */
            overflow-y: auto; /* Allow vertical scroll for canvas container */
            touch-action: none; /* Prevent scrolling while interacting with canvas content */
        }
        .page-canvas {
            display: block;
            max-width: 100%;
            height: auto;
            margin: 0 auto;
            touch-action: none; /* Crucial for preventing page scroll during canvas interaction */
        }

        /* Style for the drag preview on mobile for signature history */
        .drag-preview {
            position: fixed;
            width: 80px;
            height: 40px;
            background-size: contain;
            background-repeat: no-repeat;
            background-position: center;
            z-index: 10000;
            pointer-events: none;
            opacity: 0.7;
            border: 1px dashed #3b82f6; /* Tailwind blue-500 */
            border-radius: 4px;
        }

        /* Custom animation for download message */
        .fade-in-out {
            animation: fadeInOutAnimation 3s ease-in-out;
        }
        @keyframes fadeInOutAnimation {
            0%, 100% { opacity: 0; transform: translateY(10px); }
            10%, 90% { opacity: 1; transform: translateY(0); }
        }

        /* Ensure signature preview canvas is visible */
        #signaturePreview canvas {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            
        }
         @media (max-width: 768px) {
            
        #signatureHistory {
    display: none;
}
}