 * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
[hidden] { display: none !important; }

        
        .clap {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
            background: linear-gradient(135deg, #1a1f2d 0%, #0f1219 100%);
            color: #e7e9f1;
            min-height: 100vh;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .calligraphy-studio {
            max-width: 1400px;
            width: 100%;
            margin: 0 auto;
        }
        
        .studio-header {
            text-align: center;
            margin-bottom: 30px;
            padding: 0 20px;
        }
        
        .studio-title {
            font-size: 2.5rem;
            margin-bottom: 10px;
            background: linear-gradient(to right, #8a63d2, #3ab6d2);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            font-weight: 700;
        }
        
        .studio-subtitle {
            font-size: 1.1rem;
            color: #a0a8c9;
            max-width: 600px;
            margin: 0 auto 30px;
            line-height: 1.6;
        }
        
        .calli-app {
            display: grid;
            grid-template-columns: 380px 1fr;
            gap: 25px;
            padding: 25px;
            background: rgba(14, 17, 26, 0.85);
            border-radius: 20px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(10px);
            border: 1px solid #2a3047;
        }
        
        @media (max-width: 1100px) {
            .calli-app {
                grid-template-columns: 1fr;
                grid-template-rows: auto 1fr;
            }
        }
        
        .panel {
            background: linear-gradient(180deg, #11131a 0%, #171a22 100%);
            border: 1px solid #242835;
            border-radius: 18px;
            padding: 20px;
            box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
        }
        
        #controls.panel {
            max-height: 80vh;
            overflow: auto;
        }
        
        @media (max-width: 1100px) {
            #controls.panel {
                max-height: none;
            }
        }
        
        .panel h2 {
            font-size: 1.4rem;
            font-weight: 700;
            margin: 0 0 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid #2a3047;
            color: #d0d6f0;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .panel h2::before {
            content: "";
            display: block;
            width: 8px;
            height: 25px;
            background: linear-gradient(to bottom, #8a63d2, #3ab6d2);
            border-radius: 4px;
        }
        
        .row {
            display: flex;
            gap: 15px;
            margin-bottom: 15px;
        }
        
        .row>.col {
            flex: 1;
        }
        
        .label {
            font-size: 0.9rem;
            color: #a0a8c9;
            margin-bottom: 8px;
            font-weight: 500;
        }
        
        .input, select, button, textarea {
            width: 100%;
            padding: 12px 15px;
            border-radius: 12px;
            border: 1px solid #2a3047;
            background: #10131b;
            color: #e7e9f1;
            font-size: 1rem;
            transition: all 0.3s ease;
        }
        
        .input:focus, select:focus, textarea:focus {
            outline: none;
            border-color: #7c3aed;
            box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
        }
        
        .input[type="color"] {
            padding: 0;
            height: 45px;
            cursor: pointer;
        }
        
        .small {
            font-size: 0.85rem;
            color: #8a92b5;
            line-height: 1.5;
        }
        
        .btn {
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 0.95rem;
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }
        
        .btn.primary {
            background: linear-gradient(135deg, #7c3aed, #22d3ee);
            color: #fff;
            border: none;
        }
        
        .btn.success {
            background: linear-gradient(135deg, #16a34a, #10b981);
            border: none;
            color: #fff;
        }
        
        .btn.warn {
            background: linear-gradient(135deg, #f59e0b, #fb923c);
            border: none;
            color: #fff;
        }
        
        .seg {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        
        .seg button {
            flex: 1 1 calc(50% - 8px);
            min-width: 100px;
        }
        
        .pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 15px;
            border-radius: 50px;
            border: 1px solid #2a3047;
            background: rgba(12, 15, 21, 0.6);
            font-size: 0.9rem;
            color: #b6bad3;
            margin-right: 10px;
            margin-bottom: 10px;
            backdrop-filter: blur(5px);
        }
        
        .stage-wrap {
            position: relative;
            border-radius: 18px;
            overflow: hidden;
        }
     .top-tips{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:center;
  margin: 10px auto 0;
  padding: 0 10px;
}
        
        .stage {
            position: relative;
            background: #0b0e14;
            border-radius: 18px;
            border: 1px solid #2a3047;
            padding: 20px;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .art-holder {
            position: relative;
            width: 100%;
            height: 100%;
            min-height: 500px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        /* enable finger dragging */
.art-holder, #art, #layers g, .stage { touch-action: none; -ms-touch-action: none; }

        
        .artboard {
            max-width: 100%;
            height: auto;
            background: #fff;
            border-radius: 12px;
            box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
        }
        
        .checker {
            position: absolute;
            inset: 20px;
            pointer-events: none;
            background-image: 
                linear-gradient(45deg, #0000 25%, #00000008 25%, #00000008 50%, #0000 50%, #0000 75%, #00000008 75%, #00000008 100%);
            background-size: 24px 24px;
            opacity: 0.35;
            border-radius: 12px;
            display: none;
        }
        
        .checker.show {
            display: block;
        }
        
        .outline {
            stroke: #7c3aed;
            stroke-width: 2;
            stroke-dasharray: 5 4;
            fill: none;
            pointer-events: none;
        }
        
        .tabs {
            display: flex;
            gap: 8px;
            margin: 10px 0 20px;
            flex-wrap: wrap;
        }
        
        .tab {
            flex: 1;
            text-align: center;
            padding: 12px;
            border-radius: 12px;
            border: 1px solid #2a3047;
            background: #0d1017;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 80px;
            font-weight: 500;
        }
        
        .tab:hover {
            background: #141725;
            border-color: #3a4161;
        }
        
        .tab.active {
            background: linear-gradient(135deg, #1b2030, #0d1017);
            border-color: #3a4161;
            box-shadow: inset 0 0 0 1px #3a4161;
            color: #7c3aed;
        }
        
        .grid-2 {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }
        
        .grid-3 {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
        }
        svg text{ user-select:none; -webkit-user-select:none; -ms-user-select:none }

        
        .grid-4 {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
        }
        
        @media (max-width: 768px) {
            .grid-2, .grid-3, .grid-4 {
                grid-template-columns: 1fr;
            }
            
            .seg button {
                flex: 1 1 100%;
            }
        }
        
        .rtl {
            direction: rtl;
            unicode-bidi: plaintext;
            font-family: 'Noto Nastaliq Urdu', serif;
        }
        
        .toast {
            position: fixed;
            left: 50%;
            bottom: 25px;
            transform: translateX(-50%);
            background: #0e111a;
            border: 1px solid #3a4161;
            padding: 12px 20px;
            border-radius: 12px;
            color: #e7e9f1;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
            display: none;
            z-index: 10000;
            backdrop-filter: blur(10px);
            animation: fadeIn 0.3s ease;
        }
        
        .toast.show {
            display: block;
        }
        
        .font-status {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            background: rgba(124, 58, 237, 0.1);
            border-radius: 8px;
            margin-top: 15px;
            font-size: 0.9rem;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translate(-50%, 10px); }
            to { opacity: 1; transform: translate(-50%, 0); }
        }
        
        /* Self-hosted faces */
        @font-face { font-family: 'AASameerAsmaak'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/AA-Sameer-Asmaak.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'Moheeb'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/Moheeb.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'Hoba'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/Hoba.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'DGKufi'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/DG-kufi.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'DGModal3at'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/DG-Modal3at.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'Thulut'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/Thulut.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'Diwani'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/Diwani.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'Albattar'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/Albattar.ttf') format('truetype'); font-display: swap; }
        @font-face { font-family: 'AbdElRady'; src: url('https://www.techgrapple.com/online-tools/tools/2025/calligraphy-maker/fonts/Abd-ElRady.ttf') format('truetype'); font-display: swap; }
        
        /* Responsive adjustments */
        @media (max-width: 768px) {
            .studio-title {
                font-size: 2rem;
            }
            
            .calli-app {
                padding: 15px;
            }
            
            .panel {
                padding: 15px;
            }
            
           
            

            .pill {
                font-size: 0.8rem;
                padding: 8px 12px;
            }
        }
        
        @media (max-width: 480px) {
            .studio-title {
                font-size: 1.8rem;
            }
            
            .studio-subtitle {
                font-size: 0.95rem;
            }
            
            .tabs {
                gap: 5px;
            }
            
            .tab {
                padding: 10px 5px;
                font-size: 0.85rem;
            }
        }
        @media (max-width:768px){
  .top-tips{ padding: 0 6px; }
}