
        :root{
          --bg: #f6f7fb;
          --card: #ffffff;
          --muted: #667085;
          --text: #0b1223;
          --accent-1: #8b5cf6; /* purple */
          --accent-2: #ff6b6b; /* coral */
          --accent-grad: linear-gradient(90deg,var(--accent-1),#ff6b6b);
          --shadow-1: 0 6px 24px rgba(16,24,40,0.08);
          --radius-lg: 14px;
          --radius-md: 10px;
          --radius-sm: 8px;
          --glass: rgba(255,255,255,0.6);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial;
        }

        body {
            background: linear-gradient(180deg, #fbfbfe 0%, var(--bg) 100%);
            color: var(--text);
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            line-height: 1.4;
            padding-bottom: 20px;
        }

        /* Main layout */
        .main-wrapper {
            display: flex;
            min-height: 100vh;
            max-width: 1400px;
            margin: 0 auto;
            width: 100%;
            padding: 0 10px;
        }

        .ad-space-left, .ad-space-right {
            width: 20%;
            min-width: 160px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px 10px;
            position: sticky;
            top: 0;
            height: 100vh;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-1);
            border: 2px solid rgba(255,255,255,0.2);
            overflow: hidden;
        }

        .ad-space-left img,
        .ad-space-right img,
        .ad-space-top-above-how-to-use img {
            width: 100% !important;
            height: auto !important;
            max-height: 100% !important;
            object-fit: contain !important;
        }

        .main-content {
            flex: 1;
            min-width: 0;
            width: 60%;
            padding: 0 15px;
            max-width: 100%;
        }

        /* Layout container */
        .container {
            max-width: 100%;
            margin: 0 auto;
            padding: 20px 0;
            width: 100%;
        }

        /* Ad spaces */
        .ad-space-top-above-how-to-use {
            width: 100%;
            height: 200px;
            margin-bottom: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-1);
            border: 2px solid rgba(255,255,255,0.2);
        }

        .ad-placeholder {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
        }

        .ad-text {
            color: white;
            font-weight: 700;
            font-size: 14px;
            text-align: center;
            padding: 10px;
        }

        /* Top nav like Smallpdf */
        header {
            background: transparent;
            padding: 18px 0;
            position: relative;
        }

        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 16px;
        }

        .brand {
            display: flex;
            gap: 12px;
            align-items: center;
        }

        .brand-logo {
            width: 40px;
            height: 40px;
            border-radius: 9px;
            background: var(--accent-grad);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 800;
            box-shadow: 0 6px 18px rgba(139,92,246,0.18);
            font-size: 14px;
        }

        .brand-title {
            font-weight: 700;
            font-size: 18px;
            letter-spacing: -0.2px;
        }

        nav.topnav {
            display: flex;
            gap: 20px;
            align-items: center;
            flex-wrap: wrap;
        }

        nav.topnav a {
            color: var(--muted);
            text-decoration: none;
            font-size: 14px;
            font-weight: 600;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
        }

        nav.topnav a:hover {
            color: var(--text);
            background: rgba(99,102,241,0.06);
        }

        /* Main editor container */
        .editor-container {
            max-width: 1400px;
            margin: 20px auto;
            background: #ffffff;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-1);
            overflow: hidden;
            border: 1px solid rgba(16,24,40,0.04);
        }

        .editor-header {
            background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
            color: white;
            padding: 25px;
            text-align: center;
        }

        .editor-header h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
            font-weight: 800;
        }

        .subtitle {
            font-size: 1.2rem;
            opacity: 0.9;
            font-weight: 500;
        }

        .main-content {
            display: flex;
            min-height: 700px;
        }

        .sidebar {
            width: 300px;
            background: #ffffff;
            padding: 20px;
            border-right: 3px solid var(--accent-1);
        }

        .tool-section {
            margin-bottom: 25px;
            padding: 15px;
            background: linear-gradient(180deg, #ffffff, #fbfbff);
            border-radius: 10px;
            border: 1px solid rgba(16,24,40,0.03);
            box-shadow: 0 6px 16px rgba(16,24,40,0.03);
        }

        .tool-section h3 {
            font-size: 1.2rem;
            margin-bottom: 15px;
            color: var(--text);
            text-align: center;
            border-bottom: 2px solid var(--accent-1);
            padding-bottom: 8px;
            font-weight: 700;
        }

        .tool-group {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 15px;
        }

        .tool-btn {
            background: #ffffff;
            border: 2px solid var(--accent-1);
            border-radius: 8px;
            padding: 12px 15px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 1rem;
            flex: 1;
            min-width: 130px;
            justify-content: center;
            color: var(--text);
            font-weight: 600;
            box-shadow: 0 4px 12px rgba(139,92,246,0.08);
        }

        .tool-btn:hover {
            background: var(--accent-1);
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(139,92,246,0.18);
            color: white;
        }

        .tool-btn.active {
            background: var(--accent-1);
            border-color: #fff;
            box-shadow: 0 0 20px rgba(139,92,246,0.3);
            color: white;
        }

        .color-picker {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 15px;
            justify-content: center;
        }

        .color-option {
            width: 35px;
            height: 35px;
            border-radius: 50%;
            cursor: pointer;
            border: 3px solid transparent;
            transition: all 0.3s;
            box-shadow: 0 2px 8px rgba(16,24,40,0.08);
        }

        .color-option:hover {
            transform: scale(1.2);
        }

        .color-option.active {
            border-color: white;
            transform: scale(1.2);
            box-shadow: 0 0 15px currentColor;
        }

        .editor-area {
            flex: 1;
            padding: 25px;
            display: flex;
            flex-direction: column;
            background: #ffffff;
        }

        .upload-section {
            background: linear-gradient(180deg, #ffffff, #fbfbff);
            border: 3px dashed var(--accent-1);
            border-radius: 15px;
            padding: 50px;
            text-align: center;
            margin-bottom: 25px;
            transition: all 0.3s;
            box-shadow: 0 6px 16px rgba(16,24,40,0.03);
        }

        .upload-section:hover {
            background: rgba(139,92,246,0.02);
            border-color: var(--accent-2);
            transform: translateY(-2px);
        }

        .upload-btn {
            background: var(--accent-grad);
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 999px;
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: 700;
            transition: all 0.3s;
            margin-top: 20px;
            box-shadow: 0 8px 20px rgba(139,92,246,0.18);
        }

        .upload-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 25px rgba(139,92,246,0.25);
        }

        #pdf-upload {
            display: none;
        }

        .pdf-container {
            flex: 1;
            border: 3px solid var(--accent-1);
            border-radius: 10px;
            overflow: auto;
            background: white;
            position: relative;
            display: none;
            margin-bottom: 25px;
            box-shadow: 0 8px 25px rgba(16,24,40,0.08);
        }

        #pdf-canvas {
            display: block;
            margin: 0 auto;
            cursor: crosshair;
        }

        .toolbar {
            display: flex;
            justify-content: space-between;
            padding: 20px 0;
            border-top: 2px solid var(--accent-1);
            margin-top: 20px;
        }

        .action-btn {
            padding: 12px 25px;
            border: none;
            border-radius: 999px;
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: 700;
            transition: all 0.3s;
            box-shadow: 0 6px 16px rgba(16,24,40,0.08);
        }

        .download-btn {
            background: var(--accent-grad);
            color: white;
        }

        .download-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 20px rgba(139,92,246,0.25);
        }

        .page-nav {
            display: flex;
            align-items: center;
            gap: 15px;
            background: rgba(255,255,255,0.8);
            padding: 10px 20px;
            border-radius: 8px;
            border: 2px solid var(--accent-1);
        }

        .page-btn {
            background: var(--accent-1);
            color: white;
            border: none;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            font-weight: bold;
            transition: all 0.3s;
            box-shadow: 0 4px 12px rgba(139,92,246,0.18);
        }

        .page-btn:hover {
            background: #fff;
            color: var(--accent-1);
            transform: scale(1.1);
        }

        footer {
            text-align: center;
            padding: 20px;
            background: #ffffff;
            color: var(--muted);
            border-top: 3px solid var(--accent-1);
        }

        .loading {
            display: none;
            text-align: center;
            padding: 40px;
            background: rgba(255,255,255,0.8);
            border-radius: 10px;
            margin: 20px 0;
        }

        .spinner {
            border: 5px solid rgba(139,92,246,0.2);
            border-top: 5px solid var(--accent-1);
            border-radius: 50%;
            width: 60px;
            height: 60px;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .text-input {
            width: 100%;
            padding: 12px;
            border: 2px solid var(--accent-1);
            border-radius: 8px;
            margin-bottom: 15px;
            background: rgba(255,255,255,0.9);
            font-size: 1rem;
            color: var(--text);
        }

        .font-size-select, .brush-size-select {
            width: 100%;
            padding: 10px;
            border: 2px solid var(--accent-1);
            border-radius: 8px;
            margin-bottom: 15px;
            background: rgba(255,255,255,0.9);
            font-size: 1rem;
            color: var(--text);
        }

        .tool-instruction {
            text-align: center;
            color: var(--accent-1);
            font-size: 0.9rem;
            margin-top: 5px;
            font-style: italic;
        }

        /* Editable element styles */
        .editable-element {
            position: absolute;
            cursor: move;
            border: 2px dashed transparent;
            transition: border-color 0.3s;
        }

        .editable-element:hover {
            border-color: var(--accent-1);
        }

        .editable-element.editing {
            border-color: var(--accent-1) !important;
            border-style: solid;
        }

        .text-element {
            background: transparent;
            border: none;
            outline: none;
            resize: none;
            font-family: Arial;
            padding: 5px;
            min-width: 100px;
            min-height: 30px;
            color: inherit;
            font-size: inherit;
            pointer-events: auto;
        }

        .shape-element {
            background: transparent;
        }

        .resize-handle {
            position: absolute;
            width: 8px;
            height: 8px;
            background: var(--accent-1);
            border: 1px solid white;
            border-radius: 50%;
        }

        .resize-nw { top: -4px; left: -4px; cursor: nw-resize; }
        .resize-ne { top: -4px; right: -4px; cursor: ne-resize; }
        .resize-sw { bottom: -4px; left: -4px; cursor: sw-resize; }
        .resize-se { bottom: -4px; right: -4px; cursor: se-resize; }
        
        /* Hidden container for export */
        .export-container {
            position: fixed;
            top: -10000px;
            left: -10000px;
            z-index: -1000;
        }

        /* Footer styling */
        .site-footer {
            margin-top: 42px;
            padding: 24px 0;
            text-align: center;
            color: var(--muted);
        }

        /* responsive */
        @media (max-width: 1200px) {
            .main-wrapper {
                flex-direction: column;
                padding: 0 15px;
            }
            
            .ad-space-left, .ad-space-right {
                width: 100%;
                height: 120px;
                position: static;
                margin: 20px 0;
                min-height: auto;
            }
            
            .main-content {
                width: 100%;
                padding: 0;
            }
        }

        @media (max-width: 1000px) {
            .main-content {
                flex-direction: column;
            }
            .sidebar {
                width: 100%;
                border-right: none;
                border-bottom: 3px solid var(--accent-1);
            }
        }

        @media (max-width:768px) {
            .topbar {
                flex-direction: column;
                align-items: flex-start;
            }
            nav.topnav {
                width: 100%;
                justify-content: space-between;
            }
            .toolbar {
                flex-direction: column;
                gap: 15px;
            }
        }

        @media (max-width:600px) {
            .tool-group {
                flex-direction: column;
            }
            .tool-btn {
                width: 100%;
            }
        }

        @media (max-width:420px) {
            .editor-header h1 {
                font-size: 2rem;
            }
            .brand-title {
                font-size: 16px;
            }
            .container {
                padding: 18px;
            }
        }
