.gen-media-name{font-weight:500;color:var(--text);overflow-wrap:anywhere;min-width:0}
.gen-media-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;flex-shrink:0}
.gen-images figcaption{flex-wrap:wrap;gap:8px 12px}
.gen-reference-action{display:inline-flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;padding:12px;border:0;border-radius:50%;color:var(--muted);background:transparent;cursor:pointer;transition:background-color .16s,opacity .16s}
.gen-reference-action .gen-glyph{width:20px;height:20px}
.gen-reference-action:disabled{opacity:.5;cursor:wait}
.gen-reference-action:focus-visible{outline:2px solid var(--conversation-muted);outline-offset:3px}
.gen-sent-reference{display:flex;align-items:center;gap:10px;max-width:320px;padding:8px;margin:0 0 8px auto;border:1px solid var(--conversation-line);border-radius:16px;background:var(--conversation-soft);box-sizing:border-box}
.gen-sent-reference img{width:52px;height:52px;object-fit:cover;border-radius:10px;flex:none}
.gen-sent-reference>span{display:flex;flex-direction:column;gap:3px;min-width:0}
.gen-sent-reference strong{font-size:13px;font-weight:500;overflow-wrap:anywhere;color:var(--conversation-ink)}
.gen-sent-reference small{font-size:12px;color:var(--conversation-muted)}
.gen-reference-tray{display:flex;flex-wrap:wrap;align-items:flex-start;gap:10px;padding:14px 14px 0;max-height:212px;overflow-y:auto;scrollbar-width:thin}
.gen-reference-thumb{position:relative;width:80px;min-width:0}
.gen-reference-insert{display:block;position:relative;width:80px;height:80px;padding:0;border:0;border-radius:16px;overflow:hidden;color:#fff;background:var(--conversation-line);touch-action:pan-y;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.gen-reference-insert img{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}
.gen-reference-insert>span{position:absolute;inset:auto 0 0;padding:12px 4px 4px;background:linear-gradient(transparent,#0009);font-size:12px;font-weight:600;text-align:center;pointer-events:none}
.gen-reference-insert.is-holding{outline:2px solid var(--conversation-muted);outline-offset:2px;opacity:.75}
.gen-reference-thumb>small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:1.5;color:var(--conversation-muted);margin-top:3px}
.gen-reference-remove{display:grid;place-items:center;position:absolute;top:-6px;right:-6px;width:44px;height:44px;padding:0;border:0;background:transparent;color:#fff;font-size:23px;line-height:1;isolation:isolate}
.gen-reference-remove::before{content:'';position:absolute;inset:10px;border-radius:50%;background:#333b;z-index:-1}
.gen-reference-insert-hint{width:100%;font-size:11px;color:var(--conversation-muted)}
[data-gen-conversations] .gen-composer-shell .gen-chat-editor{display:block;width:100%;min-width:0;min-height:54px;max-height:144px;overflow-y:auto;padding:14px 16px 6px;border:0;background:transparent;color:var(--conversation-ink);font:inherit;font-size:16px;line-height:28px;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;scrollbar-width:thin;cursor:text}
.gen-chat-editor[data-empty=true]::before{content:attr(data-placeholder);color:var(--conversation-muted);pointer-events:none}
.gen-chat-editor:focus{outline:none}
.gen-reference-chip{display:inline-flex;vertical-align:middle;align-items:center;gap:4px;max-width:100%;height:28px;margin:0 3px;padding:2px 6px 2px 3px;border-radius:7px;background:var(--conversation-line);color:var(--conversation-ink);font-size:14px;line-height:24px;white-space:nowrap;user-select:all;-webkit-user-select:all}
.gen-reference-chip img{display:block;width:22px;height:22px;object-fit:cover;border-radius:4px;pointer-events:none}
[data-gen-conversations] .gen-composer-shell .gen-chat-compose-row{grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;padding:6px 8px 8px;gap:8px}
[data-gen-conversations] .gen-chat-compose-row .gen-composer-tools{grid-column:2;margin:0;padding:0;gap:8px;min-width:0}
[data-gen-conversations] .gen-chat-compose-row #gen-chat-submit{grid-column:3}
/* Keep the inactive editor and its two actions in one 58px capsule. The
 * active layout above still puts the mode tools below the full-width editor. */
[data-gen-conversations] .gen-composer-shell:not(.is-active){display:grid;grid-template-columns:44px minmax(0,1fr) 44px;grid-template-areas:"references references references" "upload prompt submit";align-items:center;column-gap:8px;padding:6px}
[data-gen-conversations] .gen-composer-shell:not(.is-active) .gen-reference-tray{grid-area:references;padding:8px 8px 6px}
[data-gen-conversations] .gen-composer-shell:not(.is-active) .gen-chat-editor{grid-area:prompt;min-height:44px;max-height:44px;padding:8px 2px;overflow:hidden}
[data-gen-conversations] .gen-composer-shell:not(.is-active) .gen-chat-compose-row{display:contents}
[data-gen-conversations] .gen-composer-shell:not(.is-active) #gen-chat-upload{grid-area:upload}
[data-gen-conversations] .gen-composer-shell:not(.is-active) #gen-chat-submit{grid-area:submit}
#gen-manual-modes .gen-composer-tools{margin:0 0 20px;padding:0}
@media(hover:hover){.gen-reference-action:hover{background:var(--tg-soft);color:var(--text)}}
@media(max-height:500px){.gen-reference-tray{max-height:104px}[data-gen-conversations] .gen-composer-shell .gen-chat-editor{max-height:72px}}
/* Keyboard height can change without a CSS media-query change. Keep the
 * toolbar outside the editor/reference scrollers, including in landscape. */
[data-gen-conversations].gen-keyboard-open .gen-chat-form{display:flex;flex-direction:column;max-height:calc(100% - 24px);margin-bottom:12px}
[data-gen-conversations].gen-keyboard-open .gen-composer-shell{min-height:0}
[data-gen-conversations].gen-keyboard-open .gen-composer-shell.is-active{display:flex;flex-direction:column;overflow:hidden}
[data-gen-conversations].gen-keyboard-open .gen-composer-shell.is-active .gen-reference-tray{flex:0 1 auto;min-height:0}
[data-gen-conversations].gen-keyboard-open .gen-composer-shell.is-active .gen-chat-editor{flex:0 1 auto}
[data-gen-conversations].gen-keyboard-open .gen-chat-compose-row{flex:none}
@media(prefers-reduced-motion:reduce){.gen-reference-action{transition:none}}


.gen-material-excerpt{padding:10px 8px 24px;color:var(--conversation-ink);background:var(--conversation-soft);font-size:11px;line-height:1.5;text-align:left;overflow:hidden;height:100%;box-sizing:border-box;overflow-wrap:anywhere}
.gen-reference-insert[aria-pressed=true]{outline:1px solid var(--conversation-muted);outline-offset:2px}
