#profile-picture-viewer{touch-action:none;overscroll-behavior:contain}
#profile-picture-image{touch-action:none;transform-origin:center;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;will-change:transform}
#attachment-viewer>.page-head,#attachment-viewer>.media-viewer-footer,#attachment-viewer>#attachment-viewer-zoom,
#profile-picture-viewer>header,#profile-picture-viewer>.profile-photo-progress,#profile-picture-viewer>.profile-photo-counter,#profile-picture-viewer>.profile-photo-actions{
 opacity:var(--media-drag-controls,1);transition:opacity 180ms ease-out
}
#attachment-viewer.media-dismiss-dragging>.page-head,#attachment-viewer.media-dismiss-dragging>.media-viewer-footer,
#attachment-viewer.media-dismiss-dragging>#attachment-viewer-zoom,#profile-picture-viewer.media-dismiss-dragging>header,
#profile-picture-viewer.media-dismiss-dragging>.profile-photo-progress,#profile-picture-viewer.media-dismiss-dragging>.profile-photo-actions{
 transition:none;pointer-events:none
}
@media(prefers-reduced-motion:reduce){
 #attachment-viewer>.page-head,#attachment-viewer>.media-viewer-footer,#attachment-viewer>#attachment-viewer-zoom,
 #profile-picture-viewer>header,#profile-picture-viewer>.profile-photo-progress,#profile-picture-viewer>.profile-photo-counter,#profile-picture-viewer>.profile-photo-actions{transition:none}
}

/* Reserve a separate dock: selection badges never share its scrolling layer. */
.attachment-sheet{isolation:isolate}
.attachment-sheet .gallery-body,.attachment-sheet.has-selection .gallery-body{position:relative;isolation:isolate;overflow:auto;padding-bottom:4px;min-height:0}
.attachment-sheet .gallery-head,.attachment-sheet .gallery-grip{flex-shrink:0}
.attachment-sheet .gallery-footer{position:relative;inset:auto;flex:none;margin:7px 12px 0;z-index:2}
.attachment-sheet .gallery-sources{position:relative;inset:auto;flex:none;margin:8px 12px max(10px,env(safe-area-inset-bottom));z-index:2}

/* A readable action sheet replaces the compressed attachment icon strip. */
.attachment-sheet .gallery-sources{display:none!important}
.attachment-sheet .gallery-other-actions{flex:none;display:flex;align-items:center;justify-content:center;gap:10px;margin:8px 12px max(10px,env(safe-area-inset-bottom));padding:12px 16px;min-height:46px;border-radius:16px;background:var(--panel);color:var(--blue);font-size:15px;line-height:1.3;white-space:normal}
.gallery-other-actions .glyph{width:23px;height:23px;flex:none}
#attachment-actions{box-sizing:border-box;width:min(420px,calc(100% - 24px));max-width:none;max-height:min(85dvh,650px);margin:auto auto max(12px,env(safe-area-inset-bottom));padding:10px 12px 12px;border:1px solid var(--line);border-radius:24px;background:var(--bg);color:var(--text);overflow:hidden;box-shadow:0 12px 50px #0006}
#attachment-actions[open]{display:flex;flex-direction:column}
#attachment-actions::backdrop{background:#0006;}
#attachment-actions header{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;padding:2px 4px 8px;margin:0;touch-action:none;user-select:none;-webkit-user-select:none}
#attachment-actions h2{font-size:18px;line-height:1.3;margin:0}
#attachment-actions .attachment-actions-close{width:38px;height:38px;flex:none;font-size:28px}
#attachment-actions .attachment-actions-list{overflow:auto;overscroll-behavior:contain;min-height:0;background:var(--panel);border-radius:16px}
#attachment-actions .attachment-action{box-sizing:border-box;width:100%;min-height:50px;display:flex;align-items:center;gap:14px;padding:12px 15px;border-radius:0;border-bottom:1px solid var(--line);background:none;text-align:left;color:var(--text);font-size:16px;line-height:1.35}
#attachment-actions .attachment-action:last-child{border-bottom:0}
#attachment-actions .attachment-action .glyph{width:24px;height:24px;flex:none;color:var(--blue)}
#attachment-actions .attachment-action span{min-width:0;overflow-wrap:anywhere;white-space:normal}
#attachment-actions .attachment-action:active{background:#409cff22}
#attachment-actions .attachment-actions-cancel{flex:none;width:100%;min-height:46px;margin-top:8px;border-radius:14px;background:var(--panel);color:var(--blue);font-size:16px}
#attachment-viewer-stage,#gif-preview{touch-action:none;overscroll-behavior:contain}
#gif-preview{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;will-change:transform}
#attachment-viewer-content{will-change:transform}

.gallery-action-dock{position:relative;z-index:2;flex:none;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;margin:8px 10px max(10px,env(safe-area-inset-bottom));padding:5px;background:var(--panel);border:1px solid var(--line);border-radius:25px}
.attachment-sheet .gallery-dock-action,.attachment-sheet #gallery-other-actions{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;margin:0;padding:5px 2px;height:60px;min-height:60px;min-width:0;max-width:none;border-radius:19px;background:none;color:var(--text);font-size:11px;line-height:14px}
.gallery-dock-action .glyph{width:24px;height:24px;flex:none}.gallery-dock-action span{max-width:100%;white-space:normal;overflow-wrap:anywhere;text-align:center}
#gallery-library{color:var(--blue);background:#409cff18}
.gallery-camera-tile{grid-row:span 2;position:relative;overflow:hidden;min-height:190px;padding:0;border-radius:0;background:#141416;color:white;touch-action:manipulation}
.gallery-camera-tile video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none}
.gallery-camera-symbol{position:absolute;right:9px;top:9px;display:grid;place-items:center;width:29px;height:29px;border-radius:9px;background:#1117}.gallery-camera-symbol .glyph{width:22px;height:22px}
#attachment-camera{box-sizing:border-box;inset:0;margin:0;padding:0;width:100%;max-width:none;height:100%;max-height:none;background:#000;color:#fff;border:0;border-radius:0;overflow:hidden}
#attachment-camera[open]{display:flex;flex-direction:column}
#attachment-camera header{display:flex;align-items:center;justify-content:space-between;flex:none;margin:0;padding:8px max(12px,env(safe-area-inset-right)) 8px max(12px,env(safe-area-inset-left));min-height:54px;background:#000}
#attachment-camera header .icon{width:44px;height:44px;border-radius:50%;font-size:30px;color:#fff;background:#ffffff18}
#attachment-camera-time{font-size:16px;font-variant-numeric:tabular-nums}
#attachment-camera-stage{flex:1;position:relative;min-height:0;overflow:hidden;background:#070709;display:grid;place-items:center}
#attachment-camera-stage video,#attachment-camera-stage img{width:100%;height:100%;object-fit:contain;position:absolute;inset:0}
#attachment-camera-live{object-fit:cover!important}.mirrored{transform:scaleX(-1)}
#attachment-camera-status{flex:none;min-height:20px;font-size:13px;line-height:1.4;margin:5px 14px;color:#ffd5d5;text-align:center}
#attachment-camera-modes{display:flex;align-items:center;justify-content:center;gap:24px;flex:none;padding:8px}
#attachment-camera-modes button{background:none;color:#999;font-size:13px;padding:6px 2px;letter-spacing:.5px}#attachment-camera-modes button.active{color:#f9d65e}
#attachment-camera footer{height:94px;flex:none;display:flex;align-items:center;justify-content:space-around;gap:14px;padding:8px 16px max(14px,env(safe-area-inset-bottom));margin:0}
#attachment-camera-shutter{width:70px;height:70px;border:4px solid #111;outline:2px solid white;border-radius:50%;background:white;flex:none;padding:0}
#attachment-camera.camera-video #attachment-camera-shutter{background:#ff5264}
#attachment-camera.camera-recording #attachment-camera-shutter{border-radius:16px;width:56px;height:56px;background:#ff5264}
#attachment-camera-retake,#attachment-camera-use{min-height:48px;padding:12px 18px;border-radius:24px;background:#27272e;color:#fff;font-size:16px}#attachment-camera-use{background:#754ce8}
.attachment-sheet{transition:height .24s cubic-bezier(.2,.75,.2,1)}
.attachment-sheet[open],#attachment-actions[open]{animation:attachment-enter .22s cubic-bezier(.2,.75,.2,1)}
@keyframes attachment-enter{from{transform:translateY(35px);opacity:.5}to{transform:translateY(0);opacity:1}}
@media(prefers-reduced-motion:reduce){.attachment-sheet{transition:none}.attachment-sheet[open],#attachment-actions[open]{animation:none}}

#attachment-camera-stage{touch-action:pan-y pinch-zoom}
#attachment-camera-modes{transform:translateX(var(--camera-mode-offset,-47px));transition:transform .22s cubic-bezier(.2,.75,.2,1)}
#attachment-camera-modes button{box-sizing:border-box;width:70px;flex:none;transition:color .18s ease}
#attachment-camera-shutter{transition:background-color .18s ease,border-radius .18s ease}
@media(prefers-reduced-motion:reduce){#attachment-camera-modes,#attachment-camera-modes button,#attachment-camera-shutter{transition:none}}
