"""comfyui_curated_styles_catalog — catálogo curado de estilos para el selector WAS de ComfyUI.

Devuelve un dict de estilos en el formato EXACTO que consumen los nodos WAS
`Prompt Styles Selector` / `Prompt Multiple Styles Selector`:

    { "NombreEstilo": {"prompt": "modificadores de estilo", "negative_prompt": "..."}, ... }

El selector múltiple CONCATENA los `prompt` de los estilos elegidos, así que cada `prompt`
contiene MODIFICADORES de estilo potentes (cámara, lente, iluminación, render engine, medio
artístico, paleta, mood) y NO una descripción de sujeto ni el placeholder `{prompt}`.

El catálogo se construye de forma programática desde estructuras compactas por categoría
(`_CATEGORIES`): una lista de `(nombre, modificadores)` por categoría más un `negative`
compartido por categoría. Esto garantiza que toda entrada tenga `prompt` y `negative_prompt`
no vacíos, y hace trivial añadir estilos (una línea por estilo).

Pensado para alimentar `comfyui_append_styles`, que lo fusiona (merge+dedup, preservando los
existentes) sobre el styles.json real de la instalación WAS.

Función PURA: sólo devuelve datos (copias), sin red ni I/O ni estado.
"""
from __future__ import annotations

# Negativos compartidos por familia. Mantienen las entradas SFW y evitan los artefactos
# típicos de cada medio (p.ej. fotografía rechaza "cartoon/3d render"; el render 3D rechaza
# "flat/2d").
_NEG_PHOTO = (
    "illustration, painting, drawing, cartoon, anime, 3d render, cgi, sketch, "
    "lowres, blurry, deformed, bad anatomy, watermark, signature, text, NSFW"
)
_NEG_RENDER3D = (
    "flat, 2d, hand-drawn, sketch, painterly, lowres, blurry, noisy, deformed, "
    "bad anatomy, watermark, signature, text, NSFW"
)
_NEG_PAINT = (
    "photo, photorealistic, 3d render, cgi, lowres, blurry, noisy, jpeg artifacts, "
    "deformed, bad anatomy, watermark, signature, text, NSFW"
)
_NEG_ANIME = (
    "photo, photorealistic, 3d render, realistic, lowres, blurry, extra limbs, "
    "bad anatomy, bad hands, deformed, watermark, signature, text, NSFW"
)
_NEG_PIXEL = (
    "blurry, smooth, photorealistic, 3d render, antialiasing, soft, gradient, noise, "
    "realistic, deformed, watermark, signature, text, NSFW"
)
_NEG_ILLUS = (
    "photo, photorealistic, lowres, blurry, noisy, jpeg artifacts, deformed, "
    "bad anatomy, watermark, signature, text, NSFW"
)
_NEG_COMIC = (
    "photo, photorealistic, 3d render, blurry, lowres, messy lines, deformed, "
    "bad anatomy, watermark, signature, NSFW"
)
_NEG_SCIFI = (
    "lowres, blurry, noisy, flat lighting, washed out, deformed, bad anatomy, "
    "watermark, signature, text, NSFW"
)
_NEG_FANTASY = (
    "lowres, blurry, noisy, modern, contemporary, deformed, bad anatomy, "
    "watermark, signature, text, NSFW"
)
_NEG_LIGHT = (
    "flat lighting, washed out, overexposed, underexposed, lowres, blurry, noisy, "
    "deformed, watermark, signature, text, NSFW"
)
_NEG_CAMERA = (
    "lowres, blurry, motion blur, noisy, jpeg artifacts, deformed, bad anatomy, "
    "watermark, signature, text, NSFW"
)
_NEG_MATERIAL = (
    "lowres, blurry, noisy, flat, dull, deformed, watermark, signature, text, NSFW"
)
_NEG_MOOD = (
    "lowres, blurry, noisy, flat, dull, deformed, bad anatomy, watermark, "
    "signature, text, NSFW"
)

# Cada entrada de categoría: (negative_compartido, [(nombre, modificadores_de_prompt), ...]).
# El prefijo del nombre (ej. "photo-", "render-") agrupa el estilo en el selector y evita
# colisiones con los 269 estilos ya presentes (que usan otros prefijos / nombres propios).
_CATEGORIES: dict[str, tuple[str, list[tuple[str, str]]]] = {
    "photography": (_NEG_PHOTO, [
        ("photo-golden-hour", "professional photograph, golden hour lighting, warm sunlight, long soft shadows, 50mm lens, shallow depth of field, sharp focus, high detail, kodak portra 400"),
        ("photo-blue-hour", "professional photograph, blue hour twilight, cool ambient light, city lights, 35mm lens, crisp detail, cinematic color grade"),
        ("photo-studio-portrait", "studio portrait photograph, softbox key light, seamless backdrop, 85mm f1.4, creamy bokeh, tack-sharp eyes, skin texture detail"),
        ("photo-macro", "extreme macro photograph, 1:1 magnification, focus stacking, razor-thin depth of field, intricate microscopic detail, ring light"),
        ("photo-aerial-drone", "aerial drone photograph, top-down bird's eye view, wide landscape, atmospheric perspective, high altitude, crisp detail"),
        ("photo-street", "candid street photograph, 35mm reportage, available light, decisive moment, grainy film, high contrast black and white"),
        ("photo-documentary", "documentary photograph, photojournalism, natural light, authentic moment, 35mm, muted color, honest realism"),
        ("photo-fashion-editorial", "high fashion editorial photograph, dramatic studio lighting, vogue magazine, glossy, bold styling, medium format detail"),
        ("photo-product", "commercial product photograph, clean white background, soft gradient light, sharp focus, reflections, advertising quality"),
        ("photo-food", "appetizing food photograph, natural side light, shallow depth of field, fresh ingredients, steam, glossy highlights, culinary magazine"),
        ("photo-wildlife", "wildlife photograph, telephoto 600mm, natural habitat, frozen action, soft background blur, national geographic"),
        ("photo-astrophotography", "astrophotography, milky way, long exposure night sky, star trails, deep space detail, low light, tripod, wide angle"),
        ("photo-underwater", "underwater photograph, caustic light rays, suspended particles, blue-green water, diffused sunlight, marine scene"),
        ("photo-infrared", "infrared photograph, false color, white foliage, dark sky, surreal tonal inversion, dreamy ethereal"),
        ("photo-pinhole", "pinhole camera photograph, soft vignette, long exposure, dreamy blur, vintage analog, light leaks"),
        ("photo-medium-format", "medium format photograph, hasselblad, 100 megapixel detail, ultra-high resolution, perfect tonality, fine grain"),
        ("photo-cinematic-still", "cinematic film still, anamorphic lens, teal and orange grade, lens flare, 2.39:1 framing, dramatic key light, movie scene"),
        ("photo-noir", "film noir photograph, high contrast black and white, hard venetian-blind shadows, low key, dramatic chiaroscuro, 1940s"),
        ("photo-polaroid", "vintage polaroid photograph, instant film, faded colors, soft focus, white frame, nostalgic, light leak"),
        ("photo-lomography", "lomography photograph, saturated colors, heavy vignette, cross-processed, light leaks, analog film, unpredictable"),
        ("photo-tilt-shift-mini", "tilt-shift photograph, miniature faking, selective focus band, toy-like scale, vivid saturation"),
        ("photo-double-exposure", "double exposure photograph, blended silhouettes, layered imagery, surreal montage, high contrast"),
        ("photo-hdr-landscape", "HDR landscape photograph, ultra wide angle, deep depth of field, vivid dynamic range, dramatic clouds, crisp foreground detail"),
        ("photo-overcast-soft", "soft overcast photograph, diffused even light, no harsh shadows, gentle muted tones, natural color"),
        ("photo-backlit-rim", "backlit photograph, strong rim light, glowing edges, lens flare, hazy atmosphere, silhouette contrast"),
    ]),
    "render3d": (_NEG_RENDER3D, [
        ("render-octane", "octane render, physically based, global illumination, subsurface scattering, 8k textures, photorealistic 3d, ray traced reflections"),
        ("render-unreal5", "unreal engine 5 render, lumen global illumination, nanite detail, cinematic, volumetric fog, ultra realistic real-time"),
        ("render-blender-cycles", "blender cycles render, path traced, soft shadows, denoised, studio hdri lighting, clean 3d"),
        ("render-pixar-style", "pixar style 3d render, stylized character, soft global illumination, subsurface skin, expressive, polished animation film"),
        ("render-clay", "clay render, matte grey material, ambient occlusion, soft studio light, sculptural form, no textures"),
        ("render-isometric-3d", "isometric 3d render, clean diorama, orthographic view, soft shadows, miniature scene, vibrant solid colors"),
        ("render-product-cgi", "product cgi render, glossy reflections, studio lighting setup, caustics, ultra clean, advertising 3d"),
        ("render-architectural-viz", "architectural visualization, photoreal interior render, natural window light, vray, realistic materials, magazine quality"),
        ("render-voxel", "voxel art 3d, cubic blocks, magicavoxel, isometric, vibrant palette, soft ambient occlusion, crisp cubes"),
        ("render-toon-3d", "toon shaded 3d render, cel shading, outline pass, flat lit, stylized cartoon 3d, clean colors"),
        ("render-zbrush-sculpt", "zbrush high-poly sculpt, detailed surface, matcap red wax, intricate displacement, digital clay"),
        ("render-glass-iridescent", "iridescent glass 3d render, refraction, dispersion rainbow, translucent material, studio reflections, dreamy"),
        ("render-inflatable", "inflatable balloon 3d render, glossy latex material, soft puffy form, bright studio light, playful"),
        ("render-liquid-metal", "liquid chrome 3d render, mirror reflections, flowing metal, abstract, high gloss, studio hdri"),
        ("render-papercraft-3d", "papercraft 3d render, folded paper texture, soft shadows, layered cutouts, handmade diorama"),
        ("render-low-poly", "low poly 3d render, faceted geometry, flat shaded, minimal polygons, clean solid colors, stylized game asset"),
        ("render-vaporwave-3d", "vaporwave 3d render, chrome and pastel, retro grid floor, neon glow, surreal 80s aesthetic, glossy"),
        ("render-miniature-diorama", "miniature diorama 3d render, tilt-shift scale, tiny detailed scene, soft top light, charming"),
    ]),
    "painting": (_NEG_PAINT, [
        ("paint-oil-classical", "classical oil painting, old master technique, rich impasto, chiaroscuro, warm varnish glaze, baroque, museum quality"),
        ("paint-impressionist", "impressionist painting, loose visible brushstrokes, dappled light, plein air, vibrant broken color, monet style"),
        ("paint-watercolor", "watercolor painting, soft wet-on-wet washes, blooming pigment, paper texture, delicate transparency, loose edges"),
        ("paint-gouache", "gouache painting, opaque matte color, flat bold shapes, illustrative, soft texture, mid-century"),
        ("paint-acrylic-bold", "acrylic painting, bold saturated color, confident brushwork, thick texture, contemporary, expressive"),
        ("paint-renaissance", "renaissance painting, sfumato, balanced composition, soft modeling, religious fresco, da vinci style, tempera"),
        ("paint-baroque", "baroque painting, dramatic tenebrism, dynamic diagonal composition, rich shadow, caravaggio, opulent"),
        ("paint-romanticism", "romanticism painting, sublime landscape, dramatic sky, emotional grandeur, turner style, atmospheric"),
        ("paint-art-nouveau", "art nouveau painting, flowing organic lines, decorative floral border, mucha style, elegant, ornamental gold"),
        ("paint-ukiyo-e", "ukiyo-e woodblock print, flat color planes, bold outlines, japanese, hokusai style, delicate gradient sky"),
        ("paint-cubism", "cubist painting, fragmented geometric planes, multiple viewpoints, muted earth tones, picasso braque style"),
        ("paint-surrealism", "surrealist painting, dreamlike imagery, impossible juxtaposition, dali style, melting forms, uncanny"),
        ("paint-fauvism", "fauvist painting, wild non-natural color, bold flat brushwork, matisse style, vivid expressive"),
        ("paint-pointillism", "pointillist painting, tiny dots of pure color, optical blending, seurat style, luminous texture"),
        ("paint-expressionist", "expressionist painting, raw emotional brushwork, distorted form, intense color, munch style, angst"),
        ("paint-tonalism", "tonalist painting, muted misty atmosphere, limited palette, soft diffused light, poetic mood, hazy"),
        ("paint-fresco", "fresco mural painting, matte plaster surface, earthy pigment, aged texture, italian renaissance wall"),
        ("paint-ink-wash", "sumi-e ink wash painting, minimal brushstrokes, negative space, monochrome black ink, zen, expressive gesture"),
        ("paint-palette-knife", "palette knife oil painting, thick textured strokes, bold impasto ridges, sculptural paint, vivid"),
        ("paint-gothic-icon", "gothic icon painting, gold leaf background, flat stylized figures, byzantine, ornate halo, tempera"),
    ]),
    "anime": (_NEG_ANIME, [
        ("anime-modern-tv", "modern anime style, clean cel shading, vibrant colors, detailed eyes, crisp lineart, tv anime key visual"),
        ("anime-90s-retro", "90s retro anime style, hand-painted cels, muted film grain, nostalgic, classic anime aesthetic"),
        ("anime-shoujo", "shoujo manga style, sparkling eyes, soft pastel tones, delicate screentone, floral background, romantic"),
        ("anime-shonen-action", "shonen anime style, dynamic action pose, bold speed lines, intense expression, vibrant, energetic"),
        ("anime-ghibli-inspired", "studio ghibli inspired, soft painterly background, gentle colors, whimsical, hand-drawn warmth, detailed nature"),
        ("anime-makoto-shinkai", "makoto shinkai style, hyper-detailed sky, lens flare, vivid saturated color, photorealistic background, emotional"),
        ("anime-chibi", "chibi style, super deformed, oversized head, tiny body, cute rounded shapes, simple flat colors"),
        ("anime-mecha", "mecha anime style, detailed robot panels, hard surface, dramatic perspective, metallic shading, sci-fi"),
        ("anime-dark-fantasy", "dark fantasy anime, gritty detailed lineart, muted desaturated palette, ominous mood, berserk style"),
        ("anime-pastel-soft", "soft pastel anime, gentle gradient shading, dreamy light, kawaii, delicate, low contrast pastel palette"),
        ("anime-manga-bw", "black and white manga, screentone shading, ink hatching, dynamic panels, sharp lineart, no color"),
        ("anime-cyberpunk", "cyberpunk anime, neon-lit night city, holographic ui, akira style, gritty detail, glowing accents"),
        ("anime-watercolor-illust", "anime watercolor illustration, soft wash background, delicate lineart, gentle bloom, light and airy"),
        ("anime-key-visual", "anime key visual, polished promotional art, intricate detail, dramatic lighting, official poster quality"),
        ("anime-vtuber-style", "vtuber model style, glossy big eyes, clean gradient shading, bright vibrant, live2d aesthetic, cute"),
    ]),
    "pixel": (_NEG_PIXEL, [
        ("pixel-8bit-nes", "8-bit pixel art, NES palette, chunky pixels, limited 4 color, dithering, retro game sprite, flat"),
        ("pixel-16bit-snes", "16-bit pixel art, SNES JRPG sprite, rich palette, clean outline, detailed dithering, retro game"),
        ("pixel-gameboy", "game boy pixel art, 4 shade green monochrome, 1-bit dithering, low res, dmg handheld, retro"),
        ("pixel-isometric", "isometric pixel art, 2:1 tile grid, crisp pixels, game asset, clean shading, vibrant palette"),
        ("pixel-cyber-neon", "neon pixel art, glowing cyberpunk sprite, dark background, bright accent pixels, synthwave palette"),
        ("pixel-demake", "demake pixel art, retro reimagining, limited palette, chunky sprite, nostalgic 16-bit"),
        ("pixel-portrait", "pixel art portrait, detailed face sprite, hand-placed pixels, anti-alias dithering, vibrant"),
        ("pixel-landscape", "pixel art landscape, parallax background, detailed scenery, soft dithered gradient sky, retro game"),
        ("pixel-1bit", "1-bit pixel art, pure black and white, dithered shading, minimal, retro monochrome, high contrast"),
        ("pixel-pico8", "pico-8 style pixel art, 16 color palette, chunky low-res, charming fantasy console sprite"),
        ("pixel-hd-modern", "modern HD pixel art, detailed sprite, smooth palette, sub-pixel animation feel, indie game polish"),
        ("pixel-horror", "horror pixel art, dark muted palette, eerie dithering, unsettling sprite, retro survival horror mood"),
    ]),
    "illustration": (_NEG_ILLUS, [
        ("illust-childrens-book", "children's book illustration, soft warm colors, friendly rounded shapes, storybook charm, gentle texture, whimsical"),
        ("illust-flat-vector", "flat vector illustration, bold geometric shapes, solid colors, minimal, clean, modern graphic design"),
        ("illust-editorial", "editorial illustration, conceptual metaphor, limited palette, textured grain, sophisticated, magazine art"),
        ("illust-storybook-painterly", "painterly storybook illustration, rich textured brushwork, warm narrative scene, fairy tale, detailed"),
        ("illust-line-art", "clean line art illustration, single weight ink lines, minimal, elegant, no shading, contour drawing"),
        ("illust-risograph", "risograph print illustration, limited spot colors, grainy texture, slight misregistration, retro indie print"),
        ("illust-isometric-infographic", "isometric infographic illustration, clean technical diagram, soft shadows, flat colors, vector"),
        ("illust-botanical", "vintage botanical illustration, detailed scientific drawing, watercolor and ink, labeled, antique plate"),
        ("illust-fantasy-cover", "fantasy book cover illustration, epic dramatic scene, detailed painterly, rich color, cinematic composition"),
        ("illust-sticker", "die-cut sticker illustration, bold outline, glossy, cute kawaii, flat vibrant colors, simple shapes"),
        ("illust-vintage-poster", "vintage poster illustration, mid-century travel ad, limited palette, bold typography space, screenprint texture"),
        ("illust-pen-and-ink", "pen and ink illustration, fine cross-hatching, stippling, detailed monochrome, etching style, intricate"),
        ("illust-art-deco", "art deco illustration, geometric symmetry, gold and black, elegant streamline, 1920s glamour, ornamental"),
        ("illust-naive-folk", "naive folk art illustration, flat childlike charm, decorative patterns, bright primary colors, handcrafted"),
        ("illust-scratchboard", "scratchboard illustration, white lines on black, fine engraving texture, dramatic high contrast, detailed"),
        ("illust-collage-mixed", "mixed media collage illustration, torn paper, layered textures, hand-cut shapes, eclectic, tactile"),
    ]),
    "comic": (_NEG_COMIC, [
        ("comic-american", "american comic book art, bold ink outlines, dynamic ben-day dots, dramatic shading, superhero, vibrant"),
        ("comic-noir-graphic", "noir graphic novel, high contrast black and white, heavy shadows, sin city style, stark ink"),
        ("comic-european-bd", "european bande dessinée, clear ligne claire lines, flat color, detailed background, tintin moebius style"),
        ("comic-manga-action", "manga action comic, dynamic panels, speed lines, screentone, dramatic ink, expressive"),
        ("comic-newspaper-strip", "newspaper comic strip, simple clean cartoon, flat colors, humorous, classic funnies style"),
        ("comic-golden-age", "golden age comic art, retro 1940s, halftone print texture, primary colors, pulp hero, vintage"),
        ("comic-webtoon", "webtoon style, vertical scroll, soft digital coloring, clean lineart, modern korean comic, gradient"),
        ("comic-underground", "underground comix, crosshatched grit, satirical, rough ink, robert crumb style, dense detail"),
        ("comic-superhero-modern", "modern superhero comic, painterly digital ink, dynamic anatomy, dramatic lighting, detailed, cinematic"),
        ("comic-cartoon-network", "cartoon network style, bold flat color, simple expressive shapes, quirky, clean thick outlines"),
    ]),
    "lighting": (_NEG_LIGHT, [
        ("light-rembrandt", "rembrandt lighting, soft key light, triangle cheek highlight, deep falloff shadow, classic portrait"),
        ("light-rim-backlight", "dramatic rim lighting, glowing edge light, dark background, strong separation, cinematic backlight"),
        ("light-volumetric-god-rays", "volumetric god rays, light shafts through haze, atmospheric beams, dust particles, dramatic"),
        ("light-neon-glow", "neon glow lighting, vibrant magenta and cyan, reflective wet surfaces, urban night, colorful bloom"),
        ("light-candlelit", "warm candlelit scene, soft flickering glow, intimate, deep warm shadows, chiaroscuro, cozy"),
        ("light-bioluminescent", "bioluminescent glow, ethereal blue-green light, magical particles, dark surroundings, otherworldly"),
        ("light-studio-softbox", "clean studio softbox lighting, even diffused, soft shadows, professional, balanced exposure"),
        ("light-harsh-noon", "harsh midday sun, hard sharp shadows, high contrast, blown highlights, intense overhead light"),
        ("light-moonlit", "moonlit night, cool blue ambient, soft silver highlights, deep shadows, serene nocturnal mood"),
        ("light-firelit-ember", "firelit scene, warm orange ember glow, dancing shadows, dramatic warmth, intimate"),
        ("light-split-dramatic", "split lighting, half face lit half shadow, bold dramatic contrast, mysterious, low key"),
        ("light-soft-window", "soft window light, gentle directional daylight, natural falloff, painterly, vermeer mood"),
        ("light-color-gel", "color gel lighting, dual contrasting hues, magenta and teal, moody, fashion editorial, vibrant"),
        ("light-overcast-flat", "soft overcast light, even diffused grey sky, no harsh shadows, gentle muted tonality"),
    ]),
    "camera": (_NEG_CAMERA, [
        ("cam-fisheye", "fisheye lens, extreme wide angle distortion, curved horizon, bulging perspective, 180 degree view"),
        ("cam-wide-angle", "ultra wide angle lens, 14mm, expansive perspective, exaggerated depth, sweeping foreground"),
        ("cam-telephoto-compression", "telephoto lens 200mm, compressed perspective, flattened background, isolated subject, creamy bokeh"),
        ("cam-bokeh-portrait", "85mm f1.2, dreamy bokeh, razor shallow depth of field, smooth background blur, sharp subject"),
        ("cam-dutch-angle", "dutch angle tilt, dynamic diagonal framing, unsettling composition, dramatic tension"),
        ("cam-low-angle-hero", "low angle hero shot, looking up, towering imposing perspective, dramatic, powerful"),
        ("cam-high-angle-overhead", "high angle overhead shot, looking down, top perspective, contextual, diminutive subject"),
        ("cam-anamorphic", "anamorphic widescreen, horizontal blue lens flare, oval bokeh, 2.39:1 cinematic, film look"),
        ("cam-motion-pan", "motion blur panning shot, sharp subject streaked background, sense of speed, dynamic"),
        ("cam-long-exposure", "long exposure, silky motion trails, light streaks, smooth water, static sharp elements"),
        ("cam-shallow-tilt", "selective focus, tilt lens, plane of focus, blurred surroundings, intimate detail isolation"),
        ("cam-vintage-lens", "vintage lens character, soft glow, swirly bokeh, gentle vignette, helios rendering, dreamy imperfection"),
    ]),
    "material": (_NEG_MATERIAL, [
        ("mat-gold-leaf", "gold leaf material, lustrous metallic sheen, ornate gilded surface, warm reflections, opulent"),
        ("mat-marble", "polished marble material, veined stone, smooth cool surface, subsurface translucence, classical"),
        ("mat-frosted-glass", "frosted glass material, translucent diffusion, soft light scatter, smooth matte transparency"),
        ("mat-rusted-metal", "rusted weathered metal, corroded patina, flaking paint, industrial grit, oxidized texture"),
        ("mat-velvet", "rich velvet material, soft plush nap, deep light absorption, luxurious sheen, tactile fabric"),
        ("mat-holographic", "holographic iridescent material, rainbow shimmer, prismatic reflections, futuristic foil, shifting color"),
        ("mat-wood-grain", "natural wood grain material, warm organic texture, visible rings, matte finish, handcrafted"),
        ("mat-liquid-chrome", "liquid chrome material, mirror polish, flowing reflective metal, high gloss, abstract"),
        ("mat-crystal", "crystal material, faceted transparency, internal refraction, sparkling dispersion, gemstone clarity"),
        ("mat-ceramic-glaze", "glazed ceramic material, smooth glossy coat, subtle crackle, soft highlights, handmade pottery"),
        ("mat-knitted-wool", "knitted wool material, cozy yarn texture, soft fibers, handmade stitch pattern, warm tactile"),
        ("mat-neon-acrylic", "translucent neon acrylic, glowing edge, bright saturated plastic, glossy, vibrant"),
    ]),
    "scifi": (_NEG_SCIFI, [
        ("scifi-cyberpunk-city", "cyberpunk megacity, towering neon skyscrapers, holographic ads, rain-slicked streets, blade runner, dense"),
        ("scifi-solarpunk", "solarpunk utopia, lush green architecture, solar panels, optimistic bright, harmonious nature-tech, airy"),
        ("scifi-space-opera", "space opera, vast starship fleet, nebula backdrop, epic galactic scale, dramatic, cinematic sci-fi"),
        ("scifi-biopunk", "biopunk, organic biotech, fleshy machinery, glowing veins, unsettling living technology, detailed"),
        ("scifi-retro-futurism", "retro futurism, 1950s atomic age vision, chrome rockets, ray guns, optimistic vintage sci-fi"),
        ("scifi-dieselpunk", "dieselpunk, industrial diesel-era machinery, art deco tech, grimy chrome, alternate 1940s, mechanical"),
        ("scifi-hard-sci-fi", "hard sci-fi, plausible realistic spacecraft, functional engineering, NASA punk, grounded detail"),
        ("scifi-alien-world", "alien world, exotic flora, strange atmosphere, twin suns, otherworldly landscape, vivid surreal"),
        ("scifi-post-apocalyptic", "post-apocalyptic wasteland, ruined overgrown city, rusted decay, dust haze, desolate survival, gritty"),
        ("scifi-holographic-ui", "futuristic holographic interface, glowing data displays, translucent screens, sleek tech, blue glow"),
        ("scifi-mecha-hangar", "mecha hangar, giant robots, industrial scaffolding, dramatic spotlights, hard surface detail, scale"),
        ("scifi-space-station", "orbital space station interior, sleek panels, viewport to earth, zero-g, clean futuristic, soft glow"),
    ]),
    "fantasy": (_NEG_FANTASY, [
        ("fantasy-high-epic", "high fantasy epic, grand sweeping vista, mythical scale, dramatic lighting, detailed, lord of the rings"),
        ("fantasy-dark-grim", "dark grimdark fantasy, brooding atmosphere, muted desaturated palette, ominous, gritty, foreboding"),
        ("fantasy-fairytale", "fairytale fantasy, enchanted forest, glowing magic, whimsical storybook, soft luminous, dreamy"),
        ("fantasy-norse-mythic", "norse mythology, rugged frozen landscape, runic carvings, epic gods, cold dramatic, ancient"),
        ("fantasy-eldritch-cosmic", "eldritch cosmic horror, lovecraftian, impossible geometry, tentacled dread, otherworldly, eerie green glow"),
        ("fantasy-enchanted-forest", "enchanted magical forest, glowing flora, floating spores, dappled mystical light, lush detailed"),
        ("fantasy-dragon-lair", "dragon lair, hoarded gold, cavernous dark, glinting treasure, dramatic firelight, epic scale"),
        ("fantasy-celestial", "celestial fantasy, divine heavenly light, ethereal clouds, golden radiance, angelic, luminous"),
        ("fantasy-underwater-kingdom", "underwater fantasy kingdom, coral spires, bioluminescent, flowing currents, magical aquatic, serene"),
        ("fantasy-steampunk", "steampunk fantasy, brass clockwork, victorian machinery, steam pipes, copper gears, ornate retro-tech"),
        ("fantasy-witch-gothic", "gothic witch aesthetic, candlelit potion lab, dark academia, mystical herbs, moody candlelight, ornate"),
        ("fantasy-desert-mystic", "mystic desert fantasy, ancient ruins, shifting dunes, mirage haze, golden sand, lost civilization"),
    ]),
    "mood": (_NEG_MOOD, [
        ("mood-cozy-warm", "cozy warm atmosphere, soft amber light, comfortable intimate, gentle, hygge, inviting"),
        ("mood-melancholic", "melancholic mood, muted desaturated tones, soft rain, wistful solitude, pensive, quiet"),
        ("mood-ethereal-dreamy", "ethereal dreamy atmosphere, soft glowing haze, pastel light, floating, surreal serenity, gentle bloom"),
        ("mood-ominous-tense", "ominous tense atmosphere, dark looming shadows, foreboding, cold palette, suspense, heavy"),
        ("mood-nostalgic", "nostalgic mood, faded warm film tones, soft grain, vintage memory, golden wistful, hazy"),
        ("mood-serene-calm", "serene calm atmosphere, soft balanced light, peaceful stillness, minimal, gentle harmony"),
        ("mood-epic-awe", "epic awe-inspiring mood, vast scale, dramatic god rays, sublime grandeur, sweeping, majestic"),
        ("mood-eerie-liminal", "eerie liminal space, empty unsettling, fluorescent flat light, uncanny stillness, dreamlike dread"),
        ("mood-romantic-soft", "romantic soft mood, warm rosy glow, gentle bokeh, tender intimate, dreamy haze, delicate"),
        ("mood-energetic-vibrant", "energetic vibrant mood, saturated bold color, dynamic, lively, punchy contrast, upbeat"),
        ("mood-foggy-mysterious", "foggy mysterious atmosphere, thick mist, obscured forms, muted, low visibility, haunting"),
        ("mood-festive-joyful", "festive joyful atmosphere, warm bokeh lights, celebratory glow, vibrant, cheerful sparkle"),
    ]),
}


def _build_catalog() -> dict[str, dict[str, str]]:
    """Construye el dict completo {nombre: {prompt, negative_prompt}} desde _CATEGORIES."""
    out: dict[str, dict[str, str]] = {}
    for _cat, (neg, items) in _CATEGORIES.items():
        for name, prompt in items:
            out[name] = {"prompt": prompt, "negative_prompt": neg}
    return out


def comfyui_curated_styles_catalog(category: str | None = None) -> dict:
    """Devuelve el catálogo curado de estilos WAS, o sólo una categoría.

    Args:
        category: si None (default), devuelve TODOS los estilos como dict plano
            {nombre: {"prompt", "negative_prompt"}}. Si es una categoría válida
            (`photography`, `render3d`, `painting`, `anime`, `pixel`, `illustration`,
            `comic`, `lighting`, `camera`, `material`, `scifi`, `fantasy`, `mood`),
            devuelve sólo los estilos de esa categoría. El valor especial `"__categories__"`
            devuelve la lista de categorías y sus conteos (discovery).

    Returns:
        - category None: dict {nombre: {"prompt", "negative_prompt"}} con todos los estilos.
        - category válida: mismo formato, filtrado a esa categoría.
        - category "__categories__": dict {"categories": {cat: count}, "total": int}.

    Raises:
        ValueError: si `category` no es None/"__categories__" ni una categoría conocida.
    """
    if category == "__categories__":
        return {
            "categories": {cat: len(items) for cat, (_neg, items) in _CATEGORIES.items()},
            "total": sum(len(items) for _neg, items in _CATEGORIES.values()),
        }
    if category is None:
        return _build_catalog()
    if category not in _CATEGORIES:
        raise ValueError(
            f"comfyui_curated_styles_catalog: categoría desconocida {category!r}. "
            f"Disponibles: {sorted(_CATEGORIES)}"
        )
    neg, items = _CATEGORIES[category]
    return {name: {"prompt": prompt, "negative_prompt": neg} for name, prompt in items}


if __name__ == "__main__":
    import json

    print(json.dumps(comfyui_curated_styles_catalog("__categories__"), indent=2))
    full = comfyui_curated_styles_catalog()
    print("TOTAL ESTILOS:", len(full))
