/* =====================================================================
   Meshy AI 3D — Frontend
   Modern "studio" UI inspired by tripo3d.ai
   Scoped to .meshy-ai-container so it NEVER leaks into my-account etc.
   Light + dark themes via [data-meshy-theme].
   ===================================================================== */

/* ---------- Theme tokens ---------- */
.meshy-ai-container {
    /* Brand (shared) */
    --meshy-grad:        linear-gradient(135deg, #7c3aed 0%, #c026d3 50%, #ec4899 100%);
    --meshy-grad-soft:   linear-gradient(135deg, rgba(124,58,237,.18), rgba(236,72,153,.18));
    --meshy-accent:      #c026d3;
    --meshy-accent-2:    #ec4899;
    --meshy-accent-3:    #7c3aed;
    --meshy-success:     #10b981;
    --meshy-error:       #f43f5e;

    /* Defaults = dark */
    --meshy-bg-0:        #0a0613;
    --meshy-bg-1:        #110a22;
    --meshy-bg-2:        #1a1030;
    --meshy-surface:     rgba(255, 255, 255, 0.04);
    --meshy-surface-2:   rgba(255, 255, 255, 0.07);
    --meshy-border:      rgba(255, 255, 255, 0.08);
    --meshy-border-hi:   rgba(255, 255, 255, 0.18);
    --meshy-text:        #f5f3ff;
    --meshy-text-dim:    #b8b2d1;
    --meshy-text-mute:   #7e7799;
    --meshy-shadow-md:   0 12px 40px rgba(0,0,0,.35);
    --meshy-shadow-glow: 0 10px 50px rgba(192, 38, 211, .35);
    --meshy-grid-line:   rgba(255,255,255,.05);
    --meshy-orb-opacity: .55;
    --meshy-caption-bg:  rgba(10,6,19,.55);

    --meshy-radius-sm:   10px;
    --meshy-radius-md:   16px;
    --meshy-radius-lg:   24px;
    --meshy-radius-xl:   32px;

    --meshy-font:        ui-sans-serif, system-ui, -apple-system, "Segoe UI",
                         Roboto, "Helvetica Neue", Arial, "Noto Sans Hebrew",
                         "Heebo", "Rubik", sans-serif;
    --meshy-ease:        cubic-bezier(.22, 1, .36, 1);
}

/* Light theme overrides */
.meshy-ai-container[data-meshy-theme="light"] {
    --meshy-bg-0:        #f6f3ff;
    --meshy-bg-1:        #ece6ff;
    --meshy-bg-2:        #f9f5ff;
    --meshy-surface:     rgba(255, 255, 255, 0.7);
    --meshy-surface-2:   rgba(255, 255, 255, 0.95);
    --meshy-border:      rgba(28, 16, 64, 0.08);
    --meshy-border-hi:   rgba(28, 16, 64, 0.18);
    --meshy-text:        #1a0f33;
    --meshy-text-dim:    #4a3d6b;
    --meshy-text-mute:   #7c6f99;
    --meshy-shadow-md:   0 12px 40px rgba(60, 24, 120, .12);
    --meshy-shadow-glow: 0 10px 50px rgba(192, 38, 211, .25);
    --meshy-grid-line:   rgba(28, 16, 64, .06);
    --meshy-orb-opacity: .35;
    --meshy-caption-bg:  rgba(255,255,255,.75);
}

/* =====================================================================
   Container — IMPORTANT: behaves as a contained block.
   No min-height: 100vh, no margin nukes. Safe to embed anywhere
   (my-account tab, sidebar, custom page, etc.).
   ===================================================================== */
.meshy-ai-container {
    position: relative;
    color: var(--meshy-text);
    font-family: var(--meshy-font);
    font-size: 16px;
    line-height: 1.6;
    background: radial-gradient(ellipse at top, var(--meshy-bg-2) 0%, var(--meshy-bg-1) 45%, var(--meshy-bg-0) 100%);
    border-radius: var(--meshy-radius-xl);
    overflow: hidden;
    isolation: isolate;
    margin: 24px auto;
    max-width: 1280px;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.meshy-ai-container *,
.meshy-ai-container *::before,
.meshy-ai-container *::after { box-sizing: border-box; }

.meshy-ai-container h1,
.meshy-ai-container h2,
.meshy-ai-container h3,
.meshy-ai-container h4 {
    color: var(--meshy-text);
    margin: 0 0 .5em;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.meshy-ai-container p { color: var(--meshy-text-dim); margin: 0 0 1em; }
.meshy-ai-container a { color: inherit; }

/* ---------- Theme toggle ---------- */
.meshy-theme-toggle {
    position: absolute;
    top: 18px;
    inset-inline-end: 18px;
    z-index: 5;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 999px;
    border: 1px solid var(--meshy-border-hi);
    background: var(--meshy-surface);
    color: var(--meshy-text);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform .25s var(--meshy-ease), background .2s var(--meshy-ease), color .2s var(--meshy-ease);
}
.meshy-theme-toggle:hover { transform: rotate(15deg); background: var(--meshy-surface-2); }
.meshy-theme-toggle svg { width: 20px; height: 20px; }
.meshy-theme-toggle .meshy-icon-sun  { display: none; }
.meshy-theme-toggle .meshy-icon-moon { display: block; }
.meshy-ai-container[data-meshy-theme="light"] .meshy-theme-toggle .meshy-icon-sun  { display: block; }
.meshy-ai-container[data-meshy-theme="light"] .meshy-theme-toggle .meshy-icon-moon { display: none; }

/* =====================================================================
   HERO
   ===================================================================== */
.meshy-hero {
    position: relative;
    padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 64px) clamp(40px, 6vw, 72px);
    overflow: hidden;
    isolation: isolate;
}
.meshy-hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }

.meshy-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: var(--meshy-orb-opacity);
    animation: meshy-float 18s var(--meshy-ease) infinite;
}
.meshy-orb-1 { width: 380px; height: 380px; left: -100px;  top: -60px;   background: #7c3aed; }
.meshy-orb-2 { width: 420px; height: 420px; right: -120px; top:  20px;   background: #ec4899; animation-delay: -6s; }
.meshy-orb-3 { width: 320px; height: 320px; left: 40%;     bottom: -80px; background: #c026d3; animation-delay: -12s; }

@keyframes meshy-float {
    0%,100% { transform: translate3d(0,0,0) scale(1); }
    50%     { transform: translate3d(20px,-30px,0) scale(1.08); }
}

.meshy-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--meshy-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--meshy-grid-line) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

.meshy-hero-inner {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.meshy-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--meshy-surface);
    border: 1px solid var(--meshy-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--meshy-text-dim);
    font-size: 13px; font-weight: 500; letter-spacing: .02em;
    margin-bottom: 22px;
}
.meshy-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--meshy-accent-2);
    box-shadow: 0 0 12px var(--meshy-accent-2);
    animation: meshy-pulse 2s ease-in-out infinite;
}
@keyframes meshy-pulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%     { opacity: .5; transform: scale(.85); }
}

.meshy-hero-title {
    font-size: clamp(2rem, 5.5vw, 4rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    background: linear-gradient(180deg, var(--meshy-text) 0%, var(--meshy-accent-3) 60%, var(--meshy-accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0 0 18px;
}

.meshy-hero-subtitle {
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    color: var(--meshy-text-dim);
    max-width: 720px;
    margin: 0 auto 28px;
}

.meshy-hero-features {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 10px; margin-bottom: 40px;
}
.meshy-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--meshy-surface);
    border: 1px solid var(--meshy-border);
    color: var(--meshy-text);
    font-size: 14px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ---- Mode cards ---- */
.meshy-mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    max-width: 880px;
    margin: 0 auto;
}
.meshy-mode-card {
    position: relative;
    display: flex; align-items: center; gap: 18px;
    text-align: start;
    padding: 22px 24px;
    border-radius: var(--meshy-radius-lg);
    border: 1px solid var(--meshy-border);
    background: var(--meshy-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--meshy-text);
    cursor: pointer;
    overflow: hidden;
    transition: transform .35s var(--meshy-ease), border-color .35s var(--meshy-ease), box-shadow .35s var(--meshy-ease), background .25s var(--meshy-ease);
    font: inherit;
}
.meshy-mode-card::before {
    content: '';
    position: absolute; inset: 0;
    background: var(--meshy-grad);
    opacity: 0;
    transition: opacity .35s var(--meshy-ease);
    z-index: 0;
    mix-blend-mode: overlay;
}
.meshy-mode-card > * { position: relative; z-index: 1; }
.meshy-mode-card:hover {
    transform: translateY(-4px);
    border-color: var(--meshy-border-hi);
    box-shadow: var(--meshy-shadow-glow);
}
.meshy-mode-card:hover::before { opacity: .18; }

.meshy-mode-icon {
    flex: 0 0 56px;
    width: 56px; height: 56px;
    display: grid; place-items: center;
    border-radius: var(--meshy-radius-md);
    background: var(--meshy-grad);
    color: #fff;
    box-shadow: 0 10px 24px rgba(192,38,211,.4);
}
.meshy-mode-icon svg { width: 28px; height: 28px; }
.meshy-mode-text { flex: 1; min-width: 0; }
.meshy-mode-text h3 { font-size: 1.15rem; margin: 0 0 4px; color: var(--meshy-text); }
.meshy-mode-text p  { font-size: .92rem; color: var(--meshy-text-dim); margin: 0; }

.meshy-mode-arrow {
    font-size: 1.6rem; color: var(--meshy-text-dim);
    transition: transform .3s var(--meshy-ease), color .3s var(--meshy-ease);
}
.meshy-mode-card:hover .meshy-mode-arrow { color: var(--meshy-text); transform: translateX(6px); }
.meshy-rtl .meshy-mode-card:hover .meshy-mode-arrow { transform: translateX(-6px); }
.meshy-rtl .meshy-mode-arrow { transform: scaleX(-1); }

/* =====================================================================
   CHARACTER GALLERY — fixed 3 columns on desktop
   ===================================================================== */
.meshy-gallery {
    padding: clamp(32px, 5vw, 64px) clamp(20px, 5vw, 64px);
    max-width: 1100px;
    margin: 0 auto;
}
.meshy-gallery-header { text-align: center; margin-bottom: 36px; }
.meshy-gallery-header h2 {
    font-size: clamp(1.5rem, 2.8vw, 2rem);
    background: linear-gradient(135deg, var(--meshy-text) 30%, var(--meshy-accent-3) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.meshy-gallery-header p { color: var(--meshy-text-dim); max-width: 620px; margin: 8px auto 0; }

.meshy-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.meshy-char-card {
    position: relative;
    margin: 0;
    border-radius: var(--meshy-radius-lg);
    overflow: hidden;
    background: linear-gradient(160deg, rgba(124,58,237,.14), rgba(236,72,153,.06) 60%, var(--meshy-surface));
    border: 1px solid var(--meshy-border);
    transition: transform .45s var(--meshy-ease), border-color .45s var(--meshy-ease), box-shadow .45s var(--meshy-ease);
    cursor: pointer;
}
.meshy-char-card:hover {
    transform: translateY(-6px);
    border-color: var(--meshy-border-hi);
    box-shadow: var(--meshy-shadow-glow);
}

.meshy-char-imgwrap {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 60%, rgba(192,38,211,.18), transparent 60%),
        var(--meshy-surface);
}
.meshy-char-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 14px;
    transition: opacity .55s var(--meshy-ease), transform .8s var(--meshy-ease);
}
/* Default state: textured (base) is visible. */
.meshy-char-base { opacity: 1; }
.meshy-char-tex  { opacity: 0; }
/* Hover state: reveal the untextured mesh. */
.meshy-char-card:hover .meshy-char-base { opacity: 0; transform: scale(1.04); }
.meshy-char-card:hover .meshy-char-tex  { opacity: 1; transform: scale(1.04); }

.meshy-char-shine {
    position: absolute; inset: 0;
    background: linear-gradient(115deg,
        transparent 30%,
        rgba(255,255,255,.18) 48%,
        rgba(192,38,211,.25) 52%,
        transparent 70%);
    transform: translateX(-120%);
    transition: transform .9s var(--meshy-ease);
    pointer-events: none;
    mix-blend-mode: screen;
}
.meshy-char-card:hover .meshy-char-shine { transform: translateX(120%); }

.meshy-char-caption {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--meshy-border);
    background: var(--meshy-caption-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.meshy-char-name { font-weight: 600; font-size: .95rem; color: var(--meshy-text); }
.meshy-char-badge {
    font-size: 11px; letter-spacing: .08em;
    padding: 3px 8px; border-radius: 999px;
    background: var(--meshy-grad); color: #fff; font-weight: 600;
}

/* =====================================================================
   STUDIO (generator)
   ===================================================================== */
.meshy-studio {
    position: relative;
    padding: clamp(32px, 5vw, 64px) clamp(16px, 4vw, 48px) clamp(48px, 7vw, 80px);
    max-width: 1080px;
    margin: 0 auto;
}

.meshy-section,
.meshy-generator-wrapper {
    position: relative;
    border-radius: var(--meshy-radius-xl);
    background: var(--meshy-surface);
    border: 1px solid var(--meshy-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--meshy-shadow-md);
    padding: clamp(24px, 4vw, 48px);
}
.meshy-generator-wrapper { padding: 0; overflow: hidden; }

.meshy-icon-large {
    width: 72px; height: 72px;
    display: grid; place-items: center;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--meshy-grad-soft);
    border: 1px solid var(--meshy-border-hi);
    color: var(--meshy-accent-2);
}
.meshy-icon-large svg { width: 34px; height: 34px; }

.meshy-auth-required, .meshy-purchase-required { text-align: center; }
.meshy-auth-required h2, .meshy-purchase-required h2 { font-size: 1.6rem; }

/* ---- YazCoins pack picker ---- */
.meshy-pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    max-width: 980px;
    margin: 28px auto 8px;
    text-align: start;
}
.meshy-pack-card {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    gap: 10px;
    padding: 22px 18px;
    border-radius: 16px;
    background: var(--meshy-grad-soft);
    border: 1px solid var(--meshy-border-hi);
    transition: transform .25s var(--meshy-ease), border-color .25s var(--meshy-ease), box-shadow .25s var(--meshy-ease);
    text-align: center;
}
.meshy-pack-card:hover {
    transform: translateY(-3px);
    border-color: var(--meshy-accent-2);
    box-shadow: 0 10px 30px -12px rgba(0,0,0,.35);
}
.meshy-pack-featured {
    border-color: var(--meshy-accent-2);
    box-shadow: 0 6px 24px -10px rgba(99,102,241,.4);
}
.meshy-pack-thumb { width: 96px; height: 96px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; }
.meshy-pack-thumb img.meshy-pack-img { max-width: 100%; max-height: 100%; height: auto; }
.meshy-pack-name { margin: 4px 0 0; font-size: 1.05rem; }
.meshy-pack-coins {
    font-weight: 700;
    color: #fbbf24;
    font-size: 1.15rem;
}
.meshy-pack-price { color: var(--meshy-text); font-weight: 600; }
.meshy-pack-price del { opacity: .55; margin-inline-end: 6px; font-weight: 400; }
.meshy-pack-buy { margin-top: 6px; align-self: stretch; }
.meshy-pack-subscription { border-color: var(--meshy-accent-2); }
.meshy-pack-badge {
    position: absolute; top: 10px; inset-inline-end: 10px;
    font-size: .7rem; font-weight: 700; letter-spacing: .02em;
    padding: 3px 8px; border-radius: 999px;
    background: var(--meshy-grad);
    color: #fff;
    text-transform: uppercase;
}

/* ---- Coupon ---- */
.meshy-coupon-section { margin: 24px auto; max-width: 420px; text-align: start; }
.meshy-coupon-section label { display: block; font-size: .9rem; color: var(--meshy-text-dim); margin-bottom: 8px; }
.meshy-coupon-row { display: flex; gap: 8px; }
.meshy-coupon-row input { flex: 1; min-width: 0; }

/* ---- Credits ---- */
.meshy-credits-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; margin: 24px 24px 0;
    border-radius: 999px;
    background: var(--meshy-grad-soft);
    border: 1px solid var(--meshy-border-hi);
    color: var(--meshy-text);
    font-weight: 600; font-size: .9rem;
}
.meshy-credits-icon { display: inline-grid; place-items: center; color: #fbbf24; }
.meshy-credits-icon svg { width: 16px; height: 16px; }

/* ---- Tabs ---- */
.meshy-tabs {
    display: flex; gap: 4px;
    padding: 24px 24px 0;
    border-bottom: 1px solid var(--meshy-border);
    flex-wrap: wrap;
}
.meshy-tab {
    appearance: none; background: transparent; border: 0;
    color: var(--meshy-text-dim); font: inherit; font-weight: 500;
    padding: 12px 18px;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    border-radius: 12px 12px 0 0;
    position: relative;
    transition: color .25s var(--meshy-ease), background .25s var(--meshy-ease);
}
.meshy-tab:hover { color: var(--meshy-text); background: var(--meshy-surface); }
.meshy-tab.active { color: var(--meshy-text); }
.meshy-tab.active::after {
    content: '';
    position: absolute; left: 12px; right: 12px; bottom: -1px;
    height: 2px; background: var(--meshy-grad); border-radius: 2px;
}
.meshy-tab-icon { display: inline-grid; place-items: center; }
.meshy-tab-icon svg { width: 18px; height: 18px; }

.meshy-tab-content { display: none; padding: 28px clamp(20px, 3vw, 36px) 36px; }
.meshy-tab-content.active { display: block; animation: meshy-fadein .4s var(--meshy-ease); }
@keyframes meshy-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Form ---- */
.meshy-form-section h3 { font-size: 1.2rem; margin-bottom: 4px; }
.meshy-form-desc { color: var(--meshy-text-dim); margin-bottom: 18px; font-size: .95rem; }

/* ---- Upload ---- */
.meshy-upload-area {
    position: relative;
    border: 2px dashed var(--meshy-border-hi);
    border-radius: var(--meshy-radius-lg);
    background: var(--meshy-surface);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .25s var(--meshy-ease), background .25s var(--meshy-ease), transform .25s var(--meshy-ease);
    margin-bottom: 22px;
    min-height: 220px;
    display: grid; place-items: center;
}
.meshy-upload-area:hover, .meshy-upload-area.dragover {
    border-color: var(--meshy-accent-2);
    background: var(--meshy-grad-soft);
}
.meshy-upload-area.dragover { transform: scale(1.01); }
.meshy-upload-placeholder {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    color: var(--meshy-text-dim);
}
.meshy-upload-icon {
    display: grid; place-items: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--meshy-grad); color: #fff;
    box-shadow: 0 8px 24px rgba(192,38,211,.35);
}
.meshy-upload-icon svg { width: 26px; height: 26px; }
.meshy-upload-placeholder p { color: var(--meshy-text); font-weight: 500; margin: 0; }
.meshy-upload-hint { font-size: .85rem; color: var(--meshy-text-mute); }
.meshy-image-preview {
    max-width: 100%; max-height: 320px;
    border-radius: var(--meshy-radius-md); object-fit: contain;
}

/* ---- Inputs ---- */
.meshy-text-input-wrapper { position: relative; margin-bottom: 22px; }
.meshy-ai-container textarea,
.meshy-ai-container input[type="text"] {
    width: 100%;
    background: var(--meshy-surface);
    border: 1px solid var(--meshy-border-hi);
    border-radius: var(--meshy-radius-md);
    color: var(--meshy-text);
    font: inherit;
    padding: 14px 16px;
    transition: border-color .2s var(--meshy-ease), background .2s var(--meshy-ease), box-shadow .2s var(--meshy-ease);
    resize: vertical;
}
.meshy-ai-container textarea::placeholder,
.meshy-ai-container input[type="text"]::placeholder { color: var(--meshy-text-mute); }
.meshy-ai-container textarea:focus,
.meshy-ai-container input[type="text"]:focus {
    outline: none;
    border-color: var(--meshy-accent-2);
    background: var(--meshy-surface-2);
    box-shadow: 0 0 0 4px rgba(236,72,153,.15);
}
.meshy-char-count {
    position: absolute; bottom: 8px; inset-inline-end: 12px;
    font-size: 12px; color: var(--meshy-text-mute);
    pointer-events: none;
}

/* ---- Buttons ---- */
.meshy-btn {
    appearance: none;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .95rem;
    cursor: pointer; text-decoration: none;
    transition: transform .2s var(--meshy-ease), box-shadow .25s var(--meshy-ease), background .25s var(--meshy-ease), border-color .25s var(--meshy-ease), opacity .2s var(--meshy-ease);
    line-height: 1.2; white-space: nowrap;
}
.meshy-btn:focus-visible { outline: 2px solid var(--meshy-accent-2); outline-offset: 3px; }
.meshy-btn:disabled { opacity: .55; cursor: not-allowed; }

.meshy-btn-primary {
    background: var(--meshy-grad);
    color: #fff;
    box-shadow: 0 10px 30px rgba(192,38,211,.35);
}
.meshy-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(192,38,211,.5);
}
.meshy-btn-secondary {
    background: var(--meshy-surface-2);
    color: var(--meshy-text);
    border-color: var(--meshy-border-hi);
}
.meshy-btn-secondary:hover:not(:disabled) {
    background: var(--meshy-surface);
    border-color: var(--meshy-accent-2);
    color: var(--meshy-text);
}
.meshy-btn-large { padding: 16px 32px; font-size: 1rem; }
.meshy-generate-btn { width: 100%; }

/* ---- Messages ---- */
.meshy-message {
    padding: 12px 14px;
    border-radius: var(--meshy-radius-sm);
    font-size: .9rem;
    margin-top: 10px;
    border: 1px solid var(--meshy-border);
    background: var(--meshy-surface);
}
.meshy-message.success { color: var(--meshy-success); border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.08); }
.meshy-message.error   { color: var(--meshy-error);   border-color: rgba(244,63,94,.4);  background: rgba(244,63,94,.08); }

/* ---- Processing ---- */
.meshy-processing-content { text-align: center; }
.meshy-spinner {
    width: 64px; height: 64px;
    margin: 0 auto 22px;
    border-radius: 50%;
    border: 4px solid var(--meshy-border);
    border-top-color: var(--meshy-accent-2);
    border-right-color: var(--meshy-accent-3);
    animation: meshy-spin 1s linear infinite;
}
@keyframes meshy-spin { to { transform: rotate(360deg); } }

.meshy-progress-bar-container {
    display: flex; align-items: center; gap: 12px;
    max-width: 420px; margin: 18px auto 12px;
}
.meshy-progress-bar {
    flex: 1; height: 10px;
    border-radius: 999px;
    background: var(--meshy-surface);
    border: 1px solid var(--meshy-border);
    overflow: hidden;
}
.meshy-progress-fill {
    height: 100%;
    background: var(--meshy-grad);
    border-radius: inherit;
    transition: width .4s var(--meshy-ease);
}
.meshy-progress-text { font-variant-numeric: tabular-nums; color: var(--meshy-text-dim); font-size: .9rem; }
.meshy-processing-note { color: var(--meshy-text-mute); font-size: .9rem; }

/* ---- Result ---- */
.meshy-result-content { text-align: center; }
.meshy-result-header {
    display: inline-flex; align-items: center; gap: 10px;
    margin-bottom: 18px;
}
.meshy-success-icon {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(16,185,129,.18);
    color: var(--meshy-success);
}
.meshy-success-icon svg { width: 22px; height: 22px; }

.meshy-result-preview {
    max-width: 420px; margin: 0 auto 24px;
    border-radius: var(--meshy-radius-lg);
    overflow: hidden;
    border: 1px solid var(--meshy-border-hi);
    background: var(--meshy-surface);
}
.meshy-result-preview img { width: 100%; height: auto; display: block; }

.meshy-download-section h4 { font-size: 1rem; color: var(--meshy-text-dim); margin-bottom: 12px; }
.meshy-download-buttons {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center; margin-bottom: 22px;
}

/* ---- Error ---- */
.meshy-error-content { text-align: center; }
.meshy-error-icon {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: rgba(244,63,94,.15);
    color: var(--meshy-error);
}
.meshy-error-icon svg { width: 30px; height: 30px; }

/* =====================================================================
   RTL
   ===================================================================== */
.meshy-rtl { direction: rtl; }

/* =====================================================================
   Responsive — gallery falls to 2 cols on tablet, 1 on phone
   ===================================================================== */
@media (max-width: 900px) {
    .meshy-gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
    .meshy-gallery-grid { grid-template-columns: 1fr; }
    .meshy-mode-card { padding: 18px; gap: 14px; }
    .meshy-mode-icon { flex-basis: 48px; width: 48px; height: 48px; }
    .meshy-mode-icon svg { width: 24px; height: 24px; }
    .meshy-coupon-row { flex-direction: column; }
    .meshy-tabs { padding: 16px 12px 0; }
    .meshy-tab { padding: 10px 12px; font-size: .9rem; }
    .meshy-theme-toggle { width: 38px; height: 38px; top: 12px; inset-inline-end: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .meshy-orb, .meshy-dot, .meshy-spinner { animation: none !important; }
    .meshy-mode-card, .meshy-char-card, .meshy-btn { transition: none !important; }
}

/* =========================================================
   Meshy Auth (login / register / combined)
   ========================================================= */
.meshy-auth { box-sizing: border-box; max-width: 460px; margin: 32px auto; padding: 0 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #1a1a1a; }
.meshy-auth *, .meshy-auth *::before, .meshy-auth *::after { box-sizing: border-box; }
.meshy-auth.meshy-rtl { direction: rtl; }

.meshy-auth-card { background: #fff; border: 1px solid #e6e8eb; border-radius: 14px; box-shadow: 0 8px 24px rgba(20, 24, 35, 0.06); padding: 28px; }

.meshy-auth-header { text-align: center; margin-bottom: 18px; }
.meshy-auth-title { margin: 0 0 6px; font-size: 22px; font-weight: 700; line-height: 1.2; }
.meshy-auth-subtitle { margin: 0; color: #6b7280; font-size: 14px; }

.meshy-auth-alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; line-height: 1.4; }
.meshy-auth-alert ul { margin: 0; padding-inline-start: 18px; }
.meshy-auth-alert-error { background: #fdecec; color: #a31515; border: 1px solid #f5c2c2; }
.meshy-auth-alert-success { background: #e8f7ee; color: #1f6f3a; border: 1px solid #b8e3c6; }

.meshy-auth-form { display: flex; flex-direction: column; gap: 14px; }
.meshy-field { display: flex; flex-direction: column; gap: 6px; }
.meshy-field label { font-size: 13px; font-weight: 600; color: #2c3138; }
.meshy-field label small { font-weight: 400; color: #8a8f98; margin-inline-start: 4px; }
.meshy-field input[type="text"], .meshy-field input[type="email"], .meshy-field input[type="password"] {
    width: 100%; padding: 11px 12px; font-size: 14px; line-height: 1.3; color: #1a1a1a;
    background: #fff; border: 1px solid #d6d9de; border-radius: 8px; transition: border-color .15s, box-shadow .15s;
}
.meshy-field input:focus { outline: none; border-color: #4b6bfb; box-shadow: 0 0 0 3px rgba(75,107,251,.18); }
.meshy-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.meshy-field-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.meshy-hint { color: #8a8f98; font-size: 12px; }
.meshy-req { color: #d33; margin-inline-start: 2px; }

.meshy-field-pass { position: relative; }
.meshy-field-pass input { padding-inline-end: 40px; }
.meshy-toggle-pass { position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%); background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 6px; color: #6b7280; }
.meshy-toggle-pass:hover { background: #f1f3f5; color: #1a1a1a; }

.meshy-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #2c3138; cursor: pointer; }
.meshy-check input { width: 16px; height: 16px; }

.meshy-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: background-color .15s, border-color .15s, transform .05s; }
.meshy-btn-block { width: 100%; }
.meshy-btn-primary { background: #4b6bfb; color: #fff; }
.meshy-btn-primary:hover { background: #3a59e8; }
.meshy-btn-primary:active { transform: translateY(1px); }
.meshy-btn-ghost { background: transparent; color: #2c3138; border-color: #d6d9de; }
.meshy-btn-ghost:hover { background: #f7f8fa; }

.meshy-auth-link { color: #4b6bfb; text-decoration: none; font-size: 13px; font-weight: 500; }
.meshy-auth-link:hover { text-decoration: underline; }

.meshy-auth-footer { text-align: center; margin: 14px 0 0; font-size: 14px; color: #6b7280; }
.meshy-auth-footer .meshy-auth-link { margin-inline-start: 4px; }
.meshy-auth-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.meshy-auth-logged-in { text-align: center; }

/* Tabs */
.meshy-tabs { display: flex; gap: 4px; background: #f1f3f5; padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.meshy-tab { flex: 1; appearance: none; background: transparent; border: 0; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #6b7280; cursor: pointer; transition: background-color .15s, color .15s; }
.meshy-tab:hover { color: #1a1a1a; }
.meshy-tab.is-active { background: #fff; color: #1a1a1a; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.meshy-tab-panel { display: none; }
.meshy-tab-panel.is-active { display: block; }

/* Responsive */
@media (max-width: 480px) {
    .meshy-auth { padding: 0 12px; }
    .meshy-auth-card { padding: 20px; border-radius: 12px; }
    .meshy-field-grid { grid-template-columns: 1fr; }
}

/* Dark theme via parent data attribute or prefers-color-scheme */
@media (prefers-color-scheme: dark) {
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-auth-card { background: #16181d; border-color: #2a2f38; color: #e6e8ec; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-auth-title { color: #f3f4f6; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-auth-subtitle,
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-auth-footer,
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-hint,
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-field label small { color: #9aa1ad; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-field label,
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-check { color: #d6d9de; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-field input { background: #1f232b; border-color: #2f3540; color: #e6e8ec; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-field input:focus { border-color: #6b86ff; box-shadow: 0 0 0 3px rgba(107,134,255,.25); }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-tabs { background: #1f232b; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-tab.is-active { background: #2a2f38; color: #f3f4f6; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-btn-ghost { color: #d6d9de; border-color: #2f3540; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-btn-ghost:hover { background: #1f232b; }
    .meshy-auth:not([data-meshy-theme="light"]) .meshy-toggle-pass:hover { background: #2a2f38; color: #f3f4f6; }
}
/* =========================================================
   Meshy Elementor: Auth icon widget
   ========================================================= */
.meshy-ai-auth-widget { display: flex; align-items: center; position: relative; }
.meshy-ai-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    appearance: none; background: transparent; border: 0;
    padding: 8px 12px; border-radius: 8px;
    color: inherit; font: inherit; line-height: 1;
    text-decoration: none; cursor: pointer;
    transition: background-color .15s, color .15s;
}
.meshy-ai-trigger:focus { outline: 2px solid rgba(75,107,251,.4); outline-offset: 2px; }
.meshy-ai-trigger .meshy-ai-icon { display: inline-block; width: 22px; height: 22px; line-height: 1; }
.meshy-ai-trigger svg { display: inline-block; }
.meshy-ai-trigger .meshy-ai-avatar { border-radius: 50%; }
.meshy-ai-trigger .meshy-ai-label { font-weight: 600; font-size: 14px; }
.meshy-ai-trigger .meshy-ai-caret { opacity: .7; transition: transform .15s; }
.meshy-ai-toggle[aria-expanded="true"] .meshy-ai-caret { transform: rotate(180deg); }

.meshy-ai-dropdown {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
    min-width: 200px;
    background: #fff; color: #1a1a1a;
    border: 1px solid #e6e8eb; border-radius: 10px;
    box-shadow: 0 10px 30px rgba(20,24,35,.12);
    padding: 6px; z-index: 9999;
    opacity: 0; transform: translateY(-6px) scale(.98);
    transition: opacity .12s ease, transform .12s ease;
}
.meshy-ai-dropdown.is-open { opacity: 1; transform: translateY(0) scale(1); }
.meshy-ai-dropdown[hidden] { display: none; }

.meshy-ai-dropdown a {
    display: block; padding: 9px 12px; border-radius: 6px;
    font-size: 14px; text-decoration: none; color: inherit;
    transition: background-color .12s;
}
.meshy-ai-dropdown a:hover,
.meshy-ai-dropdown a:focus { background: #f3f4f6; outline: 0; }
.meshy-ai-dropdown-logout { color: #b42318 !important; border-top: 1px solid #eef0f3; margin-top: 4px; padding-top: 10px !important; }

.meshy-ai-dropdown-head {
    padding: 10px 12px 8px; border-bottom: 1px solid #eef0f3; margin-bottom: 4px;
    display: flex; flex-direction: column; gap: 2px;
}
.meshy-ai-greet { font-size: 13px; font-weight: 600; }
.meshy-ai-email { font-size: 12px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; }

/* RTL: keep dropdown anchored to start edge of trigger */
[dir="rtl"] .meshy-ai-dropdown,
.rtl .meshy-ai-dropdown { inset-inline-end: auto; inset-inline-start: 0; }

@media (prefers-color-scheme: dark) {
    .meshy-ai-dropdown { background: #16181d; color: #e6e8ec; border-color: #2a2f38; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
    .meshy-ai-dropdown a:hover, .meshy-ai-dropdown a:focus { background: #1f232b; }
    .meshy-ai-dropdown-head { border-bottom-color: #2a2f38; }
    .meshy-ai-email { color: #9aa1ad; }
    .meshy-ai-dropdown-logout { border-top-color: #2a2f38; color: #ff8b80 !important; }
}