.aimsg-tool { --aimsg-radius: 22px; --aimsg-border: #ece7df; --aimsg-orange: #ff7a1a; --aimsg-soft: #fff7ed; max-width: 1120px; margin: 28px auto; font-family: inherit; }
.aimsg-tool * { box-sizing: border-box; }
.aimsg-tool-header { display: flex; align-items: center; gap: 16px; padding: 22px; background: linear-gradient(135deg, #fff7ed, #fff); border: 1px solid var(--aimsg-border); border-radius: var(--aimsg-radius); margin-bottom: 18px; }
.aimsg-tool-icon { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; background: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.07); flex: 0 0 auto; }
.aimsg-tool-header h2 { margin: 0 0 4px; font-size: clamp(24px, 3vw, 36px); }
.aimsg-tool-header p { margin: 0; color: #695f55; }
.aimsg-generator-card, .aimsg-editor-wrap { background: #fff; border: 1px solid var(--aimsg-border); border-radius: var(--aimsg-radius); padding: 22px; margin-bottom: 18px; box-shadow: 0 10px 35px rgba(0,0,0,.04); }
.aimsg-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.aimsg-form-grid-secondary { grid-template-columns: minmax(180px, 260px) 1fr; margin-top: 14px; }
.aimsg-details-label { grid-column: auto; }
.aimsg-tool label { font-weight: 700; font-size: 14px; color: #342f2a; }
.aimsg-optional { font-weight: 500; color: #8b8178; font-size: 12px; }
.aimsg-tool input, .aimsg-tool select, .aimsg-tool textarea { width: 100%; margin-top: 7px; border: 1px solid #ded7ce; border-radius: 12px; padding: 12px 13px; font: inherit; background: #fff; }
.aimsg-tool textarea { resize: vertical; }
.aimsg-generator-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.aimsg-primary-btn, .aimsg-download-btn, .aimsg-secondary-btn { border: 0; border-radius: 999px; padding: 13px 22px; font-weight: 800; cursor: pointer; }
.aimsg-primary-btn, .aimsg-download-btn { background: var(--aimsg-orange); color: #fff; box-shadow: 0 10px 22px rgba(255,122,26,.25); }
.aimsg-secondary-btn { background: #fff4e8; color: #8a4100; border: 1px solid #ffd6b4; }
.aimsg-primary-btn[disabled], .aimsg-secondary-btn[disabled] { opacity: .65; cursor: wait; }
.aimsg-status { margin-top: 12px; min-height: 22px; color: #7a4a16; font-weight: 700; }
.aimsg-loading-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; background: var(--aimsg-orange); animation: aimsgPulse 1s infinite ease-in-out; margin-right: 6px; }
@keyframes aimsgPulse { 0%, 100% { transform: scale(.75); opacity: .45; } 50% { transform: scale(1.1); opacity: 1; } }
.aimsg-results { margin-top: 18px; display: grid; gap: 12px; }
.aimsg-result-card { position: relative; width: 100%; border: 1px solid #f0e2d4; border-radius: 18px; padding: 16px 16px 14px 52px; background: #fffaf5; cursor: pointer; line-height: 1.5; transition: .18s ease; }
.aimsg-result-card:hover, .aimsg-result-card.is-selected { border-color: #ffb06f; background: #fff4e8; transform: translateY(-1px); }
.aimsg-result-number { position: absolute; top: 16px; left: 16px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 999px; background: #fff; color: #a64d00; font-size: 12px; font-weight: 900; border: 1px solid #ffd7b7; }
.aimsg-result-text { margin: 0; color: #2f2924; }
.aimsg-result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.aimsg-small-btn { border: 1px solid #ead2bd; background: #fff; color: #5a3520; border-radius: 999px; padding: 8px 12px; font-weight: 800; cursor: pointer; font-size: 13px; }
.aimsg-small-btn:hover { border-color: #ff9a45; }
.aimsg-error { color: #b42318; background: #fff1f0; border: 1px solid #ffd0cc; border-radius: 12px; padding: 12px; }
.aimsg-ad-slot { margin: 18px 0; text-align: center; }
.aimsg-status-good { color: #10803f; font-weight: 800; }
.aimsg-status-bad { color: #b42318; font-weight: 800; }
@media (max-width: 900px) { .aimsg-form-grid, .aimsg-form-grid-secondary { grid-template-columns: 1fr; } .aimsg-tool-header { align-items: flex-start; } .aimsg-result-card { padding-left: 16px; } .aimsg-result-number { position: static; margin-bottom: 8px; } }

.aimsg-ad-slot { margin: 20px auto; text-align: center; max-width: 100%; overflow: hidden; }
.aimsg-ad-slot:empty { display: none; }
.aimsg-ad-mobile-sticky { display: none; }
@media (max-width: 768px) {
    .aimsg-ad-mobile-sticky.aimsg-mobile-sticky-shell {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 99999;
        margin: 0;
        padding: 6px 8px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 -6px 22px rgba(0,0,0,.10);
    }
}


/* Premium marketplace-style frontend UI v1.2.0 */
.aimsg-premium-studio {
    --aimsg-ink: #101828;
    --aimsg-muted: #667085;
    --aimsg-line: rgba(16, 24, 40, .10);
    --aimsg-card: rgba(255,255,255,.92);
    --aimsg-studio-bg: #fff;
    --aimsg-brand: #ff6b2c;
    --aimsg-brand-dark: #d9480f;
    --aimsg-brand-soft: #fff4ed;
    --aimsg-purple: #7c3aed;
    --aimsg-shadow: 0 24px 70px rgba(16, 24, 40, .10);
    --aimsg-soft-shadow: 0 14px 40px rgba(16, 24, 40, .07);
    max-width: 1180px;
    padding: clamp(12px, 2vw, 22px);
    border-radius: 34px;
    background:
        radial-gradient(circle at 8% 2%, rgba(255, 107, 44, .13), transparent 30%),
        radial-gradient(circle at 96% 0%, rgba(124, 58, 237, .10), transparent 34%),
        linear-gradient(180deg, #ffffff, #fffaf6);
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 30px 90px rgba(16,24,40,.08);
}

.aimsg-premium-studio .aimsg-tool-header {
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding: clamp(20px, 3vw, 30px);
    border-radius: 30px;
    background:
        linear-gradient(135deg, rgba(17,24,39,.96), rgba(77,43,29,.92)),
        radial-gradient(circle at 24% 0%, rgba(255,107,44,.35), transparent 30%);
    color: #fff;
    border: 1px solid rgba(255,255,255,.16);
    box-shadow: var(--aimsg-shadow);
    overflow: hidden;
    position: relative;
}

.aimsg-premium-studio .aimsg-tool-header:before {
    content: "";
    position: absolute;
    inset: -40% -20% auto auto;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%);
    pointer-events: none;
}

.aimsg-tool-header-main {
    display: flex;
    gap: 16px;
    align-items: center;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.aimsg-premium-studio .aimsg-tool-icon {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.22);
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 35px rgba(0,0,0,.18);
}

.aimsg-studio-eyebrow,
.aimsg-panel-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    color: #ffd9c7;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.aimsg-premium-studio .aimsg-tool-header h2 {
    color: #fff;
    letter-spacing: -.04em;
    line-height: 1.02;
}

.aimsg-premium-studio .aimsg-tool-header p {
    color: rgba(255,255,255,.78);
    max-width: 680px;
}

.aimsg-flow-steps {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(96px, 1fr));
    gap: 8px;
    min-width: min(380px, 100%);
    align-self: center;
}

.aimsg-flow-steps span {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
    color: rgba(255,255,255,.88);
    font-size: 12px;
    font-weight: 800;
    backdrop-filter: blur(8px);
}

.aimsg-flow-steps strong {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    color: var(--aimsg-brand-dark);
    font-size: 12px;
}

.aimsg-premium-studio .aimsg-generator-card,
.aimsg-premium-studio .aimsg-editor-wrap {
    border-radius: 30px;
    border: 1px solid rgba(16,24,40,.08);
    background: rgba(255,255,255,.92);
    box-shadow: var(--aimsg-soft-shadow);
    backdrop-filter: blur(14px);
}

.aimsg-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(16,24,40,.08);
}

.aimsg-card-heading h3 {
    margin: 0 0 6px;
    font-size: clamp(21px, 2.5vw, 28px);
    letter-spacing: -.03em;
    color: var(--aimsg-ink);
}

.aimsg-card-heading p {
    margin: 0;
    color: var(--aimsg-muted);
    line-height: 1.55;
}

.aimsg-category-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 9px 13px;
    background: linear-gradient(135deg, #fff4ed, #fff);
    border: 1px solid rgba(255,107,44,.18);
    color: #9a3412;
    font-weight: 900;
    font-size: 12px;
    box-shadow: 0 10px 24px rgba(255,107,44,.08);
}

.aimsg-premium-studio .aimsg-form-grid {
    gap: 14px;
}

.aimsg-premium-studio label {
    color: #344054;
    font-size: 13px;
    font-weight: 850;
}

.aimsg-premium-studio input,
.aimsg-premium-studio select,
.aimsg-premium-studio textarea {
    min-height: 46px;
    border-radius: 16px;
    border: 1px solid rgba(16,24,40,.12);
    background: #fff;
    box-shadow: 0 1px 0 rgba(16,24,40,.02);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.aimsg-premium-studio input:focus,
.aimsg-premium-studio select:focus,
.aimsg-premium-studio textarea:focus {
    outline: none;
    border-color: rgba(255,107,44,.72);
    box-shadow: 0 0 0 4px rgba(255,107,44,.12);
}

.aimsg-generator-actions {
    padding-top: 4px;
}

.aimsg-premium-studio .aimsg-primary-btn,
.aimsg-premium-studio .aimsg-secondary-btn,
.aimsg-premium-studio .aimsg-small-btn {
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.aimsg-premium-studio .aimsg-primary-btn,
.aimsg-premium-studio .aimsg-download-btn {
    background: linear-gradient(135deg, #ff7a1a, #f43f5e);
    color: #fff;
    box-shadow: 0 16px 32px rgba(244,63,94,.22);
}

.aimsg-premium-studio .aimsg-secondary-btn {
    background: #fff;
    color: #9a3412;
    border: 1px solid rgba(255,107,44,.22);
}

.aimsg-premium-studio .aimsg-primary-btn:hover,
.aimsg-premium-studio .aimsg-secondary-btn:hover,
.aimsg-premium-studio .aimsg-small-btn:hover,
.aimsg-premium-studio .aimsg-download-btn:hover {
    transform: translateY(-1px);
}

.aimsg-status {
    border-radius: 16px;
}

.aimsg-premium-studio.aimsg-is-loading .aimsg-generator-card {
    position: relative;
    overflow: hidden;
}

.aimsg-premium-studio.aimsg-is-loading .aimsg-generator-card:after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.42), transparent);
    transform: translateX(-100%);
    animation: aimsgStudioShimmer 1.2s infinite;
    pointer-events: none;
}

@keyframes aimsgStudioShimmer {
    to { transform: translateX(100%); }
}

.aimsg-loading-dot {
    box-shadow: 0 0 0 6px rgba(255,107,44,.14);
}

.aimsg-results {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
}

.aimsg-empty-state {
    grid-column: 1 / -1;
    display: grid;
    gap: 4px;
    padding: 18px;
    border-radius: 22px;
    border: 1px dashed rgba(255,107,44,.28);
    background: linear-gradient(135deg, #fffaf7, #ffffff);
    color: #475467;
}

.aimsg-empty-state strong {
    color: var(--aimsg-ink);
}

.aimsg-result-card {
    min-height: 176px;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    border: 1px solid rgba(16,24,40,.08);
    background:
        radial-gradient(circle at 0% 0%, rgba(255,107,44,.10), transparent 34%),
        linear-gradient(180deg, #fff, #fffaf7);
    box-shadow: 0 14px 32px rgba(16,24,40,.06);
    padding: 18px 18px 16px;
    overflow: hidden;
}

.aimsg-result-card:before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, #ff7a1a, #f43f5e, #7c3aed);
    opacity: 0;
    transition: opacity .16s ease;
}

.aimsg-result-card:hover,
.aimsg-result-card.is-selected {
    border-color: rgba(255,107,44,.45);
    background: #fff;
    box-shadow: 0 20px 45px rgba(16,24,40,.10);
}

.aimsg-result-card:hover:before,
.aimsg-result-card.is-selected:before {
    opacity: 1;
}

.aimsg-result-number {
    position: static;
    width: 30px;
    height: 30px;
    margin-bottom: 12px;
    background: #fff4ed;
    color: #c2410c;
    border-color: rgba(255,107,44,.22);
}

.aimsg-result-text {
    flex: 1;
    font-size: 15px;
    color: #1d2939;
}

.aimsg-result-actions {
    margin-top: 16px;
}

.aimsg-small-btn {
    background: #fff;
    border: 1px solid rgba(16,24,40,.10);
    color: #344054;
}

.aimsg-use-message {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.aimsg-error {
    border-radius: 18px;
    border-color: rgba(180,35,24,.22);
    background: linear-gradient(135deg, #fff1f0, #fff);
    color: #b42318;
    font-weight: 750;
}

.aimsg-ad-slot:empty,
.aimsg-ad-slot:not(:has(*)) {
    display: none;
}

@media (max-width: 900px) {
    .aimsg-premium-studio {
        margin: 12px auto;
        padding: 10px;
        border-radius: 24px;
    }
    .aimsg-premium-studio .aimsg-tool-header {
        flex-direction: column;
        border-radius: 24px;
    }
    .aimsg-flow-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
        width: 100%;
    }
    .aimsg-card-heading {
        flex-direction: column;
    }
    .aimsg-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .aimsg-tool-header-main {
        align-items: flex-start;
    }
    .aimsg-premium-studio .aimsg-tool-icon {
        width: 52px;
        height: 52px;
        border-radius: 18px;
    }
    .aimsg-flow-steps span {
        padding: 8px 9px;
        font-size: 11px;
    }
    .aimsg-premium-studio .aimsg-generator-card,
    .aimsg-premium-studio .aimsg-editor-wrap {
        padding: 16px;
        border-radius: 24px;
    }
}


.aimsg-skeleton-card {
    min-height: 176px;
    border-radius: 24px;
    background: linear-gradient(180deg, #fff, #fffaf7);
    border: 1px solid rgba(16,24,40,.08);
    box-shadow: 0 14px 32px rgba(16,24,40,.06);
    padding: 18px;
    overflow: hidden;
    position: relative;
}

.aimsg-skeleton-card:before {
    content:"";
    position:absolute;
    inset:0;
    background:linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
    animation: aimsgStudioShimmer 1.1s infinite;
}

.aimsg-skeleton-card span,
.aimsg-skeleton-card em,
.aimsg-skeleton-card b {
    display:block;
    border-radius:999px;
    background:#f2f4f7;
    position:relative;
    z-index:1;
}

.aimsg-skeleton-card span {
    width:34px;
    height:34px;
    margin-bottom:18px;
}

.aimsg-skeleton-card em {
    height:12px;
    width:86%;
    margin:11px 0;
}

.aimsg-skeleton-card em + em {
    width:62%;
}

.aimsg-skeleton-card b {
    width:128px;
    height:34px;
    margin-top:22px;
}
