        /* ==========================================================================
           LOCAL OFFLINE FONTS SETUP
           ========================================================================== */

        /* poppins-regular - latin */
        @font-face {
            font-family: 'Poppins';
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            src: url('../fonts/poppins-v24-latin-regular.woff2') format('woff2');
        }

        /* poppins-500 - latin */
        @font-face {
            font-family: 'Poppins';
            font-style: normal;
            font-weight: 500;
            font-display: swap;
            src: url('../fonts/poppins-v24-latin-500.woff2') format('woff2');
        }

        /* poppins-600 - latin */
        @font-face {
            font-family: 'Poppins';
            font-style: normal;
            font-weight: 600;
            font-display: swap;
            src: url('../fonts/poppins-v24-latin-600.woff2') format('woff2');
        }

        /* poppins-700 - latin */
        @font-face {
            font-family: 'Poppins';
            font-style: normal;
            font-weight: 700;
            font-display: swap;
            src: url('../fonts/poppins-v24-latin-700.woff2') format('woff2');
        }

        /* abeezee-regular - latin */
        @font-face {
            font-family: 'ABeeZee';
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            src: url('../fonts/abeezee-v23-latin-regular.woff2') format('woff2');
        }

        /* abeezee-italic - latin */
        @font-face {
            font-family: 'ABeeZee';
            font-style: italic;
            font-weight: 400;
            font-display: swap;
            src: url('../fonts/abeezee-v23-latin-italic.woff2') format('woff2');
        }

        /* dancing-script-regular - latin */
        @font-face {
            font-family: 'Dancing Script';
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            src: url('../fonts/dancing-script-v29-latin-regular.woff2') format('woff2');
        }

        /* dancing-script-700 - latin */
        @font-face {
            font-family: 'Dancing Script';
            font-style: normal;
            font-weight: 700;
            font-display: swap;
            src: url('../fonts/dancing-script-v29-latin-700.woff2') format('woff2');
        }

        /* great-vibes-regular - latin */
        @font-face {
            font-family: 'Great Vibes';
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            src: url('../fonts/great-vibes-v21-latin-regular.woff2') format('woff2');
        }

        /* font-awesome solid - local override with font-display: swap */
        @font-face {
            font-family: 'Font Awesome 6 Free';
            font-style: normal;
            font-weight: 900;
            font-display: swap;
            src: url('../webfonts/fa-solid-900.woff2') format('woff2');
        }

        /* font-awesome brands - local override with font-display: swap */
        @font-face {
            font-family: 'Font Awesome 6 Brands';
            font-style: normal;
            font-weight: 400;
            font-display: swap;
            src: url('../webfonts/fa-brands-400.woff2') format('woff2');
        }

        /* Previous styles remain the same */
        .button-wrapper {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 30px 0;
        }

        .paypal-coffee-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 12px 24px;
            background-color: #ffc439;
            color: #111;
            font-size: 18px;
            font-weight: 600;
            text-decoration: none;
            font-family: 'Segoe UI', sans-serif;
            border-radius: 40px;
            box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .paypal-coffee-button:hover {
            background-color: #ffb900;
            transform: scale(1.05);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(120deg, #e0f7fa, #b2ebf2);
            min-height: 100vh;
        }

        /* MOBILE RESPONSIVE CANVAS CONTAINER */
        .canvas-container {
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
            position: relative;
            width: 100%;
            background-color: #ffffff;
        }

        /* Desktop */
        @media (min-width: 1024px) {
            .canvas-container {
                height: 500px;
            }
        }

        /* Tablet */
        @media (max-width: 1023px) and (min-width: 768px) {
            .canvas-container {
                height: 400px;
            }
        }

        /* Mobile */
        @media (max-width: 767px) {
            .canvas-container {
                height: 300px;
            }
        }

        /* Small mobile */
        @media (max-width: 480px) {
            .canvas-container {
                height: 250px;
            }
        }

        /* Landscape mode */
        @media (max-height: 600px) and (orientation: landscape) {
            .canvas-container {
                height: 300px;
            }
        }

        /* Canvas Layers - Responsive */
        #background-layer,
        #trace-layer,
        #drawing-canvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100% !important;
            height: 100% !important;
            touch-action: none;
            -webkit-tap-highlight-color: transparent;
        }

        /* Bottom Layer */
        #background-layer {
            z-index: 1;
            pointer-events: none;
        }

        /* Middle Layer (shadow) */
        #trace-layer {
            z-index: 2;
            pointer-events: none;
        }

        /* Top Layer (write here) */
        #drawing-canvas {
            z-index: 3 !important;
            background-color: transparent !important;
            cursor: crosshair !important;
        }

        /* Responsive Trace Pen */
        #trace-pen {
            position: absolute;
            pointer-events: none;
            z-index: 9999;
            display: none;
            /* Remove transform: positioning is handled entirely by JS offsetMap */
        }

        /* Mobile adjustments for trace pen */
        @media (max-width: 768px) {
            #trace-pen {
                width: 72px;
                height: 72px;
            }
        }

        @media (max-width: 480px) {
            #trace-pen {
                width: 60px;
                height: 60px;
            }
        }

        .tool-btn {
            transition: all 0.3s ease;
        }

        .tool-btn:hover {
            transform: translateY(-3px);
        }

        .bg-gradient {
            background: linear-gradient(120deg, #2980b9, #16a085);
        }

        .tool-panel {
            background: rgba(255, 255, 255, 0.9);
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        /* Mobile adjustments for tool panel */
        @media (max-width: 768px) {
            .tool-panel {
                padding: 1rem !important;
            }

            .tool-panel .grid {
                gap: 1rem !important;
            }
        }

        .feature-card {
            transition: all 0.3s ease;
        }

        .feature-card:hover {
            transform: translateY(-5px);
        }

        .canvas-backgrounds {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
            pointer-events: none;
            border-radius: 12px;
            background-color: transparent !important;
        }

        /* =============== IMAGE BACKGROUND STYLES =============== */
        /* Image background classes - NOW HANDLED BY JS FOR CRISP LINES */
        .canvas-backgrounds.image-bg-1,
        .canvas-backgrounds.image-bg-2,
        .canvas-backgrounds.image-bg-3,
        .canvas-backgrounds.image-bg-4,
        .canvas-backgrounds.image-bg-5,
        .canvas-backgrounds.image-bg-6,
        .canvas-backgrounds.image-bg-7,
        .canvas-backgrounds.image-bg-8,
        .canvas-backgrounds.image-bg-9,
        .canvas-backgrounds.image-bg-10 {
            background-image: none !important;
            width: 100% !important;
            height: 100% !important;
        }

        /* Blank background (white) */
        .canvas-backgrounds.blank {
            background-color: #ffffff;
            background-image: none !important;
            width: 100% !important;
            height: 100% !important;
        }

        /* Active state for background option buttons */
        .bg-option.active {
            border-color: #3b82f6 !important;
            border-width: 2px !important;
            background-color: #eff6ff !important;
        }

        /* Style for image preview in button */
        .bg-option div.w-6.h-6.border.overflow-hidden {
            border-radius: 4px;
            min-width: 24px;
            min-height: 24px;
        }

        .bg-option img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        /* Remove old CSS background pattern classes COMPLETELY */
        .lined,
        .dotted,
        .grid-20mm,
        .calligraphy,
        .angle-guide,
        .ascender-baseline-descender,
        .handwriting-guidelines-preview {
            background-image: none !important;
            background: none !important;
        }

        /* Remove the old preview box styles */
        .handwriting-guidelines-preview::before {
            content: none !important;
        }

        /* Responsive adjustments for background options */
        @media (max-width: 640px) {
            .background-options .grid.grid-cols-2 {
                grid-template-columns: repeat(2, 1fr) !important;
                gap: 0.5rem !important;
            }

            .bg-option {
                padding: 0.5rem !important;
                font-size: 0.75rem !important;
            }

            .bg-option span {
                font-size: 0.7rem;
            }

            .bg-option div.w-6.h-6 {
                width: 20px !important;
                height: 20px !important;
                min-width: 20px !important;
                min-height: 20px !important;
            }
        }

        @media (max-width: 480px) {
            .background-options .grid.grid-cols-2 {
                grid-template-columns: 1fr !important;
            }

            .bg-option {
                flex-direction: row !important;
                justify-content: space-between !important;
                text-align: left !important;
            }
        }

        /* Remove old CSS pattern backgrounds from preview boxes in templates */
        .template-preview.lined,
        .template-preview.dotted,
        .template-preview.grid,
        .template-preview.calligraphy {
            background-image: none !important;
            background-color: #f9fafb !important;
        }

        /* =============== END IMAGE BACKGROUND STYLES =============== */

        .color-swatch {
            width: 25px;
            height: 25px;
            border-radius: 50%;
            cursor: pointer;
            transition: transform 0.2s;
        }

        .color-swatch:hover {
            transform: scale(1.2);
        }

        /* Mobile adjustments for color swatches */
        @media (max-width: 480px) {
            .color-swatch {
                width: 20px;
                height: 20px;
            }
        }

        .tool-icon {
            width: 110px;
            height: 45px;
            display: flex;
            flex-direction: row;
            gap: 8px;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
            padding: 5px 10px;
            background: #3b82f6;
            border: 1px solid #2563eb;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .tool-icon:hover {
            background-color: #2563eb;
        }

        .tool-icon.active {
            background-color: #1e40af;
            border-color: #1e3a8a;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .tool-icon span {
            font-size: 13px;
            font-weight: 700;
            color: white;
            letter-spacing: 0.01em;
        }



        /* Mobile adjustments for tool icons */
        @media (max-width: 480px) {
            .tool-icon {
                width: 90px;
                height: 40px;
                padding: 4px 8px;
            }
        }

        .template-preview {
            width: 100px;
            background-color: white;
            border-radius: 6px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            cursor: pointer;
            position: relative;
            transition: all 0.2s;
            padding: 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .template-preview:hover {
            transform: scale(1.05);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        }

        /* Mobile adjustments for template previews */
        @media (max-width: 768px) {
            .template-preview {
                width: 80px;
                padding: 6px;
            }
        }

        @media (max-width: 480px) {
            .template-preview {
                width: 70px;
                padding: 4px;
            }

            .templates-section .grid {
                gap: 0.5rem !important;
            }
        }

        .alphabet-template {
            background-image: url('icons/text-size.svg');
            background-repeat: no-repeat;
            background-position: center;
            background-size: 24px;
        }

        .numbers-template {
            background-image: url('icons/symbol-numeric.svg');
            background-repeat: no-repeat;
            background-position: center;
            background-size: 24px;
        }

        .cursive-template {
            background-image: url('icons/symbol-string.svg');
            background-repeat: no-repeat;
            background-position: center;
            background-size: 24px;
        }

        .calligraphy-template {
            background-image: url('icons/paintcan.svg');
            background-repeat: no-repeat;
            background-position: center;
            background-size: 24px;
        }

        .signature-template {
            background-image: url('icons/edit.svg');
            background-repeat: no-repeat;
            background-position: center;
            background-size: 24px;
        }

        /* Animation for tutorial */
        @keyframes pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(79, 195, 247, 0.5);
            }

            70% {
                box-shadow: 0 0 0 10px rgba(79, 195, 247, 0);
            }

            100% {
                box-shadow: 0 0 0 0 rgba(79, 195, 247, 0);
            }
        }

        .pulse {
            animation: pulse 2s infinite;
        }

        .nav-link {
            position: relative;
            transition: all 0.3s ease;
        }

        .nav-link::after {
            content: '';
            position: absolute;
            width: 0;
            height: 2px;
            bottom: -2px;
            left: 50%;
            background-color: #2980b9;
            transition: all 0.3s ease;
        }

        .nav-link:hover::after {
            width: 100%;
            left: 0;
        }

        .footer-link {
            transition: all 0.3s ease;
        }

        .footer-link:hover {
            transform: translateY(-3px);
        }

        .statistics-card {
            transition: all 0.3s ease;
            transform-origin: center;
        }

        .statistics-card:hover {
            transform: scale(1.02);
        }

        /* Template loader animation */
        @keyframes templateLoad {
            0% {
                opacity: 0;
                transform: translateY(20px);
            }

            100% {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Type Text Modal Styles */
        .tt-color-dot {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            cursor: pointer;
            border: 3px solid white;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        .tt-color-dot:hover {
            transform: scale(1.1);
        }

        .tt-color-dot.active {
            border-color: #3b82f6;
            transform: scale(1.2);
            box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
        }

        .tt-tab.active {
            background-color: #3b82f6 !important;
            color: white !important;
        }

        .template-load {
            animation: templateLoad 0.5s ease forwards;
        }

        /* Chart container styles */
        .chart-container {
            position: relative;
            height: 300px;
            width: 100%;
        }

        .infographic-item {
            transition: all 0.3s ease;
        }

        .infographic-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }

        .footer-widget {
            background: none !important;
            background-image: none !important;
        }

        /* Center the primary navigation menu */
        .main-navigation {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* Optional: Center menu items inside the nav list */
        .main-navigation ul {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* Optional: Remove default margin if needed */
        .main-navigation ul li {
            margin: 0 15px;
        }

        .canvas-guides {
            position: absolute;
            top: 0;
            left: 0;
            z-index: 1;
            pointer-events: none;
            opacity: 0.5;
        }

        /* Add to your CSS */
        .calligraphy-guide {
            stroke-width: 1.5;
            stroke-opacity: 0.8;
        }

        .calligraphy-label {
            font-size: 12px;
            fill: #64748b;
            font-family: Arial, sans-serif;
        }

        /* Custom styles to fix mobile menu issues */
        .mobile-menu-container {
            max-height: 90vh;
            overflow-y: auto;
        }

        .mobile-tools-submenu {
            max-height: 60vh;
            overflow-y: auto;
        }

        /* Ensure proper z-index stacking */
        .mobile-menu-overlay {
            z-index: 1000;
        }

        .mobile-tools-dropdown {
            z-index: 1001;
        }

        .tool-card-link {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 1.5rem 1rem;
            background-color: #f9fafb;
            border: 1px solid #e5e7eb;
            border-radius: 0.75rem;
            text-decoration: none;
            color: inherit;
            transition: all 0.3s ease-in-out;
            height: 100%;
        }

        .tool-card-link:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
            border-color: #3b82f6;
            color: #3b82f6;
        }

        .tool-card-link .tool-icon-wrapper {
            margin-bottom: 0.75rem;
            font-size: 2rem;
            color: #3b82f6;
        }

        .tool-card-link h4 {
            font-weight: 600;
            font-size: 0.875rem;
            line-height: 1.25;
        }

        .mb-4 a {
            color: blue;
            text-decoration: underline;
        }

        /* Responsive paper color selector */
        @media (max-width: 640px) {
            .paper-color {
                width: 20px !important;
                height: 20px !important;
            }

            .background-options h3 {
                font-size: 1rem !important;
            }

            .background-options label {
                font-size: 0.875rem !important;
            }
        }

        /* Fix for image backgrounds on high-resolution screens */
        @media (-webkit-min-device-pixel-ratio: 2),
        (min-resolution: 192dpi) {
            .canvas-backgrounds[class*="image-bg-"] {
                background-size: cover;
            }
        }

        /* Ensure proper image rendering */
        .canvas-backgrounds[class*="image-bg-"] {
            image-rendering: -webkit-optimize-contrast;
            image-rendering: crisp-edges;
            image-rendering: pixelated;
        }

        /* Remove line spacing selector styles */
        #line-spacing {
            display: none !important;
        }

        /* Hide old line spacing label */
        .background-options label[for="line-spacing"] {
            display: none !important;
        }

        /* Responsive adjustments for main content */
        @media (max-width: 768px) {
            .tool-panel .grid.grid-cols-1.md\:grid-cols-3 {
                grid-template-columns: 1fr !important;
                gap: 1.5rem !important;
            }

            .drawing-tools,
            .background-options,
            .action-controls {
                width: 100% !important;
            }
        }

        /* Responsive footer */
        @media (max-width: 768px) {
            footer .grid.grid-cols-1.md\:grid-cols-4 {
                grid-template-columns: repeat(2, 1fr) !important;
                gap: 2rem !important;
            }
        }

        @media (max-width: 480px) {
            footer .grid.grid-cols-1.md\:grid-cols-4 {
                grid-template-columns: 1fr !important;
                gap: 1.5rem !important;
            }
        }

        /* Responsive header and banner */
        @media (max-width: 640px) {
            header h2 {
                font-size: 1.75rem !important;
            }

            header p {
                font-size: 1rem !important;
            }
        }

        /* Responsive blog cards */
        @media (max-width: 768px) {
            #blog .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
                grid-template-columns: repeat(2, 1fr) !important;
            }
        }

        @media (max-width: 480px) {
            #blog .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-3 {
                grid-template-columns: 1fr !important;
            }

            .blog-card .h-40 {
                height: 150px !important;
            }
        }

        /* Responsive tool cards */
        @media (max-width: 768px) {
            .tool-card-link {
                padding: 1rem 0.75rem !important;
            }

            .tool-card-link .tool-icon-wrapper {
                font-size: 1.5rem !important;
                margin-bottom: 0.5rem !important;
            }
        }

        @media (max-width: 480px) {
            .tool-card-link h4 {
                font-size: 0.75rem !important;
            }
        }

        @media (max-width: 768px) {
            .canvas-backgrounds.image-bg-2 {
                background-position: center center !important;
            }
        }

        @media (orientation: landscape) and (max-height: 600px) {
            .canvas-backgrounds.image-bg-2 {
                background-size: contain !important;
                background-color: #ffffff;
            }
        }

        /* 7 Day Challenge Section */

        .challenge-cta {
            text-align: center;
            margin: 40px auto;
            padding: 28px 30px;
            max-width: 620px;
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
        }

        .challenge-cta h3 {
            font-size: 22px;
            margin-bottom: 8px;
            color: #2c3e50;
        }

        .challenge-cta p {
            color: #555;
            margin-bottom: 14px;
        }

        .challenge-btn {
            display: inline-block;
            padding: 13px 24px;
            background: linear-gradient(135deg, #4A90E2, #2F6FE4);
            color: white;
            border-radius: 10px;
            text-decoration: none;
            font-weight: 600;
            font-size: 15px;
            transition: all .2s ease;
        }

        .challenge-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
        }

        /* ===== DARK MODE ===== */
        body.dark-mode {
            background: #0f172a;
            color: #e2e8f0;
        }

        body.dark-mode #full-app-wrapper {
            background-color: #1e293b;
        }

        body.dark-mode header {
            background-color: #0f172a !important;
            border-color: #020617 !important;
        }

        body.dark-mode #left-sidebar,
        body.dark-mode #right-sidebar {
            background-color: #1e293b;
            border-color: #334155;
        }

        body.dark-mode #left-sidebar button,
        body.dark-mode #left-sidebar a,
        body.dark-mode #right-sidebar button,
        body.dark-mode #right-sidebar a {
            border-color: #334155;
        }

        body.dark-mode #left-sidebar .sidebar-text,
        body.dark-mode #right-sidebar .sidebar-text,
        body.dark-mode #left-sidebar span,
        body.dark-mode #right-sidebar span {
            color: #e2e8f0;
        }

        /* Left sidebar icons (outer) stay white in dark mode */
        body.dark-mode #left-sidebar .w-12.h-12:not(#write-practice-icon):not(.color-swatch):not(.paper-color) {
            background-color: #ffffff !important;
            border-color: #ffffff !important;
        }

        /* Ensure icons inside these white boxes are dark blue/visible */
        body.dark-mode #left-sidebar .w-12.h-12:not(#write-practice-icon) i:not(#sidebar-color-icon) {
            color: #1e3a8a !important;
        }

        /* Right sidebar specific previews (Page Lines, Select) stay white */
        body.dark-mode .sidebar-preview-box,
        body.dark-mode .sidebar-page-btn-icon {
            background-color: #ffffff !important;
            border-color: #ffffff !important;
        }

        body.dark-mode .sidebar-preview-box i,
        body.dark-mode .sidebar-preview-box strong,
        body.dark-mode #sidebar-current-page {
            color: #1e3a8a !important;
        }

        /* Standard right sidebar icons stay dark */
        body.dark-mode #right-sidebar .w-12.h-12:not(.sidebar-preview-box):not(.sidebar-page-btn-icon) {
            background-color: rgba(51, 65, 85, 0.6);
            border-color: #475569;
        }

        /* Sidebar Popouts stay dark with light text */
        body.dark-mode .menu-popout {
            background-color: #1e293b !important;
            border-color: #475569 !important;
            color: #e2e8f0 !important;
        }

        body.dark-mode .menu-popout label,
        body.dark-mode .menu-popout p,
        body.dark-mode .menu-popout h3,
        body.dark-mode .menu-popout h4 {
            color: #e2e8f0 !important;
        }

        body.dark-mode .tool-icon span {
            color: #000000 !important;
            font-weight: 900 !important;
        }

        body.dark-mode .page-num-label,
        body.dark-mode .page-popout-btn span {
            color: #1e3a8a !important;
        }

        body.dark-mode .active span,
        body.dark-mode .active .page-num-label {
            color: #ffffff !important;
        }

        body.dark-mode .page-popout-btn {
            background-color: #ffffff !important;
            color: #1e3a8a !important;
        }

        body.dark-mode .page-popout-btn.active {
            background-color: #1e3a8a !important;
            color: #ffffff !important;
            box-shadow: 0 0 15px rgba(59, 130, 246, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.3) !important;
            border-color: #ffffff !important;
            transform: scale(1.1);
            z-index: 10;
        }

        /* Bottom toolbar dark mode */
        body.dark-mode #bottom-toolbar {
            background-color: #1e293b !important;
            border-color: #334155 !important;
        }

        body.dark-mode #bottom-toolbar .bg-gray-50 {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }

        body.dark-mode #bottom-toolbar span,
        body.dark-mode #bottom-toolbar select {
            color: #e2e8f0 !important;
        }

        /* Ensure Write Speed options are dark and readable */
        body.dark-mode #bottom-toolbar select option {
            background-color: #ffffff !important;
            color: #1e293b !important;
        }

        body.dark-mode #undo-btn,
        body.dark-mode #redo-btn {
            background-color: #334155 !important;
            border-color: #475569 !important;
            color: #94a3b8 !important;
        }

        body.dark-mode #new-btn {
            background-color: #334155 !important;
            border-color: #475569 !important;
            color: #ef4444 !important;
            /* Red for Delete */
        }

        body.dark-mode #undo-btn:hover,
        body.dark-mode #redo-btn:hover {
            background-color: #475569 !important;
            color: #e2e8f0 !important;
        }

        body.dark-mode #new-btn:hover {
            background-color: #475569 !important;
            color: #ff0000 !important;
            /* Brighter red on hover */
        }

        body.dark-mode #zoom-out i,
        body.dark-mode #zoom-in i {
            color: #93c5fd !important;
        }

        /* Canvas wrapper */
        body.dark-mode main.flex-1 {
            background-color: #1e293b;
        }

        body.dark-mode .canvas-container {
            background-color: #ffffff;
        }

        /* Toggle buttons */
        body.dark-mode #toggle-left,
        body.dark-mode #toggle-right {
            background-color: #334155;
            border-color: #475569;
        }

        body.dark-mode #toggle-left:hover,
        body.dark-mode #toggle-right:hover {
            background-color: #475569;
        }

        /* Nav dark mode */
        body.dark-mode nav {
            background-color: #1e293b;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
        }

        body.dark-mode nav a,
        body.dark-mode nav button,
        body.dark-mode nav span {
            color: #e2e8f0;
        }

        /* Content sections dark mode */
        body.dark-mode section,
        body.dark-mode .bg-white,
        body.dark-mode .bg-blue-50 {
            background-color: #1e293b;
            color: #e2e8f0;
        }

        body.dark-mode footer {
            background-color: #0f172a;
        }

        body.dark-mode .border-blue-400 {
            border-color: #334155;
        }

        /* Type Text Modal Tabs */
        .tt-tab {
            background-color: #f1f5f9;
            color: #64748b;
            cursor: pointer;
        }

        .tt-tab:hover {
            background-color: #e2e8f0;
        }

        .tt-tab.active {
            background-color: #1e3a8a;
            color: #fff;
        }

        body.dark-mode #type-text-modal .bg-white,
        body.dark-mode #type-text-modal .bg-blue-50,
        body.dark-mode #type-text-modal .bg-gray-50 {
            background-color: #ffffff !important;
            color: #1e293b !important;
        }

        body.dark-mode #type-text-modal h3 {
            color: #ffffff !important;
        }

        body.dark-mode #type-text-modal h4,
        body.dark-mode #type-text-modal label {
            color: #1e3a8a !important;
        }

        /* Ensure FREE text in extension button stays yellow in dark mode */
        body.dark-mode .text-yellow-400 {
            color: #fbbf24 !important;
        }

        body.dark-mode #type-text-modal textarea {
            background-color: #ffffff !important;
            color: #000000 !important;
            border-color: #cbd5e1 !important;
        }

        body.dark-mode #type-text-modal .border-gray-200,
        body.dark-mode #type-text-modal .border-gray-300 {
            border-color: #475569;
        }

        /* Horizontal scroller for Page Lines */
        .page-lines-row {
            display: flex;
            gap: 12px;
            overflow-x: auto;
            padding: 4px;
            scroll-behavior: smooth;
            -ms-overflow-style: none;
            /* IE and Edge */
            scrollbar-width: none;
            /* Firefox */
        }

        .page-lines-row::-webkit-scrollbar {
            display: none;
            /* Chrome, Safari and Opera */
        }

        .bg-option-thumb {
            width: 70px;
            height: 70px;
            border-radius: 12px;
            border: 4px solid transparent;
            background-color: white;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            transition: all 0.2s;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 4px;
        }

        .bg-option-thumb:hover {
            border-color: #93c5fd;
            transform: translateY(-2px);
        }

        .bg-option-thumb.active {
            border-color: #2563eb;
            background-color: #eff6ff;
        }

        .bg-option-thumb img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        /* Tool Icon with Labels */
        .tool-icon {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 16px;
            border-radius: 12px;
            border: 2px solid #e2e8f0;
            background-color: white;
            transition: all 0.2s;
            min-width: 130px;
        }

        .tool-icon:hover {
            border-color: #3b82f6;
            background-color: #f8fafc;
        }

        .tool-icon.active {
            background-color: #dbeafe !important;
            border-color: #2563eb !important;
        }

        .tool-icon span {
            font-weight: 900;
            font-size: 1.1rem;
            color: #1e3a8a;
            letter-spacing: 0.05em;
        }

        .custom-scrollbar::-webkit-scrollbar {
            height: 6px;
        }

        .custom-scrollbar::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 10px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb {
            background: #3b82f6;
            border-radius: 10px;
        }

        .custom-scrollbar::-webkit-scrollbar-thumb:hover {
            background: #2563eb;
        }

        /* Page Switcher Popout Styles */
        .page-popout-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 48px;
            height: 48px;
            background: #ffffff;
            border: 2px solid #1e3a8a;
            border-radius: 8px;
            position: relative;
            cursor: pointer;
            transition: all 0.2s;
            box-shadow: 2px 2px 0px #1e3a8a, 4px 4px 0px #ffffff, 4px 4px 0px 1px #1e3a8a;
            margin: 4px 8px 4px 4px;
            flex-shrink: 0;
            color: #1e3a8a;
        }

        .page-popout-btn:hover {
            transform: scale(1.05);
            background-color: #f0f7ff;
        }

        .page-popout-btn.active {
            background-color: #1e3a8a;
            color: #ffffff;
            box-shadow: 2px 2px 0px #3b82f6;
        }

        .page-num-label {
            font-size: 20px;
            font-weight: 900;
            font-family: 'Arial Black', sans-serif;
            z-index: 2;
        }

        .sidebar-page-btn-icon {
            position: relative;
            width: 48px;
            height: 48px;
            background: white;
            border: 2px solid #1e3a8a;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 900;
            font-size: 18px;
            color: #1e3a8a;
            box-shadow: 2px 2px 0px #1e3a8a, 4px 4px 0px #ffffff, 4px 4px 0px 1px #1e3a8a;
        }

        .sidebar-preview-box {
            background-color: white;
            border: 2px solid white;
            border-radius: 0.75rem;
            /* rounded-xl */
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            width: 3rem;
            /* w-12 */
            height: 3rem;
            /* h-12 */
            transition: all 0.3s ease;
        }

        /* Highlight for active sidebar buttons */
        .menu-toggle-btn.active-menu {
            background-color: #1e3a8a !important;
            color: white !important;
        }

        .menu-toggle-btn.active-menu .sidebar-text {
            color: white !important;
        }

        /* Keep original icon colors unless specifically needed */
        .menu-toggle-btn.active-menu .sidebar-preview-box {
            background-color: rgba(255, 255, 255, 0.2);
            border-color: rgba(255, 255, 255, 0.4);
        }

        .menu-toggle-btn.active-menu .sidebar-page-btn-icon {
            border-color: white !important;
            background-color: rgba(255, 255, 255, 0.2);
            box-shadow: none;
        }

        /* Ensure Page Select number is visible when active */
        .menu-toggle-btn.active-menu #sidebar-page-number {
            color: white !important;
        }

        /* Responsive Popout Position */
        @media (max-width: 768px) {
            .menu-popout {
                right: 0 !important;
                left: 0 !important;
                top: 100% !important;
                margin-top: 10px !important;
                min-width: 100% !important;
                border-radius: 15px !important;
            }
        }

        .tt-preset-chip {
            padding: 10px 20px;
            border: 2px solid #3b82f6;
            border-radius: 9999px;
            font-size: 0.9rem;
            font-weight: 800;
            color: #1e40af;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            background: #eff6ff;
            cursor: pointer;
            white-space: nowrap;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }

        .tt-preset-chip:hover {
            background: #2563eb;
            color: white;
            border-color: #2563eb;
            transform: translateY(-2px);
            box-shadow: 0 6px 15px rgba(37, 99, 235, 0.2);
        }

        .tt-preset-chip.active {
            background: #1e3a8a;
            color: white;
            border-color: #1e3a8a;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
        }
