:root{--app-font: "Noto Naskh Arabic", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;--preview-accent: #4f46e5;--preview-correct-bg: #dcfce7;--preview-correct-border: #16a34a;--preview-instance-radius: 12px;--preview-shadow: 0 2px 8px rgba(0, 0, 0, .06)}*{margin:0;padding:0;box-sizing:border-box}body{font-family:var(--app-font);background:linear-gradient(135deg,#667eea,#764ba2);min-height:100vh;padding:20px;color:#333;display:flex;align-items:center;justify-content:center}.api-key-section input,.api-key-section select{width:100%;padding:12px;border:2px solid #e5e7eb;border-radius:10px;font-size:14px;transition:all .3s ease;margin-bottom:10px}button,input,select,textarea,.handsontable,.handsontable table,.handsontable input,.htCore{font-family:var(--app-font)}#tagsModalBody{padding:15px 15px 20px;overflow-y:auto;flex:1}@media (max-width: 768px){body{padding:10px}.content{grid-template-columns:1fr;padding:20px}.header h1{font-size:2em}.header p{font-size:1em}.controls{flex-direction:column}.btn{width:100%}.question-type-selector{grid-template-columns:1fr 1fr}.generation-content{grid-template-columns:1fr}}.rich-text-toolbar button,.rich-text-toolbar select{background:#fff;border:1px solid #dee2e6;border-radius:6px;padding:6px 12px;cursor:pointer;font-size:14px;color:#495057;transition:all .2s;display:flex;align-items:center;gap:4px;min-width:36px;justify-content:center;font-family:inherit}.container{width:100%;max-width:1800px;margin:0 auto;background:#fffffffa;border-radius:16px;box-shadow:0 20px 40px #0000001a;overflow:hidden;display:flex;flex-direction:column;height:100vh;max-height:100vh}.header{background:linear-gradient(135deg,#4f46e5,#7c3aed);color:#fff;padding:20px 30px;text-align:center;position:relative;overflow:hidden;flex-shrink:0}.header:before{content:"";position:absolute;top:-50%;left:-50%;width:200%;height:200%;background:radial-gradient(circle,rgba(255,255,255,.1) 0%,transparent 70%);animation:pulse 4s ease-in-out infinite}.header h1{font-size:2.5em;margin-bottom:10px;text-shadow:2px 2px 4px rgba(0,0,0,.3);position:relative;z-index:1}.header p{font-size:1.2em;opacity:.9;position:relative;z-index:1}.ai-badge{position:absolute;top:15px;right:15px;background:#fff3;padding:8px 15px;border-radius:20px;font-size:.9em;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.content{padding:20px;display:grid;gap:20px;width:100%;flex:1;min-height:0;overflow:hidden;grid-template-columns:1fr;grid-template-rows:1fr 1fr;grid-template-areas:"settings" "preview"}.panel{background:#f8fafc;border-radius:12px;padding:16px;border:2px solid #e2e8f0;box-shadow:0 4px 6px #0000000d;transition:box-shadow .3s ease;display:flex;flex-direction:column;min-height:0;overflow-y:auto}.panel:hover{box-shadow:0 8px 25px #0000001a}.panel h3{color:#4f46e5;margin-bottom:20px;font-size:1.3em;display:flex;align-items:center;gap:10px}.panel:nth-child(1){grid-area:settings}.panel:nth-child(2){grid-area:preview}@media (min-width: 768px){.content{grid-template-columns:1fr 1fr;grid-template-rows:1fr;grid-template-areas:"settings preview";align-items:stretch}}@media (min-width: 1200px){.content{grid-template-columns:minmax(400px,500px) 1fr;grid-template-rows:1fr;grid-template-areas:"settings preview";align-items:stretch}}@media (min-width: 1600px){.container{max-width:95%}.content{grid-template-columns:minmax(500px,600px) 1fr}}.controls{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:20px}.controls .btn{flex-grow:1}.btn{padding:15px 20px;border:none;border-radius:12px;font-size:14px;font-weight:700;cursor:pointer;transition:all .3s ease;text-transform:uppercase;letter-spacing:1px;position:relative;overflow:hidden;display:flex;align-items:center;justify-content:center;gap:8px}.btn:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.2),transparent);transition:left .5s}.btn:hover:before{left:100%}.btn:disabled{cursor:not-allowed;opacity:.6}.btn-primary{background:linear-gradient(135deg,#4f46e5,#7c3aed);color:#fff}.btn-primary:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 10px 25px #4f46e54d}.btn-secondary{background:#f3f4f6;color:#374151;border:2px solid #d1d5db}.btn-secondary:hover:not(:disabled){background:#e5e7eb;border-color:#9ca3af}.btn-success{background:linear-gradient(135deg,#10b981,#059669);color:#fff}.btn-warning{background:linear-gradient(135deg,#f59e0b,#d97706);color:#fff}.btn-ai{background:linear-gradient(135deg,#ec4899,#d946ef);color:#fff}.btn-ai:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 10px 25px #ec48994d}.action-btn{background:#f9fafbcc;border:1px solid #d1d5db;border-radius:50%;width:32px;height:32px;cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;transition:all .2s ease;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.action-btn:hover{background:#4f46e5;border-color:#4f46e5;color:#fff;transform:scale(1.1)}.action-btn:disabled{opacity:.4;cursor:not-allowed;background:#e5e7eb}.btn .spinner{width:20px;height:20px;margin:0}#csvModal .btn,#aiTemplateModal .btn,#subjectTemplateModal .btn{min-width:120px}.table-modal-actions .btn-insert{background:#4f46e5;color:#fff}.table-modal-actions .btn-insert:hover{background:#4338ca}.table-modal-actions .btn-cancel{background:#e5e7eb;color:#495057}.table-modal-actions .btn-cancel:hover{background:#d1d5db}.metadata-selector{background:linear-gradient(135deg,#fff,#f8fafc);border-radius:16px;padding:28px 32px;margin-bottom:24px;border:1px solid #e2e8f0;box-shadow:0 4px 6px -1px #0000000d,0 2px 4px -1px #00000008;overflow:visible;max-width:100%}.metadata-row{display:grid;grid-template-columns:repeat(3,1fr);gap:24px;width:100%}.metadata-field{display:flex;flex-direction:column;position:relative;min-width:0;max-width:100%}.metadata-field label{font-weight:700;color:#1e293b;margin-bottom:10px;font-size:15px}.metadata-field select,.metadata-field input[type=text]{width:100%;max-width:100%;box-sizing:border-box;padding:14px 16px;border:2px solid #e2e8f0;border-radius:12px;background-color:#fff;cursor:pointer;transition:all .25s ease;font-weight:500;color:#1e293b;font-size:15px;box-shadow:0 1px 2px #0000000d;min-height:48px}.metadata-field select:hover,.metadata-field input[type=text]:hover{border-color:#a5b4fc;background-color:#fafbff}.metadata-field select:focus,.metadata-field input[type=text]:focus{outline:none;border-color:#6366f1;box-shadow:0 0 0 4px #6366f126;background-color:#fff}.metadata-field input[type=text]::placeholder{color:#94a3b8;font-weight:400}.metadata-field select option:checked{background:linear-gradient(135deg,#e0e7ff,#c7d2fe);color:#4338ca}.section-input-group{flex:1;min-width:300px}.section-input-group .input-with-button{display:flex;gap:10px;align-items:stretch}.section-input-group .input-with-button input{flex:1}.section-input-group .input-with-button .btn{white-space:nowrap;padding:12px 18px;font-size:14px}.section-metadata-display{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;padding:18px 24px;background:linear-gradient(135deg,#f0fdf4,#dcfce7);border-radius:14px;border:2px solid #86efac;margin-top:16px;animation:fadeIn .3s ease}.section-metadata-display .metadata-item{display:flex;flex-direction:column;gap:6px}.section-metadata-display .metadata-label{font-size:13px;color:#6b7280;font-weight:600}.section-metadata-display .metadata-value{font-size:16px;font-weight:700;color:#166534;word-break:break-word}#fetchSectionBtn.loading{opacity:.7;pointer-events:none}@keyframes fadeIn{0%{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}@media (max-width: 700px){.section-metadata-display{grid-template-columns:1fr;gap:12px}}@media (max-width: 900px){.metadata-row{grid-template-columns:repeat(2,1fr);gap:16px}}@media (max-width: 600px){.metadata-row{grid-template-columns:1fr;gap:16px}.metadata-selector{padding:16px}}.question-type-selector{display:none}.q-type-btn{padding:10px;border:2px solid #e2e8f0;border-radius:10px;background-color:#fff;cursor:pointer;transition:all .2s ease-in-out;font-weight:600;color:#475569;text-align:center}.q-type-btn:hover{background-color:#f1f5f9;border-color:#cbd5e1}.q-type-btn.active{background-color:#e0e7ff;border-color:#4f46e5;color:#4f46e5;box-shadow:0 0 0 3px #4f46e51a}.input-section textarea,.edit-textarea{width:100%;min-height:250px;padding:20px;border:2px solid #e5e7eb;border-radius:15px;font-size:14px;line-height:1.6;resize:vertical;transition:all .3s ease;background:#fff;font-family:Noto Naskh Arabic,Segoe UI,Tahoma,Geneva,Verdana,sans-serif;margin-bottom:10px}.input-section textarea:focus,.edit-textarea:focus{outline:none;border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51a}.api-key-section{display:none;margin-top:15px}.api-key-section input:focus,.api-key-section select:focus{outline:none;border-color:#7c3aed;box-shadow:0 0 0 3px #7c3aed1a}.stats-section{margin-bottom:20px}.stat-item{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:#fff;border-radius:10px;margin-bottom:10px;border:1px solid #e2e8f0}.stat-label{font-weight:600;color:#374151}.stat-value{font-weight:700;color:#4f46e5;font-size:1.1em}.question-types-stats{margin-top:15px}.type-stat{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#f8fafc;border-radius:8px;margin-bottom:6px;border-left:3px solid #4f46e5}.type-name{font-weight:500;color:#475569}.type-count{font-weight:600;color:#4f46e5;background:#e0e7ff;padding:2px 8px;border-radius:12px;font-size:.9em}.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:15px;margin-bottom:20px}.stat-card{background:#fff;padding:15px;border-radius:12px;text-align:center;box-shadow:0 5px 15px #0000000d;border:1px solid #e5e7eb;transition:all .3s ease}.stat-card:hover{transform:translateY(-3px);box-shadow:0 10px 20px #00000014}.stat-card h4{color:#4f46e5;margin-bottom:10px;font-size:.9em}.stat-card span{font-size:2em;font-weight:700;color:#1f2937}span[data-node-type=blank-line]{display:inline-block;min-width:80px;border-bottom:2px solid #333;margin:0 4px;text-align:center;vertical-align:baseline}span[data-node-type=blank-line][data-node-variation=gap]{min-width:100px;padding:2px 8px}.LexicalTheme__paragraph{margin:0;padding:0;line-height:1.8}.dir-rtl{direction:rtl;text-align:right}.dir-ltr{direction:ltr;text-align:left}.mcq_choices{list-style:none;padding:0;margin:15px 0}.mcq_choices li{display:flex!important;align-items:flex-start!important;justify-content:flex-start!important;width:100%!important;margin-bottom:12px;gap:12px}.mcq_choices li>span{flex:0 0 auto;min-width:2em;min-height:2em;display:flex!important;align-items:center;justify-content:center;border-radius:50%;background:#f3f4f6;border:1px solid #e5e7eb;font-weight:600;transition:background-color .2s ease,border-color .2s ease;overflow:visible!important;float:none!important;position:static!important;margin:0!important;left:auto!important;right:auto!important}.mcq_choices li>span.answered.correct{background:var(--preview-correct-bg);border-color:var(--preview-correct-border);color:#15803d}.mcq_choices li>span.not_active{background:#f3f4f6;border-color:#e5e7eb}.mcq_choices li .choice-value{flex:1 1 auto;min-width:0}.mcq_choices li .choice-value p{margin:0!important;white-space:normal;overflow-wrap:anywhere}.mcq_choices li p{margin:0!important}.dir-rtl .mcq_choices li{flex-direction:row!important;justify-content:flex-start!important;direction:rtl!important;text-align:right}.dir-ltr .mcq_choices li{flex-direction:row!important;justify-content:flex-start!important;direction:ltr!important;text-align:left}.dir-rtl .mcq_choices li .choice-value,.dir-rtl .mcq_choices li .choice-value *{direction:rtl;text-align:right}.dir-ltr .mcq_choices li .choice-value,.dir-ltr .mcq_choices li .choice-value *{direction:ltr;text-align:left}.mcq_choices li.correct{background:var(--preview-correct-bg);border-radius:8px;padding:8px 12px;border:1px solid var(--preview-correct-border)}.mcq_choices li.correct:before{content:none}.instances.instances--instances-preview{display:flex;flex-direction:column;gap:15px}.instance{margin-bottom:0}.one-part-question{padding:0}.question-number{margin-bottom:12px;padding:6px 12px;background:#f3f4f6;border-radius:8px;border-left:3px solid var(--preview-accent);font-size:.85em;font-weight:600;color:#4b5563}.question-number p{margin:0}.stem-content,.stem{margin-bottom:10px;line-height:1.8}.answers{margin-top:10px}.panel-header-with-action{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}.btn-sm{padding:6px 12px!important;font-size:.85em!important;border-radius:8px!important}.btn-accent{background:linear-gradient(135deg,#10b981,#059669);color:#fff;border:none;transition:all .2s ease}.btn-accent:hover:not(:disabled){background:linear-gradient(135deg,#059669,#047857);transform:translateY(-1px);box-shadow:0 4px 12px #10b9814d}.btn-accent:disabled{background:#d1d5db;color:#9ca3af;cursor:not-allowed;opacity:.7}#questionsPreview{flex-grow:1;overflow-y:auto;max-height:70vh;scroll-behavior:smooth}.question-preview ul,.question-preview ol{margin:8px 0;padding-inline-start:20px;list-style-position:inside}.question-preview{background:#fff;padding:20px;border-radius:var(--preview-instance-radius);margin-bottom:15px;border:1px solid #e2e8f0;box-shadow:var(--preview-shadow);animation:fadeIn .5s ease;position:relative}.question-actions{position:absolute;top:10px;left:10px;display:none;gap:8px;z-index:10}.question-preview:hover .question-actions{display:flex}.validation-warning{position:absolute;top:15px;left:50px;font-size:1.2em;cursor:help}.question-preview h4,.question-preview .statement-preview{color:#374151;margin-bottom:10px;font-size:1.1em;line-height:1.5}.part-preview{border-top:2px dashed #a5b4fc;margin-top:15px;padding-top:15px}.part-preview h5{color:#4338ca;font-size:1em;margin-bottom:8px}.question-type-badge{display:inline-flex;align-items:center;gap:6px;padding:6px 14px;border-radius:999px;font-size:.8em;font-weight:600;margin-bottom:12px;border:1px solid transparent;box-shadow:0 1px 2px #0000000d;transition:box-shadow .2s ease,transform .15s ease}.question-type-badge:hover{box-shadow:0 2px 6px #00000014}@media (prefers-reduced-motion: reduce){.question-type-badge{transition:none}}.type-mcq{background:#dbeafe;color:#1e40af;border-color:#1e40af4d}.type-mrq,.type-matching{background:#e0e7ff;color:#3730a3;border-color:#3730a34d}.type-gap{background:#d1fae5;color:#065f46;border-color:#055f464d}.type-string{background:#fef3c7;color:#92400e;border-color:#92400e4d}.type-frq{background:#fce7f3;color:#be185d;border-color:#be185d4d}.type-ordering{background:#fef9c3;color:#854d0e;border-color:#854d0e4d}.type-input{background:#f3e8ff;color:#6b21a8;border-color:#6b21a84d}.type-gmrq{background:#e9d5ff;color:#6b21a8;border-color:#6b21a84d}.type-counting{background:#dbeafe;color:#1e40af;border-color:#1e40af4d}.type-puzzle{background:#fce7f3;color:#9d174d;border-color:#9d174d4d}.type-opinion{background:#fef3c7;color:#b45309;border-color:#b453094d}.type-multipart{background:#e5e7eb;color:#374151;border-color:#3741514d}.type-s3{background:#8b5cf6;color:#fff;border-color:#8b5cf680}.type-unknown{background:#fee2e2;color:#991b1b;border-color:#991b1b4d}.question-type-badge-part{background:#6366f1;color:#fff;padding:4px 10px;font-size:.75em;border-color:#6366f180}.choice-item{padding:8px 15px;margin:5px 0;background:#f8fafc;border-radius:8px;border:1px solid #e2e8f0;transition:all .2s ease}.part-preview[data-interactive=true] .choice-item{cursor:pointer}.part-preview[data-interactive=true] .choice-item:hover{background:#f3f4f6;border-color:#4f46e5}.choice-item.correct{background:#dcfce7;border-color:#16a34a;color:#15803d;font-weight:700}.choice-item.correct:before{content:"✔ ";color:#15803d}.matching-preview{display:flex;gap:24px}.matching-column{flex:1}.matching-column>strong{display:block;font-size:1em;color:var(--preview-accent);margin-bottom:12px}.matching-item{background:#f8fafc;border:1px solid #e2e8f0;padding:12px 14px;border-radius:8px;margin-bottom:10px;box-shadow:0 1px 2px #0000000a;transition:box-shadow .2s ease,border-color .2s ease}.matching-item:hover{box-shadow:0 2px 6px #00000014;border-color:#d1d5db}.gapped-text-answers{margin-top:15px;padding-top:10px;border-top:1px dashed #ccc}.gapped-text-answers strong{color:var(--preview-accent)}.guidelines-container{margin-top:16px}.guidelines-container h4{margin-top:12px;margin-bottom:8px;color:var(--preview-accent);font-size:1em;font-weight:600}.guidelines-table-wrapper{overflow-x:auto;border-radius:8px;margin-top:8px}.guidelines-table{width:100%;border-collapse:collapse;border-radius:8px;overflow:hidden;font-size:.95em}.guidelines-table thead{background:var(--preview-accent);color:#fff}.guidelines-table thead th{text-align:left;padding:12px 14px;font-weight:600}.guidelines-table thead th:first-child{border-radius:8px 0 0}.guidelines-table thead th:last-child{border-radius:0 8px 0 0}.guidelines-table thead th:nth-child(2){text-align:center;width:80px}.guidelines-table tbody tr{transition:background-color .2s ease}.guidelines-table tbody tr:nth-child(2n){background:#f9fafb}.guidelines-table tbody tr:hover{background:#f3f4f6}.guidelines-table tbody td{padding:12px 14px;border-bottom:1px solid #e5e7eb}.guidelines-table tbody td:nth-child(2){text-align:center}.bilingual-question-row{display:flex;gap:20px;margin-bottom:16px}.bilingual-question-row .question-preview{flex:1;min-width:350px}.bilingual-original{border-left:4px solid #2563eb}.bilingual-translation{border-left:4px solid #059669}.language-badge,.preview-badge{padding:4px 12px;border-radius:6px;font-size:.8em;display:inline-block;margin-bottom:10px;font-weight:700}.preview-badge-original{background:#2563eb;color:#fff}.preview-badge-translation{background:#059669;color:#fff}.preview-badge-error{background:#dc2626;color:#fff}.parent-fetch-error{color:#dc2626;padding:15px}.question-preview img.uploaded-image,.question-preview img[src^="data:"],.question-preview img[src^=http],.question-preview img[src^="/temp-images/"]{display:inline-block!important;max-width:200px;max-height:150px;object-fit:contain;border-radius:8px;border:2px solid #10b981;vertical-align:middle;margin:4px}.statement-preview img.uploaded-image,.statement-preview img[src^="data:"],.statement-preview img[src^=http],.statement-preview img[src^="/temp-images/"],.part-preview img.uploaded-image,.part-preview img[src^="data:"],.part-preview img[src^=http],.part-preview img[src^="/temp-images/"]{display:inline-block!important;max-width:180px;max-height:120px;object-fit:contain;border-radius:6px;border:2px solid #10b981;vertical-align:middle;margin:4px}@media (max-width: 768px){.bilingual-question-row{flex-direction:column}.bilingual-question-row .question-preview{min-width:100%}.matching-preview{flex-direction:column}.guidelines-table{font-size:.9em}.guidelines-table-wrapper{margin-left:-4px;margin-right:-4px}.question-preview{padding:16px}}@media print{.question-actions,.validation-warning,.english-template-selector,.oq-direction-selector,.advanced-preview-btn,.panel-header-with-action button{display:none!important}.question-preview{break-inside:avoid;box-shadow:none;border:1px solid #ccc}#questionsPreview{max-height:none}}.instance{animation:fadeIn .5s ease forwards}@media (prefers-reduced-motion: reduce){.instance{animation:none}#questionsPreview{scroll-behavior:auto}}.loading-badge{background:#6b7280;color:#fff;padding:4px 12px;border-radius:6px;font-size:.8em;display:inline-block;margin-bottom:12px;font-weight:700}.loading-skeleton{display:flex;flex-direction:column;gap:12px;padding:16px 0}.loading-skeleton-line{height:16px;background:linear-gradient(90deg,#f3f4f6 25%,#e5e7eb,#f3f4f6 75%);background-size:200% 100%;animation:skeleton-shimmer 1.5s infinite;border-radius:4px}.loading-skeleton-line:nth-child(1){width:80%}.loading-skeleton-line:nth-child(2){width:100%}.loading-skeleton-line:nth-child(3){width:60%}.loading-skeleton-line:nth-child(4){width:90%}.loading-skeleton-line:nth-child(5){width:70%}@keyframes skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}#preview-placeholder,.preview-placeholder-initial{text-align:center;color:#6b7280;padding:40px 24px;display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:200px}#preview-placeholder .placeholder-icon{font-size:3em;margin-bottom:16px;opacity:.6}#preview-placeholder p{margin:0;font-size:1em;max-width:280px;line-height:1.5}.virtual-image-preview{background:linear-gradient(135deg,#fef3c7,#fde68a);border:2px dashed #f59e0b;border-radius:8px;padding:12px;display:inline-block}.virtual-image-preview .virtual-image-icon{font-size:24px;text-align:center;margin-bottom:8px}.virtual-image-preview .virtual-image-alt{font-size:12px;color:#92400e;font-weight:700}.virtual-image-preview .virtual-image-notes{font-size:11px;color:#78350f;margin-top:4px}.edit-view-actions{margin-top:10px;display:flex;gap:10px}.action-btn:focus-visible,.edit-btn:focus-visible,.delete-btn:focus-visible{outline:2px solid var(--preview-accent);outline-offset:2px}.btn-save-edit:focus-visible,.btn-cancel-edit:focus-visible{outline:2px solid var(--preview-accent);outline-offset:2px}.PoemContainer{margin:12px 0}.Poem{font-size:1.25em;line-height:2;font-family:Noto Naskh Arabic,serif;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}.Poem.vertical-split{display:grid;grid-template-columns:1fr 1fr;column-gap:2rem;row-gap:.25em;grid-auto-flow:row dense;direction:rtl;text-align:center;align-items:start;justify-items:stretch;align-content:start;justify-content:center}.Poem.vertical-split p{margin:.25em 0;white-space:pre-wrap;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;word-spacing:normal;letter-spacing:normal}.Poem.vertical-split p:nth-child(odd){grid-column:1 / 2;justify-self:start;text-align:left}.Poem.vertical-split p:nth-child(2n){grid-column:2 / 3;justify-self:end;text-align:right}@media (max-width: 768px){.Poem.vertical-split{grid-template-columns:1fr}.Poem.vertical-split p{grid-column:1!important;text-align:right!important}}.Poem.vertical{display:flex;flex-direction:column;align-items:center;direction:rtl;text-align:center}.Poem.vertical p{margin:.25em 0;white-space:pre-wrap;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;word-spacing:normal;letter-spacing:normal}.Poem.free{display:flex;flex-direction:column;align-items:flex-start;direction:rtl;text-align:right}.Poem.free p{margin:.15em 0;white-space:pre-wrap;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;word-spacing:normal;letter-spacing:normal}.Poem.triangle{display:flex;flex-direction:column;align-items:center;direction:rtl;text-align:center}.Poem.triangle p{margin:.15em 0;white-space:pre-wrap;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;word-spacing:normal;letter-spacing:normal}.ck.ck-editor{border-radius:12px;overflow:hidden;box-shadow:0 2px 12px #0000000a}.ck.ck-editor__top{background:#f8fafc}.ck.ck-toolbar{border:2px solid #e5e7eb!important;border-bottom:none!important}.ck.ck-content{min-height:280px;border:2px solid #e5e7eb!important;border-top:none!important;border-radius:0 0 12px 12px;font-size:14px;line-height:1.7;padding:16px;background:#fff;font-family:var(--app-font)}.ck-focused .ck.ck-content{border-color:#4f46e5!important;box-shadow:0 0 0 3px #4f46e51a}.rich-text-preview{font-family:Cairo,Amiri,Arial,sans-serif;line-height:1.6}.rich-text-preview h1,.rich-text-preview h2,.rich-text-preview h3,.rich-text-preview h4,.rich-text-preview h5,.rich-text-preview h6{font-weight:700;margin:1em 0 .5em}.rich-text-preview h1{font-size:2em}.rich-text-preview h2{font-size:1.5em}.rich-text-preview h3{font-size:1.3em}.rich-text-preview u{text-decoration:underline}.rich-text-preview strong,.rich-text-preview b{font-weight:700}.rich-text-preview em,.rich-text-preview i{font-style:italic}.rich-text-preview s,.rich-text-preview strike{text-decoration:line-through}.rich-text-preview sub{vertical-align:sub;font-size:.8em}.rich-text-preview sup{vertical-align:super;font-size:.8em}.rich-text-preview blockquote{border-left:4px solid #ccc;margin:1em 0;padding-left:1em;font-style:italic}.rich-text-preview hr{border:none;border-top:1px solid #ccc;margin:2em 0}.rich-text-preview code{background-color:#f4f4f4;padding:2px 4px;border-radius:3px;font-family:Courier New,monospace}.rich-text-preview pre{background-color:#f4f4f4;padding:1em;border-radius:5px;overflow-x:auto}.rich-text-preview ul,.rich-text-preview ol{margin:1em 0;padding-left:2em}.rich-text-preview li{margin:.5em 0}.rich-text-preview [style*="text-align: left"]{text-align:left}.rich-text-preview [style*="text-align: center"]{text-align:center}.rich-text-preview [style*="text-align: right"]{text-align:right}.rich-text-preview [style*="text-align: justify"]{text-align:justify}.rich-text-preview [dir=rtl]{direction:rtl;text-align:right}.rich-text-preview [dir=ltr]{direction:ltr;text-align:left}.rich-text-editor-wrapper{width:100%;border:2px solid #e5e7eb;border-radius:15px;background:#fff;overflow:hidden;transition:all .3s ease;display:flex;flex-direction:column}.rich-text-editor-wrapper:focus-within{border-color:#4f46e5;box-shadow:0 0 0 3px #4f46e51a}.rich-text-toolbar{background:#f8f9fa;border-bottom:1px solid #dee2e6;padding:8px 12px;display:flex;gap:4px;flex-wrap:wrap;align-items:center;position:sticky;top:0;z-index:10}.rich-text-toolbar button:hover,.rich-text-toolbar select:hover{background:#e9ecef;border-color:#adb5bd}.rich-text-toolbar button.active{background:#4f46e5;color:#fff;border-color:#4f46e5}.rich-text-toolbar select{padding:6px 8px;min-width:120px}.color-picker-wrapper{position:relative;display:inline-block}.toolbar-btn.color-trigger{display:flex;flex-direction:column;align-items:center;justify-content:center;width:36px;height:32px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;transition:border-color .2s,box-shadow .2s;padding:4px 6px}.toolbar-btn.color-trigger:hover{border-color:#4f46e5;box-shadow:0 2px 6px #4f46e526}.color-dropdown{position:absolute;top:calc(100% + 6px);left:0;background:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000;padding:12px;min-width:200px}.color-section{margin-bottom:8px}.color-section-title{font-size:11px;color:#6b7280;font-weight:600;text-transform:uppercase;margin-bottom:6px}.color-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}.color-grid.square-grid .color-swatch{border-radius:4px}.color-swatch{width:24px;height:24px;border-radius:50%;border:1px solid #e5e7eb;cursor:pointer;transition:transform .1s,border-color .1s;background:transparent}.color-swatch:hover{transform:scale(1.2);border-color:#999}.color-separator{height:1px;background:#e5e7eb;margin:8px 0}.color-reset-btn{font-size:13px;cursor:pointer;padding:6px;text-align:center;background:#f3f4f6;border-radius:4px;color:#374151;display:flex;align-items:center;justify-content:center;gap:6px}.color-reset-btn:hover{background:#e5e7eb}.rich-text-toolbar .toolbar-separator{width:1px;height:24px;background:#dee2e6;margin:0 4px}.rich-text-editor{min-height:250px;padding:20px 20px 100px;font-size:14px;line-height:1.6;direction:rtl;text-align:right;outline:none;overflow-y:auto;font-family:Noto Naskh Arabic,Segoe UI,Tahoma,Geneva,Verdana,sans-serif;resize:vertical;flex:1}.rich-text-editor:focus{outline:none}.rich-text-editor p,.rich-text-editor div{margin:0 0 8px;min-height:1.5em}.rich-text-editor p:last-child,.rich-text-editor div:last-child{margin-bottom:0}.rich-text-editor p:empty:before,.rich-text-editor div:empty:before{content:"​"}.rich-text-editor h1{font-size:2em;font-weight:700;margin:.67em 0}.rich-text-editor h3{font-size:1.17em;font-weight:700;margin:1em 0}.rich-text-editor math-field{display:inline-block;vertical-align:baseline;min-width:60px;min-height:1.5em;margin:0 2px;padding:2px 4px;border:1px solid #d1d5db;border-radius:4px;background:#f9fafb;font-size:14px;line-height:1.5}.rich-text-editor math-field:focus,.rich-text-editor math-field:focus-within{outline:none;border-color:#4f46e5;box-shadow:0 0 0 2px #4f46e51a;background:#fff}.rich-text-editor math-field[contenteditable=true]{cursor:text}.math-block-wrapper{display:flex;justify-content:center;width:100%;margin:10px 0}.math-block-wrapper math-field{display:block;font-size:1.1em;min-width:200px}.rich-text-editor table{border-collapse:collapse;width:100%;margin:12px 0;border:1px solid #ccc;background:#fff}.rich-text-editor table td,.rich-text-editor table th{border:1px solid #ccc;padding:8px 12px;min-width:50px;vertical-align:top;text-align:right}.rich-text-editor table th{background:#f8f9fa;font-weight:600}.rich-text-editor table td[contenteditable=true],.rich-text-editor table th[contenteditable=true]{outline:none}.rich-text-editor table td[contenteditable=true]:focus,.rich-text-editor table th[contenteditable=true]:focus{background:#f0f9ff;outline:2px solid #4f46e5;outline-offset:-2px}.rich-text-editor table.LexicalTheme__table{border-collapse:collapse;width:100%}.invalid-tag{background-color:#ef444426;text-decoration:wavy underline #ef4444;text-decoration-skip-ink:none;color:#dc2626;font-weight:600;padding:0 2px;border-radius:2px;cursor:help}.invalid-tag:after{content:"⚠";font-size:.8em;margin-left:2px;color:#f59e0b}.tag-error-tooltip{position:absolute;background:#fef2f2;border:1px solid #fecaca;color:#dc2626;padding:6px 10px;border-radius:6px;font-size:12px;box-shadow:0 4px 12px #00000026;z-index:1000;max-width:300px}.tag-error-tooltip .suggestion{color:#16a34a;font-weight:600}.valid-tag{color:#059669;font-weight:600}.tag-status-indicator{position:fixed;bottom:20px;left:20px;background:#fff;border-radius:8px;padding:10px 16px;box-shadow:0 4px 12px #00000026;display:flex;align-items:center;gap:8px;z-index:999;transition:all .3s ease}.tag-status-indicator.error{background:#fef2f2;border:1px solid #fecaca}.tag-status-indicator.success{background:#f0fdf4;border:1px solid #bbf7d0}.tag-status-indicator .icon{font-size:18px}.tag-status-indicator .message{font-size:13px;font-weight:500}.image-placeholder-wrapper{display:inline-flex;align-items:center;justify-content:center;position:relative;width:120px;height:80px;background:linear-gradient(135deg,#f0f9ff,#e0f2fe);border:2px dashed #38bdf8;border-radius:8px;margin:4px;cursor:pointer;vertical-align:middle;-webkit-user-select:none;user-select:none;transition:all .2s ease}.image-placeholder-wrapper:before{content:"🖼️";font-size:28px;opacity:.8}.image-placeholder-wrapper img{display:none}.image-placeholder-wrapper img.uploaded-image,.image-placeholder-wrapper img[src^="data:"],.image-placeholder-wrapper img[src^=http]{display:block!important;max-width:100%;max-height:100%;object-fit:contain;border-radius:6px}.image-placeholder-wrapper:has(img.uploaded-image):before,.image-placeholder-wrapper:has(img[src^="data:"]):before,.image-placeholder-wrapper:has(img[src^=http]):before{display:none}.image-placeholder-wrapper:has(img.uploaded-image),.image-placeholder-wrapper:has(img[src^="data:"]),.image-placeholder-wrapper:has(img[src^=http]){width:auto;height:auto;max-width:250px;background:transparent;border:2px solid #10b981;border-style:solid}.image-number-badge{position:absolute;top:-8px;right:-8px;background:linear-gradient(135deg,#3b82f6,#2563eb);color:#fff;font-size:11px;font-weight:700;padding:3px 7px;border-radius:10px;min-width:22px;text-align:center;box-shadow:0 2px 4px #3b82f64d}.image-placeholder-wrapper:hover{border-color:#0284c7;background:linear-gradient(135deg,#e0f2fe,#bae6fd);transform:scale(1.02);box-shadow:0 4px 12px #38bdf833}.image-placeholder-wrapper:hover .image-number-badge{background:linear-gradient(135deg,#2563eb,#1d4ed8)}.image-delete-btn{position:absolute;top:-10px;left:-10px;width:24px;height:24px;background:linear-gradient(135deg,#ef4444,#dc2626);color:#fff;border:2px solid white;border-radius:50%;font-size:14px;font-weight:700;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transform:scale(.8);transition:all .2s ease;z-index:10;box-shadow:0 2px 6px #ef444466}.image-placeholder-wrapper:hover .image-delete-btn{opacity:1;transform:scale(1)}.image-delete-btn:hover{background:linear-gradient(135deg,#dc2626,#b91c1c);transform:scale(1.15)!important;box-shadow:0 4px 12px #ef444480}.image-placeholder-wrapper[title]:hover:after{content:attr(title);position:absolute;bottom:-32px;left:50%;transform:translate(-50%);background:#1e293b;color:#fff;padding:6px 10px;border-radius:6px;font-size:11px;white-space:nowrap;max-width:200px;overflow:hidden;text-overflow:ellipsis;z-index:100;box-shadow:0 4px 8px #0003;pointer-events:none}.image-placeholder-wrapper[title]:hover:before{content:"🖼️";font-size:28px;opacity:1}.image-placeholder-wrapper:hover .image-number-badge:after{content:" ✏️";font-size:9px}.part-preview .image-placeholder-wrapper,.statement-preview .image-placeholder-wrapper,.choice-item .image-placeholder-wrapper{width:100px;height:65px}.part-preview .image-placeholder-wrapper:before,.statement-preview .image-placeholder-wrapper:before,.choice-item .image-placeholder-wrapper:before{font-size:22px}.json-output img[num]{display:inline;background:#dbeafe;padding:2px 6px;border-radius:4px;font-family:monospace;font-size:12px}.audio-placeholder-wrapper{display:inline-flex;align-items:center;justify-content:center;position:relative;width:120px;height:80px;background:linear-gradient(135deg,#f0fdf4,#dcfce7);border:2px dashed #22c55e;border-radius:8px;margin:4px;cursor:pointer;vertical-align:middle;-webkit-user-select:none;user-select:none;transition:all .2s ease}.audio-placeholder-wrapper:before{content:"🎵";font-size:28px;opacity:.8}.audio-placeholder-wrapper audio{display:none}.audio-number-badge{position:absolute;top:-8px;right:-8px;background:linear-gradient(135deg,#22c55e,#16a34a);color:#fff;font-size:11px;font-weight:700;padding:3px 7px;border-radius:10px;min-width:22px;text-align:center;box-shadow:0 2px 4px #22c55e4d}.audio-placeholder-wrapper:hover{border-color:#15803d;background:linear-gradient(135deg,#dcfce7,#bbf7d0);transform:scale(1.02);box-shadow:0 4px 12px #22c55e33}.audio-placeholder-wrapper:hover .audio-number-badge{background:linear-gradient(135deg,#16a34a,#15803d)}.audio-placeholder-wrapper[title]:hover:after{content:attr(title);position:absolute;bottom:-32px;left:50%;transform:translate(-50%);background:#1e293b;color:#fff;padding:6px 10px;border-radius:6px;font-size:11px;white-space:nowrap;max-width:200px;overflow:hidden;text-overflow:ellipsis;z-index:100;box-shadow:0 4px 8px #0003;pointer-events:none}.audio-placeholder-wrapper[title]:hover:before{content:"🎵";font-size:28px;opacity:1}.audio-placeholder-wrapper:hover .audio-number-badge:after{content:" ✏️";font-size:9px}.part-preview .audio-placeholder-wrapper,.statement-preview .audio-placeholder-wrapper,.choice-item .audio-placeholder-wrapper{width:100px;height:65px}.part-preview .audio-placeholder-wrapper:before,.statement-preview .audio-placeholder-wrapper:before,.choice-item .audio-placeholder-wrapper:before{font-size:22px}.json-output audio[num]{display:inline;background:#dcfce7;padding:2px 6px;border-radius:4px;font-family:monospace;font-size:12px}.table-context-menu{position:absolute;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:200px;padding:4px 0;display:none;font-size:14px}.table-context-menu.active{display:block}.table-context-menu-item{padding:8px 16px;cursor:pointer;color:#495057;transition:background .2s;display:flex;align-items:center;gap:8px}.table-context-menu-item:hover{background:#f8f9fa}.table-context-menu-item.danger{color:#dc2626}.table-context-menu-item.danger:hover{background:#fee2e2}.table-context-menu-separator{height:1px;background:#e5e7eb;margin:4px 0}.table-modal{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:#00000080;z-index:10000;align-items:center;justify-content:center}.table-modal.active{display:flex}.table-modal-content{background:#fff;padding:30px;border-radius:12px;max-width:400px;width:90%;box-shadow:0 10px 40px #0003}.table-modal-content h3{margin-bottom:20px;color:#1f2937}.table-modal-form-group{margin-bottom:16px}.table-modal-form-group label{display:block;margin-bottom:6px;color:#374151;font-weight:500}.table-modal-form-group input[type=number]{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px}.table-modal-form-group input[type=checkbox]{margin-left:8px;width:18px;height:18px;cursor:pointer}.table-modal-actions{display:flex;gap:10px;margin-top:24px;justify-content:flex-end}.table-modal-actions button{padding:10px 20px;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500}#csvModalBg,#aiTemplateModalBg,#subjectTemplateModalBg,#generationModalBg,#jsonOutputModalBg{display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;background:#00000040;z-index:3000;align-items:center;justify-content:center}#csvModal,#aiTemplateModal,#subjectTemplateModal,#jsonOutputModal{background:#fff;border-radius:16px;max-width:1200px;width:95vw;padding:32px 24px;box-shadow:0 8px 32px #00000026;position:relative;min-height:600px;min-width:900px;display:flex;flex-direction:column;align-items:center;justify-content:center}#csvModal .hot-container,#aiTemplateModal .hot-container{margin-bottom:18px;width:100%}#csvModal .csv-warning{color:#dc2626;font-weight:700;margin-bottom:10px}#tagsModal{display:none;position:fixed;top:150px;left:150px;width:380px;max-height:85vh;background:#fff;border-radius:12px;box-shadow:0 10px 30px #0003;z-index:4000;border:1px solid #ccc;flex-direction:column;overflow:hidden}#tagsModal[style*="display: block"],#tagsModal[style*="display:flex"]{display:flex!important}#tagsModalHeader{padding:12px 15px;cursor:move;background:#f1f5f9;border-bottom:1px solid #e2e8f0;border-top-left-radius:12px;border-top-right-radius:12px;display:flex;justify-content:space-between;align-items:center;font-weight:700;color:#475569}.tags-section h4{font-size:1em;color:#4f46e5;margin-bottom:15px;padding-bottom:5px;border-bottom:2px solid #e0e7ff}.tags-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px;margin-bottom:0}#generationModal{background:#fff;border-radius:16px;max-width:1200px;width:95vw;box-shadow:0 8px 32px #00000026;position:relative;display:flex;flex-direction:column;max-height:90vh}.generation-header{padding:1.25rem 1.5rem;border-bottom:1px solid #e5e7eb}.generation-header h2{color:#4f46e5}.generation-content{display:grid;grid-template-columns:1fr 1fr;gap:2rem;padding:1.5rem;overflow-y:auto}.generation-column h4{margin-bottom:1rem;color:#4338ca}.generation-footer{padding:1rem 1.5rem;border-top:1px solid #e5e7eb;text-align:left}.message-container{position:fixed;top:20px;left:50%;transform:translate(-50%);z-index:1000;display:flex;flex-direction:column;align-items:center;gap:10px}.message{padding:15px 25px;border-radius:8px;box-shadow:0 4px 15px #0000001a;animation:slideIn .5s ease,fadeOut .5s ease 3.5s forwards;font-weight:500;min-width:300px;text-align:center;position:relative}.message.error{background:#fee2e2;color:#dc2626;border:1px solid #fecaca}.message.success{background:#dcfce7;color:#065f46;border:1px solid #a7f3d0}.message.warning{background:#fef3c7;color:#92400e;border:1px solid #fde68a}.message .close-x{position:absolute;top:6px;left:8px;cursor:pointer;font-weight:700;opacity:.6}.json-output{background:#1e293b;color:#e2e8f0;padding:20px;border-radius:12px;font-family:var(--app-font);font-size:13px;line-height:1.4;overflow-x:auto;white-space:pre-wrap;max-height:500px;overflow-y:auto;border:1px solid #334155;flex-grow:1;margin-top:15px}.json-output .key{color:#60a5fa}.json-output .string{color:#34d399}.json-output .number{color:#fbbf24}.json-output .boolean{color:#f87171}.json-output .null{color:#a78bfa}.analysis-section{background:#fff;padding:20px;border-radius:12px;margin-bottom:20px;border:1px solid #e2e8f0}.analysis-item{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:1px solid #f3f4f6;font-size:.9em}.analysis-item:last-child{border-bottom:none}@keyframes pulse{0%,to{transform:scale(1);opacity:.5}50%{transform:scale(1.1);opacity:.8}}.confidence-bar{width:100px;height:8px;background:#e5e7eb;border-radius:4px;overflow:hidden}.confidence-fill{height:100%;background:linear-gradient(90deg,#ef4444,#f59e0b,#10b981);border-radius:4px;transition:width .5s ease-in-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.loading{display:none;text-align:center;padding:20px}.spinner{border:4px solid #f3f4f6;border-top:4px solid #4f46e5;border-radius:50%;width:40px;height:40px;animation:spin 1s linear infinite;margin:0 auto 15px}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes slideIn{0%{transform:translateY(-50px) translate(-50%);opacity:0}to{transform:translateY(0) translate(-50%);opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0;transform:translateY(-20px) translate(-50%)}}.LexicalTheme__paragraph{text-align:justify;text-justify:inter-word}math-field{border:1px solid #ddd;padding:2px 5px;border-radius:4px;font-size:1.1em;display:inline-block;background:#f9f9f9;min-width:20px;vertical-align:-.25em}math-field:focus-within{background-color:#eef2ff;box-shadow:0 0 0 2px #4f46e5;outline:none}span[data-node-type=blank-line]{border-bottom:2px solid #374151;display:inline-block;min-width:80px;height:1.2em;margin:0 4px;vertical-align:baseline;position:relative;top:-2px}span[data-node-type=blank-line][data-node-variation=gap]{border-bottom-color:#4f46e5;border-bottom-style:dashed;min-width:100px}span[data-node-type=blank-line][data-node-variation=space]{border-bottom-color:#374151;border-bottom-style:solid;min-width:80px}#tags-modal-close-btn{background:none;border:none;font-size:1.5em;cursor:pointer;color:#64748b;line-height:1}.tag-group{margin-bottom:15px}.tag-group-title{font-size:.85em;font-weight:700;color:#6b7280;margin-bottom:8px;padding-bottom:6px;border-bottom:1px solid #eee}.tag-btn{padding:8px 12px;font-family:Noto Naskh Arabic,Segoe UI,Tahoma,Geneva,Verdana,sans-serif;font-size:.9em;font-weight:500;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;cursor:pointer;transition:all .2s ease;text-align:center;height:38px;display:flex;align-items:center;justify-content:center}.tag-btn:hover{background:#e0e7ff;border-color:#4f46e5;color:#4f46e5}#gen-image-drop-zone{border:2px dashed #cbd5e1;border-radius:12px;padding:2rem;text-align:center;color:#64748b;cursor:pointer;transition:all .2s ease}#gen-image-drop-zone.dragover{background:#eef2ff;border-color:#4f46e5}#gen-image-preview{margin-top:1rem;max-width:100%;max-height:150px;border-radius:8px}.gen-q-type-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:.75rem}.gen-q-type-row label{font-weight:500}.gen-q-type-row input{width:60px;padding:5px 8px;border-radius:6px;border:1px solid #d1d5db;text-align:center}#gen-multi-part-types{width:100%;padding:8px;border-radius:6px;border:1px solid #d1d5db;margin-top:5px}.english-template-selector{transition:all .3s ease;cursor:pointer}.english-template-selector:focus{outline:none;border-color:#2563eb!important;box-shadow:0 0 0 3px #2563eb1a}.english-template-selector:hover{border-color:#60a5fa}.english-template-selector option{padding:8px;font-size:14px}.mathlive-mathfield{border:1px solid #d1d5db;border-radius:4px;padding:8px;background:#fff}.mathlive-mathfield:focus{border-color:#4f46e5;box-shadow:0 0 0 2px #4f46e51a}.editor-keyword{color:#d946ef;font-weight:700;background:#fae8ff;padding:2px 4px;border-radius:4px;font-family:Courier New,monospace}
