/* SIGNATURE GENERATOR PRO - WORLD'S BEST */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --radius: 12px;
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header - Universal Styles */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__inner { display: flex; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.back-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: #f5f5f5; border-radius: 10px; color: #333; margin-right: 12px; transition: all 0.2s; text-decoration: none; }
.back-btn:hover { background: #333; color: white; }
.back-btn svg { width: 20px; height: 20px; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; text-decoration: none; color: inherit; }
.logo__icon { width: 28px; height: 28px; color: #1a1a1a; }
.logo__text { color: var(--text); }
.nav { display: flex; gap: 4px; }
.nav__link { padding: 8px 14px; font-size: 14px; font-weight: 500; color: var(--text-secondary); border-radius: 6px; transition: all 0.2s; text-decoration: none; }
.nav__link:hover { color: var(--text); background: var(--bg); }
.nav__link--active { color: var(--primary); background: var(--primary-light); }

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Mode Tabs */
.mode-section { margin-bottom: 2rem; }

.mode-tabs {
    display: flex;
    background: white;
    border-radius: var(--radius);
    padding: 0.5rem;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.mode-tab:hover { background: var(--bg-alt); color: var(--text); }

.mode-tab.active {
    background: var(--primary);
    color: white;
}

.mode-tab svg { width: 20px; height: 20px; }

/* Mode Sections - Type, Draw, Initials */
.type-section { display: block; }
.draw-section { display: none; }
.initials-section { display: none; }

/* Input Box */
.input-box {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.input-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.name-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1.25rem;
    text-align: center;
    transition: var(--transition);
}

.name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Styles Grid */
.styles-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.styles-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.style-count {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.style-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.style-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.style-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.style-card.active::after {
    content: '✓';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.style-preview {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fafbfc, #fff);
    border-radius: 8px;
    overflow: hidden;
}

.style-preview canvas {
    max-width: 100%;
    max-height: 100%;
}

.style-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    text-align: center;
}

/* Draw Section */
.draw-section { padding-bottom: 2rem; }

.draw-section-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.draw-section-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.draw-section-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.canvas-container {
    background: linear-gradient(135deg, #fefefe 0%, #f8f9fc 100%);
    border: 3px dashed var(--primary);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    touch-action: none;
    min-height: 250px;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.1), inset 0 0 40px rgba(255,255,255,0.9);
    transition: var(--transition);
}

.canvas-container:hover {
    border-color: var(--secondary);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.15), inset 0 0 40px rgba(255,255,255,0.9);
}

.canvas-container canvas {
    display: block;
    background: white;
    /* Pen cursor with hotspot at tip (bottom-left corner at 0,24) */
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M3 21l3-3" stroke="%23333" stroke-width="2" stroke-linecap="round"/><path d="M12 3L21 12L12 21L3 12L12 3Z" fill="none" stroke="%232563eb" stroke-width="0"/><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75 1.84-1.83z" fill="%232563eb"/><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z" fill="%232563eb"/></svg>') 0 24, crosshair;
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 1.25rem;
    pointer-events: none;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.canvas-placeholder .placeholder-icon {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

.canvas-placeholder .placeholder-text {
    font-weight: 600;
    color: var(--text-secondary);
}

.canvas-placeholder .placeholder-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.canvas-placeholder.hidden { opacity: 0; pointer-events: none; }

.draw-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.control-group input[type="range"] {
    width: 100px;
    height: 6px;
    accent-color: var(--primary);
    cursor: pointer;
}

.btn-clear-canvas {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
    border: 2px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    margin-left: auto;
    transition: var(--transition);
}

.btn-clear-canvas:hover {
    background: #fee2e2;
}

/* Initials Section */
.initials-styles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.initial-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.initial-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.initial-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.initial-preview {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.initial-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Customize Section */
.customize-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.customize-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.customize-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.customize-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.color-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.color-btn:hover { transform: scale(1.1); }

.color-btn.active {
    border-color: var(--text);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text);
}

.size-options, .thickness-options {
    display: flex;
    gap: 0.5rem;
}

.size-btn, .thickness-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.size-btn:hover, .thickness-btn:hover {
    border-color: var(--primary);
}

.size-btn.active, .thickness-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.slant-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slant-control input {
    flex: 1;
    accent-color: var(--primary);
}

.slant-control span {
    font-weight: 600;
    min-width: 40px;
}

/* Preview Section */
.preview-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.preview-header h2 {
    font-size: 1.25rem;
}

.preview-bg-toggle {
    display: flex;
    gap: 0.5rem;
}

.bg-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.bg-btn:hover { border-color: var(--primary); }
.bg-btn.active { border-color: var(--primary); background: var(--primary-light); }

.preview-canvas-wrapper {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: repeating-conic-gradient(#e5e7eb 0% 25%, transparent 0% 50%) 50% / 16px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.preview-canvas-wrapper.bg-white { background: white; }
.preview-canvas-wrapper.bg-paper { background: linear-gradient(#f5f5dc, #f5f5dc), repeating-linear-gradient(45deg, transparent 0 2px, rgba(0,0,0,0.02) 2px 4px); }

#previewCanvas {
    max-width: 100%;
    height: auto;
}

.signature-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.style-badge, .dimension-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.style-badge { background: var(--primary-light); color: var(--primary); }
.dimension-badge { background: #f1f5f9; color: var(--text-secondary); }

/* Download Section */
.download-section {
    margin-bottom: 2rem;
}

.download-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.download-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.download-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.download-btn.special {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border-color: #7c3aed;
    color: white;
}

.btn-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-btn:not(.primary):not(.special) .btn-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-text { flex: 1; }

.btn-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.btn-desc {
    font-size: 0.8rem;
    opacity: 0.8;
}

.bulk-download {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-bulk {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--text);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-bulk:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Use Cases */
.usecases-section {
    margin-bottom: 2rem;
}

.usecases-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    text-align: center;
}

.usecases-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.usecase {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--text);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer-sub {
    margin-top: 0.5rem;
    opacity: 0.7;
    font-size: 0.875rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    box-shadow: var(--shadow-xl);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* Viral Box */
.viral-box {
    position: fixed;
    top: 100px;
    right: 1.5rem;
    z-index: 999;
    pointer-events: none;
    max-width: 300px;
}

.viral-item {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(350px);
    opacity: 0;
    transition: var(--transition);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viral-item.show { transform: translateX(0); opacity: 1; }

.viral-item .emoji { font-size: 1.2rem; }

.viral-item .city {
    font-weight: 600;
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .header-stats { display: none; }
    
    .mode-tabs { flex-direction: column; }
    
    .mode-tab { justify-content: flex-start; }
    
    .styles-grid { grid-template-columns: repeat(2, 1fr); }
    
    .draw-controls {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .control-group { width: 100%; justify-content: space-between; }
    
    .btn-clear-canvas { width: 100%; justify-content: center; margin-left: 0; }
    
    .customize-grid { grid-template-columns: 1fr; }
    
    .download-grid { grid-template-columns: 1fr; }
    
    .viral-box { display: none; }
}

/* Signature Fonts - Embedded */
@font-face {
    font-family: 'Signature1';
    src: url("data:application/font-woff2;charset=utf-8;base64,") format('woff2');
}

/* Animation */
@keyframes draw {
    from { stroke-dashoffset: 1000; }
    to { stroke-dashoffset: 0; }
}