/*
 * English to Arabic Calligraphy Generator - Futuristic Frontend Styles
 *
 * All classes are prefixed with .eacg- and scoped inside .eacg-wrapper to avoid
 * leaking into the host theme. No global resets are applied.
 *
 * The .eacg-futuristic layer adds a cyber/glass aesthetic on top of the base
 * theme. Per-variation styles live under .eacg-variant-{key}.
 */

/* ================ Wrapper + theme variables ================ */
.eacg-wrapper {
    --eacg-bg: #ffffff;
    --eacg-surface: #f9f9f9;
    --eacg-border: #e0e0e0;
    --eacg-text: #1a1a1a;
    --eacg-accent: #0f766e;
    --eacg-accent-hover: #0d5e57;
    --eacg-label: #555555;
    --eacg-radius: 6px;

    background: var(--eacg-bg);
    color: var(--eacg-text);
    padding: 24px;
    border-radius: var(--eacg-radius);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

.eacg-theme-dark.eacg-wrapper {
    --eacg-bg: #1a1a1a;
    --eacg-surface: #242424;
    --eacg-border: #333333;
    --eacg-text: #f0f0f0;
    --eacg-accent: #14b8a6;
    --eacg-accent-hover: #0d9488;
    --eacg-label: #aaaaaa;
}

.eacg-wrapper *,
.eacg-wrapper *::before,
.eacg-wrapper *::after {
    box-sizing: inherit;
}

/* ================================================================
 * FUTURISTIC LAYER — light glassmorphism.
 * Soft pastel background with colored glow blobs, frosted white
 * panels, subtle borders, dark text for readability.
 * ================================================================ */
.eacg-futuristic {
    --eacg-bg: transparent;
    --eacg-surface: rgba(255, 255, 255, 0.55);
    --eacg-surface-strong: rgba(255, 255, 255, 0.75);
    --eacg-surface-input: rgba(255, 255, 255, 0.8);
    --eacg-border: rgba(255, 255, 255, 0.75);
    --eacg-border-soft: rgba(15, 23, 42, 0.06);
    --eacg-border-strong: rgba(99, 102, 241, 0.35);
    --eacg-text: #0f172a;
    --eacg-text-soft: #1e293b;
    --eacg-label: #64748b;
    --eacg-muted: #94a3b8;
    --eacg-accent: #6366f1;
    --eacg-accent-2: #8b5cf6;
    --eacg-accent-3: #ec4899;
    --eacg-accent-4: #06b6d4;
    --eacg-accent-hover: #4f46e5;
    --eacg-radius: 18px;
    --eacg-radius-sm: 12px;
    --eacg-shadow-soft: 0 10px 40px -20px rgba(99, 102, 241, 0.35);
    --eacg-shadow-glass:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 -1px 0 rgba(15, 23, 42, 0.04) inset,
        0 20px 45px -25px rgba(30, 41, 59, 0.28);

    /* Transparent wrapper — the page background shows through. Inner glass
       panels still provide the frosted structure. No box-shadow, no border
       radius, no decorative overlays so the tool blends into the host page. */
    position: relative;
    padding: 0;
    border-radius: 0;
    color: var(--eacg-text);
    background: transparent;
    box-shadow: none;
}

/* ================ Header ================ */
.eacg-header {
    margin-bottom: 26px;
    text-align: left;
}
.eacg-title {
    font-size: clamp(1.35rem, 3vw + 0.6rem, 1.75rem);
    margin: 0 0 10px;
    color: var(--eacg-text);
    letter-spacing: -0.01em;
    line-height: 1.15;
    word-break: break-word;
}
.eacg-futuristic .eacg-title {
    font-size: clamp(1.5rem, 4vw + 0.5rem, 2.1rem);
    font-weight: 700;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 45%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    letter-spacing: -0.015em;
}
.eacg-intro {
    margin: 0 0 8px;
    color: var(--eacg-label);
    max-width: 68ch;
}
.eacg-futuristic .eacg-intro {
    color: #475569;
    font-size: 1rem;
}

/* ================ Layout ================ */
.eacg-tool {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 24px;
    /* Columns stretch to the same height so the panels look balanced. */
    align-items: stretch;
}
.eacg-tool .eacg-controls,
.eacg-tool .eacg-preview-area {
    display: flex;
    flex-direction: column;
}
.eacg-tool .eacg-preview-area > .eacg-preview-wrap {
    flex: 1 1 auto;
    min-height: 0;
}
.eacg-futuristic .eacg-tool {
    gap: 28px;
}

/* Adaptive: hide-column pages collapse to single column. */
.eacg-wrapper.eacg-no-preview .eacg-tool,
.eacg-tool:not(:has(.eacg-preview-area)) {
    grid-template-columns: 1fr;
    max-width: 720px;
    margin: 0 auto;
}

/* Empty state: no Arabic text yet, so hide the preview column and the
   multi-style grid entirely. The controls column centers and takes only
   the width it needs. Managed by the eacg-empty class the JS toggles on
   the wrapper based on state.arabicText.
   `!important` is required because some page-builder themes (Elementor
   included) apply their own `display` rules with `!important` that would
   otherwise beat these selectors. */
.eacg-wrapper.eacg-empty .eacg-preview-area,
.eacg-wrapper.eacg-empty .eacg-multi {
    display: none !important;
}
.eacg-wrapper.eacg-empty .eacg-tool {
    grid-template-columns: 1fr !important;
    max-width: 720px;
    margin: 0 auto;
}

@media (max-width: 860px) {
    .eacg-tool {
        grid-template-columns: 1fr;
    }
}

.eacg-controls {
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    padding: 18px;
    min-width: 0;
}
.eacg-futuristic .eacg-controls {
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    padding: 24px;
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
    box-shadow: var(--eacg-shadow-glass);
}

.eacg-preview-area {
    min-width: 0;
}

/* ================ Form fields ================ */
.eacg-field {
    margin-bottom: 18px;
    border: 0;
    padding: 0;
}
.eacg-legend,
.eacg-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--eacg-label);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.eacg-futuristic .eacg-label {
    color: var(--eacg-accent);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    font-weight: 700;
}
.eacg-upload-row {
    margin-top: 10px;
}
.eacg-upload-help {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--eacg-label);
}
.eacg-mini-title {
    margin: 20px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--eacg-border);
    font-size: 0.95rem;
    color: var(--eacg-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.eacg-futuristic .eacg-mini-title {
    color: var(--eacg-text);
    border-bottom-color: var(--eacg-border-soft);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem;
    font-weight: 700;
}

.eacg-input,
.eacg-select,
.eacg-arabic-textarea,
.eacg-wrapper input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius-sm, var(--eacg-radius));
    background: var(--eacg-bg);
    color: var(--eacg-text);
    font-size: 0.98rem;
    font-family: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.eacg-futuristic .eacg-input,
.eacg-futuristic .eacg-select,
.eacg-futuristic .eacg-arabic-textarea,
.eacg-futuristic input[type="number"] {
    background: var(--eacg-surface-input);
    border: 1px solid var(--eacg-border-soft);
    color: var(--eacg-text);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 1px 2px rgba(15, 23, 42, 0.04);
}
.eacg-futuristic .eacg-input::placeholder,
.eacg-futuristic .eacg-arabic-textarea::placeholder {
    color: var(--eacg-muted);
}
.eacg-futuristic .eacg-input:focus,
.eacg-futuristic .eacg-select:focus,
.eacg-futuristic .eacg-arabic-textarea:focus,
.eacg-futuristic input[type="number"]:focus {
    outline: none;
    border-color: var(--eacg-accent);
    background: #ffffff;
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.eacg-arabic-textarea {
    font-family: 'Noto Naskh Arabic', 'Amiri', serif;
    font-size: 1.55rem;
    line-height: 1.9;
    min-height: 110px;
    resize: vertical;
}

/* Multi-line English input — paragraphs OK, but keeps compact by default. */
textarea.eacg-input,
.eacg-input-multiline {
    min-height: 58px;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
}

.eacg-wrapper input[type="range"] {
    width: 100%;
    accent-color: var(--eacg-accent);
}

.eacg-wrapper input[type="color"] {
    width: 56px;
    height: 36px;
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius-sm, var(--eacg-radius));
    padding: 2px;
    background: var(--eacg-bg);
    cursor: pointer;
}

/* ================ Buttons ================ */
.eacg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius-sm, var(--eacg-radius));
    background: var(--eacg-bg);
    color: var(--eacg-text);
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    /* Wrap-friendly by default so no button label overflows narrow screens. */
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.eacg-wrapper .eacg-btn:hover,
.eacg-wrapper .eacg-btn:focus {
    background: var(--eacg-accent);
    border-color: var(--eacg-accent);
    color: #ffffff;
}
.eacg-btn-primary {
    background: var(--eacg-accent);
    color: #ffffff;
    border-color: var(--eacg-accent);
}
.eacg-btn-primary:hover {
    background: var(--eacg-accent-hover);
    border-color: var(--eacg-accent-hover);
    color: #ffffff;
}
.eacg-btn-ghost {
    background: transparent;
}
.eacg-btn-toggle.eacg-active,
.eacg-btn-preset.eacg-preset-active {
    background: var(--eacg-accent);
    color: #ffffff;
    border-color: var(--eacg-accent);
}
.eacg-btn:focus-visible {
    outline: 2px solid var(--eacg-accent);
    outline-offset: 2px;
}

/* Futuristic buttons: gradient primaries, glass ghosts, soft glow. */
.eacg-futuristic .eacg-btn {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--eacg-border);
    color: var(--eacg-text);
    letter-spacing: 0.02em;
    padding: 11px 18px;
    border-radius: 12px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 4px 12px -6px rgba(15, 23, 42, 0.15);
}
/* Generic hover — deliberately excludes primary/example buttons so their
   gradient backgrounds aren't clobbered by this white ghost style. */
.eacg-futuristic .eacg-btn:not(.eacg-btn-primary):not(.eacg-btn-example):hover,
.eacg-futuristic .eacg-btn:not(.eacg-btn-primary):not(.eacg-btn-example):focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--eacg-accent);
    color: var(--eacg-accent);
    transform: translateY(-1px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 1) inset,
        0 10px 24px -8px rgba(99, 102, 241, 0.35);
}
.eacg-futuristic .eacg-btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    color: #ffffff;
    border: 1px solid transparent;
    box-shadow:
        0 12px 30px -10px rgba(139, 92, 246, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    font-weight: 700;
    letter-spacing: 0.03em;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.eacg-futuristic .eacg-btn-primary:hover,
.eacg-futuristic .eacg-btn-primary:focus,
.eacg-wrapper.eacg-futuristic .eacg-btn-primary:hover,
.eacg-wrapper.eacg-futuristic .eacg-btn-primary:focus {
    /* Re-declare the gradient background so the generic .btn:hover
       white background doesn't win by source order and turn the
       primary button into an invisible white-on-white blob. */
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
    filter: brightness(1.05) saturate(1.05);
    transform: translateY(-1px);
    box-shadow:
        0 16px 36px -10px rgba(139, 92, 246, 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    color: #ffffff;
    border-color: transparent;
}
.eacg-futuristic .eacg-btn-ghost {
    background: rgba(255, 255, 255, 0.35);
    color: var(--eacg-label);
    border-color: var(--eacg-border-soft);
}
.eacg-futuristic .eacg-btn-ghost:hover {
    color: var(--eacg-accent);
    background: rgba(255, 255, 255, 0.75);
    border-color: var(--eacg-accent);
}

#eacg-convert-btn {
    margin-top: 10px;
    width: 100%;
}
.eacg-futuristic #eacg-convert-btn {
    padding: 14px 18px;
    font-size: 0.98rem;
    /* Mixed case + tight spacing so the label wraps cleanly on narrow
       phones instead of being clipped by overflow:hidden. */
    letter-spacing: 0.02em;
    line-height: 1.3;
    white-space: normal;
    position: relative;
    overflow: hidden;
}
.eacg-futuristic #eacg-convert-btn::before {
    content: "";
    position: absolute;
    inset: -2px;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.7s ease;
    pointer-events: none;
}
.eacg-futuristic #eacg-convert-btn:hover::before {
    transform: translateX(100%);
}

/* Busy state — pulsing glow while translation runs. */
.eacg-futuristic #eacg-convert-btn.eacg-busy {
    cursor: progress;
    animation: eacg-pulse 1.4s ease-in-out infinite;
}
@keyframes eacg-pulse {
    0%, 100% { box-shadow: 0 12px 30px -10px rgba(99, 102, 241, 0.55); }
    50%      { box-shadow: 0 18px 44px -8px rgba(236, 72, 153, 0.55); }
}

/* ================ Counter, helper, error, disclaimer ================ */
.eacg-row {
    display: flex;
    align-items: center;
    margin-top: 8px;
}
.eacg-row-between {
    justify-content: space-between;
}
.eacg-row-end {
    justify-content: flex-end;
}
.eacg-counter {
    font-size: 0.78rem;
    color: var(--eacg-label);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    letter-spacing: 0.05em;
}
.eacg-error {
    margin-top: 8px;
    color: #dc2626;
    font-size: 0.86rem;
}
.eacg-disclaimer {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.55);
    border-left: 3px solid var(--eacg-accent);
    border-radius: 0 var(--eacg-radius-sm, var(--eacg-radius)) var(--eacg-radius-sm, var(--eacg-radius)) 0;
    font-size: 0.8rem;
    color: var(--eacg-label);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.eacg-helper {
    margin: -2px 0 8px;
    font-size: 0.82rem;
    color: var(--eacg-label);
}
.eacg-warn {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(254, 243, 199, 0.7);
    border-left: 3px solid #f59e0b;
    border-radius: 0 var(--eacg-radius-sm, var(--eacg-radius)) var(--eacg-radius-sm, var(--eacg-radius)) 0;
    color: #92400e;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ================ Preview ================ */
.eacg-preview-wrap {
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.eacg-futuristic .eacg-preview-wrap {
    padding: 22px;
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    box-shadow: var(--eacg-shadow-glass);
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
    position: relative;
}
.eacg-futuristic .eacg-preview-wrap::after {
    /* Corner brackets — subtle HUD accent in the accent gradient. */
    content: "";
    position: absolute;
    inset: 10px;
    background:
        linear-gradient(var(--eacg-accent), var(--eacg-accent)) top left / 22px 2px no-repeat,
        linear-gradient(var(--eacg-accent), var(--eacg-accent)) top left / 2px 22px no-repeat,
        linear-gradient(var(--eacg-accent-3), var(--eacg-accent-3)) top right / 22px 2px no-repeat,
        linear-gradient(var(--eacg-accent-3), var(--eacg-accent-3)) top right / 2px 22px no-repeat,
        linear-gradient(var(--eacg-accent-2), var(--eacg-accent-2)) bottom left / 22px 2px no-repeat,
        linear-gradient(var(--eacg-accent-2), var(--eacg-accent-2)) bottom left / 2px 22px no-repeat,
        linear-gradient(var(--eacg-accent), var(--eacg-accent)) bottom right / 22px 2px no-repeat,
        linear-gradient(var(--eacg-accent), var(--eacg-accent)) bottom right / 2px 22px no-repeat;
    pointer-events: none;
    opacity: 0.5;
    border-radius: 8px;
}
#eacg-canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius-sm, var(--eacg-radius));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    background:
        linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%) 0 0 / 20px 20px,
        linear-gradient(45deg, #e8e8e8 25%, transparent 25%, transparent 75%, #e8e8e8 75%) 10px 10px / 20px 20px,
        #ffffff;
}

/* ================ Design panel (colors) ================ */
.eacg-design {
    margin-top: 18px;
    padding: 18px;
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
}
.eacg-futuristic .eacg-design {
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    box-shadow: var(--eacg-shadow-glass);
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
}
.eacg-design-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.eacg-field-color .eacg-label {
    margin-bottom: 6px;
}
.eacg-color-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    background: var(--eacg-bg);
    border: 1px solid var(--eacg-border-soft);
    border-radius: 10px;
    min-height: 44px;
}
.eacg-futuristic .eacg-color-row {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--eacg-border-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.eacg-color-row input[type="color"] {
    width: 40px;
    height: 36px;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}
.eacg-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.eacg-color-row input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--eacg-border-soft);
    border-radius: 6px;
}
.eacg-color-row input[type="color"]::-moz-color-swatch {
    border: 1px solid var(--eacg-border-soft);
    border-radius: 6px;
}
.eacg-color-swatch-label {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.78rem;
    color: var(--eacg-label);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.eacg-field-inline {
    margin-bottom: 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--eacg-border-soft);
}
.eacg-field-inline .eacg-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--eacg-text);
    padding: 6px 0;
}
.eacg-field-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--eacg-accent);
    cursor: pointer;
}
/* When transparent-bg is toggled on, dim the bg-color picker so it's clear
   the value is inert until you turn transparent off again. */
#eacg-transparent-bg:checked ~ *,
.eacg-design:has(#eacg-transparent-bg:checked) #eacg-bg-options {
    opacity: 0.5;
    pointer-events: none;
}

/* ================ Downloads ================ */
.eacg-downloads {
    margin-top: 18px;
    padding: 18px;
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
}
.eacg-futuristic .eacg-downloads {
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    box-shadow: var(--eacg-shadow-glass);
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
}
.eacg-download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.eacg-download-buttons .eacg-btn {
    flex: 1 1 auto;
    min-width: 130px;
}

/* ================ Section titles ================ */
.eacg-section-title {
    font-size: 1.15rem;
    margin: 0 0 12px;
    color: var(--eacg-text);
    letter-spacing: -0.005em;
}
.eacg-futuristic .eacg-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--eacg-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.eacg-futuristic .eacg-section-title::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--eacg-accent), var(--eacg-accent-3));
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

/* ================ Info / examples / FAQ ================ */
.eacg-info,
.eacg-examples,
.eacg-faq {
    margin-top: 30px;
}
.eacg-example-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.eacg-futuristic .eacg-btn-example {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--eacg-border-soft);
    color: var(--eacg-text);
}
.eacg-futuristic .eacg-btn-example:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(236, 72, 153, 0.14));
    border-color: var(--eacg-accent-2);
    color: var(--eacg-accent-hover);
}

/* ================ FAQ ================ */
.eacg-faq-list {
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    overflow: hidden;
    background: var(--eacg-surface);
}
.eacg-faq-item + .eacg-faq-item {
    border-top: 1px solid var(--eacg-border);
}
.eacg-faq-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 14px 16px;
    font: inherit;
    color: var(--eacg-text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.eacg-faq-toggle:hover { color: var(--eacg-accent); }
.eacg-faq-icon {
    font-size: 1.2rem;
    color: var(--eacg-accent);
    transition: transform 0.2s ease;
}
.eacg-faq-open .eacg-faq-icon { transform: rotate(45deg); }
.eacg-faq-answer {
    padding: 0 16px 14px;
    color: var(--eacg-label);
    font-size: 0.95rem;
}
.eacg-faq-answer p { margin: 0; }

/* ================ Multi-style preview grid ================ */
.eacg-multi {
    margin-top: 32px;
}
.eacg-multi-intro {
    margin: 0 0 16px;
    color: var(--eacg-label);
    font-size: 0.9rem;
}
.eacg-multi-grid {
    display: grid;
    /* One preview per row — each card gets the full width of the container
       so the Arabic text renders large and legible. */
    grid-template-columns: 1fr;
    gap: 16px;
}
.eacg-mp-card {
    background: var(--eacg-surface);
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius);
    padding: 16px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}
.eacg-futuristic .eacg-mp-card {
    background: var(--eacg-surface-strong);
    border: 1px solid var(--eacg-border);
    box-shadow: var(--eacg-shadow-glass);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
}
.eacg-futuristic .eacg-mp-card::before {
    /* gradient border on hover */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.7), rgba(139, 92, 246, 0.7), rgba(236, 72, 153, 0.7));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.eacg-futuristic .eacg-mp-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 24px 50px -20px rgba(99, 102, 241, 0.35);
}
.eacg-futuristic .eacg-mp-card:hover::before { opacity: 1; }

.eacg-mp-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--eacg-label);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.eacg-futuristic .eacg-mp-label {
    color: var(--eacg-accent);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 700;
}
.eacg-mp-preview {
    background: #ffffff;
    border: 1px solid var(--eacg-border);
    border-radius: var(--eacg-radius-sm, var(--eacg-radius));
    overflow: hidden;
    margin-bottom: 12px;
}
.eacg-futuristic .eacg-mp-preview {
    background: #ffffff;
    border: 1px solid var(--eacg-border-soft);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}
.eacg-mp-canvas {
    display: block;
    width: 100%;
    height: auto;
    /* Paragraph-friendly ceiling — canvas is now 1200×500 (aspect ~2.4:1),
       so a full-width card fits a wrapped 2–4 line paragraph without
       distortion. Clipping here would squish the aspect and hurt legibility. */
    max-height: 640px;
}
.eacg-mp-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.eacg-mp-buttons .eacg-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Copy-mode: single wide Copy button per card. */
.eacg-multi-copy .eacg-mp-buttons {
    justify-content: stretch;
}
.eacg-multi-copy .eacg-mp-buttons .eacg-btn {
    flex: 1 1 auto;
    padding: 10px 14px;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    white-space: normal;
    line-height: 1.3;
}
.eacg-futuristic.eacg-multi-copy .eacg-mp-buttons .eacg-btn {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(236, 72, 153, 0.10));
    border-color: var(--eacg-border-soft);
    color: var(--eacg-accent);
}
.eacg-futuristic.eacg-multi-copy .eacg-mp-buttons .eacg-btn:hover {
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 24px -8px rgba(139, 92, 246, 0.45);
}

.eacg-mp-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
}
.eacg-mp-pageinfo {
    font-size: 0.85rem;
    color: var(--eacg-label);
    min-width: 100px;
    text-align: center;
    font-family: "JetBrains Mono", ui-monospace, monospace;
}
.eacg-mp-pager .eacg-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.eacg-wrapper .eacg-mp-pager .eacg-btn[disabled]:hover {
    background: rgba(255, 255, 255, 0.65);
    color: var(--eacg-text);
    border-color: var(--eacg-border);
    transform: none;
    box-shadow: none;
}

/* =============================================================
 * RESPONSIVE — everything from 4K desktop to a small phone.
 * Breakpoints:
 *   ≤ 1024px   Tablet landscape (tighter spacing, same 2-col tool)
 *   ≤ 860px    Tablet portrait  (tool collapses to single column)
 *   ≤ 640px    Large phone      (compact padding, smaller multi grid)
 *   ≤ 480px    Small phone      (single-column multi grid, stacked buttons)
 *   ≤ 380px    Tiny phone       (tightest padding)
 * ============================================================= */

/* Prevent iOS Safari from zooming when a form field is focused —
   any input font-size ≥ 16px avoids the zoom trigger. Excludes the
   Arabic textarea, which already uses a much larger custom size. */
.eacg-wrapper .eacg-input,
.eacg-wrapper .eacg-select,
.eacg-wrapper input[type="number"],
.eacg-wrapper input[type="text"],
.eacg-wrapper input[type="url"],
.eacg-wrapper input[type="password"] {
    font-size: max(16px, 0.98rem);
}
/* Wrapping-friendly buttons — no horizontal scroll from a long label. */
.eacg-btn { max-width: 100%; }
.eacg-btn > * { min-width: 0; }
/* Kill iOS blue tap highlight; smoother touches. */
.eacg-wrapper .eacg-btn,
.eacg-wrapper .eacg-btn-toggle,
.eacg-wrapper .eacg-btn-example,
.eacg-wrapper .eacg-btn-preset,
.eacg-wrapper .eacg-faq-toggle {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Canvas must never overflow its container. */
#eacg-canvas {
    display: block;
    max-width: 100%;
    width: 100%;
    height: auto;
}
.eacg-preview-wrap {
    overflow: hidden;
    max-width: 100%;
}

/* ================ ≤ 1024px — Tablet landscape ================ */
@media (max-width: 1024px) {
    .eacg-tool { gap: 20px; }
    /* Multi grid stays single-column — one preview per row on every size. */
}

/* ================ ≤ 860px — Tablet portrait ================ */
@media (max-width: 860px) {
    .eacg-tool {
        grid-template-columns: 1fr;
    }
    .eacg-variant-homepage .eacg-tool {
        grid-template-columns: 1fr;
    }
    .eacg-controls,
    .eacg-preview-area {
        min-width: 0;
    }
    /* Sticky pager centers nicely on tablet. */
    .eacg-mp-pager {
        gap: 10px;
    }
}

/* ================ ≤ 640px — Large phone ================ */
@media (max-width: 640px) {
    .eacg-wrapper { padding: 0; }
    /* .eacg-futuristic stays transparent, no padding — the page container
       provides the horizontal spacing. */
    /* Design panel: color grid stacks 1-col on phones. */
    .eacg-design-grid { grid-template-columns: 1fr; gap: 12px; }
    /* Header: less top margin so the tool is visible sooner. */
    .eacg-header { margin-bottom: 16px; }
    .eacg-intro { font-size: 0.92rem; }
    /* Panels: tighter internal spacing. */
    .eacg-controls,
    .eacg-futuristic .eacg-controls,
    .eacg-preview-wrap,
    .eacg-futuristic .eacg-preview-wrap,
    .eacg-downloads,
    .eacg-futuristic .eacg-downloads {
        padding: 16px;
    }
    .eacg-field { margin-bottom: 14px; }
    /* Arabic textarea: readable but not overwhelming. */
    .eacg-arabic-textarea {
        font-size: 1.25rem;
        line-height: 1.7;
        min-height: 90px;
    }
    /* Multi grid: single column keeps mobile layout consistent with desktop. */
    .eacg-multi-grid { gap: 12px; }
    .eacg-mp-card,
    .eacg-futuristic .eacg-mp-card { padding: 14px; }
    /* On phones the card is narrower — allow the paragraph to render
       taller so wrapped lines don't get squashed. */
    .eacg-mp-canvas { max-height: 420px; }
    /* Section titles slightly smaller. */
    .eacg-section-title,
    .eacg-futuristic .eacg-section-title { font-size: 1.1rem; }
    /* Compact HUD brackets. */
    .eacg-futuristic .eacg-preview-wrap::after { inset: 6px; }
    /* Larger touch targets on all buttons. */
    .eacg-btn { min-height: 44px; padding: 10px 14px; }
    /* Example buttons wrap tightly. */
    .eacg-example-buttons { gap: 6px; }
}

/* ================ ≤ 480px — Small phone ================ */
@media (max-width: 480px) {
    /* Multi grid: tighter gap; single column is already the base. */
    .eacg-multi-grid { gap: 10px; }
    /* Convert button and downloads stack full-width. */
    #eacg-convert-btn,
    .eacg-download-buttons .eacg-btn,
    .eacg-multi-copy .eacg-mp-buttons .eacg-btn {
        width: 100%;
        min-width: 0;
    }
    .eacg-download-buttons { flex-direction: column; }
    .eacg-download-buttons .eacg-btn {
        flex: 0 0 auto;
    }
    /* Per-card multi buttons stack on the tiniest phones. */
    .eacg-mp-buttons {
        justify-content: stretch;
    }
    .eacg-mp-buttons .eacg-btn {
        flex: 1 1 100%;
    }
    /* Arabic output slightly smaller so tashkeel remains legible. */
    .eacg-arabic-textarea {
        font-size: 1.15rem;
        min-height: 84px;
    }
    /* Copy button row goes full-width on small phones. */
    .eacg-row.eacg-row-end {
        justify-content: stretch;
    }
    .eacg-row.eacg-row-end .eacg-btn {
        flex: 1 1 100%;
        justify-content: center;
    }
    /* Pager text uses less horizontal room. */
    .eacg-mp-pageinfo { min-width: 80px; font-size: 0.8rem; }
    /* HUD brackets removed on very small screens — too visually busy. */
    .eacg-futuristic .eacg-preview-wrap::after { display: none; }
}

/* ================ ≤ 380px — Tiny phone (iPhone SE 1st gen etc.) ================ */
@media (max-width: 380px) {
    .eacg-wrapper { padding: 0; }
    .eacg-controls,
    .eacg-futuristic .eacg-controls,
    .eacg-preview-wrap,
    .eacg-futuristic .eacg-preview-wrap,
    .eacg-downloads,
    .eacg-futuristic .eacg-downloads,
    .eacg-mp-card,
    .eacg-futuristic .eacg-mp-card {
        padding: 12px;
    }
    .eacg-btn { font-size: 0.85rem; padding: 10px 12px; min-height: 44px; }
    /* Keep the paragraph readable — don't clip the wrapped lines. */
    .eacg-mp-canvas { max-height: 360px; }
    /* Pager fits without overflow on 320-360px phones. */
    .eacg-mp-pager { gap: 8px; flex-wrap: wrap; }
    .eacg-mp-pageinfo { min-width: 72px; font-size: 0.78rem; }
}

/* ================ ≤ 340px — Very small phone (feature phones, cramped webviews) ================ */
@media (max-width: 340px) {
    .eacg-wrapper { padding: 0; }
    /* Reduce ALL heading + section title sizes so they never wrap awkwardly. */
    .eacg-futuristic .eacg-title { font-size: 1.4rem; }
    .eacg-section-title,
    .eacg-futuristic .eacg-section-title { font-size: 1rem; }
    .eacg-mini-title,
    .eacg-futuristic .eacg-mini-title { font-size: 0.72rem; }
    /* All labels shorter/smaller. */
    .eacg-label,
    .eacg-futuristic .eacg-label { font-size: 0.68rem; letter-spacing: 0.1em; }
    /* Panels: no rounded corners battle for pixels. */
    .eacg-controls,
    .eacg-futuristic .eacg-controls,
    .eacg-preview-wrap,
    .eacg-futuristic .eacg-preview-wrap,
    .eacg-downloads,
    .eacg-futuristic .eacg-downloads,
    .eacg-mp-card,
    .eacg-futuristic .eacg-mp-card {
        padding: 10px;
        border-radius: 12px;
    }
    /* Arabic textarea: even more conservative. */
    .eacg-arabic-textarea {
        font-size: 1.05rem;
        line-height: 1.6;
        min-height: 78px;
    }
    /* Buttons: allow text to wrap onto two lines if needed. */
    .eacg-btn {
        white-space: normal;
        line-height: 1.2;
        padding: 10px 10px;
        font-size: 0.82rem;
    }
    /* Pager: stack the info line onto its own row. */
    .eacg-mp-pager { flex-direction: column; gap: 8px; }
    .eacg-mp-pageinfo { order: 3; }
    /* Every button in the field row goes full-width. */
    .eacg-row .eacg-btn { width: 100%; justify-content: center; }
}

/* ================ Landscape phones — vertical space is scarce ================ */
@media (max-height: 500px) and (orientation: landscape) {
    /* Give more vertical breathing room: shrink hero-y elements. */
    .eacg-header { margin-bottom: 12px; }
    .eacg-futuristic .eacg-title { font-size: 1.4rem; }
    .eacg-intro { font-size: 0.85rem; }
    /* Landscape phones: compact card but still enough room for a 2-line wrap. */
    .eacg-mp-canvas { max-height: 300px; }
}

/* ================ Universal overflow guard ================
 * Some host themes wrap the shortcode in a container that isn't
 * width-constrained. These rules prevent the tool from creating
 * horizontal scroll even in that case. */
.eacg-wrapper {
    max-width: 100%;
    overflow-x: clip;
}
/* Inputs, textareas and selects inside flex containers must be
   allowed to shrink below their intrinsic content width. */
.eacg-wrapper .eacg-input,
.eacg-wrapper .eacg-select,
.eacg-wrapper .eacg-arabic-textarea,
.eacg-wrapper input,
.eacg-wrapper select,
.eacg-wrapper textarea {
    min-width: 0;
    max-width: 100%;
}
/* Images, media, iframes in FAQ or examples never blow the container. */
.eacg-wrapper img,
.eacg-wrapper video,
.eacg-wrapper iframe {
    max-width: 100%;
    height: auto;
}

/* ================ Reduced-motion support ================ */
@media (prefers-reduced-motion: reduce) {
    .eacg-futuristic::before,
    .eacg-futuristic .eacg-mp-card,
    .eacg-futuristic .eacg-btn,
    .eacg-futuristic #eacg-convert-btn,
    .eacg-variant-english_generator #eacg-convert-btn,
    .eacg-futuristic #eacg-convert-btn::before {
        animation: none !important;
        transition: none !important;
    }
    .eacg-futuristic .eacg-mp-card:hover,
    .eacg-futuristic .eacg-btn:hover { transform: none !important; }
}

/* Heavy backdrop-filter blurs are expensive on low-end mobile GPUs.
   On coarse pointers (touch devices), lighten them. */
@media (hover: none) and (pointer: coarse) {
    .eacg-futuristic .eacg-controls,
    .eacg-futuristic .eacg-preview-wrap,
    .eacg-futuristic .eacg-downloads,
    .eacg-futuristic .eacg-mp-card {
        backdrop-filter: blur(14px) saturate(1.3);
        -webkit-backdrop-filter: blur(14px) saturate(1.3);
    }
}

/* ================ Compact mode ================ */
.eacg-compact.eacg-wrapper { padding: 16px; }
.eacg-compact .eacg-title { font-size: 1.3rem; }
.eacg-compact .eacg-field { margin-bottom: 12px; }
.eacg-compact .eacg-btn { padding: 8px 12px; font-size: 0.85rem; }

/* ================================================================
 * PER-VARIATION TWEAKS
 * ================================================================ */

/* Homepage: full tool, but the multi grid is hidden. Emphasize preview. */
.eacg-variant-homepage .eacg-tool {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr);
}

/* Copy & Paste: no preview column. Big Arabic textarea, styled grid of Copy cards. */
.eacg-variant-copy_paste .eacg-arabic-textarea {
    font-size: 1.8rem;
    min-height: 140px;
    text-align: center;
}
/* Multi grid on every variation stays single-column (see base rule). */
.eacg-variant-copy_paste .eacg-mp-preview {
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Font Styles: gallery-first layout. */
.eacg-variant-font_styles .eacg-controls {
    max-width: 640px;
    margin: 0 auto 4px;
}

/* English Generator: input-first hero feel. */
.eacg-variant-english_generator .eacg-input {
    font-size: 1.05rem;
}
.eacg-variant-english_generator #eacg-convert-btn {
    background-size: 200% 200%;
    animation: eacg-hue 8s ease-in-out infinite;
}
@keyframes eacg-hue {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* =============================================================
 * PER-VARIATION RESPONSIVE OVERRIDES
 * The per-variation rules above have higher specificity than the
 * generic responsive block, so any variation-scoped tweak must be
 * re-declared under each breakpoint. Same breakpoints as the main
 * responsive block: 860 / 640 / 480 / 380 / 340 + landscape.
 * ============================================================= */

/* ≤ 860px — tool collapses. All variations become single column. */
@media (max-width: 860px) {
    .eacg-variant-homepage .eacg-tool,
    .eacg-variant-full .eacg-tool,
    .eacg-variant-copy_paste .eacg-tool,
    .eacg-variant-font_styles .eacg-tool,
    .eacg-variant-english_generator .eacg-tool {
        grid-template-columns: 1fr;
    }
    /* Font-styles centered controls block: full width when stacked. */
    .eacg-variant-font_styles .eacg-controls {
        max-width: 100%;
    }
    /* Multi grid is single-column at every size; no per-variation override needed. */
}

/* ≤ 640px — large phone tuning per variation. */
@media (max-width: 640px) {
    /* Copy-paste textarea: scale down from 1.8rem so tashkeel + long
       phrases fit without overflowing the panel. */
    .eacg-variant-copy_paste .eacg-arabic-textarea {
        font-size: 1.4rem;
        min-height: 120px;
    }
    /* English-generator input: normalise so iOS Safari doesn't zoom. */
    .eacg-variant-english_generator .eacg-input {
        font-size: 16px;
    }
    /* Copy-paste mp-preview compresses to fit narrower cards. */
    .eacg-variant-copy_paste .eacg-mp-preview {
        min-height: 110px;
    }
}

/* ≤ 480px — small phone. */
@media (max-width: 480px) {
    .eacg-variant-copy_paste .eacg-arabic-textarea {
        font-size: 1.25rem;
        min-height: 100px;
    }
    .eacg-variant-copy_paste .eacg-mp-preview {
        min-height: 96px;
    }
}

/* ≤ 340px — very small phones. */
@media (max-width: 340px) {
    .eacg-variant-copy_paste .eacg-arabic-textarea {
        font-size: 1.05rem;
        min-height: 84px;
    }
    .eacg-variant-english_generator .eacg-input {
        font-size: 16px;
    }
}

/* Landscape phones: further compression for the copy-paste + english variants. */
@media (max-height: 500px) and (orientation: landscape) {
    .eacg-variant-copy_paste .eacg-arabic-textarea {
        font-size: 1.15rem;
        min-height: 60px;
    }
    .eacg-variant-copy_paste .eacg-mp-preview {
        min-height: 72px;
    }
}
