.embed-frame .attachment-panel { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 12px 0; }
.embed-frame .attachment-panel[hidden] { display: none; }
.embed-frame form.rich-composer[hidden] { display: none; }
.embed-frame .attachment-options { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-14); color: var(--text-2); }
.embed-frame .attachment-options label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.embed-frame .attachment-panel .attachment-drafts { padding: 0; max-height: 132px; }
.embed-frame .attachment-drafts .attachment-draft { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; width: 190px; padding: 4px 24px 4px 4px; text-align: left; cursor: pointer; }
@media (max-width: 720px) { .embed-frame .attachment-panel .attachment-drafts { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; } .embed-frame .attachment-drafts .attachment-draft { flex: 0 0 auto; width: 160px; } }
.embed-frame .attachment-draft img,
.embed-frame .attachment-draft video,
.embed-frame .attachment-draft-ext { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: var(--radius-s); object-fit: cover; background: var(--bg-3); }
.embed-frame .attachment-draft-ext { display: flex; align-items: center; justify-content: center; font-size: var(--fs-12); font-weight: var(--fw-bold); color: var(--text-2); }
.embed-frame .attachment-draft-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-12); color: var(--text-1); }
.embed-frame .attachment-draft small { font-size: var(--fs-12); color: var(--text-3); }
.embed-frame .attachment-draft-remove { position: absolute; top: 2px; right: 6px; font-size: var(--fs-14); color: var(--text-3); }

.embed-frame .attachment-drop { position: absolute; inset: 0; z-index: 40; display: grid; grid-template-rows: 1fr 1fr; gap: 10px; padding: 12px; background: var(--overlay); }
.embed-frame .attachment-drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed var(--border-2); border-radius: var(--radius-l); background: var(--surface); color: var(--text-1); text-align: center; transition: border-color .12s, background .12s; }
.embed-frame .attachment-drop-zone b { font-size: var(--fs-18); }
.embed-frame .attachment-drop-zone span { font-size: var(--fs-14); color: var(--text-2); }
.embed-frame .attachment-drop-zone.active { border-color: var(--accent); background: var(--bg-3); }

.embed-frame :is(.bubble, .comment) .attachment--pending { position: relative; display: flex; align-items: center; justify-content: center; width: min(320px, calc(360px * var(--photo-ratio, 1.3333))); max-width: 100%; aspect-ratio: var(--photo-ratio, 1.3333); margin: 8px 0 0; overflow: hidden; border-radius: var(--radius-m); background: var(--skeleton); }
.embed-frame :is(.bubble, .comment) .attachment--pending img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(6px); opacity: .7; }
.embed-frame :is(.bubble, .comment) .attachment--pending img.attachment-still { filter: none; opacity: 1; }
.embed-frame .attachment-pending-label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--radius-m); background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--text-1); font-size: var(--fs-14); text-align: center; }
.embed-frame .attachment-pending-label small { font-size: var(--fs-12); opacity: .85; }
.embed-frame .attachment--pending.is-failed { background: var(--danger-soft); }
.embed-frame .attachment-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: attachment-spin .8s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes attachment-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .embed-frame .attachment-spinner { animation: none; } }
.embed-frame :is(.bubble, .comment) .attachment--file { display: flex; align-items: center; gap: 10px; max-width: min(320px, 100%); margin: 8px 0 0; padding: 8px 10px; border: 1px solid var(--border-1); border-radius: var(--radius-m); background: var(--surface); color: var(--text-1); text-decoration: none; }
.embed-frame .attachment-file-icon { display: flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-m); background: var(--bg-3); color: var(--text-2); font-size: var(--fs-12); font-weight: var(--fw-bold); }
.embed-frame .attachment-file-meta { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.embed-frame .attachment-file-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-14); font-weight: var(--fw-bold); }
.embed-frame .attachment-file-meta small,
.embed-frame .attachment-file-state { font-size: var(--fs-12); color: var(--text-3); }
.embed-frame .attachment-file-warning { font-size: var(--fs-12); color: var(--warning); }
.embed-frame .attachment-file-download { margin-left: auto; font-size: var(--fs-18); color: var(--text-2); }
.embed-frame :is(.bubble, .comment) .attachment--audio { display: flex; flex-direction: column; gap: 4px; max-width: min(320px, 100%); margin: 8px 0 0; }
.embed-frame :is(.bubble, .comment) .attachment--audio audio { width: 100%; }

.embed-frame :is(.bubble, .comment) .attachment[data-photo] { --photo-max-w: 320px; --photo-max-h: 360px; display: block; width: min(var(--photo-max-w), calc(var(--photo-max-h) * var(--photo-ratio, 1.3333))); max-width: 100%; aspect-ratio: var(--photo-ratio, 1.3333); margin: 8px 0 0; padding: 0; overflow: hidden; border-radius: var(--radius-m); background: var(--skeleton); line-height: 0; }
.embed-frame :is(.bubble, .comment) .attachment[data-photo] img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; border-radius: inherit; object-fit: cover; }
.embed-frame :is(.bubble, .comment) .attachment[data-photo] { position: relative; isolation: isolate; }
.embed-frame :is(.bubble, .comment) .attachment[data-photo] > .attachment-thumb { position: absolute; inset: 0; filter: blur(10px); transform: scale(1.08); }
.embed-frame :is(.bubble, .comment) .attachment[data-photo] > img:first-child { position: relative; z-index: 1; }
.embed-frame :is(.bubble, .comment) .attachment[data-photo] > img[data-photo-ready] ~ .attachment-thumb { visibility: hidden; }
.embed-frame :is(.bubble, .comment) .attachment--video { position: relative; cursor: pointer; width: min(320px, calc(360px * var(--photo-ratio, 1.7778))); max-width: 100%; margin: 8px 0 0; }
.embed-frame :is(.bubble, .comment) .attachment--video video { display: block; width: 100%; aspect-ratio: var(--photo-ratio, 1.7778); border-radius: var(--radius-m); background: var(--skeleton); object-fit: contain; }
.embed-frame :is(.bubble, .comment) .attachment--video .video-badge { position: absolute; top: 8px; left: 8px; display: flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 4px 2px 8px; border-radius: var(--radius-m); background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--text-1); font-size: var(--fs-12); line-height: var(--lh-tight); }
.embed-frame :is(.bubble, .comment) .attachment--video .video-duration:empty { display: none; }
.embed-frame :is(.bubble, .comment) .attachment--video .video-sound { display: grid; place-items: center; width: 22px; height: 20px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.embed-frame :is(.bubble, .comment) .attachment--video .video-sound svg { width: 16px; height: 16px; }
.embed-frame :is(.bubble, .comment) .attachment--video .attachment-download { display: inline-block; margin-top: 4px; }
@media (max-width: 768px) { .embed-frame :is(.bubble, .comment) .attachment[data-photo] { --photo-max-w: 260px; --photo-max-h: 300px; } }

.embed-frame :is(.bubble, .comment) .attachment-album { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; width: min(360px, 100%); margin: 8px 0 0; overflow: hidden; border-radius: var(--radius-m); }
.embed-frame :is(.bubble, .comment) .attachment-album[data-count="3"] > :first-child,
.embed-frame :is(.bubble, .comment) .attachment-album[data-count="5"] > :first-child,
.embed-frame :is(.bubble, .comment) .attachment-album[data-count="7"] > :first-child,
.embed-frame :is(.bubble, .comment) .attachment-album[data-count="9"] > :first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.embed-frame :is(.bubble, .comment) .attachment-album > .attachment { width: 100%; max-width: none; margin: 0; border-radius: 0; aspect-ratio: 1; }
.embed-frame :is(.bubble, .comment) .attachment-album > .attachment video,
.embed-frame :is(.bubble, .comment) .attachment-album > .attachment img { width: 100%; height: 100%; object-fit: cover; }
.embed-frame :is(.bubble, .comment) .attachment-album .attachment-download { display: none; }

.embed-frame form.rich-composer { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 14px; border: 0; border-radius: 0; background: var(--surface); }
.embed-frame form.rich-composer .composer-plain,
.embed-frame form.rich-composer .composer-emojis,
.embed-frame .rich-composer-tools > :not(.attach-button) { display: none; }
.embed-frame .rich-composer-field { order: 2; flex: 1; min-width: 0; min-height: 42px; max-height: 180px; padding: 10px 14px; border-radius: var(--radius-control); background: var(--bg-3); color: var(--text-1); overflow-y: auto; outline: none; font: inherit; line-height: var(--lh-text); white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.embed-frame .rich-composer-field:empty::before { content: attr(data-placeholder); color: var(--text-3); pointer-events: none; }
.embed-frame .rich-composer-field:focus-visible { box-shadow: inset 0 0 0 1px var(--border-2); }
.embed-frame .rich-composer-field[aria-invalid=true] { box-shadow: inset 3px 0 var(--danger); }
.embed-frame .rich-composer-tools { order: 1; display: flex; flex: 0 0 40px; align-items: center; justify-content: center; height: 42px; }
.embed-frame .rich-composer-tools .attach-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; width: 40px; height: 42px; padding: 9px; color: var(--text-2); background: transparent; border: 0; border-radius: var(--radius-s); cursor: pointer; }
.embed-frame .attach-button svg { width: 23px; height: 23px; }
.embed-frame .rich-composer-tools .attach-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.embed-frame .composer-mention { color: var(--link); background: var(--info-soft); border-radius: var(--radius-s); padding: 0 2px; }
.embed-frame .composer-people { position: absolute; bottom: calc(100% + 6px); left: 12px; width: min(320px, calc(100% - 24px)); max-height: 260px; overflow: auto; z-index: 50; background: var(--surface); border: 1px solid var(--border-1); border-radius: var(--radius-m); padding: 6px; box-shadow: var(--shadow); }
.embed-frame .composer-people button { display: block; width: 100%; text-align: left; border: 0; border-radius: var(--radius-s); padding: 10px 12px; background: var(--surface); color: var(--text-1); cursor: pointer; font: inherit; }
.embed-frame .composer-people button[aria-selected=true],
.embed-frame .composer-people button:hover { background: var(--bg-3); }
.embed-frame .composer-people p { padding: 8px 10px; margin: 0; font-size: var(--fs-14); color: var(--text-3); }
.embed-frame form.rich-composer .composer-send { order: 3; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 42px; align-self: flex-end; width: 42px; max-width: 100%; height: 42px; min-height: 42px; padding: 8px; margin: 0; border: 0; border-radius: 50%; background: transparent; color: var(--link); box-shadow: none; opacity: 1; transition: opacity .12s ease; }
.embed-frame form.rich-composer .composer-send:hover { background: var(--bg-3); }
.embed-frame form.rich-composer .composer-send:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.embed-frame form.rich-composer .composer-send:disabled { opacity: 1; }
.embed-frame form.rich-composer .composer-send svg { display: block; width: 28px; height: 28px; fill: currentColor; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .embed-frame form.rich-composer .composer-send { transition: none; } }
@media (max-width: 600px) { .embed-frame form.rich-composer { padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); gap: 6px; } .embed-frame .rich-composer-field { max-height: 120px; font-size: var(--fs-16); } }

.embed-frame .photo-viewer { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border: 0; background: color-mix(in srgb, var(--media-bg) 94%, transparent); color: var(--on-media); overflow: hidden; }
.embed-frame .photo-viewer::backdrop { background: var(--overlay); }
.embed-frame .photo-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; }
.embed-frame .photo-toolbar { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; min-width: 0; }
.embed-frame .photo-toolbar button,
.embed-frame .photo-toolbar a { background: var(--bg-3); color: inherit; border: 1px solid var(--border-2); border-radius: var(--radius-m); padding: 9px 12px; min-height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.embed-frame .photo-toolbar [data-close] { min-width: 44px; touch-action: manipulation; }
.embed-frame .photo-toolbar [hidden] { display: none; }
.embed-frame .photo-toolbar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.embed-frame .photo-toolbar button:disabled { opacity: .35; }
.embed-frame .photo-stage { position: relative; z-index: 1; isolation: isolate; display: flex; align-items: center; justify-content: center; overflow: hidden; min-height: 0; touch-action: none; }
.embed-frame .photo-stage img,
.embed-frame .photo-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.embed-frame .photo-stage img { cursor: zoom-in; }
.embed-frame .photo-stage.zoomed { overflow: hidden; }
.embed-frame .photo-stage.zoomed img { cursor: zoom-out; }
.embed-frame .photo-caption { font: var(--fs-12)/var(--lh-text) var(--font-sans); color: inherit; opacity: .85; text-align: center; overflow-wrap: anywhere; }
