[x-cloak] { display: none !important; }

/* ── 1. Design Tokens ────────────────────────────────────────── */
/*  OxieAI — Premium minimalist cinematic dark mode.                 */
/*  Single graphite background, restrained accent, hairline borders. */
:root {
    /* Background — deep, near-black graphite. No purple wash. */
    --bg-0: #0A0A0A;     /* page base */
    --bg-1: #121212;     /* surface elevation 1 */

    /* Text — pure white headings, soft gray body, restrained mutes */
    --ink:      #FFFFFF;                   /* headings, on-emphasis copy */
    --ink-dim:  #F4F4F5;                   /* near-white body */
    --ink-2:    #E4E4E7;                   /* secondary body */
    --ink-3:    #A1A1AA;                   /* primary muted (per brief) */
    --muted:    #A1A1AA;
    --muted-2:  #71717A;
    --muted-3:  #52525B;

    /* Surfaces — translucent overlays on the graphite base, hairline edges */
    --line:        rgba(255, 255, 255, 0.08);  /* per brief: very subtle */
    --line-hover:  rgba(255, 255, 255, 0.14);
    --line-focus:  rgba(255, 255, 255, 0.22);
    --card:        rgba(255, 255, 255, 0.03);
    --card-alt:    rgba(255, 255, 255, 0.02);
    --surface-1:   rgba(255, 255, 255, 0.025);
    --surface-2:   rgba(255, 255, 255, 0.04);

    /* Accent — single premium neon-blue. Reserved for primary CTAs
       and active states only. Used sparingly. */
    --accent:        #4F8DFF;
    --accent-hover:  #6BA1FF;
    --accent-soft:   rgba(79, 141, 255, 0.12);
    --accent-ring:   rgba(79, 141, 255, 0.35);
    --accent-fg:     #0A0A0A;              /* text on accent fills */

    --glow:  rgba(79, 141, 255, 0.10);     /* now extremely subtle */
    --gold:  rgba(79, 141, 255, 0.06);     /* legacy var: same family */

    /* Semantic — toned-down, no over-saturation */
    --success:        #34D399;
    --success-bg:     rgba(52, 211, 153, 0.10);
    --success-border: rgba(52, 211, 153, 0.30);
    --danger:         #F87171;
    --danger-bg:      rgba(248, 113, 113, 0.10);
    --danger-border:  rgba(248, 113, 113, 0.30);
    --info-bg:        rgba(255, 255, 255, 0.04);
    --info-border:    rgba(255, 255, 255, 0.08);

    /* Brand — primary CTA token aliases the accent */
    --primary:        #4F8DFF;
    --primary-hover:  #6BA1FF;
    --primary-fg:     #0A0A0A;

    /* Gradients — kept far more restrained. The brand gradient is
       now a near-monochrome accent wash; the headline gradient is
       white-to-soft-blue for cinematic legibility. */
    --gradient-brand: linear-gradient(90deg, #4F8DFF 0%, #6BA1FF 100%);
    --gradient-text:  linear-gradient(90deg, #FFFFFF 0%, #FFFFFF 55%, #C7D7F5 100%);

    /* Spacing (4px base) */
    --sp-1:  0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;  --sp-4: 1rem;
    --sp-5:  1.25rem;  --sp-6: 1.5rem;   --sp-8: 2rem;     --sp-10: 2.5rem;  --sp-12: 3rem;

    /* Radii */
    --radius-sm:   0.5rem;
    --radius-md:   0.75rem;
    --radius-lg:   1rem;
    --radius-xl:   1.25rem;
    --radius-2xl:  1.5rem;
    --radius-3xl:  1.75rem;
    --radius-full: 9999px;

    /* Typography — Inter primary per brief, Manrope fallback for
       any locales/views where Inter doesn't load. Headline serif
       retained for the wordmark only. */
    --font-sans:  Inter, "Inter Variable", "SF Pro Text", "SF Pro Display", Manrope, system-ui, -apple-system, sans-serif;
    --font-serif: "DM Serif Display", ui-serif, Georgia, serif;
    --text-xs:    0.75rem;  --text-sm: 0.875rem; --text-base: 1rem;
    --text-lg:    1.125rem; --text-xl: 1.25rem;  --text-2xl:  1.5rem;
    --text-3xl:   1.875rem;

    /* Shadows — minimal. We rely on hairline borders and contrast,
       not heavy drop shadows, to define elevation. */
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md:   0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg:   0 16px 48px rgba(0, 0, 0, 0.45);
    --shadow-xl:   0 24px 64px rgba(0, 0, 0, 0.50);
    --shadow-glow: 0 0 0 1px rgba(79, 141, 255, 0.18), 0 8px 24px rgba(79, 141, 255, 0.18);

    /* Transitions */
    --tr-fast: 150ms;
    --tr:      200ms;
    --tr-slow: 250ms;
}

/* ── 2. Base ─────────────────────────────────────────────────── */
body.studio-body {
    font-family: var(--font-sans);
    background-color: var(--bg-0);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* ── 3. Backdrop layers ──────────────────────────────────────── */
/*  Minimal cinematic backdrop: flat graphite with one ultra-subtle
    top-center accent wash. No competing color radials — images stay
    the visual hero. */
.studio-bg-layer {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(1200px 600px at 50% -10%, var(--glow), transparent 70%),
        var(--bg-0);
}

.studio-vignette::after {
    content: "";
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background: radial-gradient(ellipse at 50% 0%, transparent 55%, rgba(0, 0, 0, 0.40) 100%);
    opacity: 0.5;
}

/* ── 4. Typography helpers ───────────────────────────────────── */
/*  Brand wordmark uses the same clean sans-serif as the rest of the
    UI (per brief). Slight letter-spacing tightening for a refined
    SaaS feel comparable to Linear / Stripe. */
.studio-brand {
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.studio-gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding-bottom: 0.15em;
    letter-spacing: -0.02em;
}

/* ── 5. Header & Layout Primitives ───────────────────────────── */
/*  Sticky glassmorphic header per brief. Hairline bottom edge,
    pronounced backdrop blur, near-opaque graphite base. */
.studio-header {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.72);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.studio-panel {
    position: relative;
    border-radius: var(--radius-3xl);
    border: 1px solid var(--line);
}

/*  Studio surface — a flat graphite card with a hairline edge.
    No multi-color radials competing with imagery. The slider/gallery
    is the hero; this is the frame. */
.studio-surface {
    position: relative;
    border-radius: inherit;
    border: 1px solid var(--line);
    background: var(--surface-2);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.studio-surface:hover {
    border-color: var(--line-hover);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ══════════════════════════════════════════════════════════════
 * 6. DESIGN-SYSTEM COMPONENTS  (use these across all views)
 * ══════════════════════════════════════════════════════════════ */

/* ── 6.1 Panels & Cards ──────────────────────────────────────── */
:where(.ds-panel) {
    border-radius: var(--radius-3xl);
    border: 1px solid var(--line);
    background: var(--surface-1);
    padding: var(--sp-8);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(16px);
}

:where(.ds-panel-lg) { padding: var(--sp-10); }
:where(.ds-panel-sm) { padding: var(--sp-6); }

:where(.ds-card) {
    border-radius: var(--radius-2xl);
    border: 1px solid var(--line);
    background: var(--card);
    padding: var(--sp-4);
    transition: border-color var(--tr), background-color var(--tr);
}
:where(.ds-card-dark) {
    border-radius: var(--radius-3xl);
    border: 1px solid var(--line);
    background: var(--surface-2);
    padding: var(--sp-4);
}

:where(.ds-card-dashed) {
    border-radius: var(--radius-3xl);
    border: 1px dashed var(--line);
    background: rgba(0, 0, 0, 0.20);
    padding: var(--sp-10);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--muted-2);
}

/* ── 6.2 Form Inputs (unified) ───────────────────────────────── */
.ds-input {
    width: 100%;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--line);
    background: var(--card);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    color: var(--ink-dim);
    outline: none;
    transition: border-color var(--tr), box-shadow var(--tr);
    font-family: inherit;
}

.ds-input::placeholder { color: var(--muted-2); }

.ds-input:focus,
.ds-input:focus-visible {
    border-color: var(--line-focus);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.20);
}

.ds-input:disabled { opacity: 0.55; cursor: not-allowed; }

.ds-input-sm   { padding: 0.625rem var(--sp-4); }
.ds-input-dark { background: var(--surface-2); }

.ds-input-search {
    border-radius: var(--radius-full);
    padding: var(--sp-3) var(--sp-4) var(--sp-3) 2.5rem;
}

textarea.ds-input { resize: vertical; min-height: 6rem; }

.ds-hint  { font-size: var(--text-xs); color: var(--muted-2); margin-top: var(--sp-1); }
/* ── Accent hint box (brand-colored) ──────────────────────── */
.ds-hint-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(79, 141, 255, 0.20);
    background: rgba(79, 141, 255, 0.08);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    color: #FFFFFF;
}
.ds-hint-brand svg,
.ds-hint-brand .lucide {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: #6BA1FF;
}


/* ── 6.3 Buttons (unified) ───────────────────────────────────── */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: filter var(--tr), transform var(--tr-fast),
                background var(--tr), border-color var(--tr), box-shadow var(--tr);
    white-space: nowrap;
}
.ds-btn:disabled,
.ds-btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.ds-btn svg, .ds-btn i { width: 16px; height: 16px; flex-shrink: 0; }

.ds-btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    box-shadow: var(--shadow-glow);
    letter-spacing: 0.01em;
}
.ds-btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(79, 141, 255, 0.32), 0 12px 32px rgba(79, 141, 255, 0.28);
}
.ds-btn-primary:active { transform: translateY(0); }
.ds-btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-glow);
}

.ds-btn-solid {
    background: var(--primary);
    color: var(--primary-fg);
    box-shadow: var(--shadow-sm);
}
.ds-btn-solid:hover { background: var(--primary-hover); box-shadow: var(--shadow-md); }

.ds-btn-ghost {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink-dim);
}
.ds-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line-hover);
    color: var(--ink);
}

.ds-btn-chip {
    padding: 0.375rem 0.875rem;
    font-size: var(--text-xs);
    font-weight: 500;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-2);
    border-radius: var(--radius-full);
    display: inline-flex; align-items: center; gap: var(--sp-2);
    transition: border-color var(--tr), background var(--tr);
    cursor: pointer;
    text-decoration: none;
}
.ds-btn-chip:hover { border-color: var(--line-hover); background: rgba(255, 255, 255, 0.05); }
.ds-btn-chip.is-active {
    border-color: var(--accent-ring);
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.ds-btn-sm    { padding: 0.55rem 1.1rem; font-size: var(--text-xs); }
.ds-btn-xs    { padding: 0.375rem 0.75rem; font-size: var(--text-xs); }
.ds-btn-lg    { padding: 0.85rem 1.75rem; font-size: var(--text-base); }
.ds-btn-block { width: 100%; }

.ds-btn-danger:hover { background: rgba(244, 63, 94, 0.25); border-color: rgba(244, 63, 94, 0.55); }

.ds-btn-success:hover { background: rgba(16, 185, 129, 0.25); border-color: rgba(16, 185, 129, 0.55); }

.ds-btn-icon:hover { border-color: var(--line-hover); background: rgba(255, 255, 255, 0.10); }

/* ── 6.4 Badges & Tags ───────────────────────────────────────── */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-3);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.studio-chip {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
}

.studio-icon-bubble {
    display: inline-flex;
    align-items: center; justify-content: center;
    height: 42px; width: 42px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: var(--card);
}

/* ── 6.5 Alerts (unified) ────────────────────────────────────── */
.alert-error,
.alert-success,
.alert-info {
    border-radius: var(--radius-2xl);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    border-width: 1px;
    border-style: solid;
}
.alert-error   { border-color: var(--danger-border);  background: var(--danger-bg);  color: #ffe4e6; }
.alert-success { border-color: var(--success-border); background: var(--success-bg); color: #d1fae5; }
.alert-info    { border-color: var(--info-border);    background: var(--info-bg);    color: var(--ink-dim); }

/* ── 6.7 Legacy aliases ──────────────────────────────────────── */
.studio-input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-2xl);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    color: var(--ink);
    outline: none;
    transition: border-color var(--tr), box-shadow var(--tr);
}
.studio-input:focus {
    border-color: var(--line-focus);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10);
}

.form-input:focus {
    border-color: var(--line-focus);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.10);
}

.studio-btn {
    position: relative; overflow: hidden;
    background: var(--accent);
    color: #FFFFFF;
    box-shadow: var(--shadow-glow);
    transition: background var(--tr), transform var(--tr-fast), box-shadow var(--tr);
}
.studio-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(79, 141, 255, 0.32), 0 12px 32px rgba(79, 141, 255, 0.28); }
.studio-btn:active { transform: translateY(0); }

.studio-btn-ghost {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink-dim);
    transition: background var(--tr), border-color var(--tr), color var(--tr);
}
.studio-btn-ghost:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line-hover); color: var(--ink); }

/* ── 7. Preview / Before-After Slider ────────────────────────── */
.preview-btn {
    font-size: 14px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    transition: var(--tr-slow);
}
.preview-btn:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.preview-btn.active {
    background: rgba(79, 141, 255, 0.10);
    color: #FFFFFF;
    border: 1px solid rgba(79, 141, 255, 0.35);
    box-shadow: 0 0 12px rgba(79, 141, 255, 0.25);
}

/* ── 8. Custom Styles Page (btn-purple) ──────────────────────── */
.btn-purple {
    background: linear-gradient(135deg, #4F8DFF 0%, #3B7DFF 50%, #2C6FE8 100%);
    border: 1px solid rgba(79, 141, 255, 0.3);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(79, 141, 255, 0.4);
    transition: box-shadow var(--tr), transform var(--tr-fast), background var(--tr);
}
.btn-purple:hover {
    background: linear-gradient(135deg, #6BA1FF 0%, #4F8DFF 50%, #3B7DFF 100%);
    box-shadow: 0 0 18px rgba(79, 141, 255, 0.5), 0 4px 16px rgba(79, 141, 255, 0.5);
    transform: translateY(-1px);
    border-color: rgba(79, 141, 255, 0.4);
}
.btn-purple:active { transform: translateY(0); box-shadow: 0 0 8px rgba(79, 141, 255, 0.3); }

/* ── 9. Favorite cards ───────────────────────────────────────── */
.fav-style-card {
    position: relative; overflow: hidden; display: block;
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0, 0, 0, 0.4);
    background-size: cover;
    background-position: center;
    transition: border-color var(--tr);
}
.fav-style-card:hover { border-color: var(--line-hover); }
.fav-style-card .aspect-box { aspect-ratio: 3/4; }

.fav-style-card .overlay {
    position: absolute; inset: 0;
    border-radius: var(--radius-2xl);
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
    transition: background var(--tr);
}
.fav-style-card:hover .overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.25) 55%, transparent 100%);
}

.fav-style-card .card-body {
    pointer-events: none;
    position: absolute; inset: 0;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: var(--sp-5);
    color: var(--ink-dim);
    gap: var(--sp-3);
}

.fav-style-card .accent-bar {
    position: absolute; inset-inline: 0; bottom: 0; height: 4px; opacity: 0.8;
}

.fav-corner-btn {
    position: absolute; top: 0.75rem; right: 0.75rem; z-index: 10;
    display: flex; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(79, 141, 255, 0.35);
    color: #FFFFFF; cursor: pointer;
    transition: background var(--tr), box-shadow var(--tr), transform var(--tr-fast), border-color var(--tr);
}
.fav-corner-btn:hover {
    background: rgba(79, 141, 255, 0.35);
    box-shadow: 0 0 12px rgba(79, 141, 255, 0.4);
    border-color: rgba(79, 141, 255, 0.55);
    transform: scale(1.1);
}

/* ── Favorite heart icon (filled state) ─────────────────────── */
.favorite-btn svg.fill-rose-400,
.favorite-btn svg.fill-rose-400 path {
    fill: #fb7185 !important;
    stroke: #fb7185 !important;
}
/* ── Lucide filled icons (generic) ──────────────────────────── */
svg[class*="fill-rose"] path { fill: inherit; }

/* ── 10. Ribbon ──────────────────────────────────────────────── */
/*  A clean horizontal "POPULAR" badge in the top-right of the card,
    using the accent color. Replaces the old rotated ribbon for a
    more refined SaaS look. */
.studio-ribbon {
    position: absolute; top: 1.25rem; right: 1.25rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--accent-ring);
    background: var(--accent-soft);
    color: #FFFFFF;
    font-size: 0.65rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ── 11. Animations ──────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
    .studio-float { animation: studioFloat 7s ease-in-out infinite; }
    @keyframes studioFloat {
        0%, 100% { transform: translateY(0); }
        50%      { transform: translateY(-8px); }
    }
}

/* ── 12. Utilities ───────────────────────────────────────────── */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.is-hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════
 * 12b. Generation Overlay
 * ══════════════════════════════════════════════════════════════ */
.gen-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 7, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.3s ease;
}
.gen-overlay.is-hidden {
    display: none !important;
}
.gen-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-6);
    text-align: center;
    padding: var(--sp-6);
}
.gen-overlay-spinner {
    width: 5rem;
    height: 5rem;
    color: #6BA1FF;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.gen-overlay-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: #fff;
}
.gen-overlay-sub {
    font-size: var(--text-sm);
    color: var(--muted-2);
}

/* ══════════════════════════════════════════════════════════════
 * 13. Result Page
 * ══════════════════════════════════════════════════════════════ */
.result-page { padding: var(--sp-8) 0 var(--sp-12); }
.result-container { max-width: 72rem; margin: 0 auto; padding: 0 var(--sp-6); }

.result-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--sp-5); flex-wrap: wrap;
    margin-bottom: var(--sp-8);
}
.result-header-title {
    font-family: var(--font-sans);
    font-size: var(--text-3xl); font-weight: 700;
    color: var(--ink); letter-spacing: -0.3px; line-height: 1.2;
}
.result-header-title span {
    background: var(--gradient-text);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.result-header-sub {
    margin-top: var(--sp-3);
    display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
}
.result-header-actions { display: flex; gap: var(--sp-3); align-items: center; }

.result-tag {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs); font-weight: 600;
}
.result-tag-muted   { background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.result-tag-brand   { background: rgba(79, 141, 255, 0.10); color: #FFFFFF; border: 1px solid rgba(79, 141, 255, 0.30); }
.result-tag-brand::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(79, 141, 255, 1);
    box-shadow: 0 0 8px var(--glow);
}
.result-tag-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.result-tag-success svg { width: 12px; height: 12px; }

.result-btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 0.65rem 1.35rem;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-size: var(--text-sm); font-weight: 600;
    cursor: pointer; border: none; text-decoration: none; line-height: 1.4;
    transition: filter var(--tr), transform var(--tr-fast), background var(--tr), border-color var(--tr), box-shadow var(--tr);
}
.result-btn svg, .result-btn i { width: 16px; height: 16px; flex-shrink: 0; }
.result-btn-primary { background: var(--gradient-brand); color: #FFFFFF; box-shadow: var(--shadow-glow); }
.result-btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: 0 8px 30px rgba(79, 141, 255, 0.25); }
.result-btn-primary:active { transform: translateY(0); }
.result-btn-ghost {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
}
.result-btn-ghost:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--line-hover); }
.result-btn-sm { padding: 0.55rem 1.1rem; font-size: var(--text-xs); }

.result-bento {
    display: grid;
    grid-template-columns: 1fr 1fr 340px;
    grid-template-rows: auto auto;
    gap: var(--sp-4);
}
.result-cell {
    border-radius: var(--radius-2xl);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--card), var(--card-alt));
    overflow: hidden;
    transition: border-color var(--tr-slow), box-shadow var(--tr-slow);
}
.result-cell:hover { border-color: var(--line-hover); box-shadow: var(--shadow-sm); }

.result-cell-img { position: relative; display: flex; flex-direction: column; }
.result-cell-img-wrap { position: relative; background: rgba(0, 0, 0, 0.20); overflow: hidden; flex: 1 1 0%; min-height: 0; }
.result-cell-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 340px; }
.result-cell-img-wrap img[data-placeholder] {
    position: absolute; inset: 0;
    filter: blur(8px); transform: scale(1.05);
    transition: opacity 0.5s;
}

.result-img-label {
    position: absolute; bottom: var(--sp-4); left: var(--sp-4);
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-lg);
    font-size: var(--text-xs); font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase;
    backdrop-filter: blur(16px); z-index: 5;
}
.result-img-label-orig   { background: rgba(0, 0, 0, 0.50); color: rgba(255, 255, 255, 0.75); border: 1px solid rgba(255, 255, 255, 0.10); }
.result-img-label-result { background: rgba(79, 141, 255, 0.22); color: #FFFFFF; border: 1px solid rgba(79, 141, 255, 0.35); }
.result-img-label-dot { width: 6px; height: 6px; border-radius: 50%; }
.result-img-label-orig .result-img-label-dot { background: rgba(255, 255, 255, 0.45); }
.result-img-label-result .result-img-label-dot { background: rgba(79, 141, 255, 1); box-shadow: 0 0 8px rgba(79, 141, 255, 0.6); }

.result-cell-download {
    position: absolute; top: var(--sp-4); right: var(--sp-4);
    width: 44px; height: 44px;
    border-radius: var(--radius-lg);
    background: rgba(0, 0, 0, 0.40);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff; z-index: 5;
    transition: all var(--tr-slow);
}
.result-cell-download:hover {
    background: var(--gradient-brand);
    border-color: transparent; color: #FFFFFF;
    transform: scale(1.08);
    box-shadow: var(--shadow-glow);
}
.result-cell-download svg, .result-cell-download i { width: 18px; height: 18px; }

.result-site-badge { position: absolute; top: var(--sp-4); left: var(--sp-4); z-index: 5; }

.result-error-card { padding: var(--sp-6); }
.result-error-row { display: flex; align-items: center; gap: var(--sp-3); color: var(--danger); font-size: var(--text-sm); }
.result-error-row svg, .result-error-row i { width: 20px; height: 20px; flex-shrink: 0; color: var(--danger); }

.result-error-toggle:hover { color: var(--ink); }

.result-sidebar { grid-row: 1 / 3; }
.result-sidebar-inner { padding: var(--sp-6); display: flex; flex-direction: column; height: 100%; }
.result-sidebar-section { padding: var(--sp-5) 0; border-bottom: 1px solid var(--line); }
.result-sidebar-section:first-child { padding-top: 0; }
.result-sidebar-section:last-child { border-bottom: none; padding-bottom: 0; }
.result-sidebar-label {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.15em;
    color: var(--muted); font-weight: 600; margin-bottom: var(--sp-2);
}
.result-sidebar-value { font-size: var(--text-lg); font-weight: 700; color: var(--ink); }
.result-sidebar-hint { margin-top: var(--sp-1); font-size: var(--text-xs); color: var(--muted); line-height: 1.5; }

.result-credit-amount {
    font-size: 2rem; font-weight: 800; letter-spacing: -1px;
    background: var(--gradient-text);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.result-credit-unit {
    font-size: var(--text-sm); font-weight: 400; color: var(--muted);
    margin-left: 4px; background: none;
    -webkit-text-fill-color: var(--muted);
}

.result-share-link-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
    margin-top: var(--sp-3);
    font-size: var(--text-xs); color: var(--muted);
}
.result-share-link-row a { color: rgba(255, 255, 255, 0.70); text-decoration: underline; word-break: break-all; }

.result-share-copy-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--success-border);
    background: var(--success-bg);
    font-size: 0.6875rem; font-weight: 600; color: var(--success);
    cursor: pointer; font-family: var(--font-sans);
    transition: background var(--tr), border-color var(--tr);
}
.result-share-copy-btn:hover { background: rgba(16, 185, 129, 0.25); border-color: rgba(16, 185, 129, 0.55); }

.result-public-badge {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--success-border);
    background: var(--success-bg);
    font-size: var(--text-xs); font-weight: 600; color: var(--success);
}
.result-public-badge svg, .result-public-badge i { width: 14px; height: 14px; }

.result-badge-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.result-badge-row .result-public-badge { margin-top: 0; }

.result-revoke-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.10);
    font-size: var(--text-xs); font-weight: 600; color: #f87171;
    cursor: pointer; font-family: var(--font-sans); white-space: nowrap;
    transition: background var(--tr), border-color var(--tr), opacity var(--tr);
}
.result-revoke-btn:hover { background: rgba(239, 68, 68, 0.20); border-color: rgba(239, 68, 68, 0.55); }

.result-sidebar-btns { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.result-sidebar-btns .result-btn { width: 100%; justify-content: center; }
.result-shared-at { margin-top: var(--sp-3); font-size: var(--text-xs); color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
    @keyframes resultSlideIn {
        from { opacity: 0; transform: translateY(18px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .result-header                 { animation: resultSlideIn 0.55s ease-out both; }
    .result-bento > *:nth-child(1) { animation: resultSlideIn 0.55s ease-out 0.07s both; }
    .result-bento > *:nth-child(2) { animation: resultSlideIn 0.55s ease-out 0.14s both; }
    .result-bento > *:nth-child(3) { animation: resultSlideIn 0.55s ease-out 0.21s both; }
}

@media (max-width: 1024px) {
    .result-bento { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto; }
    .result-sidebar { grid-row: auto; grid-column: 1 / -1; }
    .result-sidebar-inner { flex-direction: row; flex-wrap: wrap; gap: var(--sp-6); }
    .result-sidebar-section {
        flex: 1; min-width: 200px;
        border-bottom: none; padding: 0;
        border-right: 1px solid var(--line);
        padding-right: var(--sp-6);
    }
    .result-sidebar-section:last-child { border-right: none; padding-right: 0; }
}
@media (max-width: 640px) {
    .result-bento { grid-template-columns: 1fr; }
    .result-cell-img-wrap img { min-height: 240px; }
    .result-video-wrap { min-height: 240px; }
    .result-sidebar-inner { flex-direction: column; }
    .result-sidebar-section {
        border-right: none; padding-right: 0;
        border-bottom: 1px solid var(--line);
        padding-bottom: var(--sp-5);
    }
    .result-sidebar-section:last-child { border-bottom: none; padding-bottom: 0; }
    .result-header { flex-direction: column; }
    .result-header-actions { width: 100%; }
    .result-header-actions .result-btn { flex: 1; justify-content: center; }
}

/* ── 13b. Result states: pending / expired / failed (Session 2) ─── */

/* Inline non-blocking pending state — lives inside the result cell,
   never covers the whole page so the user can navigate freely. */
.result-pending-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 340px;
    position: relative;
}
/* Solid dark scrim above the blurred photo so the loader text stays readable
   no matter how light the underlying image is. */
.result-pending-wrap::before {
    content: "";
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.62);
    z-index: 1;
}
.result-pending-bg {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover;
    filter: blur(24px) brightness(0.3); transform: scale(1.08);
    z-index: 0;
}
.result-pending-inner {
    position: relative; z-index: 2;
    display: flex; flex-direction: column; align-items: center;
    text-align: center; gap: var(--sp-3);
    padding: var(--sp-6);
    max-width: 32rem;
}
.result-pending-spinner {
    width: 56px; height: 56px; color: var(--accent);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-pending-title { font-size: var(--text-lg); font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.result-pending-sub   { font-size: var(--text-sm); color: rgba(255,255,255,0.85); text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.result-pending-hint  { font-size: var(--text-xs); color: rgba(255,255,255,0.65); margin-top: var(--sp-1); text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* Notice card (expired) — informational, not an error. */
.result-notice-card {
    padding: var(--sp-6);
    display: flex; flex-direction: column; align-items: flex-start;
    gap: var(--sp-3);
    min-height: 340px; justify-content: center;
}
.result-notice-icon {
    width: 48px; height: 48px; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06); border: 1px solid var(--line);
    color: var(--ink-3);
}
.result-notice-icon i, .result-notice-icon svg { width: 24px; height: 24px; }
.result-notice-title { font-size: var(--text-base); font-weight: 700; color: var(--ink); }
.result-notice-body  { font-size: var(--text-sm); color: var(--ink-3); line-height: 1.55; }
.result-notice-hint  { font-size: var(--text-xs); color: var(--muted-2); }
.result-notice-expired .result-notice-icon { color: #d9b25f; background: rgba(217,178,95,0.10); border-color: rgba(217,178,95,0.25); }

/* Generated video — fills the cell, no native controls, click to play/pause. */
.result-video-stage {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    cursor: pointer;
}
.result-video {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    min-height: 340px;
    background: #000;
}
/* The video stage + overlays are all position:absolute, so the wrapper has
   no in-flow content to give it height. On desktop the grid row borrows
   height from the sibling (original) cell, but in the single-column mobile
   layout the video cell is alone in its row and would collapse to 0 — making
   the result invisible. Give the video wrapper an explicit min-height. */
.result-video-wrap { min-height: 340px; }
.result-video-playicon {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 72px; height: 72px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    opacity: 0;                 /* hidden while playing */
    transition: opacity var(--tr-slow);
    pointer-events: none;       /* clicks pass through to the stage */
    z-index: 6;
}
.result-video-playicon i, .result-video-playicon svg { width: 32px; height: 32px; }
/* Show the play badge only when the stage is marked paused (set by JS). */
.result-video-stage.is-paused .result-video-playicon { opacity: 1; }

/* Failed-state error details toggle. */
.result-error-toggle {
    margin-top: var(--sp-3);
    font-size: var(--text-xs); color: var(--muted-2);
    background: none; border: none; cursor: pointer; text-decoration: underline;
    padding: 0;
}
.result-error-toggle:hover { color: var(--ink-3); }
.result-error-detail {
    margin-top: var(--sp-2);
    font-size: var(--text-xs); color: var(--muted-2);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    word-break: break-word; white-space: pre-wrap;
    background: rgba(0,0,0,0.25); border: 1px solid var(--line);
    border-radius: var(--radius-md); padding: var(--sp-3);
    max-height: 200px; overflow: auto;
}

/* ── 13c. Custom-style media toggle + VIDEO badge (Session 4) ──── */

/* Image/Video segmented toggle on the "create style" form. Self-contained
   (no Tailwind peer utilities) so it works without a CSS rebuild. */
.ds-media-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
}
.ds-media-opt { cursor: pointer; }
.ds-media-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ds-media-opt > span {
    display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.05);
    padding: 0.75rem 1rem;
    font-size: var(--text-sm); font-weight: 600;
    color: var(--ink-3);
    transition: border-color var(--tr-slow), background var(--tr-slow), color var(--tr-slow);
}
.ds-media-opt > span i, .ds-media-opt > span svg { width: 16px; height: 16px; }
.ds-media-opt input:checked + span {
    border-color: var(--accent-ring);
    background: var(--accent-soft);
    color: #fff;
}
.ds-media-opt input:focus-visible + span {
    box-shadow: 0 0 0 3px var(--accent-ring);
}

/* VIDEO badge shown on style cards / pages whose media_type is video. */
.style-video-badge {
    position: absolute; top: var(--sp-3); left: var(--sp-3);
    z-index: 6;
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-lg);
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase;
    pointer-events: none;
}
.style-video-badge i, .style-video-badge svg { width: 13px; height: 13px; }
.style-video-badge-lg {
    top: var(--sp-4); left: var(--sp-4);
    padding: 0.35rem 0.75rem; font-size: 12px;
}

/* ── 14. RTL Support ─────────────────────────────────────────── */
[dir="rtl"] body,
[dir="rtl"] p, [dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4,
[dir="rtl"] li, [dir="rtl"] label, [dir="rtl"] span, [dir="rtl"] a {
    text-align: right;
}
[dir="rtl"] input, [dir="rtl"] textarea, [dir="rtl"] select {
    direction: rtl; text-align: right;
}


/* ══════════════════════════════════════════════════════════════
 * 7b. Before / After Slider
 * ══════════════════════════════════════════════════════════════ */

/* ── Stage wrapper ─────────────────────────────────────────── */
.bas-stage {
    position: relative;
    box-sizing: border-box;
    max-width: 100%;
    padding: 20px;
    border-radius: 28px;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(79, 141, 255, 0.08), transparent 70%),
        radial-gradient(ellipse 100% 100% at 50% 50%, var(--card) 40%, transparent 100%),
        linear-gradient(180deg, var(--card), var(--card-alt));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        0 0 40px 8px rgba(79, 141, 255, 0.04),
        0 30px 80px -20px rgba(0, 0, 0, 0.6),
        0 10px 30px -10px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.bas-stage,
.bas-stage > * { min-width: 0; }
.bas-stage *,
.bas-stage *::before,
.bas-stage *::after { box-sizing: border-box; }

/* Decorative top light line */
.bas-stage::before {
    content: "";
    position: absolute;
    top: -1px; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(140, 170, 255, 0.5), transparent);
    pointer-events: none;
}

/* ── Frame ─────────────────────────────────────────────────── */
/* Keep portrait faces in frame when cropped to the wide ratio */
#basAfter, #basBefore { object-position: center 30%; }

.bas-frame {
    cursor: col-resize;
    aspect-ratio: 16 / 9;
    min-height: 220px;
    min-width: 0;
    max-width: 100%;
    border-radius: 22px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.5);
}
.bas-frame:focus-visible {
    outline: 2px solid rgba(140, 170, 255, 0.7);
    outline-offset: 3px;
}
/* ── Divider line ──────────────────────────────────────────── */
/* ── Corner badges (Before / After labels) ────────────────── */
.bas-label-after {
    padding: 4px 10px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(140,110,255,.90), rgba(80,220,255,.90));
    backdrop-filter: blur(6px);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .10em;
    color: #FFFFFF;
}

/* ── Live drag handle ──────────────────────────────────────── */
.bas-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
    z-index: 20;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    animation: bas-breathe 2.8s ease-in-out infinite;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
}
.bas-handle svg {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
    animation: bas-arrow-left 2.4s ease-in-out infinite;
}
.bas-handle svg:last-of-type {
    animation-name: bas-arrow-right;
    animation-delay: 0.15s;
}
.bas-handle-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid rgba(180, 200, 255, 0.55);
    animation: bas-ring 2.4s ease-out infinite;
    pointer-events: none;
}
.bas-handle-glow {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(140, 170, 255, 0.35) 0%, rgba(140, 170, 255, 0) 65%);
    filter: blur(4px);
    animation: bas-glow 2.8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
.bas-handle.is-dragging {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow:
        0 6px 28px rgba(120, 170, 255, 0.55),
        inset 0 0 14px rgba(255, 255, 255, 0.35);
    animation-play-state: paused;
}
.bas-handle.is-dragging svg,
.bas-handle.is-dragging .bas-handle-ring,
.bas-handle.is-dragging .bas-handle-glow {
    animation-play-state: paused;
}

@keyframes bas-breathe {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.2);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.06);
        box-shadow: 0 6px 26px rgba(120, 170, 255, 0.45), inset 0 0 14px rgba(255, 255, 255, 0.3);
    }
}
@keyframes bas-ring {
    0%        { transform: scale(1);   opacity: 0.7; }
    80%, 100% { transform: scale(1.5); opacity: 0;   }
}
@keyframes bas-glow {
    0%, 100% { opacity: 0.55; transform: scale(1);    }
    50%      { opacity: 0.95; transform: scale(1.15); }
}
@keyframes bas-arrow-left {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(-2px); }
}
@keyframes bas-arrow-right {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(2px); }
}

/* ── Autoplay progress bar ─────────────────────────────────── */
.bas-autoplay-bar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 15;
    pointer-events: none;
    transition: opacity 300ms ease;
}
.bas-autoplay-bar.is-hidden { opacity: 0; }
.bas-autoplay-bar span {
    display: block;
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: linear-gradient(90deg, rgba(79, 141, 255, 0.9), rgba(79, 141, 255, 0.9));
    box-shadow: 0 0 8px rgba(79, 141, 255, 0.5);
}

/* ── Thumbnail buttons ─────────────────────────────────────── */
.preview-btn.bas-thumb {
    position: relative;
    padding: 2px;
    flex: 0 1 64px;
    min-width: 0;
    aspect-ratio: 16 / 9;
    border-radius: 11px;
    overflow: hidden;
    background: transparent;
    border: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition:
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.4s ease,
        box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.preview-btn.bas-thumb:hover {
    background: transparent;
    transform: translateY(-2px);
    border-color: var(--line-hover);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.preview-btn.bas-thumb.active {
    background: transparent;
    border-color: rgba(140, 170, 255, 0.55);
    box-shadow:
        0 0 0 2px rgba(79, 141, 255, 0.18),
        0 10px 28px rgba(0, 0, 0, 0.35);
}
.preview-btn.bas-thumb:focus-visible {
    outline: 2px solid rgba(140, 170, 255, 0.7);
    outline-offset: 2px;
}

/* Shine sweep on hover */
.preview-btn.bas-thumb::before {
    content: "";
    position: absolute;
    top: 3px; bottom: 3px; left: -100%;
    width: 50%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: skewX(-20deg);
    z-index: 2;
    transition: left 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.preview-btn.bas-thumb:hover::before { left: 200%; }

/* Bottom gradient for label legibility */
.preview-btn.bas-thumb::after {
    content: "";
    position: absolute;
    left: 3px; right: 3px; bottom: 3px;
    height: 45%;
    border-radius: 0 0 11px 11px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.preview-btn.bas-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 11px;
    filter: brightness(0.8) saturate(0.95);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
}
.preview-btn.bas-thumb:hover img {
    transform: scale(1.05);
    filter: brightness(1) saturate(1.05);
}
.preview-btn.bas-thumb.active img {
    filter: brightness(1.05) saturate(1.1);
}

.bas-thumb-label {
    position: absolute;
    left: 3px; right: 3px;
    bottom: 9px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    z-index: 3;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .bas-stage { padding: 12px; border-radius: 20px; }
    .bas-frame { min-height: 240px; }
}
@media (max-width: 480px) {
    .bas-stage { padding: 10px; border-radius: 18px; }
    .bas-frame { min-height: 200px; }
    #basTabs { gap: 8px; }
    .preview-btn.bas-thumb { flex-basis: 56px; }
    .bas-thumb-label { font-size: 9px; bottom: 4px; letter-spacing: 0.1em; }
}
@media (max-width: 380px) {
    #basTabs { gap: 6px; }
    .preview-btn.bas-thumb { width: 64px; height: 48px; }
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .bas-handle,
    .bas-handle svg,
    .bas-handle-ring,
    .bas-handle-glow { animation: none !important; }
    .preview-btn.bas-thumb { transition: none; }
    .preview-btn.bas-thumb:hover { transform: none; }
}

/* ── Image zoom on hover ─────────────────────────────────── */
.preset-zoom-img {
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.group:hover .preset-zoom-img {
    transform: scale(1.08);
}

/* Background layer for fav-style-card (custom.php) */
.fav-card-bg {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* ══════════════════════════════════════════════════════════════
 *  17. OxieAI Premium Refresh — additive component utilities
 * ══════════════════════════════════════════════════════════════
 *  All classes below are NEW. They do not override existing styles
 *  and are safe to opt-into per-element. Drop them onto markup
 *  where you want the refreshed treatment.
 * ── 17.1 Credit pill (header balance display) ──────────────── */
.ds-credit-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem 0.4rem 0.7rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-dim);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    transition: border-color var(--tr), background var(--tr), color var(--tr);
    text-decoration: none;
    white-space: nowrap;
}
.ds-credit-pill:hover {
    border-color: var(--accent-ring);
    background: var(--accent-soft);
    color: var(--ink);
}
.ds-credit-pill__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    color: var(--accent);
}
.ds-credit-pill__icon svg,
.ds-credit-pill__icon i { width: 14px; height: 14px; }
.ds-credit-pill__value {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.ds-credit-pill__label {
    color: var(--ink-3);
    font-weight: 500;
}
/* ── 17.2 Section breathing room ───────────────────────────── */
/*  Apply .ds-section to top-level marketing/page sections to give
    them generous vertical rhythm. Pairs naturally with max-w-6xl. */
.ds-section { padding-top: 5rem; padding-bottom: 5rem; }
@media (min-width: 768px)  { .ds-section { padding-top: 6rem;   padding-bottom: 6rem; } }
@media (min-width: 1024px) { .ds-section { padding-top: 7.5rem; padding-bottom: 7.5rem; } }

/* ── 17.3 Eyebrow / kicker text above headlines ────────────── */
.ds-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-3);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── 17.4 Hairline frame around hero gallery / sliders ─────── */
/*  The interface is a minimal frame — the image is the hero. */
/* ── 17.5 Smooth focus ring for accessibility ──────────────── */
.ds-focus-ring:focus-visible,
a:focus-visible, button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--accent-ring);
    border-radius: inherit;
}

/* ── 17.6 Body type sets the calm muted gray per brief ─────── */
body.studio-body { color: var(--ink-2); }
body.studio-body p { color: var(--ink-3); }
body.studio-body h1,
body.studio-body h2,
body.studio-body h3 { color: var(--ink); letter-spacing: -0.02em; }

/* ── 17.7 Tailwind primary-utility overrides ─────────────────
 *  The Tailwind static build still ships compiled `bg-primary` /
 *  `text-primary` / `text-primary-foreground` utilities pointing at
 *  the legacy purple (#7c3aed). Since rebuilding Tailwind on the
 *  server isn't an option, we re-map them here to the new blue accent
 *  using CSS variables. This file loads AFTER app.css so these win. */
.bg-primary { background-color: var(--accent) !important; }
.bg-primary\/10 { background-color: rgba(79, 141, 255, 0.10) !important; }
.bg-primary\/20 { background-color: rgba(79, 141, 255, 0.20) !important; }
.bg-primary\/30 { background-color: rgba(79, 141, 255, 0.30) !important; }
.text-primary { color: var(--accent) !important; }
.text-primary-foreground { color: #FFFFFF !important; }
.ring-primary { --tw-ring-color: var(--accent) !important; }
.hover\:bg-primary:hover { background-color: var(--accent-hover) !important; }

/* ── 17.8 Hero grid (replaces Tailwind arbitrary value) ────────
 *  Tailwind classes like lg:grid-cols-[1fr_420px] only get compiled
 *  if they appear in source at JIT-build time. To avoid silent
 *  breakage when adding new arbitrary values, the hero grid is
 *  defined here as a stable class. */
.ds-hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: start;
}
@media (min-width: 1024px) {
    .ds-hero-grid {
        grid-template-columns: minmax(0, 1fr) 460px;
        gap: 4rem;
        align-items: start;
    }
}
@media (min-width: 1280px) {
    .ds-hero-grid {
        grid-template-columns: minmax(0, 1fr) 500px;
    }
}

/* ── 17.9 Stable spacing utilities (Tailwind-compile-proof) ────
 *  When the production Tailwind build can't be regenerated, any
 *  utility class that wasn't present at JIT-build time will be
 *  silently dropped from the final CSS. To stay independent of
 *  the build pipeline, the spacing primitives below are defined
 *  here as plain CSS — they cannot be lost. */

/*  Inline flex with gap — used inside hero meta strip, badges,
    chips, anywhere where a Lucide icon sits next to a label. */
.ds-inline-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;        /* 8px between icon and label */
    white-space: nowrap;
}

/*  Horizontal stack with consistent column gap and row wrap. */
.ds-hstack {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 1.5rem;  /* 24px between items */
    row-gap: 0.5rem;     /* 8px when wrapped */
}

.ds-hstack--tight   { column-gap: 0.75rem; row-gap: 0.5rem; }
/*  Vertical stack with consistent gap (replaces fragile space-y / gap-N). */
.ds-vstack          { display: flex; flex-direction: column; gap: 1.5rem; }
.ds-vstack--xl      { gap: 3.5rem; }
/*  Buttons: any direct-child icon gets natural breathing room
    so we never have to remember an explicit gap class on the
    button itself. */
.ds-btn > svg,
.ds-btn > i,
.ds-btn > [data-lucide] {
    margin-inline-start: 0.5rem;
}
.ds-btn > svg:first-child,
.ds-btn > i:first-child,
.ds-btn > [data-lucide]:first-child {
    margin-inline-start: 0;
    margin-inline-end: 0.5rem;
}

/*  Hero grid: bullets need air between rows on desktop. */
.ds-hero-bullets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem 2rem;
}

/* ── "How it works" — compact version inside the hero left column ── */
.ds-mini-steps {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ds-mini-steps > li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.85rem;
    color: var(--ink-3, #b9c0cc);
}
.ds-mini-steps .ds-mini-num { margin-top: 1px; }
.ds-mini-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: color-mix(in srgb, var(--accent, #4F8DFF) 18%, transparent);
    color: var(--accent, #4F8DFF);
    font-size: 0.72rem;
    font-weight: 700;
}
.ds-mini-step-video {
    color: var(--accent, #4F8DFF);
    font-weight: 600;
}

/* ── Slider prev/next round buttons ─────────────────────────── */
.bas-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2rem;
    border-radius: 9999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-2, #e5e7eb);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
@media (max-width: 640px) {
    .bas-nav-btn { width: 3.25rem; height: 2.5rem; }
}
.bas-nav-btn:hover {
    background: color-mix(in srgb, var(--accent, #4F8DFF) 16%, var(--card));
    border-color: color-mix(in srgb, var(--accent, #4F8DFF) 50%, transparent);
    color: #fff;
}
.bas-nav-btn:active { transform: scale(0.92); }

/* ── Animated CTA arrow (Start creating) ────────────────────── */
@keyframes ds-arrow-nudge {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(4px); }
}
.ds-cta-arrow {
    animation: ds-arrow-nudge 1.3s ease-in-out infinite;
    transition: transform 0.15s ease;
}
.ds-btn:hover .ds-cta-arrow {
    animation: none;
    transform: translateX(5px);
}
@media (prefers-reduced-motion: reduce) {
    .ds-cta-arrow { animation: none; }
}
@media (min-width: 640px) {
    .ds-hero-bullets { grid-template-columns: 1fr 1fr; }
}
.ds-hero-bullets > li {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.625rem;
}

/* ── 17.10 CTA pair — mobile-asymmetric, desktop auto-width ────
 *  Used for hero/landing CTAs where two buttons sit side-by-side.
 *  On mobile the primary CTA gets more width (60%) than the
 *  secondary (40%) so the main label never gets clipped. On
 *  ≥640px both snap back to natural width. */
.ds-cta-pair {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
    width: 100%;
}
.ds-cta-pair > .ds-btn {
    min-width: 0;
    width: 100%;
    justify-content: center;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    white-space: nowrap;
}
@media (min-width: 640px) {
    .ds-cta-pair {
        flex-direction: row;
        flex-wrap: wrap;
        width: auto;
        gap: 0.75rem;
    }
    .ds-cta-pair > .ds-btn {
        flex: 0 0 auto;
        width: auto;
        padding-left: 1.75rem;
        padding-right: 1.75rem;
    }
}

/* ── 17.11 Soften legacy harsh-bordered cards ──────────────────
 *  Some partials (and content blocks added through CMS/lang files
 *  that are not in version control) use opaque black backgrounds
 *  with strong white borders like border-white/15 or border-white/20.
 *  Those clash with the hairline aesthetic everywhere else on the
 *  site. We knock them down to the same hairline border + subtle
 *  card surface used by .ds-card / .studio-surface. */

.border-white\/15,
.border-white\/20,
.border-white\/25,
.border-white\/\[0\.15\],
.border-white\/\[0\.20\],
.border-white\/\[0\.25\] {
    border-color: var(--line) !important;
}
.border-white\/15:hover,
.border-white\/20:hover,
.border-white\/\[0\.15\]:hover,
.border-white\/\[0\.20\]:hover {
    border-color: var(--line-hover) !important;
}

/*  Solid-black card backgrounds → soften to our translucent surface
    so the cards sit on top of the page wash instead of looking like
    cutouts. Targets the most common Tailwind black-bg patterns. */
.bg-black,
.bg-black\/40,
.bg-black\/50,
.bg-black\/60,
.bg-black\/70,
.bg-\[\#000\],
.bg-\[\#000000\],
.bg-\[\#0a0a0a\],
.bg-\[\#0A0A0A\],
.bg-\[\#0a0a0d\] {
    background-color: var(--surface-2) !important;
}

/*  Light theme: above overrides should use the light-theme card token. */
html[data-theme="light"] .border-white\/15,
html[data-theme="light"] .border-white\/20,
html[data-theme="light"] .border-white\/25,
html[data-theme="light"] .border-white\/\[0\.15\],
html[data-theme="light"] .border-white\/\[0\.20\],
html[data-theme="light"] .border-white\/\[0\.25\] {
    border-color: var(--line) !important;
}
html[data-theme="light"] .bg-black,
html[data-theme="light"] .bg-black\/40,
html[data-theme="light"] .bg-black\/50,
html[data-theme="light"] .bg-black\/60,
html[data-theme="light"] .bg-black\/70 {
    background-color: var(--card) !important;
}

/* ── 17.12 Round icon button — matches credit pill aesthetic ───
 *  Used for header icons (bell, etc) so they sit harmoniously next
 *  to .ds-credit-pill. Same border + background + transitions, just
 *  square aspect ratio with a circular border-radius. */
.ds-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;        /* 36px — matches credit-pill height */
    height: 2.25rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-2);
    transition: border-color var(--tr), background var(--tr), color var(--tr);
    text-decoration: none;
    flex-shrink: 0;
}
.ds-icon-btn:hover {
    border-color: var(--line-hover);
    background: var(--surface-2);
    color: var(--ink);
}

/* ── 17.13 Meta strip — icon + label rows under hero CTAs ──────
 *  On desktop: items sit on one row separated by spacing.
 *  On mobile: items stack vertically; the label inside each item
 *  is allowed to wrap so long sentences don't push the layout
 *  past the viewport. */
.ds-meta-strip {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}
.ds-meta-strip > .ds-meta-item {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
    /* allow wrap inside; don't force nowrap like ds-inline-row does */
    white-space: normal;
}
.ds-meta-strip > .ds-meta-item > i,
.ds-meta-strip > .ds-meta-item > svg,
.ds-meta-strip > .ds-meta-item > [data-lucide] {
    flex-shrink: 0;
    margin-top: 2px;          /* baseline-align with first text line */
}
@media (min-width: 640px) {
    .ds-meta-strip {
        flex-direction: row;
        flex-wrap: wrap;
        column-gap: 1.75rem;
        row-gap: 0.5rem;
    }
}

/* ============================================================
 * Phase D2 hotfix v4 — Rail card dimensions
 *
 * Explicit width + height for rail cards. Replaces the earlier
 * `aspect-ratio` approach which had inconsistent results when
 * the flex item width was constrained only by min-width and the
 * card content was fully absolute-positioned.
 *
 * Card geometry chosen to closely match the picker-form preset
 * cards (240/280px wide on mobile/desktop) but at 3:4 portrait
 * instead of 1:1 square.
 *
 *   240w × 320h on mobile  (3:4)
 *   280w × 373h on >=640px (3:4)
 * ============================================================ */
.rail-card-link {
    flex: 0 0 auto;
    width: 240px;
    height: 320px;
}
@media (min-width: 640px) {
    .rail-card-link {
        width: 280px;
        height: 373px;
    }
}

/* ============================================================
   Scene Immersion upsell card (Mode 2 toggle)
   Glassy, attention-first. Default-off but visually the loudest
   element under the generate form so it stays discoverable.
   ============================================================ */
.scene-immersion {
    position: relative;
    cursor: pointer;
    border-radius: 1.25rem;
    padding: 1.1rem 1.15rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: border-color .25s ease, box-shadow .25s ease, background .25s ease, transform .15s ease;
    overflow: hidden;
}
.scene-immersion::before {
    /* soft accent glow that fades in when active */
    content: "";
    position: absolute;
    inset: -1px;
    background: radial-gradient(120% 80% at 0% 0%, var(--accent-soft), transparent 60%);
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}
.scene-immersion:hover {
    border-color: rgba(255, 255, 255, 0.18);
    /* No translate on hover: the lift re-rasterised the backdrop-blurred
       text and made the letters look fuzzy. Border highlight is enough. */
}
.scene-immersion.is-on {
    border-color: var(--accent);
    background: linear-gradient(180deg, var(--accent-soft), rgba(255,255,255,0.02));
    box-shadow: 0 0 0 1px var(--accent-ring), 0 8px 30px -12px var(--accent-ring);
}
.scene-immersion.is-on::before { opacity: 1; }
.scene-immersion:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-ring);
}

.scene-immersion__head {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.scene-immersion__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .75rem;
    background: var(--accent-soft);
    color: var(--accent);
    flex: 0 0 auto;
    transition: background .25s ease, color .25s ease;
}
.scene-immersion.is-on .scene-immersion__icon {
    background: var(--accent);
    color: var(--accent-fg);
}
.scene-immersion__icon svg { width: 1.15rem; height: 1.15rem; }

.scene-immersion__title-wrap {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
}
.scene-immersion__title {
    font-size: .95rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}
.scene-immersion__cost {
    font-size: .72rem;
    font-weight: 600;
    color: var(--accent);
    padding: .1rem .45rem;
    border-radius: 999px;
    background: var(--accent-soft);
    white-space: nowrap;
}

.scene-immersion__switch {
    position: relative;
    flex: 0 0 auto;
    width: 2.75rem;
    height: 1.5rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.2);
    transition: background .25s ease;
}
.scene-immersion.is-on .scene-immersion__switch { background: var(--accent); }
.scene-immersion__knob {
    position: absolute;
    top: 50%;
    left: .15rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%);
    transition: left .25s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.scene-immersion.is-on .scene-immersion__knob { left: 1.4rem; }

.scene-immersion__subtitle {
    margin-top: .7rem;
    font-size: .8rem;
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.82);
}

.scene-immersion__benefits {
    margin-top: .85rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem .9rem;
    list-style: none;
    padding: 0;
}
.scene-immersion__benefits li {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .76rem;
    color: rgba(226, 232, 240, 0.72);
}
.scene-immersion__benefits svg {
    width: .95rem;
    height: .95rem;
    color: var(--accent);
    flex: 0 0 auto;
}
.scene-immersion.is-on .scene-immersion__benefits li { color: rgba(241, 245, 249, 0.92); }

@media (max-width: 420px) {
    .scene-immersion__benefits { grid-template-columns: 1fr; }
}

/* ============================================================
   Product block (result page) — AI-detected name/description,
   editable. Marketplace post UI is added in a later step.
   ============================================================ */
.product-block {
    margin-top: 1.25rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 1.25rem 1.35rem;
}
.product-block-head {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1rem;
}
.product-block-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    border-radius: .75rem;
    background: var(--accent-soft);
    color: var(--accent);
}
.product-block-icon svg { width: 1.15rem; height: 1.15rem; }
.product-block-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}
.product-block-sub {
    margin-top: .15rem;
    font-size: .8rem;
    color: rgba(226, 232, 240, 0.7);
}
.product-field-label {
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: rgba(148, 163, 184, 0.9);
    margin: .75rem 0 .35rem;
}
.product-input {
    width: 100%;
    border-radius: .85rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.30);
    padding: .7rem .9rem;
    font-size: .9rem;
    color: #f1f5f9;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.product-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-ring);
}
.product-textarea { resize: vertical; min-height: 4.5rem; line-height: 1.5; }
.product-block-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1rem;
}
.product-save-status { font-size: .8rem; color: rgba(148, 163, 184, 0.9); }
.product-save-ok  { color: #4ade80; }
.product-save-err { color: #f87171; }

/* Product post controls (result page) */
.product-post-controls {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.product-post-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    flex: 0 0 auto;
    white-space: nowrap;
}
.product-post-cost {
    font-size: .72rem;
    font-weight: 600;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: rgba(0,0,0,0.25);
}
.product-post-output {
    margin-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 1rem;
}
.product-post-output-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .5rem;
}
.product-post-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: .85rem;
    line-height: 1.6;
    color: #e2e8f0;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: .85rem;
    padding: .9rem 1rem;
    margin: 0;
    max-height: 30rem;
    overflow-y: auto;
}

/* Structured product post blocks */
.product-post-block { margin-top: 1.1rem; }
.product-post-block-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: .4rem;
}
.product-copy-btn { padding: .25rem .6rem; font-size: .78rem; }
.product-specs { display: flex; flex-direction: column; gap: .4rem; }
.product-spec-row { display: flex; gap: .5rem; }
.product-spec-key { flex: 0 0 38%; }
.product-spec-val { flex: 1 1 auto; }
.product-info-card {
    border: 1px solid var(--accent-ring);
    background: var(--accent-soft);
    border-radius: .9rem;
    padding: .85rem 1rem;
}
.product-info-row {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .3rem 0; font-size: .85rem;
}
.product-info-key { color: rgba(226,232,240,0.75); }
.product-info-val { color: #fff; font-weight: 600; text-align: right; }
.product-info-price { color: var(--accent); font-size: 1rem; }
.product-info-note {
    margin-top: .5rem; font-size: .72rem; font-style: italic;
    color: rgba(226,232,240,0.6);
}

/* Collapsible generated-post cards */
.product-post-card {
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 1rem;
    background: rgba(0,0,0,0.20);
    margin-top: .75rem;
    overflow: hidden;
}
.product-post-card-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .85rem 1rem;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    color: #fff;
}
.product-post-card-head:hover { background: rgba(255,255,255,0.03); }
.product-post-badge {
    flex: 0 0 auto;
    font-size: .72rem;
    font-weight: 700;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.product-post-card-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e2e8f0;
}
.product-post-chevron {
    flex: 0 0 auto;
    width: 1.1rem; height: 1.1rem;
    color: rgba(226,232,240,0.6);
    transition: transform .2s ease;
}
.product-post-card.is-open .product-post-chevron { transform: rotate(180deg); }
.product-post-card-body {
    display: none;
    padding: 0 1rem 1rem;
}
.product-post-card.is-open .product-post-card-body { display: block; }
.product-post-body .product-post-block:first-child { margin-top: .25rem; }

/* Product export bar */
.product-export-bar {
    display: flex; align-items: center; gap: .5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.product-export-label {
    font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
    color: rgba(148,163,184,0.9); margin-right: .25rem;
}

/* Download + resolution group */
.result-download-group { display: inline-flex; align-items: stretch; gap: .4rem; }
.result-resolution-select {
    border-radius: var(--radius-full);
    border: 1px solid rgba(128, 128, 128, 0.28);
    background: transparent;
    color: inherit;
    font-size: var(--text-xs);
    padding: 0.55rem 1.1rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--tr), background var(--tr);
}
.result-resolution-select:hover { border-color: var(--accent); }
.result-resolution-select:focus { border-color: var(--accent); }
/* Native option popup follows the OS; force readable colors so it isn't grey. */
.result-resolution-select option { color: #0f172a; background: #ffffff; }
