.images-dialog{width:min(1180px,96vw);max-width:1180px;max-height:92dvh;padding:0;border:1px solid #38383c;border-radius:22px;background:#181819;color:#eee;box-shadow:0 32px 120px #0009}
.images-dialog .images-header{position:sticky;top:0;z-index:2;background:#181819}
.chat-image-card{margin:14px 0;max-width:720px;border:1px solid #ffffff16;border-radius:18px;background:#222224;padding:18px;overflow:hidden}.chat-image-card.is-pending{max-width:420px}.chat-image-stage{display:flex;justify-content:space-between;gap:20px;margin-bottom:16px;font-size:14px}.chat-image-stage strong{font-variant-numeric:tabular-nums;color:#c5bfdc}.chat-image-progress{height:5px;border-radius:8px;background:#ffffff13;overflow:hidden;margin-bottom:12px}.chat-image-progress>div{height:100%;background:#b4a8d5;border-radius:inherit;transition:width .4s ease}.chat-image-card small{display:block;font-size:11px;line-height:1.5;color:#aaa}.chat-image-card>.button{margin-top:12px;font-size:11px}.chat-image-provider{margin-top:14px}.chat-image-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin-top:12px}.chat-image-tile{min-width:0}.chat-image-preview{display:block;width:100%;border:0;padding:0;background:repeating-conic-gradient(#303033 0 25%,#27272a 0 50%) 0/20px 20px;border-radius:10px;overflow:hidden;cursor:zoom-in}.chat-image-preview img{display:block;width:100%;max-height:400px;object-fit:contain}.chat-image-buttons{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}.chat-image-buttons .button{padding:6px 9px;font-size:11px}.chat-image-selection{display:flex;align-items:center;gap:12px;font-size:12px;padding:8px 12px;color:#cbc4dc}.chat-image-selection button{font-size:11px;padding:3px 8px}.chat-image-complete{color:#b8c8b3!important}@media(max-width:480px){.chat-image-card{padding:14px}.chat-image-grid{grid-template-columns:1fr}}@media(prefers-reduced-motion:reduce){.chat-image-progress>div{transition:none}}
.images-dialog::backdrop,.images-viewer::backdrop{background:#000a;backdrop-filter:blur(5px)}
.images-dialog [hidden]{display:none!important}.images-header{display:flex;align-items:center;justify-content:space-between;padding:22px 28px;border-bottom:1px solid #ffffff12}.images-header h2{margin:4px 0 0;font-size:26px;font-weight:550}.images-eyebrow{font-size:10px;letter-spacing:.2em;color:#aaa}.images-layout{display:grid;grid-template-columns:340px 1fr;min-height:540px}.images-controls{padding:24px;border-right:1px solid #ffffff12;display:flex;flex-direction:column;gap:20px}.images-controls label{display:flex;flex-direction:column;gap:8px;font-size:12px;color:#ccc}.images-controls textarea,.images-controls select{box-sizing:border-box;width:100%;background:#232325;color:#eee;border:1px solid #424246;border-radius:10px;padding:10px;font:inherit}.images-controls textarea{min-height:130px;resize:vertical;line-height:1.6}.images-controls :focus-visible,.images-results :focus-visible{outline:2px solid #b8afff;outline-offset:3px}.images-options{display:grid;grid-template-columns:1fr 1fr;gap:14px}.images-dialog h3{font-size:14px;margin:0 0 10px}.images-muted,.images-notice{font-size:11px;line-height:1.6;color:#aaa;margin:0 0 12px}.images-notice{margin:0;padding-top:14px;border-top:1px solid #ffffff12}.images-target{display:flex;gap:8px;flex-wrap:wrap}.images-target p{width:100%}.images-flags{display:grid;gap:12px}.images-dialog .images-check{flex-direction:row;align-items:center;gap:8px}.images-check input{accent-color:#b8afff}.images-actions,.images-card-actions{display:flex;gap:8px;flex-wrap:wrap}.images-dialog button{cursor:pointer}.images-dialog button:disabled{cursor:wait;opacity:.5}.images-status{font-size:12px;line-height:1.5;min-height:18px;margin:0;color:#bbb}.images-status.is-error{color:#f0a3a3}.images-working .images-status:before{content:'';display:inline-block;width:8px;height:8px;border-radius:50%;background:#b8afff;margin-right:8px;animation:imagesPulse 1.4s infinite}.images-results{padding:24px;min-width:0;background:linear-gradient(145deg,#21212466,transparent 60%)}.images-history-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.images-gallery{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.images-card{min-width:0;border:1px solid #ffffff12;background:#232325;border-radius:14px;overflow:hidden;padding-bottom:12px}.images-preview{border:0;width:100%;padding:0;display:block;background:repeating-conic-gradient(#303033 0 25%,#27272a 0 50%) 0/20px 20px}.images-preview img{width:100%;height:220px;object-fit:contain;display:block}.images-caption{margin:12px 12px 6px;font-size:12px;line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.images-card small{display:block;margin:0 12px 12px;color:#aaa;font-size:10px}.images-card-actions{margin:0 12px;gap:6px}.images-card-actions button{padding:5px 7px;font-size:11px}.images-card details{font-size:11px;margin:12px;color:#aaa;overflow-wrap:anywhere}.images-empty{padding:100px 20px;text-align:center;color:#aaa}.images-empty h3{font-size:20px;color:#ddd;margin:14px}.images-empty p{font-size:13px;line-height:1.6;max-width:300px;margin:auto}.images-empty-mark{font-size:40px;color:#b8afff}.images-reference{display:flex;align-items:center;gap:8px;margin:10px 0}.images-reference img{width:42px;height:42px;object-fit:cover;border-radius:8px}.images-reference label{flex:1}.images-reference button{font-size:11px;padding:6px}.images-mask-stage{position:relative;line-height:0;margin:10px 0}.images-mask-stage img{width:100%;height:auto}.images-mask-stage canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:crosshair}.images-mask input[type=range]{width:100px}.images-viewer{padding:12px;border:1px solid #444;background:#181819;color:white;max-width:96vw;max-height:95dvh;border-radius:12px}.images-viewer img{display:block;max-width:90vw;max-height:80dvh;object-fit:contain;margin-top:12px}.images-controls .button,.images-header .button,.images-results .button{border-radius:8px}.images-results>button{margin-top:20px}@keyframes imagesPulse{50%{opacity:.3}}@media(prefers-reduced-motion:reduce){.images-working .images-status:before{animation:none}}@media(max-width:760px){.images-dialog{width:96vw;max-height:94dvh;border-radius:16px}.images-header{padding:16px}.images-layout{grid-template-columns:1fr}.images-controls{padding:18px;border-right:0;border-bottom:1px solid #ffffff12}.images-results{padding:18px}.images-gallery{gap:10px}.images-preview img{height:170px}.images-empty{padding:45px 10px}}@media(max-width:380px){.images-gallery{grid-template-columns:1fr}}

.analysis-card pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:280px;overflow:auto}.analysis-card progress{width:100%;accent-color:#bda8d6}.analysis-table{overflow:auto;max-height:320px}.analysis-table table{border-collapse:collapse;font-size:12px}.analysis-table td,.analysis-table th{padding:6px 10px;border-bottom:1px solid #444;text-align:left;max-width:240px;overflow-wrap:anywhere}

/* Creating image: the real stage above a dotted canvas. The dots fill in only while the picture is
   drawn (sampling steps); the pill shows a percentage only when one is measured. */
.chat-image-card.is-creating{background:transparent;border:0;padding:0;max-width:440px}
.chat-image-title{margin:2px 0 12px;font-size:15px;color:#9c9c9c;background:linear-gradient(90deg,#8d8d8d 0%,#f1f1f1 45%,#8d8d8d 90%) 0 0/220% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:image-title 2.6s linear infinite}
.chat-image-dots{--progress:0;position:relative;width:min(440px,100%,calc(540px * var(--ratio,1)));aspect-ratio:1;border-radius:16px;overflow:hidden;background:radial-gradient(circle,#ffffff17 1px,transparent 1.35px) 0 0/15px 15px}
.chat-image-dots::before,.chat-image-dots::after{content:'';position:absolute;inset:0;background:radial-gradient(circle,#5b8cf0 1.15px,transparent 1.6px) 0 0/15px 15px}
.chat-image-dots::before{opacity:calc(.25 + var(--progress) * .75);-webkit-mask:linear-gradient(180deg,#000 calc(var(--progress) * 100%),#0003 calc(var(--progress) * 100% + 18%));mask:linear-gradient(180deg,#000 calc(var(--progress) * 100%),#0003 calc(var(--progress) * 100% + 18%));transition:opacity .5s ease}
.chat-image-dots::after{background-image:radial-gradient(circle,#a9c4ff 1.3px,transparent 1.8px);-webkit-mask:linear-gradient(115deg,#0000 35%,#000 50%,#0000 65%) 0 0/260% 100%;mask:linear-gradient(115deg,#0000 35%,#000 50%,#0000 65%) 0 0/260% 100%;animation:image-dots 2.2s linear infinite}
.chat-image-percent{position:absolute;right:12px;bottom:12px;z-index:1;padding:4px 10px;border-radius:999px;background:#1d1d20e6;color:#7fa8ff;font-size:13px;font-variant-numeric:tabular-nums}
.chat-image-card.is-creating>small{margin-top:8px;font-variant-numeric:tabular-nums}
.chat-image-card.is-creating>small:empty{display:none}
@keyframes image-title{to{background-position:-220% 0}}
@keyframes image-dots{from{-webkit-mask-position:130% 0;mask-position:130% 0}to{-webkit-mask-position:-130% 0;mask-position:-130% 0}}
@media(prefers-reduced-motion:reduce){.chat-image-title,.chat-image-dots::after{animation:none}}

/* The finished picture: a rounded card revealed from the dots, an Edit pill and a share/download
   button over it, and a row of small actions under it. */
@property --sweep{syntax:'<percentage>';inherits:false;initial-value:120%}
.chat-image-card.is-done{background:transparent;border:0;padding:0;max-width:440px;overflow:visible}.chat-image-card.is-done.is-multi{max-width:620px}
.chat-image-results{display:grid;gap:10px}
.chat-image-results[data-count="2"],.chat-image-results[data-count="4"]{grid-template-columns:repeat(2,minmax(0,1fr))}
.chat-image-result{--aspect:1 / 1;position:relative;margin:0;width:100%;max-width:min(100%,calc(540px * var(--ratio,1)));aspect-ratio:var(--aspect);border-radius:16px;overflow:hidden;background:#232325;isolation:isolate}
.chat-image-open{position:absolute;inset:0;display:block;width:100%;height:100%;padding:0;border:0;border-radius:inherit;background:none;cursor:zoom-in}
.chat-image-open:focus-visible{outline:2px solid #b8afff;outline-offset:-2px}
.chat-image-open img{position:absolute;inset:0;display:block;width:100%;height:100%;max-height:none;object-fit:cover}
.chat-image-thumb{filter:blur(10px);transform:scale(1.06)}
.chat-image-full{opacity:0;transition:opacity .45s ease}
.chat-image-result.is-sharp .chat-image-full{opacity:1}
.chat-image-result.is-missing.no-thumb .chat-image-open::after{content:'Image unavailable';position:absolute;inset:auto 0 50%;text-align:center;font-size:12px;color:#aaa}
.chat-image-veil{position:absolute;inset:0;z-index:1;pointer-events:none;opacity:0;background:radial-gradient(circle,#a9c4ff 1.3px,transparent 1.8px) 0 0/15px 15px,radial-gradient(circle,#5b8cf0 1.15px,transparent 1.6px) 0 0/15px 15px,#1d1d20}
.chat-image-pill,.chat-image-round{position:absolute;z-index:2;bottom:12px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #ffffff24;background:#16161ac7;color:#f4f4f4;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-shadow:0 2px 10px #0006;cursor:pointer;transition:background .15s ease,transform .15s ease}
.chat-image-pill{left:12px;gap:6px;height:34px;padding:0 14px 0 11px;border-radius:999px;font:inherit;font-size:13px;font-weight:550}
.chat-image-round{right:12px;width:36px;height:36px;border-radius:50%;padding:0}
.chat-image-pill svg,.chat-image-round svg{width:17px;height:17px;stroke-width:1.9}
.chat-image-pill:hover,.chat-image-round:hover{background:#2a2a30e6;transform:translateY(-1px)}
.chat-image-pill:focus-visible,.chat-image-round:focus-visible{outline:2px solid #b8afff;outline-offset:2px}
.chat-image-result.is-revealing .chat-image-open{-webkit-mask-image:linear-gradient(180deg,#000 var(--sweep),#0000 calc(var(--sweep) + 26%));mask-image:linear-gradient(180deg,#000 var(--sweep),#0000 calc(var(--sweep) + 26%));animation:image-reveal var(--reveal,1300ms) cubic-bezier(.2,.7,.2,1) both;animation-delay:var(--reveal-delay,0ms)}
.chat-image-result.is-revealing .chat-image-veil{animation:image-veil var(--reveal,1300ms) ease-out both;animation-delay:var(--reveal-delay,0ms)}
.chat-image-result.is-revealing .chat-image-pill,.chat-image-result.is-revealing .chat-image-round{animation:image-controls .35s ease both;animation-delay:calc(var(--reveal-delay,0ms) + 900ms)}
@keyframes image-reveal{0%{opacity:0;filter:blur(22px) saturate(.4);transform:scale(1.04);--sweep:-26%}55%{opacity:1;filter:blur(6px) saturate(.85)}100%{opacity:1;filter:none;transform:none;--sweep:120%}}
@keyframes image-veil{0%{opacity:1}70%{opacity:.35}100%{opacity:0}}
@keyframes image-controls{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.chat-image-toolbar{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:2px;margin-top:8px}
.chat-image-toolbar .icon-button{width:32px;height:32px;color:var(--quiet,#9b9b96);border-radius:9px}
.chat-image-toolbar .icon-button svg{width:17px;height:17px}.chat-image-toolbar [aria-haspopup=menu] svg{stroke-width:3}
.chat-image-toolbar .icon-button[aria-pressed=true]{color:var(--ink,#eeedea);background:#ffffff12}
.chat-image-toolbar .icon-button[aria-pressed=true] svg{fill:currentColor;fill-opacity:.22}
.message:not(:last-child) .chat-image-again{display:none}
.chat-image-menu{position:absolute;left:150px;top:36px;z-index:20;min-width:190px;padding:5px;border-radius:var(--menu-radius,13px);background:var(--surface-raised,#2c2c2c);box-shadow:var(--menu-shadow,0 14px 36px #0004,0 0 0 1px #ffffff0a)}
.chat-image-menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:9px 11px;border:0;border-radius:9px;background:none;color:var(--ink,#eeedea);font:inherit;font-size:13px;text-align:left;cursor:pointer}
.chat-image-menu-item:hover,.chat-image-menu-item:focus-visible{background:var(--surface-hover,#313131);outline:none}
.chat-image-menu-item svg{width:16px;height:16px;color:var(--muted,#b5b5b0)}
.chat-image-status{min-height:0;margin:4px 0 0;font-size:12px;color:var(--muted,#b5b5b0)}
.chat-image-status:empty{display:none}
.chat-image-card.is-done .chat-image-provider{margin-top:6px;color:#8f8f8a}
@media(max-width:480px){.chat-image-menu{left:auto;right:0}.chat-image-pill{height:32px;padding:0 12px 0 10px}}
@media(prefers-reduced-motion:reduce){.chat-image-result.is-revealing .chat-image-open,.chat-image-result.is-revealing .chat-image-veil,.chat-image-result.is-revealing .chat-image-pill,.chat-image-result.is-revealing .chat-image-round{animation:none}.chat-image-full{transition:none}}
:root[data-reduce-motion=true] .chat-image-result.is-revealing .chat-image-open,:root[data-reduce-motion=true] .chat-image-result.is-revealing .chat-image-veil{animation:none}
